From 0d93d180d5b65314bc4e8443b90fc4d7c44dbcd0 Mon Sep 17 00:00:00 2001 From: Artemus <31190188+Mr-Artemus@users.noreply.github.com> Date: Wed, 14 Sep 2022 22:59:41 +0000 Subject: [PATCH 01/29] feat(#73): Base for plugins with test plugin --- .swcrc | 44 +++++-- mikro-orm.config.ts | 12 +- package.json | 3 + plugins/my-plugin/api/controllers/index.ts | 1 + plugins/my-plugin/api/controllers/plugin.ts | 14 ++ plugins/my-plugin/api/middlewares/index.ts | 1 + plugins/my-plugin/api/middlewares/plugin.ts | 6 + plugins/my-plugin/commands/plugin.ts | 25 ++++ plugins/my-plugin/config/index.ts | 1 + plugins/my-plugin/config/plugin.ts | 3 + plugins/my-plugin/entities/PluginEntity.ts | 24 ++++ plugins/my-plugin/entities/index.ts | 1 + plugins/my-plugin/events/ready.ts | 14 ++ plugins/my-plugin/guards/.gitkeep | 0 plugins/my-plugin/i18n/en.ts | 10 ++ plugins/my-plugin/i18n/fr.ts | 10 ++ plugins/my-plugin/plugin.json | 11 ++ plugins/my-plugin/utils/classes/.gitkeep | 0 plugins/my-plugin/utils/decorators/.gitkeep | 0 plugins/my-plugin/utils/errors/.gitkeep | 0 plugins/my-plugin/utils/functions/.gitkeep | 0 .../my-plugin/utils/types/pluginconfig.d.ts | 3 + src/api/server.ts | 3 +- src/config/api.ts | 2 +- src/config/database.ts | 3 - src/i18n/en/index.ts | 78 +++++------- src/i18n/en/my-plugin/index.ts | 11 ++ src/i18n/fr/index.ts | 43 +++---- src/i18n/fr/my-plugin/index.ts | 11 ++ src/i18n/i18n-types.ts | 45 ++++++- src/i18n/i18n-util.async.ts | 17 ++- src/i18n/i18n-util.sync.ts | 13 +- src/i18n/i18n-util.ts | 6 +- src/i18n/index.ts | 13 +- src/main.ts | 10 +- src/services/Database.ts | 9 +- src/utils/errors/UnknownReply.ts | 2 +- src/utils/functions/index.ts | 3 +- src/utils/functions/plugins.ts | 120 ++++++++++++++++++ tsconfig.json | 45 +++++-- 40 files changed, 506 insertions(+), 111 deletions(-) create mode 100644 plugins/my-plugin/api/controllers/index.ts create mode 100644 plugins/my-plugin/api/controllers/plugin.ts create mode 100644 plugins/my-plugin/api/middlewares/index.ts create mode 100644 plugins/my-plugin/api/middlewares/plugin.ts create mode 100644 plugins/my-plugin/commands/plugin.ts create mode 100644 plugins/my-plugin/config/index.ts create mode 100644 plugins/my-plugin/config/plugin.ts create mode 100644 plugins/my-plugin/entities/PluginEntity.ts create mode 100644 plugins/my-plugin/entities/index.ts create mode 100644 plugins/my-plugin/events/ready.ts create mode 100644 plugins/my-plugin/guards/.gitkeep create mode 100644 plugins/my-plugin/i18n/en.ts create mode 100644 plugins/my-plugin/i18n/fr.ts create mode 100644 plugins/my-plugin/plugin.json create mode 100644 plugins/my-plugin/utils/classes/.gitkeep create mode 100644 plugins/my-plugin/utils/decorators/.gitkeep create mode 100644 plugins/my-plugin/utils/errors/.gitkeep create mode 100644 plugins/my-plugin/utils/functions/.gitkeep create mode 100644 plugins/my-plugin/utils/types/pluginconfig.d.ts create mode 100644 src/i18n/en/my-plugin/index.ts create mode 100644 src/i18n/fr/my-plugin/index.ts create mode 100644 src/utils/functions/plugins.ts diff --git a/.swcrc b/.swcrc index f473f0cb..72c18d52 100644 --- a/.swcrc +++ b/.swcrc @@ -9,18 +9,40 @@ "target": "es2021", "baseUrl": "./", "paths": { - "@types": ["src/utils/types"], - "@decorators": ["src/utils/decorators"], - "@errors": ["src/utils/errors"], - "@entities": ["src/entities"], - "@guards": ["src/guards"], - "@services": ["src/services"], - "@i18n": ["src/i18n"], - "@config": ["src/config"], + "@decorators": ["src/utils/decorators"], + "@decorators/*": ["plugins/*/utils/decorators"], + + "@errors": ["src/utils/errors"], + "@errors/*": ["plugins/*/utils/errors"], + + "@entities": ["src/entities"], + "@entities/*": ["plugins/*/entities"], + + "@guards": ["src/guards"], + "@guards/*": ["plugins/*/guards"], - "@core/*": ["src/core/*"], - "@utils/*": ["src/utils/*"], - "@api/*": ["src/api/*"] + "@services": ["src/services"], + "@services/*": ["plugins/*/services"], + + "@i18n": ["src/i18n"], + "@i18n/*": ["plugins/*/i18n"], + + "@config": ["src/config"], + "@config/*": ["plugins/*/config"], + + "@utils/classes": ["src/utils/classes"], + "@utils/classes/*": ["plugins/*/utils/classes"], + + "@utils/functions": ["src/utils/functions"], + "@utils/functions/*": ["plugins/*/utils/functions"], + + "@api/controllers": ["src/api/controllers"], + "@api/controllers/*": ["plugins/*/api/controllers"], + + "@api/middlewares": ["src/api/middlewares"], + "@api/middlewares/*": ["plugins/*/api/middlewares"], + + "@api/server": ["src/api/server.ts"] }, "transform": { "decoratorMetadata": true diff --git a/mikro-orm.config.ts b/mikro-orm.config.ts index 247e2a1a..653c8444 100644 --- a/mikro-orm.config.ts +++ b/mikro-orm.config.ts @@ -1,3 +1,13 @@ import { mikroORMConfig } from './src/config/database' +import * as entities from '@entities' +import { getPluginsEntities } from '@utils/functions' +import { Options } from '@mikro-orm/core' + +export default async () => { + let config = mikroORMConfig[process.env.NODE_ENV || 'development'] as Options + + config.entities = [...Object.values(entities), ...Object.values(await getPluginsEntities())] + + return config +} -export default mikroORMConfig[process.env.NODE_ENV || 'development'] \ No newline at end of file diff --git a/package.json b/package.json index 4ab878d0..186ef634 100644 --- a/package.json +++ b/package.json @@ -114,5 +114,8 @@ }, "overrides": { "validator": "13.7.0" + }, + "nodemonConfig": { + "ignore": ["src/i18n/**/!(index.ts)"] } } diff --git a/plugins/my-plugin/api/controllers/index.ts b/plugins/my-plugin/api/controllers/index.ts new file mode 100644 index 00000000..6d3c1bdc --- /dev/null +++ b/plugins/my-plugin/api/controllers/index.ts @@ -0,0 +1 @@ +export * from './plugin' \ No newline at end of file diff --git a/plugins/my-plugin/api/controllers/plugin.ts b/plugins/my-plugin/api/controllers/plugin.ts new file mode 100644 index 00000000..8c36162f --- /dev/null +++ b/plugins/my-plugin/api/controllers/plugin.ts @@ -0,0 +1,14 @@ +import { BaseController } from "@utils/classes" +import { Get, JsonController, UseBefore } from "routing-controllers" +import { pluginMiddleware } from "@api/middlewares/my-plugin" + +@JsonController("/plugin") +export class PluginController extends BaseController { + + @Get('/name') + @UseBefore(pluginMiddleware) + async name() { + + return { name: 'my-plugin' } + } +} \ No newline at end of file diff --git a/plugins/my-plugin/api/middlewares/index.ts b/plugins/my-plugin/api/middlewares/index.ts new file mode 100644 index 00000000..6d3c1bdc --- /dev/null +++ b/plugins/my-plugin/api/middlewares/index.ts @@ -0,0 +1 @@ +export * from './plugin' \ No newline at end of file diff --git a/plugins/my-plugin/api/middlewares/plugin.ts b/plugins/my-plugin/api/middlewares/plugin.ts new file mode 100644 index 00000000..f2547c6b --- /dev/null +++ b/plugins/my-plugin/api/middlewares/plugin.ts @@ -0,0 +1,6 @@ +import { NextFunction, Request, Response } from "express" + +export async function pluginMiddleware(req: Request, res: Response, next: NextFunction) { + if(req.query.plugin == "true") next() + else res.status(400).send("Plugin param not found") +} \ No newline at end of file diff --git a/plugins/my-plugin/commands/plugin.ts b/plugins/my-plugin/commands/plugin.ts new file mode 100644 index 00000000..73ae566c --- /dev/null +++ b/plugins/my-plugin/commands/plugin.ts @@ -0,0 +1,25 @@ +import { Client } from "discordx" +import { Category } from "@discordx/utilities" +import { CommandInteraction } from "discord.js" + +import { Discord, Slash } from "@decorators" +import { Guard } from "@guards" +import { pluginConfig } from "@config/my-plugin" + +@Discord() +@Category('General') +export default class PluginCommand { + + @Slash({ + name: 'plugin', + description: 'Here goes the command description!' + }) + @Guard() + async plugin( + interaction: CommandInteraction, + client: Client, + { localize }: InteractionData + ) { + interaction.followUp('Plugin command works!\nconfig: '+pluginConfig.enabled); + } +} \ No newline at end of file diff --git a/plugins/my-plugin/config/index.ts b/plugins/my-plugin/config/index.ts new file mode 100644 index 00000000..4a8b37d4 --- /dev/null +++ b/plugins/my-plugin/config/index.ts @@ -0,0 +1 @@ +export * from './plugin'; \ No newline at end of file diff --git a/plugins/my-plugin/config/plugin.ts b/plugins/my-plugin/config/plugin.ts new file mode 100644 index 00000000..5765db89 --- /dev/null +++ b/plugins/my-plugin/config/plugin.ts @@ -0,0 +1,3 @@ +export const pluginConfig: pluginConfigType = { + enabled: false, +} \ No newline at end of file diff --git a/plugins/my-plugin/entities/PluginEntity.ts b/plugins/my-plugin/entities/PluginEntity.ts new file mode 100644 index 00000000..978bf0ca --- /dev/null +++ b/plugins/my-plugin/entities/PluginEntity.ts @@ -0,0 +1,24 @@ +import { Entity, PrimaryKey, Property, EntityRepositoryType } from '@mikro-orm/core' +import { EntityRepository } from '@mikro-orm/sqlite' + +// =========================================== +// ================= Entity ================== +// =========================================== + +@Entity({ customRepository: () => PluginEntityRepository }) +export class PluginEntity { + + [EntityRepositoryType]?: PluginEntityRepository + + @PrimaryKey({ autoincrement: false }) + id: string + +} + +// =========================================== +// =========== Custom Repository ============= +// =========================================== + +export class PluginEntityRepository extends EntityRepository { + +} \ No newline at end of file diff --git a/plugins/my-plugin/entities/index.ts b/plugins/my-plugin/entities/index.ts new file mode 100644 index 00000000..3c2c1f70 --- /dev/null +++ b/plugins/my-plugin/entities/index.ts @@ -0,0 +1 @@ +export * from './PluginEntity' \ No newline at end of file diff --git a/plugins/my-plugin/events/ready.ts b/plugins/my-plugin/events/ready.ts new file mode 100644 index 00000000..2af3fe27 --- /dev/null +++ b/plugins/my-plugin/events/ready.ts @@ -0,0 +1,14 @@ +import { injectable } from 'tsyringe' + +import { Once, Discord } from '@decorators' + + +@Discord() +@injectable() +export default class ReadyEvent { + + @Once('ready') + async readyHandler() { + console.log("Plugin: Bot ready !") + } +} \ No newline at end of file diff --git a/plugins/my-plugin/guards/.gitkeep b/plugins/my-plugin/guards/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/plugins/my-plugin/i18n/en.ts b/plugins/my-plugin/i18n/en.ts new file mode 100644 index 00000000..2a20af44 --- /dev/null +++ b/plugins/my-plugin/i18n/en.ts @@ -0,0 +1,10 @@ +import { BaseTranslation } from "typesafe-i18n"; + +const en: BaseTranslation = { + PLUGIN: { + NAME: "My Plugin", + DESCRIPTION: "My Plugin Description", + } +} + +export default en \ No newline at end of file diff --git a/plugins/my-plugin/i18n/fr.ts b/plugins/my-plugin/i18n/fr.ts new file mode 100644 index 00000000..12e13707 --- /dev/null +++ b/plugins/my-plugin/i18n/fr.ts @@ -0,0 +1,10 @@ +import { BaseTranslation } from "typesafe-i18n"; + +const fr: BaseTranslation = { + PLUGIN: { + NAME: "Mon Plugin", + DESCRIPTION: "Description de Mon Plugin", + } +} + +export default fr \ No newline at end of file diff --git a/plugins/my-plugin/plugin.json b/plugins/my-plugin/plugin.json new file mode 100644 index 00000000..f56bdcfa --- /dev/null +++ b/plugins/my-plugin/plugin.json @@ -0,0 +1,11 @@ +{ + "author": "John Doe", + "name": "My Awesome Plugin", + "version": "1.0.0", + "tscordRequiredVersion": "1.0.0", + "description": "This plugin does awesome things", + "source": "https://github.com/johndoe/my-awesome-plugin", + "dependencies": { + "my-other-plugin": "1.0.0" + } +} \ No newline at end of file diff --git a/plugins/my-plugin/utils/classes/.gitkeep b/plugins/my-plugin/utils/classes/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/plugins/my-plugin/utils/decorators/.gitkeep b/plugins/my-plugin/utils/decorators/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/plugins/my-plugin/utils/errors/.gitkeep b/plugins/my-plugin/utils/errors/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/plugins/my-plugin/utils/functions/.gitkeep b/plugins/my-plugin/utils/functions/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/plugins/my-plugin/utils/types/pluginconfig.d.ts b/plugins/my-plugin/utils/types/pluginconfig.d.ts new file mode 100644 index 00000000..3a78f074 --- /dev/null +++ b/plugins/my-plugin/utils/types/pluginconfig.d.ts @@ -0,0 +1,3 @@ +type pluginConfigType = { + enabled: boolean; +} \ No newline at end of file diff --git a/src/api/server.ts b/src/api/server.ts index 3fc1db4b..b5add07b 100644 --- a/src/api/server.ts +++ b/src/api/server.ts @@ -1,6 +1,7 @@ import * as controllers from "@api/controllers" import { log } from "@api/middlewares" import { Logger } from "@services" +import { getPluginsControllers } from "@utils/functions" import express, { Application } from "express" import { ClassConstructor, ExpressErrorMiddlewareInterface, getMetadataArgsStorage, IocAdapter, Middleware, useContainer, useExpressServer } from "routing-controllers" import { routingControllersToSpec } from "routing-controllers-openapi" @@ -26,7 +27,7 @@ export class Server { this.setupSwaggerUi() useExpressServer(this.server, { - controllers: Object.values(controllers), + controllers: [...Object.values(controllers), ...Object.values(await getPluginsControllers())], defaultErrorHandler: false }) diff --git a/src/config/api.ts b/src/config/api.ts index c9bda5d1..224cee39 100644 --- a/src/config/api.ts +++ b/src/config/api.ts @@ -1,5 +1,5 @@ export const apiConfig: APIConfigType = { - enabled: false, + enabled: true, port: process.env['API_PORT'] ? parseInt(process.env['API_PORT']) : 4000, } \ No newline at end of file diff --git a/src/config/database.ts b/src/config/database.ts index 9e1300a7..d18972fb 100644 --- a/src/config/database.ts +++ b/src/config/database.ts @@ -1,8 +1,6 @@ import { Options } from '@mikro-orm/core' import { SqlHighlighter } from '@mikro-orm/sql-highlighter' -import * as entities from '@entities' - export const databaseConfig: DatabaseConfigType = { path: './database/', @@ -61,7 +59,6 @@ const envMikroORMConfig: { production: Options, development?: Options } = { // user: process.env['DATABASE_USER'], // password: process.env['DATABASE_PASSWORD'], - entities: Object.values(entities), highlighter: new SqlHighlighter(), allowGlobalContext: true, debug: false, diff --git a/src/i18n/en/index.ts b/src/i18n/en/index.ts index 2520f9a3..0cf64c3d 100644 --- a/src/i18n/en/index.ts +++ b/src/i18n/en/index.ts @@ -1,77 +1,67 @@ -import type { BaseTranslation } from "../i18n-types" +/* eslint-disable */ +import type { BaseTranslation } from '../i18n-types' const en: BaseTranslation = { - GUARDS: { - DISABLED_COMMAND: "This command is currently desactivated.", - MAINTENANCE: "This bot is currently in maintenance mode.", - GUILD_ONLY: "This command can only be used in a server.", - NSFW: "This command can only be used in a NSFW channel.", + DISABLED_COMMAND: 'This command is currently desactivated.', + MAINTENANCE: 'This bot is currently in maintenance mode.', + GUILD_ONLY: 'This command can only be used in a server.', + NSFW: 'This command can only be used in a NSFW channel.', }, - ERRORS: { - UNKNOWN: "An unknown error occured.", + UNKNOWN: 'An unknown error occured.', }, - COMMANDS: { INVITE: { - DESCRIPTION: "Invite the bot to your server!", - + DESCRIPTION: 'Invite the bot to your server!', EMBED: { - TITLE: "Invite me on your server!", - DESCRIPTION: "[Click here]({link}) to invite me!" - } + TITLE: 'Invite me on your server!', + DESCRIPTION: '[Click here]({link}) to invite me!', + }, }, PREFIX: { NAME: 'prefix', - DESCRIPTION: "Change the prefix of the bot.", + DESCRIPTION: 'Change the prefix of the bot.', OPTIONS: { PREFIX: { - NAME: "new_prefix", - DESCRIPTION: "The new prefix of the bot.", - } + NAME: 'new_prefix', + DESCRIPTION: 'The new prefix of the bot.', + }, }, - EMBED: { - DESCRIPTION: "Prefix changed to `{prefix:string}`." - } + DESCRIPTION: 'Prefix changed to `{prefix:string}`.', + }, }, MAINTENANCE: { - DESCRIPTION: "Set the maintenance mode of the bot.", - + DESCRIPTION: 'Set the maintenance mode of the bot.', EMBED: { - DESCRIPTION: "Maintenance mode set to `{state:string}`." - } + DESCRIPTION: 'Maintenance mode set to `{state:string}`.', + }, }, STATS: { - DESCRIPTION: "Get some stats about the bot.", - + DESCRIPTION: 'Get some stats about the bot.', HEADERS: { - COMMANDS: "Commands", - GUILDS: "Guild", - ACTIVE_USERS: "Active Users", - USERS: "Users", - } + COMMANDS: 'Commands', + GUILDS: 'Guild', + ACTIVE_USERS: 'Active Users', + USERS: 'Users', + }, }, HELP: { DESCRIPTION: 'Get global help about the bot and its commands', - EMBED: { - TITLE: "Help pannel", - CATEGORY_TITLE: "{category:string} Commands", - + TITLE: 'Help pannel', + CATEGORY_TITLE: '{category:string} Commands', }, - SELECT_MENU: { - TITLE: "Select a category", - CATEGORY_DESCRIPTION: "{category:string} commands", - } + TITLE: 'Select a category', + CATEGORY_DESCRIPTION: '{category:string} commands', + }, }, PING: { - DESCRIPTION: "Pong!", - - MESSAGE: "{member:string} Pong! The message round-trip took {time:number}ms.{heartbeat:string}" - } + DESCRIPTION: 'Pong!', + MESSAGE: '{member:string} Pong! The message round-trip took {time:number}ms.{heartbeat:string}', + }, }, } diff --git a/src/i18n/en/my-plugin/index.ts b/src/i18n/en/my-plugin/index.ts new file mode 100644 index 00000000..927fa861 --- /dev/null +++ b/src/i18n/en/my-plugin/index.ts @@ -0,0 +1,11 @@ +/* eslint-disable */ +import type { BaseTranslation } from '../../i18n-types' + +const en_my_plugin: BaseTranslation = { + PLUGIN: { + NAME: 'My Plugin', + DESCRIPTION: 'My Plugin Description', + }, +} + +export default en_my_plugin diff --git a/src/i18n/fr/index.ts b/src/i18n/fr/index.ts index e46ebc4c..be67e8ef 100644 --- a/src/i18n/fr/index.ts +++ b/src/i18n/fr/index.ts @@ -1,76 +1,67 @@ +/* eslint-disable */ import type { Translation } from '../i18n-types' const fr: Translation = { - GUARDS: { DISABLED_COMMAND: 'Cette commande est désactivée.', MAINTENANCE: 'Ce bot est en mode maintenance.', - GUILD_ONLY: 'Cette commande ne peut être utilisée qu\'en serveur.', + GUILD_ONLY: "Cette commande ne peut être utilisée qu'en serveur.", NSFW: 'Cette commande ne peut être utilisée que dans un salon NSFW.', }, - ERRORS: { UNKNOWN: 'Une erreur est survenue.', }, - COMMANDS: { INVITE: { DESCRIPTION: 'Invitez le bot sur votre serveur!', - EMBED: { TITLE: 'Invite moi sur ton serveur!', - DESCRIPTION: '[Clique ici]({link}) pour m\'inviter!' - } + DESCRIPTION: "[Clique ici]({link}) pour m'inviter!", + }, }, PREFIX: { NAME: 'prefixe', DESCRIPTION: 'Change le préfix du bot.', OPTIONS: { PREFIX: { - NAME: "nouveau_prefix", - DESCRIPTION: "Le nouveau préfix du bot.", - } + NAME: 'nouveau_prefix', + DESCRIPTION: 'Le nouveau préfix du bot.', + }, }, - EMBED: { - DESCRIPTION: 'Prefix changé en `{prefix}`.' - } + DESCRIPTION: 'Prefix changé en `{prefix}`.', + }, }, MAINTENANCE: { DESCRIPTION: 'Met le mode maintenance du bot.', - EMBED: { - DESCRIPTION: 'Le mode maintenance a été définie à `{state}`.' - } + DESCRIPTION: 'Le mode maintenance a été définie à `{state}`.', + }, }, STATS: { DESCRIPTION: 'Obtiens des statistiques sur le bot.', - HEADERS: { COMMANDS: 'Commandes', GUILDS: 'Serveurs', ACTIVE_USERS: 'Utilisateurs actifs', USERS: 'Utilisateurs', - } + }, }, HELP: { - DESCRIPTION: 'Obtenez de l\'aide globale sur le bot et ses commandes', - + DESCRIPTION: "Obtenez de l'aide globale sur le bot et ses commandes", EMBED: { TITLE: "Pannel d'aide", CATEGORY_TITLE: 'Commandes de {category}', }, - SELECT_MENU: { TITLE: 'Sélectionnez une catégorie', CATEGORY_DESCRIPTION: 'Commandes de {category}', - } + }, }, PING: { - DESCRIPTION: "Pong!", - - MESSAGE: "{member} Pong! Le temps de réponse de la réponse était {time}ms.{heartbeat}", - } + DESCRIPTION: 'Pong!', + MESSAGE: '{member} Pong! Le temps de réponse de la réponse était {time}ms.{heartbeat}', + }, }, } diff --git a/src/i18n/fr/my-plugin/index.ts b/src/i18n/fr/my-plugin/index.ts new file mode 100644 index 00000000..cf1d301d --- /dev/null +++ b/src/i18n/fr/my-plugin/index.ts @@ -0,0 +1,11 @@ +/* eslint-disable */ +import type { NamespaceMyPluginTranslation } from '../../i18n-types' + +const fr_my_plugin: NamespaceMyPluginTranslation = { + PLUGIN: { + NAME: 'Mon Plugin', + DESCRIPTION: 'Description de Mon Plugin', + }, +} + +export default fr_my_plugin diff --git a/src/i18n/i18n-types.ts b/src/i18n/i18n-types.ts index e2bbd146..8c450fbf 100644 --- a/src/i18n/i18n-types.ts +++ b/src/i18n/i18n-types.ts @@ -2,16 +2,19 @@ /* eslint-disable */ import type { BaseTranslation as BaseTranslationType, LocalizedString, RequiredParams } from 'typesafe-i18n' -export type BaseTranslation = BaseTranslationType +export type BaseTranslation = BaseTranslationType & DisallowNamespaces export type BaseLocale = 'en' export type Locales = | 'en' | 'fr' -export type Translation = RootTranslation +export type Translation = RootTranslation & DisallowNamespaces -export type Translations = RootTranslation +export type Translations = RootTranslation & +{ + 'my-plugin': NamespaceMyPluginTranslation +} type RootTranslation = { GUARDS: { @@ -166,6 +169,30 @@ type RootTranslation = { } } +export type NamespaceMyPluginTranslation = { + PLUGIN: { + /** + * My Plugin + */ + NAME: string + /** + * My Plugin Description + */ + DESCRIPTION: string + } +} + +export type Namespaces = + | 'my-plugin' + +type DisallowNamespaces = { + /** + * reserved for 'my-plugin'-namespace\ + * you need to use the `./my-plugin/index.ts` file instead + */ + 'my-plugin'?: "[typesafe-i18n] reserved for 'my-plugin'-namespace. You need to use the `./my-plugin/index.ts` file instead." +} + export type TranslationFunctions = { GUARDS: { /** @@ -309,6 +336,18 @@ export type TranslationFunctions = { MESSAGE: (arg: { heartbeat: string, member: string, time: number }) => LocalizedString } } + 'my-plugin': { + PLUGIN: { + /** + * My Plugin + */ + NAME: () => LocalizedString + /** + * My Plugin Description + */ + DESCRIPTION: () => LocalizedString + } + } } export type Formatters = {} diff --git a/src/i18n/i18n-util.async.ts b/src/i18n/i18n-util.async.ts index a280a302..10436a3e 100644 --- a/src/i18n/i18n-util.async.ts +++ b/src/i18n/i18n-util.async.ts @@ -2,7 +2,7 @@ /* eslint-disable */ import { initFormatters } from './formatters' -import type { Locales, Translations } from './i18n-types' +import type { Locales, Namespaces, Translations } from './i18n-types' import { loadedFormatters, loadedLocales, locales } from './i18n-util' const localeTranslationLoaders = { @@ -10,6 +10,15 @@ const localeTranslationLoaders = { fr: () => import('./fr'), } +const localeNamespaceLoaders = { + en: { + 'my-plugin': () => import('./en/my-plugin') + }, + fr: { + 'my-plugin': () => import('./fr/my-plugin') + } +} + const updateDictionary = (locale: Locales, dictionary: Partial) => loadedLocales[locale] = { ...loadedLocales[locale], ...dictionary } @@ -25,3 +34,9 @@ export const loadAllLocalesAsync = (): Promise => Promise.all(locales.ma export const loadFormatters = (locale: Locales): void => void (loadedFormatters[locale] = initFormatters(locale)) + +export const loadNamespaceAsync = async (locale: Locales, namespace: Namespace): Promise => + void updateDictionary( + locale, + { [namespace]: (await (localeNamespaceLoaders[locale][namespace])()).default } as unknown as Partial + ) diff --git a/src/i18n/i18n-util.sync.ts b/src/i18n/i18n-util.sync.ts index 206e9dfb..076882ec 100644 --- a/src/i18n/i18n-util.sync.ts +++ b/src/i18n/i18n-util.sync.ts @@ -8,9 +8,18 @@ import { loadedFormatters, loadedLocales, locales } from './i18n-util' import en from './en' import fr from './fr' +import en_my_plugin from './en/my-plugin' +import fr_my_plugin from './fr/my-plugin' + const localeTranslations = { - en, - fr, + en: { + ...en, + 'my-plugin': en_my_plugin + }, + fr: { + ...fr, + 'my-plugin': fr_my_plugin + }, } export const loadLocale = (locale: Locales): void => { diff --git a/src/i18n/i18n-util.ts b/src/i18n/i18n-util.ts index 2c4fa894..43a35632 100644 --- a/src/i18n/i18n-util.ts +++ b/src/i18n/i18n-util.ts @@ -4,7 +4,7 @@ import { i18n as initI18n, i18nObject as initI18nObject, i18nString as initI18nString } from 'typesafe-i18n' import type { LocaleDetector } from 'typesafe-i18n/detectors' import { detectLocale as detectLocaleFn } from 'typesafe-i18n/detectors' -import type { Formatters, Locales, Translations, TranslationFunctions } from './i18n-types' +import type { Formatters, Locales, Namespaces, Translations, TranslationFunctions } from './i18n-types' export const baseLocale: Locales = 'en' @@ -13,6 +13,10 @@ export const locales: Locales[] = [ 'fr' ] +export const namespaces: Namespaces[] = [ + 'my-plugin' +] + export const loadedLocales = {} as Record export const loadedFormatters = {} as Record diff --git a/src/i18n/index.ts b/src/i18n/index.ts index f7258ee1..71b72aa8 100644 --- a/src/i18n/index.ts +++ b/src/i18n/index.ts @@ -1,4 +1,15 @@ export { L } from './i18n-node' export { getLocaleFromInteraction } from './detectors' export type { Locales, Translation } from "./i18n-types" -export { loadedLocales, locales } from "./i18n-util" \ No newline at end of file +export { loadedLocales, locales } from "./i18n-util" + + + +import { BaseTranslation } from 'typesafe-i18n' +import { Locales } from './i18n-types' +import en from "./en" +import fr from "./fr" + +export const defaultTranslations: { [key in Locales]: BaseTranslation } = { + en, fr +} \ No newline at end of file diff --git a/src/main.ts b/src/main.ts index 78387599..b715db19 100644 --- a/src/main.ts +++ b/src/main.ts @@ -7,7 +7,7 @@ import { DIService, Client, tsyringeDependencyRegistryEngine } from 'discordx' import { importx } from '@discordx/importer' import { Database, ImagesUpload, ErrorHandler, Logger, WebSocket } from '@services' -import { initDataTable, waitForDependency } from '@utils/functions' +import { importPluginsCommands, importPluginsEvents, importPluginsTranslations, initDataTable, waitForDependency } from '@utils/functions' import { Server } from '@api/server' import { clientConfig } from './client' @@ -18,6 +18,11 @@ async function run() { // start loading const logger = await waitForDependency(Logger) + + // Import translations from plugins + await importPluginsTranslations() + + // Strart spinner console.log('\n') logger.startSpinner('Starting...') @@ -38,6 +43,9 @@ async function run() { // import all the commands and events await importx(__dirname + "/{events,commands}/**/*.{ts,js}") + await importPluginsCommands() + await importPluginsEvents() + // init the data table if it doesn't exist await initDataTable() diff --git a/src/services/Database.ts b/src/services/Database.ts index a6fccf48..2130aa22 100644 --- a/src/services/Database.ts +++ b/src/services/Database.ts @@ -6,6 +6,8 @@ import fastFolderSizeSync from 'fast-folder-size/sync' import fs from 'fs' import { backup, restore } from 'saveqlite' import { delay, inject, singleton } from 'tsyringe' +import * as entities from '@entities' +import { getPluginsEntities } from '@utils/functions' @singleton() export class Database { @@ -17,9 +19,14 @@ export class Database { ) { } async initialize() { + // get config + let config = mikroORMConfig[process.env.NODE_ENV || 'development'] as Options + + // defines entities into the config + config.entities = [...Object.values(entities), ...Object.values(await getPluginsEntities())] // initialize the ORM using the configuration exported in `mikro-orm.config.ts` - this._orm = await MikroORM.init(mikroORMConfig[process.env.NODE_ENV || 'development'] as Options) + this._orm = await MikroORM.init(config) const migrator = this._orm.getMigrator() diff --git a/src/utils/errors/UnknownReply.ts b/src/utils/errors/UnknownReply.ts index 03467337..bf172961 100644 --- a/src/utils/errors/UnknownReply.ts +++ b/src/utils/errors/UnknownReply.ts @@ -1,7 +1,7 @@ import { CommandInteraction } from "discord.js" import { getLocaleFromInteraction, L } from '@i18n' -import { simpleErrorEmbed } from '@utils/functions/embeds' +import { simpleErrorEmbed } from '@utils/functions' import { BaseError } from "@utils/classes" export class UnknownReplyError extends BaseError { diff --git a/src/utils/functions/index.ts b/src/utils/functions/index.ts index e73571e2..7a61e652 100644 --- a/src/utils/functions/index.ts +++ b/src/utils/functions/index.ts @@ -16,4 +16,5 @@ export * from './devs' export * from './dependency' export * from './error' export * from './localization' -export * from './fs' \ No newline at end of file +export * from './fs' +export * from './plugins' \ No newline at end of file diff --git a/src/utils/functions/plugins.ts b/src/utils/functions/plugins.ts new file mode 100644 index 00000000..6a27b003 --- /dev/null +++ b/src/utils/functions/plugins.ts @@ -0,0 +1,120 @@ +import { importx, resolve } from "@discordx/importer"; +import { defaultTranslations } from "@i18n"; +import { AnyEntity, EntityClass } from "@mikro-orm/core"; +import { BaseController } from "@utils/classes"; +import { BaseTranslation } from "typesafe-i18n"; +import { ImportLocaleMapping, storeTranslationsToDisk } from "typesafe-i18n/importer"; + +export async function getPluginsControllers(): Promise<{ [key: string]: typeof BaseController }> { + let controllers = {}; + const controllersExporter = (await getValidPlugins()).map(e => e + "/api/controllers"); + + for(let exporter of controllersExporter) { + controllers = { + ...controllers, + ...await import(exporter) + }; + } + + return controllers; +} + +export async function getPluginsEntities(): Promise<{ [key: string]: EntityClass> }> { + let entities = {}; + const entitiesExporter = (await getValidPlugins()).map(e => e + "/entities"); + + for(let exporter of entitiesExporter) { + entities = { + ...entities, + ...await import(exporter) + }; + } + + return entities; +} + +export async function importPluginsCommands(): Promise { + const commands = (await getValidPlugins()).map(e => e + "/commands/**/*.{ts,js}"); + return importx(...commands); +} + +export async function importPluginsEvents(): Promise { + const events = (await getValidPlugins()).map(e => e + "/events/**/*.{ts,js}"); + return importx(...events); +} + +export async function importPluginsTranslations(): Promise { + let localeMapping: ImportLocaleMapping[] = []; + let namespaces: { [key: string]: string[] } = {}; + let translations: { [key: string]: BaseTranslation } = { ...defaultTranslations }; + + const translationsGlobs = (await getValidPlugins()).map(e => e + "/i18n/*.{ts,js}"); + for(let glob of translationsGlobs) { + const resolvedTranslations = await resolve(glob); + + for(let resolved of resolvedTranslations) { + const locale = resolved.split("/").at(-1)?.split(".")[0] || ""; + const namespace = resolved.split("/").at(-3) || ""; + const translation = (await import(resolved)).default as BaseTranslation; + + if(!translations[locale]) translations[locale] = {}; + if(!namespaces[locale]) namespaces[locale] = []; + + namespaces[locale].push(namespace); + translations[locale] = { + ...translations[locale], + [namespace]: translation + } + } + } + + for(let locale in translations) { + if(!Object.keys(defaultTranslations).includes(locale)) continue + localeMapping.push({ + locale, + translations: translations[locale], + namespaces: namespaces[locale] + }); + } + + await storeTranslationsToDisk(localeMapping); +} + +/* +export async function importPluginsTranslations(): Promise { + let localeMapping: ImportLocaleMapping[] = []; + const defaultLocales = Object.keys(defaultTranslations); + + for (const locale of defaultLocales) { + localeMapping.push({ + locale, + translations: defaultTranslations[locale as keyof typeof defaultTranslations] + }); + } + + const translationsGlobs = (await getValidPlugins()).map(e => e + "/i18n/*.{ts,js}"); + for(let glob of translationsGlobs) { + const resolvedTranslations = await resolve(glob); + + for(let resolved of resolvedTranslations) { + const locale = resolved.split("/").at(-1)?.split(".")[0] || ""; + const namespace = resolved.split("/").at(-3) || ""; + const translation = (await import(resolved)).default as BaseTranslation; + + if(!defaultLocales.includes(locale)) continue; + + localeMapping.push({ + locale, + translations: translation, + namespaces: [namespace] + }); + } + } + + return storeTranslationsToDisk(localeMapping); +} +*/ + +async function getValidPlugins() { + return resolve(process.env.PWD + "/plugins/*") +} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 1bec4637..82e651b0 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -21,25 +21,46 @@ "baseUrl": ".", "paths": { + "@decorators": ["src/utils/decorators"], + "@decorators/*": ["plugins/*/utils/decorators"], - "@types": ["src/utils/types"], - "@decorators": ["src/utils/decorators"], - "@errors": ["src/utils/errors"], - "@entities": ["src/entities"], - "@guards": ["src/guards"], - "@services": ["src/services"], - "@i18n": ["src/i18n"], - "@config": ["src/config"], + "@errors": ["src/utils/errors"], + "@errors/*": ["plugins/*/utils/errors"], + + "@entities": ["src/entities"], + "@entities/*": ["plugins/*/entities"], + + "@guards": ["src/guards"], + "@guards/*": ["plugins/*/guards"], - "@core/*": ["src/core/*"], - "@utils/*": ["src/utils/*"], - "@api/*": ["src/api/*"] + "@services": ["src/services"], + "@services/*": ["plugins/*/services"], + + "@i18n": ["src/i18n"], + "@i18n/*": ["plugins/*/i18n"], + + "@config": ["src/config"], + "@config/*": ["plugins/*/config"], + + "@utils/classes": ["src/utils/classes"], + "@utils/classes/*": ["plugins/*/utils/classes"], + + "@utils/functions": ["src/utils/functions"], + "@utils/functions/*": ["plugins/*/utils/functions"], + + "@api/controllers": ["src/api/controllers"], + "@api/controllers/*": ["plugins/*/api/controllers"], + + "@api/middlewares": ["src/api/middlewares"], + "@api/middlewares/*": ["plugins/*/api/middlewares"], + + "@api/server": ["src/api/server.ts"] } }, "include": ["src", "**/*.ts"], "exclude": ["build", "node_modules", "tests"], - "paths": ["node_modules/*", "src/utils/types/*"], + "paths": ["node_modules/*", "src/utils/types/*", "plugins/*/utils/types/*"], "ts-node": { "require": ["tsconfig-paths/register"] From d6e471a5c69a620753168a0c8e4d8adc2693d69b Mon Sep 17 00:00:00 2001 From: Artemus <31190188+Mr-Artemus@users.noreply.github.com> Date: Fri, 16 Sep 2022 21:45:32 +0000 Subject: [PATCH 02/29] feat(#73): Switch from functions to service --- mikro-orm.config.ts | 13 +- src/api/server.ts | 8 +- .../{my-plugin => My Awesome Plugin}/index.ts | 4 +- src/i18n/fr/My Awesome Plugin/index.ts | 11 ++ src/i18n/fr/my-plugin/index.ts | 11 -- src/i18n/i18n-types.ts | 14 +- src/i18n/i18n-util.async.ts | 4 +- src/i18n/i18n-util.sync.ts | 8 +- src/i18n/i18n-util.ts | 2 +- src/main.ts | 23 ++-- src/services/Database.ts | 8 +- src/services/ErrorHandler.ts | 3 +- src/services/PluginsManager.ts | 67 ++++++++++ src/services/index.ts | 1 + src/utils/classes/Plugin.ts | 71 +++++++++++ src/utils/classes/index.ts | 3 +- src/utils/functions/index.ts | 3 +- src/utils/functions/plugins.ts | 120 ------------------ 18 files changed, 198 insertions(+), 176 deletions(-) rename src/i18n/en/{my-plugin => My Awesome Plugin}/index.ts (65%) create mode 100644 src/i18n/fr/My Awesome Plugin/index.ts delete mode 100644 src/i18n/fr/my-plugin/index.ts create mode 100644 src/services/PluginsManager.ts create mode 100644 src/utils/classes/Plugin.ts delete mode 100644 src/utils/functions/plugins.ts diff --git a/mikro-orm.config.ts b/mikro-orm.config.ts index 653c8444..bcab5383 100644 --- a/mikro-orm.config.ts +++ b/mikro-orm.config.ts @@ -1,13 +1,16 @@ import { mikroORMConfig } from './src/config/database' import * as entities from '@entities' -import { getPluginsEntities } from '@utils/functions' +import { PluginsManager } from '@services' import { Options } from '@mikro-orm/core' +import { waitForDependency } from '@utils/functions' export default async () => { - let config = mikroORMConfig[process.env.NODE_ENV || 'development'] as Options + const pluginsManager = await waitForDependency(PluginsManager) + await pluginsManager.loadPlugins() - config.entities = [...Object.values(entities), ...Object.values(await getPluginsEntities())] - - return config + return { + ...mikroORMConfig[process.env.NODE_ENV || 'development'] as Options, + entities: [...Object.values(entities), ...pluginsManager.getEntities()] + } } diff --git a/src/api/server.ts b/src/api/server.ts index b5add07b..56833955 100644 --- a/src/api/server.ts +++ b/src/api/server.ts @@ -1,7 +1,6 @@ import * as controllers from "@api/controllers" import { log } from "@api/middlewares" -import { Logger } from "@services" -import { getPluginsControllers } from "@utils/functions" +import { Logger, PluginsManager } from "@services" import express, { Application } from "express" import { ClassConstructor, ExpressErrorMiddlewareInterface, getMetadataArgsStorage, IocAdapter, Middleware, useContainer, useExpressServer } from "routing-controllers" import { routingControllersToSpec } from "routing-controllers-openapi" @@ -14,7 +13,8 @@ export class Server { private server: Application constructor( - private readonly logger: Logger + private readonly logger: Logger, + private readonly pluginsManager: PluginsManager ) {} async start() { @@ -27,7 +27,7 @@ export class Server { this.setupSwaggerUi() useExpressServer(this.server, { - controllers: [...Object.values(controllers), ...Object.values(await getPluginsControllers())], + controllers: [...Object.values(controllers), ...this.pluginsManager.getControllers()], defaultErrorHandler: false }) diff --git a/src/i18n/en/my-plugin/index.ts b/src/i18n/en/My Awesome Plugin/index.ts similarity index 65% rename from src/i18n/en/my-plugin/index.ts rename to src/i18n/en/My Awesome Plugin/index.ts index 927fa861..d5ce4c4e 100644 --- a/src/i18n/en/my-plugin/index.ts +++ b/src/i18n/en/My Awesome Plugin/index.ts @@ -1,11 +1,11 @@ /* eslint-disable */ import type { BaseTranslation } from '../../i18n-types' -const en_my_plugin: BaseTranslation = { +const en_My_Awesome_Plugin: BaseTranslation = { PLUGIN: { NAME: 'My Plugin', DESCRIPTION: 'My Plugin Description', }, } -export default en_my_plugin +export default en_My_Awesome_Plugin diff --git a/src/i18n/fr/My Awesome Plugin/index.ts b/src/i18n/fr/My Awesome Plugin/index.ts new file mode 100644 index 00000000..8d970495 --- /dev/null +++ b/src/i18n/fr/My Awesome Plugin/index.ts @@ -0,0 +1,11 @@ +/* eslint-disable */ +import type { NamespaceMyAwesomePluginTranslation } from '../../i18n-types' + +const fr_My_Awesome_Plugin: NamespaceMyAwesomePluginTranslation = { + PLUGIN: { + NAME: 'Mon Plugin', + DESCRIPTION: 'Description de Mon Plugin', + }, +} + +export default fr_My_Awesome_Plugin diff --git a/src/i18n/fr/my-plugin/index.ts b/src/i18n/fr/my-plugin/index.ts deleted file mode 100644 index cf1d301d..00000000 --- a/src/i18n/fr/my-plugin/index.ts +++ /dev/null @@ -1,11 +0,0 @@ -/* eslint-disable */ -import type { NamespaceMyPluginTranslation } from '../../i18n-types' - -const fr_my_plugin: NamespaceMyPluginTranslation = { - PLUGIN: { - NAME: 'Mon Plugin', - DESCRIPTION: 'Description de Mon Plugin', - }, -} - -export default fr_my_plugin diff --git a/src/i18n/i18n-types.ts b/src/i18n/i18n-types.ts index 8c450fbf..6593e0d4 100644 --- a/src/i18n/i18n-types.ts +++ b/src/i18n/i18n-types.ts @@ -13,7 +13,7 @@ export type Translation = RootTranslation & DisallowNamespaces export type Translations = RootTranslation & { - 'my-plugin': NamespaceMyPluginTranslation + 'My Awesome Plugin': NamespaceMyAwesomePluginTranslation } type RootTranslation = { @@ -169,7 +169,7 @@ type RootTranslation = { } } -export type NamespaceMyPluginTranslation = { +export type NamespaceMyAwesomePluginTranslation = { PLUGIN: { /** * My Plugin @@ -183,14 +183,14 @@ export type NamespaceMyPluginTranslation = { } export type Namespaces = - | 'my-plugin' + | 'My Awesome Plugin' type DisallowNamespaces = { /** - * reserved for 'my-plugin'-namespace\ - * you need to use the `./my-plugin/index.ts` file instead + * reserved for 'My Awesome Plugin'-namespace\ + * you need to use the `./My Awesome Plugin/index.ts` file instead */ - 'my-plugin'?: "[typesafe-i18n] reserved for 'my-plugin'-namespace. You need to use the `./my-plugin/index.ts` file instead." + 'My Awesome Plugin'?: "[typesafe-i18n] reserved for 'My Awesome Plugin'-namespace. You need to use the `./My Awesome Plugin/index.ts` file instead." } export type TranslationFunctions = { @@ -336,7 +336,7 @@ export type TranslationFunctions = { MESSAGE: (arg: { heartbeat: string, member: string, time: number }) => LocalizedString } } - 'my-plugin': { + 'My Awesome Plugin': { PLUGIN: { /** * My Plugin diff --git a/src/i18n/i18n-util.async.ts b/src/i18n/i18n-util.async.ts index 10436a3e..4f2bfbd9 100644 --- a/src/i18n/i18n-util.async.ts +++ b/src/i18n/i18n-util.async.ts @@ -12,10 +12,10 @@ const localeTranslationLoaders = { const localeNamespaceLoaders = { en: { - 'my-plugin': () => import('./en/my-plugin') + 'My Awesome Plugin': () => import('./en/My Awesome Plugin') }, fr: { - 'my-plugin': () => import('./fr/my-plugin') + 'My Awesome Plugin': () => import('./fr/My Awesome Plugin') } } diff --git a/src/i18n/i18n-util.sync.ts b/src/i18n/i18n-util.sync.ts index 076882ec..a1160958 100644 --- a/src/i18n/i18n-util.sync.ts +++ b/src/i18n/i18n-util.sync.ts @@ -8,17 +8,17 @@ import { loadedFormatters, loadedLocales, locales } from './i18n-util' import en from './en' import fr from './fr' -import en_my_plugin from './en/my-plugin' -import fr_my_plugin from './fr/my-plugin' +import en_My_Awesome_Plugin from './en/My Awesome Plugin' +import fr_My_Awesome_Plugin from './fr/My Awesome Plugin' const localeTranslations = { en: { ...en, - 'my-plugin': en_my_plugin + 'My Awesome Plugin': en_My_Awesome_Plugin }, fr: { ...fr, - 'my-plugin': fr_my_plugin + 'My Awesome Plugin': fr_My_Awesome_Plugin }, } diff --git a/src/i18n/i18n-util.ts b/src/i18n/i18n-util.ts index 43a35632..1418915b 100644 --- a/src/i18n/i18n-util.ts +++ b/src/i18n/i18n-util.ts @@ -14,7 +14,7 @@ export const locales: Locales[] = [ ] export const namespaces: Namespaces[] = [ - 'my-plugin' + 'My Awesome Plugin' ] export const loadedLocales = {} as Record diff --git a/src/main.ts b/src/main.ts index b715db19..61f33533 100644 --- a/src/main.ts +++ b/src/main.ts @@ -6,8 +6,8 @@ import discordLogs from 'discord-logs' import { DIService, Client, tsyringeDependencyRegistryEngine } from 'discordx' import { importx } from '@discordx/importer' -import { Database, ImagesUpload, ErrorHandler, Logger, WebSocket } from '@services' -import { importPluginsCommands, importPluginsEvents, importPluginsTranslations, initDataTable, waitForDependency } from '@utils/functions' +import { Database, ImagesUpload, ErrorHandler, Logger, WebSocket, PluginsManager } from '@services' +import { initDataTable, waitForDependency } from '@utils/functions' import { Server } from '@api/server' import { clientConfig } from './client' @@ -15,14 +15,16 @@ import { apiConfig, generalConfig, websocketConfig } from '@config' import { NoBotTokenError } from '@errors' async function run() { - - // start loading + // init logger, pluginsmanager and error handler const logger = await waitForDependency(Logger) + await waitForDependency(ErrorHandler) + const pluginManager = await waitForDependency(PluginsManager) - // Import translations from plugins - await importPluginsTranslations() + // load plugins and import translations + await pluginManager.loadPlugins() + await pluginManager.syncTranslations() - // Strart spinner + // strart spinner console.log('\n') logger.startSpinner('Starting...') @@ -38,13 +40,10 @@ async function run() { discordLogs(client, { debug: false }) container.registerInstance(Client, client) - // init the error handler - await waitForDependency(ErrorHandler) - // import all the commands and events await importx(__dirname + "/{events,commands}/**/*.{ts,js}") - await importPluginsCommands() - await importPluginsEvents() + await pluginManager.importCommands() + await pluginManager.importEvents() // init the data table if it doesn't exist diff --git a/src/services/Database.ts b/src/services/Database.ts index 2130aa22..333c1c0a 100644 --- a/src/services/Database.ts +++ b/src/services/Database.ts @@ -1,13 +1,13 @@ import { databaseConfig, mikroORMConfig } from '@config' import { Schedule } from '@decorators' import { EntityName, MikroORM, Options } from '@mikro-orm/core' -import { Logger } from '@services' +import { Logger, PluginsManager } from '@services' import fastFolderSizeSync from 'fast-folder-size/sync' import fs from 'fs' import { backup, restore } from 'saveqlite' import { delay, inject, singleton } from 'tsyringe' import * as entities from '@entities' -import { getPluginsEntities } from '@utils/functions' +import { waitForDependency } from '@utils/functions' @singleton() export class Database { @@ -19,11 +19,13 @@ export class Database { ) { } async initialize() { + const pluginsManager = await waitForDependency(PluginsManager) + // get config let config = mikroORMConfig[process.env.NODE_ENV || 'development'] as Options // defines entities into the config - config.entities = [...Object.values(entities), ...Object.values(await getPluginsEntities())] + config.entities = [...Object.values(entities), ...pluginsManager.getEntities()] // initialize the ORM using the configuration exported in `mikro-orm.config.ts` this._orm = await MikroORM.init(config) diff --git a/src/services/ErrorHandler.ts b/src/services/ErrorHandler.ts index 1406ea0e..e113f4ab 100644 --- a/src/services/ErrorHandler.ts +++ b/src/services/ErrorHandler.ts @@ -8,8 +8,7 @@ import { BaseError } from '@utils/classes' export class ErrorHandler { constructor( - private logger: Logger, - private client: Client + private logger: Logger ) { // Catch all exeptions diff --git a/src/services/PluginsManager.ts b/src/services/PluginsManager.ts new file mode 100644 index 00000000..d6fb518c --- /dev/null +++ b/src/services/PluginsManager.ts @@ -0,0 +1,67 @@ +import { ImportLocaleMapping, storeTranslationsToDisk } from "typesafe-i18n/importer"; +import { resolve } from "@discordx/importer"; +import { singleton } from "tsyringe"; + +import { BaseController, Plugin } from "@utils/classes"; +import { BaseTranslation } from "typesafe-i18n"; +import { defaultTranslations } from "@i18n"; +import { AnyEntity, EntityClass } from "@mikro-orm/core"; + +@singleton() +export class PluginsManager { + private plugins: Plugin[] = []; + + constructor() {} + + public async loadPlugins(): Promise { + const pluginPaths = resolve(process.env.PWD + "/plugins/*"); + for (const path of pluginPaths) { + const plugin = new Plugin(path); + await plugin.load(); + this.plugins.push(plugin); + } + } + + public getEntities(): EntityClass[] { + return this.plugins.map(plugin => Object.values(plugin.entities)).flat() + } + + public getControllers(): typeof BaseController[] { + return this.plugins.map(plugin => Object.values(plugin.controllers)).flat() + } + + public async importCommands(): Promise { + for (const plugin of this.plugins) await plugin.importCommands(); + } + + public async importEvents(): Promise { + for (const plugin of this.plugins) await plugin.importEvents(); + } + + public async syncTranslations(saveToDisk: boolean = true, generateTypes?: boolean): Promise { + let localeMapping: ImportLocaleMapping[] = []; + let namespaces: { [key: string]: string[] } = {}; + let translations: { [key: string]: BaseTranslation } = { ...defaultTranslations }; + + for (const plugin of this.plugins) { + for (const locale in plugin.translations) { + if(!translations[locale]) translations[locale] = {}; + if(!namespaces[locale]) namespaces[locale] = []; + + translations[locale] = { ...translations[locale], [plugin.name]: plugin.translations[locale] } + namespaces[locale].push(plugin.name); + } + } + + for(let locale in translations) { + if(!Object.keys(defaultTranslations).includes(locale)) continue + localeMapping.push({ + locale, + translations: translations[locale], + namespaces: namespaces[locale] + }); + } + + if(saveToDisk) await storeTranslationsToDisk(localeMapping, generateTypes); + } +} \ No newline at end of file diff --git a/src/services/index.ts b/src/services/index.ts index 3549c3ab..b40ef18e 100644 --- a/src/services/index.ts +++ b/src/services/index.ts @@ -7,3 +7,4 @@ export * from './ErrorHandler' export * from './Scheduler' export * from './WebSocket' export * from './Pastebin' +export * from './PluginsManager' diff --git a/src/utils/classes/Plugin.ts b/src/utils/classes/Plugin.ts new file mode 100644 index 00000000..98957af6 --- /dev/null +++ b/src/utils/classes/Plugin.ts @@ -0,0 +1,71 @@ +import { importx, resolve } from "@discordx/importer"; +import { AnyEntity, EntityClass } from "@mikro-orm/core"; +import { BaseController } from "@utils/classes"; +import { BaseTranslation } from "typesafe-i18n"; + +export class Plugin { + // Common values + private _path: string; + private _name: string; + private _version: string; + + // Specific values + private _entities: { [key: string]: EntityClass }; + private _controllers: { [key: string]: typeof BaseController }; + private _translations: { [key: string]: BaseTranslation }; + + constructor(path: string) { + this._path = path; + } + + public async load(): Promise { + // Read plugin.json + const pluginConfig = await import(this._path + "/plugin.json"); + + // Assign common values + this._name = pluginConfig.name; + this._version = pluginConfig.version; + + // Load specific values + this._entities = await this.getEntities(); + this._controllers = await this.getControllers(); + this._translations = await this.getTranslations(); + + + } + + private async getControllers(): Promise<{ [key: string]: typeof BaseController }> { + return import(this._path + "/api/controllers"); + } + + private async getEntities(): Promise<{ [key: string]: EntityClass }> { + return import(this._path + "/entities"); + } + + private async getTranslations(): Promise<{ [key: string]: BaseTranslation }> { + const translations: { [key: string]: BaseTranslation } = {}; + + const localesPath = resolve(this._path + "/i18n/*.{ts,js}"); + for(const localeFile of localesPath) { + const locale = localeFile.split("/").at(-1)?.split(".")[0] || "unknow"; + translations[locale] = (await import(localeFile)).default; + } + + return translations; + } + + public async importCommands(): Promise { + await importx(this._path + "/commands/**/*.{ts,js}"); + } + + public async importEvents(): Promise { + await importx(this._path + "/events/**/*.{ts,js}"); + } + + get path() { return this._path } + get name() { return this._name } + get version() { return this._version } + get entities() { return this._entities } + get controllers() { return this._controllers } + get translations() { return this._translations } +} \ No newline at end of file diff --git a/src/utils/classes/index.ts b/src/utils/classes/index.ts index 2f6f5c50..60f842e5 100644 --- a/src/utils/classes/index.ts +++ b/src/utils/classes/index.ts @@ -1,2 +1,3 @@ export * from './BaseError' -export * from './BaseController' \ No newline at end of file +export * from './BaseController' +export * from './Plugin' \ No newline at end of file diff --git a/src/utils/functions/index.ts b/src/utils/functions/index.ts index 7a61e652..e73571e2 100644 --- a/src/utils/functions/index.ts +++ b/src/utils/functions/index.ts @@ -16,5 +16,4 @@ export * from './devs' export * from './dependency' export * from './error' export * from './localization' -export * from './fs' -export * from './plugins' \ No newline at end of file +export * from './fs' \ No newline at end of file diff --git a/src/utils/functions/plugins.ts b/src/utils/functions/plugins.ts deleted file mode 100644 index 6a27b003..00000000 --- a/src/utils/functions/plugins.ts +++ /dev/null @@ -1,120 +0,0 @@ -import { importx, resolve } from "@discordx/importer"; -import { defaultTranslations } from "@i18n"; -import { AnyEntity, EntityClass } from "@mikro-orm/core"; -import { BaseController } from "@utils/classes"; -import { BaseTranslation } from "typesafe-i18n"; -import { ImportLocaleMapping, storeTranslationsToDisk } from "typesafe-i18n/importer"; - -export async function getPluginsControllers(): Promise<{ [key: string]: typeof BaseController }> { - let controllers = {}; - const controllersExporter = (await getValidPlugins()).map(e => e + "/api/controllers"); - - for(let exporter of controllersExporter) { - controllers = { - ...controllers, - ...await import(exporter) - }; - } - - return controllers; -} - -export async function getPluginsEntities(): Promise<{ [key: string]: EntityClass> }> { - let entities = {}; - const entitiesExporter = (await getValidPlugins()).map(e => e + "/entities"); - - for(let exporter of entitiesExporter) { - entities = { - ...entities, - ...await import(exporter) - }; - } - - return entities; -} - -export async function importPluginsCommands(): Promise { - const commands = (await getValidPlugins()).map(e => e + "/commands/**/*.{ts,js}"); - return importx(...commands); -} - -export async function importPluginsEvents(): Promise { - const events = (await getValidPlugins()).map(e => e + "/events/**/*.{ts,js}"); - return importx(...events); -} - -export async function importPluginsTranslations(): Promise { - let localeMapping: ImportLocaleMapping[] = []; - let namespaces: { [key: string]: string[] } = {}; - let translations: { [key: string]: BaseTranslation } = { ...defaultTranslations }; - - const translationsGlobs = (await getValidPlugins()).map(e => e + "/i18n/*.{ts,js}"); - for(let glob of translationsGlobs) { - const resolvedTranslations = await resolve(glob); - - for(let resolved of resolvedTranslations) { - const locale = resolved.split("/").at(-1)?.split(".")[0] || ""; - const namespace = resolved.split("/").at(-3) || ""; - const translation = (await import(resolved)).default as BaseTranslation; - - if(!translations[locale]) translations[locale] = {}; - if(!namespaces[locale]) namespaces[locale] = []; - - namespaces[locale].push(namespace); - translations[locale] = { - ...translations[locale], - [namespace]: translation - } - } - } - - for(let locale in translations) { - if(!Object.keys(defaultTranslations).includes(locale)) continue - localeMapping.push({ - locale, - translations: translations[locale], - namespaces: namespaces[locale] - }); - } - - await storeTranslationsToDisk(localeMapping); -} - -/* -export async function importPluginsTranslations(): Promise { - let localeMapping: ImportLocaleMapping[] = []; - const defaultLocales = Object.keys(defaultTranslations); - - for (const locale of defaultLocales) { - localeMapping.push({ - locale, - translations: defaultTranslations[locale as keyof typeof defaultTranslations] - }); - } - - const translationsGlobs = (await getValidPlugins()).map(e => e + "/i18n/*.{ts,js}"); - for(let glob of translationsGlobs) { - const resolvedTranslations = await resolve(glob); - - for(let resolved of resolvedTranslations) { - const locale = resolved.split("/").at(-1)?.split(".")[0] || ""; - const namespace = resolved.split("/").at(-3) || ""; - const translation = (await import(resolved)).default as BaseTranslation; - - if(!defaultLocales.includes(locale)) continue; - - localeMapping.push({ - locale, - translations: translation, - namespaces: [namespace] - }); - } - } - - return storeTranslationsToDisk(localeMapping); -} -*/ - -async function getValidPlugins() { - return resolve(process.env.PWD + "/plugins/*") -} \ No newline at end of file From 274d90dee1e34356817bd9466ecd361f7ec313ff Mon Sep 17 00:00:00 2001 From: Artemus <31190188+Mr-Artemus@users.noreply.github.com> Date: Sat, 17 Sep 2022 15:24:42 +0000 Subject: [PATCH 03/29] feat(#73): Plugins services & bot ready info --- plugins/my-plugin/services/PluginService.ts | 9 +++++++++ plugins/my-plugin/services/index.ts | 1 + src/main.ts | 3 +++ src/services/Logger.ts | 21 +++++++++++++++------ src/services/PluginsManager.ts | 12 ++++++++++++ src/utils/classes/Plugin.ts | 7 +++++++ 6 files changed, 47 insertions(+), 6 deletions(-) create mode 100644 plugins/my-plugin/services/PluginService.ts create mode 100644 plugins/my-plugin/services/index.ts diff --git a/plugins/my-plugin/services/PluginService.ts b/plugins/my-plugin/services/PluginService.ts new file mode 100644 index 00000000..0638f54a --- /dev/null +++ b/plugins/my-plugin/services/PluginService.ts @@ -0,0 +1,9 @@ +import { singleton } from 'tsyringe' + +@singleton() +export class pluginService { + + constructor() { + console.log("PluginService: loaded !") + } +} \ No newline at end of file diff --git a/plugins/my-plugin/services/index.ts b/plugins/my-plugin/services/index.ts new file mode 100644 index 00000000..587b523c --- /dev/null +++ b/plugins/my-plugin/services/index.ts @@ -0,0 +1 @@ +export * from './PluginService' \ No newline at end of file diff --git a/src/main.ts b/src/main.ts index 61f33533..68c48670 100644 --- a/src/main.ts +++ b/src/main.ts @@ -49,6 +49,9 @@ async function run() { // init the data table if it doesn't exist await initDataTable() + // init plugins services + await pluginManager.initServices() + // log in with the bot token if (!process.env.BOT_TOKEN) throw new NoBotTokenError() client.login(process.env.BOT_TOKEN) diff --git a/src/services/Logger.ts b/src/services/Logger.ts index 262bbc88..61a90648 100644 --- a/src/services/Logger.ts +++ b/src/services/Logger.ts @@ -11,8 +11,9 @@ import { getMetadataArgsStorage } from 'routing-controllers' import { routingControllersToSpec } from 'routing-controllers-openapi' import { formatDate, getTypeOfInteraction, numberAlign, oneLine, resolveAction, resolveChannel, resolveGuild, resolveUser, validString, waitForDependency } from '@utils/functions' -import { Scheduler, WebSocket, Pastebin } from '@services' +import { Scheduler, WebSocket, Pastebin, PluginsManager } from '@services' import { apiConfig, logsConfig } from '@config' +import { resolve } from '@discordx/importer' @singleton() export class Logger { @@ -21,7 +22,8 @@ export class Logger { @inject(delay(() => Client)) private client: Client, @inject(delay(() => Scheduler)) private scheduler: Scheduler, @inject(delay(() => WebSocket)) private ws: WebSocket, - @inject(delay(() => Pastebin)) private pastebin: Pastebin + @inject(delay(() => Pastebin)) private pastebin: Pastebin, + @inject(delay(() => PluginsManager)) private pluginsManager: PluginsManager ) { this.defaultConsole = { ...console } console.log = (...args) => this.log("info", args.join(", ")) @@ -395,16 +397,23 @@ export class Logger { !entity.startsWith('index') && !entity.startsWith('BaseEntity') ) - .map(entity => entity.split('.')[0]) - this.console('info', chalk.red(`${symbol} ${numberAlign(entities.length)} ${chalk.bold('entities')} loaded`), true) + const pluginsEntites = resolve(`${__dirname}/../../plugins/*/entities`) + .filter(entity => + !entity.startsWith('index') + && !entity.startsWith('BaseEntity') + ) + + this.console('info', chalk.red(`${symbol} ${numberAlign(entities.length + pluginsEntites.length)} ${chalk.bold('entities')} loaded`), true) // services const services = fs.readdirSync(`${__dirname}/../services`) .filter(service => !service.startsWith('index')) - .map(service => service.split('.')[0]) + + const pluginsServices = resolve(`${__dirname}/../../plugins/*/services`) + .filter(service => !service.startsWith('index')) - this.console('info', chalk.yellow(`${symbol} ${numberAlign(services.length)} ${chalk.bold('services')} loaded`), true) + this.console('info', chalk.yellow(`${symbol} ${numberAlign(services.length + pluginsServices.length)} ${chalk.bold('services')} loaded`), true) // api if (apiConfig.enabled) { diff --git a/src/services/PluginsManager.ts b/src/services/PluginsManager.ts index d6fb518c..ed2940d3 100644 --- a/src/services/PluginsManager.ts +++ b/src/services/PluginsManager.ts @@ -38,6 +38,18 @@ export class PluginsManager { for (const plugin of this.plugins) await plugin.importEvents(); } + public async initServices(): Promise<{ [key: string]: any }> { + let services: { [key: string]: any } = {}; + + for (const plugin of this.plugins) { + for(const service in plugin.services) { + services[service] = new plugin.services[service](); + } + } + + return services; + } + public async syncTranslations(saveToDisk: boolean = true, generateTypes?: boolean): Promise { let localeMapping: ImportLocaleMapping[] = []; let namespaces: { [key: string]: string[] } = {}; diff --git a/src/utils/classes/Plugin.ts b/src/utils/classes/Plugin.ts index 98957af6..00570dbd 100644 --- a/src/utils/classes/Plugin.ts +++ b/src/utils/classes/Plugin.ts @@ -12,6 +12,7 @@ export class Plugin { // Specific values private _entities: { [key: string]: EntityClass }; private _controllers: { [key: string]: typeof BaseController }; + private _services: { [key: string]: any }; private _translations: { [key: string]: BaseTranslation }; constructor(path: string) { @@ -29,6 +30,7 @@ export class Plugin { // Load specific values this._entities = await this.getEntities(); this._controllers = await this.getControllers(); + this._services = await this.getServices(); this._translations = await this.getTranslations(); @@ -42,6 +44,10 @@ export class Plugin { return import(this._path + "/entities"); } + private async getServices(): Promise<{ [key: string]: any }> { + return import(this._path + "/services"); + } + private async getTranslations(): Promise<{ [key: string]: BaseTranslation }> { const translations: { [key: string]: BaseTranslation } = {}; @@ -67,5 +73,6 @@ export class Plugin { get version() { return this._version } get entities() { return this._entities } get controllers() { return this._controllers } + get services() { return this._services } get translations() { return this._translations } } \ No newline at end of file From 7f6330e9ea075866d54cf601d19c358c3569a372 Mon Sep 17 00:00:00 2001 From: Artemus <31190188+Mr-Artemus@users.noreply.github.com> Date: Sat, 17 Sep 2022 16:06:59 +0000 Subject: [PATCH 04/29] feat(#73): Support of `plugin.json` --- package-lock.json | 190 +++++++++++++-------------------- package.json | 6 +- plugins/my-plugin/plugin.json | 5 +- src/services/Logger.ts | 5 +- src/services/PluginsManager.ts | 3 +- src/utils/classes/Plugin.ts | 32 +++++- 6 files changed, 114 insertions(+), 127 deletions(-) diff --git a/package-lock.json b/package-lock.json index b3c6ed9a..40e4da19 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,6 +23,7 @@ "@mikro-orm/postgresql": "^5.3.1", "@mikro-orm/sql-highlighter": "^1.0.1", "@mikro-orm/sqlite": "^5.3.1", + "@types/semver": "^7.3.12", "axios": "^0.27.2", "boxen": "^5.1.2", "case": "^1.6.3", @@ -54,6 +55,7 @@ "routing-controllers-openapi": "^3.1.0", "rxeta": "^1.1.2", "saveqlite": "^1.1.2", + "semver": "^7.3.7", "socket.io-client": "^4.5.1", "stacktrace-parser": "^0.1.10", "swagger-ui-express": "^4.5.0", @@ -164,20 +166,6 @@ "node-pre-gyp": "bin/node-pre-gyp" } }, - "node_modules/@discordjs/node-pre-gyp/node_modules/semver": { - "version": "7.3.7", - "license": "ISC", - "peer": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/@discordjs/opus": { "version": "0.8.0", "hasInstallScript": true, @@ -421,19 +409,6 @@ "node-pre-gyp": "bin/node-pre-gyp" } }, - "node_modules/@mapbox/node-pre-gyp/node_modules/semver": { - "version": "7.3.7", - "license": "ISC", - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/@mikro-orm/better-sqlite": { "version": "5.3.1", "license": "MIT", @@ -844,20 +819,6 @@ "semver": "^7.3.5" } }, - "node_modules/@npmcli/fs/node_modules/semver": { - "version": "7.3.7", - "license": "ISC", - "optional": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/@npmcli/move-file": { "version": "1.1.2", "license": "MIT", @@ -1309,6 +1270,11 @@ "node": ">= 0.12" } }, + "node_modules/@types/semver": { + "version": "7.3.12", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.12.tgz", + "integrity": "sha512-WwA1MW0++RfXmCr12xeYOOC5baSC9mSb0ZqCquFzKhcoF4TvHu5MKOuXsncgZcpVFhB1pXd5hZmM0ryAoCp12A==" + }, "node_modules/@types/serve-static": { "version": "1.13.10", "dev": true, @@ -6461,19 +6427,6 @@ "node": ">=10" } }, - "node_modules/node-abi/node_modules/semver": { - "version": "7.3.7", - "license": "ISC", - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/node-addon-api": { "version": "4.3.0", "license": "MIT" @@ -6602,20 +6555,6 @@ "node": "^12.13.0 || ^14.15.0 || >=16.0.0" } }, - "node_modules/node-gyp/node_modules/semver": { - "version": "7.3.7", - "license": "ISC", - "optional": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/node-os-utils": { "version": "1.3.7", "license": "MIT" @@ -6754,6 +6693,15 @@ "node": "*" } }, + "node_modules/nodemon/node_modules/semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true, + "bin": { + "semver": "bin/semver" + } + }, "node_modules/nopt": { "version": "5.0.0", "license": "ISC", @@ -6778,6 +6726,15 @@ "validate-npm-package-license": "^3.0.1" } }, + "node_modules/normalize-package-data/node_modules/semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true, + "bin": { + "semver": "bin/semver" + } + }, "node_modules/normalize-path": { "version": "3.0.0", "dev": true, @@ -6866,6 +6823,15 @@ "node": ">=4" } }, + "node_modules/npm-run-all/node_modules/semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true, + "bin": { + "semver": "bin/semver" + } + }, "node_modules/npm-run-all/node_modules/shebang-command": { "version": "1.2.0", "dev": true, @@ -8506,11 +8472,17 @@ "license": "ISC" }, "node_modules/semver": { - "version": "5.7.1", - "dev": true, - "license": "ISC", + "version": "7.3.7", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", + "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", + "dependencies": { + "lru-cache": "^6.0.0" + }, "bin": { - "semver": "bin/semver" + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" } }, "node_modules/semver-compare": { @@ -10567,15 +10539,6 @@ "rimraf": "^3.0.2", "semver": "^7.3.5", "tar": "^6.1.11" - }, - "dependencies": { - "semver": { - "version": "7.3.7", - "peer": true, - "requires": { - "lru-cache": "^6.0.0" - } - } } }, "@discordjs/opus": { @@ -10727,14 +10690,6 @@ "rimraf": "^3.0.2", "semver": "^7.3.5", "tar": "^6.1.11" - }, - "dependencies": { - "semver": { - "version": "7.3.7", - "requires": { - "lru-cache": "^6.0.0" - } - } } }, "@mikro-orm/better-sqlite": { @@ -10851,15 +10806,6 @@ "requires": { "@gar/promisify": "^1.0.1", "semver": "^7.3.5" - }, - "dependencies": { - "semver": { - "version": "7.3.7", - "optional": true, - "requires": { - "lru-cache": "^6.0.0" - } - } } }, "@npmcli/move-file": { @@ -11178,6 +11124,11 @@ } } }, + "@types/semver": { + "version": "7.3.12", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.12.tgz", + "integrity": "sha512-WwA1MW0++RfXmCr12xeYOOC5baSC9mSb0ZqCquFzKhcoF4TvHu5MKOuXsncgZcpVFhB1pXd5hZmM0ryAoCp12A==" + }, "@types/serve-static": { "version": "1.13.10", "dev": true, @@ -14626,14 +14577,6 @@ "version": "3.24.0", "requires": { "semver": "^7.3.5" - }, - "dependencies": { - "semver": { - "version": "7.3.7", - "requires": { - "lru-cache": "^6.0.0" - } - } } }, "node-addon-api": { @@ -14719,13 +14662,6 @@ "gauge": "^4.0.3", "set-blocking": "^2.0.0" } - }, - "semver": { - "version": "7.3.7", - "optional": true, - "requires": { - "lru-cache": "^6.0.0" - } } } }, @@ -14829,6 +14765,12 @@ "requires": { "brace-expansion": "^1.1.7" } + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true } } }, @@ -14846,6 +14788,14 @@ "resolve": "^1.10.0", "semver": "2 || 3 || 4 || 5", "validate-npm-package-license": "^3.0.1" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + } } }, "normalize-path": { @@ -14906,6 +14856,12 @@ "version": "2.0.1", "dev": true }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + }, "shebang-command": { "version": "1.2.0", "dev": true, @@ -15933,8 +15889,12 @@ "version": "1.2.4" }, "semver": { - "version": "5.7.1", - "dev": true + "version": "7.3.7", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", + "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", + "requires": { + "lru-cache": "^6.0.0" + } }, "semver-compare": { "version": "1.0.0" diff --git a/package.json b/package.json index 186ef634..170224a1 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,7 @@ "@mikro-orm/postgresql": "^5.3.1", "@mikro-orm/sql-highlighter": "^1.0.1", "@mikro-orm/sqlite": "^5.3.1", + "@types/semver": "^7.3.12", "axios": "^0.27.2", "boxen": "^5.1.2", "case": "^1.6.3", @@ -67,6 +68,7 @@ "routing-controllers-openapi": "^3.1.0", "rxeta": "^1.1.2", "saveqlite": "^1.1.2", + "semver": "^7.3.7", "socket.io-client": "^4.5.1", "stacktrace-parser": "^0.1.10", "swagger-ui-express": "^4.5.0", @@ -116,6 +118,8 @@ "validator": "13.7.0" }, "nodemonConfig": { - "ignore": ["src/i18n/**/!(index.ts)"] + "ignore": [ + "src/i18n/**/!(index.ts)" + ] } } diff --git a/plugins/my-plugin/plugin.json b/plugins/my-plugin/plugin.json index f56bdcfa..4898f589 100644 --- a/plugins/my-plugin/plugin.json +++ b/plugins/my-plugin/plugin.json @@ -4,8 +4,5 @@ "version": "1.0.0", "tscordRequiredVersion": "1.0.0", "description": "This plugin does awesome things", - "source": "https://github.com/johndoe/my-awesome-plugin", - "dependencies": { - "my-other-plugin": "1.0.0" - } + "source": "https://github.com/johndoe/my-awesome-plugin" } \ No newline at end of file diff --git a/src/services/Logger.ts b/src/services/Logger.ts index 61a90648..62c9574f 100644 --- a/src/services/Logger.ts +++ b/src/services/Logger.ts @@ -11,7 +11,7 @@ import { getMetadataArgsStorage } from 'routing-controllers' import { routingControllersToSpec } from 'routing-controllers-openapi' import { formatDate, getTypeOfInteraction, numberAlign, oneLine, resolveAction, resolveChannel, resolveGuild, resolveUser, validString, waitForDependency } from '@utils/functions' -import { Scheduler, WebSocket, Pastebin, PluginsManager } from '@services' +import { Scheduler, WebSocket, Pastebin } from '@services' import { apiConfig, logsConfig } from '@config' import { resolve } from '@discordx/importer' @@ -22,8 +22,7 @@ export class Logger { @inject(delay(() => Client)) private client: Client, @inject(delay(() => Scheduler)) private scheduler: Scheduler, @inject(delay(() => WebSocket)) private ws: WebSocket, - @inject(delay(() => Pastebin)) private pastebin: Pastebin, - @inject(delay(() => PluginsManager)) private pluginsManager: PluginsManager + @inject(delay(() => Pastebin)) private pastebin: Pastebin ) { this.defaultConsole = { ...console } console.log = (...args) => this.log("info", args.join(", ")) diff --git a/src/services/PluginsManager.ts b/src/services/PluginsManager.ts index ed2940d3..4249ed30 100644 --- a/src/services/PluginsManager.ts +++ b/src/services/PluginsManager.ts @@ -18,7 +18,8 @@ export class PluginsManager { for (const path of pluginPaths) { const plugin = new Plugin(path); await plugin.load(); - this.plugins.push(plugin); + + if(plugin.isValid()) this.plugins.push(plugin); } } diff --git a/src/utils/classes/Plugin.ts b/src/utils/classes/Plugin.ts index 00570dbd..cde79a37 100644 --- a/src/utils/classes/Plugin.ts +++ b/src/utils/classes/Plugin.ts @@ -1,13 +1,18 @@ -import { importx, resolve } from "@discordx/importer"; import { AnyEntity, EntityClass } from "@mikro-orm/core"; -import { BaseController } from "@utils/classes"; +import { importx, resolve } from "@discordx/importer"; import { BaseTranslation } from "typesafe-i18n"; +import semver from "semver"; +import fs from "fs" + +import { generalConfig } from "@config"; +import { BaseController } from "@utils/classes"; export class Plugin { // Common values private _path: string; private _name: string; private _version: string; + private _valid: boolean = true; // Specific values private _entities: { [key: string]: EntityClass }; @@ -20,9 +25,24 @@ export class Plugin { } public async load(): Promise { + // Check if the plugin.json is present + if(!await fs.existsSync(this._path + "/plugin.json")) return this.stopLoad("plugin.json not found"); + // Read plugin.json const pluginConfig = await import(this._path + "/plugin.json"); + // Check if the plugin.json is valid + if(!pluginConfig.name) return this.stopLoad("Missing name in plugin.json"); + if(!pluginConfig.version) return this.stopLoad("Missing version in plugin.json"); + if(!pluginConfig.tscordRequiredVersion) return this.stopLoad("Missing tscordRequiredVersion in plugin.json"); + + // Check plugin.json values + if(!pluginConfig.name.match(/^[a-zA-Z0-9-_]+$/)) return this.stopLoad("Invalid name in plugin.json"); + if(!semver.valid(pluginConfig.version)) return this.stopLoad("Invalid version in plugin.json"); + + // Check if the plugin is compatible with the current version of Tscord + if(!semver.satisfies(generalConfig.__templateVersion, pluginConfig.tscordRequiredVersion)) return this.stopLoad(`Incompatible with the current version of Tscord (v${generalConfig.__templateVersion})`); + // Assign common values this._name = pluginConfig.name; this._version = pluginConfig.version; @@ -32,8 +52,11 @@ export class Plugin { this._controllers = await this.getControllers(); this._services = await this.getServices(); this._translations = await this.getTranslations(); + } - + private stopLoad(error: string): void { + this._valid = false; + console.error(`Plugin ${this._name ? this._name : this._path } ${this._version ? "v" + this._version : ""} is not valid: ${error}`); } private async getControllers(): Promise<{ [key: string]: typeof BaseController }> { @@ -68,9 +91,12 @@ export class Plugin { await importx(this._path + "/events/**/*.{ts,js}"); } + public isValid(): boolean { return this._valid; } + get path() { return this._path } get name() { return this._name } get version() { return this._version } + get entities() { return this._entities } get controllers() { return this._controllers } get services() { return this._services } From 76c8eeb1cd521abec5a813ba15d24b0cb2324595 Mon Sep 17 00:00:00 2001 From: Artemus <31190188+Mr-Artemus@users.noreply.github.com> Date: Mon, 19 Sep 2022 19:27:35 +0000 Subject: [PATCH 05/29] feat(#73): Optional plugin folder --- package-lock.json | 1 + package.json | 1 + src/utils/classes/Plugin.ts | 3 +++ 3 files changed, 5 insertions(+) diff --git a/package-lock.json b/package-lock.json index 40e4da19..328cf5ed 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,6 +25,7 @@ "@mikro-orm/sqlite": "^5.3.1", "@types/semver": "^7.3.12", "axios": "^0.27.2", + "body-parser": "^1.20.0", "boxen": "^5.1.2", "case": "^1.6.3", "chalk": "^4.1.2", diff --git a/package.json b/package.json index 170224a1..0ede245b 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,7 @@ "@mikro-orm/sqlite": "^5.3.1", "@types/semver": "^7.3.12", "axios": "^0.27.2", + "body-parser": "^1.20.0", "boxen": "^5.1.2", "case": "^1.6.3", "chalk": "^4.1.2", diff --git a/src/utils/classes/Plugin.ts b/src/utils/classes/Plugin.ts index cde79a37..f865bc40 100644 --- a/src/utils/classes/Plugin.ts +++ b/src/utils/classes/Plugin.ts @@ -60,14 +60,17 @@ export class Plugin { } private async getControllers(): Promise<{ [key: string]: typeof BaseController }> { + if(!fs.existsSync(this._path + "/api/controllers")) return {} return import(this._path + "/api/controllers"); } private async getEntities(): Promise<{ [key: string]: EntityClass }> { + if(!fs.existsSync(this._path + "/entities")) return {} return import(this._path + "/entities"); } private async getServices(): Promise<{ [key: string]: any }> { + if(!fs.existsSync(this._path + "/services")) return {} return import(this._path + "/services"); } From c13dd28342c3f58c6ff3d04d424ba19ee7b1da4c Mon Sep 17 00:00:00 2001 From: Artemus <31190188+Mr-Artemus@users.noreply.github.com> Date: Mon, 19 Sep 2022 19:31:49 +0000 Subject: [PATCH 06/29] feat(#73): NPM script to install plugins dependencies --- package-lock.json | 744 ++++++++++++++++++++++++++++++++++++++++++++-- package.json | 2 + 2 files changed, 721 insertions(+), 25 deletions(-) diff --git a/package-lock.json b/package-lock.json index 328cf5ed..569fac60 100644 --- a/package-lock.json +++ b/package-lock.json @@ -50,6 +50,7 @@ "oneline": "^1.0.3", "ora": "^5.4.1", "pidusage": "^3.0.0", + "recursive-install": "^1.4.0", "reflect-metadata": "^0.1.13", "rentry-pastebin": "^1.2.3", "routing-controllers": "^0.9.0", @@ -2485,6 +2486,14 @@ "type-is": "^1.6.16" } }, + "node_modules/code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha512-RpAVKQA5T63xEj6/giIbUEtZwJ4UFIc3ZtvEkiaUERylqe8xb5IvqcgOurZLahv93CLKfxcw5YI+DZcUBRyLXA==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/collection-visit": { "version": "1.0.0", "dev": true, @@ -3335,7 +3344,6 @@ }, "node_modules/error-ex": { "version": "1.3.2", - "dev": true, "license": "MIT", "dependencies": { "is-arrayish": "^0.2.1" @@ -4762,7 +4770,6 @@ }, "node_modules/hosted-git-info": { "version": "2.8.9", - "dev": true, "license": "ISC" }, "node_modules/http-assert": { @@ -5001,6 +5008,14 @@ "node": ">= 0.10" } }, + "node_modules/invert-kv": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", + "integrity": "sha512-xgs2NH9AE66ucSq4cNG1nhSFghr5l6tdL15Pk+jl46bmmBapgoaY/AacXyaDznAqmGL99TiLSQgO/XazFSKYeQ==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/ip": { "version": "1.1.8", "license": "MIT" @@ -5038,7 +5053,6 @@ }, "node_modules/is-arrayish": { "version": "0.2.1", - "dev": true, "license": "MIT" }, "node_modules/is-bigint": { @@ -5371,6 +5385,11 @@ "upper-case": "^1.1.0" } }, + "node_modules/is-utf8": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", + "integrity": "sha512-rMYPYvCzsXywIsldgLaSoPlw5PfoB/ssr7hY4pLfcodrA5M/eArza1a9VmTiNIBNMjOGr1Ow9mTyU2o69U6U9Q==" + }, "node_modules/is-weakref": { "version": "1.0.2", "dev": true, @@ -5721,6 +5740,17 @@ "node": ">= 0.8" } }, + "node_modules/lcid": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", + "integrity": "sha512-YiGkH6EnGrDGqLMITnGjXtGmNtjoXw9SVUzcaos8RBi7Ps0VBylkq+vOcY9QE5poLasPCR849ucFUkl0UzUyOw==", + "dependencies": { + "invert-kv": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/liftoff": { "version": "2.5.0", "dev": true, @@ -5781,6 +5811,11 @@ "version": "4.17.21", "license": "MIT" }, + "node_modules/lodash.assign": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/lodash.assign/-/lodash.assign-4.2.0.tgz", + "integrity": "sha512-hFuH8TY+Yji7Eja3mGiuAxBqLagejScbG8GbG0j6o9vzn0YL14My+ktnqtZgFTosKymC9/44wP6s7xyuLfnClw==" + }, "node_modules/lodash.capitalize": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/lodash.capitalize/-/lodash.capitalize-4.2.1.tgz", @@ -6718,7 +6753,6 @@ }, "node_modules/normalize-package-data": { "version": "2.5.0", - "dev": true, "license": "BSD-2-Clause", "dependencies": { "hosted-git-info": "^2.1.4", @@ -6731,7 +6765,6 @@ "version": "5.7.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true, "bin": { "semver": "bin/semver" } @@ -6873,6 +6906,14 @@ "set-blocking": "^2.0.0" } }, + "node_modules/number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha512-4jbtZXNAsfZbAHiiqjLPBiCl16dES1zI4Hpzzxw61Tk+loF+sBDBKx1ICKKKwIqQ7M0mFn1TmkN7euSncWgHiQ==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/oauth-sign": { "version": "0.9.0", "license": "Apache-2.0", @@ -7122,6 +7163,17 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/os-locale": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", + "integrity": "sha512-PRT7ZORmwu2MEFt4/fv3Q+mEfN4zetKxufQrkShY2oGvUms9r8otu5HfdyIFHkYXjO7laNsoVGmM2MANfuTA8g==", + "dependencies": { + "lcid": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/os-tmpdir": { "version": "1.0.2", "dev": true, @@ -7426,6 +7478,25 @@ "node": ">=4" } }, + "node_modules/pinkie": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha512-MnUuEycAemtSaeFSjXKW/aroV7akBbY+Sv+RkyqFjgAe73F+MR0TBWKBRDkmfWq/HiFmdavfZ1G7h4SPZXaCSg==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pinkie-promise": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha512-0Gni6D4UcLTbv9c57DfxDGdr41XfgUjqWZu492f0cIGr16zDU06BWP/RAEvOuo7CQ0CNjHaLlM59YJJFm3NWlw==", + "dependencies": { + "pinkie": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/pirates": { "version": "4.0.5", "dev": true, @@ -7961,6 +8032,112 @@ "node": ">=4" } }, + "node_modules/read-pkg-up": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz", + "integrity": "sha512-WD9MTlNtI55IwYUS27iHh9tK3YoIVhxis8yKhLpTqWtml739uXc9NWTpxoHkfZf3+DkCCsXox94/VWZniuZm6A==", + "dependencies": { + "find-up": "^1.0.0", + "read-pkg": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/read-pkg-up/node_modules/find-up": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", + "integrity": "sha512-jvElSjyuo4EMQGoTwo1uJU5pQMwTW5lS1x05zzfJuTIyLR3zwO27LYrxNg+dlvKpGOuGy/MzBdXh80g0ve5+HA==", + "dependencies": { + "path-exists": "^2.0.0", + "pinkie-promise": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/read-pkg-up/node_modules/load-json-file": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", + "integrity": "sha512-cy7ZdNRXdablkXYNI049pthVeXFurRyb9+hA/dZzerZ0pGTx42z+y+ssxBaVV2l70t1muq5IdKhn4UtcoGUY9A==", + "dependencies": { + "graceful-fs": "^4.1.2", + "parse-json": "^2.2.0", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0", + "strip-bom": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/read-pkg-up/node_modules/parse-json": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha512-QR/GGaKCkhwk1ePQNYDRKYZ3mwU9ypsKhB0XyFnLQdomyEqk3e8wpW3V5Jp88zbxK4n5ST1nqo+g9juTpownhQ==", + "dependencies": { + "error-ex": "^1.2.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/read-pkg-up/node_modules/path-exists": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", + "integrity": "sha512-yTltuKuhtNeFJKa1PiRzfLAU5182q1y4Eb4XCJ3PBqyzEDkAZRzBrKKBct682ls9reBVHf9udYLN5Nd+K1B9BQ==", + "dependencies": { + "pinkie-promise": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/read-pkg-up/node_modules/path-type": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", + "integrity": "sha512-S4eENJz1pkiQn9Znv33Q+deTOKmbl+jj1Fl+qiP/vYezj+S8x+J3Uo0ISrx/QoEvIlOaDWJhPaRd1flJ9HXZqg==", + "dependencies": { + "graceful-fs": "^4.1.2", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/read-pkg-up/node_modules/pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/read-pkg-up/node_modules/read-pkg": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", + "integrity": "sha512-7BGwRHqt4s/uVbuyoeejRn4YmFnYZiFl4AuaeXHlgZf3sONF0SOGlxs2Pw8g6hCKupo08RafIO5YXFNOKTfwsQ==", + "dependencies": { + "load-json-file": "^1.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/read-pkg-up/node_modules/strip-bom": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", + "integrity": "sha512-kwrX1y7czp1E69n2ajbG65mIo9dqvJ+8aBQXOGVxqwvNbsXdFM6Lq37dLAY3mknUwru8CfcCbfOLL/gMo+fi3g==", + "dependencies": { + "is-utf8": "^0.2.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/read-pkg/node_modules/path-type": { "version": "3.0.0", "dev": true, @@ -8019,6 +8196,141 @@ "node": ">= 10.13.0" } }, + "node_modules/recursive-install": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/recursive-install/-/recursive-install-1.4.0.tgz", + "integrity": "sha512-pK7bU5PUe5UVHxHJseTQaAmSD7qTtIyhNVhM4u6yru9rkicbxLYhPwXsHhPSxwWLyxmEHx8Fba59BhlHWSGwDA==", + "dependencies": { + "shelljs": "^0.7.0", + "yargs": "^5.0.0" + }, + "bin": { + "npm-recursive-install": "recursive-install.js" + } + }, + "node_modules/recursive-install/node_modules/ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/recursive-install/node_modules/camelcase": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz", + "integrity": "sha512-4nhGqUkc4BqbBBB4Q6zLuD7lzzrHYrjKGeYaEji/3tFR5VdJu9v+LilhGIVe8wxEJPPOeWo7eg8dwY13TZ1BNg==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/recursive-install/node_modules/cliui": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", + "integrity": "sha512-0yayqDxWQbqk3ojkYqUKqaAQ6AfNKeKWRNA8kR0WXzAsdHpP4BIaOmMAG87JGuO6qcobyW4GjxHd9PmhEd+T9w==", + "dependencies": { + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wrap-ansi": "^2.0.0" + } + }, + "node_modules/recursive-install/node_modules/get-caller-file": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz", + "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==" + }, + "node_modules/recursive-install/node_modules/is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha512-1pqUqRjkhPJ9miNq9SwMfdvi6lBJcd6eFxvfaivQhaH3SgisfiuudvFntdKOmxuee/77l+FPjKrQjWvmPjWrRw==", + "dependencies": { + "number-is-nan": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/recursive-install/node_modules/require-main-filename": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", + "integrity": "sha512-IqSUtOVP4ksd1C/ej5zeEh/BIP2ajqpn8c5x+q99gvcIG/Qf0cud5raVnE/Dwd0ua9TXYDoDc0RE5hBSdz22Ug==" + }, + "node_modules/recursive-install/node_modules/string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha512-0XsVpQLnVCXHJfyEs8tC0zpTVIr5PKKsQtkT29IwupnPTjtPmQ3xT/4yCREF9hYkV/3M3kzcUTSAZT6a6h81tw==", + "dependencies": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/recursive-install/node_modules/strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg==", + "dependencies": { + "ansi-regex": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/recursive-install/node_modules/which-module": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-1.0.0.tgz", + "integrity": "sha512-F6+WgncZi/mJDrammbTuHe1q0R5hOXv/mBaiNA2TCNT/LTHusX0V+CJnj9XT8ki5ln2UZyyddDgHfCzyrOH7MQ==" + }, + "node_modules/recursive-install/node_modules/wrap-ansi": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "integrity": "sha512-vAaEaDM946gbNpH5pLVNR+vX2ht6n0Bt3GXwVB1AuAqZosOvHNF3P7wDnh8KLkSqgUh0uh77le7Owgoz+Z9XBw==", + "dependencies": { + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/recursive-install/node_modules/y18n": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.2.tgz", + "integrity": "sha512-uGZHXkHnhF0XeeAPgnKfPv1bgKAYyVvmNL1xlKsPYZPaIHxGti2hHqvOCQv71XMsLxu1QjergkqogUnms5D3YQ==" + }, + "node_modules/recursive-install/node_modules/yargs": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-5.0.0.tgz", + "integrity": "sha512-krgVLGNhMWUVY1EJkM/bgbvn3yCIRrsZp6KaeX8hx8ztT+jBtX7/flTQcSHe5089xIDQRUsEr2mzlZVNe/7P5w==", + "dependencies": { + "cliui": "^3.2.0", + "decamelize": "^1.1.1", + "get-caller-file": "^1.0.1", + "lodash.assign": "^4.2.0", + "os-locale": "^1.4.0", + "read-pkg-up": "^1.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^1.0.1", + "set-blocking": "^2.0.0", + "string-width": "^1.0.2", + "which-module": "^1.0.0", + "window-size": "^0.2.0", + "y18n": "^3.2.1", + "yargs-parser": "^3.2.0" + } + }, + "node_modules/recursive-install/node_modules/yargs-parser": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-3.2.0.tgz", + "integrity": "sha512-eANlJIqYwhwS/asi4ybKxkeJYUIjNMZXL36C/KICV5jyudUZWp+/lEfBHM0PuJcQjBfs00HwqePEQjtLJd+Kyw==", + "dependencies": { + "camelcase": "^3.0.0", + "lodash.assign": "^4.1.0" + } + }, "node_modules/reflect-metadata": { "version": "0.1.13", "license": "Apache-2.0" @@ -8655,6 +8967,81 @@ "dev": true, "license": "MIT" }, + "node_modules/shelljs": { + "version": "0.7.8", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.7.8.tgz", + "integrity": "sha512-/YF5Uk8hcwi7ima04ppkbA4RaRMdPMBfwAvAf8sufYOxsJRtbdoBsT8vGvlb+799BrlGdYrd+oczIA2eN2JdWA==", + "dependencies": { + "glob": "^7.0.0", + "interpret": "^1.0.0", + "rechoir": "^0.6.2" + }, + "bin": { + "shjs": "bin/shjs" + }, + "engines": { + "iojs": "*", + "node": ">=0.11.0" + } + }, + "node_modules/shelljs/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/shelljs/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/shelljs/node_modules/interpret": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz", + "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/shelljs/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/shelljs/node_modules/rechoir": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", + "integrity": "sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw==", + "dependencies": { + "resolve": "^1.1.6" + }, + "engines": { + "node": ">= 0.10" + } + }, "node_modules/side-channel": { "version": "1.0.4", "license": "MIT", @@ -9032,7 +9419,6 @@ }, "node_modules/spdx-correct": { "version": "3.1.1", - "dev": true, "license": "Apache-2.0", "dependencies": { "spdx-expression-parse": "^3.0.0", @@ -9041,12 +9427,10 @@ }, "node_modules/spdx-exceptions": { "version": "2.3.0", - "dev": true, "license": "CC-BY-3.0" }, "node_modules/spdx-expression-parse": { "version": "3.0.1", - "dev": true, "license": "MIT", "dependencies": { "spdx-exceptions": "^2.1.0", @@ -9055,7 +9439,6 @@ }, "node_modules/spdx-license-ids": { "version": "3.0.11", - "dev": true, "license": "CC0-1.0" }, "node_modules/split-string": { @@ -10147,7 +10530,6 @@ }, "node_modules/validate-npm-package-license": { "version": "3.0.4", - "dev": true, "license": "Apache-2.0", "dependencies": { "spdx-correct": "^3.0.0", @@ -10250,6 +10632,17 @@ "node": ">=8" } }, + "node_modules/window-size": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.2.0.tgz", + "integrity": "sha512-UD7d8HFA2+PZsbKyaOCEy8gMh1oDtHgJh1LfgjQ4zVXmYjAT/kvz3PueITKuqDiIXQe7yzpPnxX3lNc+AhQMyw==", + "bin": { + "window-size": "cli.js" + }, + "engines": { + "node": ">= 0.10.0" + } + }, "node_modules/wordwrap": { "version": "1.0.0", "dev": true, @@ -11937,6 +12330,11 @@ "type-is": "^1.6.16" } }, + "code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha512-RpAVKQA5T63xEj6/giIbUEtZwJ4UFIc3ZtvEkiaUERylqe8xb5IvqcgOurZLahv93CLKfxcw5YI+DZcUBRyLXA==" + }, "collection-visit": { "version": "1.0.0", "dev": true, @@ -12518,7 +12916,6 @@ }, "error-ex": { "version": "1.3.2", - "dev": true, "requires": { "is-arrayish": "^0.2.1" } @@ -13492,8 +13889,7 @@ } }, "hosted-git-info": { - "version": "2.8.9", - "dev": true + "version": "2.8.9" }, "http-assert": { "version": "1.5.0", @@ -13651,6 +14047,11 @@ "interpret": { "version": "2.2.0" }, + "invert-kv": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", + "integrity": "sha512-xgs2NH9AE66ucSq4cNG1nhSFghr5l6tdL15Pk+jl46bmmBapgoaY/AacXyaDznAqmGL99TiLSQgO/XazFSKYeQ==" + }, "ip": { "version": "1.1.8" }, @@ -13675,8 +14076,7 @@ } }, "is-arrayish": { - "version": "0.2.1", - "dev": true + "version": "0.2.1" }, "is-bigint": { "version": "1.0.4", @@ -13864,6 +14264,11 @@ "upper-case": "^1.1.0" } }, + "is-utf8": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", + "integrity": "sha512-rMYPYvCzsXywIsldgLaSoPlw5PfoB/ssr7hY4pLfcodrA5M/eArza1a9VmTiNIBNMjOGr1Ow9mTyU2o69U6U9Q==" + }, "is-weakref": { "version": "1.0.2", "dev": true, @@ -14108,6 +14513,14 @@ } } }, + "lcid": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", + "integrity": "sha512-YiGkH6EnGrDGqLMITnGjXtGmNtjoXw9SVUzcaos8RBi7Ps0VBylkq+vOcY9QE5poLasPCR849ucFUkl0UzUyOw==", + "requires": { + "invert-kv": "^1.0.0" + } + }, "liftoff": { "version": "2.5.0", "dev": true, @@ -14153,6 +14566,11 @@ "lodash": { "version": "4.17.21" }, + "lodash.assign": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/lodash.assign/-/lodash.assign-4.2.0.tgz", + "integrity": "sha512-hFuH8TY+Yji7Eja3mGiuAxBqLagejScbG8GbG0j6o9vzn0YL14My+ktnqtZgFTosKymC9/44wP6s7xyuLfnClw==" + }, "lodash.capitalize": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/lodash.capitalize/-/lodash.capitalize-4.2.1.tgz", @@ -14783,7 +15201,6 @@ }, "normalize-package-data": { "version": "2.5.0", - "dev": true, "requires": { "hosted-git-info": "^2.1.4", "resolve": "^1.10.0", @@ -14794,8 +15211,7 @@ "semver": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" } } }, @@ -14892,6 +15308,11 @@ "set-blocking": "^2.0.0" } }, + "number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha512-4jbtZXNAsfZbAHiiqjLPBiCl16dES1zI4Hpzzxw61Tk+loF+sBDBKx1ICKKKwIqQ7M0mFn1TmkN7euSncWgHiQ==" + }, "oauth-sign": { "version": "0.9.0" }, @@ -15052,6 +15473,14 @@ "wcwidth": "^1.0.1" } }, + "os-locale": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", + "integrity": "sha512-PRT7ZORmwu2MEFt4/fv3Q+mEfN4zetKxufQrkShY2oGvUms9r8otu5HfdyIFHkYXjO7laNsoVGmM2MANfuTA8g==", + "requires": { + "lcid": "^1.0.0" + } + }, "os-tmpdir": { "version": "1.0.2", "dev": true @@ -15224,6 +15653,19 @@ "version": "3.0.0", "dev": true }, + "pinkie": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha512-MnUuEycAemtSaeFSjXKW/aroV7akBbY+Sv+RkyqFjgAe73F+MR0TBWKBRDkmfWq/HiFmdavfZ1G7h4SPZXaCSg==" + }, + "pinkie-promise": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha512-0Gni6D4UcLTbv9c57DfxDGdr41XfgUjqWZu492f0cIGr16zDU06BWP/RAEvOuo7CQ0CNjHaLlM59YJJFm3NWlw==", + "requires": { + "pinkie": "^2.0.0" + } + }, "pirates": { "version": "4.0.5", "dev": true @@ -15561,6 +16003,87 @@ } } }, + "read-pkg-up": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz", + "integrity": "sha512-WD9MTlNtI55IwYUS27iHh9tK3YoIVhxis8yKhLpTqWtml739uXc9NWTpxoHkfZf3+DkCCsXox94/VWZniuZm6A==", + "requires": { + "find-up": "^1.0.0", + "read-pkg": "^1.0.0" + }, + "dependencies": { + "find-up": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", + "integrity": "sha512-jvElSjyuo4EMQGoTwo1uJU5pQMwTW5lS1x05zzfJuTIyLR3zwO27LYrxNg+dlvKpGOuGy/MzBdXh80g0ve5+HA==", + "requires": { + "path-exists": "^2.0.0", + "pinkie-promise": "^2.0.0" + } + }, + "load-json-file": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", + "integrity": "sha512-cy7ZdNRXdablkXYNI049pthVeXFurRyb9+hA/dZzerZ0pGTx42z+y+ssxBaVV2l70t1muq5IdKhn4UtcoGUY9A==", + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^2.2.0", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0", + "strip-bom": "^2.0.0" + } + }, + "parse-json": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha512-QR/GGaKCkhwk1ePQNYDRKYZ3mwU9ypsKhB0XyFnLQdomyEqk3e8wpW3V5Jp88zbxK4n5ST1nqo+g9juTpownhQ==", + "requires": { + "error-ex": "^1.2.0" + } + }, + "path-exists": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", + "integrity": "sha512-yTltuKuhtNeFJKa1PiRzfLAU5182q1y4Eb4XCJ3PBqyzEDkAZRzBrKKBct682ls9reBVHf9udYLN5Nd+K1B9BQ==", + "requires": { + "pinkie-promise": "^2.0.0" + } + }, + "path-type": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", + "integrity": "sha512-S4eENJz1pkiQn9Znv33Q+deTOKmbl+jj1Fl+qiP/vYezj+S8x+J3Uo0ISrx/QoEvIlOaDWJhPaRd1flJ9HXZqg==", + "requires": { + "graceful-fs": "^4.1.2", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" + } + }, + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==" + }, + "read-pkg": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", + "integrity": "sha512-7BGwRHqt4s/uVbuyoeejRn4YmFnYZiFl4AuaeXHlgZf3sONF0SOGlxs2Pw8g6hCKupo08RafIO5YXFNOKTfwsQ==", + "requires": { + "load-json-file": "^1.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^1.0.0" + } + }, + "strip-bom": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", + "integrity": "sha512-kwrX1y7czp1E69n2ajbG65mIo9dqvJ+8aBQXOGVxqwvNbsXdFM6Lq37dLAY3mknUwru8CfcCbfOLL/gMo+fi3g==", + "requires": { + "is-utf8": "^0.2.0" + } + } + } + }, "readable-stream": { "version": "3.6.0", "requires": { @@ -15588,6 +16111,122 @@ "resolve": "^1.20.0" } }, + "recursive-install": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/recursive-install/-/recursive-install-1.4.0.tgz", + "integrity": "sha512-pK7bU5PUe5UVHxHJseTQaAmSD7qTtIyhNVhM4u6yru9rkicbxLYhPwXsHhPSxwWLyxmEHx8Fba59BhlHWSGwDA==", + "requires": { + "shelljs": "^0.7.0", + "yargs": "^5.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==" + }, + "camelcase": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz", + "integrity": "sha512-4nhGqUkc4BqbBBB4Q6zLuD7lzzrHYrjKGeYaEji/3tFR5VdJu9v+LilhGIVe8wxEJPPOeWo7eg8dwY13TZ1BNg==" + }, + "cliui": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", + "integrity": "sha512-0yayqDxWQbqk3ojkYqUKqaAQ6AfNKeKWRNA8kR0WXzAsdHpP4BIaOmMAG87JGuO6qcobyW4GjxHd9PmhEd+T9w==", + "requires": { + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wrap-ansi": "^2.0.0" + } + }, + "get-caller-file": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz", + "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==" + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha512-1pqUqRjkhPJ9miNq9SwMfdvi6lBJcd6eFxvfaivQhaH3SgisfiuudvFntdKOmxuee/77l+FPjKrQjWvmPjWrRw==", + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "require-main-filename": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", + "integrity": "sha512-IqSUtOVP4ksd1C/ej5zeEh/BIP2ajqpn8c5x+q99gvcIG/Qf0cud5raVnE/Dwd0ua9TXYDoDc0RE5hBSdz22Ug==" + }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha512-0XsVpQLnVCXHJfyEs8tC0zpTVIr5PKKsQtkT29IwupnPTjtPmQ3xT/4yCREF9hYkV/3M3kzcUTSAZT6a6h81tw==", + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg==", + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "which-module": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-1.0.0.tgz", + "integrity": "sha512-F6+WgncZi/mJDrammbTuHe1q0R5hOXv/mBaiNA2TCNT/LTHusX0V+CJnj9XT8ki5ln2UZyyddDgHfCzyrOH7MQ==" + }, + "wrap-ansi": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "integrity": "sha512-vAaEaDM946gbNpH5pLVNR+vX2ht6n0Bt3GXwVB1AuAqZosOvHNF3P7wDnh8KLkSqgUh0uh77le7Owgoz+Z9XBw==", + "requires": { + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1" + } + }, + "y18n": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.2.tgz", + "integrity": "sha512-uGZHXkHnhF0XeeAPgnKfPv1bgKAYyVvmNL1xlKsPYZPaIHxGti2hHqvOCQv71XMsLxu1QjergkqogUnms5D3YQ==" + }, + "yargs": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-5.0.0.tgz", + "integrity": "sha512-krgVLGNhMWUVY1EJkM/bgbvn3yCIRrsZp6KaeX8hx8ztT+jBtX7/flTQcSHe5089xIDQRUsEr2mzlZVNe/7P5w==", + "requires": { + "cliui": "^3.2.0", + "decamelize": "^1.1.1", + "get-caller-file": "^1.0.1", + "lodash.assign": "^4.2.0", + "os-locale": "^1.4.0", + "read-pkg-up": "^1.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^1.0.1", + "set-blocking": "^2.0.0", + "string-width": "^1.0.2", + "which-module": "^1.0.0", + "window-size": "^0.2.0", + "y18n": "^3.2.1", + "yargs-parser": "^3.2.0" + } + }, + "yargs-parser": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-3.2.0.tgz", + "integrity": "sha512-eANlJIqYwhwS/asi4ybKxkeJYUIjNMZXL36C/KICV5jyudUZWp+/lEfBHM0PuJcQjBfs00HwqePEQjtLJd+Kyw==", + "requires": { + "camelcase": "^3.0.0", + "lodash.assign": "^4.1.0" + } + } + } + }, "reflect-metadata": { "version": "0.1.13" }, @@ -16031,6 +16670,61 @@ "version": "1.7.3", "dev": true }, + "shelljs": { + "version": "0.7.8", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.7.8.tgz", + "integrity": "sha512-/YF5Uk8hcwi7ima04ppkbA4RaRMdPMBfwAvAf8sufYOxsJRtbdoBsT8vGvlb+799BrlGdYrd+oczIA2eN2JdWA==", + "requires": { + "glob": "^7.0.0", + "interpret": "^1.0.0", + "rechoir": "^0.6.2" + }, + "dependencies": { + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "interpret": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz", + "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==" + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "rechoir": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", + "integrity": "sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw==", + "requires": { + "resolve": "^1.1.6" + } + } + } + }, "side-channel": { "version": "1.0.4", "requires": { @@ -16279,27 +16973,23 @@ }, "spdx-correct": { "version": "3.1.1", - "dev": true, "requires": { "spdx-expression-parse": "^3.0.0", "spdx-license-ids": "^3.0.0" } }, "spdx-exceptions": { - "version": "2.3.0", - "dev": true + "version": "2.3.0" }, "spdx-expression-parse": { "version": "3.0.1", - "dev": true, "requires": { "spdx-exceptions": "^2.1.0", "spdx-license-ids": "^3.0.0" } }, "spdx-license-ids": { - "version": "3.0.11", - "dev": true + "version": "3.0.11" }, "split-string": { "version": "3.1.0", @@ -17005,7 +17695,6 @@ }, "validate-npm-package-license": { "version": "3.0.4", - "dev": true, "requires": { "spdx-correct": "^3.0.0", "spdx-expression-parse": "^3.0.0" @@ -17076,6 +17765,11 @@ "string-width": "^4.0.0" } }, + "window-size": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.2.0.tgz", + "integrity": "sha512-UD7d8HFA2+PZsbKyaOCEy8gMh1oDtHgJh1LfgjQ4zVXmYjAT/kvz3PueITKuqDiIXQe7yzpPnxX3lNc+AhQMyw==" + }, "wordwrap": { "version": "1.0.0", "dev": true diff --git a/package.json b/package.json index 0ede245b..fdb1f85c 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "migration:create": "npx mikro-orm migration:create", "migration:up": "npx mikro-orm migration:up", "migration:down": "npx mikro-orm migration:down", + "plugins:install": "npm-recursive-install --rootDir=plugins", "plop": "plop --plopfile ./cli/plopfile.js" }, "dependencies": { @@ -63,6 +64,7 @@ "oneline": "^1.0.3", "ora": "^5.4.1", "pidusage": "^3.0.0", + "recursive-install": "^1.4.0", "reflect-metadata": "^0.1.13", "rentry-pastebin": "^1.2.3", "routing-controllers": "^0.9.0", From c7c327829848488077ecb273c93e58b9198d27a9 Mon Sep 17 00:00:00 2001 From: Artemus <31190188+Mr-Artemus@users.noreply.github.com> Date: Mon, 19 Sep 2022 19:54:34 +0000 Subject: [PATCH 07/29] feat(#73): Support for plugins .env --- src/services/PluginsManager.ts | 5 ++++- src/utils/classes/Plugin.ts | 6 ++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/services/PluginsManager.ts b/src/services/PluginsManager.ts index 4249ed30..8c6cb1a6 100644 --- a/src/services/PluginsManager.ts +++ b/src/services/PluginsManager.ts @@ -19,7 +19,10 @@ export class PluginsManager { const plugin = new Plugin(path); await plugin.load(); - if(plugin.isValid()) this.plugins.push(plugin); + if(plugin.isValid()) { + plugin.loadEnv(); + this.plugins.push(plugin); + } } } diff --git a/src/utils/classes/Plugin.ts b/src/utils/classes/Plugin.ts index f865bc40..968532fb 100644 --- a/src/utils/classes/Plugin.ts +++ b/src/utils/classes/Plugin.ts @@ -1,6 +1,7 @@ import { AnyEntity, EntityClass } from "@mikro-orm/core"; import { importx, resolve } from "@discordx/importer"; import { BaseTranslation } from "typesafe-i18n"; +import dotenv from "dotenv"; import semver from "semver"; import fs from "fs" @@ -86,6 +87,11 @@ export class Plugin { return translations; } + public loadEnv(): void { + if(!fs.existsSync(this._path + "/services")) return + dotenv.config({ path: this._path + "/.env" }); + } + public async importCommands(): Promise { await importx(this._path + "/commands/**/*.{ts,js}"); } From be9deb985e4e1a23f8dd9f5e2fc1850c90327004 Mon Sep 17 00:00:00 2001 From: Artemus <31190188+Mr-Artemus@users.noreply.github.com> Date: Mon, 19 Sep 2022 20:23:34 +0000 Subject: [PATCH 08/29] feat(#73): Support for plugins main.ts --- src/main.ts | 3 +++ src/services/PluginsManager.ts | 4 ++++ src/utils/classes/Plugin.ts | 5 +++++ 3 files changed, 12 insertions(+) diff --git a/src/main.ts b/src/main.ts index 68c48670..dd594f73 100644 --- a/src/main.ts +++ b/src/main.ts @@ -52,6 +52,9 @@ async function run() { // init plugins services await pluginManager.initServices() + // init the plugin main file + await pluginManager.execMains() + // log in with the bot token if (!process.env.BOT_TOKEN) throw new NoBotTokenError() client.login(process.env.BOT_TOKEN) diff --git a/src/services/PluginsManager.ts b/src/services/PluginsManager.ts index 8c6cb1a6..ef039308 100644 --- a/src/services/PluginsManager.ts +++ b/src/services/PluginsManager.ts @@ -54,6 +54,10 @@ export class PluginsManager { return services; } + public async execMains(): Promise { + for (const plugin of this.plugins) await plugin.execMain(); + } + public async syncTranslations(saveToDisk: boolean = true, generateTypes?: boolean): Promise { let localeMapping: ImportLocaleMapping[] = []; let namespaces: { [key: string]: string[] } = {}; diff --git a/src/utils/classes/Plugin.ts b/src/utils/classes/Plugin.ts index 968532fb..47116828 100644 --- a/src/utils/classes/Plugin.ts +++ b/src/utils/classes/Plugin.ts @@ -92,6 +92,11 @@ export class Plugin { dotenv.config({ path: this._path + "/.env" }); } + public execMain(): void { + if(!fs.existsSync(this._path + "/main.ts")) return + import(this._path + "/main.ts"); + } + public async importCommands(): Promise { await importx(this._path + "/commands/**/*.{ts,js}"); } From 41276177daeff9651b273474b38f8cea762f8bd3 Mon Sep 17 00:00:00 2001 From: Artemus <31190188+Mr-Artemus@users.noreply.github.com> Date: Mon, 19 Sep 2022 21:57:06 +0000 Subject: [PATCH 09/29] feat(#73): Move `plugins` folder inside the `src` folder --- .swcrc | 23 +++++----- package.json | 2 +- plugins/my-plugin/api/controllers/index.ts | 1 - plugins/my-plugin/api/controllers/plugin.ts | 14 ------ plugins/my-plugin/api/middlewares/index.ts | 1 - plugins/my-plugin/api/middlewares/plugin.ts | 6 --- plugins/my-plugin/commands/plugin.ts | 25 ----------- plugins/my-plugin/config/index.ts | 1 - plugins/my-plugin/config/plugin.ts | 3 -- plugins/my-plugin/entities/PluginEntity.ts | 24 ---------- plugins/my-plugin/entities/index.ts | 1 - plugins/my-plugin/events/ready.ts | 14 ------ plugins/my-plugin/guards/.gitkeep | 0 plugins/my-plugin/i18n/en.ts | 10 ----- plugins/my-plugin/i18n/fr.ts | 10 ----- plugins/my-plugin/plugin.json | 8 ---- plugins/my-plugin/services/PluginService.ts | 9 ---- plugins/my-plugin/services/index.ts | 1 - plugins/my-plugin/utils/classes/.gitkeep | 0 plugins/my-plugin/utils/decorators/.gitkeep | 0 plugins/my-plugin/utils/errors/.gitkeep | 0 plugins/my-plugin/utils/functions/.gitkeep | 0 .../my-plugin/utils/types/pluginconfig.d.ts | 3 -- src/i18n/en/My Awesome Plugin/index.ts | 11 ----- src/i18n/fr/My Awesome Plugin/index.ts | 11 ----- src/i18n/i18n-types.ts | 45 ++----------------- src/i18n/i18n-util.async.ts | 17 +------ src/i18n/i18n-util.sync.ts | 13 +----- src/i18n/i18n-util.ts | 6 +-- src/utils/functions/localization.ts | 2 +- tsconfig.json | 24 +++++----- 31 files changed, 33 insertions(+), 252 deletions(-) delete mode 100644 plugins/my-plugin/api/controllers/index.ts delete mode 100644 plugins/my-plugin/api/controllers/plugin.ts delete mode 100644 plugins/my-plugin/api/middlewares/index.ts delete mode 100644 plugins/my-plugin/api/middlewares/plugin.ts delete mode 100644 plugins/my-plugin/commands/plugin.ts delete mode 100644 plugins/my-plugin/config/index.ts delete mode 100644 plugins/my-plugin/config/plugin.ts delete mode 100644 plugins/my-plugin/entities/PluginEntity.ts delete mode 100644 plugins/my-plugin/entities/index.ts delete mode 100644 plugins/my-plugin/events/ready.ts delete mode 100644 plugins/my-plugin/guards/.gitkeep delete mode 100644 plugins/my-plugin/i18n/en.ts delete mode 100644 plugins/my-plugin/i18n/fr.ts delete mode 100644 plugins/my-plugin/plugin.json delete mode 100644 plugins/my-plugin/services/PluginService.ts delete mode 100644 plugins/my-plugin/services/index.ts delete mode 100644 plugins/my-plugin/utils/classes/.gitkeep delete mode 100644 plugins/my-plugin/utils/decorators/.gitkeep delete mode 100644 plugins/my-plugin/utils/errors/.gitkeep delete mode 100644 plugins/my-plugin/utils/functions/.gitkeep delete mode 100644 plugins/my-plugin/utils/types/pluginconfig.d.ts delete mode 100644 src/i18n/en/My Awesome Plugin/index.ts delete mode 100644 src/i18n/fr/My Awesome Plugin/index.ts diff --git a/.swcrc b/.swcrc index 72c18d52..f81eb341 100644 --- a/.swcrc +++ b/.swcrc @@ -10,37 +10,37 @@ "baseUrl": "./", "paths": { "@decorators": ["src/utils/decorators"], - "@decorators/*": ["plugins/*/utils/decorators"], + "@decorators/*": ["src/plugins/*/utils/decorators"], "@errors": ["src/utils/errors"], - "@errors/*": ["plugins/*/utils/errors"], + "@errors/*": ["src/plugins/*/utils/errors"], "@entities": ["src/entities"], - "@entities/*": ["plugins/*/entities"], + "@entities/*": ["src/plugins/*/entities"], "@guards": ["src/guards"], - "@guards/*": ["plugins/*/guards"], + "@guards/*": ["src/plugins/*/guards"], "@services": ["src/services"], - "@services/*": ["plugins/*/services"], + "@services/*": ["src/plugins/*/services"], "@i18n": ["src/i18n"], - "@i18n/*": ["plugins/*/i18n"], + "@i18n/*": ["src/plugins/*/i18n"], "@config": ["src/config"], - "@config/*": ["plugins/*/config"], + "@config/*": ["src/plugins/*/config"], "@utils/classes": ["src/utils/classes"], - "@utils/classes/*": ["plugins/*/utils/classes"], + "@utils/classes/*": ["src/plugins/*/utils/classes"], "@utils/functions": ["src/utils/functions"], - "@utils/functions/*": ["plugins/*/utils/functions"], + "@utils/functions/*": ["src/plugins/*/utils/functions"], "@api/controllers": ["src/api/controllers"], - "@api/controllers/*": ["plugins/*/api/controllers"], + "@api/controllers/*": ["src/plugins/*/api/controllers"], "@api/middlewares": ["src/api/middlewares"], - "@api/middlewares/*": ["plugins/*/api/middlewares"], + "@api/middlewares/*": ["src/plugins/*/api/middlewares"], "@api/server": ["src/api/server.ts"] }, @@ -48,6 +48,7 @@ "decoratorMetadata": true } }, + "exclude": ["node_modules"], "module": { "type": "commonjs" } diff --git a/package.json b/package.json index fdb1f85c..439584e0 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "migration:create": "npx mikro-orm migration:create", "migration:up": "npx mikro-orm migration:up", "migration:down": "npx mikro-orm migration:down", - "plugins:install": "npm-recursive-install --rootDir=plugins", + "plugins:install": "npm-recursive-install --rootDir=src/plugins", "plop": "plop --plopfile ./cli/plopfile.js" }, "dependencies": { diff --git a/plugins/my-plugin/api/controllers/index.ts b/plugins/my-plugin/api/controllers/index.ts deleted file mode 100644 index 6d3c1bdc..00000000 --- a/plugins/my-plugin/api/controllers/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './plugin' \ No newline at end of file diff --git a/plugins/my-plugin/api/controllers/plugin.ts b/plugins/my-plugin/api/controllers/plugin.ts deleted file mode 100644 index 8c36162f..00000000 --- a/plugins/my-plugin/api/controllers/plugin.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { BaseController } from "@utils/classes" -import { Get, JsonController, UseBefore } from "routing-controllers" -import { pluginMiddleware } from "@api/middlewares/my-plugin" - -@JsonController("/plugin") -export class PluginController extends BaseController { - - @Get('/name') - @UseBefore(pluginMiddleware) - async name() { - - return { name: 'my-plugin' } - } -} \ No newline at end of file diff --git a/plugins/my-plugin/api/middlewares/index.ts b/plugins/my-plugin/api/middlewares/index.ts deleted file mode 100644 index 6d3c1bdc..00000000 --- a/plugins/my-plugin/api/middlewares/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './plugin' \ No newline at end of file diff --git a/plugins/my-plugin/api/middlewares/plugin.ts b/plugins/my-plugin/api/middlewares/plugin.ts deleted file mode 100644 index f2547c6b..00000000 --- a/plugins/my-plugin/api/middlewares/plugin.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { NextFunction, Request, Response } from "express" - -export async function pluginMiddleware(req: Request, res: Response, next: NextFunction) { - if(req.query.plugin == "true") next() - else res.status(400).send("Plugin param not found") -} \ No newline at end of file diff --git a/plugins/my-plugin/commands/plugin.ts b/plugins/my-plugin/commands/plugin.ts deleted file mode 100644 index 73ae566c..00000000 --- a/plugins/my-plugin/commands/plugin.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { Client } from "discordx" -import { Category } from "@discordx/utilities" -import { CommandInteraction } from "discord.js" - -import { Discord, Slash } from "@decorators" -import { Guard } from "@guards" -import { pluginConfig } from "@config/my-plugin" - -@Discord() -@Category('General') -export default class PluginCommand { - - @Slash({ - name: 'plugin', - description: 'Here goes the command description!' - }) - @Guard() - async plugin( - interaction: CommandInteraction, - client: Client, - { localize }: InteractionData - ) { - interaction.followUp('Plugin command works!\nconfig: '+pluginConfig.enabled); - } -} \ No newline at end of file diff --git a/plugins/my-plugin/config/index.ts b/plugins/my-plugin/config/index.ts deleted file mode 100644 index 4a8b37d4..00000000 --- a/plugins/my-plugin/config/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './plugin'; \ No newline at end of file diff --git a/plugins/my-plugin/config/plugin.ts b/plugins/my-plugin/config/plugin.ts deleted file mode 100644 index 5765db89..00000000 --- a/plugins/my-plugin/config/plugin.ts +++ /dev/null @@ -1,3 +0,0 @@ -export const pluginConfig: pluginConfigType = { - enabled: false, -} \ No newline at end of file diff --git a/plugins/my-plugin/entities/PluginEntity.ts b/plugins/my-plugin/entities/PluginEntity.ts deleted file mode 100644 index 978bf0ca..00000000 --- a/plugins/my-plugin/entities/PluginEntity.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { Entity, PrimaryKey, Property, EntityRepositoryType } from '@mikro-orm/core' -import { EntityRepository } from '@mikro-orm/sqlite' - -// =========================================== -// ================= Entity ================== -// =========================================== - -@Entity({ customRepository: () => PluginEntityRepository }) -export class PluginEntity { - - [EntityRepositoryType]?: PluginEntityRepository - - @PrimaryKey({ autoincrement: false }) - id: string - -} - -// =========================================== -// =========== Custom Repository ============= -// =========================================== - -export class PluginEntityRepository extends EntityRepository { - -} \ No newline at end of file diff --git a/plugins/my-plugin/entities/index.ts b/plugins/my-plugin/entities/index.ts deleted file mode 100644 index 3c2c1f70..00000000 --- a/plugins/my-plugin/entities/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './PluginEntity' \ No newline at end of file diff --git a/plugins/my-plugin/events/ready.ts b/plugins/my-plugin/events/ready.ts deleted file mode 100644 index 2af3fe27..00000000 --- a/plugins/my-plugin/events/ready.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { injectable } from 'tsyringe' - -import { Once, Discord } from '@decorators' - - -@Discord() -@injectable() -export default class ReadyEvent { - - @Once('ready') - async readyHandler() { - console.log("Plugin: Bot ready !") - } -} \ No newline at end of file diff --git a/plugins/my-plugin/guards/.gitkeep b/plugins/my-plugin/guards/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/plugins/my-plugin/i18n/en.ts b/plugins/my-plugin/i18n/en.ts deleted file mode 100644 index 2a20af44..00000000 --- a/plugins/my-plugin/i18n/en.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { BaseTranslation } from "typesafe-i18n"; - -const en: BaseTranslation = { - PLUGIN: { - NAME: "My Plugin", - DESCRIPTION: "My Plugin Description", - } -} - -export default en \ No newline at end of file diff --git a/plugins/my-plugin/i18n/fr.ts b/plugins/my-plugin/i18n/fr.ts deleted file mode 100644 index 12e13707..00000000 --- a/plugins/my-plugin/i18n/fr.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { BaseTranslation } from "typesafe-i18n"; - -const fr: BaseTranslation = { - PLUGIN: { - NAME: "Mon Plugin", - DESCRIPTION: "Description de Mon Plugin", - } -} - -export default fr \ No newline at end of file diff --git a/plugins/my-plugin/plugin.json b/plugins/my-plugin/plugin.json deleted file mode 100644 index 4898f589..00000000 --- a/plugins/my-plugin/plugin.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "author": "John Doe", - "name": "My Awesome Plugin", - "version": "1.0.0", - "tscordRequiredVersion": "1.0.0", - "description": "This plugin does awesome things", - "source": "https://github.com/johndoe/my-awesome-plugin" -} \ No newline at end of file diff --git a/plugins/my-plugin/services/PluginService.ts b/plugins/my-plugin/services/PluginService.ts deleted file mode 100644 index 0638f54a..00000000 --- a/plugins/my-plugin/services/PluginService.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { singleton } from 'tsyringe' - -@singleton() -export class pluginService { - - constructor() { - console.log("PluginService: loaded !") - } -} \ No newline at end of file diff --git a/plugins/my-plugin/services/index.ts b/plugins/my-plugin/services/index.ts deleted file mode 100644 index 587b523c..00000000 --- a/plugins/my-plugin/services/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './PluginService' \ No newline at end of file diff --git a/plugins/my-plugin/utils/classes/.gitkeep b/plugins/my-plugin/utils/classes/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/plugins/my-plugin/utils/decorators/.gitkeep b/plugins/my-plugin/utils/decorators/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/plugins/my-plugin/utils/errors/.gitkeep b/plugins/my-plugin/utils/errors/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/plugins/my-plugin/utils/functions/.gitkeep b/plugins/my-plugin/utils/functions/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/plugins/my-plugin/utils/types/pluginconfig.d.ts b/plugins/my-plugin/utils/types/pluginconfig.d.ts deleted file mode 100644 index 3a78f074..00000000 --- a/plugins/my-plugin/utils/types/pluginconfig.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -type pluginConfigType = { - enabled: boolean; -} \ No newline at end of file diff --git a/src/i18n/en/My Awesome Plugin/index.ts b/src/i18n/en/My Awesome Plugin/index.ts deleted file mode 100644 index d5ce4c4e..00000000 --- a/src/i18n/en/My Awesome Plugin/index.ts +++ /dev/null @@ -1,11 +0,0 @@ -/* eslint-disable */ -import type { BaseTranslation } from '../../i18n-types' - -const en_My_Awesome_Plugin: BaseTranslation = { - PLUGIN: { - NAME: 'My Plugin', - DESCRIPTION: 'My Plugin Description', - }, -} - -export default en_My_Awesome_Plugin diff --git a/src/i18n/fr/My Awesome Plugin/index.ts b/src/i18n/fr/My Awesome Plugin/index.ts deleted file mode 100644 index 8d970495..00000000 --- a/src/i18n/fr/My Awesome Plugin/index.ts +++ /dev/null @@ -1,11 +0,0 @@ -/* eslint-disable */ -import type { NamespaceMyAwesomePluginTranslation } from '../../i18n-types' - -const fr_My_Awesome_Plugin: NamespaceMyAwesomePluginTranslation = { - PLUGIN: { - NAME: 'Mon Plugin', - DESCRIPTION: 'Description de Mon Plugin', - }, -} - -export default fr_My_Awesome_Plugin diff --git a/src/i18n/i18n-types.ts b/src/i18n/i18n-types.ts index 6593e0d4..e2bbd146 100644 --- a/src/i18n/i18n-types.ts +++ b/src/i18n/i18n-types.ts @@ -2,19 +2,16 @@ /* eslint-disable */ import type { BaseTranslation as BaseTranslationType, LocalizedString, RequiredParams } from 'typesafe-i18n' -export type BaseTranslation = BaseTranslationType & DisallowNamespaces +export type BaseTranslation = BaseTranslationType export type BaseLocale = 'en' export type Locales = | 'en' | 'fr' -export type Translation = RootTranslation & DisallowNamespaces +export type Translation = RootTranslation -export type Translations = RootTranslation & -{ - 'My Awesome Plugin': NamespaceMyAwesomePluginTranslation -} +export type Translations = RootTranslation type RootTranslation = { GUARDS: { @@ -169,30 +166,6 @@ type RootTranslation = { } } -export type NamespaceMyAwesomePluginTranslation = { - PLUGIN: { - /** - * My Plugin - */ - NAME: string - /** - * My Plugin Description - */ - DESCRIPTION: string - } -} - -export type Namespaces = - | 'My Awesome Plugin' - -type DisallowNamespaces = { - /** - * reserved for 'My Awesome Plugin'-namespace\ - * you need to use the `./My Awesome Plugin/index.ts` file instead - */ - 'My Awesome Plugin'?: "[typesafe-i18n] reserved for 'My Awesome Plugin'-namespace. You need to use the `./My Awesome Plugin/index.ts` file instead." -} - export type TranslationFunctions = { GUARDS: { /** @@ -336,18 +309,6 @@ export type TranslationFunctions = { MESSAGE: (arg: { heartbeat: string, member: string, time: number }) => LocalizedString } } - 'My Awesome Plugin': { - PLUGIN: { - /** - * My Plugin - */ - NAME: () => LocalizedString - /** - * My Plugin Description - */ - DESCRIPTION: () => LocalizedString - } - } } export type Formatters = {} diff --git a/src/i18n/i18n-util.async.ts b/src/i18n/i18n-util.async.ts index 4f2bfbd9..a280a302 100644 --- a/src/i18n/i18n-util.async.ts +++ b/src/i18n/i18n-util.async.ts @@ -2,7 +2,7 @@ /* eslint-disable */ import { initFormatters } from './formatters' -import type { Locales, Namespaces, Translations } from './i18n-types' +import type { Locales, Translations } from './i18n-types' import { loadedFormatters, loadedLocales, locales } from './i18n-util' const localeTranslationLoaders = { @@ -10,15 +10,6 @@ const localeTranslationLoaders = { fr: () => import('./fr'), } -const localeNamespaceLoaders = { - en: { - 'My Awesome Plugin': () => import('./en/My Awesome Plugin') - }, - fr: { - 'My Awesome Plugin': () => import('./fr/My Awesome Plugin') - } -} - const updateDictionary = (locale: Locales, dictionary: Partial) => loadedLocales[locale] = { ...loadedLocales[locale], ...dictionary } @@ -34,9 +25,3 @@ export const loadAllLocalesAsync = (): Promise => Promise.all(locales.ma export const loadFormatters = (locale: Locales): void => void (loadedFormatters[locale] = initFormatters(locale)) - -export const loadNamespaceAsync = async (locale: Locales, namespace: Namespace): Promise => - void updateDictionary( - locale, - { [namespace]: (await (localeNamespaceLoaders[locale][namespace])()).default } as unknown as Partial - ) diff --git a/src/i18n/i18n-util.sync.ts b/src/i18n/i18n-util.sync.ts index a1160958..206e9dfb 100644 --- a/src/i18n/i18n-util.sync.ts +++ b/src/i18n/i18n-util.sync.ts @@ -8,18 +8,9 @@ import { loadedFormatters, loadedLocales, locales } from './i18n-util' import en from './en' import fr from './fr' -import en_My_Awesome_Plugin from './en/My Awesome Plugin' -import fr_My_Awesome_Plugin from './fr/My Awesome Plugin' - const localeTranslations = { - en: { - ...en, - 'My Awesome Plugin': en_My_Awesome_Plugin - }, - fr: { - ...fr, - 'My Awesome Plugin': fr_My_Awesome_Plugin - }, + en, + fr, } export const loadLocale = (locale: Locales): void => { diff --git a/src/i18n/i18n-util.ts b/src/i18n/i18n-util.ts index 1418915b..2c4fa894 100644 --- a/src/i18n/i18n-util.ts +++ b/src/i18n/i18n-util.ts @@ -4,7 +4,7 @@ import { i18n as initI18n, i18nObject as initI18nObject, i18nString as initI18nString } from 'typesafe-i18n' import type { LocaleDetector } from 'typesafe-i18n/detectors' import { detectLocale as detectLocaleFn } from 'typesafe-i18n/detectors' -import type { Formatters, Locales, Namespaces, Translations, TranslationFunctions } from './i18n-types' +import type { Formatters, Locales, Translations, TranslationFunctions } from './i18n-types' export const baseLocale: Locales = 'en' @@ -13,10 +13,6 @@ export const locales: Locales[] = [ 'fr' ] -export const namespaces: Namespaces[] = [ - 'My Awesome Plugin' -] - export const loadedLocales = {} as Record export const loadedFormatters = {} as Record diff --git a/src/utils/functions/localization.ts b/src/utils/functions/localization.ts index 52a7223c..51e3872f 100644 --- a/src/utils/functions/localization.ts +++ b/src/utils/functions/localization.ts @@ -52,7 +52,7 @@ export const sanitizeLocales = (option: K) => { export const getLocalizationFromPathString = (path: TranslationsNestedPaths, locale?: Locales) => { - const pathArray = path.split('.') + const pathArray = path?.split('.') || [] let currentLocalization: any = loadedLocales[locale ?? generalConfig.defaultLocale] for (const pathNode of pathArray) { diff --git a/tsconfig.json b/tsconfig.json index 82e651b0..d4ecfc2c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -22,37 +22,37 @@ "baseUrl": ".", "paths": { "@decorators": ["src/utils/decorators"], - "@decorators/*": ["plugins/*/utils/decorators"], + "@decorators/*": ["src/plugins/*/utils/decorators"], "@errors": ["src/utils/errors"], - "@errors/*": ["plugins/*/utils/errors"], + "@errors/*": ["src/plugins/*/utils/errors"], "@entities": ["src/entities"], - "@entities/*": ["plugins/*/entities"], + "@entities/*": ["src/plugins/*/entities"], "@guards": ["src/guards"], - "@guards/*": ["plugins/*/guards"], + "@guards/*": ["src/plugins/*/guards"], "@services": ["src/services"], - "@services/*": ["plugins/*/services"], + "@services/*": ["src/plugins/*/services"], "@i18n": ["src/i18n"], - "@i18n/*": ["plugins/*/i18n"], + "@i18n/*": ["src/plugins/*/i18n"], "@config": ["src/config"], - "@config/*": ["plugins/*/config"], + "@config/*": ["src/plugins/*/config"], "@utils/classes": ["src/utils/classes"], - "@utils/classes/*": ["plugins/*/utils/classes"], + "@utils/classes/*": ["src/plugins/*/utils/classes"], "@utils/functions": ["src/utils/functions"], - "@utils/functions/*": ["plugins/*/utils/functions"], + "@utils/functions/*": ["src/plugins/*/utils/functions"], "@api/controllers": ["src/api/controllers"], - "@api/controllers/*": ["plugins/*/api/controllers"], + "@api/controllers/*": ["src/plugins/*/api/controllers"], "@api/middlewares": ["src/api/middlewares"], - "@api/middlewares/*": ["plugins/*/api/middlewares"], + "@api/middlewares/*": ["src/plugins/*/api/middlewares"], "@api/server": ["src/api/server.ts"] } @@ -60,7 +60,7 @@ "include": ["src", "**/*.ts"], "exclude": ["build", "node_modules", "tests"], - "paths": ["node_modules/*", "src/utils/types/*", "plugins/*/utils/types/*"], + "paths": ["node_modules/*", "src/utils/types/*", "src/plugins/*/utils/types/*"], "ts-node": { "require": ["tsconfig-paths/register"] From 76a2d58a63e54385974e5786b04b4b4da06f1a59 Mon Sep 17 00:00:00 2001 From: Artemus <31190188+Mr-Artemus@users.noreply.github.com> Date: Tue, 20 Sep 2022 19:26:48 +0000 Subject: [PATCH 10/29] feat(#73): Missing plugins folder --- src/plugins/.gitkeep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/plugins/.gitkeep diff --git a/src/plugins/.gitkeep b/src/plugins/.gitkeep new file mode 100644 index 00000000..e69de29b From ffb0fdd0ead5f83f0e5d189bfb646706e10b1032 Mon Sep 17 00:00:00 2001 From: Artemus <31190188+Mr-Artemus@users.noreply.github.com> Date: Sat, 24 Sep 2022 14:48:28 +0000 Subject: [PATCH 11/29] feat(#73): fix path in PluginsManager --- src/services/PluginsManager.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/PluginsManager.ts b/src/services/PluginsManager.ts index ef039308..2f3ae8bd 100644 --- a/src/services/PluginsManager.ts +++ b/src/services/PluginsManager.ts @@ -14,7 +14,7 @@ export class PluginsManager { constructor() {} public async loadPlugins(): Promise { - const pluginPaths = resolve(process.env.PWD + "/plugins/*"); + const pluginPaths = resolve(process.env.PWD + "/src/plugins/*"); for (const path of pluginPaths) { const plugin = new Plugin(path); await plugin.load(); From 29e11bec7aa8ac114055ffc0ceea58876c77c3c6 Mon Sep 17 00:00:00 2001 From: Artemus <31190188+Mr-Artemus@users.noreply.github.com> Date: Sat, 24 Sep 2022 15:02:16 +0000 Subject: [PATCH 12/29] feat(#73):Edit ready to show plugins count --- src/services/Logger.ts | 22 ++++++++++++---------- src/services/PluginsManager.ts | 18 ++++++++++-------- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/src/services/Logger.ts b/src/services/Logger.ts index 62c9574f..520935a0 100644 --- a/src/services/Logger.ts +++ b/src/services/Logger.ts @@ -14,6 +14,7 @@ import { formatDate, getTypeOfInteraction, numberAlign, oneLine, resolveAction, import { Scheduler, WebSocket, Pastebin } from '@services' import { apiConfig, logsConfig } from '@config' import { resolve } from '@discordx/importer' +import { PluginsManager } from './PluginsManager' @singleton() export class Logger { @@ -22,7 +23,8 @@ export class Logger { @inject(delay(() => Client)) private client: Client, @inject(delay(() => Scheduler)) private scheduler: Scheduler, @inject(delay(() => WebSocket)) private ws: WebSocket, - @inject(delay(() => Pastebin)) private pastebin: Pastebin + @inject(delay(() => Pastebin)) private pastebin: Pastebin, + @inject(delay(() => PluginsManager)) private pluginsManager: PluginsManager ) { this.defaultConsole = { ...console } console.log = (...args) => this.log("info", args.join(", ")) @@ -397,22 +399,17 @@ export class Logger { && !entity.startsWith('BaseEntity') ) - const pluginsEntites = resolve(`${__dirname}/../../plugins/*/entities`) - .filter(entity => - !entity.startsWith('index') - && !entity.startsWith('BaseEntity') - ) + const pluginsEntitesCount = this.pluginsManager.plugins.reduce((acc, plugin) => acc + Object.values(plugin.entities).length, 0) - this.console('info', chalk.red(`${symbol} ${numberAlign(entities.length + pluginsEntites.length)} ${chalk.bold('entities')} loaded`), true) + this.console('info', chalk.red(`${symbol} ${numberAlign(entities.length + pluginsEntitesCount)} ${chalk.bold('entities')} loaded`), true) // services const services = fs.readdirSync(`${__dirname}/../services`) .filter(service => !service.startsWith('index')) - const pluginsServices = resolve(`${__dirname}/../../plugins/*/services`) - .filter(service => !service.startsWith('index')) + const pluginsServicesCount = this.pluginsManager.plugins.reduce((acc, plugin) => acc + Object.values(plugin.services).length, 0) - this.console('info', chalk.yellow(`${symbol} ${numberAlign(services.length + pluginsServices.length)} ${chalk.bold('services')} loaded`), true) + this.console('info', chalk.yellow(`${symbol} ${numberAlign(services.length + pluginsServicesCount)} ${chalk.bold('services')} loaded`), true) // api if (apiConfig.enabled) { @@ -428,6 +425,11 @@ export class Logger { const scheduledJobs = this.scheduler.jobs.size this.console('info', chalk.green(`${symbol} ${numberAlign(scheduledJobs)} ${chalk.bold('scheduled jobs')} loaded`), true) + + // plugins + const pluginsCount = this.pluginsManager.plugins.length + + this.console('info', chalk.hex('#47d188')(`${symbol} ${numberAlign(pluginsCount)} ${chalk.bold('plugin' + (pluginsCount > 1 ? 's':''))} loaded`), true) // connected if (apiConfig.enabled) { diff --git a/src/services/PluginsManager.ts b/src/services/PluginsManager.ts index 2f3ae8bd..46a37568 100644 --- a/src/services/PluginsManager.ts +++ b/src/services/PluginsManager.ts @@ -9,7 +9,7 @@ import { AnyEntity, EntityClass } from "@mikro-orm/core"; @singleton() export class PluginsManager { - private plugins: Plugin[] = []; + private _plugins: Plugin[] = []; constructor() {} @@ -27,25 +27,25 @@ export class PluginsManager { } public getEntities(): EntityClass[] { - return this.plugins.map(plugin => Object.values(plugin.entities)).flat() + return this._plugins.map(plugin => Object.values(plugin.entities)).flat() } public getControllers(): typeof BaseController[] { - return this.plugins.map(plugin => Object.values(plugin.controllers)).flat() + return this._plugins.map(plugin => Object.values(plugin.controllers)).flat() } public async importCommands(): Promise { - for (const plugin of this.plugins) await plugin.importCommands(); + for (const plugin of this._plugins) await plugin.importCommands(); } public async importEvents(): Promise { - for (const plugin of this.plugins) await plugin.importEvents(); + for (const plugin of this._plugins) await plugin.importEvents(); } public async initServices(): Promise<{ [key: string]: any }> { let services: { [key: string]: any } = {}; - for (const plugin of this.plugins) { + for (const plugin of this._plugins) { for(const service in plugin.services) { services[service] = new plugin.services[service](); } @@ -55,7 +55,7 @@ export class PluginsManager { } public async execMains(): Promise { - for (const plugin of this.plugins) await plugin.execMain(); + for (const plugin of this._plugins) await plugin.execMain(); } public async syncTranslations(saveToDisk: boolean = true, generateTypes?: boolean): Promise { @@ -63,7 +63,7 @@ export class PluginsManager { let namespaces: { [key: string]: string[] } = {}; let translations: { [key: string]: BaseTranslation } = { ...defaultTranslations }; - for (const plugin of this.plugins) { + for (const plugin of this._plugins) { for (const locale in plugin.translations) { if(!translations[locale]) translations[locale] = {}; if(!namespaces[locale]) namespaces[locale] = []; @@ -84,4 +84,6 @@ export class PluginsManager { if(saveToDisk) await storeTranslationsToDisk(localeMapping, generateTypes); } + + get plugins() { return this._plugins; } } \ No newline at end of file From f6ea8e12e865fc6e4d0d25305d5e00b0a8604205 Mon Sep 17 00:00:00 2001 From: Artemus <31190188+Mr-Artemus@users.noreply.github.com> Date: Mon, 26 Sep 2022 21:24:30 +0000 Subject: [PATCH 13/29] feat(#73): Load and unload plugin translations auto --- package.json | 6 ++---- src/services/PluginsManager.ts | 17 +++++++++++++---- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 439584e0..3204303a 100644 --- a/package.json +++ b/package.json @@ -11,10 +11,8 @@ "build:clean": "rimraf build", "serve": "cross-env NODE_ENV=production node build/main.js", "start": "cross-env NODE_ENV=production node -r @swc-node/register src/main.ts", - "dev": "npm-run-all --parallel dev:i18n dev:watch", - "dev:watch": "cross-env NODE_ENV=development nodemon --exec node -r @swc-node/register src/main.ts", + "dev": "cross-env NODE_ENV=development nodemon --exec node -r @swc-node/register src/main.ts", "dev:compile": "swc src -w -d build", - "dev:i18n": "typesafe-i18n", "type:check": "tsc --pretty --skipLibCheck --noEmit", "migration:create": "npx mikro-orm migration:create", "migration:up": "npx mikro-orm migration:up", @@ -122,7 +120,7 @@ }, "nodemonConfig": { "ignore": [ - "src/i18n/**/!(index.ts)" + "src/i18n/**/!(i18n-types.ts)" ] } } diff --git a/src/services/PluginsManager.ts b/src/services/PluginsManager.ts index 46a37568..8e3b1556 100644 --- a/src/services/PluginsManager.ts +++ b/src/services/PluginsManager.ts @@ -1,10 +1,11 @@ import { ImportLocaleMapping, storeTranslationsToDisk } from "typesafe-i18n/importer"; import { resolve } from "@discordx/importer"; import { singleton } from "tsyringe"; +import fs from "fs"; import { BaseController, Plugin } from "@utils/classes"; import { BaseTranslation } from "typesafe-i18n"; -import { defaultTranslations } from "@i18n"; +import { defaultTranslations, L } from "@i18n"; import { AnyEntity, EntityClass } from "@mikro-orm/core"; @singleton() @@ -58,7 +59,7 @@ export class PluginsManager { for (const plugin of this._plugins) await plugin.execMain(); } - public async syncTranslations(saveToDisk: boolean = true, generateTypes?: boolean): Promise { + public async syncTranslations(saveToDisk: boolean = true): Promise { let localeMapping: ImportLocaleMapping[] = []; let namespaces: { [key: string]: string[] } = {}; let translations: { [key: string]: BaseTranslation } = { ...defaultTranslations }; @@ -81,8 +82,16 @@ export class PluginsManager { namespaces: namespaces[locale] }); } - - if(saveToDisk) await storeTranslationsToDisk(localeMapping, generateTypes); + + const pluginsName = this._plugins.map(plugin => plugin.name); + for(const path of await resolve(process.env.PWD + "/src/i18n/*/*/index.ts")) { + const name = path.split("/").at(-2) || ""; + if(!pluginsName.includes(name)) { + await fs.rmSync(path.slice(0, -8), { recursive: true, force: true }); + } + } + + if(saveToDisk) await storeTranslationsToDisk(localeMapping, true); } get plugins() { return this._plugins; } From 4f4dcdefee40495ea0e79588f296c692c341c648 Mon Sep 17 00:00:00 2001 From: Artemus <31190188+Mr-Artemus@users.noreply.github.com> Date: Mon, 26 Sep 2022 21:29:52 +0000 Subject: [PATCH 14/29] feat(#73):Force storeTranslationsToDisk when syncing translations --- src/services/PluginsManager.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/services/PluginsManager.ts b/src/services/PluginsManager.ts index 8e3b1556..6f160200 100644 --- a/src/services/PluginsManager.ts +++ b/src/services/PluginsManager.ts @@ -5,7 +5,7 @@ import fs from "fs"; import { BaseController, Plugin } from "@utils/classes"; import { BaseTranslation } from "typesafe-i18n"; -import { defaultTranslations, L } from "@i18n"; +import { defaultTranslations } from "@i18n"; import { AnyEntity, EntityClass } from "@mikro-orm/core"; @singleton() @@ -59,7 +59,7 @@ export class PluginsManager { for (const plugin of this._plugins) await plugin.execMain(); } - public async syncTranslations(saveToDisk: boolean = true): Promise { + public async syncTranslations(): Promise { let localeMapping: ImportLocaleMapping[] = []; let namespaces: { [key: string]: string[] } = {}; let translations: { [key: string]: BaseTranslation } = { ...defaultTranslations }; @@ -91,7 +91,7 @@ export class PluginsManager { } } - if(saveToDisk) await storeTranslationsToDisk(localeMapping, true); + await storeTranslationsToDisk(localeMapping, true); } get plugins() { return this._plugins; } From 3ee3c30f524e2f1f7d42919c5490139ce9efbd7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartholom=C3=A9=20Gili?= Date: Wed, 5 Oct 2022 22:43:58 +0200 Subject: [PATCH 15/29] merge: branch 'main' into 73-feature-plugins --- .docker/app/Dockerfile | 4 +- .github/COMMIT_CONVENTION.md | 4 +- .github/CONTRIBUTING.md | 56 +- .github/ISSUE_TEMPLATE/feature-request.yml | 2 +- .github/workflows/build.yml | 2 +- .typesafe-i18n.json | 2 +- README.md | 53 +- cli/generators/command.js | 30 - cli/generators/entity.js | 25 - cli/generators/event.js | 25 - cli/generators/guard.js | 25 - cli/generators/templates/command.ts.hbs | 25 - cli/generators/templates/entity.ts.hbs | 28 - cli/generators/templates/event.ts.hbs | 37 - cli/generators/templates/guard.ts.hbs | 11 - cli/plopfile.js | 13 - package-lock.json | 1439 +++++++++++--------- package.json | 162 +-- pm2.config.json | 2 +- src/api/controllers/bot.ts | 2 +- src/api/controllers/database.ts | 10 +- src/api/controllers/stats.ts | 18 +- src/api/middlewares/log.ts | 4 +- src/commands/General/info.ts | 2 +- src/entities/index.ts | 2 +- src/events/custom/guildAdmin.ts | 4 +- src/events/ready.ts | 2 +- src/i18n/i18n-types.ts | 54 +- src/i18n/i18n-util.async.ts | 8 +- src/i18n/i18n-util.sync.ts | 5 +- src/i18n/i18n-util.ts | 2 + src/services/Database.ts | 18 +- src/services/ErrorHandler.ts | 2 +- src/services/ImagesUpload.ts | 13 +- src/services/Logger.ts | 126 +- src/services/Stats.ts | 81 +- src/utils/classes/BaseError.ts | 4 + src/utils/decorators/On.ts | 5 +- src/utils/decorators/Slash.ts | 5 +- src/utils/errors/InvalidOptionName.ts | 4 +- src/utils/errors/NoBotToken.ts | 4 +- src/utils/functions/dependency.ts | 4 +- src/utils/functions/fs.ts | 6 + src/utils/functions/image.ts | 2 +- src/utils/types/localization.d.ts | 4 +- 45 files changed, 1214 insertions(+), 1122 deletions(-) delete mode 100644 cli/generators/command.js delete mode 100644 cli/generators/entity.js delete mode 100644 cli/generators/event.js delete mode 100644 cli/generators/guard.js delete mode 100644 cli/generators/templates/command.ts.hbs delete mode 100644 cli/generators/templates/entity.ts.hbs delete mode 100644 cli/generators/templates/event.ts.hbs delete mode 100644 cli/generators/templates/guard.ts.hbs delete mode 100644 cli/plopfile.js diff --git a/.docker/app/Dockerfile b/.docker/app/Dockerfile index 8d1349b9..ef604a29 100644 --- a/.docker/app/Dockerfile +++ b/.docker/app/Dockerfile @@ -1,5 +1,5 @@ ## build runner -FROM node:17.6-alpine as build-runner +FROM node:16.17-alpine as build-runner # Set temp directory WORKDIR /tmp/app @@ -21,7 +21,7 @@ COPY tsconfig.json . RUN npm run build ## producation runner -FROM node:17.6-alpine as prod-runner +FROM node:16.17-alpine as prod-runner # set production mode ARG NODE_ENV=production diff --git a/.github/COMMIT_CONVENTION.md b/.github/COMMIT_CONVENTION.md index 3dd98ec9..3f35d58f 100644 --- a/.github/COMMIT_CONVENTION.md +++ b/.github/COMMIT_CONVENTION.md @@ -58,11 +58,11 @@ If the prefix is `feat`, `fix` or `perf`, it will appear in the changelog. Howev Other prefixes are up to your discretion. Suggested prefixes are `build`, `ci`, `docs` ,`style`, `refactor`, and `test` for non-changelog related tasks. -Details regarding these types can be found in the official [Discord.ts Contributing Guidelines](https://github.com/oceanroleplay/discord.ts/blob/main/.github/CONTRIBUTING.md#type). +Details regarding these types can be found in the official [TSCord Contributing Guidelines](https://github.com/barthofu/tscord/blob/main/.github/CONTRIBUTING.md#type). ### Scope -The scope could be anything specifying the place of the commit change. For example `Decorator`, `Message`, `Embed` etc... +The scope could be anything specifying the place of the commit change. For example `services`, `commands`, `cli` etc... ### Subject diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 6bcb1dbe..a6055875 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -1,6 +1,6 @@ -# Contributing to discord.ts +# Contributing to TSCord -We would love for you to contribute to discord.ts and help make it even better than it is today! +We would love for you to contribute to TSCord and help make it even better than it is today! As a contributor, here are the guidelines we would like you to follow: - [Code of Conduct](#coc) @@ -14,13 +14,13 @@ As a contributor, here are the guidelines we would like you to follow: ## Code of Conduct -Help us keep discord.ts open and inclusive. +Help us keep TSCord open and inclusive. Please read and follow our [Code of Conduct][coc]. ## Got a Question or Problem? Do not open issues for general support questions as we want to keep GitHub issues for bug reports and feature requests. -Instead, we recommend using [Discord Server](https://discord-ts.js.org/discord) to ask support-related questions. +Instead, we recommend using [Discord Server](https://discord.gg/8P7jFpbKkb) to ask support-related questions. Discord is a much better place to ask questions since: @@ -64,13 +64,13 @@ We understand that sometimes it might be hard to extract essential bits of code Unfortunately, we are not able to investigate / fix bugs without a minimal reproduction, so if we don't hear back from you, we are going to close an issue that doesn't have enough info to be reproduced. -You can file new issues by selecting from our [new issue templates](https://github.com/oceanroleplay/discord.ts/issues/new/choose) and filling out the issue template. +You can file new issues by selecting from our [new issue templates](https://github.com/barthofu/tscord/issues/new/choose) and filling out the issue template. ### Submitting a Pull Request (PR) Before you submit your Pull Request (PR) consider the following guidelines: -1. Search [GitHub](https://github.com/oceanroleplay/discord.ts/pulls) for an open or closed PR that relates to your submission. +1. Search [GitHub](https://github.com/oceanroleplay/TSCord/pulls) for an open or closed PR that relates to your submission. You don't want to duplicate existing efforts. 2. Be sure that an issue describes the problem you're fixing, or documents the design for the feature you'd like to add. @@ -80,7 +80,7 @@ Before you submit your Pull Request (PR) consider the following guidelines: We cannot accept code without a signed CLA. Make sure you author all contributed Git commits with email address associated with your CLA signature. -4. [Fork](https://docs.github.com/en/github/getting-started-with-github/fork-a-repo) the oceanroleplay/discord.ts repo. +4. [Fork](https://docs.github.com/en/github/getting-started-with-github/fork-a-repo) the `barthofu/tscord` repo. 5. In your forked repository, make your changes in a new git branch: @@ -88,11 +88,11 @@ Before you submit your Pull Request (PR) consider the following guidelines: git checkout -b my-fix-branch master ``` -6. Create your patch, **including appropriate test cases**. +6. Create your patch. 7. Follow our [Coding Rules](#rules). -8. Run the full discord.ts test suite, as described in the [developer documentation][dev-doc], and ensure that all tests pass. +8. Make sure to test your changes. 9. Commit your changes using a descriptive commit message that follows our [commit message conventions](#commit). Adherence to these conventions is necessary because release notes are automatically generated from these messages. @@ -109,11 +109,11 @@ Before you submit your Pull Request (PR) consider the following guidelines: git push origin my-fix-branch ``` -11. In GitHub, send a pull request to `discord.ts:main`. +11. In GitHub, send a pull request to `tscord:main`. ### Reviewing a Pull Request -The discord.ts team reserves the right not to accept pull requests from community members who haven't been good citizens of the community. Such behavior includes not following the [discord.ts code of conduct](https://github.com/oceanroleplay/discord.ts/blob/main/.github/CODE_OF_CONDUCT.md) and applies within or outside of discord.ts managed channels. +The TSCord team reserves the right not to accept pull requests from community members who haven't been good citizens of the community. Such behavior includes not following the [TSCord code of conduct](https://github.com/barthofu/tscord/blob/main/.github/CODE_OF_CONDUCT.md) and applies within or outside of TSCord managed channels. #### Addressing review feedback @@ -121,17 +121,13 @@ If we ask for changes via code reviews then: 1. Make the required updates to the code. -2. Re-run the discoord.ts test suites to ensure tests are still passing. - -3. Create a fixup commit and push to your GitHub repository (this will update your Pull Request): +2. Create a fixup commit and push to your GitHub repository (this will update your Pull Request): ```shell git commit --all --fixup HEAD git push ``` - For more info on working with fixup commits see [here](docs/FIXUP_COMMITS.md). - That's it! Thank you for your contribution! ##### Updating the commit message @@ -157,7 +153,7 @@ In order to update the commit message of the last commit on your branch: git push --force-with-lease ``` -> NOTE:
+> **info** > If you need to update the commit message of an earlier commit, you can use `git rebase` in interactive mode. > See the [git docs](https://git-scm.com/docs/git-rebase#_interactive_mode) for more details. @@ -193,15 +189,12 @@ After your pull request is merged, you can safely delete your branch and pull th To ensure consistency throughout the source code, keep these rules in mind as you are working: -- All features or bug fixes **must be tested** by one or more specs (unit-tests). +- All features or bug fixes **must be tested**. - All public API methods **must be documented**. -- We follow [Google's JavaScript Style Guide][js-style-guide], but wrap all code at **100 characters**. - - An automated formatter is available, see [DEVELOPER.md](docs/DEVELOPER.md#clang-format). ## Commit Message Format -_This specification is inspired by and supersedes the [discord.ts commit message format][commit-message-format]._ +_This specification is inspired by and supersedes the [TSCord commit message format][commit-message-format]._ We have very precise rules over how our Git commit messages must be formatted. This format leads to **easier to read commit history**. @@ -228,7 +221,7 @@ The `footer` is optional. The [Commit Message Footer](#commit-footer) format des ``` (): │ │ │ - │ │ └─⫸ Summary in present tense. Not capitalized. No period at the end. + │ │ └─⫸ Summary in present tense. **Not capitalized**. No period at the end. │ │ │ └─⫸ Commit Scope: animations|bazel|benchpress|common|compiler|compiler-cli|core| │ elements|forms|http|language-service|localize|platform-browser| @@ -259,10 +252,19 @@ The scope should be the name of the npm package affected (as perceived by the pe The following is the list of supported scopes: -- `decorator` -- `music` -- `utilities` - +- `api` +- `commands` +- `config` +- `entities` +- `events` +- `guards` +- `i18n` +- `services` +- `utils` +- `cli` +OR +- if the commits are relative to an issue, you can pass the `#{id}` of the issue (e.g: `fix(#51): api error handling`) +OR - none/empty string: useful for `test` and `refactor` changes that are done across all packages (e.g. `test: add missing unit tests`) and for docs changes that are not related to a specific package (e.g. `docs: fix typo in tutorial`). ##### Summary diff --git a/.github/ISSUE_TEMPLATE/feature-request.yml b/.github/ISSUE_TEMPLATE/feature-request.yml index fd9a5af6..4c4a548d 100644 --- a/.github/ISSUE_TEMPLATE/feature-request.yml +++ b/.github/ISSUE_TEMPLATE/feature-request.yml @@ -13,7 +13,7 @@ body: - type: textarea id: feature attributes: - label: Feature? + label: Feature description: Please describe the feature you are requesting in detail placeholder: describe.... validations: diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d94804be..f0482326 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,7 +24,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v3 with: - node-version: 17.6.0 + node-version: 16.17.0 cache: 'npm' - name: Install dependencies diff --git a/.typesafe-i18n.json b/.typesafe-i18n.json index df8312e2..0293f59e 100644 --- a/.typesafe-i18n.json +++ b/.typesafe-i18n.json @@ -1,4 +1,4 @@ { - "$schema": "https://unpkg.com/typesafe-i18n@5.5.2/schema/typesafe-i18n.json", + "$schema": "https://unpkg.com/typesafe-i18n@5.14.0/schema/typesafe-i18n.json", "adapter": "node" } \ No newline at end of file diff --git a/README.md b/README.md index 26189c9f..530d5769 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,13 @@

+
+
-# 🌟 What is TSCord +# What is TSCord #### **TSCord** is a fully-featured **[discord bot](https://discord.com/developers/docs/intro#bots-and-apps)** *template* written in [Typescript](https://www.typescriptlang.org/), intended to provide a framework that's easy to use, extend and modify. @@ -17,6 +19,45 @@ This template was created to give developers a starting point for new Discord bo
+ + + + +
+ㅤ + +ㅤ **[To know how to use TSCord and all its components, check the documentation here]()** ㅤ + +
+ +*But TSCord is not only a Discord bot template...* + + + + + + +
+ +### [Dashboard](https://github.com/barthofu/tscord-dashboard) + +**A ready-to-use fancy dashboard for your TSCord bot!** + + + + + +### [Website](https://github.com/barthofu/tscord-website) + +**Static front homepage for your TSCord-based bot!** + +https://user-images.githubusercontent.com/66025667/184621486-7340157f-b7fc-44ea-94a9-03d76a99384c.mp4 + +
+ +
+ + ## 📜 Features Talking about features, here are some of the core features of the template: @@ -45,7 +86,7 @@ Talking about features, here are some of the core features of the template: - Automatic **static assets upload** to [imgur](https://imgur.com/) - **WebSocket** server with decorators driven events system -This template is also developper friendly and follow strict design patterns to ease its maintenance: +This template is also developer friendly and follow strict design patterns to ease its maintenance: - Written in **Typescript** - Built around the **Dependency Injection** and **Singleton** patterns - Use of battle-tested **libraries** under the hood (*discord.ts* and *discord.js*) @@ -101,7 +142,7 @@ You can also find useful documentations at: - [x] Other databases support - [x] MySQL - [x] MariaDB - - [x] PosgreSQL + - [x] PostgreSQL - [x] Automatic backup - [x] Automatic assets upload and association - [x] Users/Guilds sync with database @@ -147,8 +188,8 @@ You can also find useful documentations at: #### Other - [ ] Documentation using [docusaurus](https://docusaurus.io) - [x] Comment code -- [x] Readme ([exemple](https://github.com/cristianireyes/ds-bot-core)) -- [x] Issues templates ([exemple](https://github.com/oceanroleplay/discord.ts/issues/new/choose)) +- [x] Readme ([example](https://github.com/cristianireyes/ds-bot-core)) +- [x] Issues templates ([example](https://github.com/oceanroleplay/discord.ts/issues/new/choose)) - [x] Code of conduct - [x] JSDoc - ~~ESlint / Prettier~~ @@ -156,7 +197,7 @@ You can also find useful documentations at: #### Bonus - [ ] Beautify discord channels logs - [ ] `info` command -- [ ] Online dashboard for stats viuzalisation, monitoring, etc (using [Next.js](https://nextjs.org/) and [@discordx/koa](https://www.npmjs.com/package/@discordx/koa)) +- [ ] Online dashboard for stats visualization, monitoring, etc (using [Next.js](https://nextjs.org/) and [@discordx/koa](https://www.npmjs.com/package/@discordx/koa)) - [ ] Extensions - [ ] Convert the template as an `npx` auto generated boilerplate (using [plop](https://github.com/plopjs/plop)) - [ ] Multiple database server instances connections diff --git a/cli/generators/command.js b/cli/generators/command.js deleted file mode 100644 index b74a45da..00000000 --- a/cli/generators/command.js +++ /dev/null @@ -1,30 +0,0 @@ -const fs = require('fs') - -module.exports = (plop) => { - - const categories = fs.readdirSync('./src/commands/').filter(category => !category.includes('.')) - - plop.setGenerator('command', { - - description: 'Create a new command file', - - prompts: [ - { - type: 'input', - name: 'name', - message: 'What is the name of the command file?', - }, - { - type: 'list', - name: 'category', - message: 'Category of your command', - choices: categories - } - ], - actions: [{ - type: 'add', - path: '../src/commands/{{pascalCase category}}/{{camelCase name}}.ts', - templateFile: 'templates/command.ts.hbs', - }] - }) -} \ No newline at end of file diff --git a/cli/generators/entity.js b/cli/generators/entity.js deleted file mode 100644 index f18b1a04..00000000 --- a/cli/generators/entity.js +++ /dev/null @@ -1,25 +0,0 @@ -module.exports = (plop) => { - - plop.setGenerator('entity', { - - description: 'Create a new entity', - - prompts: [{ - type: 'input', - name: 'name', - message: 'What is the name of the entity?', - }], - actions: [ - { - type: 'add', - path: '../src/entities/{{pascalCase name}}.ts', - templateFile: 'templates/entity.ts.hbs', - }, - { - type: 'append', - path: '../src/entities/index.ts', - template: 'export * from \'./{{pascalCase name}}\'', - } - ] - }) -} \ No newline at end of file diff --git a/cli/generators/event.js b/cli/generators/event.js deleted file mode 100644 index e9870de8..00000000 --- a/cli/generators/event.js +++ /dev/null @@ -1,25 +0,0 @@ -module.exports = (plop) => { - - plop.setGenerator('event', { - - description: 'Create a new event file', - - prompts: [ - { - type: 'input', - name: 'name', - message: 'What is the name of the event file?', - }, - { - type: 'confirm', - name: 'customEvent', - message: 'Is your event a custom event?', - } - ], - actions: [{ - type: 'add', - path: '../src/events/{{#if customEvent}}custom/{{/if}}{{camelCase name}}.ts', - templateFile: 'templates/event.ts.hbs', - }] - }) -} \ No newline at end of file diff --git a/cli/generators/guard.js b/cli/generators/guard.js deleted file mode 100644 index 82acded5..00000000 --- a/cli/generators/guard.js +++ /dev/null @@ -1,25 +0,0 @@ -module.exports = (plop) => { - - plop.setGenerator('guard', { - - description: 'Create a new guard function', - - prompts: [{ - type: 'input', - name: 'name', - message: 'What is the name of the guard?', - }], - actions: [ - { - type: 'add', - path: '../src/guards/{{camelCase name}}.ts', - templateFile: 'templates/guard.ts.hbs', - }, - { - type: 'append', - path: '../src/guards/index.ts', - template: 'export * from \'./{{camelCase name}}\'', - } - ] - }) -} \ No newline at end of file diff --git a/cli/generators/templates/command.ts.hbs b/cli/generators/templates/command.ts.hbs deleted file mode 100644 index 37f0817e..00000000 --- a/cli/generators/templates/command.ts.hbs +++ /dev/null @@ -1,25 +0,0 @@ -import { Client } from "discordx" -import { Category } from "@discordx/utilities" -import { CommandInteraction } from "discord.js" - -import { Discord, Slash } from "@decorators" -import { Guard } from "@guards" - -@Discord() -@Category('{{pascalCase category}}') -export default class {{pascalCase name}}Command { - - @Slash({ - name: '{{camelCase name}}', - description: 'Here goes the command description!' - }) - @Guard() - async {{camelCase name}}( - interaction: CommandInteraction, - client: Client, - { localize }: InteractionData - ) { - - interaction.reply('{{camelCase name}} command invoked!') - } -} \ No newline at end of file diff --git a/cli/generators/templates/entity.ts.hbs b/cli/generators/templates/entity.ts.hbs deleted file mode 100644 index 4e47ebfd..00000000 --- a/cli/generators/templates/entity.ts.hbs +++ /dev/null @@ -1,28 +0,0 @@ -import { Entity, PrimaryKey, Property, EntityRepositoryType } from '@mikro-orm/core' -import { EntityRepository } from '@mikro-orm/sqlite' - -import { CustomBaseEntity } from './BaseEntity' - -// =========================================== -// ================= Entity ================== -// =========================================== - -@Entity({ customRepository: () => {{pascalCase name}}Repository }) -export class {{pascalCase name}} extends CustomBaseEntity { - - [EntityRepositoryType]?: {{pascalCase name}}Repository - - @PrimaryKey() - id: number - - @Property() - name: string -} - -// =========================================== -// =========== Custom Repository ============= -// =========================================== - -export class {{pascalCase name}}Repository extends EntityRepository<{{pascalCase name}}> { - -} \ No newline at end of file diff --git a/cli/generators/templates/event.ts.hbs b/cli/generators/templates/event.ts.hbs deleted file mode 100644 index c80f578d..00000000 --- a/cli/generators/templates/event.ts.hbs +++ /dev/null @@ -1,37 +0,0 @@ -import { ArgsOf, Client } from 'discordx' - -import { On, Discord } from '@decorators' - -@Discord() -export default class {{pascalCase name}}Event { - - {{#if customEvent}} - // ============================= - // ========= Handlers ========== - // ============================= - - {{/if}} - @On('{{camelCase name}}') - async {{camelCase name}}Handler( - [arg]: {{#if customEvent}}any{{else}}ArgsOf<'{{camelCase name}}'>{{/if}}, - client: Client - ) { - - console.log('{{camelCase name}} event triggered!') - } - - {{#if customEvent}} - // ============================= - // ========== Emitter ========== - // ============================= - - @On('EMITTER_EVENT_HERE') - async {{camelCase name}}Emitter( - [arg]: any, - client: Client - ) { - - client.emit('{{camelCase name}}', arg, client) - } - {{/if}} -} \ No newline at end of file diff --git a/cli/generators/templates/guard.ts.hbs b/cli/generators/templates/guard.ts.hbs deleted file mode 100644 index e6477979..00000000 --- a/cli/generators/templates/guard.ts.hbs +++ /dev/null @@ -1,11 +0,0 @@ -import type { ArgsOf, GuardFunction } from "discordx" - -/** - * Prevent ... - */ -export const {{pascalCase name}}: GuardFunction< - | ArgsOf<"interactionCreate"> -> = async (arg, client, next) => { - - next() -} \ No newline at end of file diff --git a/cli/plopfile.js b/cli/plopfile.js deleted file mode 100644 index 9675ecb2..00000000 --- a/cli/plopfile.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Plopfile generator - * - * https://github.com/amwmedia/plop - */ - -module.exports = function (plop) { - - plop.load('./generators/command.js') - plop.load('./generators/event.js') - plop.load('./generators/entity.js') - plop.load('./generators/guard.js') -} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 569fac60..82c4f06e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,89 +9,88 @@ "version": "1.0.0", "license": "MIT", "dependencies": { - "@discordx/importer": "^1.1.10", - "@discordx/music": "^4.1.0", - "@discordx/pagination": "^3.0.0", - "@discordx/utilities": "^5.0.0", - "@mikro-orm/better-sqlite": "^5.3.1", - "@mikro-orm/cli": "^5.3.1", - "@mikro-orm/core": "^5.3.1", - "@mikro-orm/mariadb": "^5.3.1", - "@mikro-orm/migrations": "^5.3.1", - "@mikro-orm/mongodb": "^5.3.1", - "@mikro-orm/mysql": "^5.3.1", - "@mikro-orm/postgresql": "^5.3.1", - "@mikro-orm/sql-highlighter": "^1.0.1", - "@mikro-orm/sqlite": "^5.3.1", - "@types/semver": "^7.3.12", - "axios": "^0.27.2", - "body-parser": "^1.20.0", - "boxen": "^5.1.2", - "case": "^1.6.3", - "chalk": "^4.1.2", - "cron": "^2.0.0", - "cron-validator": "^1.3.1", - "cross-env": "^7.0.3", - "dayjs": "^1.11.3", - "discord-api-types": "^0.36.2", - "discord-logs": "^2.2.1", - "discord-oauth2": "^2.10.0", - "discord.js": "^14.0.3", - "discordx": "^11.1.8", - "dotenv": "^16.0.1", - "fast-folder-size": "^1.7.0", - "fs": "^0.0.1-security", - "http-status-codes": "^2.2.0", - "image-hash": "^5.3.1", - "imgur": "^2.2.0", - "joi": "^17.6.0", - "koa": "^2.13.4", - "node-os-utils": "^1.3.7", - "oneline": "^1.0.3", - "ora": "^5.4.1", - "pidusage": "^3.0.0", + "@discordx/importer": "~1.1.10", + "@discordx/music": "~4.1.0", + "@discordx/pagination": "~3.0.0", + "@discordx/utilities": "~5.0.0", + "@mikro-orm/better-sqlite": "~5.3.1", + "@mikro-orm/cli": "~5.3.1", + "@mikro-orm/core": "~5.3.1", + "@mikro-orm/mariadb": "~5.3.1", + "@mikro-orm/migrations": "~5.3.1", + "@mikro-orm/mongodb": "~5.3.1", + "@mikro-orm/mysql": "~5.3.1", + "@mikro-orm/postgresql": "~5.3.1", + "@mikro-orm/sql-highlighter": "~1.0.1", + "@mikro-orm/sqlite": "~5.3.1", + "axios": "~0.27.2", + "boxen": "~5.1.2", + "case": "~1.6.3", + "chalk": "~4.1.2", + "cron": "~2.0.0", + "cron-validator": "~1.3.1", + "cross-env": "~7.0.3", + "dayjs": "~1.11.3", + "discord-api-types": "~0.36.2", + "discord-logs": "~2.2.1", + "discord-oauth2": "~2.10.0", + "discord.js": "~14.0.3", + "discordx": "~11.2.0", + "dotenv": "~16.0.1", + "fast-folder-size": "~1.7.0", + "fs": "~0.0.1-security", + "http-status-codes": "~2.2.0", + "image-hash": "~5.3.1", + "imgur": "~2.2.0", + "joi": "~17.6.0", + "koa": "~2.13.4", + "node-os-utils": "~1.3.7", + "oneline": "~1.0.3", + "ora": "~5.4.1", + "pidusage": "~3.0.0", "recursive-install": "^1.4.0", - "reflect-metadata": "^0.1.13", - "rentry-pastebin": "^1.2.3", - "routing-controllers": "^0.9.0", - "routing-controllers-openapi": "^3.1.0", - "rxeta": "^1.1.2", - "saveqlite": "^1.1.2", + "reflect-metadata": "~0.1.13", + "rentry-pastebin": "~1.2.3", + "routing-controllers": "~0.9.0", + "routing-controllers-openapi": "~3.1.0", + "rxeta": "~1.1.2", + "saveqlite": "~1.1.2", "semver": "^7.3.7", - "socket.io-client": "^4.5.1", - "stacktrace-parser": "^0.1.10", - "swagger-ui-express": "^4.5.0", - "tsyringe": "^4.6.0", - "typesafe-i18n": "^5.4.3", - "uuid": "^8.3.2" + "socket.io-client": "~4.5.1", + "stacktrace-parser": "~0.1.10", + "swagger-ui-express": "~4.5.0", + "tsyringe": "~4.7.0", + "typesafe-i18n": "^5.13.1", + "uuid": "~8.3.2" }, "devDependencies": { - "@swc-node/register": "^1.5.1", - "@swc/cli": "^0.1.57", - "@swc/core": "^1.2.245", - "@types/better-sqlite3": "^7.5.0", - "@types/cron": "^2.0.0", - "@types/dateformat": "^5.0.0", - "@types/express": "^4.17.13", - "@types/node": "^17.0.33", - "@types/node-os-utils": "^1.3.0", - "@types/pidusage": "^2.0.2", - "@types/swagger-ui-express": "^4.1.3", - "chokidar": "^3.5.3", - "concurrently": "^7.3.0", - "ncp": "^2.0.0", - "nodemon": "^2.0.19", - "npm-run-all": "^4.1.5", - "plop": "^2.3.0", - "rimraf": "^3.0.2", - "ts-node": "^10.7.0", - "tsc-alias": "^1.6.7", - "tsconfig-paths": "^4.0.0", + "@swc-node/register": "~1.5.1", + "@swc/cli": "~0.1.57", + "@swc/core": "1.3.2", + "@types/better-sqlite3": "~7.5.0", + "@types/cron": "~2.0.0", + "@types/dateformat": "~5.0.0", + "@types/express": "~4.17.13", + "@types/node": "~17.0.33", + "@types/node-os-utils": "~1.3.0", + "@types/pidusage": "~2.0.2", + "@types/semver": "^7.3.12", + "@types/swagger-ui-express": "~4.1.3", + "chokidar": "~3.5.3", + "concurrently": "~7.3.0", + "ncp": "~2.0.0", + "nodemon": "~2.0.19", + "npm-run-all": "~4.1.5", + "plop": "^2.7.6", + "rimraf": "~3.0.2", + "ts-node": "~10.7.0", + "tsc-alias": "~1.6.7", + "tsconfig-paths": "~4.0.0", "typescript": "~4.6.4" }, "engines": { - "node": ">=16.0.0", - "npm": ">=7.0.0" + "node": ">=16.9.0", + "npm": ">=8.0.0" } }, "node_modules/@babel/runtime-corejs3": { @@ -110,12 +109,22 @@ "version": "1.0.0", "license": "MIT" }, + "node_modules/@cspotcode/source-map-consumer": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz", + "integrity": "sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg==", + "dev": true, + "engines": { + "node": ">= 12" + } + }, "node_modules/@cspotcode/source-map-support": { - "version": "0.8.1", + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz", + "integrity": "sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA==", "dev": true, - "license": "MIT", "dependencies": { - "@jridgewell/trace-mapping": "0.3.9" + "@cspotcode/source-map-consumer": "0.8.0" }, "engines": { "node": ">=12" @@ -168,6 +177,20 @@ "node-pre-gyp": "bin/node-pre-gyp" } }, + "node_modules/@discordjs/node-pre-gyp/node_modules/semver": { + "version": "7.3.7", + "license": "ISC", + "peer": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/@discordjs/opus": { "version": "0.8.0", "hasInstallScript": true, @@ -274,8 +297,9 @@ } }, "node_modules/@discordx/di": { - "version": "3.0.1", - "license": "Apache-2.0", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@discordx/di/-/di-3.0.2.tgz", + "integrity": "sha512-mHvM+dscoyo5/yvQb/QHSPLdhfphNhYHKRuo1P9fphTpF150t/39kDJrEzqbTfoXBtoY/DtVD/Voni8mNgmiyw==", "dependencies": { "tsyringe": "^4.7.0", "typedi": "^0.10.0" @@ -371,28 +395,6 @@ "@hapi/hoek": "^9.0.0" } }, - "node_modules/@jridgewell/resolve-uri": { - "version": "3.0.7", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.4.13", - "dev": true, - "license": "MIT" - }, - "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.9", - "dev": true, - "license": "MIT", - "dependencies": { - "@jridgewell/resolve-uri": "^3.0.3", - "@jridgewell/sourcemap-codec": "^1.4.10" - } - }, "node_modules/@mapbox/node-pre-gyp": { "version": "1.0.9", "license": "BSD-3-Clause", @@ -411,6 +413,19 @@ "node-pre-gyp": "bin/node-pre-gyp" } }, + "node_modules/@mapbox/node-pre-gyp/node_modules/semver": { + "version": "7.3.7", + "license": "ISC", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/@mikro-orm/better-sqlite": { "version": "5.3.1", "license": "MIT", @@ -821,6 +836,20 @@ "semver": "^7.3.5" } }, + "node_modules/@npmcli/fs/node_modules/semver": { + "version": "7.3.7", + "license": "ISC", + "optional": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/@npmcli/move-file": { "version": "1.1.2", "license": "MIT", @@ -995,9 +1024,9 @@ } }, "node_modules/@swc/core": { - "version": "1.2.245", - "resolved": "https://registry.npmjs.org/@swc/core/-/core-1.2.245.tgz", - "integrity": "sha512-QbjqYkgC1AbJZqybzm3jWg13I5VhlRRODpeBb7H69h5GY1YUWdAb/mpKA5x5jh7j6VuGxJHDxYfry0Rv/MNz7w==", + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@swc/core/-/core-1.3.2.tgz", + "integrity": "sha512-p2nLRVgtaz/v5UkNW9Ur5WrQUKB5YH1X7mE15UD2kihiAMc/04wvo0SNLW0BIeGSqeFdoZQ45TX5uOIxhAvRSg==", "dev": true, "hasInstallScript": true, "bin": { @@ -1011,25 +1040,193 @@ "url": "https://opencollective.com/swc" }, "optionalDependencies": { - "@swc/core-android-arm-eabi": "1.2.245", - "@swc/core-android-arm64": "1.2.245", - "@swc/core-darwin-arm64": "1.2.245", - "@swc/core-darwin-x64": "1.2.245", - "@swc/core-freebsd-x64": "1.2.245", - "@swc/core-linux-arm-gnueabihf": "1.2.245", - "@swc/core-linux-arm64-gnu": "1.2.245", - "@swc/core-linux-arm64-musl": "1.2.245", - "@swc/core-linux-x64-gnu": "1.2.245", - "@swc/core-linux-x64-musl": "1.2.245", - "@swc/core-win32-arm64-msvc": "1.2.245", - "@swc/core-win32-ia32-msvc": "1.2.245", - "@swc/core-win32-x64-msvc": "1.2.245" + "@swc/core-android-arm-eabi": "1.3.2", + "@swc/core-android-arm64": "1.3.2", + "@swc/core-darwin-arm64": "1.3.2", + "@swc/core-darwin-x64": "1.3.2", + "@swc/core-freebsd-x64": "1.3.2", + "@swc/core-linux-arm-gnueabihf": "1.3.2", + "@swc/core-linux-arm64-gnu": "1.3.2", + "@swc/core-linux-arm64-musl": "1.3.2", + "@swc/core-linux-x64-gnu": "1.3.2", + "@swc/core-linux-x64-musl": "1.3.2", + "@swc/core-win32-arm64-msvc": "1.3.2", + "@swc/core-win32-ia32-msvc": "1.3.2", + "@swc/core-win32-x64-msvc": "1.3.2" + } + }, + "node_modules/@swc/core-android-arm-eabi": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@swc/core-android-arm-eabi/-/core-android-arm-eabi-1.3.2.tgz", + "integrity": "sha512-jCqckwATVC4HbNjjrJii6xZzFKl7ecxVtY94odGD15+7qu5VCMuLD+Pj3bYxIQxQyzvi1z8S/187uUrAKMC2/w==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "dependencies": { + "@swc/wasm": "1.2.122" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-android-arm-eabi/node_modules/@swc/wasm": { + "version": "1.2.122", + "resolved": "https://registry.npmjs.org/@swc/wasm/-/wasm-1.2.122.tgz", + "integrity": "sha512-sM1VCWQxmNhFtdxME+8UXNyPNhxNu7zdb6ikWpz0YKAQQFRGT5ThZgJrubEpah335SUToNg8pkdDF7ibVCjxbQ==", + "dev": true, + "optional": true + }, + "node_modules/@swc/core-android-arm64": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@swc/core-android-arm64/-/core-android-arm64-1.3.2.tgz", + "integrity": "sha512-zZ3EX5jmY6kTBlnAqLmIhDFGlsAB3Tiwk/sqoMLruZT1RsueDToQAXtjT5TWSlPh/GXAZyJQwqar2xIdi5pPAA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "dependencies": { + "@swc/wasm": "1.2.130" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-android-arm64/node_modules/@swc/wasm": { + "version": "1.2.130", + "resolved": "https://registry.npmjs.org/@swc/wasm/-/wasm-1.2.130.tgz", + "integrity": "sha512-rNcJsBxS70+pv8YUWwf5fRlWX6JoY/HJc25HD/F8m6Kv7XhJdqPPMhyX6TKkUBPAG7TWlZYoxa+rHAjPy4Cj3Q==", + "dev": true, + "optional": true + }, + "node_modules/@swc/core-darwin-arm64": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.3.2.tgz", + "integrity": "sha512-YQpbRkd5zhycr+Nl1mm1p7koFqr8hsY8Z7XzNjfNIaJeFsXg9wjjH7yVmedQl+If+ibaPWpS3gMWfcIoUhdvGg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-darwin-x64": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.3.2.tgz", + "integrity": "sha512-DMvvdWgi/2dHtSGk4m6OcmlW8AAEUUl7Zys+Sxp+AtyIlQvn0Lbw9HCMPG6pqC0SHEO1kcNj6f6ARt3lL25jSA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-freebsd-x64": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@swc/core-freebsd-x64/-/core-freebsd-x64-1.3.2.tgz", + "integrity": "sha512-GUXqDnmJTWZBoTbOMOKG+mw/jJ7dAOOKuUKwnQvyzconLkqHZZfJTimDsc1KWpikf9IPdQNY0+0/NqAVPGA0Dg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "dependencies": { + "@swc/wasm": "1.2.130" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-freebsd-x64/node_modules/@swc/wasm": { + "version": "1.2.130", + "resolved": "https://registry.npmjs.org/@swc/wasm/-/wasm-1.2.130.tgz", + "integrity": "sha512-rNcJsBxS70+pv8YUWwf5fRlWX6JoY/HJc25HD/F8m6Kv7XhJdqPPMhyX6TKkUBPAG7TWlZYoxa+rHAjPy4Cj3Q==", + "dev": true, + "optional": true + }, + "node_modules/@swc/core-linux-arm-gnueabihf": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.3.2.tgz", + "integrity": "sha512-Df3ln4IhiFxOYBNr/x192tXhRBTVEhJPMLRDl9Q0WY/lvPp/n5Ee0VgKR1CaQ16bg3/z3lZjXrZRBw01kENEew==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "dependencies": { + "@swc/wasm": "1.2.130" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-linux-arm-gnueabihf/node_modules/@swc/wasm": { + "version": "1.2.130", + "resolved": "https://registry.npmjs.org/@swc/wasm/-/wasm-1.2.130.tgz", + "integrity": "sha512-rNcJsBxS70+pv8YUWwf5fRlWX6JoY/HJc25HD/F8m6Kv7XhJdqPPMhyX6TKkUBPAG7TWlZYoxa+rHAjPy4Cj3Q==", + "dev": true, + "optional": true + }, + "node_modules/@swc/core-linux-arm64-gnu": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.3.2.tgz", + "integrity": "sha512-jPtcA61HqWFxlIr5OCToa97kqTS6u4I2GJR5whc8u2rSzn2N+M5CfqskOGHBETcEhUWfFa0hJq3+i6w9lqKV+w==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-linux-arm64-musl": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.3.2.tgz", + "integrity": "sha512-GhGM49GTzpjxKrzi8IpyHNlrJkOwiS6Pk4xhy3D7nrbB5KppU8O+lppkiRjiF9awD+mIzFq27TdokbmEoQcXaQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=10" } }, "node_modules/@swc/core-linux-x64-gnu": { - "version": "1.2.245", - "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.2.245.tgz", - "integrity": "sha512-NAgd4ImnWubYKdZE1sQi9hNvsSw8+z3nVm7WrZqhBx3OVQx/XQ2OQxUKIYvTe3LInUDxywX+ifRQ/syR/pFHUQ==", + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.3.2.tgz", + "integrity": "sha512-JgN5rGHAKe2hvtU1H1V9toxSDWKEAWbrrb+/Wp/6CrxBxNgexmgXuDGt0VP21jbRA2qTRNEhx9zzuzZK9ggNTQ==", "cpu": [ "x64" ], @@ -1043,9 +1240,9 @@ } }, "node_modules/@swc/core-linux-x64-musl": { - "version": "1.2.245", - "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.2.245.tgz", - "integrity": "sha512-jBThAr+TdmGRj5syD58IRlTu+N/9IcWT4GZ/YdujwDifyb2oZVj5Hop5D8wMBqBrDs1oWmK43sHp2suTfWdKBQ==", + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.3.2.tgz", + "integrity": "sha512-VpT6jgU7qqNjQmKt5RaOpkocv9MI5FTxWon4OQvTc+kHCoTAmXIndaW6aA+j4VEDSTJ/7DQAFWSXpSCffoQMsA==", "cpu": [ "x64" ], @@ -1058,6 +1255,74 @@ "node": ">=10" } }, + "node_modules/@swc/core-win32-arm64-msvc": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.3.2.tgz", + "integrity": "sha512-bilVzxfq5upHsil1WwPSoArZLkhPJyqJJ+5EzbiDS3Y38BPkPYZuN0h6sKuEiXLMHGODXtzuAkSgQyy0VVQKIA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "dependencies": { + "@swc/wasm": "1.2.130" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-win32-arm64-msvc/node_modules/@swc/wasm": { + "version": "1.2.130", + "resolved": "https://registry.npmjs.org/@swc/wasm/-/wasm-1.2.130.tgz", + "integrity": "sha512-rNcJsBxS70+pv8YUWwf5fRlWX6JoY/HJc25HD/F8m6Kv7XhJdqPPMhyX6TKkUBPAG7TWlZYoxa+rHAjPy4Cj3Q==", + "dev": true, + "optional": true + }, + "node_modules/@swc/core-win32-ia32-msvc": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.3.2.tgz", + "integrity": "sha512-UzHbZvJnfGZKvoEPiHoKtKehtuiDuNP/mKKBAaG5Cnu8m47z/cE5Mi0onR2iJi1p64GX0RhRIBcGa8x9PVHGjA==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "dependencies": { + "@swc/wasm": "1.2.130" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-win32-ia32-msvc/node_modules/@swc/wasm": { + "version": "1.2.130", + "resolved": "https://registry.npmjs.org/@swc/wasm/-/wasm-1.2.130.tgz", + "integrity": "sha512-rNcJsBxS70+pv8YUWwf5fRlWX6JoY/HJc25HD/F8m6Kv7XhJdqPPMhyX6TKkUBPAG7TWlZYoxa+rHAjPy4Cj3Q==", + "dev": true, + "optional": true + }, + "node_modules/@swc/core-win32-x64-msvc": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.3.2.tgz", + "integrity": "sha512-RSFgS2imGONhdN8anvDI+8wL+sinmeKUy2SmSiy8hSmqke1bCslirULCckyGzQAIMf3qCjuaTXxOFiQrsoSoIA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=10" + } + }, "node_modules/@swc/wasm": { "version": "1.2.233", "dev": true, @@ -1146,9 +1411,8 @@ }, "node_modules/@types/express": { "version": "4.17.13", - "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.13.tgz", - "integrity": "sha512-6bSZTPaTIACxn48l50SR+axgrqm6qXFIxrdAKaG6PaJk3+zuUr35hBlgT7vOmJcum+OEaIBLtHV/qloEAFITeA==", "dev": true, + "license": "MIT", "dependencies": { "@types/body-parser": "*", "@types/express-serve-static-core": "^4.17.18", @@ -1275,7 +1539,8 @@ "node_modules/@types/semver": { "version": "7.3.12", "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.12.tgz", - "integrity": "sha512-WwA1MW0++RfXmCr12xeYOOC5baSC9mSb0ZqCquFzKhcoF4TvHu5MKOuXsncgZcpVFhB1pXd5hZmM0ryAoCp12A==" + "integrity": "sha512-WwA1MW0++RfXmCr12xeYOOC5baSC9mSb0ZqCquFzKhcoF4TvHu5MKOuXsncgZcpVFhB1pXd5hZmM0ryAoCp12A==", + "dev": true }, "node_modules/@types/serve-static": { "version": "1.13.10", @@ -1288,9 +1553,8 @@ }, "node_modules/@types/swagger-ui-express": { "version": "4.1.3", - "resolved": "https://registry.npmjs.org/@types/swagger-ui-express/-/swagger-ui-express-4.1.3.tgz", - "integrity": "sha512-jqCjGU/tGEaqIplPy3WyQg+Nrp6y80DCFnDEAvVKWkJyv0VivSSDCChkppHRHAablvInZe6pijDFMnavtN0vqA==", "dev": true, + "license": "MIT", "dependencies": { "@types/express": "*", "@types/serve-static": "*" @@ -1310,8 +1574,7 @@ }, "node_modules/@types/validator": { "version": "13.0.0", - "resolved": "https://registry.npmjs.org/@types/validator/-/validator-13.0.0.tgz", - "integrity": "sha512-WAy5txG7aFX8Vw3sloEKp5p/t/Xt8jD3GRD9DacnFv6Vo8ubudAsRTXgxpQwU0mpzY/H8U4db3roDuCMjShBmw==", + "license": "MIT", "peer": true }, "node_modules/@types/webidl-conversions": { @@ -1464,8 +1727,7 @@ }, "node_modules/any-promise": { "version": "1.3.0", - "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", - "integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==", + "license": "MIT", "optional": true }, "node_modules/anymatch": { @@ -1482,8 +1744,7 @@ }, "node_modules/append-field": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/append-field/-/append-field-1.0.0.tgz", - "integrity": "sha512-klpgFSWLW1ZEs8svjfb7g4qWY0YS5imI82dTg+QahUvJ8YqAY0P10Uk8tTyh9ZGuYEZEMaeJYCF5BFuX552hsw==", + "license": "MIT", "optional": true }, "node_modules/aproba": { @@ -1547,8 +1808,7 @@ }, "node_modules/array-flatten": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", - "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" + "license": "MIT" }, "node_modules/array-slice": { "version": "1.1.0", @@ -1740,8 +2000,7 @@ }, "node_modules/body-parser": { "version": "1.20.0", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.0.tgz", - "integrity": "sha512-DfJ+q6EPcGKZD1QWUjSpqp+Q7bDQTsQIF4zfUAtZ6qk+H/3/QRhg9CEp39ss+/T2vw0+HaidC0ecJj/DRLIaKg==", + "license": "MIT", "dependencies": { "bytes": "3.1.2", "content-type": "~1.0.4", @@ -1763,24 +2022,21 @@ }, "node_modules/body-parser/node_modules/debug": { "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "license": "MIT", "dependencies": { "ms": "2.0.0" } }, "node_modules/body-parser/node_modules/depd": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", - "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "license": "MIT", "engines": { "node": ">= 0.8" } }, "node_modules/body-parser/node_modules/http-errors": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", - "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", + "license": "MIT", "dependencies": { "depd": "2.0.0", "inherits": "2.0.4", @@ -1794,13 +2050,11 @@ }, "node_modules/body-parser/node_modules/ms": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + "license": "MIT" }, "node_modules/body-parser/node_modules/qs": { "version": "6.10.3", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.3.tgz", - "integrity": "sha512-wr7M2E0OFRfIfJZjKGieI8lBKb7fRCH4Fv5KNPEs7gJ8jadvotdsS08PzOKR7opXhZ/Xkjtt3WF9g38drmyRqQ==", + "license": "BSD-3-Clause", "dependencies": { "side-channel": "^1.0.4" }, @@ -1813,8 +2067,7 @@ }, "node_modules/body-parser/node_modules/statuses": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", - "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", + "license": "MIT", "engines": { "node": ">= 0.8" } @@ -1925,8 +2178,6 @@ }, "node_modules/busboy": { "version": "0.2.14", - "resolved": "https://registry.npmjs.org/busboy/-/busboy-0.2.14.tgz", - "integrity": "sha512-InWFDomvlkEj+xWLBfU3AvnbVYqeTWmQopiW0tWWEy5yehYm2YkGEc59sUmw/4ty5Zj/b0WHGs1LgecuBSBGrg==", "optional": true, "dependencies": { "dicer": "0.2.5", @@ -1938,14 +2189,12 @@ }, "node_modules/busboy/node_modules/isarray": { "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==", + "license": "MIT", "optional": true }, "node_modules/busboy/node_modules/readable-stream": { "version": "1.1.14", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", - "integrity": "sha512-+MeVjFf4L44XUkhM1eYbD8fyEsxcV81pqMSR5gblfcLCHfZvbrqy4/qYHE+/R5HoBUT11WV5O08Cr1n3YXkWVQ==", + "license": "MIT", "optional": true, "dependencies": { "core-util-is": "~1.0.0", @@ -1956,8 +2205,7 @@ }, "node_modules/busboy/node_modules/string_decoder": { "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha512-ev2QzSzWPYmy9GuqfIVildA4OdcGLeFZQrq5ys6RtiuF+RQQiZWr8TZNyAcuVXyQRYfEO+MsoB/1BuQVhOJuoQ==", + "license": "MIT", "optional": true }, "node_modules/bytes": { @@ -2260,8 +2508,7 @@ }, "node_modules/class-transformer": { "version": "0.3.1", - "resolved": "https://registry.npmjs.org/class-transformer/-/class-transformer-0.3.1.tgz", - "integrity": "sha512-cKFwohpJbuMovS8xVLmn8N2AUbAuc8pVo4zEfsUVo8qgECOogns1WVk/FkOZoxhOPTyTYFckuoH+13FO+MQ8GA==", + "license": "MIT", "peer": true }, "node_modules/class-utils": { @@ -2356,8 +2603,7 @@ }, "node_modules/class-validator": { "version": "0.12.2", - "resolved": "https://registry.npmjs.org/class-validator/-/class-validator-0.12.2.tgz", - "integrity": "sha512-TDzPzp8BmpsbPhQpccB3jMUE/3pK0TyqamrK0kcx+ZeFytMA+O6q87JZZGObHHnoo9GM8vl/JppIyKWeEA/EVw==", + "license": "MIT", "peer": true, "dependencies": { "@types/validator": "13.0.0", @@ -2558,11 +2804,10 @@ }, "node_modules/concat-stream": { "version": "1.6.2", - "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", - "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", "engines": [ "node >= 0.8" ], + "license": "MIT", "optional": true, "dependencies": { "buffer-from": "^1.0.0", @@ -2573,8 +2818,7 @@ }, "node_modules/concat-stream/node_modules/readable-stream": { "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "license": "MIT", "optional": true, "dependencies": { "core-util-is": "~1.0.0", @@ -2588,14 +2832,12 @@ }, "node_modules/concat-stream/node_modules/safe-buffer": { "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "license": "MIT", "optional": true }, "node_modules/concat-stream/node_modules/string_decoder": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "license": "MIT", "optional": true, "dependencies": { "safe-buffer": "~5.1.0" @@ -2728,16 +2970,14 @@ }, "node_modules/cookie": { "version": "0.4.2", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.2.tgz", - "integrity": "sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==", + "license": "MIT", "engines": { "node": ">= 0.6" } }, "node_modules/cookie-signature": { "version": "1.0.6", - "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", - "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==" + "license": "MIT" }, "node_modules/cookies": { "version": "0.8.0", @@ -3074,8 +3314,6 @@ }, "node_modules/dicer": { "version": "0.2.5", - "resolved": "https://registry.npmjs.org/dicer/-/dicer-0.2.5.tgz", - "integrity": "sha512-FDvbtnq7dzlPz0wyYlOExifDEZcu8h+rErEXgfxqmLfRfC/kJidEFh4+effJRO3P0xmfqyPbSMG0LveNRfTKVg==", "optional": true, "dependencies": { "readable-stream": "1.1.x", @@ -3087,14 +3325,12 @@ }, "node_modules/dicer/node_modules/isarray": { "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==", + "license": "MIT", "optional": true }, "node_modules/dicer/node_modules/readable-stream": { "version": "1.1.14", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", - "integrity": "sha512-+MeVjFf4L44XUkhM1eYbD8fyEsxcV81pqMSR5gblfcLCHfZvbrqy4/qYHE+/R5HoBUT11WV5O08Cr1n3YXkWVQ==", + "license": "MIT", "optional": true, "dependencies": { "core-util-is": "~1.0.0", @@ -3105,8 +3341,7 @@ }, "node_modules/dicer/node_modules/string_decoder": { "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha512-ev2QzSzWPYmy9GuqfIVildA4OdcGLeFZQrq5ys6RtiuF+RQQiZWr8TZNyAcuVXyQRYfEO+MsoB/1BuQVhOJuoQ==", + "license": "MIT", "optional": true }, "node_modules/diff": { @@ -3133,8 +3368,7 @@ }, "node_modules/discord-logs": { "version": "2.2.1", - "resolved": "https://registry.npmjs.org/discord-logs/-/discord-logs-2.2.1.tgz", - "integrity": "sha512-VTNe/uRcfdLDLBLf1Taaj3OYU1GLWTAVEcCPC/xZqZd1X4D3DXW1qYJWxoyx3yqiJZ4rwQ3A0bPIFryIdniKrQ==", + "license": "ISC", "dependencies": { "@types/node": "^18.7.11", "@types/ws": "^8.5.3" @@ -3142,8 +3376,7 @@ }, "node_modules/discord-logs/node_modules/@types/node": { "version": "18.7.16", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.16.tgz", - "integrity": "sha512-EQHhixfu+mkqHMZl1R2Ovuvn47PUw18azMJOTwSZr9/fhzHNGXAJ0ma0dayRVchprpCj0Kc1K1xKoWaATWF1qg==" + "license": "MIT" }, "node_modules/discord-oauth2": { "version": "2.10.0", @@ -3170,10 +3403,11 @@ } }, "node_modules/discordx": { - "version": "11.1.8", - "license": "Apache-2.0", + "version": "11.2.2", + "resolved": "https://registry.npmjs.org/discordx/-/discordx-11.2.2.tgz", + "integrity": "sha512-1jj3hWrrhula1QVVDIMiUeiStrj0DLDEtlQ6iWqMiWdFOfO440QK4KXhtLec81OHjliAwl7nQBy2NlVvs8A/YQ==", "dependencies": { - "@discordx/di": "^3.0.1", + "@discordx/di": "^3.0.2", "@discordx/internal": "^1.0.2", "lodash": "^4.17.21", "reflect-metadata": "^0.1.13", @@ -3435,8 +3669,7 @@ }, "node_modules/etag": { "version": "1.8.1", - "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", - "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "license": "MIT", "engines": { "node": ">= 0.6" } @@ -3586,8 +3819,7 @@ }, "node_modules/express": { "version": "4.18.1", - "resolved": "https://registry.npmjs.org/express/-/express-4.18.1.tgz", - "integrity": "sha512-zZBcOX9TfehHQhtupq57OF8lFZ3UZi08Y97dwFCkD8p9d/d2Y3M+ykKcwaMDEL+4qyUolgBDX6AblpR3fL212Q==", + "license": "MIT", "dependencies": { "accepts": "~1.3.8", "array-flatten": "1.1.1", @@ -3627,8 +3859,7 @@ }, "node_modules/express-session": { "version": "1.17.3", - "resolved": "https://registry.npmjs.org/express-session/-/express-session-1.17.3.tgz", - "integrity": "sha512-4+otWXlShYlG1Ma+2Jnn+xgKUZTMJ5QD3YvfilX3AcocOAbIkVylSWEklzALe/+Pu4qV6TYBj5GwOBFfdKqLBw==", + "license": "MIT", "dependencies": { "cookie": "0.4.2", "cookie-signature": "1.0.6", @@ -3645,53 +3876,46 @@ }, "node_modules/express-session/node_modules/debug": { "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "license": "MIT", "dependencies": { "ms": "2.0.0" } }, "node_modules/express-session/node_modules/depd": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", - "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "license": "MIT", "engines": { "node": ">= 0.8" } }, "node_modules/express-session/node_modules/ms": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + "license": "MIT" }, "node_modules/express/node_modules/cookie": { "version": "0.5.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", - "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==", + "license": "MIT", "engines": { "node": ">= 0.6" } }, "node_modules/express/node_modules/debug": { "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "license": "MIT", "dependencies": { "ms": "2.0.0" } }, "node_modules/express/node_modules/depd": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", - "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "license": "MIT", "engines": { "node": ">= 0.8" } }, "node_modules/express/node_modules/http-errors": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", - "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", + "license": "MIT", "dependencies": { "depd": "2.0.0", "inherits": "2.0.4", @@ -3705,18 +3929,15 @@ }, "node_modules/express/node_modules/ms": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + "license": "MIT" }, "node_modules/express/node_modules/path-to-regexp": { "version": "0.1.7", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", - "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==" + "license": "MIT" }, "node_modules/express/node_modules/qs": { "version": "6.10.3", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.3.tgz", - "integrity": "sha512-wr7M2E0OFRfIfJZjKGieI8lBKb7fRCH4Fv5KNPEs7gJ8jadvotdsS08PzOKR7opXhZ/Xkjtt3WF9g38drmyRqQ==", + "license": "BSD-3-Clause", "dependencies": { "side-channel": "^1.0.4" }, @@ -3729,8 +3950,7 @@ }, "node_modules/express/node_modules/statuses": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", - "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", + "license": "MIT", "engines": { "node": ">= 0.8" } @@ -3911,8 +4131,7 @@ }, "node_modules/finalhandler": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", - "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==", + "license": "MIT", "dependencies": { "debug": "2.6.9", "encodeurl": "~1.0.2", @@ -3928,21 +4147,18 @@ }, "node_modules/finalhandler/node_modules/debug": { "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "license": "MIT", "dependencies": { "ms": "2.0.0" } }, "node_modules/finalhandler/node_modules/ms": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + "license": "MIT" }, "node_modules/finalhandler/node_modules/statuses": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", - "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", + "license": "MIT", "engines": { "node": ">= 0.8" } @@ -4185,8 +4401,7 @@ }, "node_modules/forwarded": { "version": "0.2.0", - "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", - "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "license": "MIT", "engines": { "node": ">= 0.6" } @@ -4560,8 +4775,7 @@ }, "node_modules/google-libphonenumber": { "version": "3.2.30", - "resolved": "https://registry.npmjs.org/google-libphonenumber/-/google-libphonenumber-3.2.30.tgz", - "integrity": "sha512-Kx2/AqmY0P6863vOhkiCFqfAxfY3jagMe916ByU38JRKiRCqSHGJW1qTOZNV4+ag8Xda69dk6w8VwEeswVy44w==", + "license": "(MIT AND Apache-2.0)", "peer": true, "engines": { "node": ">=0.10" @@ -5022,8 +5236,7 @@ }, "node_modules/ipaddr.js": { "version": "1.9.1", - "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", - "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "license": "MIT", "engines": { "node": ">= 0.10" } @@ -5637,9 +5850,7 @@ }, "node_modules/koa-multer": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/koa-multer/-/koa-multer-1.0.2.tgz", - "integrity": "sha512-0kFzN4atVd+9oiG+4fYxQ9S2T3dPhKNvmhITIY606Qn9wLEmfhW0DhSpOzRYhddN//4rh/TCK95TMtflmFa5lA==", - "deprecated": "Please use @koa/multer instead, see ", + "license": "MIT", "optional": true, "dependencies": { "multer": "1.3.0" @@ -5650,15 +5861,12 @@ }, "node_modules/koa-multer/node_modules/append-field": { "version": "0.1.0", - "resolved": "https://registry.npmjs.org/append-field/-/append-field-0.1.0.tgz", - "integrity": "sha512-8BgHoIwbQZaAQgDZLBu2vQoXHgUpSx4vQK1qv7e6R8YfbiSf4fCaBPJRtM1BaxVn1rIHc5ftv0cklsJ78BkouQ==", + "license": "MIT", "optional": true }, "node_modules/koa-multer/node_modules/multer": { "version": "1.3.0", - "resolved": "https://registry.npmjs.org/multer/-/multer-1.3.0.tgz", - "integrity": "sha512-wbAkTsh0QXkvqvHCU2qSLEXLuRN7IKMEe80+JrXfJzANniPNgrNcDOMKfGgR1EhL7y7MHIbODVwT7uaVY20ggw==", - "deprecated": "Multer 1.x is affected by CVE-2022-24434. This is fixed in v1.4.4-lts.1 which drops support for versions of Node.js before 6. Please upgrade to at least Node.js 6 and version 1.4.4-lts.1 of Multer. If you need support for older versions of Node.js, we are open to accepting patches that would fix the CVE on the main 1.x release line, whilst maintaining compatibility with Node.js 0.10.", + "license": "MIT", "optional": true, "dependencies": { "append-field": "^0.1.0", @@ -5676,8 +5884,7 @@ }, "node_modules/koa-multer/node_modules/object-assign": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-3.0.0.tgz", - "integrity": "sha512-jHP15vXVGeVh1HuaA2wY6lxk+whK/x4KBG88VXeRma7CCun7iGD5qPc4eYykQ9sdQvg8jkwFKsSxHln2ybW3xQ==", + "license": "MIT", "optional": true, "engines": { "node": ">=0.10.0" @@ -5685,8 +5892,7 @@ }, "node_modules/koa-router": { "version": "7.4.0", - "resolved": "https://registry.npmjs.org/koa-router/-/koa-router-7.4.0.tgz", - "integrity": "sha512-IWhaDXeAnfDBEpWS6hkGdZ1ablgr6Q6pGdXCyK38RbzuH4LkUOpPqPw+3f8l8aTDrQmBQ7xJc0bs2yV4dzcO+g==", + "license": "MIT", "optional": true, "dependencies": { "debug": "^3.1.0", @@ -5702,8 +5908,7 @@ }, "node_modules/koa-router/node_modules/debug": { "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "license": "MIT", "optional": true, "dependencies": { "ms": "^2.1.1" @@ -5711,14 +5916,12 @@ }, "node_modules/koa-router/node_modules/isarray": { "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==", + "license": "MIT", "optional": true }, "node_modules/koa-router/node_modules/koa-compose": { "version": "3.2.1", - "resolved": "https://registry.npmjs.org/koa-compose/-/koa-compose-3.2.1.tgz", - "integrity": "sha512-8gen2cvKHIZ35eDEik5WOo8zbVp9t4cP8p4hW4uE55waxolLRexKKrqfCpwhGVppnB40jWeF8bZeTVg99eZgPw==", + "license": "MIT", "optional": true, "dependencies": { "any-promise": "^1.1.0" @@ -5726,8 +5929,7 @@ }, "node_modules/koa-router/node_modules/path-to-regexp": { "version": "1.8.0", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.8.0.tgz", - "integrity": "sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA==", + "license": "MIT", "optional": true, "dependencies": { "isarray": "0.0.1" @@ -5818,8 +6020,7 @@ }, "node_modules/lodash.capitalize": { "version": "4.2.1", - "resolved": "https://registry.npmjs.org/lodash.capitalize/-/lodash.capitalize-4.2.1.tgz", - "integrity": "sha512-kZzYOKspf8XVX5AvmQF94gQW0lejFVgb80G85bU4ZWzoJ6C03PQg3coYAUpSTpQWelrZELd3XWgHzw4Ck5kaIw==" + "license": "MIT" }, "node_modules/lodash.get": { "version": "4.4.2", @@ -5828,8 +6029,7 @@ }, "node_modules/lodash.merge": { "version": "4.6.2", - "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", - "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==" + "license": "MIT" }, "node_modules/lodash.snakecase": { "version": "4.1.1", @@ -5837,8 +6037,7 @@ }, "node_modules/lodash.startcase": { "version": "4.4.0", - "resolved": "https://registry.npmjs.org/lodash.startcase/-/lodash.startcase-4.4.0.tgz", - "integrity": "sha512-+WKqsK294HMSc2jEbNgpHpd0JfIBhp7rEV4aqXWqFr6AlXov+SlcgB1Fv01y2kGe3Gc8nMW7VA0SrGuSkRfIEg==" + "license": "MIT" }, "node_modules/lodash.uniqwith": { "version": "4.5.0", @@ -6028,8 +6227,7 @@ }, "node_modules/merge-descriptors": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", - "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==" + "license": "MIT" }, "node_modules/merge2": { "version": "1.4.1", @@ -6065,8 +6263,7 @@ }, "node_modules/mime": { "version": "1.6.0", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", - "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "license": "MIT", "bin": { "mime": "cli.js" }, @@ -6311,9 +6508,7 @@ }, "node_modules/multer": { "version": "1.4.4", - "resolved": "https://registry.npmjs.org/multer/-/multer-1.4.4.tgz", - "integrity": "sha512-2wY2+xD4udX612aMqMcB8Ws2Voq6NIUPEtD1be6m411T4uDH/VtL9i//xvcyFlTVfRdaBsk7hV5tgrGQqhuBiw==", - "deprecated": "Multer 1.x is affected by CVE-2022-24434. This is fixed in v1.4.4-lts.1 which drops support for versions of Node.js before 6. Please upgrade to at least Node.js 6 and version 1.4.4-lts.1 of Multer. If you need support for older versions of Node.js, we are open to accepting patches that would fix the CVE on the main 1.x release line, whilst maintaining compatibility with Node.js 0.10.", + "license": "MIT", "optional": true, "dependencies": { "append-field": "^1.0.0", @@ -6457,7 +6652,20 @@ "version": "3.24.0", "license": "MIT", "dependencies": { - "semver": "^7.3.5" + "semver": "^7.3.5" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/node-abi/node_modules/semver": { + "version": "7.3.7", + "license": "ISC", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" }, "engines": { "node": ">=10" @@ -6591,6 +6799,20 @@ "node": "^12.13.0 || ^14.15.0 || >=16.0.0" } }, + "node_modules/node-gyp/node_modules/semver": { + "version": "7.3.7", + "license": "ISC", + "optional": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/node-os-utils": { "version": "1.3.7", "license": "MIT" @@ -7098,8 +7320,7 @@ }, "node_modules/on-headers": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz", - "integrity": "sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==", + "license": "MIT", "engines": { "node": ">= 0.8" } @@ -7136,8 +7357,7 @@ }, "node_modules/openapi3-ts": { "version": "2.0.2", - "resolved": "https://registry.npmjs.org/openapi3-ts/-/openapi3-ts-2.0.2.tgz", - "integrity": "sha512-TxhYBMoqx9frXyOgnRHufjQfPXomTIHYKhSKJ6jHfj13kS8OEIhvmE8CTuQyKtjjWttAjX5DPxM1vmalEpo8Qw==", + "license": "MIT", "dependencies": { "yaml": "^1.10.2" } @@ -7881,8 +8101,7 @@ }, "node_modules/proxy-addr": { "version": "2.0.7", - "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", - "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "license": "MIT", "dependencies": { "forwarded": "0.2.0", "ipaddr.js": "1.9.1" @@ -7951,16 +8170,14 @@ }, "node_modules/random-bytes": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/random-bytes/-/random-bytes-1.0.0.tgz", - "integrity": "sha512-iv7LhNVO047HzYR3InF6pUcUsPQiHTM1Qal51DcGSuZFBil1aBBWG5eHPNek7bvILMaYJ/8RU1e8w1AMdHmLQQ==", + "license": "MIT", "engines": { "node": ">= 0.8" } }, "node_modules/range-parser": { "version": "1.2.1", - "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", - "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "license": "MIT", "engines": { "node": ">= 0.6" } @@ -8589,8 +8806,7 @@ }, "node_modules/routing-controllers": { "version": "0.9.0", - "resolved": "https://registry.npmjs.org/routing-controllers/-/routing-controllers-0.9.0.tgz", - "integrity": "sha512-OtARLKA6j8enNgGqi/hoRqBsTjVo2hbxc1+MeKi8mvelNn18+LXUdHpzY3z4GbCERBtaj8CwVjcsiQR+2w6ZFg==", + "license": "MIT", "dependencies": { "cookie": "^0.4.0", "express-session": "^1.17.1", @@ -8614,8 +8830,7 @@ }, "node_modules/routing-controllers-openapi": { "version": "3.1.0", - "resolved": "https://registry.npmjs.org/routing-controllers-openapi/-/routing-controllers-openapi-3.1.0.tgz", - "integrity": "sha512-FnTYnbNfsCN+vTDAc7rhCm5u0nLAH+p+UpbJXZT10cgo2t7xiZ23BrrzsR5nnqMGwe/iwsDUEEr8lxs6KarscQ==", + "license": "MIT", "dependencies": { "lodash.capitalize": "^4.2.1", "lodash.merge": "^4.6.2", @@ -8631,13 +8846,11 @@ }, "node_modules/routing-controllers-openapi/node_modules/path-to-regexp": { "version": "2.4.0", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-2.4.0.tgz", - "integrity": "sha512-G6zHoVqC6GGTQkZwF4lkuEyMbVOjoBKAEybQUypI1WTkqinCOrq2x6U2+phkJ1XsEMTy4LjtwPI7HW+NVrRR2w==" + "license": "MIT" }, "node_modules/routing-controllers/node_modules/brace-expansion": { "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "license": "MIT", "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -8645,8 +8858,7 @@ }, "node_modules/routing-controllers/node_modules/glob": { "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "license": "ISC", "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -8664,8 +8876,7 @@ }, "node_modules/routing-controllers/node_modules/minimatch": { "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "license": "ISC", "dependencies": { "brace-expansion": "^1.1.7" }, @@ -8785,9 +8996,9 @@ "license": "ISC" }, "node_modules/semver": { - "version": "7.3.7", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", - "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", + "version": "7.3.8", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", + "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", "dependencies": { "lru-cache": "^6.0.0" }, @@ -8804,8 +9015,7 @@ }, "node_modules/send": { "version": "0.18.0", - "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", - "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", + "license": "MIT", "dependencies": { "debug": "2.6.9", "depd": "2.0.0", @@ -8827,29 +9037,25 @@ }, "node_modules/send/node_modules/debug": { "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "license": "MIT", "dependencies": { "ms": "2.0.0" } }, "node_modules/send/node_modules/debug/node_modules/ms": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + "license": "MIT" }, "node_modules/send/node_modules/depd": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", - "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "license": "MIT", "engines": { "node": ">= 0.8" } }, "node_modules/send/node_modules/http-errors": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", - "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", + "license": "MIT", "dependencies": { "depd": "2.0.0", "inherits": "2.0.4", @@ -8863,13 +9069,11 @@ }, "node_modules/send/node_modules/ms": { "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + "license": "MIT" }, "node_modules/send/node_modules/statuses": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", - "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", + "license": "MIT", "engines": { "node": ">= 0.8" } @@ -8888,8 +9092,7 @@ }, "node_modules/serve-static": { "version": "1.15.0", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz", - "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==", + "license": "MIT", "dependencies": { "encodeurl": "~1.0.2", "escape-html": "~1.0.3", @@ -9646,8 +9849,6 @@ }, "node_modules/streamsearch": { "version": "0.1.2", - "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-0.1.2.tgz", - "integrity": "sha512-jos8u++JKm0ARcSUTAZXOVC0mSox7Bhn6sBgty73P1f3JGf7yG2clTbBNHUdde/kdvP2FESam+vM6l8jBrNxHA==", "optional": true, "engines": { "node": ">=0.8.0" @@ -9783,13 +9984,11 @@ }, "node_modules/swagger-ui-dist": { "version": "4.14.0", - "resolved": "https://registry.npmjs.org/swagger-ui-dist/-/swagger-ui-dist-4.14.0.tgz", - "integrity": "sha512-TBzhheU15s+o54Cgk9qxuYcZMiqSm/SkvKnapoGHOF66kz0Y5aGjpzj5BT/vpBbn6rTPJ9tUYXQxuDWfsjiGMw==" + "license": "Apache-2.0" }, "node_modules/swagger-ui-express": { "version": "4.5.0", - "resolved": "https://registry.npmjs.org/swagger-ui-express/-/swagger-ui-express-4.5.0.tgz", - "integrity": "sha512-DHk3zFvsxrkcnurGvQlAcLuTDacAVN1JHKDgcba/gr2NFRE4HGwP1YeHIXMiGznkWR4AeS7X5vEblNn4QljuNA==", + "license": "MIT", "dependencies": { "swagger-ui-dist": ">=4.11.0" }, @@ -9871,8 +10070,7 @@ }, "node_modules/template-url": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/template-url/-/template-url-1.0.0.tgz", - "integrity": "sha512-QUjZNE7yTdIzB91sITTSYcSX5GRF5FulKvIYCqV5350NfSNfiuuCYQIJZ5PIN7k/uJ+kpurEEv9hFqRRc+JilA==" + "license": "ISC" }, "node_modules/through": { "version": "2.3.8", @@ -10028,11 +10226,12 @@ "license": "MIT" }, "node_modules/ts-node": { - "version": "10.8.1", + "version": "10.7.0", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.7.0.tgz", + "integrity": "sha512-TbIGS4xgJoX2i3do417KSaep1uRAW/Lu+WAL2doDHC0D6ummjirVOXU5/7aiZotbQ5p1Zp9tP7U6cYhA0O7M8A==", "dev": true, - "license": "MIT", "dependencies": { - "@cspotcode/source-map-support": "^0.8.0", + "@cspotcode/source-map-support": "0.7.0", "@tsconfig/node10": "^1.0.7", "@tsconfig/node12": "^1.0.7", "@tsconfig/node14": "^1.0.0", @@ -10043,7 +10242,7 @@ "create-require": "^1.1.0", "diff": "^4.0.1", "make-error": "^1.1.1", - "v8-compile-cache-lib": "^3.0.1", + "v8-compile-cache-lib": "^3.0.0", "yn": "3.1.1" }, "bin": { @@ -10157,17 +10356,18 @@ }, "node_modules/typedarray": { "version": "0.0.6", - "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", - "integrity": "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==", + "license": "MIT", "optional": true }, "node_modules/typedi": { "version": "0.10.0", - "license": "MIT" + "resolved": "https://registry.npmjs.org/typedi/-/typedi-0.10.0.tgz", + "integrity": "sha512-v3UJF8xm68BBj6AF4oQML3ikrfK2c9EmZUyLOfShpJuItAqVBHWP/KtpGinkSsIiP6EZyyb6Z3NXyW9dgS9X1w==" }, "node_modules/typesafe-i18n": { - "version": "5.5.2", - "license": "MIT", + "version": "5.14.0", + "resolved": "https://registry.npmjs.org/typesafe-i18n/-/typesafe-i18n-5.14.0.tgz", + "integrity": "sha512-ZNHysUvZZhmUuMjBvDGtUI8vT3g//4ay5fFOk2sJCsjx4ztippW1Hrhrq59nJ9mV/Q0u4OX80Gyorq8L3rwNLw==", "bin": { "typesafe-i18n": "cli/typesafe-i18n.mjs" }, @@ -10204,8 +10404,7 @@ }, "node_modules/uid-safe": { "version": "2.1.5", - "resolved": "https://registry.npmjs.org/uid-safe/-/uid-safe-2.1.5.tgz", - "integrity": "sha512-KPHm4VL5dDXKz01UuEd88Df+KzynaohSL9fBh096KWAxSKZQDI2uBrVqtvRM4rwrIrRRKsdLNML/lnaaVSRioA==", + "license": "MIT", "dependencies": { "random-bytes": "~1.0.0" }, @@ -10466,8 +10665,7 @@ }, "node_modules/urijs": { "version": "1.19.11", - "resolved": "https://registry.npmjs.org/urijs/-/urijs-1.19.11.tgz", - "integrity": "sha512-HXgFDgDommxn5/bIv0cnQZsPhHDA90NPHD6+c/v21U5+Sx5hoP8+dP9IZXBU1gIfvdRfhG8cel9QNPeionfcCQ==", + "license": "MIT", "optional": true }, "node_modules/urix": { @@ -10500,8 +10698,7 @@ }, "node_modules/utils-merge": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", - "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", + "license": "MIT", "engines": { "node": ">= 0.4.0" } @@ -10537,9 +10734,9 @@ } }, "node_modules/validator": { - "version": "13.0.0", - "resolved": "https://registry.npmjs.org/validator/-/validator-13.0.0.tgz", - "integrity": "sha512-anYx5fURbgF04lQV18nEQWZ/3wHGnxiKdG4aL8J+jEDsm98n/sU/bey+tYk6tnGJzm7ioh5FoqrAiQ6m03IgaA==", + "version": "13.7.0", + "resolved": "https://registry.npmjs.org/validator/-/validator-13.7.0.tgz", + "integrity": "sha512-nYXQLCBkpJ8X6ltALua9dRrZDHVYxjJ1wgskNt1lH9fzGjs3tgojGSCBjmEPwkWS1y29+DrizMTW19Pr9uB2nw==", "peer": true, "engines": { "node": ">= 0.10" @@ -10736,8 +10933,7 @@ }, "node_modules/yaml": { "version": "1.10.2", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", - "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", + "license": "ISC", "engines": { "node": ">= 6" } @@ -10894,11 +11090,19 @@ "@canvas/image-data": { "version": "1.0.0" }, + "@cspotcode/source-map-consumer": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz", + "integrity": "sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg==", + "dev": true + }, "@cspotcode/source-map-support": { - "version": "0.8.1", + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz", + "integrity": "sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA==", "dev": true, "requires": { - "@jridgewell/trace-mapping": "0.3.9" + "@cspotcode/source-map-consumer": "0.8.0" } }, "@cwasm/webp": { @@ -10933,6 +11137,15 @@ "rimraf": "^3.0.2", "semver": "^7.3.5", "tar": "^6.1.11" + }, + "dependencies": { + "semver": { + "version": "7.3.7", + "peer": true, + "requires": { + "lru-cache": "^6.0.0" + } + } } }, "@discordjs/opus": { @@ -11000,7 +11213,9 @@ } }, "@discordx/di": { - "version": "3.0.1", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@discordx/di/-/di-3.0.2.tgz", + "integrity": "sha512-mHvM+dscoyo5/yvQb/QHSPLdhfphNhYHKRuo1P9fphTpF150t/39kDJrEzqbTfoXBtoY/DtVD/Voni8mNgmiyw==", "requires": { "tsyringe": "^4.7.0", "typedi": "^0.10.0" @@ -11056,22 +11271,6 @@ "@hapi/hoek": "^9.0.0" } }, - "@jridgewell/resolve-uri": { - "version": "3.0.7", - "dev": true - }, - "@jridgewell/sourcemap-codec": { - "version": "1.4.13", - "dev": true - }, - "@jridgewell/trace-mapping": { - "version": "0.3.9", - "dev": true, - "requires": { - "@jridgewell/resolve-uri": "^3.0.3", - "@jridgewell/sourcemap-codec": "^1.4.10" - } - }, "@mapbox/node-pre-gyp": { "version": "1.0.9", "requires": { @@ -11084,6 +11283,14 @@ "rimraf": "^3.0.2", "semver": "^7.3.5", "tar": "^6.1.11" + }, + "dependencies": { + "semver": { + "version": "7.3.7", + "requires": { + "lru-cache": "^6.0.0" + } + } } }, "@mikro-orm/better-sqlite": { @@ -11200,6 +11407,15 @@ "requires": { "@gar/promisify": "^1.0.1", "semver": "^7.3.5" + }, + "dependencies": { + "semver": { + "version": "7.3.7", + "optional": true, + "requires": { + "lru-cache": "^6.0.0" + } + } } }, "@npmcli/move-file": { @@ -11305,37 +11521,186 @@ } }, "@swc/core": { - "version": "1.2.245", - "resolved": "https://registry.npmjs.org/@swc/core/-/core-1.2.245.tgz", - "integrity": "sha512-QbjqYkgC1AbJZqybzm3jWg13I5VhlRRODpeBb7H69h5GY1YUWdAb/mpKA5x5jh7j6VuGxJHDxYfry0Rv/MNz7w==", - "dev": true, - "requires": { - "@swc/core-android-arm-eabi": "1.2.245", - "@swc/core-android-arm64": "1.2.245", - "@swc/core-darwin-arm64": "1.2.245", - "@swc/core-darwin-x64": "1.2.245", - "@swc/core-freebsd-x64": "1.2.245", - "@swc/core-linux-arm-gnueabihf": "1.2.245", - "@swc/core-linux-arm64-gnu": "1.2.245", - "@swc/core-linux-arm64-musl": "1.2.245", - "@swc/core-linux-x64-gnu": "1.2.245", - "@swc/core-linux-x64-musl": "1.2.245", - "@swc/core-win32-arm64-msvc": "1.2.245", - "@swc/core-win32-ia32-msvc": "1.2.245", - "@swc/core-win32-x64-msvc": "1.2.245" + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@swc/core/-/core-1.3.2.tgz", + "integrity": "sha512-p2nLRVgtaz/v5UkNW9Ur5WrQUKB5YH1X7mE15UD2kihiAMc/04wvo0SNLW0BIeGSqeFdoZQ45TX5uOIxhAvRSg==", + "dev": true, + "requires": { + "@swc/core-android-arm-eabi": "1.3.2", + "@swc/core-android-arm64": "1.3.2", + "@swc/core-darwin-arm64": "1.3.2", + "@swc/core-darwin-x64": "1.3.2", + "@swc/core-freebsd-x64": "1.3.2", + "@swc/core-linux-arm-gnueabihf": "1.3.2", + "@swc/core-linux-arm64-gnu": "1.3.2", + "@swc/core-linux-arm64-musl": "1.3.2", + "@swc/core-linux-x64-gnu": "1.3.2", + "@swc/core-linux-x64-musl": "1.3.2", + "@swc/core-win32-arm64-msvc": "1.3.2", + "@swc/core-win32-ia32-msvc": "1.3.2", + "@swc/core-win32-x64-msvc": "1.3.2" + } + }, + "@swc/core-android-arm-eabi": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@swc/core-android-arm-eabi/-/core-android-arm-eabi-1.3.2.tgz", + "integrity": "sha512-jCqckwATVC4HbNjjrJii6xZzFKl7ecxVtY94odGD15+7qu5VCMuLD+Pj3bYxIQxQyzvi1z8S/187uUrAKMC2/w==", + "dev": true, + "optional": true, + "requires": { + "@swc/wasm": "1.2.122" + }, + "dependencies": { + "@swc/wasm": { + "version": "1.2.122", + "resolved": "https://registry.npmjs.org/@swc/wasm/-/wasm-1.2.122.tgz", + "integrity": "sha512-sM1VCWQxmNhFtdxME+8UXNyPNhxNu7zdb6ikWpz0YKAQQFRGT5ThZgJrubEpah335SUToNg8pkdDF7ibVCjxbQ==", + "dev": true, + "optional": true + } + } + }, + "@swc/core-android-arm64": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@swc/core-android-arm64/-/core-android-arm64-1.3.2.tgz", + "integrity": "sha512-zZ3EX5jmY6kTBlnAqLmIhDFGlsAB3Tiwk/sqoMLruZT1RsueDToQAXtjT5TWSlPh/GXAZyJQwqar2xIdi5pPAA==", + "dev": true, + "optional": true, + "requires": { + "@swc/wasm": "1.2.130" + }, + "dependencies": { + "@swc/wasm": { + "version": "1.2.130", + "resolved": "https://registry.npmjs.org/@swc/wasm/-/wasm-1.2.130.tgz", + "integrity": "sha512-rNcJsBxS70+pv8YUWwf5fRlWX6JoY/HJc25HD/F8m6Kv7XhJdqPPMhyX6TKkUBPAG7TWlZYoxa+rHAjPy4Cj3Q==", + "dev": true, + "optional": true + } + } + }, + "@swc/core-darwin-arm64": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.3.2.tgz", + "integrity": "sha512-YQpbRkd5zhycr+Nl1mm1p7koFqr8hsY8Z7XzNjfNIaJeFsXg9wjjH7yVmedQl+If+ibaPWpS3gMWfcIoUhdvGg==", + "dev": true, + "optional": true + }, + "@swc/core-darwin-x64": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.3.2.tgz", + "integrity": "sha512-DMvvdWgi/2dHtSGk4m6OcmlW8AAEUUl7Zys+Sxp+AtyIlQvn0Lbw9HCMPG6pqC0SHEO1kcNj6f6ARt3lL25jSA==", + "dev": true, + "optional": true + }, + "@swc/core-freebsd-x64": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@swc/core-freebsd-x64/-/core-freebsd-x64-1.3.2.tgz", + "integrity": "sha512-GUXqDnmJTWZBoTbOMOKG+mw/jJ7dAOOKuUKwnQvyzconLkqHZZfJTimDsc1KWpikf9IPdQNY0+0/NqAVPGA0Dg==", + "dev": true, + "optional": true, + "requires": { + "@swc/wasm": "1.2.130" + }, + "dependencies": { + "@swc/wasm": { + "version": "1.2.130", + "resolved": "https://registry.npmjs.org/@swc/wasm/-/wasm-1.2.130.tgz", + "integrity": "sha512-rNcJsBxS70+pv8YUWwf5fRlWX6JoY/HJc25HD/F8m6Kv7XhJdqPPMhyX6TKkUBPAG7TWlZYoxa+rHAjPy4Cj3Q==", + "dev": true, + "optional": true + } + } + }, + "@swc/core-linux-arm-gnueabihf": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.3.2.tgz", + "integrity": "sha512-Df3ln4IhiFxOYBNr/x192tXhRBTVEhJPMLRDl9Q0WY/lvPp/n5Ee0VgKR1CaQ16bg3/z3lZjXrZRBw01kENEew==", + "dev": true, + "optional": true, + "requires": { + "@swc/wasm": "1.2.130" + }, + "dependencies": { + "@swc/wasm": { + "version": "1.2.130", + "resolved": "https://registry.npmjs.org/@swc/wasm/-/wasm-1.2.130.tgz", + "integrity": "sha512-rNcJsBxS70+pv8YUWwf5fRlWX6JoY/HJc25HD/F8m6Kv7XhJdqPPMhyX6TKkUBPAG7TWlZYoxa+rHAjPy4Cj3Q==", + "dev": true, + "optional": true + } } }, + "@swc/core-linux-arm64-gnu": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.3.2.tgz", + "integrity": "sha512-jPtcA61HqWFxlIr5OCToa97kqTS6u4I2GJR5whc8u2rSzn2N+M5CfqskOGHBETcEhUWfFa0hJq3+i6w9lqKV+w==", + "dev": true, + "optional": true + }, + "@swc/core-linux-arm64-musl": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.3.2.tgz", + "integrity": "sha512-GhGM49GTzpjxKrzi8IpyHNlrJkOwiS6Pk4xhy3D7nrbB5KppU8O+lppkiRjiF9awD+mIzFq27TdokbmEoQcXaQ==", + "dev": true, + "optional": true + }, "@swc/core-linux-x64-gnu": { - "version": "1.2.245", - "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.2.245.tgz", - "integrity": "sha512-NAgd4ImnWubYKdZE1sQi9hNvsSw8+z3nVm7WrZqhBx3OVQx/XQ2OQxUKIYvTe3LInUDxywX+ifRQ/syR/pFHUQ==", + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.3.2.tgz", + "integrity": "sha512-JgN5rGHAKe2hvtU1H1V9toxSDWKEAWbrrb+/Wp/6CrxBxNgexmgXuDGt0VP21jbRA2qTRNEhx9zzuzZK9ggNTQ==", "dev": true, "optional": true }, "@swc/core-linux-x64-musl": { - "version": "1.2.245", - "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.2.245.tgz", - "integrity": "sha512-jBThAr+TdmGRj5syD58IRlTu+N/9IcWT4GZ/YdujwDifyb2oZVj5Hop5D8wMBqBrDs1oWmK43sHp2suTfWdKBQ==", + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.3.2.tgz", + "integrity": "sha512-VpT6jgU7qqNjQmKt5RaOpkocv9MI5FTxWon4OQvTc+kHCoTAmXIndaW6aA+j4VEDSTJ/7DQAFWSXpSCffoQMsA==", + "dev": true, + "optional": true + }, + "@swc/core-win32-arm64-msvc": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.3.2.tgz", + "integrity": "sha512-bilVzxfq5upHsil1WwPSoArZLkhPJyqJJ+5EzbiDS3Y38BPkPYZuN0h6sKuEiXLMHGODXtzuAkSgQyy0VVQKIA==", + "dev": true, + "optional": true, + "requires": { + "@swc/wasm": "1.2.130" + }, + "dependencies": { + "@swc/wasm": { + "version": "1.2.130", + "resolved": "https://registry.npmjs.org/@swc/wasm/-/wasm-1.2.130.tgz", + "integrity": "sha512-rNcJsBxS70+pv8YUWwf5fRlWX6JoY/HJc25HD/F8m6Kv7XhJdqPPMhyX6TKkUBPAG7TWlZYoxa+rHAjPy4Cj3Q==", + "dev": true, + "optional": true + } + } + }, + "@swc/core-win32-ia32-msvc": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.3.2.tgz", + "integrity": "sha512-UzHbZvJnfGZKvoEPiHoKtKehtuiDuNP/mKKBAaG5Cnu8m47z/cE5Mi0onR2iJi1p64GX0RhRIBcGa8x9PVHGjA==", + "dev": true, + "optional": true, + "requires": { + "@swc/wasm": "1.2.130" + }, + "dependencies": { + "@swc/wasm": { + "version": "1.2.130", + "resolved": "https://registry.npmjs.org/@swc/wasm/-/wasm-1.2.130.tgz", + "integrity": "sha512-rNcJsBxS70+pv8YUWwf5fRlWX6JoY/HJc25HD/F8m6Kv7XhJdqPPMhyX6TKkUBPAG7TWlZYoxa+rHAjPy4Cj3Q==", + "dev": true, + "optional": true + } + } + }, + "@swc/core-win32-x64-msvc": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.3.2.tgz", + "integrity": "sha512-RSFgS2imGONhdN8anvDI+8wL+sinmeKUy2SmSiy8hSmqke1bCslirULCckyGzQAIMf3qCjuaTXxOFiQrsoSoIA==", "dev": true, "optional": true }, @@ -11410,8 +11775,6 @@ }, "@types/express": { "version": "4.17.13", - "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.13.tgz", - "integrity": "sha512-6bSZTPaTIACxn48l50SR+axgrqm6qXFIxrdAKaG6PaJk3+zuUr35hBlgT7vOmJcum+OEaIBLtHV/qloEAFITeA==", "dev": true, "requires": { "@types/body-parser": "*", @@ -11521,7 +11884,8 @@ "@types/semver": { "version": "7.3.12", "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.12.tgz", - "integrity": "sha512-WwA1MW0++RfXmCr12xeYOOC5baSC9mSb0ZqCquFzKhcoF4TvHu5MKOuXsncgZcpVFhB1pXd5hZmM0ryAoCp12A==" + "integrity": "sha512-WwA1MW0++RfXmCr12xeYOOC5baSC9mSb0ZqCquFzKhcoF4TvHu5MKOuXsncgZcpVFhB1pXd5hZmM0ryAoCp12A==", + "dev": true }, "@types/serve-static": { "version": "1.13.10", @@ -11533,8 +11897,6 @@ }, "@types/swagger-ui-express": { "version": "4.1.3", - "resolved": "https://registry.npmjs.org/@types/swagger-ui-express/-/swagger-ui-express-4.1.3.tgz", - "integrity": "sha512-jqCjGU/tGEaqIplPy3WyQg+Nrp6y80DCFnDEAvVKWkJyv0VivSSDCChkppHRHAablvInZe6pijDFMnavtN0vqA==", "dev": true, "requires": { "@types/express": "*", @@ -11553,8 +11915,6 @@ }, "@types/validator": { "version": "13.0.0", - "resolved": "https://registry.npmjs.org/@types/validator/-/validator-13.0.0.tgz", - "integrity": "sha512-WAy5txG7aFX8Vw3sloEKp5p/t/Xt8jD3GRD9DacnFv6Vo8ubudAsRTXgxpQwU0mpzY/H8U4db3roDuCMjShBmw==", "peer": true }, "@types/webidl-conversions": { @@ -11651,8 +12011,6 @@ }, "any-promise": { "version": "1.3.0", - "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", - "integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==", "optional": true }, "anymatch": { @@ -11665,8 +12023,6 @@ }, "append-field": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/append-field/-/append-field-1.0.0.tgz", - "integrity": "sha512-klpgFSWLW1ZEs8svjfb7g4qWY0YS5imI82dTg+QahUvJ8YqAY0P10Uk8tTyh9ZGuYEZEMaeJYCF5BFuX552hsw==", "optional": true }, "aproba": { @@ -11706,9 +12062,7 @@ "dev": true }, "array-flatten": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", - "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" + "version": "1.1.1" }, "array-slice": { "version": "1.1.0", @@ -11828,8 +12182,6 @@ }, "body-parser": { "version": "1.20.0", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.0.tgz", - "integrity": "sha512-DfJ+q6EPcGKZD1QWUjSpqp+Q7bDQTsQIF4zfUAtZ6qk+H/3/QRhg9CEp39ss+/T2vw0+HaidC0ecJj/DRLIaKg==", "requires": { "bytes": "3.1.2", "content-type": "~1.0.4", @@ -11847,21 +12199,15 @@ "dependencies": { "debug": { "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "requires": { "ms": "2.0.0" } }, "depd": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", - "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==" + "version": "2.0.0" }, "http-errors": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", - "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", "requires": { "depd": "2.0.0", "inherits": "2.0.4", @@ -11871,22 +12217,16 @@ } }, "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + "version": "2.0.0" }, "qs": { "version": "6.10.3", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.3.tgz", - "integrity": "sha512-wr7M2E0OFRfIfJZjKGieI8lBKb7fRCH4Fv5KNPEs7gJ8jadvotdsS08PzOKR7opXhZ/Xkjtt3WF9g38drmyRqQ==", "requires": { "side-channel": "^1.0.4" } }, "statuses": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", - "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==" + "version": "2.0.1" } } }, @@ -11948,8 +12288,6 @@ }, "busboy": { "version": "0.2.14", - "resolved": "https://registry.npmjs.org/busboy/-/busboy-0.2.14.tgz", - "integrity": "sha512-InWFDomvlkEj+xWLBfU3AvnbVYqeTWmQopiW0tWWEy5yehYm2YkGEc59sUmw/4ty5Zj/b0WHGs1LgecuBSBGrg==", "optional": true, "requires": { "dicer": "0.2.5", @@ -11958,14 +12296,10 @@ "dependencies": { "isarray": { "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==", "optional": true }, "readable-stream": { "version": "1.1.14", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", - "integrity": "sha512-+MeVjFf4L44XUkhM1eYbD8fyEsxcV81pqMSR5gblfcLCHfZvbrqy4/qYHE+/R5HoBUT11WV5O08Cr1n3YXkWVQ==", "optional": true, "requires": { "core-util-is": "~1.0.0", @@ -11976,8 +12310,6 @@ }, "string_decoder": { "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha512-ev2QzSzWPYmy9GuqfIVildA4OdcGLeFZQrq5ys6RtiuF+RQQiZWr8TZNyAcuVXyQRYfEO+MsoB/1BuQVhOJuoQ==", "optional": true } } @@ -12181,8 +12513,6 @@ }, "class-transformer": { "version": "0.3.1", - "resolved": "https://registry.npmjs.org/class-transformer/-/class-transformer-0.3.1.tgz", - "integrity": "sha512-cKFwohpJbuMovS8xVLmn8N2AUbAuc8pVo4zEfsUVo8qgECOogns1WVk/FkOZoxhOPTyTYFckuoH+13FO+MQ8GA==", "peer": true }, "class-utils": { @@ -12251,14 +12581,12 @@ }, "class-validator": { "version": "0.12.2", - "resolved": "https://registry.npmjs.org/class-validator/-/class-validator-0.12.2.tgz", - "integrity": "sha512-TDzPzp8BmpsbPhQpccB3jMUE/3pK0TyqamrK0kcx+ZeFytMA+O6q87JZZGObHHnoo9GM8vl/JppIyKWeEA/EVw==", "peer": true, "requires": { "@types/validator": "13.0.0", "google-libphonenumber": "^3.2.8", "tslib": ">=1.9.0", - "validator": "13.0.0" + "validator": "13.7.0" } }, "clean-stack": { @@ -12378,8 +12706,6 @@ }, "concat-stream": { "version": "1.6.2", - "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", - "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", "optional": true, "requires": { "buffer-from": "^1.0.0", @@ -12390,8 +12716,6 @@ "dependencies": { "readable-stream": { "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", "optional": true, "requires": { "core-util-is": "~1.0.0", @@ -12405,14 +12729,10 @@ }, "safe-buffer": { "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", "optional": true }, "string_decoder": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "optional": true, "requires": { "safe-buffer": "~5.1.0" @@ -12506,14 +12826,10 @@ "version": "1.0.4" }, "cookie": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.2.tgz", - "integrity": "sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==" + "version": "0.4.2" }, "cookie-signature": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", - "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==" + "version": "1.0.6" }, "cookies": { "version": "0.8.0", @@ -12715,8 +13031,6 @@ }, "dicer": { "version": "0.2.5", - "resolved": "https://registry.npmjs.org/dicer/-/dicer-0.2.5.tgz", - "integrity": "sha512-FDvbtnq7dzlPz0wyYlOExifDEZcu8h+rErEXgfxqmLfRfC/kJidEFh4+effJRO3P0xmfqyPbSMG0LveNRfTKVg==", "optional": true, "requires": { "readable-stream": "1.1.x", @@ -12725,14 +13039,10 @@ "dependencies": { "isarray": { "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==", "optional": true }, "readable-stream": { "version": "1.1.14", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", - "integrity": "sha512-+MeVjFf4L44XUkhM1eYbD8fyEsxcV81pqMSR5gblfcLCHfZvbrqy4/qYHE+/R5HoBUT11WV5O08Cr1n3YXkWVQ==", "optional": true, "requires": { "core-util-is": "~1.0.0", @@ -12743,8 +13053,6 @@ }, "string_decoder": { "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha512-ev2QzSzWPYmy9GuqfIVildA4OdcGLeFZQrq5ys6RtiuF+RQQiZWr8TZNyAcuVXyQRYfEO+MsoB/1BuQVhOJuoQ==", "optional": true } } @@ -12764,17 +13072,13 @@ }, "discord-logs": { "version": "2.2.1", - "resolved": "https://registry.npmjs.org/discord-logs/-/discord-logs-2.2.1.tgz", - "integrity": "sha512-VTNe/uRcfdLDLBLf1Taaj3OYU1GLWTAVEcCPC/xZqZd1X4D3DXW1qYJWxoyx3yqiJZ4rwQ3A0bPIFryIdniKrQ==", "requires": { "@types/node": "^18.7.11", "@types/ws": "^8.5.3" }, "dependencies": { "@types/node": { - "version": "18.7.16", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.16.tgz", - "integrity": "sha512-EQHhixfu+mkqHMZl1R2Ovuvn47PUw18azMJOTwSZr9/fhzHNGXAJ0ma0dayRVchprpCj0Kc1K1xKoWaATWF1qg==" + "version": "18.7.16" } } }, @@ -12798,9 +13102,11 @@ } }, "discordx": { - "version": "11.1.8", + "version": "11.2.2", + "resolved": "https://registry.npmjs.org/discordx/-/discordx-11.2.2.tgz", + "integrity": "sha512-1jj3hWrrhula1QVVDIMiUeiStrj0DLDEtlQ6iWqMiWdFOfO440QK4KXhtLec81OHjliAwl7nQBy2NlVvs8A/YQ==", "requires": { - "@discordx/di": "^3.0.1", + "@discordx/di": "^3.0.2", "@discordx/internal": "^1.0.2", "lodash": "^4.17.21", "reflect-metadata": "^0.1.13", @@ -12974,9 +13280,7 @@ "version": "3.2.25" }, "etag": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", - "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==" + "version": "1.8.1" }, "expand-brackets": { "version": "2.1.4", @@ -13079,8 +13383,6 @@ }, "express": { "version": "4.18.1", - "resolved": "https://registry.npmjs.org/express/-/express-4.18.1.tgz", - "integrity": "sha512-zZBcOX9TfehHQhtupq57OF8lFZ3UZi08Y97dwFCkD8p9d/d2Y3M+ykKcwaMDEL+4qyUolgBDX6AblpR3fL212Q==", "requires": { "accepts": "~1.3.8", "array-flatten": "1.1.1", @@ -13116,27 +13418,19 @@ }, "dependencies": { "cookie": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", - "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==" + "version": "0.5.0" }, "debug": { "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "requires": { "ms": "2.0.0" } }, "depd": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", - "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==" + "version": "2.0.0" }, "http-errors": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", - "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", "requires": { "depd": "2.0.0", "inherits": "2.0.4", @@ -13146,34 +13440,24 @@ } }, "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + "version": "2.0.0" }, "path-to-regexp": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", - "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==" + "version": "0.1.7" }, "qs": { "version": "6.10.3", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.3.tgz", - "integrity": "sha512-wr7M2E0OFRfIfJZjKGieI8lBKb7fRCH4Fv5KNPEs7gJ8jadvotdsS08PzOKR7opXhZ/Xkjtt3WF9g38drmyRqQ==", "requires": { "side-channel": "^1.0.4" } }, "statuses": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", - "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==" + "version": "2.0.1" } } }, "express-session": { "version": "1.17.3", - "resolved": "https://registry.npmjs.org/express-session/-/express-session-1.17.3.tgz", - "integrity": "sha512-4+otWXlShYlG1Ma+2Jnn+xgKUZTMJ5QD3YvfilX3AcocOAbIkVylSWEklzALe/+Pu4qV6TYBj5GwOBFfdKqLBw==", "requires": { "cookie": "0.4.2", "cookie-signature": "1.0.6", @@ -13187,21 +13471,15 @@ "dependencies": { "debug": { "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "requires": { "ms": "2.0.0" } }, "depd": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", - "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==" + "version": "2.0.0" }, "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + "version": "2.0.0" } } }, @@ -13319,8 +13597,6 @@ }, "finalhandler": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", - "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==", "requires": { "debug": "2.6.9", "encodeurl": "~1.0.2", @@ -13333,21 +13609,15 @@ "dependencies": { "debug": { "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "requires": { "ms": "2.0.0" } }, "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + "version": "2.0.0" }, "statuses": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", - "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==" + "version": "2.0.1" } } }, @@ -13509,9 +13779,7 @@ } }, "forwarded": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", - "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==" + "version": "0.2.0" }, "fragment-cache": { "version": "0.2.1", @@ -13759,8 +14027,6 @@ }, "google-libphonenumber": { "version": "3.2.30", - "resolved": "https://registry.npmjs.org/google-libphonenumber/-/google-libphonenumber-3.2.30.tgz", - "integrity": "sha512-Kx2/AqmY0P6863vOhkiCFqfAxfY3jagMe916ByU38JRKiRCqSHGJW1qTOZNV4+ag8Xda69dk6w8VwEeswVy44w==", "peer": true }, "graceful-fs": { @@ -14056,9 +14322,7 @@ "version": "1.1.8" }, "ipaddr.js": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", - "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==" + "version": "1.9.1" }, "is-absolute": { "version": "1.0.0", @@ -14427,8 +14691,6 @@ }, "koa-multer": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/koa-multer/-/koa-multer-1.0.2.tgz", - "integrity": "sha512-0kFzN4atVd+9oiG+4fYxQ9S2T3dPhKNvmhITIY606Qn9wLEmfhW0DhSpOzRYhddN//4rh/TCK95TMtflmFa5lA==", "optional": true, "requires": { "multer": "1.3.0" @@ -14436,14 +14698,10 @@ "dependencies": { "append-field": { "version": "0.1.0", - "resolved": "https://registry.npmjs.org/append-field/-/append-field-0.1.0.tgz", - "integrity": "sha512-8BgHoIwbQZaAQgDZLBu2vQoXHgUpSx4vQK1qv7e6R8YfbiSf4fCaBPJRtM1BaxVn1rIHc5ftv0cklsJ78BkouQ==", "optional": true }, "multer": { "version": "1.3.0", - "resolved": "https://registry.npmjs.org/multer/-/multer-1.3.0.tgz", - "integrity": "sha512-wbAkTsh0QXkvqvHCU2qSLEXLuRN7IKMEe80+JrXfJzANniPNgrNcDOMKfGgR1EhL7y7MHIbODVwT7uaVY20ggw==", "optional": true, "requires": { "append-field": "^0.1.0", @@ -14458,16 +14716,12 @@ }, "object-assign": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-3.0.0.tgz", - "integrity": "sha512-jHP15vXVGeVh1HuaA2wY6lxk+whK/x4KBG88VXeRma7CCun7iGD5qPc4eYykQ9sdQvg8jkwFKsSxHln2ybW3xQ==", "optional": true } } }, "koa-router": { "version": "7.4.0", - "resolved": "https://registry.npmjs.org/koa-router/-/koa-router-7.4.0.tgz", - "integrity": "sha512-IWhaDXeAnfDBEpWS6hkGdZ1ablgr6Q6pGdXCyK38RbzuH4LkUOpPqPw+3f8l8aTDrQmBQ7xJc0bs2yV4dzcO+g==", "optional": true, "requires": { "debug": "^3.1.0", @@ -14480,8 +14734,6 @@ "dependencies": { "debug": { "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", "optional": true, "requires": { "ms": "^2.1.1" @@ -14489,14 +14741,10 @@ }, "isarray": { "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==", "optional": true }, "koa-compose": { "version": "3.2.1", - "resolved": "https://registry.npmjs.org/koa-compose/-/koa-compose-3.2.1.tgz", - "integrity": "sha512-8gen2cvKHIZ35eDEik5WOo8zbVp9t4cP8p4hW4uE55waxolLRexKKrqfCpwhGVppnB40jWeF8bZeTVg99eZgPw==", "optional": true, "requires": { "any-promise": "^1.1.0" @@ -14504,8 +14752,6 @@ }, "path-to-regexp": { "version": "1.8.0", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.8.0.tgz", - "integrity": "sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA==", "optional": true, "requires": { "isarray": "0.0.1" @@ -14572,26 +14818,20 @@ "integrity": "sha512-hFuH8TY+Yji7Eja3mGiuAxBqLagejScbG8GbG0j6o9vzn0YL14My+ktnqtZgFTosKymC9/44wP6s7xyuLfnClw==" }, "lodash.capitalize": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/lodash.capitalize/-/lodash.capitalize-4.2.1.tgz", - "integrity": "sha512-kZzYOKspf8XVX5AvmQF94gQW0lejFVgb80G85bU4ZWzoJ6C03PQg3coYAUpSTpQWelrZELd3XWgHzw4Ck5kaIw==" + "version": "4.2.1" }, "lodash.get": { "version": "4.4.2", "dev": true }, "lodash.merge": { - "version": "4.6.2", - "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", - "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==" + "version": "4.6.2" }, "lodash.snakecase": { "version": "4.1.1" }, "lodash.startcase": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/lodash.startcase/-/lodash.startcase-4.4.0.tgz", - "integrity": "sha512-+WKqsK294HMSc2jEbNgpHpd0JfIBhp7rEV4aqXWqFr6AlXov+SlcgB1Fv01y2kGe3Gc8nMW7VA0SrGuSkRfIEg==" + "version": "4.4.0" }, "lodash.uniqwith": { "version": "4.5.0" @@ -14720,9 +14960,7 @@ "dev": true }, "merge-descriptors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", - "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==" + "version": "1.0.1" }, "merge2": { "version": "1.4.1" @@ -14741,9 +14979,7 @@ "version": "5.3.1" }, "mime": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", - "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==" + "version": "1.6.0" }, "mime-db": { "version": "1.52.0" @@ -14889,8 +15125,6 @@ }, "multer": { "version": "1.4.4", - "resolved": "https://registry.npmjs.org/multer/-/multer-1.4.4.tgz", - "integrity": "sha512-2wY2+xD4udX612aMqMcB8Ws2Voq6NIUPEtD1be6m411T4uDH/VtL9i//xvcyFlTVfRdaBsk7hV5tgrGQqhuBiw==", "optional": true, "requires": { "append-field": "^1.0.0", @@ -14996,6 +15230,14 @@ "version": "3.24.0", "requires": { "semver": "^7.3.5" + }, + "dependencies": { + "semver": { + "version": "7.3.7", + "requires": { + "lru-cache": "^6.0.0" + } + } } }, "node-addon-api": { @@ -15081,6 +15323,13 @@ "gauge": "^4.0.3", "set-blocking": "^2.0.0" } + }, + "semver": { + "version": "7.3.7", + "optional": true, + "requires": { + "lru-cache": "^6.0.0" + } } } }, @@ -15429,9 +15678,7 @@ } }, "on-headers": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz", - "integrity": "sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==" + "version": "1.0.2" }, "once": { "version": "1.4.0", @@ -15453,8 +15700,6 @@ }, "openapi3-ts": { "version": "2.0.2", - "resolved": "https://registry.npmjs.org/openapi3-ts/-/openapi3-ts-2.0.2.tgz", - "integrity": "sha512-TxhYBMoqx9frXyOgnRHufjQfPXomTIHYKhSKJ6jHfj13kS8OEIhvmE8CTuQyKtjjWttAjX5DPxM1vmalEpo8Qw==", "requires": { "yaml": "^1.10.2" } @@ -15902,8 +16147,6 @@ }, "proxy-addr": { "version": "2.0.7", - "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", - "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", "requires": { "forwarded": "0.2.0", "ipaddr.js": "1.9.1" @@ -15940,14 +16183,10 @@ "version": "1.2.3" }, "random-bytes": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/random-bytes/-/random-bytes-1.0.0.tgz", - "integrity": "sha512-iv7LhNVO047HzYR3InF6pUcUsPQiHTM1Qal51DcGSuZFBil1aBBWG5eHPNek7bvILMaYJ/8RU1e8w1AMdHmLQQ==" + "version": "1.0.0" }, "range-parser": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", - "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==" + "version": "1.2.1" }, "raw-body": { "version": "2.5.1", @@ -16392,8 +16631,6 @@ }, "routing-controllers": { "version": "0.9.0", - "resolved": "https://registry.npmjs.org/routing-controllers/-/routing-controllers-0.9.0.tgz", - "integrity": "sha512-OtARLKA6j8enNgGqi/hoRqBsTjVo2hbxc1+MeKi8mvelNn18+LXUdHpzY3z4GbCERBtaj8CwVjcsiQR+2w6ZFg==", "requires": { "body-parser": "^1.19.0", "cookie": "^0.4.0", @@ -16411,8 +16648,6 @@ "dependencies": { "brace-expansion": { "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -16420,8 +16655,6 @@ }, "glob": { "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -16433,8 +16666,6 @@ }, "minimatch": { "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "requires": { "brace-expansion": "^1.1.7" } @@ -16443,8 +16674,6 @@ }, "routing-controllers-openapi": { "version": "3.1.0", - "resolved": "https://registry.npmjs.org/routing-controllers-openapi/-/routing-controllers-openapi-3.1.0.tgz", - "integrity": "sha512-FnTYnbNfsCN+vTDAc7rhCm5u0nLAH+p+UpbJXZT10cgo2t7xiZ23BrrzsR5nnqMGwe/iwsDUEEr8lxs6KarscQ==", "requires": { "lodash.capitalize": "^4.2.1", "lodash.merge": "^4.6.2", @@ -16456,9 +16685,7 @@ }, "dependencies": { "path-to-regexp": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-2.4.0.tgz", - "integrity": "sha512-G6zHoVqC6GGTQkZwF4lkuEyMbVOjoBKAEybQUypI1WTkqinCOrq2x6U2+phkJ1XsEMTy4LjtwPI7HW+NVrRR2w==" + "version": "2.4.0" } } }, @@ -16529,9 +16756,9 @@ "version": "1.2.4" }, "semver": { - "version": "7.3.7", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", - "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", + "version": "7.3.8", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", + "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", "requires": { "lru-cache": "^6.0.0" } @@ -16541,8 +16768,6 @@ }, "send": { "version": "0.18.0", - "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", - "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", "requires": { "debug": "2.6.9", "depd": "2.0.0", @@ -16561,28 +16786,20 @@ "dependencies": { "debug": { "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "requires": { "ms": "2.0.0" }, "dependencies": { "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + "version": "2.0.0" } } }, "depd": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", - "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==" + "version": "2.0.0" }, "http-errors": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", - "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", "requires": { "depd": "2.0.0", "inherits": "2.0.4", @@ -16592,14 +16809,10 @@ } }, "ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + "version": "2.1.3" }, "statuses": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", - "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==" + "version": "2.0.1" } } }, @@ -16616,8 +16829,6 @@ }, "serve-static": { "version": "1.15.0", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz", - "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==", "requires": { "encodeurl": "~1.0.2", "escape-html": "~1.0.3", @@ -17118,8 +17329,6 @@ }, "streamsearch": { "version": "0.1.2", - "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-0.1.2.tgz", - "integrity": "sha512-jos8u++JKm0ARcSUTAZXOVC0mSox7Bhn6sBgty73P1f3JGf7yG2clTbBNHUdde/kdvP2FESam+vM6l8jBrNxHA==", "optional": true }, "string_decoder": { @@ -17196,14 +17405,10 @@ "version": "1.0.0" }, "swagger-ui-dist": { - "version": "4.14.0", - "resolved": "https://registry.npmjs.org/swagger-ui-dist/-/swagger-ui-dist-4.14.0.tgz", - "integrity": "sha512-TBzhheU15s+o54Cgk9qxuYcZMiqSm/SkvKnapoGHOF66kz0Y5aGjpzj5BT/vpBbn6rTPJ9tUYXQxuDWfsjiGMw==" + "version": "4.14.0" }, "swagger-ui-express": { "version": "4.5.0", - "resolved": "https://registry.npmjs.org/swagger-ui-express/-/swagger-ui-express-4.5.0.tgz", - "integrity": "sha512-DHk3zFvsxrkcnurGvQlAcLuTDacAVN1JHKDgcba/gr2NFRE4HGwP1YeHIXMiGznkWR4AeS7X5vEblNn4QljuNA==", "requires": { "swagger-ui-dist": ">=4.11.0" } @@ -17260,9 +17465,7 @@ "version": "3.0.2" }, "template-url": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/template-url/-/template-url-1.0.0.tgz", - "integrity": "sha512-QUjZNE7yTdIzB91sITTSYcSX5GRF5FulKvIYCqV5350NfSNfiuuCYQIJZ5PIN7k/uJ+kpurEEv9hFqRRc+JilA==" + "version": "1.0.0" }, "through": { "version": "2.3.8", @@ -17365,10 +17568,12 @@ "version": "6.0.1" }, "ts-node": { - "version": "10.8.1", + "version": "10.7.0", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.7.0.tgz", + "integrity": "sha512-TbIGS4xgJoX2i3do417KSaep1uRAW/Lu+WAL2doDHC0D6ummjirVOXU5/7aiZotbQ5p1Zp9tP7U6cYhA0O7M8A==", "dev": true, "requires": { - "@cspotcode/source-map-support": "^0.8.0", + "@cspotcode/source-map-support": "0.7.0", "@tsconfig/node10": "^1.0.7", "@tsconfig/node12": "^1.0.7", "@tsconfig/node14": "^1.0.0", @@ -17379,7 +17584,7 @@ "create-require": "^1.1.0", "diff": "^4.0.1", "make-error": "^1.1.1", - "v8-compile-cache-lib": "^3.0.1", + "v8-compile-cache-lib": "^3.0.0", "yn": "3.1.1" } }, @@ -17442,15 +17647,17 @@ }, "typedarray": { "version": "0.0.6", - "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", - "integrity": "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==", "optional": true }, "typedi": { - "version": "0.10.0" + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/typedi/-/typedi-0.10.0.tgz", + "integrity": "sha512-v3UJF8xm68BBj6AF4oQML3ikrfK2c9EmZUyLOfShpJuItAqVBHWP/KtpGinkSsIiP6EZyyb6Z3NXyW9dgS9X1w==" }, "typesafe-i18n": { - "version": "5.5.2", + "version": "5.14.0", + "resolved": "https://registry.npmjs.org/typesafe-i18n/-/typesafe-i18n-5.14.0.tgz", + "integrity": "sha512-ZNHysUvZZhmUuMjBvDGtUI8vT3g//4ay5fFOk2sJCsjx4ztippW1Hrhrq59nJ9mV/Q0u4OX80Gyorq8L3rwNLw==", "requires": {} }, "typescript": { @@ -17463,8 +17670,6 @@ }, "uid-safe": { "version": "2.1.5", - "resolved": "https://registry.npmjs.org/uid-safe/-/uid-safe-2.1.5.tgz", - "integrity": "sha512-KPHm4VL5dDXKz01UuEd88Df+KzynaohSL9fBh096KWAxSKZQDI2uBrVqtvRM4rwrIrRRKsdLNML/lnaaVSRioA==", "requires": { "random-bytes": "~1.0.0" } @@ -17655,8 +17860,6 @@ }, "urijs": { "version": "1.19.11", - "resolved": "https://registry.npmjs.org/urijs/-/urijs-1.19.11.tgz", - "integrity": "sha512-HXgFDgDommxn5/bIv0cnQZsPhHDA90NPHD6+c/v21U5+Sx5hoP8+dP9IZXBU1gIfvdRfhG8cel9QNPeionfcCQ==", "optional": true }, "urix": { @@ -17675,9 +17878,7 @@ "version": "1.0.2" }, "utils-merge": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", - "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==" + "version": "1.0.1" }, "uuid": { "version": "8.3.2" @@ -17701,9 +17902,9 @@ } }, "validator": { - "version": "13.0.0", - "resolved": "https://registry.npmjs.org/validator/-/validator-13.0.0.tgz", - "integrity": "sha512-anYx5fURbgF04lQV18nEQWZ/3wHGnxiKdG4aL8J+jEDsm98n/sU/bey+tYk6tnGJzm7ioh5FoqrAiQ6m03IgaA==", + "version": "13.7.0", + "resolved": "https://registry.npmjs.org/validator/-/validator-13.7.0.tgz", + "integrity": "sha512-nYXQLCBkpJ8X6ltALua9dRrZDHVYxjJ1wgskNt1lH9fzGjs3tgojGSCBjmEPwkWS1y29+DrizMTW19Pr9uB2nw==", "peer": true }, "vary": { @@ -17819,9 +18020,7 @@ "version": "4.0.0" }, "yaml": { - "version": "1.10.2", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", - "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==" + "version": "1.10.2" }, "yargonaut": { "version": "1.1.4", diff --git a/package.json b/package.json index 3204303a..f563fb6c 100644 --- a/package.json +++ b/package.json @@ -7,11 +7,11 @@ "scripts": { "build": "npm run build:clean && swc src -d build && npm run type:check", "build:changelog": "npx @discordx/changelog --root=src", - "build:serve": "npm run build && npm run serve", + "build:start": "npm run build && npm run start", "build:clean": "rimraf build", - "serve": "cross-env NODE_ENV=production node build/main.js", - "start": "cross-env NODE_ENV=production node -r @swc-node/register src/main.ts", + "start": "cross-env NODE_ENV=production node build/main.js", "dev": "cross-env NODE_ENV=development nodemon --exec node -r @swc-node/register src/main.ts", + "dev:start": "cross-env NODE_ENV=production node -r @swc-node/register src/main.ts", "dev:compile": "swc src -w -d build", "type:check": "tsc --pretty --skipLibCheck --noEmit", "migration:create": "npx mikro-orm migration:create", @@ -21,89 +21,88 @@ "plop": "plop --plopfile ./cli/plopfile.js" }, "dependencies": { - "@discordx/importer": "^1.1.10", - "@discordx/music": "^4.1.0", - "@discordx/pagination": "^3.0.0", - "@discordx/utilities": "^5.0.0", - "@mikro-orm/better-sqlite": "^5.3.1", - "@mikro-orm/cli": "^5.3.1", - "@mikro-orm/core": "^5.3.1", - "@mikro-orm/mariadb": "^5.3.1", - "@mikro-orm/migrations": "^5.3.1", - "@mikro-orm/mongodb": "^5.3.1", - "@mikro-orm/mysql": "^5.3.1", - "@mikro-orm/postgresql": "^5.3.1", - "@mikro-orm/sql-highlighter": "^1.0.1", - "@mikro-orm/sqlite": "^5.3.1", - "@types/semver": "^7.3.12", - "axios": "^0.27.2", - "body-parser": "^1.20.0", - "boxen": "^5.1.2", - "case": "^1.6.3", - "chalk": "^4.1.2", - "cron": "^2.0.0", - "cron-validator": "^1.3.1", - "cross-env": "^7.0.3", - "dayjs": "^1.11.3", - "discord-api-types": "^0.36.2", - "discord-logs": "^2.2.1", - "discord-oauth2": "^2.10.0", - "discord.js": "^14.0.3", - "discordx": "^11.1.8", - "dotenv": "^16.0.1", - "fast-folder-size": "^1.7.0", - "fs": "^0.0.1-security", - "http-status-codes": "^2.2.0", - "image-hash": "^5.3.1", - "imgur": "^2.2.0", - "joi": "^17.6.0", - "koa": "^2.13.4", - "node-os-utils": "^1.3.7", - "oneline": "^1.0.3", - "ora": "^5.4.1", - "pidusage": "^3.0.0", + "@discordx/importer": "~1.1.10", + "@discordx/music": "~4.1.0", + "@discordx/pagination": "~3.0.0", + "@discordx/utilities": "~5.0.0", + "@mikro-orm/better-sqlite": "~5.3.1", + "@mikro-orm/cli": "~5.3.1", + "@mikro-orm/core": "~5.3.1", + "@mikro-orm/mariadb": "~5.3.1", + "@mikro-orm/migrations": "~5.3.1", + "@mikro-orm/mongodb": "~5.3.1", + "@mikro-orm/mysql": "~5.3.1", + "@mikro-orm/postgresql": "~5.3.1", + "@mikro-orm/sql-highlighter": "~1.0.1", + "@mikro-orm/sqlite": "~5.3.1", + "axios": "~0.27.2", + "boxen": "~5.1.2", + "case": "~1.6.3", + "chalk": "~4.1.2", + "cron": "~2.0.0", + "cron-validator": "~1.3.1", + "cross-env": "~7.0.3", + "dayjs": "~1.11.3", + "discord-api-types": "~0.36.2", + "discord-logs": "~2.2.1", + "discord-oauth2": "~2.10.0", + "discord.js": "~14.0.3", + "discordx": "~11.2.0", + "dotenv": "~16.0.1", + "fast-folder-size": "~1.7.0", + "fs": "~0.0.1-security", + "http-status-codes": "~2.2.0", + "image-hash": "~5.3.1", + "imgur": "~2.2.0", + "joi": "~17.6.0", + "koa": "~2.13.4", + "node-os-utils": "~1.3.7", + "oneline": "~1.0.3", + "ora": "~5.4.1", + "pidusage": "~3.0.0", "recursive-install": "^1.4.0", - "reflect-metadata": "^0.1.13", - "rentry-pastebin": "^1.2.3", - "routing-controllers": "^0.9.0", - "routing-controllers-openapi": "^3.1.0", - "rxeta": "^1.1.2", - "saveqlite": "^1.1.2", + "reflect-metadata": "~0.1.13", + "rentry-pastebin": "~1.2.3", + "routing-controllers": "~0.9.0", + "routing-controllers-openapi": "~3.1.0", + "rxeta": "~1.1.2", + "saveqlite": "~1.1.2", "semver": "^7.3.7", - "socket.io-client": "^4.5.1", - "stacktrace-parser": "^0.1.10", - "swagger-ui-express": "^4.5.0", - "tsyringe": "^4.6.0", - "typesafe-i18n": "^5.4.3", - "uuid": "^8.3.2" + "socket.io-client": "~4.5.1", + "stacktrace-parser": "~0.1.10", + "swagger-ui-express": "~4.5.0", + "tsyringe": "~4.7.0", + "typesafe-i18n": "^5.13.1", + "uuid": "~8.3.2" }, "devDependencies": { - "@swc-node/register": "^1.5.1", - "@swc/cli": "^0.1.57", - "@swc/core": "^1.2.245", - "@types/better-sqlite3": "^7.5.0", - "@types/cron": "^2.0.0", - "@types/dateformat": "^5.0.0", - "@types/express": "^4.17.13", - "@types/node": "^17.0.33", - "@types/node-os-utils": "^1.3.0", - "@types/pidusage": "^2.0.2", - "@types/swagger-ui-express": "^4.1.3", - "chokidar": "^3.5.3", - "concurrently": "^7.3.0", - "ncp": "^2.0.0", - "nodemon": "^2.0.19", - "npm-run-all": "^4.1.5", - "plop": "^2.3.0", - "rimraf": "^3.0.2", - "ts-node": "^10.7.0", - "tsc-alias": "^1.6.7", - "tsconfig-paths": "^4.0.0", + "@types/semver": "^7.3.12", + "@swc-node/register": "~1.5.1", + "@swc/cli": "~0.1.57", + "@swc/core": "1.3.2", + "@types/better-sqlite3": "~7.5.0", + "@types/cron": "~2.0.0", + "@types/dateformat": "~5.0.0", + "@types/express": "~4.17.13", + "@types/node": "~17.0.33", + "@types/node-os-utils": "~1.3.0", + "@types/pidusage": "~2.0.2", + "@types/swagger-ui-express": "~4.1.3", + "chokidar": "~3.5.3", + "concurrently": "~7.3.0", + "ncp": "~2.0.0", + "nodemon": "~2.0.19", + "npm-run-all": "~4.1.5", + "plop": "^2.7.6", + "rimraf": "~3.0.2", + "ts-node": "~10.7.0", + "tsc-alias": "~1.6.7", + "tsconfig-paths": "~4.0.0", "typescript": "~4.6.4" }, "engines": { - "node": ">=16.0.0", - "npm": ">=7.0.0" + "node": ">=16.9.0", + "npm": ">=8.0.0" }, "mikro-orm": { "useTsNode": true, @@ -113,7 +112,7 @@ ] }, "volta": { - "node": "17.6.0" + "node": "16.17.0" }, "overrides": { "validator": "13.7.0" @@ -122,5 +121,6 @@ "ignore": [ "src/i18n/**/!(i18n-types.ts)" ] - } + }, + "tscordTemplate": true } diff --git a/pm2.config.json b/pm2.config.json index 3113a772..0a868f17 100644 --- a/pm2.config.json +++ b/pm2.config.json @@ -3,7 +3,7 @@ { "name": "My Discord Bot", "script": "npm", - "args" : "run build:serve" + "args" : "run build:start" } ] } \ No newline at end of file diff --git a/src/api/controllers/bot.ts b/src/api/controllers/bot.ts index 71a1f3fb..6629da1e 100644 --- a/src/api/controllers/bot.ts +++ b/src/api/controllers/bot.ts @@ -206,7 +206,7 @@ export class BotController extends BaseController { } } - @Get('/cachedUsers') + @Get('/users/cached') async cachedUsers() { return this.client.users.cache.map(user => user.toJSON()) diff --git a/src/api/controllers/database.ts b/src/api/controllers/database.ts index b8d9f650..a922ba00 100644 --- a/src/api/controllers/database.ts +++ b/src/api/controllers/database.ts @@ -34,7 +34,7 @@ export class DatabaseController extends BaseController { } } } - else throw new InternalServerError("Couldn't generate backup, see the logs for more informations") + else throw new InternalServerError("Couldn't generate backup, see the logs for more information") } @Post('/restore') @@ -46,11 +46,11 @@ export class DatabaseController extends BaseController { const success = await this.db.restore(snapshotName) if (success) return { message: "Backup restored" } - else throw new InternalServerError("Couldn't restore backup, see the logs for more informations") + else throw new InternalServerError("Couldn't restore backup, see the logs for more information") } - @Get('/backup/list') - async getBackupList(req: Request, res: Response) { + @Get('/backups') + async getBackups(req: Request, res: Response) { const backupPath = databaseConfig.backup.path if (!backupPath) throw new InternalServerError("Backup path not set, couldn't find backups") @@ -58,7 +58,7 @@ export class DatabaseController extends BaseController { const backupList = this.db.getBackupList() if (backupList) return backupList - else throw new InternalServerError("Couldn't get backup list, see the logs for more informations") + else throw new InternalServerError("Couldn't get backup list, see the logs for more information") } @Get('/size') diff --git a/src/api/controllers/stats.ts b/src/api/controllers/stats.ts index 2c5c54dc..bf79c13e 100644 --- a/src/api/controllers/stats.ts +++ b/src/api/controllers/stats.ts @@ -4,7 +4,6 @@ import { BaseController } from "@utils/classes" import { Get, JsonController, QueryParam, UseBefore } from "routing-controllers" import { injectable } from "tsyringe" - @JsonController('/stats') @UseBefore( authenticated @@ -33,14 +32,21 @@ export class StatsController extends BaseController { } } - @Get('/lastInteraction') + @Get('/interaction/last') async lastInteraction() { const lastInteraction = await this.stats.getLastInteraction() return lastInteraction } - @Get('/commandsUsage') + @Get('/guilds/last') + async lastGuildAdded() { + + const lastGuild = await this.stats.getLastGuildAdded() + return lastGuild + } + + @Get('/commands/usage') async commandsUsage(@QueryParam('numberOfDays', { type: Number }) numberOfDays: number = 7) { const commandsUsage = { @@ -63,7 +69,7 @@ export class StatsController extends BaseController { return body } - @Get('/topCommands') + @Get('/commands/top') async topCommands() { const topCommands = await this.stats.getTopCommands() @@ -71,7 +77,7 @@ export class StatsController extends BaseController { return topCommands } - @Get('/usersActivity') + @Get('/users/activity') async usersActivity() { const usersActivity = await this.stats.getUsersActivity() @@ -79,7 +85,7 @@ export class StatsController extends BaseController { return usersActivity } - @Get('/topGuilds') + @Get('/guilds/top') async topGuilds() { const topGuilds = await this.stats.getTopGuilds() diff --git a/src/api/middlewares/log.ts b/src/api/middlewares/log.ts index 7d423b93..f7f0e19e 100644 --- a/src/api/middlewares/log.ts +++ b/src/api/middlewares/log.ts @@ -15,8 +15,8 @@ export async function log(req: Request, res: Response, next: NextFunction) { const message = `(API) ${method} - ${url}` const chalkedMessage = `(${chalk.bold.white('API')}) ${chalk.bold.green(method)} - ${chalk.bold.blue(url)}` - logger.console('info', chalkedMessage) - logger.file('info', message) + logger.console(chalkedMessage) + logger.file(message) } else { delete req.query.logIgnore diff --git a/src/commands/General/info.ts b/src/commands/General/info.ts index 0cdb3609..9347fe74 100644 --- a/src/commands/General/info.ts +++ b/src/commands/General/info.ts @@ -130,7 +130,7 @@ export default class InfoCommand { const row = new ActionRowBuilder() .addComponents(...buttons) - // finaly send the embed + // finally send the embed interaction.followUp({ embeds: [embed], components: [row], diff --git a/src/entities/index.ts b/src/entities/index.ts index ae0eb3ae..4a182ff4 100644 --- a/src/entities/index.ts +++ b/src/entities/index.ts @@ -1,4 +1,4 @@ -export * from './BaseEntity' +// export * from './BaseEntity' export * from './User' export * from './Guild' diff --git a/src/events/custom/guildAdmin.ts b/src/events/custom/guildAdmin.ts index 9101897f..aa511690 100644 --- a/src/events/custom/guildAdmin.ts +++ b/src/events/custom/guildAdmin.ts @@ -28,7 +28,7 @@ export default class GuildAdminAddEvent { client: Client ) { - this.logger.log('info', `${member.nickname} has been added as an admin`) + this.logger.log(`${member.nickname} has been added as an admin`) } @On('guildAdminDelete') @@ -41,7 +41,7 @@ export default class GuildAdminAddEvent { client: Client ) { - this.logger.log('info', `${member.nickname} has been removed from admins`) + this.logger.log(`${member.nickname} has been removed from admins`) } // ============================= diff --git a/src/events/ready.ts b/src/events/ready.ts index d222fd03..aa26a671 100644 --- a/src/events/ready.ts +++ b/src/events/ready.ts @@ -61,7 +61,7 @@ export default class ReadyEvent { // log startup await this.logger.logStartingConsole() - // syncrhonize guilds between discord and the database + // synchronize guilds between discord and the database await syncAllGuilds(client) } diff --git a/src/i18n/i18n-types.ts b/src/i18n/i18n-types.ts index e2bbd146..4c3f3696 100644 --- a/src/i18n/i18n-types.ts +++ b/src/i18n/i18n-types.ts @@ -16,41 +16,41 @@ export type Translations = RootTranslation type RootTranslation = { GUARDS: { /** - * This command is currently desactivated. + * T​h​i​s​ ​c​o​m​m​a​n​d​ ​i​s​ ​c​u​r​r​e​n​t​l​y​ ​d​e​s​a​c​t​i​v​a​t​e​d​. */ DISABLED_COMMAND: string /** - * This bot is currently in maintenance mode. + * T​h​i​s​ ​b​o​t​ ​i​s​ ​c​u​r​r​e​n​t​l​y​ ​i​n​ ​m​a​i​n​t​e​n​a​n​c​e​ ​m​o​d​e​. */ MAINTENANCE: string /** - * This command can only be used in a server. + * T​h​i​s​ ​c​o​m​m​a​n​d​ ​c​a​n​ ​o​n​l​y​ ​b​e​ ​u​s​e​d​ ​i​n​ ​a​ ​s​e​r​v​e​r​. */ GUILD_ONLY: string /** - * This command can only be used in a NSFW channel. + * T​h​i​s​ ​c​o​m​m​a​n​d​ ​c​a​n​ ​o​n​l​y​ ​b​e​ ​u​s​e​d​ ​i​n​ ​a​ ​N​S​F​W​ ​c​h​a​n​n​e​l​. */ NSFW: string } ERRORS: { /** - * An unknown error occured. + * A​n​ ​u​n​k​n​o​w​n​ ​e​r​r​o​r​ ​o​c​c​u​r​e​d​. */ UNKNOWN: string } COMMANDS: { INVITE: { /** - * Invite the bot to your server! + * I​n​v​i​t​e​ ​t​h​e​ ​b​o​t​ ​t​o​ ​y​o​u​r​ ​s​e​r​v​e​r​! */ DESCRIPTION: string EMBED: { /** - * Invite me on your server! + * I​n​v​i​t​e​ ​m​e​ ​o​n​ ​y​o​u​r​ ​s​e​r​v​e​r​! */ TITLE: string /** - * [Click here]({link}) to invite me! + * [​C​l​i​c​k​ ​h​e​r​e​]​(​{​l​i​n​k​}​)​ ​t​o​ ​i​n​v​i​t​e​ ​m​e​! * @param {unknown} link */ DESCRIPTION: RequiredParams<'link'> @@ -58,28 +58,28 @@ type RootTranslation = { } PREFIX: { /** - * prefix + * p​r​e​f​i​x */ NAME: string /** - * Change the prefix of the bot. + * C​h​a​n​g​e​ ​t​h​e​ ​p​r​e​f​i​x​ ​o​f​ ​t​h​e​ ​b​o​t​. */ DESCRIPTION: string OPTIONS: { PREFIX: { /** - * new_prefix + * n​e​w​_​p​r​e​f​i​x */ NAME: string /** - * The new prefix of the bot. + * T​h​e​ ​n​e​w​ ​p​r​e​f​i​x​ ​o​f​ ​t​h​e​ ​b​o​t​. */ DESCRIPTION: string } } EMBED: { /** - * Prefix changed to `{prefix}`. + * P​r​e​f​i​x​ ​c​h​a​n​g​e​d​ ​t​o​ ​`​{​p​r​e​f​i​x​}​`​. * @param {string} prefix */ DESCRIPTION: RequiredParams<'prefix'> @@ -87,12 +87,12 @@ type RootTranslation = { } MAINTENANCE: { /** - * Set the maintenance mode of the bot. + * S​e​t​ ​t​h​e​ ​m​a​i​n​t​e​n​a​n​c​e​ ​m​o​d​e​ ​o​f​ ​t​h​e​ ​b​o​t​. */ DESCRIPTION: string EMBED: { /** - * Maintenance mode set to `{state}`. + * M​a​i​n​t​e​n​a​n​c​e​ ​m​o​d​e​ ​s​e​t​ ​t​o​ ​`​{​s​t​a​t​e​}​`​. * @param {string} state */ DESCRIPTION: RequiredParams<'state'> @@ -100,51 +100,51 @@ type RootTranslation = { } STATS: { /** - * Get some stats about the bot. + * G​e​t​ ​s​o​m​e​ ​s​t​a​t​s​ ​a​b​o​u​t​ ​t​h​e​ ​b​o​t​. */ DESCRIPTION: string HEADERS: { /** - * Commands + * C​o​m​m​a​n​d​s */ COMMANDS: string /** - * Guild + * G​u​i​l​d */ GUILDS: string /** - * Active Users + * A​c​t​i​v​e​ ​U​s​e​r​s */ ACTIVE_USERS: string /** - * Users + * U​s​e​r​s */ USERS: string } } HELP: { /** - * Get global help about the bot and its commands + * G​e​t​ ​g​l​o​b​a​l​ ​h​e​l​p​ ​a​b​o​u​t​ ​t​h​e​ ​b​o​t​ ​a​n​d​ ​i​t​s​ ​c​o​m​m​a​n​d​s */ DESCRIPTION: string EMBED: { /** - * Help pannel + * H​e​l​p​ ​p​a​n​n​e​l */ TITLE: string /** - * {category} Commands + * {​c​a​t​e​g​o​r​y​}​ ​C​o​m​m​a​n​d​s * @param {string} category */ CATEGORY_TITLE: RequiredParams<'category'> } SELECT_MENU: { /** - * Select a category + * S​e​l​e​c​t​ ​a​ ​c​a​t​e​g​o​r​y */ TITLE: string /** - * {category} commands + * {​c​a​t​e​g​o​r​y​}​ ​c​o​m​m​a​n​d​s * @param {string} category */ CATEGORY_DESCRIPTION: RequiredParams<'category'> @@ -152,11 +152,11 @@ type RootTranslation = { } PING: { /** - * Pong! + * P​o​n​g​! */ DESCRIPTION: string /** - * {member} Pong! The message round-trip took {time}ms.{heartbeat} + * {​m​e​m​b​e​r​}​ ​P​o​n​g​!​ ​T​h​e​ ​m​e​s​s​a​g​e​ ​r​o​u​n​d​-​t​r​i​p​ ​t​o​o​k​ ​{​t​i​m​e​}​m​s​.​{​h​e​a​r​t​b​e​a​t​} * @param {string} heartbeat * @param {string} member * @param {number} time diff --git a/src/i18n/i18n-util.async.ts b/src/i18n/i18n-util.async.ts index a280a302..13e8d99f 100644 --- a/src/i18n/i18n-util.async.ts +++ b/src/i18n/i18n-util.async.ts @@ -13,11 +13,11 @@ const localeTranslationLoaders = { const updateDictionary = (locale: Locales, dictionary: Partial) => loadedLocales[locale] = { ...loadedLocales[locale], ...dictionary } +export const importLocaleAsync = async (locale: Locales) => + (await localeTranslationLoaders[locale]()).default as unknown as Translations + export const loadLocaleAsync = async (locale: Locales): Promise => { - updateDictionary( - locale, - (await localeTranslationLoaders[locale]()).default as unknown as Translations - ) + updateDictionary(locale, await importLocaleAsync(locale)) loadFormatters(locale) } diff --git a/src/i18n/i18n-util.sync.ts b/src/i18n/i18n-util.sync.ts index 206e9dfb..fe0ba74f 100644 --- a/src/i18n/i18n-util.sync.ts +++ b/src/i18n/i18n-util.sync.ts @@ -22,6 +22,5 @@ export const loadLocale = (locale: Locales): void => { export const loadAllLocales = (): void => locales.forEach(loadLocale) -export const loadFormatters = (locale: Locales): void => { - loadedFormatters[locale] = initFormatters(locale) -} +export const loadFormatters = (locale: Locales): void => + void (loadedFormatters[locale] = initFormatters(locale)) diff --git a/src/i18n/i18n-util.ts b/src/i18n/i18n-util.ts index 2c4fa894..9088944f 100644 --- a/src/i18n/i18n-util.ts +++ b/src/i18n/i18n-util.ts @@ -13,6 +13,8 @@ export const locales: Locales[] = [ 'fr' ] +export const isLocale = (locale: string) => locales.includes(locale as Locales) + export const loadedLocales = {} as Record export const loadedFormatters = {} as Record diff --git a/src/services/Database.ts b/src/services/Database.ts index 333c1c0a..33de0f5b 100644 --- a/src/services/Database.ts +++ b/src/services/Database.ts @@ -65,22 +65,22 @@ export class Database { } /** - * Create a snapshot of the database each day at 23:59:59 + * Create a snapshot of the database each day at 00:00 */ - @Schedule('59 59 23 * * *') + @Schedule('0 0 * * *') async backup(snapshotName?: string): Promise { const { formatDate } = await import('@utils/functions') if (!databaseConfig.backup.enabled && !snapshotName) return false if (!this.isSQLiteDatabase()) { - this.logger.log('error', 'Database is not SQLite, couldn\'t backup') + this.logger.log('Database is not SQLite, couldn\'t backup') return false } const backupPath = databaseConfig.backup.path if (!backupPath) { - this.logger.log('error', 'Backup path not set, couldn\'t backup', true) + this.logger.log('Backup path not set, couldn\'t backup', 'error', true) return false } @@ -101,7 +101,7 @@ export class Database { const errorMessage = typeof e === 'string' ? e : e instanceof Error ? e.message : 'Unknown error' - this.logger.log('error', 'Couldn\'t backup : ' + errorMessage, true) + this.logger.log('Couldn\'t backup : ' + errorMessage, 'error', true) return false } @@ -115,13 +115,13 @@ export class Database { async restore(snapshotName: string): Promise { if (!this.isSQLiteDatabase()) { - this.logger.log('error', 'Database is not SQLite, couldn\'t restore') + this.logger.log('Database is not SQLite, couldn\'t restore', 'error') return false } const backupPath = databaseConfig.backup.path if (!backupPath) { - this.logger.log('error', 'Backup path not set, couldn\'t restore', true) + this.logger.log('Backup path not set, couldn\'t restore', 'error', true) } try { @@ -140,7 +140,7 @@ export class Database { } catch (error) { console.debug(error) - this.logger.log('error', 'Snapshot file not found, couldn\'t restore', true) + this.logger.log('Snapshot file not found, couldn\'t restore', 'error', true) return false } } @@ -149,7 +149,7 @@ export class Database { const backupPath = databaseConfig.backup.path if (!backupPath) { - this.logger.log('error', 'Backup path not set, couldn\'t get list of backups') + this.logger.log('Backup path not set, couldn\'t get list of backups', 'error') return null } diff --git a/src/services/ErrorHandler.ts b/src/services/ErrorHandler.ts index e113f4ab..0c3ae772 100644 --- a/src/services/ErrorHandler.ts +++ b/src/services/ErrorHandler.ts @@ -11,7 +11,7 @@ export class ErrorHandler { private logger: Logger ) { - // Catch all exeptions + // Catch all exceptions process.on('uncaughtException', (error: Error, origin: string) => { // stop in case of unhandledRejection diff --git a/src/services/ImagesUpload.ts b/src/services/ImagesUpload.ts index 44fe668a..e08fc50e 100644 --- a/src/services/ImagesUpload.ts +++ b/src/services/ImagesUpload.ts @@ -6,7 +6,7 @@ import axios from "axios" import { Database, Logger } from "@services" import { Image, ImageRepository } from "@entities" -import { base64Encode, getFiles } from "@utils/functions" +import { base64Encode, getFiles, fileOrDirectoryExists } from "@utils/functions" import chalk from "chalk" const imageHasher = promisify(callbackImageHash) @@ -41,6 +41,9 @@ export class ImagesUpload { } async syncWithDatabase() { + + if (!fileOrDirectoryExists(this.imageFolderPath)) this.logger.log('Image folder does not exist, couldn\'t sync with database', 'warn') + // get all images inside the assets/images folder const images = getFiles(this.imageFolderPath) .filter(file => this.isValidImageFormat(file)) @@ -92,8 +95,8 @@ export class ImagesUpload { await this.imgurClient.deleteImage(image.deleteHash) this.logger.log( - 'info', `Image ${image.fileName} deleted from database because it is not in the filesystem anymore`, + 'info', true ) } @@ -118,8 +121,8 @@ export class ImagesUpload { if (!uploadResponse.success ) { this.logger.log( - 'error', `Error uploading image ${imageFileName} to imgur: ${uploadResponse.status} ${uploadResponse.data}`, + 'error', true ) return @@ -138,14 +141,14 @@ export class ImagesUpload { // log the success this.logger.log( - 'info', `Image ${chalk.bold.green(imagePath)} uploaded to imgur`, + 'info', true ) } catch (error: any) { - this.logger.log('error', error?.toString(), true) + this.logger.log(error?.toString(), 'error', true) } } diff --git a/src/services/Logger.ts b/src/services/Logger.ts index 520935a0..996f6cc9 100644 --- a/src/services/Logger.ts +++ b/src/services/Logger.ts @@ -10,7 +10,7 @@ import ora from 'ora' import { getMetadataArgsStorage } from 'routing-controllers' import { routingControllersToSpec } from 'routing-controllers-openapi' -import { formatDate, getTypeOfInteraction, numberAlign, oneLine, resolveAction, resolveChannel, resolveGuild, resolveUser, validString, waitForDependency } from '@utils/functions' +import { fileOrDirectoryExists, formatDate, getTypeOfInteraction, numberAlign, oneLine, resolveAction, resolveChannel, resolveGuild, resolveUser, validString, waitForDependency } from '@utils/functions' import { Scheduler, WebSocket, Pastebin } from '@services' import { apiConfig, logsConfig } from '@config' import { resolve } from '@discordx/importer' @@ -27,10 +27,9 @@ export class Logger { @inject(delay(() => PluginsManager)) private pluginsManager: PluginsManager ) { this.defaultConsole = { ...console } - console.log = (...args) => this.log("info", args.join(", ")) - console.info = (...args) => this.log("info", args.join(", ")) - console.warn = (...args) => this.log("warn", args.join(", ")) - console.error = (...args) => this.log("error", args.join(", ")) + console.info = (...args) => this.log(args.join(", "), 'info') + console.warn = (...args) => this.log(args.join(", "), 'info') + console.error = (...args) => this.log(args.join(", "), 'info') } private readonly logPath: string = `${__dirname}/../../logs` @@ -55,9 +54,15 @@ export class Logger { // ======== Output Providers ======= // ================================= - console(level: typeof this.levels[number] = 'info', message: string = '', ignoreTemplate = false) { + /** + * Log a message in the console. + * @param message the message to log + * @param level info (default) | warn | error + * @param ignoreTemplate if it should ignore the timestamp template (default to false) + */ + console(message: string, level: typeof this.levels[number] = 'info', ignoreTemplate = false) { - this.spinner.stop() + if (this.spinner.isSpinning) this.spinner.stop() if (!validString(message)) return @@ -69,16 +74,12 @@ export class Logger { this.websocket(level, message) } - websocket(level: typeof this.levels[number] = 'info', message: string) { - - // send the log to all connected websockets clients - this.ws.broadcast('log', { - level, - message: message - }) - } - - file(level: typeof this.levels[number] = 'info', message: string = '') { + /** + * Log a message in a log file. + * @param message the message to log + * @param level info (default) | warn | error + */ + file(message: string, level: typeof this.levels[number] = 'info') { if (!validString(message)) return @@ -87,15 +88,21 @@ export class Logger { const fileName = `${this.logPath}/${level}.log` // create the folder if it doesn't exist - if (!fs.existsSync(this.logPath)) fs.mkdirSync(this.logPath) + if (!fileOrDirectoryExists(this.logPath)) fs.mkdirSync(this.logPath) // create file if it doesn't exist - if (!fs.existsSync(fileName)) fs.writeFileSync(fileName, '') + if (!fileOrDirectoryExists(fileName)) fs.writeFileSync(fileName, '') fs.appendFileSync(fileName, `${templatedMessage}\n`) } - - async discordChannel(channelId: string, message: string | MessageOptions = '', level?: typeof this.levels[number]) { + /** + * Log a message in a Discord channel using embeds. + * @param channelId the ID of the discord channel to log to + * @param message the message to log or a [MessageOptions](https://discord.js.org/#/docs/discord.js/main/typedef/BaseMessageOptions) compliant object (like embeds, components, etc) + * @param level info (default) | warn | error + * @returns + */ + async discordChannel(channelId: string, message: string | MessageOptions, level?: typeof this.levels[number]) { if (!this.client.token) return @@ -111,20 +118,29 @@ export class Logger { } } + websocket(level: typeof this.levels[number] = 'info', message: string) { + + // send the log to all connected websocket clients + this.ws.broadcast('log', { + level, + message: message + }) + } + // ================================= // =========== Shortcut ============ // ================================= /** - * Shortcut function that will log in console, and optionnaly in file or discord channel depending params. - * @param level info, warn, error + * Shortcut function that will log in the console, and optionally in a file or discord channel depending on params. * @param message message to log - * @param saveToFile if true, the message will be saved to a file + * @param level info (default) | warn | error + * @param saveToFile if true, the message will be saved to a file (default to true) * @param channelId Discord channel to log to (if `null`, nothing will be logged to Discord) */ log( - level: typeof this.levels[number] = 'info', message: string, + level: typeof this.levels[number] = 'info', saveToFile: boolean = true, channelId: string | null = null ) { @@ -132,10 +148,10 @@ export class Logger { if (message === '') return // log in the console - this.console(level, message) + this.console(message, level) // save log to file - if (saveToFile) this.file(level, message) + if (saveToFile) this.file(message, level) // send to discord channel if (channelId) this.discordChannel(channelId, message, level) @@ -184,8 +200,8 @@ export class Logger { } ` - if (logsConfig.interaction.console) this.console('info', chalkedMessage) - if (logsConfig.interaction.file) this.file('info', message) + if (logsConfig.interaction.console) this.console(chalkedMessage) + if (logsConfig.interaction.file) this.file(message) if (logsConfig.interaction.channel) this.discordChannel(logsConfig.interaction.channel, { embeds: [{ author: { @@ -231,7 +247,7 @@ export class Logger { color: 0xdb5c21, timestamp: new Date().toISOString() }] - }, 'info') + }) } /** @@ -243,8 +259,8 @@ export class Logger { const message = `(NEW_USER) ${user.tag} (${user.id}) has been added to the db` const chalkedMessage = `(${chalk.bold.white('NEW_USER')}) ${chalk.bold.green(user.tag)} (${chalk.bold.blue(user.id)}) ${chalk.dim.italic.gray('has been added to the db')}` - if (logsConfig.newUser.console) this.console('info', chalkedMessage) - if (logsConfig.newUser.file) this.file('info', message) + if (logsConfig.newUser.console) this.console(chalkedMessage) + if (logsConfig.newUser.file) this.file(message) if (logsConfig.newUser.channel) this.discordChannel(logsConfig.newUser.channel, { embeds: [{ title: 'New user', @@ -258,7 +274,7 @@ export class Logger { text: user.id } }] - }, 'info') + }) } /** @@ -287,8 +303,8 @@ export class Logger { ${chalk.dim.italic.gray(additionalMessage)} ` - if (logsConfig.guild.console) this.console('info', chalkedMessage) - if (logsConfig.guild.file) this.file('info', message) + if (logsConfig.guild.console) this.console(chalkedMessage) + if (logsConfig.guild.file) this.file(message) if (logsConfig.guild.channel) this.discordChannel(logsConfig.guild.channel, { embeds: [{ title: (type === 'NEW_GUILD' ? 'New guild' : type === 'DELETE_GUILD' ? 'Deleted guild' : 'Recovered guild'), @@ -306,7 +322,7 @@ export class Logger { color: (type === 'NEW_GUILD' ? 0x02fd77 : type === 'DELETE_GUILD' ? 0xff0000 : 0xfffb00), timestamp: new Date().toISOString(), }] - }, 'info') + }) }) } @@ -330,11 +346,11 @@ export class Logger { chalkedMessage += ` ${chalk.dim.italic.gray(type === 'Exception' ? 'Exception' : 'Unhandled rejection')} : ${error.message}\n${chalk.dim.italic(trace.map((frame: StackFrame) => `\t> ${frame.file}:${frame.lineNumber}`).join('\n'))}` } else { if (type === 'Exception') { - message += `An exception as occured in a unknow file\n\t> ${error.message}` - embedMessage += `An exception as occured in a unknow file\n${error.message}` + message += `An exception as occurred in a unknown file\n\t> ${error.message}` + embedMessage += `An exception as occurred in a unknown file\n${error.message}` } else { - message += `An unhandled rejection as occured in a unknow file\n\t> ${error}` - embedMessage += `An unhandled rejection as occured in a unknow file\n${error}` + message += `An unhandled rejection as occurred in a unknown file\n\t> ${error}` + embedMessage += `An unhandled rejection as occurred in a unknown file\n${error}` } } @@ -344,8 +360,8 @@ export class Logger { embedMessage = `[Pastebin of the error](https://rentry.co/${paste?.getLink()})` } - if (logsConfig.error.console) this.console('error', chalkedMessage) - if (logsConfig.error.file) this.file('error', message) + if (logsConfig.error.console) this.console(chalkedMessage, 'error') + if (logsConfig.error.file) this.file(message, 'error') if (logsConfig.error.channel && process.env['NODE_ENV'] === 'production') this.discordChannel(logsConfig.error.channel, { embeds: [{ title: (embedTitle.length >= 256 ? (embedTitle.substring(0, 252) + "...") : embedTitle), @@ -373,7 +389,7 @@ export class Logger { this.spinner.stop() - this.console('info', chalk.dim.gray('\n━━━━━━━━━━ Started! ━━━━━━━━━━\n'), true) + this.console(chalk.dim.gray('\n━━━━━━━━━━ Started! ━━━━━━━━━━\n'), 'info', true) // commands const slashCommands = MetadataStorage.instance.applicationCommandSlashes @@ -384,13 +400,13 @@ export class Logger { ] const commandsSum = slashCommands.length + simpleCommands.length + contextMenus.length - this.console('info', chalk.blue(`${symbol} ${numberAlign(commandsSum)} ${chalk.bold('commands')} loaded`), true) - this.console('info', chalk.dim.gray(`${tab}┝──╾ ${numberAlign(slashCommands.length)} slash commands\n${tab}┝──╾ ${numberAlign(simpleCommands.length)} simple commands\n${tab}╰──╾ ${numberAlign(contextMenus.length)} context menus`), true) + this.console(chalk.blue(`${symbol} ${numberAlign(commandsSum)} ${chalk.bold('commands')} loaded`), 'info', true) + this.console(chalk.dim.gray(`${tab}┝──╾ ${numberAlign(slashCommands.length)} slash commands\n${tab}┝──╾ ${numberAlign(simpleCommands.length)} simple commands\n${tab}╰──╾ ${numberAlign(contextMenus.length)} context menus`), 'info', true) // events const events = MetadataStorage.instance.events - this.console('info', chalk.magenta(`${symbol} ${numberAlign(events.length)} ${chalk.bold('events')} loaded`), true) + this.console(chalk.magenta(`${symbol} ${numberAlign(events.length)} ${chalk.bold('events')} loaded`), 'info', true) // entities const entities = fs.readdirSync(`${__dirname}/../entities`) @@ -401,7 +417,7 @@ export class Logger { const pluginsEntitesCount = this.pluginsManager.plugins.reduce((acc, plugin) => acc + Object.values(plugin.entities).length, 0) - this.console('info', chalk.red(`${symbol} ${numberAlign(entities.length + pluginsEntitesCount)} ${chalk.bold('entities')} loaded`), true) + this.console(chalk.red(`${symbol} ${numberAlign(entities.length + pluginsEntitesCount)} ${chalk.bold('entities')} loaded`), 'info', true) // services const services = fs.readdirSync(`${__dirname}/../services`) @@ -409,7 +425,7 @@ export class Logger { const pluginsServicesCount = this.pluginsManager.plugins.reduce((acc, plugin) => acc + Object.values(plugin.services).length, 0) - this.console('info', chalk.yellow(`${symbol} ${numberAlign(services.length + pluginsServicesCount)} ${chalk.bold('services')} loaded`), true) + this.console(chalk.yellow(`${symbol} ${numberAlign(services.length + pluginsServicesCount)} ${chalk.bold('services')} loaded`), 'info', true) // api if (apiConfig.enabled) { @@ -418,23 +434,23 @@ export class Logger { const openAPISpec = routingControllersToSpec(storage) const endpoints = Object.keys(openAPISpec.paths) - this.console('info', chalk.cyan(`${symbol} ${numberAlign(endpoints.length)} ${chalk.bold('api endpoints')} loaded`), true) + this.console(chalk.cyan(`${symbol} ${numberAlign(endpoints.length)} ${chalk.bold('api endpoints')} loaded`), 'info', true) } // scheduled jobs const scheduledJobs = this.scheduler.jobs.size - this.console('info', chalk.green(`${symbol} ${numberAlign(scheduledJobs)} ${chalk.bold('scheduled jobs')} loaded`), true) + this.console(chalk.green(`${symbol} ${numberAlign(scheduledJobs)} ${chalk.bold('scheduled jobs')} loaded`), 'info', true) // plugins const pluginsCount = this.pluginsManager.plugins.length - this.console('info', chalk.hex('#47d188')(`${symbol} ${numberAlign(pluginsCount)} ${chalk.bold('plugin' + (pluginsCount > 1 ? 's':''))} loaded`), true) + this.console(chalk.hex('#47d188')(`${symbol} ${numberAlign(pluginsCount)} ${chalk.bold('plugin' + (pluginsCount > 1 ? 's':''))} loaded`), 'info', true) // connected if (apiConfig.enabled) { - this.console('info', chalk.gray(boxen( + this.console(chalk.gray(boxen( ` API Server listening on port ${chalk.bold(apiConfig.port)} `, { padding: 0, @@ -447,10 +463,10 @@ export class Logger { borderStyle: 'round', dimBorder: true } - )), true) + )), 'info', true) } - this.console('info', chalk.hex('7289DA')(boxen( + this.console(chalk.hex('7289DA')(boxen( ` ${this.client.user ? `${chalk.bold(this.client.user.tag)}` : 'Bot'} is ${chalk.green('connected')}! `, { padding: 0, @@ -463,6 +479,6 @@ export class Logger { borderStyle: 'round', dimBorder: true } - )), true) + )), 'info', true) } } \ No newline at end of file diff --git a/src/services/Stats.ts b/src/services/Stats.ts index 24b8fd09..6e7b3d9f 100644 --- a/src/services/Stats.ts +++ b/src/services/Stats.ts @@ -3,14 +3,14 @@ import { delay, inject, singleton } from 'tsyringe' import { EntityRepository } from '@mikro-orm/core' import { constant } from 'case' import osu from 'node-os-utils' +import pidusage from 'pidusage' import { Database, WebSocket } from '@services' import { Guild, Stat, User } from '@entities' import { formatDate, getTypeOfInteraction, resolveAction, resolveChannel, resolveGuild, resolveUser, datejs, isInMaintenance } from '@utils/functions' import { Schedule, WSOn } from '@decorators' -import { statsConfig } from '@config' -import pidusage from 'pidusage' +import { statsConfig, websocketConfig } from '@config' const allInteractions = { $or: [ @@ -53,7 +53,6 @@ export class Stats { /** * Record an interaction and add it to the database. * @param interaction - * @returns */ async registerInteraction(interaction: AllInteractions) { @@ -92,7 +91,7 @@ export class Stats { } /** - * Returns an object with the total stats for each type + * Returns an object with the total stats for each type. */ async getTotalStats() { @@ -106,6 +105,9 @@ export class Stats { return totalStatsObj } + /** + * Get the last saved interaction. + */ async getLastInteraction() { const lastInteraction = await this.statsRepo.findOne(allInteractions, { @@ -115,6 +117,21 @@ export class Stats { return lastInteraction } + /** + * Get the last guild added to the database. + */ + async getLastGuildAdded() { + + const guilds = await this.db.get(Guild).find({}, { + orderBy: { createdAt: 'DESC' } + }) + + return guilds[0] + } + + /** + * Get commands sorted by total amount of uses in DESC order. + */ async getTopCommands() { if ('createQueryBuilder' in this.db.em) { @@ -159,6 +176,9 @@ export class Stats { } else return [] } + /** + * Get the users activity per slice of interactions amount in percentage. + */ async getUsersActivity() { const usersActivity = { @@ -190,6 +210,9 @@ export class Stats { return usersActivity } + /** + * Get guilds sorted by total amount of commands in DESC order. + */ async getTopGuilds() { const topGuilds: { @@ -223,8 +246,8 @@ export class Stats { /** * Returns the amount of row for a given type per day in a given interval of days from now. - * @param type - * @param days + * @param type the type of the stat to retrieve + * @param days interval of days from now */ async countStatsPerDays(type: string, days: number): Promise { @@ -242,16 +265,16 @@ export class Stats { }) } - return this.cummulateStatPerInterval(stats) + return this.cumulateStatPerInterval(stats) } /** * Transform individual day stats into cumulated stats. * @param stats */ - cummulateStatPerInterval(stats: StatPerInterval): StatPerInterval { + cumulateStatPerInterval(stats: StatPerInterval): StatPerInterval { - const cummulatedStats = + const cumulatedStats = stats .reverse() .reduce((acc, stat, i) => { @@ -266,14 +289,13 @@ export class Stats { }, [] as StatPerInterval) .reverse() - return cummulatedStats + return cumulatedStats } /** * Sum two array of stats. * @param stats1 * @param stats2 - * @returns */ sumStats(stats1: StatPerInterval, stats2: StatPerInterval): StatPerInterval { @@ -316,7 +338,7 @@ export class Stats { } /** - * Get the current process usage (CPU, RAM, etc) + * Get the current process usage (CPU, RAM, etc). */ async getPidUsage() { @@ -333,7 +355,7 @@ export class Stats { } /** - * Get the current host health (CPU, RAM, etc) + * Get the current host health (CPU, RAM, etc). */ async getHostUsage() { @@ -348,6 +370,9 @@ export class Stats { } } + /** + * Get latency from the discord websocket gate. + */ getLatency() { return { @@ -356,9 +381,9 @@ export class Stats { } /** - * Run each day at 23:59 to update daily stats + * Run each day at 23:59 to update daily stats. */ - @Schedule('59 23 * * *') + @Schedule('59 59 23 * * *') async registerDailyStats() { const totalStats = await this.getTotalStats() @@ -374,19 +399,23 @@ export class Stats { @Schedule('*/5 * * * * *') async sendWebSocketHealth(response?: WSResponseFunction) { - const data = { - botStatus: { - online: true, - uptime: this.client.uptime, - maintenance: await isInMaintenance() - }, - host: await this.getHostUsage(), - pid: await this.getPidUsage(), - latency: this.getLatency() + if (websocketConfig.enabled) { + + const data = { + botStatus: { + online: true, + uptime: this.client.uptime, + maintenance: await isInMaintenance() + }, + host: await this.getHostUsage(), + pid: await this.getPidUsage(), + latency: this.getLatency() + } + + if (response) response('monitoring', data) + else this.ws.broadcast('monitoring', data) } - if (response) response('monitoring', data) - else this.ws.broadcast('monitoring', data) } } \ No newline at end of file diff --git a/src/utils/classes/BaseError.ts b/src/utils/classes/BaseError.ts index 171074fa..af7f90b4 100644 --- a/src/utils/classes/BaseError.ts +++ b/src/utils/classes/BaseError.ts @@ -14,4 +14,8 @@ export abstract class BaseError extends Error { } handle() {} + + kill() { + process.exit(1) + } } \ No newline at end of file diff --git a/src/utils/decorators/On.ts b/src/utils/decorators/On.ts index 4624ffd4..f8f415da 100644 --- a/src/utils/decorators/On.ts +++ b/src/utils/decorators/On.ts @@ -10,7 +10,7 @@ import { EventOptions, MethodDecoratorEx, DOn, MetadataStorage } from 'discordx' * * @category Decorator */ -export const On = (event: string, options?: EventOptions): MethodDecoratorEx => { +export const On = (event: string, options?: Omit): MethodDecoratorEx => { return function ( target: Record, @@ -23,7 +23,8 @@ export const On = (event: string, options?: EventOptions): MethodDecoratorEx => botIds: options?.botIds, event: event, once: false, - rest: false + rest: false, + priority: options?.priority, }).decorate(clazz.constructor, key, descriptor?.value) MetadataStorage.instance.addOn(on) diff --git a/src/utils/decorators/Slash.ts b/src/utils/decorators/Slash.ts index 9b34ea97..d7876d6d 100644 --- a/src/utils/decorators/Slash.ts +++ b/src/utils/decorators/Slash.ts @@ -11,7 +11,10 @@ import { constantPreserveDots, sanitizeLocales, setOptionsLocalization } from '@ * * @category Decorator */ -export const Slash = (options: ApplicationCommandOptions = {}) => { +export const Slash = (options?: ApplicationCommandOptions | string) => { + + if (!options) options = {} + else if (typeof options === 'string') options = { name: options } let localizationSource: TranslationsNestedPaths | null = null diff --git a/src/utils/errors/InvalidOptionName.ts b/src/utils/errors/InvalidOptionName.ts index 142f2fd3..d71076b3 100644 --- a/src/utils/errors/InvalidOptionName.ts +++ b/src/utils/errors/InvalidOptionName.ts @@ -9,7 +9,7 @@ export class InvalidOptionName extends BaseError { handle() { - this.logger.console('error', this.message) - process.exit(1) + this.logger.console(this.message, 'error') + this.kill() } } \ No newline at end of file diff --git a/src/utils/errors/NoBotToken.ts b/src/utils/errors/NoBotToken.ts index 3fc42b0b..09f99e02 100644 --- a/src/utils/errors/NoBotToken.ts +++ b/src/utils/errors/NoBotToken.ts @@ -8,7 +8,7 @@ export class NoBotTokenError extends BaseError { handle() { - this.logger.console('error', this.message) - process.exit(1) + this.logger.console(this.message, 'error') + this.kill() } } \ No newline at end of file diff --git a/src/utils/functions/dependency.ts b/src/utils/functions/dependency.ts index bccd0470..ee2351c2 100644 --- a/src/utils/functions/dependency.ts +++ b/src/utils/functions/dependency.ts @@ -1,6 +1,6 @@ import { container, InjectionToken } from 'tsyringe' -export async function waitForDependency(token: InjectionToken, interval: number = 500): Promise { +export const waitForDependency = async (token: InjectionToken, interval: number = 500): Promise => { while(!container.isRegistered(token, true)) { await new Promise(resolve => setTimeout(resolve, interval)) @@ -9,7 +9,7 @@ export async function waitForDependency(token: InjectionToken, interval: n return container.resolve(token) } -export async function waitForDependencies(tokens: any[], interval: number = 500): Promise { +export const waitForDependencies = async (tokens: any[], interval: number = 500): Promise => { return Promise.all(tokens.map(token => waitForDependency(token, interval) diff --git a/src/utils/functions/fs.ts b/src/utils/functions/fs.ts index 0cc8d985..0d4a02ac 100644 --- a/src/utils/functions/fs.ts +++ b/src/utils/functions/fs.ts @@ -6,6 +6,8 @@ import fs from 'fs' */ export const getFiles = (path: string): string[] => { + if (!fs.existsSync(path)) return [] + const files = fs.readdirSync(path) const fileList = [] @@ -22,4 +24,8 @@ export const getFiles = (path: string): string[] => { } return fileList +} + +export const fileOrDirectoryExists = (path: string): boolean => { + return fs.existsSync(path) } \ No newline at end of file diff --git a/src/utils/functions/image.ts b/src/utils/functions/image.ts index 7504be95..596ef85a 100644 --- a/src/utils/functions/image.ts +++ b/src/utils/functions/image.ts @@ -3,7 +3,7 @@ import { Database } from "@services" import { Image } from "@entities" /** - * Abstraction level for the image repository that will find an image by its name (with or withouth extension). + * Abstraction level for the image repository that will find an image by its name (with or without extension). * @param imageName * @returns image url */ diff --git a/src/utils/types/localization.d.ts b/src/utils/types/localization.d.ts index cd0fead9..0a1217b2 100644 --- a/src/utils/types/localization.d.ts +++ b/src/utils/types/localization.d.ts @@ -1,10 +1,10 @@ -declare enum AdditionnalLocaleString { +declare enum AdditionalLocaleString { English = 'en' } type TranslationsNestedPaths = NestedPaths -type LocalizationMap = Partial> +type LocalizationMap = Partial> type SanitizedOptions = { descriptionLocalizations?: LocalizationMap From fc3d5bcf9e11a0357ef50c6ec3bcaba48e31bb60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartholom=C3=A9=20Gili?= Date: Wed, 5 Oct 2022 22:49:53 +0200 Subject: [PATCH 16/29] feat(npm): preinstall script --- package-lock.json | 1 + package.json | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index 82c4f06e..f9dfb1fe 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,6 +7,7 @@ "": { "name": "tscord-template", "version": "1.0.0", + "hasInstallScript": true, "license": "MIT", "dependencies": { "@discordx/importer": "~1.1.10", diff --git a/package.json b/package.json index f563fb6c..eabcf5ff 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,8 @@ "migration:up": "npx mikro-orm migration:up", "migration:down": "npx mikro-orm migration:down", "plugins:install": "npm-recursive-install --rootDir=src/plugins", - "plop": "plop --plopfile ./cli/plopfile.js" + "plop": "plop --plopfile ./cli/plopfile.js", + "preinstall": "npm run plugins:install" }, "dependencies": { "@discordx/importer": "~1.1.10", From 661b04971a0ca912a77576a356bc4a0b7c2ee485 Mon Sep 17 00:00:00 2001 From: Artemus <31190188+Mr-Artemus@users.noreply.github.com> Date: Wed, 5 Oct 2022 21:42:58 +0000 Subject: [PATCH 17/29] feat(#73): Custom translation for plugins --- src/utils/classes/Plugin.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/utils/classes/Plugin.ts b/src/utils/classes/Plugin.ts index 47116828..8f5a01dc 100644 --- a/src/utils/classes/Plugin.ts +++ b/src/utils/classes/Plugin.ts @@ -7,6 +7,7 @@ import fs from "fs" import { generalConfig } from "@config"; import { BaseController } from "@utils/classes"; +import { defaultTranslations } from "@i18n"; export class Plugin { // Common values @@ -79,11 +80,18 @@ export class Plugin { const translations: { [key: string]: BaseTranslation } = {}; const localesPath = resolve(this._path + "/i18n/*.{ts,js}"); - for(const localeFile of localesPath) { - const locale = localeFile.split("/").at(-1)?.split(".")[0] || "unknow"; + for (const localeFile of localesPath) { + const locale = localeFile.split("/").at(-1)?.split(".")[0] || "unknown"; + translations[locale] = (await import(localeFile)).default; } + for (const defaultLocale of Object.keys(defaultTranslations)) { + const path = `${process.env.PWD}/src/i18n/${defaultLocale}/${this._name}/_custom.` + if (fs.existsSync(path + "js")) translations[defaultLocale] = (await import(path + "js")).default; + else if (fs.existsSync(path + "ts")) translations[defaultLocale] = (await import(path + "ts")).default; + } + return translations; } From be204cbab877ce4650ce4e10f19315f9a3a78045 Mon Sep 17 00:00:00 2001 From: Artemus <31190188+Mr-Artemus@users.noreply.github.com> Date: Tue, 11 Oct 2022 20:10:38 +0000 Subject: [PATCH 18/29] feat(#73): drop support for `.env` inside plugins --- src/services/PluginsManager.ts | 5 +---- src/utils/classes/Plugin.ts | 5 ----- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/src/services/PluginsManager.ts b/src/services/PluginsManager.ts index 6f160200..79889b0f 100644 --- a/src/services/PluginsManager.ts +++ b/src/services/PluginsManager.ts @@ -20,10 +20,7 @@ export class PluginsManager { const plugin = new Plugin(path); await plugin.load(); - if(plugin.isValid()) { - plugin.loadEnv(); - this.plugins.push(plugin); - } + if(plugin.isValid()) this.plugins.push(plugin); } } diff --git a/src/utils/classes/Plugin.ts b/src/utils/classes/Plugin.ts index 8f5a01dc..6c30b12c 100644 --- a/src/utils/classes/Plugin.ts +++ b/src/utils/classes/Plugin.ts @@ -95,11 +95,6 @@ export class Plugin { return translations; } - public loadEnv(): void { - if(!fs.existsSync(this._path + "/services")) return - dotenv.config({ path: this._path + "/.env" }); - } - public execMain(): void { if(!fs.existsSync(this._path + "/main.ts")) return import(this._path + "/main.ts"); From c97837550736d3e6258b60642f3dac4ca4df9f36 Mon Sep 17 00:00:00 2001 From: Artemus <31190188+Mr-Artemus@users.noreply.github.com> Date: Tue, 11 Oct 2022 20:15:10 +0000 Subject: [PATCH 19/29] feat(#73): Add method to check if a plugin is loaded --- src/services/PluginsManager.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/services/PluginsManager.ts b/src/services/PluginsManager.ts index 79889b0f..7445e2be 100644 --- a/src/services/PluginsManager.ts +++ b/src/services/PluginsManager.ts @@ -91,5 +91,9 @@ export class PluginsManager { await storeTranslationsToDisk(localeMapping, true); } + public isPluginLoad(pluginName: string): boolean { + return this._plugins.findIndex(plugin => plugin.name === pluginName) !== -1 + } + get plugins() { return this._plugins; } } \ No newline at end of file From 0b27765e7bee16894d6d2e7e60fff9566ff218e7 Mon Sep 17 00:00:00 2001 From: Artemus <31190188+Mr-Artemus@users.noreply.github.com> Date: Tue, 11 Oct 2022 20:36:20 +0000 Subject: [PATCH 20/29] feat(#73): Auto detect locales for plugins --- src/i18n/index.ts | 13 +------------ src/services/PluginsManager.ts | 13 +++++++++---- src/utils/classes/Plugin.ts | 4 ++-- 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/src/i18n/index.ts b/src/i18n/index.ts index 71b72aa8..f7258ee1 100644 --- a/src/i18n/index.ts +++ b/src/i18n/index.ts @@ -1,15 +1,4 @@ export { L } from './i18n-node' export { getLocaleFromInteraction } from './detectors' export type { Locales, Translation } from "./i18n-types" -export { loadedLocales, locales } from "./i18n-util" - - - -import { BaseTranslation } from 'typesafe-i18n' -import { Locales } from './i18n-types' -import en from "./en" -import fr from "./fr" - -export const defaultTranslations: { [key in Locales]: BaseTranslation } = { - en, fr -} \ No newline at end of file +export { loadedLocales, locales } from "./i18n-util" \ No newline at end of file diff --git a/src/services/PluginsManager.ts b/src/services/PluginsManager.ts index 7445e2be..f2831f72 100644 --- a/src/services/PluginsManager.ts +++ b/src/services/PluginsManager.ts @@ -5,7 +5,7 @@ import fs from "fs"; import { BaseController, Plugin } from "@utils/classes"; import { BaseTranslation } from "typesafe-i18n"; -import { defaultTranslations } from "@i18n"; +import { locales } from "@i18n"; import { AnyEntity, EntityClass } from "@mikro-orm/core"; @singleton() @@ -59,7 +59,12 @@ export class PluginsManager { public async syncTranslations(): Promise { let localeMapping: ImportLocaleMapping[] = []; let namespaces: { [key: string]: string[] } = {}; - let translations: { [key: string]: BaseTranslation } = { ...defaultTranslations }; + let translations: { [key: string]: BaseTranslation } = {}; + + for (const locale of locales) { + const path = process.env.PWD + "/src/i18n/"+locale + if(fs.existsSync(path)) translations[locale] = (await import(path))?.default; + } for (const plugin of this._plugins) { for (const locale in plugin.translations) { @@ -71,8 +76,8 @@ export class PluginsManager { } } - for(let locale in translations) { - if(!Object.keys(defaultTranslations).includes(locale)) continue + for(const locale in translations) { + if(!locales.includes(locale as any)) continue localeMapping.push({ locale, translations: translations[locale], diff --git a/src/utils/classes/Plugin.ts b/src/utils/classes/Plugin.ts index 6c30b12c..a4557965 100644 --- a/src/utils/classes/Plugin.ts +++ b/src/utils/classes/Plugin.ts @@ -7,7 +7,7 @@ import fs from "fs" import { generalConfig } from "@config"; import { BaseController } from "@utils/classes"; -import { defaultTranslations } from "@i18n"; +import { locales } from "@i18n"; export class Plugin { // Common values @@ -86,7 +86,7 @@ export class Plugin { translations[locale] = (await import(localeFile)).default; } - for (const defaultLocale of Object.keys(defaultTranslations)) { + for (const defaultLocale of locales) { const path = `${process.env.PWD}/src/i18n/${defaultLocale}/${this._name}/_custom.` if (fs.existsSync(path + "js")) translations[defaultLocale] = (await import(path + "js")).default; else if (fs.existsSync(path + "ts")) translations[defaultLocale] = (await import(path + "ts")).default; From c45c942e56a4013ff35711d5b234ddb745d42654 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartholom=C3=A9=20Gili?= Date: Thu, 13 Oct 2022 23:02:09 +0200 Subject: [PATCH 21/29] fix(#73): cwd path --- src/services/PluginsManager.ts | 72 +++++++++++++------------ src/utils/classes/Plugin.ts | 97 +++++++++++++++++----------------- 2 files changed, 87 insertions(+), 82 deletions(-) diff --git a/src/services/PluginsManager.ts b/src/services/PluginsManager.ts index f2831f72..7f3187f5 100644 --- a/src/services/PluginsManager.ts +++ b/src/services/PluginsManager.ts @@ -1,26 +1,30 @@ -import { ImportLocaleMapping, storeTranslationsToDisk } from "typesafe-i18n/importer"; -import { resolve } from "@discordx/importer"; -import { singleton } from "tsyringe"; -import fs from "fs"; +import { ImportLocaleMapping, storeTranslationsToDisk } from "typesafe-i18n/importer" +import { resolve } from "@discordx/importer" +import { singleton } from "tsyringe" +import fs from "fs" -import { BaseController, Plugin } from "@utils/classes"; -import { BaseTranslation } from "typesafe-i18n"; -import { locales } from "@i18n"; -import { AnyEntity, EntityClass } from "@mikro-orm/core"; +import { BaseController, Plugin } from "@utils/classes" +import { BaseTranslation } from "typesafe-i18n" +import { locales } from "@i18n" +import { AnyEntity, EntityClass } from "@mikro-orm/core" +import { cwd } from "process" @singleton() export class PluginsManager { - private _plugins: Plugin[] = []; + + private _plugins: Plugin[] = [] constructor() {} public async loadPlugins(): Promise { - const pluginPaths = resolve(process.env.PWD + "/src/plugins/*"); + + const pluginPaths = resolve(process.cwd() + "/src/plugins/*") + for (const path of pluginPaths) { - const plugin = new Plugin(path); - await plugin.load(); + const plugin = new Plugin(path) + await plugin.load() - if(plugin.isValid()) this.plugins.push(plugin); + if(plugin.isValid()) this.plugins.push(plugin) } } @@ -33,46 +37,46 @@ export class PluginsManager { } public async importCommands(): Promise { - for (const plugin of this._plugins) await plugin.importCommands(); + for (const plugin of this._plugins) await plugin.importCommands() } public async importEvents(): Promise { - for (const plugin of this._plugins) await plugin.importEvents(); + for (const plugin of this._plugins) await plugin.importEvents() } public async initServices(): Promise<{ [key: string]: any }> { - let services: { [key: string]: any } = {}; + let services: { [key: string]: any } = {} for (const plugin of this._plugins) { for(const service in plugin.services) { - services[service] = new plugin.services[service](); + services[service] = new plugin.services[service]() } } - return services; + return services } public async execMains(): Promise { - for (const plugin of this._plugins) await plugin.execMain(); + for (const plugin of this._plugins) await plugin.execMain() } public async syncTranslations(): Promise { - let localeMapping: ImportLocaleMapping[] = []; - let namespaces: { [key: string]: string[] } = {}; - let translations: { [key: string]: BaseTranslation } = {}; + let localeMapping: ImportLocaleMapping[] = [] + let namespaces: { [key: string]: string[] } = {} + let translations: { [key: string]: BaseTranslation } = {} for (const locale of locales) { - const path = process.env.PWD + "/src/i18n/"+locale - if(fs.existsSync(path)) translations[locale] = (await import(path))?.default; + const path = process.cwd() + "/src/i18n/"+locale + if(fs.existsSync(path)) translations[locale] = (await import(path))?.default } for (const plugin of this._plugins) { for (const locale in plugin.translations) { - if(!translations[locale]) translations[locale] = {}; - if(!namespaces[locale]) namespaces[locale] = []; + if(!translations[locale]) translations[locale] = {} + if(!namespaces[locale]) namespaces[locale] = [] translations[locale] = { ...translations[locale], [plugin.name]: plugin.translations[locale] } - namespaces[locale].push(plugin.name); + namespaces[locale].push(plugin.name) } } @@ -82,23 +86,23 @@ export class PluginsManager { locale, translations: translations[locale], namespaces: namespaces[locale] - }); + }) } - const pluginsName = this._plugins.map(plugin => plugin.name); - for(const path of await resolve(process.env.PWD + "/src/i18n/*/*/index.ts")) { - const name = path.split("/").at(-2) || ""; + const pluginsName = this._plugins.map(plugin => plugin.name) + for(const path of await resolve(process.cwd() + "/src/i18n/*/*/index.ts")) { + const name = path.split("/").at(-2) || "" if(!pluginsName.includes(name)) { - await fs.rmSync(path.slice(0, -8), { recursive: true, force: true }); + await fs.rmSync(path.slice(0, -8), { recursive: true, force: true }) } } - await storeTranslationsToDisk(localeMapping, true); + await storeTranslationsToDisk(localeMapping, true) } public isPluginLoad(pluginName: string): boolean { return this._plugins.findIndex(plugin => plugin.name === pluginName) !== -1 } - get plugins() { return this._plugins; } + get plugins() { return this._plugins } } \ No newline at end of file diff --git a/src/utils/classes/Plugin.ts b/src/utils/classes/Plugin.ts index a4557965..8b5e3200 100644 --- a/src/utils/classes/Plugin.ts +++ b/src/utils/classes/Plugin.ts @@ -1,114 +1,115 @@ -import { AnyEntity, EntityClass } from "@mikro-orm/core"; -import { importx, resolve } from "@discordx/importer"; -import { BaseTranslation } from "typesafe-i18n"; -import dotenv from "dotenv"; -import semver from "semver"; +import { AnyEntity, EntityClass } from "@mikro-orm/core" +import { importx, resolve } from "@discordx/importer" +import { BaseTranslation } from "typesafe-i18n" +import dotenv from "dotenv" +import semver from "semver" import fs from "fs" -import { generalConfig } from "@config"; -import { BaseController } from "@utils/classes"; -import { locales } from "@i18n"; +import { generalConfig } from "@config" +import { BaseController } from "@utils/classes" +import { locales } from "@i18n" export class Plugin { + // Common values - private _path: string; - private _name: string; - private _version: string; - private _valid: boolean = true; + private _path: string + private _name: string + private _version: string + private _valid: boolean = true // Specific values - private _entities: { [key: string]: EntityClass }; - private _controllers: { [key: string]: typeof BaseController }; - private _services: { [key: string]: any }; - private _translations: { [key: string]: BaseTranslation }; + private _entities: { [key: string]: EntityClass } + private _controllers: { [key: string]: typeof BaseController } + private _services: { [key: string]: any } + private _translations: { [key: string]: BaseTranslation } constructor(path: string) { - this._path = path; + this._path = path } public async load(): Promise { // Check if the plugin.json is present - if(!await fs.existsSync(this._path + "/plugin.json")) return this.stopLoad("plugin.json not found"); + if(!await fs.existsSync(this._path + "/plugin.json")) return this.stopLoad("plugin.json not found") // Read plugin.json - const pluginConfig = await import(this._path + "/plugin.json"); + const pluginConfig = await import(this._path + "/plugin.json") // Check if the plugin.json is valid - if(!pluginConfig.name) return this.stopLoad("Missing name in plugin.json"); - if(!pluginConfig.version) return this.stopLoad("Missing version in plugin.json"); - if(!pluginConfig.tscordRequiredVersion) return this.stopLoad("Missing tscordRequiredVersion in plugin.json"); + if(!pluginConfig.name) return this.stopLoad("Missing name in plugin.json") + if(!pluginConfig.version) return this.stopLoad("Missing version in plugin.json") + if(!pluginConfig.tscordRequiredVersion) return this.stopLoad("Missing tscordRequiredVersion in plugin.json") // Check plugin.json values - if(!pluginConfig.name.match(/^[a-zA-Z0-9-_]+$/)) return this.stopLoad("Invalid name in plugin.json"); - if(!semver.valid(pluginConfig.version)) return this.stopLoad("Invalid version in plugin.json"); + if(!pluginConfig.name.match(/^[a-zA-Z0-9-_]+$/)) return this.stopLoad("Invalid name in plugin.json") + if(!semver.valid(pluginConfig.version)) return this.stopLoad("Invalid version in plugin.json") // Check if the plugin is compatible with the current version of Tscord - if(!semver.satisfies(generalConfig.__templateVersion, pluginConfig.tscordRequiredVersion)) return this.stopLoad(`Incompatible with the current version of Tscord (v${generalConfig.__templateVersion})`); + if(!semver.satisfies(generalConfig.__templateVersion, pluginConfig.tscordRequiredVersion)) return this.stopLoad(`Incompatible with the current version of Tscord (v${generalConfig.__templateVersion})`) // Assign common values - this._name = pluginConfig.name; - this._version = pluginConfig.version; + this._name = pluginConfig.name + this._version = pluginConfig.version // Load specific values - this._entities = await this.getEntities(); - this._controllers = await this.getControllers(); - this._services = await this.getServices(); - this._translations = await this.getTranslations(); + this._entities = await this.getEntities() + this._controllers = await this.getControllers() + this._services = await this.getServices() + this._translations = await this.getTranslations() } private stopLoad(error: string): void { - this._valid = false; - console.error(`Plugin ${this._name ? this._name : this._path } ${this._version ? "v" + this._version : ""} is not valid: ${error}`); + this._valid = false + console.error(`Plugin ${this._name ? this._name : this._path } ${this._version ? "v" + this._version : ""} is not valid: ${error}`) } private async getControllers(): Promise<{ [key: string]: typeof BaseController }> { if(!fs.existsSync(this._path + "/api/controllers")) return {} - return import(this._path + "/api/controllers"); + return import(this._path + "/api/controllers") } private async getEntities(): Promise<{ [key: string]: EntityClass }> { if(!fs.existsSync(this._path + "/entities")) return {} - return import(this._path + "/entities"); + return import(this._path + "/entities") } private async getServices(): Promise<{ [key: string]: any }> { if(!fs.existsSync(this._path + "/services")) return {} - return import(this._path + "/services"); + return import(this._path + "/services") } private async getTranslations(): Promise<{ [key: string]: BaseTranslation }> { - const translations: { [key: string]: BaseTranslation } = {}; + const translations: { [key: string]: BaseTranslation } = {} - const localesPath = resolve(this._path + "/i18n/*.{ts,js}"); + const localesPath = resolve(this._path + "/i18n/*.{ts,js}") for (const localeFile of localesPath) { - const locale = localeFile.split("/").at(-1)?.split(".")[0] || "unknown"; + const locale = localeFile.split("/").at(-1)?.split(".")[0] || "unknown" - translations[locale] = (await import(localeFile)).default; + translations[locale] = (await import(localeFile)).default } for (const defaultLocale of locales) { - const path = `${process.env.PWD}/src/i18n/${defaultLocale}/${this._name}/_custom.` - if (fs.existsSync(path + "js")) translations[defaultLocale] = (await import(path + "js")).default; - else if (fs.existsSync(path + "ts")) translations[defaultLocale] = (await import(path + "ts")).default; + const path = `${process.cwd()}/src/i18n/${defaultLocale}/${this._name}/_custom.` + if (fs.existsSync(path + "js")) translations[defaultLocale] = (await import(path + "js")).default + else if (fs.existsSync(path + "ts")) translations[defaultLocale] = (await import(path + "ts")).default } - return translations; + return translations } public execMain(): void { if(!fs.existsSync(this._path + "/main.ts")) return - import(this._path + "/main.ts"); + import(this._path + "/main.ts") } public async importCommands(): Promise { - await importx(this._path + "/commands/**/*.{ts,js}"); + await importx(this._path + "/commands/**/*.{ts,js}") } public async importEvents(): Promise { - await importx(this._path + "/events/**/*.{ts,js}"); + await importx(this._path + "/events/**/*.{ts,js}") } - public isValid(): boolean { return this._valid; } + public isValid(): boolean { return this._valid } get path() { return this._path } get name() { return this._name } From 32b5f1e036e65d920839e6384fc529821b824577 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartholom=C3=A9=20Gili?= Date: Thu, 13 Oct 2022 23:02:31 +0200 Subject: [PATCH 22/29] chore(deps): use `installoop` instead of `recursive-install` --- package-lock.json | 850 +++++++--------------------------------------- package.json | 4 +- 2 files changed, 133 insertions(+), 721 deletions(-) diff --git a/package-lock.json b/package-lock.json index f22128f3..916aa597 100644 --- a/package-lock.json +++ b/package-lock.json @@ -51,11 +51,11 @@ "http-status-codes": "~2.2.0", "image-hash": "~5.3.1", "imgur": "~2.2.0", + "installoop": "^1.0.2", "joi": "~17.6.2", "node-os-utils": "~1.3.7", "ora": "~5.4.1", "pidusage": "~3.0.0", - "recursive-install": "^1.4.0", "reflect-metadata": "~0.1.13", "rentry-pastebin": "~1.2.3", "rxeta": "~1.1.2", @@ -3281,14 +3281,6 @@ "node": ">=0.8" } }, - "node_modules/code-point-at": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", - "integrity": "sha512-RpAVKQA5T63xEj6/giIbUEtZwJ4UFIc3ZtvEkiaUERylqe8xb5IvqcgOurZLahv93CLKfxcw5YI+DZcUBRyLXA==", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/collection-visit": { "version": "1.0.0", "dev": true, @@ -4000,6 +3992,7 @@ }, "node_modules/error-ex": { "version": "1.3.2", + "dev": true, "license": "MIT", "dependencies": { "is-arrayish": "^0.2.1" @@ -5393,6 +5386,7 @@ }, "node_modules/hosted-git-info": { "version": "2.8.9", + "dev": true, "license": "ISC" }, "node_modules/http-cache-semantics": { @@ -5584,6 +5578,23 @@ "node": ">=8.0.0" } }, + "node_modules/installoop": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/installoop/-/installoop-1.0.2.tgz", + "integrity": "sha512-ERBqyZg+eiSqZh7K6hTv7TD5KmiSWm3B9Bshu0PhXqQWJbRYM2b8Q2h71j0VEXX3oDUWv7dtUmTBieW1kPssCg==", + "dependencies": { + "arg": "^5.0.2", + "spawnise": "^1.0.0" + }, + "bin": { + "installoop": "build/index.js" + } + }, + "node_modules/installoop/node_modules/arg": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/arg/-/arg-5.0.2.tgz", + "integrity": "sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==" + }, "node_modules/internal-slot": { "version": "1.0.3", "dev": true, @@ -5605,14 +5616,6 @@ "node": ">= 0.10" } }, - "node_modules/invert-kv": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", - "integrity": "sha512-xgs2NH9AE66ucSq4cNG1nhSFghr5l6tdL15Pk+jl46bmmBapgoaY/AacXyaDznAqmGL99TiLSQgO/XazFSKYeQ==", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/ip": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.0.tgz", @@ -5651,6 +5654,7 @@ }, "node_modules/is-arrayish": { "version": "0.2.1", + "dev": true, "license": "MIT" }, "node_modules/is-bigint": { @@ -5975,11 +5979,6 @@ "upper-case": "^1.1.0" } }, - "node_modules/is-utf8": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", - "integrity": "sha512-rMYPYvCzsXywIsldgLaSoPlw5PfoB/ssr7hY4pLfcodrA5M/eArza1a9VmTiNIBNMjOGr1Ow9mTyU2o69U6U9Q==" - }, "node_modules/is-weakref": { "version": "1.0.2", "dev": true, @@ -6196,17 +6195,6 @@ } } }, - "node_modules/lcid": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", - "integrity": "sha512-YiGkH6EnGrDGqLMITnGjXtGmNtjoXw9SVUzcaos8RBi7Ps0VBylkq+vOcY9QE5poLasPCR849ucFUkl0UzUyOw==", - "dependencies": { - "invert-kv": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/liftoff": { "version": "2.5.0", "dev": true, @@ -6267,11 +6255,6 @@ "version": "4.17.21", "license": "MIT" }, - "node_modules/lodash.assign": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/lodash.assign/-/lodash.assign-4.2.0.tgz", - "integrity": "sha512-hFuH8TY+Yji7Eja3mGiuAxBqLagejScbG8GbG0j6o9vzn0YL14My+ktnqtZgFTosKymC9/44wP6s7xyuLfnClw==" - }, "node_modules/lodash.get": { "version": "4.4.2", "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", @@ -7194,6 +7177,7 @@ }, "node_modules/normalize-package-data": { "version": "2.5.0", + "dev": true, "license": "BSD-2-Clause", "dependencies": { "hosted-git-info": "^2.1.4", @@ -7206,6 +7190,7 @@ "version": "5.7.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true, "bin": { "semver": "bin/semver" } @@ -7346,14 +7331,6 @@ "set-blocking": "^2.0.0" } }, - "node_modules/number-is-nan": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", - "integrity": "sha512-4jbtZXNAsfZbAHiiqjLPBiCl16dES1zI4Hpzzxw61Tk+loF+sBDBKx1ICKKKwIqQ7M0mFn1TmkN7euSncWgHiQ==", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/oauth-sign": { "version": "0.9.0", "license": "Apache-2.0", @@ -7577,17 +7554,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/os-locale": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", - "integrity": "sha512-PRT7ZORmwu2MEFt4/fv3Q+mEfN4zetKxufQrkShY2oGvUms9r8otu5HfdyIFHkYXjO7laNsoVGmM2MANfuTA8g==", - "dependencies": { - "lcid": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/os-tmpdir": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", @@ -7905,25 +7871,6 @@ "node": ">=4" } }, - "node_modules/pinkie": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", - "integrity": "sha512-MnUuEycAemtSaeFSjXKW/aroV7akBbY+Sv+RkyqFjgAe73F+MR0TBWKBRDkmfWq/HiFmdavfZ1G7h4SPZXaCSg==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/pinkie-promise": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", - "integrity": "sha512-0Gni6D4UcLTbv9c57DfxDGdr41XfgUjqWZu492f0cIGr16zDU06BWP/RAEvOuo7CQ0CNjHaLlM59YJJFm3NWlw==", - "dependencies": { - "pinkie": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/pirates": { "version": "4.0.5", "dev": true, @@ -8440,112 +8387,6 @@ "node": ">=4" } }, - "node_modules/read-pkg-up": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz", - "integrity": "sha512-WD9MTlNtI55IwYUS27iHh9tK3YoIVhxis8yKhLpTqWtml739uXc9NWTpxoHkfZf3+DkCCsXox94/VWZniuZm6A==", - "dependencies": { - "find-up": "^1.0.0", - "read-pkg": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/read-pkg-up/node_modules/find-up": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", - "integrity": "sha512-jvElSjyuo4EMQGoTwo1uJU5pQMwTW5lS1x05zzfJuTIyLR3zwO27LYrxNg+dlvKpGOuGy/MzBdXh80g0ve5+HA==", - "dependencies": { - "path-exists": "^2.0.0", - "pinkie-promise": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/read-pkg-up/node_modules/load-json-file": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", - "integrity": "sha512-cy7ZdNRXdablkXYNI049pthVeXFurRyb9+hA/dZzerZ0pGTx42z+y+ssxBaVV2l70t1muq5IdKhn4UtcoGUY9A==", - "dependencies": { - "graceful-fs": "^4.1.2", - "parse-json": "^2.2.0", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0", - "strip-bom": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/read-pkg-up/node_modules/parse-json": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", - "integrity": "sha512-QR/GGaKCkhwk1ePQNYDRKYZ3mwU9ypsKhB0XyFnLQdomyEqk3e8wpW3V5Jp88zbxK4n5ST1nqo+g9juTpownhQ==", - "dependencies": { - "error-ex": "^1.2.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/read-pkg-up/node_modules/path-exists": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", - "integrity": "sha512-yTltuKuhtNeFJKa1PiRzfLAU5182q1y4Eb4XCJ3PBqyzEDkAZRzBrKKBct682ls9reBVHf9udYLN5Nd+K1B9BQ==", - "dependencies": { - "pinkie-promise": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/read-pkg-up/node_modules/path-type": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", - "integrity": "sha512-S4eENJz1pkiQn9Znv33Q+deTOKmbl+jj1Fl+qiP/vYezj+S8x+J3Uo0ISrx/QoEvIlOaDWJhPaRd1flJ9HXZqg==", - "dependencies": { - "graceful-fs": "^4.1.2", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/read-pkg-up/node_modules/pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/read-pkg-up/node_modules/read-pkg": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", - "integrity": "sha512-7BGwRHqt4s/uVbuyoeejRn4YmFnYZiFl4AuaeXHlgZf3sONF0SOGlxs2Pw8g6hCKupo08RafIO5YXFNOKTfwsQ==", - "dependencies": { - "load-json-file": "^1.0.0", - "normalize-package-data": "^2.3.2", - "path-type": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/read-pkg-up/node_modules/strip-bom": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", - "integrity": "sha512-kwrX1y7czp1E69n2ajbG65mIo9dqvJ+8aBQXOGVxqwvNbsXdFM6Lq37dLAY3mknUwru8CfcCbfOLL/gMo+fi3g==", - "dependencies": { - "is-utf8": "^0.2.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/read-pkg/node_modules/path-type": { "version": "3.0.0", "dev": true, @@ -8605,141 +8446,6 @@ "node": ">= 10.13.0" } }, - "node_modules/recursive-install": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/recursive-install/-/recursive-install-1.4.0.tgz", - "integrity": "sha512-pK7bU5PUe5UVHxHJseTQaAmSD7qTtIyhNVhM4u6yru9rkicbxLYhPwXsHhPSxwWLyxmEHx8Fba59BhlHWSGwDA==", - "dependencies": { - "shelljs": "^0.7.0", - "yargs": "^5.0.0" - }, - "bin": { - "npm-recursive-install": "recursive-install.js" - } - }, - "node_modules/recursive-install/node_modules/ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/recursive-install/node_modules/camelcase": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz", - "integrity": "sha512-4nhGqUkc4BqbBBB4Q6zLuD7lzzrHYrjKGeYaEji/3tFR5VdJu9v+LilhGIVe8wxEJPPOeWo7eg8dwY13TZ1BNg==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/recursive-install/node_modules/cliui": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", - "integrity": "sha512-0yayqDxWQbqk3ojkYqUKqaAQ6AfNKeKWRNA8kR0WXzAsdHpP4BIaOmMAG87JGuO6qcobyW4GjxHd9PmhEd+T9w==", - "dependencies": { - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1", - "wrap-ansi": "^2.0.0" - } - }, - "node_modules/recursive-install/node_modules/get-caller-file": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz", - "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==" - }, - "node_modules/recursive-install/node_modules/is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha512-1pqUqRjkhPJ9miNq9SwMfdvi6lBJcd6eFxvfaivQhaH3SgisfiuudvFntdKOmxuee/77l+FPjKrQjWvmPjWrRw==", - "dependencies": { - "number-is-nan": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/recursive-install/node_modules/require-main-filename": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", - "integrity": "sha512-IqSUtOVP4ksd1C/ej5zeEh/BIP2ajqpn8c5x+q99gvcIG/Qf0cud5raVnE/Dwd0ua9TXYDoDc0RE5hBSdz22Ug==" - }, - "node_modules/recursive-install/node_modules/string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha512-0XsVpQLnVCXHJfyEs8tC0zpTVIr5PKKsQtkT29IwupnPTjtPmQ3xT/4yCREF9hYkV/3M3kzcUTSAZT6a6h81tw==", - "dependencies": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/recursive-install/node_modules/strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg==", - "dependencies": { - "ansi-regex": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/recursive-install/node_modules/which-module": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-1.0.0.tgz", - "integrity": "sha512-F6+WgncZi/mJDrammbTuHe1q0R5hOXv/mBaiNA2TCNT/LTHusX0V+CJnj9XT8ki5ln2UZyyddDgHfCzyrOH7MQ==" - }, - "node_modules/recursive-install/node_modules/wrap-ansi": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", - "integrity": "sha512-vAaEaDM946gbNpH5pLVNR+vX2ht6n0Bt3GXwVB1AuAqZosOvHNF3P7wDnh8KLkSqgUh0uh77le7Owgoz+Z9XBw==", - "dependencies": { - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/recursive-install/node_modules/y18n": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.2.tgz", - "integrity": "sha512-uGZHXkHnhF0XeeAPgnKfPv1bgKAYyVvmNL1xlKsPYZPaIHxGti2hHqvOCQv71XMsLxu1QjergkqogUnms5D3YQ==" - }, - "node_modules/recursive-install/node_modules/yargs": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-5.0.0.tgz", - "integrity": "sha512-krgVLGNhMWUVY1EJkM/bgbvn3yCIRrsZp6KaeX8hx8ztT+jBtX7/flTQcSHe5089xIDQRUsEr2mzlZVNe/7P5w==", - "dependencies": { - "cliui": "^3.2.0", - "decamelize": "^1.1.1", - "get-caller-file": "^1.0.1", - "lodash.assign": "^4.2.0", - "os-locale": "^1.4.0", - "read-pkg-up": "^1.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^1.0.1", - "set-blocking": "^2.0.0", - "string-width": "^1.0.2", - "which-module": "^1.0.0", - "window-size": "^0.2.0", - "y18n": "^3.2.1", - "yargs-parser": "^3.2.0" - } - }, - "node_modules/recursive-install/node_modules/yargs-parser": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-3.2.0.tgz", - "integrity": "sha512-eANlJIqYwhwS/asi4ybKxkeJYUIjNMZXL36C/KICV5jyudUZWp+/lEfBHM0PuJcQjBfs00HwqePEQjtLJd+Kyw==", - "dependencies": { - "camelcase": "^3.0.0", - "lodash.assign": "^4.1.0" - } - }, "node_modules/reflect-metadata": { "version": "0.1.13", "license": "Apache-2.0" @@ -9283,81 +8989,6 @@ "dev": true, "license": "MIT" }, - "node_modules/shelljs": { - "version": "0.7.8", - "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.7.8.tgz", - "integrity": "sha512-/YF5Uk8hcwi7ima04ppkbA4RaRMdPMBfwAvAf8sufYOxsJRtbdoBsT8vGvlb+799BrlGdYrd+oczIA2eN2JdWA==", - "dependencies": { - "glob": "^7.0.0", - "interpret": "^1.0.0", - "rechoir": "^0.6.2" - }, - "bin": { - "shjs": "bin/shjs" - }, - "engines": { - "iojs": "*", - "node": ">=0.11.0" - } - }, - "node_modules/shelljs/node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/shelljs/node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/shelljs/node_modules/interpret": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz", - "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==", - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/shelljs/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/shelljs/node_modules/rechoir": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", - "integrity": "sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw==", - "dependencies": { - "resolve": "^1.1.6" - }, - "engines": { - "node": ">= 0.10" - } - }, "node_modules/side-channel": { "version": "1.0.4", "license": "MIT", @@ -9735,8 +9366,51 @@ "memory-pager": "^1.0.2" } }, + "node_modules/spawnise": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/spawnise/-/spawnise-1.0.0.tgz", + "integrity": "sha512-HRmGun1rESPpAeq4oU0Nzpg360ffqxjYvS3w17ZR4hp82MX2jHkvljtT0Z304alO3dNHHpfzeaENdUXdjvFJbw==", + "dependencies": { + "bl": "^5.0.0", + "cross-spawn": "^7.0.3" + } + }, + "node_modules/spawnise/node_modules/bl": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-5.0.0.tgz", + "integrity": "sha512-8vxFNZ0pflFfi0WXA3WQXlj6CaMEwsmh63I1CNp0q+wWv8sD0ARx1KovSQd0l2GkwrMIOyedq0EF1FxI+RCZLQ==", + "dependencies": { + "buffer": "^6.0.3", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, + "node_modules/spawnise/node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, "node_modules/spdx-correct": { "version": "3.1.1", + "dev": true, "license": "Apache-2.0", "dependencies": { "spdx-expression-parse": "^3.0.0", @@ -9745,10 +9419,12 @@ }, "node_modules/spdx-exceptions": { "version": "2.3.0", + "dev": true, "license": "CC-BY-3.0" }, "node_modules/spdx-expression-parse": { "version": "3.0.1", + "dev": true, "license": "MIT", "dependencies": { "spdx-exceptions": "^2.1.0", @@ -9757,6 +9433,7 @@ }, "node_modules/spdx-license-ids": { "version": "3.0.11", + "dev": true, "license": "CC0-1.0" }, "node_modules/split-string": { @@ -10830,6 +10507,7 @@ }, "node_modules/validate-npm-package-license": { "version": "3.0.4", + "dev": true, "license": "Apache-2.0", "dependencies": { "spdx-correct": "^3.0.0", @@ -10924,17 +10602,6 @@ "node": ">=8" } }, - "node_modules/window-size": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.2.0.tgz", - "integrity": "sha512-UD7d8HFA2+PZsbKyaOCEy8gMh1oDtHgJh1LfgjQ4zVXmYjAT/kvz3PueITKuqDiIXQe7yzpPnxX3lNc+AhQMyw==", - "bin": { - "window-size": "cli.js" - }, - "engines": { - "node": ">= 0.10.0" - } - }, "node_modules/wordwrap": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", @@ -13203,11 +12870,6 @@ "clone": { "version": "1.0.4" }, - "code-point-at": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", - "integrity": "sha512-RpAVKQA5T63xEj6/giIbUEtZwJ4UFIc3ZtvEkiaUERylqe8xb5IvqcgOurZLahv93CLKfxcw5YI+DZcUBRyLXA==" - }, "collection-visit": { "version": "1.0.0", "dev": true, @@ -13705,6 +13367,7 @@ }, "error-ex": { "version": "1.3.2", + "dev": true, "requires": { "is-arrayish": "^0.2.1" } @@ -14669,7 +14332,8 @@ } }, "hosted-git-info": { - "version": "2.8.9" + "version": "2.8.9", + "dev": true }, "http-cache-semantics": { "version": "4.1.0", @@ -14806,6 +14470,22 @@ "through": "^2.3.6" } }, + "installoop": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/installoop/-/installoop-1.0.2.tgz", + "integrity": "sha512-ERBqyZg+eiSqZh7K6hTv7TD5KmiSWm3B9Bshu0PhXqQWJbRYM2b8Q2h71j0VEXX3oDUWv7dtUmTBieW1kPssCg==", + "requires": { + "arg": "^5.0.2", + "spawnise": "^1.0.0" + }, + "dependencies": { + "arg": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/arg/-/arg-5.0.2.tgz", + "integrity": "sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==" + } + } + }, "internal-slot": { "version": "1.0.3", "dev": true, @@ -14820,11 +14500,6 @@ "resolved": "https://registry.npmjs.org/interpret/-/interpret-2.2.0.tgz", "integrity": "sha512-Ju0Bz/cEia55xDwUWEa8+olFpCiQoypjnQySseKtmjNrnps3P+xfpUmGr90T7yjlVJmOtybRvPXhKMbHr+fWnw==" }, - "invert-kv": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", - "integrity": "sha512-xgs2NH9AE66ucSq4cNG1nhSFghr5l6tdL15Pk+jl46bmmBapgoaY/AacXyaDznAqmGL99TiLSQgO/XazFSKYeQ==" - }, "ip": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.0.tgz", @@ -14851,7 +14526,8 @@ } }, "is-arrayish": { - "version": "0.2.1" + "version": "0.2.1", + "dev": true }, "is-bigint": { "version": "1.0.4", @@ -15043,11 +14719,6 @@ "upper-case": "^1.1.0" } }, - "is-utf8": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", - "integrity": "sha512-rMYPYvCzsXywIsldgLaSoPlw5PfoB/ssr7hY4pLfcodrA5M/eArza1a9VmTiNIBNMjOGr1Ow9mTyU2o69U6U9Q==" - }, "is-weakref": { "version": "1.0.2", "dev": true, @@ -15183,14 +14854,6 @@ "tildify": "2.0.0" } }, - "lcid": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", - "integrity": "sha512-YiGkH6EnGrDGqLMITnGjXtGmNtjoXw9SVUzcaos8RBi7Ps0VBylkq+vOcY9QE5poLasPCR849ucFUkl0UzUyOw==", - "requires": { - "invert-kv": "^1.0.0" - } - }, "liftoff": { "version": "2.5.0", "dev": true, @@ -15236,11 +14899,6 @@ "lodash": { "version": "4.17.21" }, - "lodash.assign": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/lodash.assign/-/lodash.assign-4.2.0.tgz", - "integrity": "sha512-hFuH8TY+Yji7Eja3mGiuAxBqLagejScbG8GbG0j6o9vzn0YL14My+ktnqtZgFTosKymC9/44wP6s7xyuLfnClw==" - }, "lodash.get": { "version": "4.4.2", "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", @@ -15903,6 +15561,7 @@ }, "normalize-package-data": { "version": "2.5.0", + "dev": true, "requires": { "hosted-git-info": "^2.1.4", "resolve": "^1.10.0", @@ -15913,7 +15572,8 @@ "semver": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true } } }, @@ -16009,11 +15669,6 @@ "set-blocking": "^2.0.0" } }, - "number-is-nan": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", - "integrity": "sha512-4jbtZXNAsfZbAHiiqjLPBiCl16dES1zI4Hpzzxw61Tk+loF+sBDBKx1ICKKKwIqQ7M0mFn1TmkN7euSncWgHiQ==" - }, "oauth-sign": { "version": "0.9.0" }, @@ -16155,14 +15810,6 @@ "wcwidth": "^1.0.1" } }, - "os-locale": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", - "integrity": "sha512-PRT7ZORmwu2MEFt4/fv3Q+mEfN4zetKxufQrkShY2oGvUms9r8otu5HfdyIFHkYXjO7laNsoVGmM2MANfuTA8g==", - "requires": { - "lcid": "^1.0.0" - } - }, "os-tmpdir": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", @@ -16361,19 +16008,6 @@ "version": "3.0.0", "dev": true }, - "pinkie": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", - "integrity": "sha512-MnUuEycAemtSaeFSjXKW/aroV7akBbY+Sv+RkyqFjgAe73F+MR0TBWKBRDkmfWq/HiFmdavfZ1G7h4SPZXaCSg==" - }, - "pinkie-promise": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", - "integrity": "sha512-0Gni6D4UcLTbv9c57DfxDGdr41XfgUjqWZu492f0cIGr16zDU06BWP/RAEvOuo7CQ0CNjHaLlM59YJJFm3NWlw==", - "requires": { - "pinkie": "^2.0.0" - } - }, "pirates": { "version": "4.0.5", "dev": true @@ -16723,87 +16357,6 @@ } } }, - "read-pkg-up": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz", - "integrity": "sha512-WD9MTlNtI55IwYUS27iHh9tK3YoIVhxis8yKhLpTqWtml739uXc9NWTpxoHkfZf3+DkCCsXox94/VWZniuZm6A==", - "requires": { - "find-up": "^1.0.0", - "read-pkg": "^1.0.0" - }, - "dependencies": { - "find-up": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", - "integrity": "sha512-jvElSjyuo4EMQGoTwo1uJU5pQMwTW5lS1x05zzfJuTIyLR3zwO27LYrxNg+dlvKpGOuGy/MzBdXh80g0ve5+HA==", - "requires": { - "path-exists": "^2.0.0", - "pinkie-promise": "^2.0.0" - } - }, - "load-json-file": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", - "integrity": "sha512-cy7ZdNRXdablkXYNI049pthVeXFurRyb9+hA/dZzerZ0pGTx42z+y+ssxBaVV2l70t1muq5IdKhn4UtcoGUY9A==", - "requires": { - "graceful-fs": "^4.1.2", - "parse-json": "^2.2.0", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0", - "strip-bom": "^2.0.0" - } - }, - "parse-json": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", - "integrity": "sha512-QR/GGaKCkhwk1ePQNYDRKYZ3mwU9ypsKhB0XyFnLQdomyEqk3e8wpW3V5Jp88zbxK4n5ST1nqo+g9juTpownhQ==", - "requires": { - "error-ex": "^1.2.0" - } - }, - "path-exists": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", - "integrity": "sha512-yTltuKuhtNeFJKa1PiRzfLAU5182q1y4Eb4XCJ3PBqyzEDkAZRzBrKKBct682ls9reBVHf9udYLN5Nd+K1B9BQ==", - "requires": { - "pinkie-promise": "^2.0.0" - } - }, - "path-type": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", - "integrity": "sha512-S4eENJz1pkiQn9Znv33Q+deTOKmbl+jj1Fl+qiP/vYezj+S8x+J3Uo0ISrx/QoEvIlOaDWJhPaRd1flJ9HXZqg==", - "requires": { - "graceful-fs": "^4.1.2", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0" - } - }, - "pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==" - }, - "read-pkg": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", - "integrity": "sha512-7BGwRHqt4s/uVbuyoeejRn4YmFnYZiFl4AuaeXHlgZf3sONF0SOGlxs2Pw8g6hCKupo08RafIO5YXFNOKTfwsQ==", - "requires": { - "load-json-file": "^1.0.0", - "normalize-package-data": "^2.3.2", - "path-type": "^1.0.0" - } - }, - "strip-bom": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", - "integrity": "sha512-kwrX1y7czp1E69n2ajbG65mIo9dqvJ+8aBQXOGVxqwvNbsXdFM6Lq37dLAY3mknUwru8CfcCbfOLL/gMo+fi3g==", - "requires": { - "is-utf8": "^0.2.0" - } - } - } - }, "readable-stream": { "version": "3.6.0", "requires": { @@ -16833,122 +16386,6 @@ "resolve": "^1.20.0" } }, - "recursive-install": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/recursive-install/-/recursive-install-1.4.0.tgz", - "integrity": "sha512-pK7bU5PUe5UVHxHJseTQaAmSD7qTtIyhNVhM4u6yru9rkicbxLYhPwXsHhPSxwWLyxmEHx8Fba59BhlHWSGwDA==", - "requires": { - "shelljs": "^0.7.0", - "yargs": "^5.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==" - }, - "camelcase": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz", - "integrity": "sha512-4nhGqUkc4BqbBBB4Q6zLuD7lzzrHYrjKGeYaEji/3tFR5VdJu9v+LilhGIVe8wxEJPPOeWo7eg8dwY13TZ1BNg==" - }, - "cliui": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", - "integrity": "sha512-0yayqDxWQbqk3ojkYqUKqaAQ6AfNKeKWRNA8kR0WXzAsdHpP4BIaOmMAG87JGuO6qcobyW4GjxHd9PmhEd+T9w==", - "requires": { - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1", - "wrap-ansi": "^2.0.0" - } - }, - "get-caller-file": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz", - "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==" - }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha512-1pqUqRjkhPJ9miNq9SwMfdvi6lBJcd6eFxvfaivQhaH3SgisfiuudvFntdKOmxuee/77l+FPjKrQjWvmPjWrRw==", - "requires": { - "number-is-nan": "^1.0.0" - } - }, - "require-main-filename": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", - "integrity": "sha512-IqSUtOVP4ksd1C/ej5zeEh/BIP2ajqpn8c5x+q99gvcIG/Qf0cud5raVnE/Dwd0ua9TXYDoDc0RE5hBSdz22Ug==" - }, - "string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha512-0XsVpQLnVCXHJfyEs8tC0zpTVIr5PKKsQtkT29IwupnPTjtPmQ3xT/4yCREF9hYkV/3M3kzcUTSAZT6a6h81tw==", - "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" - } - }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg==", - "requires": { - "ansi-regex": "^2.0.0" - } - }, - "which-module": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-1.0.0.tgz", - "integrity": "sha512-F6+WgncZi/mJDrammbTuHe1q0R5hOXv/mBaiNA2TCNT/LTHusX0V+CJnj9XT8ki5ln2UZyyddDgHfCzyrOH7MQ==" - }, - "wrap-ansi": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", - "integrity": "sha512-vAaEaDM946gbNpH5pLVNR+vX2ht6n0Bt3GXwVB1AuAqZosOvHNF3P7wDnh8KLkSqgUh0uh77le7Owgoz+Z9XBw==", - "requires": { - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1" - } - }, - "y18n": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.2.tgz", - "integrity": "sha512-uGZHXkHnhF0XeeAPgnKfPv1bgKAYyVvmNL1xlKsPYZPaIHxGti2hHqvOCQv71XMsLxu1QjergkqogUnms5D3YQ==" - }, - "yargs": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-5.0.0.tgz", - "integrity": "sha512-krgVLGNhMWUVY1EJkM/bgbvn3yCIRrsZp6KaeX8hx8ztT+jBtX7/flTQcSHe5089xIDQRUsEr2mzlZVNe/7P5w==", - "requires": { - "cliui": "^3.2.0", - "decamelize": "^1.1.1", - "get-caller-file": "^1.0.1", - "lodash.assign": "^4.2.0", - "os-locale": "^1.4.0", - "read-pkg-up": "^1.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^1.0.1", - "set-blocking": "^2.0.0", - "string-width": "^1.0.2", - "which-module": "^1.0.0", - "window-size": "^0.2.0", - "y18n": "^3.2.1", - "yargs-parser": "^3.2.0" - } - }, - "yargs-parser": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-3.2.0.tgz", - "integrity": "sha512-eANlJIqYwhwS/asi4ybKxkeJYUIjNMZXL36C/KICV5jyudUZWp+/lEfBHM0PuJcQjBfs00HwqePEQjtLJd+Kyw==", - "requires": { - "camelcase": "^3.0.0", - "lodash.assign": "^4.1.0" - } - } - } - }, "reflect-metadata": { "version": "0.1.13" }, @@ -17328,61 +16765,6 @@ "version": "1.7.3", "dev": true }, - "shelljs": { - "version": "0.7.8", - "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.7.8.tgz", - "integrity": "sha512-/YF5Uk8hcwi7ima04ppkbA4RaRMdPMBfwAvAf8sufYOxsJRtbdoBsT8vGvlb+799BrlGdYrd+oczIA2eN2JdWA==", - "requires": { - "glob": "^7.0.0", - "interpret": "^1.0.0", - "rechoir": "^0.6.2" - }, - "dependencies": { - "brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "interpret": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz", - "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==" - }, - "minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "rechoir": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", - "integrity": "sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw==", - "requires": { - "resolve": "^1.1.6" - } - } - } - }, "side-channel": { "version": "1.0.4", "requires": { @@ -17639,25 +17021,59 @@ "memory-pager": "^1.0.2" } }, + "spawnise": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/spawnise/-/spawnise-1.0.0.tgz", + "integrity": "sha512-HRmGun1rESPpAeq4oU0Nzpg360ffqxjYvS3w17ZR4hp82MX2jHkvljtT0Z304alO3dNHHpfzeaENdUXdjvFJbw==", + "requires": { + "bl": "^5.0.0", + "cross-spawn": "^7.0.3" + }, + "dependencies": { + "bl": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-5.0.0.tgz", + "integrity": "sha512-8vxFNZ0pflFfi0WXA3WQXlj6CaMEwsmh63I1CNp0q+wWv8sD0ARx1KovSQd0l2GkwrMIOyedq0EF1FxI+RCZLQ==", + "requires": { + "buffer": "^6.0.3", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, + "buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "requires": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + } + } + }, "spdx-correct": { "version": "3.1.1", + "dev": true, "requires": { "spdx-expression-parse": "^3.0.0", "spdx-license-ids": "^3.0.0" } }, "spdx-exceptions": { - "version": "2.3.0" + "version": "2.3.0", + "dev": true }, "spdx-expression-parse": { "version": "3.0.1", + "dev": true, "requires": { "spdx-exceptions": "^2.1.0", "spdx-license-ids": "^3.0.0" } }, "spdx-license-ids": { - "version": "3.0.11" + "version": "3.0.11", + "dev": true }, "split-string": { "version": "3.1.0", @@ -18394,6 +17810,7 @@ }, "validate-npm-package-license": { "version": "3.0.4", + "dev": true, "requires": { "spdx-correct": "^3.0.0", "spdx-expression-parse": "^3.0.0" @@ -18460,11 +17877,6 @@ "string-width": "^4.0.0" } }, - "window-size": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.2.0.tgz", - "integrity": "sha512-UD7d8HFA2+PZsbKyaOCEy8gMh1oDtHgJh1LfgjQ4zVXmYjAT/kvz3PueITKuqDiIXQe7yzpPnxX3lNc+AhQMyw==" - }, "wordwrap": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", diff --git a/package.json b/package.json index c8c9f51f..3bc86a47 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "migration:create": "npx mikro-orm migration:create", "migration:up": "npx mikro-orm migration:up", "migration:down": "npx mikro-orm migration:down", - "plugins:install": "npm-recursive-install --rootDir=src/plugins", + "plugins:install": "installoop --rootDir=src/plugins", "plop": "plop --plopfile ./cli/plopfile.js", "postinstall": "npm run plugins:install" }, @@ -64,11 +64,11 @@ "http-status-codes": "~2.2.0", "image-hash": "~5.3.1", "imgur": "~2.2.0", + "installoop": "^1.0.2", "joi": "~17.6.2", "node-os-utils": "~1.3.7", "ora": "~5.4.1", "pidusage": "~3.0.0", - "recursive-install": "^1.4.0", "reflect-metadata": "~0.1.13", "rentry-pastebin": "~1.2.3", "rxeta": "~1.1.2", From 43edac8da23e0edadbcc85ff94f3c1e83d3618ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartholom=C3=A9=20Gili?= Date: Fri, 14 Oct 2022 00:32:22 +0200 Subject: [PATCH 23/29] fix(devops/docker): postinstall script erroring --- .docker/app/Dockerfile | 19 +++++++++---------- .swcrc | 2 +- package-lock.json | 18 +++++++++--------- package.json | 8 ++++---- src/config/general.ts | 2 +- 5 files changed, 24 insertions(+), 25 deletions(-) diff --git a/.docker/app/Dockerfile b/.docker/app/Dockerfile index ef604a29..1e54647c 100644 --- a/.docker/app/Dockerfile +++ b/.docker/app/Dockerfile @@ -1,5 +1,5 @@ ## build runner -FROM node:16.17-alpine as build-runner +FROM node:16.17-buster-slim as build-runner # Set temp directory WORKDIR /tmp/app @@ -7,12 +7,11 @@ WORKDIR /tmp/app # Move package.json and package-lock.json COPY package.json . COPY package-lock.json . +COPY src ./src # Install dependencies from package-lock.json -RUN npm ci && npm cache clean --force - -# Move source files -COPY src ./src +# and install dependencies for plugins (because postinstall script doesn't work in docker) +RUN npm ci --ignore-scripts && find src/plugins ! -path "*/node_modules/*" -name "package.json" -execdir npm install \; COPY .swcrc . COPY tsconfig.json . @@ -21,7 +20,7 @@ COPY tsconfig.json . RUN npm run build ## producation runner -FROM node:16.17-alpine as prod-runner +FROM node:16.17-buster-slim as prod-runner # set production mode ARG NODE_ENV=production @@ -34,12 +33,12 @@ WORKDIR /app COPY --from=build-runner /tmp/app/package.json /app/package.json COPY --from=build-runner /tmp/app/package-lock.json /app/package-lock.json -# Install dependencies from package-lock.json -RUN npm ci --omit=dev - # Move build files COPY --from=build-runner /tmp/app/build /app/build -# COPY assets /app/assets + +# Install dependencies from package-lock.json +# and install dependencies for plugins (because postinstall script doesn't work in docker) +RUN npm ci --omit=dev --ignore-scripts && find build/plugins ! -path "*/node_modules/*" -name "package.json" -execdir npm install --omit=dev \; && npm cache clean --force # Finaly start the bot CMD ["node", "build/main.js"] \ No newline at end of file diff --git a/.swcrc b/.swcrc index f81eb341..66049034 100644 --- a/.swcrc +++ b/.swcrc @@ -48,7 +48,7 @@ "decoratorMetadata": true } }, - "exclude": ["node_modules"], + "exclude": ["node_modules", ".git"], "module": { "type": "commonjs" } diff --git a/package-lock.json b/package-lock.json index 916aa597..f9c18dfa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "tscord", - "version": "1.1.0", + "version": "1.0.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "tscord", - "version": "1.1.0", + "version": "1.0.0", "hasInstallScript": true, "license": "MIT", "dependencies": { @@ -51,7 +51,7 @@ "http-status-codes": "~2.2.0", "image-hash": "~5.3.1", "imgur": "~2.2.0", - "installoop": "^1.0.2", + "installoop": "^1.0.4", "joi": "~17.6.2", "node-os-utils": "~1.3.7", "ora": "~5.4.1", @@ -5579,9 +5579,9 @@ } }, "node_modules/installoop": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/installoop/-/installoop-1.0.2.tgz", - "integrity": "sha512-ERBqyZg+eiSqZh7K6hTv7TD5KmiSWm3B9Bshu0PhXqQWJbRYM2b8Q2h71j0VEXX3oDUWv7dtUmTBieW1kPssCg==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/installoop/-/installoop-1.0.4.tgz", + "integrity": "sha512-77PRTph037Q1hXn9iEnbGYd1pgpKoU0Y3LmmenwOHUhlstKQ+WSVTnAzu9xKPSlPR4mPUd6gnEAtXKcXyhGhig==", "dependencies": { "arg": "^5.0.2", "spawnise": "^1.0.0" @@ -14471,9 +14471,9 @@ } }, "installoop": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/installoop/-/installoop-1.0.2.tgz", - "integrity": "sha512-ERBqyZg+eiSqZh7K6hTv7TD5KmiSWm3B9Bshu0PhXqQWJbRYM2b8Q2h71j0VEXX3oDUWv7dtUmTBieW1kPssCg==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/installoop/-/installoop-1.0.4.tgz", + "integrity": "sha512-77PRTph037Q1hXn9iEnbGYd1pgpKoU0Y3LmmenwOHUhlstKQ+WSVTnAzu9xKPSlPR4mPUd6gnEAtXKcXyhGhig==", "requires": { "arg": "^5.0.2", "spawnise": "^1.0.0" diff --git a/package.json b/package.json index 3bc86a47..523f8a75 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,11 @@ { "name": "tscord", - "version": "1.1.0", + "version": "1.0.0", "description": "A fully-featured discord bot template written in Typescript, intended to provide a framework that's easy to use, extend and modify", "license": "MIT", "main": "build/main.js", "scripts": { - "build": "npm run build:clean && swc src -d build && npm run type:check", + "build": "npm run build:clean && swc src -d build -D && npm run type:check", "build:changelog": "npx @discordx/changelog --root=src", "build:start": "npm run build && npm run start", "build:clean": "rimraf build", @@ -18,7 +18,7 @@ "migration:create": "npx mikro-orm migration:create", "migration:up": "npx mikro-orm migration:up", "migration:down": "npx mikro-orm migration:down", - "plugins:install": "installoop --rootDir=src/plugins", + "plugins:install": "installoop --rootDir=./src/plugins --rootDir=./build/plugins", "plop": "plop --plopfile ./cli/plopfile.js", "postinstall": "npm run plugins:install" }, @@ -64,7 +64,7 @@ "http-status-codes": "~2.2.0", "image-hash": "~5.3.1", "imgur": "~2.2.0", - "installoop": "^1.0.2", + "installoop": "^1.0.4", "joi": "~17.6.2", "node-os-utils": "~1.3.7", "ora": "~5.4.1", diff --git a/src/config/general.ts b/src/config/general.ts index c8d09321..b0572961 100644 --- a/src/config/general.ts +++ b/src/config/general.ts @@ -1,6 +1,6 @@ export const generalConfig: GeneralConfigType = { - __templateVersion: '1.1.0', + __templateVersion: '2.0.0', name: 'tscord', description: '', From ca8770ed140e4d86d89006aece582ad8eae48981 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartholom=C3=A9=20Gili?= <66025667+barthofu@users.noreply.github.com> Date: Sat, 15 Oct 2022 08:30:17 +0000 Subject: [PATCH 24/29] fix(#73): docker build fail --- .docker/app/Dockerfile | 6 +- package-lock.json | 409 ++++++++++++++++++++++++++++++++++++++++- package.json | 3 +- 3 files changed, 412 insertions(+), 6 deletions(-) diff --git a/.docker/app/Dockerfile b/.docker/app/Dockerfile index 1e54647c..5ce83164 100644 --- a/.docker/app/Dockerfile +++ b/.docker/app/Dockerfile @@ -11,7 +11,7 @@ COPY src ./src # Install dependencies from package-lock.json # and install dependencies for plugins (because postinstall script doesn't work in docker) -RUN npm ci --ignore-scripts && find src/plugins ! -path "*/node_modules/*" -name "package.json" -execdir npm install \; +RUN npm ci && find src/plugins ! -path "*/node_modules/*" -name "package.json" -execdir npm install \; COPY .swcrc . COPY tsconfig.json . @@ -37,8 +37,8 @@ COPY --from=build-runner /tmp/app/package-lock.json /app/package-lock.json COPY --from=build-runner /tmp/app/build /app/build # Install dependencies from package-lock.json -# and install dependencies for plugins (because postinstall script doesn't work in docker) -RUN npm ci --omit=dev --ignore-scripts && find build/plugins ! -path "*/node_modules/*" -name "package.json" -execdir npm install --omit=dev \; && npm cache clean --force +# and install dependencies for plugins (because plugins:install script doesn't work in docker) +RUN npm ci --omit=dev && mkdir -p build/plugins && find build/plugins ! -path "*/node_modules/*" -name "package.json" -execdir npm install --omit=dev \; && npm cache clean --force # Finaly start the bot CMD ["node", "build/main.js"] \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index f9c18dfa..beb7da88 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,7 +7,6 @@ "": { "name": "tscord", "version": "1.0.0", - "hasInstallScript": true, "license": "MIT", "dependencies": { "@discordx/importer": "~1.1.10", @@ -999,6 +998,258 @@ "@swc/core-win32-x64-msvc": "1.3.2" } }, + "node_modules/@swc/core-android-arm-eabi": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@swc/core-android-arm-eabi/-/core-android-arm-eabi-1.3.2.tgz", + "integrity": "sha512-jCqckwATVC4HbNjjrJii6xZzFKl7ecxVtY94odGD15+7qu5VCMuLD+Pj3bYxIQxQyzvi1z8S/187uUrAKMC2/w==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "dependencies": { + "@swc/wasm": "1.2.122" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-android-arm-eabi/node_modules/@swc/wasm": { + "version": "1.2.122", + "resolved": "https://registry.npmjs.org/@swc/wasm/-/wasm-1.2.122.tgz", + "integrity": "sha512-sM1VCWQxmNhFtdxME+8UXNyPNhxNu7zdb6ikWpz0YKAQQFRGT5ThZgJrubEpah335SUToNg8pkdDF7ibVCjxbQ==", + "dev": true, + "optional": true + }, + "node_modules/@swc/core-android-arm64": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@swc/core-android-arm64/-/core-android-arm64-1.3.2.tgz", + "integrity": "sha512-zZ3EX5jmY6kTBlnAqLmIhDFGlsAB3Tiwk/sqoMLruZT1RsueDToQAXtjT5TWSlPh/GXAZyJQwqar2xIdi5pPAA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "dependencies": { + "@swc/wasm": "1.2.130" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-android-arm64/node_modules/@swc/wasm": { + "version": "1.2.130", + "resolved": "https://registry.npmjs.org/@swc/wasm/-/wasm-1.2.130.tgz", + "integrity": "sha512-rNcJsBxS70+pv8YUWwf5fRlWX6JoY/HJc25HD/F8m6Kv7XhJdqPPMhyX6TKkUBPAG7TWlZYoxa+rHAjPy4Cj3Q==", + "dev": true, + "optional": true + }, + "node_modules/@swc/core-darwin-arm64": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.3.2.tgz", + "integrity": "sha512-YQpbRkd5zhycr+Nl1mm1p7koFqr8hsY8Z7XzNjfNIaJeFsXg9wjjH7yVmedQl+If+ibaPWpS3gMWfcIoUhdvGg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-darwin-x64": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.3.2.tgz", + "integrity": "sha512-DMvvdWgi/2dHtSGk4m6OcmlW8AAEUUl7Zys+Sxp+AtyIlQvn0Lbw9HCMPG6pqC0SHEO1kcNj6f6ARt3lL25jSA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-freebsd-x64": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@swc/core-freebsd-x64/-/core-freebsd-x64-1.3.2.tgz", + "integrity": "sha512-GUXqDnmJTWZBoTbOMOKG+mw/jJ7dAOOKuUKwnQvyzconLkqHZZfJTimDsc1KWpikf9IPdQNY0+0/NqAVPGA0Dg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "dependencies": { + "@swc/wasm": "1.2.130" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-freebsd-x64/node_modules/@swc/wasm": { + "version": "1.2.130", + "resolved": "https://registry.npmjs.org/@swc/wasm/-/wasm-1.2.130.tgz", + "integrity": "sha512-rNcJsBxS70+pv8YUWwf5fRlWX6JoY/HJc25HD/F8m6Kv7XhJdqPPMhyX6TKkUBPAG7TWlZYoxa+rHAjPy4Cj3Q==", + "dev": true, + "optional": true + }, + "node_modules/@swc/core-linux-arm-gnueabihf": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.3.2.tgz", + "integrity": "sha512-Df3ln4IhiFxOYBNr/x192tXhRBTVEhJPMLRDl9Q0WY/lvPp/n5Ee0VgKR1CaQ16bg3/z3lZjXrZRBw01kENEew==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "dependencies": { + "@swc/wasm": "1.2.130" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-linux-arm-gnueabihf/node_modules/@swc/wasm": { + "version": "1.2.130", + "resolved": "https://registry.npmjs.org/@swc/wasm/-/wasm-1.2.130.tgz", + "integrity": "sha512-rNcJsBxS70+pv8YUWwf5fRlWX6JoY/HJc25HD/F8m6Kv7XhJdqPPMhyX6TKkUBPAG7TWlZYoxa+rHAjPy4Cj3Q==", + "dev": true, + "optional": true + }, + "node_modules/@swc/core-linux-arm64-gnu": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.3.2.tgz", + "integrity": "sha512-jPtcA61HqWFxlIr5OCToa97kqTS6u4I2GJR5whc8u2rSzn2N+M5CfqskOGHBETcEhUWfFa0hJq3+i6w9lqKV+w==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-linux-arm64-musl": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.3.2.tgz", + "integrity": "sha512-GhGM49GTzpjxKrzi8IpyHNlrJkOwiS6Pk4xhy3D7nrbB5KppU8O+lppkiRjiF9awD+mIzFq27TdokbmEoQcXaQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-linux-x64-gnu": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.3.2.tgz", + "integrity": "sha512-JgN5rGHAKe2hvtU1H1V9toxSDWKEAWbrrb+/Wp/6CrxBxNgexmgXuDGt0VP21jbRA2qTRNEhx9zzuzZK9ggNTQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-linux-x64-musl": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.3.2.tgz", + "integrity": "sha512-VpT6jgU7qqNjQmKt5RaOpkocv9MI5FTxWon4OQvTc+kHCoTAmXIndaW6aA+j4VEDSTJ/7DQAFWSXpSCffoQMsA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-win32-arm64-msvc": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.3.2.tgz", + "integrity": "sha512-bilVzxfq5upHsil1WwPSoArZLkhPJyqJJ+5EzbiDS3Y38BPkPYZuN0h6sKuEiXLMHGODXtzuAkSgQyy0VVQKIA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "dependencies": { + "@swc/wasm": "1.2.130" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-win32-arm64-msvc/node_modules/@swc/wasm": { + "version": "1.2.130", + "resolved": "https://registry.npmjs.org/@swc/wasm/-/wasm-1.2.130.tgz", + "integrity": "sha512-rNcJsBxS70+pv8YUWwf5fRlWX6JoY/HJc25HD/F8m6Kv7XhJdqPPMhyX6TKkUBPAG7TWlZYoxa+rHAjPy4Cj3Q==", + "dev": true, + "optional": true + }, + "node_modules/@swc/core-win32-ia32-msvc": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.3.2.tgz", + "integrity": "sha512-UzHbZvJnfGZKvoEPiHoKtKehtuiDuNP/mKKBAaG5Cnu8m47z/cE5Mi0onR2iJi1p64GX0RhRIBcGa8x9PVHGjA==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "dependencies": { + "@swc/wasm": "1.2.130" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-win32-ia32-msvc/node_modules/@swc/wasm": { + "version": "1.2.130", + "resolved": "https://registry.npmjs.org/@swc/wasm/-/wasm-1.2.130.tgz", + "integrity": "sha512-rNcJsBxS70+pv8YUWwf5fRlWX6JoY/HJc25HD/F8m6Kv7XhJdqPPMhyX6TKkUBPAG7TWlZYoxa+rHAjPy4Cj3Q==", + "dev": true, + "optional": true + }, "node_modules/@swc/core-win32-x64-msvc": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.3.2.tgz", @@ -11264,6 +11515,162 @@ "@swc/core-win32-x64-msvc": "1.3.2" } }, + "@swc/core-android-arm-eabi": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@swc/core-android-arm-eabi/-/core-android-arm-eabi-1.3.2.tgz", + "integrity": "sha512-jCqckwATVC4HbNjjrJii6xZzFKl7ecxVtY94odGD15+7qu5VCMuLD+Pj3bYxIQxQyzvi1z8S/187uUrAKMC2/w==", + "dev": true, + "optional": true, + "requires": { + "@swc/wasm": "1.2.122" + }, + "dependencies": { + "@swc/wasm": { + "version": "1.2.122", + "resolved": "https://registry.npmjs.org/@swc/wasm/-/wasm-1.2.122.tgz", + "integrity": "sha512-sM1VCWQxmNhFtdxME+8UXNyPNhxNu7zdb6ikWpz0YKAQQFRGT5ThZgJrubEpah335SUToNg8pkdDF7ibVCjxbQ==", + "dev": true, + "optional": true + } + } + }, + "@swc/core-android-arm64": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@swc/core-android-arm64/-/core-android-arm64-1.3.2.tgz", + "integrity": "sha512-zZ3EX5jmY6kTBlnAqLmIhDFGlsAB3Tiwk/sqoMLruZT1RsueDToQAXtjT5TWSlPh/GXAZyJQwqar2xIdi5pPAA==", + "dev": true, + "optional": true, + "requires": { + "@swc/wasm": "1.2.130" + }, + "dependencies": { + "@swc/wasm": { + "version": "1.2.130", + "resolved": "https://registry.npmjs.org/@swc/wasm/-/wasm-1.2.130.tgz", + "integrity": "sha512-rNcJsBxS70+pv8YUWwf5fRlWX6JoY/HJc25HD/F8m6Kv7XhJdqPPMhyX6TKkUBPAG7TWlZYoxa+rHAjPy4Cj3Q==", + "dev": true, + "optional": true + } + } + }, + "@swc/core-darwin-arm64": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.3.2.tgz", + "integrity": "sha512-YQpbRkd5zhycr+Nl1mm1p7koFqr8hsY8Z7XzNjfNIaJeFsXg9wjjH7yVmedQl+If+ibaPWpS3gMWfcIoUhdvGg==", + "dev": true, + "optional": true + }, + "@swc/core-darwin-x64": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.3.2.tgz", + "integrity": "sha512-DMvvdWgi/2dHtSGk4m6OcmlW8AAEUUl7Zys+Sxp+AtyIlQvn0Lbw9HCMPG6pqC0SHEO1kcNj6f6ARt3lL25jSA==", + "dev": true, + "optional": true + }, + "@swc/core-freebsd-x64": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@swc/core-freebsd-x64/-/core-freebsd-x64-1.3.2.tgz", + "integrity": "sha512-GUXqDnmJTWZBoTbOMOKG+mw/jJ7dAOOKuUKwnQvyzconLkqHZZfJTimDsc1KWpikf9IPdQNY0+0/NqAVPGA0Dg==", + "dev": true, + "optional": true, + "requires": { + "@swc/wasm": "1.2.130" + }, + "dependencies": { + "@swc/wasm": { + "version": "1.2.130", + "resolved": "https://registry.npmjs.org/@swc/wasm/-/wasm-1.2.130.tgz", + "integrity": "sha512-rNcJsBxS70+pv8YUWwf5fRlWX6JoY/HJc25HD/F8m6Kv7XhJdqPPMhyX6TKkUBPAG7TWlZYoxa+rHAjPy4Cj3Q==", + "dev": true, + "optional": true + } + } + }, + "@swc/core-linux-arm-gnueabihf": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.3.2.tgz", + "integrity": "sha512-Df3ln4IhiFxOYBNr/x192tXhRBTVEhJPMLRDl9Q0WY/lvPp/n5Ee0VgKR1CaQ16bg3/z3lZjXrZRBw01kENEew==", + "dev": true, + "optional": true, + "requires": { + "@swc/wasm": "1.2.130" + }, + "dependencies": { + "@swc/wasm": { + "version": "1.2.130", + "resolved": "https://registry.npmjs.org/@swc/wasm/-/wasm-1.2.130.tgz", + "integrity": "sha512-rNcJsBxS70+pv8YUWwf5fRlWX6JoY/HJc25HD/F8m6Kv7XhJdqPPMhyX6TKkUBPAG7TWlZYoxa+rHAjPy4Cj3Q==", + "dev": true, + "optional": true + } + } + }, + "@swc/core-linux-arm64-gnu": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.3.2.tgz", + "integrity": "sha512-jPtcA61HqWFxlIr5OCToa97kqTS6u4I2GJR5whc8u2rSzn2N+M5CfqskOGHBETcEhUWfFa0hJq3+i6w9lqKV+w==", + "dev": true, + "optional": true + }, + "@swc/core-linux-arm64-musl": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.3.2.tgz", + "integrity": "sha512-GhGM49GTzpjxKrzi8IpyHNlrJkOwiS6Pk4xhy3D7nrbB5KppU8O+lppkiRjiF9awD+mIzFq27TdokbmEoQcXaQ==", + "dev": true, + "optional": true + }, + "@swc/core-linux-x64-gnu": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.3.2.tgz", + "integrity": "sha512-JgN5rGHAKe2hvtU1H1V9toxSDWKEAWbrrb+/Wp/6CrxBxNgexmgXuDGt0VP21jbRA2qTRNEhx9zzuzZK9ggNTQ==", + "dev": true, + "optional": true + }, + "@swc/core-linux-x64-musl": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.3.2.tgz", + "integrity": "sha512-VpT6jgU7qqNjQmKt5RaOpkocv9MI5FTxWon4OQvTc+kHCoTAmXIndaW6aA+j4VEDSTJ/7DQAFWSXpSCffoQMsA==", + "dev": true, + "optional": true + }, + "@swc/core-win32-arm64-msvc": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.3.2.tgz", + "integrity": "sha512-bilVzxfq5upHsil1WwPSoArZLkhPJyqJJ+5EzbiDS3Y38BPkPYZuN0h6sKuEiXLMHGODXtzuAkSgQyy0VVQKIA==", + "dev": true, + "optional": true, + "requires": { + "@swc/wasm": "1.2.130" + }, + "dependencies": { + "@swc/wasm": { + "version": "1.2.130", + "resolved": "https://registry.npmjs.org/@swc/wasm/-/wasm-1.2.130.tgz", + "integrity": "sha512-rNcJsBxS70+pv8YUWwf5fRlWX6JoY/HJc25HD/F8m6Kv7XhJdqPPMhyX6TKkUBPAG7TWlZYoxa+rHAjPy4Cj3Q==", + "dev": true, + "optional": true + } + } + }, + "@swc/core-win32-ia32-msvc": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.3.2.tgz", + "integrity": "sha512-UzHbZvJnfGZKvoEPiHoKtKehtuiDuNP/mKKBAaG5Cnu8m47z/cE5Mi0onR2iJi1p64GX0RhRIBcGa8x9PVHGjA==", + "dev": true, + "optional": true, + "requires": { + "@swc/wasm": "1.2.130" + }, + "dependencies": { + "@swc/wasm": { + "version": "1.2.130", + "resolved": "https://registry.npmjs.org/@swc/wasm/-/wasm-1.2.130.tgz", + "integrity": "sha512-rNcJsBxS70+pv8YUWwf5fRlWX6JoY/HJc25HD/F8m6Kv7XhJdqPPMhyX6TKkUBPAG7TWlZYoxa+rHAjPy4Cj3Q==", + "dev": true, + "optional": true + } + } + }, "@swc/core-win32-x64-msvc": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.3.2.tgz", diff --git a/package.json b/package.json index 523f8a75..23816726 100644 --- a/package.json +++ b/package.json @@ -19,8 +19,7 @@ "migration:up": "npx mikro-orm migration:up", "migration:down": "npx mikro-orm migration:down", "plugins:install": "installoop --rootDir=./src/plugins --rootDir=./build/plugins", - "plop": "plop --plopfile ./cli/plopfile.js", - "postinstall": "npm run plugins:install" + "plop": "plop --plopfile ./cli/plopfile.js" }, "dependencies": { "@discordx/importer": "~1.1.10", From 45ac967aad0cf739843fdce2dd8f73b12ffed293 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartholom=C3=A9=20Gili?= <66025667+barthofu@users.noreply.github.com> Date: Sat, 15 Oct 2022 09:22:26 +0000 Subject: [PATCH 25/29] fix(#73): source code path differ between prod and dev --- .swcrc | 47 +- src/plugins/twilio/.env.example | 3 + src/plugins/twilio/api/controllers/index.ts | 1 + src/plugins/twilio/api/controllers/twilio.ts | 53 + src/plugins/twilio/config/index.ts | 1 + src/plugins/twilio/config/twilio.ts | 9 + src/plugins/twilio/package-lock.json | 1071 +++++++++++++++++ src/plugins/twilio/package.json | 6 + src/plugins/twilio/plugin.json | 7 + src/plugins/twilio/services/Twilio.ts | 37 + src/plugins/twilio/services/index.ts | 1 + src/plugins/twilio/utils/types/config.d.ts | 7 + .../twilio/utils/types/environements.d.ts | 12 + src/plugins/twilio/utils/types/twilio.d.ts | 30 + src/services/ImagesUpload.ts | 2 +- src/services/Pastebin.ts | 4 +- src/services/PluginsManager.ts | 27 +- src/utils/classes/Plugin.ts | 39 +- src/utils/functions/dependency.ts | 2 +- src/utils/functions/{fs.ts => files.ts} | 4 + src/utils/functions/index.ts | 2 +- tsconfig.json | 47 +- 22 files changed, 1331 insertions(+), 81 deletions(-) create mode 100644 src/plugins/twilio/.env.example create mode 100644 src/plugins/twilio/api/controllers/index.ts create mode 100644 src/plugins/twilio/api/controllers/twilio.ts create mode 100644 src/plugins/twilio/config/index.ts create mode 100644 src/plugins/twilio/config/twilio.ts create mode 100644 src/plugins/twilio/package-lock.json create mode 100644 src/plugins/twilio/package.json create mode 100644 src/plugins/twilio/plugin.json create mode 100644 src/plugins/twilio/services/Twilio.ts create mode 100644 src/plugins/twilio/services/index.ts create mode 100644 src/plugins/twilio/utils/types/config.d.ts create mode 100644 src/plugins/twilio/utils/types/environements.d.ts create mode 100644 src/plugins/twilio/utils/types/twilio.d.ts rename src/utils/functions/{fs.ts => files.ts} (81%) diff --git a/.swcrc b/.swcrc index 66049034..9eac4ebd 100644 --- a/.swcrc +++ b/.swcrc @@ -9,40 +9,41 @@ "target": "es2021", "baseUrl": "./", "paths": { - "@decorators": ["src/utils/decorators"], - "@decorators/*": ["src/plugins/*/utils/decorators"], - "@errors": ["src/utils/errors"], - "@errors/*": ["src/plugins/*/utils/errors"], + "@decorators": ["src/utils/decorators"], + "@decorators/*": ["src/plugins/*/utils/decorators"], - "@entities": ["src/entities"], - "@entities/*": ["src/plugins/*/entities"], + "@errors": ["src/utils/errors"], + "@errors/*": ["src/plugins/*/utils/errors"], - "@guards": ["src/guards"], - "@guards/*": ["src/plugins/*/guards"], + "@entities": ["src/entities"], + "@entities/*": ["src/plugins/*/entities"], + + "@guards": ["src/guards"], + "@guards/*": ["src/plugins/*/guards"], - "@services": ["src/services"], - "@services/*": ["src/plugins/*/services"], + "@services": ["src/services"], + "@services/*": ["src/plugins/*/services"], - "@i18n": ["src/i18n"], - "@i18n/*": ["src/plugins/*/i18n"], + "@i18n": ["src/i18n"], + "@i18n/*": ["src/plugins/*/i18n"], - "@config": ["src/config"], - "@config/*": ["src/plugins/*/config"], + "@config": ["src/config"], + "@config/*": ["src/plugins/*/config"], - "@utils/classes": ["src/utils/classes"], - "@utils/classes/*": ["src/plugins/*/utils/classes"], + "@utils/classes": ["src/utils/classes"], + "@utils/classes/*": ["src/plugins/*/utils/classes"], - "@utils/functions": ["src/utils/functions"], - "@utils/functions/*": ["src/plugins/*/utils/functions"], + "@utils/functions": ["src/utils/functions"], + "@utils/functions/*": ["src/plugins/*/utils/functions"], - "@api/controllers": ["src/api/controllers"], - "@api/controllers/*": ["src/plugins/*/api/controllers"], + "@api/controllers": ["src/api/controllers"], + "@api/controllers/*": ["src/plugins/*/api/controllers"], - "@api/middlewares": ["src/api/middlewares"], - "@api/middlewares/*": ["src/plugins/*/api/middlewares"], + "@api/middlewares": ["src/api/middlewares"], + "@api/middlewares/*": ["src/plugins/*/api/middlewares"], - "@api/server": ["src/api/server.ts"] + "@api/server": ["src/api/server.ts"] }, "transform": { "decoratorMetadata": true diff --git a/src/plugins/twilio/.env.example b/src/plugins/twilio/.env.example new file mode 100644 index 00000000..de818187 --- /dev/null +++ b/src/plugins/twilio/.env.example @@ -0,0 +1,3 @@ +# Twilio +TWILIO_ACCOUNT_SID="YOUR_TWILIO_ACCOUNT_SID" +TWILIO_AUTH_TOKEN="YOUR_TWILIO_AUTH_TOKEN" \ No newline at end of file diff --git a/src/plugins/twilio/api/controllers/index.ts b/src/plugins/twilio/api/controllers/index.ts new file mode 100644 index 00000000..e5460761 --- /dev/null +++ b/src/plugins/twilio/api/controllers/index.ts @@ -0,0 +1 @@ +export * from './twilio' \ No newline at end of file diff --git a/src/plugins/twilio/api/controllers/twilio.ts b/src/plugins/twilio/api/controllers/twilio.ts new file mode 100644 index 00000000..98ac0359 --- /dev/null +++ b/src/plugins/twilio/api/controllers/twilio.ts @@ -0,0 +1,53 @@ +import { Context, Controller, PlatformContext, Post, UseBefore } from "@tsed/common" +import { BaseController } from "@utils/classes" +import bodyParser from "body-parser" +import { injectable } from "tsyringe" +import { webhook as TwilioWebhook } from 'twilio' +import MessagingResponse from 'twilio/lib/twiml/MessagingResponse' +import { twilioConfig } from "../../config" +import { Twilio } from "../../services" + +@Controller('/twilio') +@UseBefore(bodyParser.urlencoded({ extended: false })) +@injectable() +export class TwilioController extends BaseController { + + constructor( + private twilio: Twilio + ) { + super() + } + + + @Post("/sms") + @UseBefore(TwilioWebhook( { validate: twilioConfig.apiValidateSource } )) + async status(@Context() { request }: PlatformContext) { + + this.twilio.emit("sms", { + messageSid: request.body.MessageSid, + smsSid: request.body.SmsSid, + accountSid: request.body.AccountSid, + messagingServiceSid: request.body.MessagingServiceSid, + body: request.body.Body, + from: request.body.From, + to: request.body.To, + geo: { + from: { + country: request.body.FromCountry, + state: request.body.FromState, + city: request.body.FromCity, + zip: request.body.FromZip, + }, + to: { + country: request.body.ToCountry, + state: request.body.ToState, + city: request.body.ToCity, + zip: request.body.ToZip, + } + }, + apiVersion: request.body.ApiVersion + }) + + return new MessagingResponse() + } +} \ No newline at end of file diff --git a/src/plugins/twilio/config/index.ts b/src/plugins/twilio/config/index.ts new file mode 100644 index 00000000..e5460761 --- /dev/null +++ b/src/plugins/twilio/config/index.ts @@ -0,0 +1 @@ +export * from './twilio' \ No newline at end of file diff --git a/src/plugins/twilio/config/twilio.ts b/src/plugins/twilio/config/twilio.ts new file mode 100644 index 00000000..8da5705d --- /dev/null +++ b/src/plugins/twilio/config/twilio.ts @@ -0,0 +1,9 @@ +export const twilioConfig: TwilioPlugin.ConfigType = { + enabled: false, + debug: false, + apiValidateSource: false, // Set to false if you are using a reverse-proxy +} + +export const twilioPhoneNumbers = [ + "+1XXXXXXXXXX" +] as const \ No newline at end of file diff --git a/src/plugins/twilio/package-lock.json b/src/plugins/twilio/package-lock.json new file mode 100644 index 00000000..50f79dd9 --- /dev/null +++ b/src/plugins/twilio/package-lock.json @@ -0,0 +1,1071 @@ +{ + "name": "twilio", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "dependencies": { + "body-parser": "^1.20.0", + "twilio": "^3.82.0" + } + }, + "node_modules/agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/agent-base/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/agent-base/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "node_modules/asap": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", + "integrity": "sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==" + }, + "node_modules/axios": { + "version": "0.26.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz", + "integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==", + "dependencies": { + "follow-redirects": "^1.14.8" + } + }, + "node_modules/body-parser": { + "version": "1.20.1", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz", + "integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==", + "dependencies": { + "bytes": "3.1.2", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "on-finished": "2.4.1", + "qs": "6.11.0", + "raw-body": "2.5.1", + "type-is": "~1.6.18", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/buffer-equal-constant-time": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", + "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==" + }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "dependencies": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/content-type": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", + "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/dayjs": { + "version": "1.11.5", + "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.5.tgz", + "integrity": "sha512-CAdX5Q3YW3Gclyo5Vpqkgpj8fSdLQcRuzfX6mC6Phy0nfJ0eGYOeS7m4mt2plDWLAtA4TqTakvbboHvUxfe4iA==" + }, + "node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/destroy": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", + "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/ecdsa-sig-formatter": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", + "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", + "dependencies": { + "safe-buffer": "^5.0.1" + } + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" + }, + "node_modules/follow-redirects": { + "version": "1.15.2", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", + "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + }, + "node_modules/get-intrinsic": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.3.tgz", + "integrity": "sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==", + "dependencies": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/http-errors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", + "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", + "dependencies": { + "depd": "2.0.0", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "toidentifier": "1.0.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/https-proxy-agent/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/https-proxy-agent/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/jsonwebtoken": { + "version": "8.5.1", + "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-8.5.1.tgz", + "integrity": "sha512-XjwVfRS6jTMsqYs0EsuJ4LGxXV14zQybNd4L2r0UvbVnSF9Af8x7p5MzbJ90Ioz/9TI41/hTCvznF/loiSzn8w==", + "dependencies": { + "jws": "^3.2.2", + "lodash.includes": "^4.3.0", + "lodash.isboolean": "^3.0.3", + "lodash.isinteger": "^4.0.4", + "lodash.isnumber": "^3.0.3", + "lodash.isplainobject": "^4.0.6", + "lodash.isstring": "^4.0.1", + "lodash.once": "^4.0.0", + "ms": "^2.1.1", + "semver": "^5.6.0" + }, + "engines": { + "node": ">=4", + "npm": ">=1.4.28" + } + }, + "node_modules/jsonwebtoken/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, + "node_modules/jwa": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz", + "integrity": "sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA==", + "dependencies": { + "buffer-equal-constant-time": "1.0.1", + "ecdsa-sig-formatter": "1.0.11", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/jws": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz", + "integrity": "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==", + "dependencies": { + "jwa": "^1.4.1", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + }, + "node_modules/lodash.includes": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", + "integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==" + }, + "node_modules/lodash.isboolean": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz", + "integrity": "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==" + }, + "node_modules/lodash.isinteger": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz", + "integrity": "sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==" + }, + "node_modules/lodash.isnumber": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz", + "integrity": "sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==" + }, + "node_modules/lodash.isplainobject": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", + "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==" + }, + "node_modules/lodash.isstring": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", + "integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==" + }, + "node_modules/lodash.once": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", + "integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==" + }, + "node_modules/media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + }, + "node_modules/object-inspect": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.2.tgz", + "integrity": "sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/pop-iterate": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/pop-iterate/-/pop-iterate-1.0.1.tgz", + "integrity": "sha512-HRCx4+KJE30JhX84wBN4+vja9bNfysxg1y28l0DuJmkoaICiv2ZSilKddbS48pq50P8d2erAhqDLbp47yv3MbQ==" + }, + "node_modules/q": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/q/-/q-2.0.3.tgz", + "integrity": "sha512-gv6vLGcmAOg96/fgo3d9tvA4dJNZL3fMyBqVRrGxQ+Q/o4k9QzbJ3NQF9cOO/71wRodoXhaPgphvMFU68qVAJQ==", + "dependencies": { + "asap": "^2.0.0", + "pop-iterate": "^1.0.1", + "weak-map": "^1.0.5" + } + }, + "node_modules/qs": { + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", + "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", + "dependencies": { + "side-channel": "^1.0.4" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/querystringify": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", + "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==" + }, + "node_modules/raw-body": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz", + "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==", + "dependencies": { + "bytes": "3.1.2", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==" + }, + "node_modules/rootpath": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/rootpath/-/rootpath-0.1.2.tgz", + "integrity": "sha512-R3wLbuAYejpxQjL/SjXo1Cjv4wcJECnMRT/FlcCfTwCBhaji9rWaRCoVEQ1SPiTJ4kKK+yh+bZLAV7SCafoDDw==" + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "node_modules/scmp": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/scmp/-/scmp-2.1.0.tgz", + "integrity": "sha512-o/mRQGk9Rcer/jEEw/yw4mwo3EU/NvYvp577/Btqrym9Qy5/MdWGBqipbALgd2lrdWTJ5/gqDusxfnQBxOxT2Q==" + }, + "node_modules/semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" + }, + "node_modules/side-channel": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "dependencies": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/statuses": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", + "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/twilio": { + "version": "3.82.2", + "resolved": "https://registry.npmjs.org/twilio/-/twilio-3.82.2.tgz", + "integrity": "sha512-LHqTrrpEROY3dqsSIzHTPeJ0sxjv8j0J3N0CRyrJybhs+iLIzJ3OeLrSIzlJo4x+pRFY4F1dBNCfMjTl4fwf2g==", + "dependencies": { + "axios": "^0.26.1", + "dayjs": "^1.8.29", + "https-proxy-agent": "^5.0.0", + "jsonwebtoken": "^8.5.1", + "lodash": "^4.17.21", + "q": "2.0.x", + "qs": "^6.9.4", + "rootpath": "^0.1.2", + "scmp": "^2.1.0", + "url-parse": "^1.5.9", + "xmlbuilder": "^13.0.2" + }, + "engines": { + "node": ">=6.0" + } + }, + "node_modules/type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "dependencies": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/url-parse": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", + "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", + "dependencies": { + "querystringify": "^2.1.1", + "requires-port": "^1.0.0" + } + }, + "node_modules/weak-map": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/weak-map/-/weak-map-1.0.8.tgz", + "integrity": "sha512-lNR9aAefbGPpHO7AEnY0hCFjz1eTkWCXYvkTRrTHs9qv8zJp+SkVYpzfLIFXQQiG3tVvbNFQgVg2bQS8YGgxyw==" + }, + "node_modules/xmlbuilder": { + "version": "13.0.2", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-13.0.2.tgz", + "integrity": "sha512-Eux0i2QdDYKbdbA6AM6xE4m6ZTZr4G4xF9kahI2ukSEMCzwce2eX9WlTI5J3s+NU7hpasFsr8hWIONae7LluAQ==", + "engines": { + "node": ">=6.0" + } + } + }, + "dependencies": { + "agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "requires": { + "debug": "4" + }, + "dependencies": { + "debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } + } + }, + "asap": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", + "integrity": "sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==" + }, + "axios": { + "version": "0.26.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz", + "integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==", + "requires": { + "follow-redirects": "^1.14.8" + } + }, + "body-parser": { + "version": "1.20.1", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz", + "integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==", + "requires": { + "bytes": "3.1.2", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "on-finished": "2.4.1", + "qs": "6.11.0", + "raw-body": "2.5.1", + "type-is": "~1.6.18", + "unpipe": "1.0.0" + } + }, + "buffer-equal-constant-time": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", + "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==" + }, + "bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==" + }, + "call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "requires": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + } + }, + "content-type": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", + "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" + }, + "dayjs": { + "version": "1.11.5", + "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.5.tgz", + "integrity": "sha512-CAdX5Q3YW3Gclyo5Vpqkgpj8fSdLQcRuzfX6mC6Phy0nfJ0eGYOeS7m4mt2plDWLAtA4TqTakvbboHvUxfe4iA==" + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==" + }, + "destroy": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", + "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==" + }, + "ecdsa-sig-formatter": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", + "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" + }, + "follow-redirects": { + "version": "1.15.2", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", + "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==" + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + }, + "get-intrinsic": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.3.tgz", + "integrity": "sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==", + "requires": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.3" + } + }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "requires": { + "function-bind": "^1.1.1" + } + }, + "has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==" + }, + "http-errors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", + "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", + "requires": { + "depd": "2.0.0", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "toidentifier": "1.0.1" + } + }, + "https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "requires": { + "agent-base": "6", + "debug": "4" + }, + "dependencies": { + "debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } + } + }, + "iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "jsonwebtoken": { + "version": "8.5.1", + "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-8.5.1.tgz", + "integrity": "sha512-XjwVfRS6jTMsqYs0EsuJ4LGxXV14zQybNd4L2r0UvbVnSF9Af8x7p5MzbJ90Ioz/9TI41/hTCvznF/loiSzn8w==", + "requires": { + "jws": "^3.2.2", + "lodash.includes": "^4.3.0", + "lodash.isboolean": "^3.0.3", + "lodash.isinteger": "^4.0.4", + "lodash.isnumber": "^3.0.3", + "lodash.isplainobject": "^4.0.6", + "lodash.isstring": "^4.0.1", + "lodash.once": "^4.0.0", + "ms": "^2.1.1", + "semver": "^5.6.0" + }, + "dependencies": { + "ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + } + } + }, + "jwa": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz", + "integrity": "sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA==", + "requires": { + "buffer-equal-constant-time": "1.0.1", + "ecdsa-sig-formatter": "1.0.11", + "safe-buffer": "^5.0.1" + } + }, + "jws": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz", + "integrity": "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==", + "requires": { + "jwa": "^1.4.1", + "safe-buffer": "^5.0.1" + } + }, + "lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + }, + "lodash.includes": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", + "integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==" + }, + "lodash.isboolean": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz", + "integrity": "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==" + }, + "lodash.isinteger": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz", + "integrity": "sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==" + }, + "lodash.isnumber": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz", + "integrity": "sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==" + }, + "lodash.isplainobject": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", + "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==" + }, + "lodash.isstring": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", + "integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==" + }, + "lodash.once": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", + "integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==" + }, + "media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==" + }, + "mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==" + }, + "mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "requires": { + "mime-db": "1.52.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + }, + "object-inspect": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.2.tgz", + "integrity": "sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ==" + }, + "on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "requires": { + "ee-first": "1.1.1" + } + }, + "pop-iterate": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/pop-iterate/-/pop-iterate-1.0.1.tgz", + "integrity": "sha512-HRCx4+KJE30JhX84wBN4+vja9bNfysxg1y28l0DuJmkoaICiv2ZSilKddbS48pq50P8d2erAhqDLbp47yv3MbQ==" + }, + "q": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/q/-/q-2.0.3.tgz", + "integrity": "sha512-gv6vLGcmAOg96/fgo3d9tvA4dJNZL3fMyBqVRrGxQ+Q/o4k9QzbJ3NQF9cOO/71wRodoXhaPgphvMFU68qVAJQ==", + "requires": { + "asap": "^2.0.0", + "pop-iterate": "^1.0.1", + "weak-map": "^1.0.5" + } + }, + "qs": { + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", + "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", + "requires": { + "side-channel": "^1.0.4" + } + }, + "querystringify": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", + "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==" + }, + "raw-body": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz", + "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==", + "requires": { + "bytes": "3.1.2", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + } + }, + "requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==" + }, + "rootpath": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/rootpath/-/rootpath-0.1.2.tgz", + "integrity": "sha512-R3wLbuAYejpxQjL/SjXo1Cjv4wcJECnMRT/FlcCfTwCBhaji9rWaRCoVEQ1SPiTJ4kKK+yh+bZLAV7SCafoDDw==" + }, + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "scmp": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/scmp/-/scmp-2.1.0.tgz", + "integrity": "sha512-o/mRQGk9Rcer/jEEw/yw4mwo3EU/NvYvp577/Btqrym9Qy5/MdWGBqipbALgd2lrdWTJ5/gqDusxfnQBxOxT2Q==" + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" + }, + "setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" + }, + "side-channel": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "requires": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + } + }, + "statuses": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", + "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==" + }, + "toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==" + }, + "twilio": { + "version": "3.82.2", + "resolved": "https://registry.npmjs.org/twilio/-/twilio-3.82.2.tgz", + "integrity": "sha512-LHqTrrpEROY3dqsSIzHTPeJ0sxjv8j0J3N0CRyrJybhs+iLIzJ3OeLrSIzlJo4x+pRFY4F1dBNCfMjTl4fwf2g==", + "requires": { + "axios": "^0.26.1", + "dayjs": "^1.8.29", + "https-proxy-agent": "^5.0.0", + "jsonwebtoken": "^8.5.1", + "lodash": "^4.17.21", + "q": "2.0.x", + "qs": "^6.9.4", + "rootpath": "^0.1.2", + "scmp": "^2.1.0", + "url-parse": "^1.5.9", + "xmlbuilder": "^13.0.2" + } + }, + "type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "requires": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + } + }, + "unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==" + }, + "url-parse": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", + "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", + "requires": { + "querystringify": "^2.1.1", + "requires-port": "^1.0.0" + } + }, + "weak-map": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/weak-map/-/weak-map-1.0.8.tgz", + "integrity": "sha512-lNR9aAefbGPpHO7AEnY0hCFjz1eTkWCXYvkTRrTHs9qv8zJp+SkVYpzfLIFXQQiG3tVvbNFQgVg2bQS8YGgxyw==" + }, + "xmlbuilder": { + "version": "13.0.2", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-13.0.2.tgz", + "integrity": "sha512-Eux0i2QdDYKbdbA6AM6xE4m6ZTZr4G4xF9kahI2ukSEMCzwce2eX9WlTI5J3s+NU7hpasFsr8hWIONae7LluAQ==" + } + } +} diff --git a/src/plugins/twilio/package.json b/src/plugins/twilio/package.json new file mode 100644 index 00000000..c4a212dc --- /dev/null +++ b/src/plugins/twilio/package.json @@ -0,0 +1,6 @@ +{ + "dependencies": { + "body-parser": "^1.20.0", + "twilio": "^3.82.0" + } +} diff --git a/src/plugins/twilio/plugin.json b/src/plugins/twilio/plugin.json new file mode 100644 index 00000000..fd721bfc --- /dev/null +++ b/src/plugins/twilio/plugin.json @@ -0,0 +1,7 @@ +{ + "author": "Artemus", + "name": "Twilio", + "version": "1.0.1", + "tscordRequiredVersion": ">=2.0.0", + "description": "This plugin allows you to send and receive SMS through Twilio" +} \ No newline at end of file diff --git a/src/plugins/twilio/services/Twilio.ts b/src/plugins/twilio/services/Twilio.ts new file mode 100644 index 00000000..a701e10d --- /dev/null +++ b/src/plugins/twilio/services/Twilio.ts @@ -0,0 +1,37 @@ +import { singleton } from 'tsyringe' +import EventEmitter from 'node:events'; +import { Twilio as TwilioSDK } from 'twilio' + +import { twilioConfig, twilioPhoneNumbers } from "../config" + + +@singleton() +export class Twilio extends EventEmitter { + public client: TwilioSDK; + + constructor() { + super() + if (twilioConfig.enabled) this.client = new TwilioSDK( + process.env["TWILIO_ACCOUNT_SID"] as string, + process.env["TWILIO_AUTH_TOKEN"] as string, + { logLevel: twilioConfig.debug ? "debug" : undefined } + ) + } + + public async sendSMS(from: typeof twilioPhoneNumbers[number], to: string, body: string) { + if (!twilioConfig.enabled || !this.client) return; + if (!twilioPhoneNumbers.includes(from)) throw new Error(`Invalid source phone number: ${from}`); + + return this.client.messages.create({ from, to, body }); + } +} + +export interface Twilio { + on( + event: U, listener: TwilioPlugin.Events[U] + ): this; + + emit( + event: U, ...args: Parameters + ): boolean; +} \ No newline at end of file diff --git a/src/plugins/twilio/services/index.ts b/src/plugins/twilio/services/index.ts new file mode 100644 index 00000000..97ac4a22 --- /dev/null +++ b/src/plugins/twilio/services/index.ts @@ -0,0 +1 @@ +export * from './Twilio' \ No newline at end of file diff --git a/src/plugins/twilio/utils/types/config.d.ts b/src/plugins/twilio/utils/types/config.d.ts new file mode 100644 index 00000000..657b0dad --- /dev/null +++ b/src/plugins/twilio/utils/types/config.d.ts @@ -0,0 +1,7 @@ +declare namespace TwilioPlugin { + type ConfigType = { + enabled: boolean, + debug: boolean, + apiValidateSource: boolean, + } +} \ No newline at end of file diff --git a/src/plugins/twilio/utils/types/environements.d.ts b/src/plugins/twilio/utils/types/environements.d.ts new file mode 100644 index 00000000..a05bd3d5 --- /dev/null +++ b/src/plugins/twilio/utils/types/environements.d.ts @@ -0,0 +1,12 @@ +declare global { + namespace NodeJS { + interface ProcessEnv { + TWILIO_ACCOUNT_SID: string; + TWILIO_AUTH_TOKEN: string; + } + } +} + + // If this file has no import/export statements (i.e. is a script) + // convert it into a module by adding an empty export statement. + export {} \ No newline at end of file diff --git a/src/plugins/twilio/utils/types/twilio.d.ts b/src/plugins/twilio/utils/types/twilio.d.ts new file mode 100644 index 00000000..4cabf155 --- /dev/null +++ b/src/plugins/twilio/utils/types/twilio.d.ts @@ -0,0 +1,30 @@ +declare namespace TwilioPlugin { + type IncomingMessage = { + messageSid: string; + smsSid?: string; + accountSid: string; + messagingServiceSid?: string; + body: string; + from: string; + to: string; + geo: { + from: { + country?: string; + state?: string; + city?: string; + zip?: string; + }, + to: { + country?: string; + state?: string; + city?: string; + zip?: string; + } + }; + apiVersion: string; + } + + interface Events { + sms: (incomingMessage: IncomingMessage) => void; + } +} \ No newline at end of file diff --git a/src/services/ImagesUpload.ts b/src/services/ImagesUpload.ts index e08fc50e..2f0a622f 100644 --- a/src/services/ImagesUpload.ts +++ b/src/services/ImagesUpload.ts @@ -80,7 +80,7 @@ export class ImagesUpload { }) if (!imageInDb) await this.addNewImageToImgur(imagePath, imageHash) - else if( + else if ( imageInDb && ( imageInDb.basePath != imagePath.split('/').slice(0, -1).join('/') || imageInDb.fileName != imagePath.split('/').slice(-1)[0] ) diff --git a/src/services/Pastebin.ts b/src/services/Pastebin.ts index 0af97403..aabbbbe2 100644 --- a/src/services/Pastebin.ts +++ b/src/services/Pastebin.ts @@ -18,7 +18,7 @@ export class Pastebin { private async waitForToken(): Promise { - while(!this.client.getToken()) { + while (!this.client.getToken()) { await new Promise(resolve => setTimeout(resolve, 100)) } } @@ -56,7 +56,7 @@ export class Pastebin { const pastes = await this.db.get(PastebinEntity).find({ lifetime: { $gt: 0 } }) - for(const paste of pastes) { + for (const paste of pastes) { const diff = dayjs().diff(dayjs(paste.createdAt), 'day') if (diff >= paste.lifetime) { diff --git a/src/services/PluginsManager.ts b/src/services/PluginsManager.ts index 7f3187f5..e5504bbc 100644 --- a/src/services/PluginsManager.ts +++ b/src/services/PluginsManager.ts @@ -8,6 +8,7 @@ import { BaseTranslation } from "typesafe-i18n" import { locales } from "@i18n" import { AnyEntity, EntityClass } from "@mikro-orm/core" import { cwd } from "process" +import { getSourceCodeLocation } from "@utils/functions" @singleton() export class PluginsManager { @@ -18,13 +19,16 @@ export class PluginsManager { public async loadPlugins(): Promise { - const pluginPaths = resolve(process.cwd() + "/src/plugins/*") + const pluginPaths = resolve(`${getSourceCodeLocation()}/plugins/*`) + + console.log(pluginPaths) for (const path of pluginPaths) { + const plugin = new Plugin(path) await plugin.load() - if(plugin.isValid()) this.plugins.push(plugin) + if (plugin.isValid()) this.plugins.push(plugin) } } @@ -48,7 +52,7 @@ export class PluginsManager { let services: { [key: string]: any } = {} for (const plugin of this._plugins) { - for(const service in plugin.services) { + for (const service in plugin.services) { services[service] = new plugin.services[service]() } } @@ -66,22 +70,22 @@ export class PluginsManager { let translations: { [key: string]: BaseTranslation } = {} for (const locale of locales) { - const path = process.cwd() + "/src/i18n/"+locale - if(fs.existsSync(path)) translations[locale] = (await import(path))?.default + const path = getSourceCodeLocation + "/i18n/"+locale + if (fs.existsSync(path)) translations[locale] = (await import(path))?.default } for (const plugin of this._plugins) { for (const locale in plugin.translations) { - if(!translations[locale]) translations[locale] = {} - if(!namespaces[locale]) namespaces[locale] = [] + if (!translations[locale]) translations[locale] = {} + if (!namespaces[locale]) namespaces[locale] = [] translations[locale] = { ...translations[locale], [plugin.name]: plugin.translations[locale] } namespaces[locale].push(plugin.name) } } - for(const locale in translations) { - if(!locales.includes(locale as any)) continue + for (const locale in translations) { + if (!locales.includes(locale as any)) continue localeMapping.push({ locale, translations: translations[locale], @@ -90,9 +94,10 @@ export class PluginsManager { } const pluginsName = this._plugins.map(plugin => plugin.name) - for(const path of await resolve(process.cwd() + "/src/i18n/*/*/index.ts")) { + for (const path of await resolve(getSourceCodeLocation() + '/i18n/*/*/index.ts')) { + const name = path.split("/").at(-2) || "" - if(!pluginsName.includes(name)) { + if (!pluginsName.includes(name)) { await fs.rmSync(path.slice(0, -8), { recursive: true, force: true }) } } diff --git a/src/utils/classes/Plugin.ts b/src/utils/classes/Plugin.ts index 8b5e3200..b74535b1 100644 --- a/src/utils/classes/Plugin.ts +++ b/src/utils/classes/Plugin.ts @@ -1,12 +1,12 @@ import { AnyEntity, EntityClass } from "@mikro-orm/core" import { importx, resolve } from "@discordx/importer" import { BaseTranslation } from "typesafe-i18n" -import dotenv from "dotenv" import semver from "semver" import fs from "fs" import { generalConfig } from "@config" import { BaseController } from "@utils/classes" +import { getSourceCodeLocation } from "@utils/functions" import { locales } from "@i18n" export class Plugin { @@ -28,25 +28,26 @@ export class Plugin { } public async load(): Promise { - // Check if the plugin.json is present - if(!await fs.existsSync(this._path + "/plugin.json")) return this.stopLoad("plugin.json not found") - // Read plugin.json + // check if the plugin.json is present + if (!await fs.existsSync(this._path + "/plugin.json")) return this.stopLoad("plugin.json not found") + + // read plugin.json const pluginConfig = await import(this._path + "/plugin.json") - // Check if the plugin.json is valid - if(!pluginConfig.name) return this.stopLoad("Missing name in plugin.json") - if(!pluginConfig.version) return this.stopLoad("Missing version in plugin.json") - if(!pluginConfig.tscordRequiredVersion) return this.stopLoad("Missing tscordRequiredVersion in plugin.json") + // check if the plugin.json is valid + if (!pluginConfig.name) return this.stopLoad("Missing name in plugin.json") + if (!pluginConfig.version) return this.stopLoad("Missing version in plugin.json") + if (!pluginConfig.tscordRequiredVersion) return this.stopLoad("Missing tscordRequiredVersion in plugin.json") - // Check plugin.json values - if(!pluginConfig.name.match(/^[a-zA-Z0-9-_]+$/)) return this.stopLoad("Invalid name in plugin.json") - if(!semver.valid(pluginConfig.version)) return this.stopLoad("Invalid version in plugin.json") + // check plugin.json values + if (!pluginConfig.name.match(/^[a-zA-Z0-9-_]+$/)) return this.stopLoad("Invalid name in plugin.json") + if (!semver.valid(pluginConfig.version)) return this.stopLoad("Invalid version in plugin.json") - // Check if the plugin is compatible with the current version of Tscord - if(!semver.satisfies(generalConfig.__templateVersion, pluginConfig.tscordRequiredVersion)) return this.stopLoad(`Incompatible with the current version of Tscord (v${generalConfig.__templateVersion})`) + // check if the plugin is compatible with the current version of Tscord + if (!semver.satisfies(generalConfig.__templateVersion, pluginConfig.tscordRequiredVersion)) return this.stopLoad(`Incompatible with the current version of Tscord (v${generalConfig.__templateVersion})`) - // Assign common values + // assign common values this._name = pluginConfig.name this._version = pluginConfig.version @@ -63,17 +64,17 @@ export class Plugin { } private async getControllers(): Promise<{ [key: string]: typeof BaseController }> { - if(!fs.existsSync(this._path + "/api/controllers")) return {} + if (!fs.existsSync(this._path + "/api/controllers")) return {} return import(this._path + "/api/controllers") } private async getEntities(): Promise<{ [key: string]: EntityClass }> { - if(!fs.existsSync(this._path + "/entities")) return {} + if (!fs.existsSync(this._path + "/entities")) return {} return import(this._path + "/entities") } private async getServices(): Promise<{ [key: string]: any }> { - if(!fs.existsSync(this._path + "/services")) return {} + if (!fs.existsSync(this._path + "/services")) return {} return import(this._path + "/services") } @@ -88,7 +89,7 @@ export class Plugin { } for (const defaultLocale of locales) { - const path = `${process.cwd()}/src/i18n/${defaultLocale}/${this._name}/_custom.` + const path = `${getSourceCodeLocation()}/i18n/${defaultLocale}/${this._name}/_custom.` if (fs.existsSync(path + "js")) translations[defaultLocale] = (await import(path + "js")).default else if (fs.existsSync(path + "ts")) translations[defaultLocale] = (await import(path + "ts")).default } @@ -97,7 +98,7 @@ export class Plugin { } public execMain(): void { - if(!fs.existsSync(this._path + "/main.ts")) return + if (!fs.existsSync(this._path + "/main.ts")) return import(this._path + "/main.ts") } diff --git a/src/utils/functions/dependency.ts b/src/utils/functions/dependency.ts index 63e37c8f..e4982044 100644 --- a/src/utils/functions/dependency.ts +++ b/src/utils/functions/dependency.ts @@ -3,7 +3,7 @@ import { F } from 'ts-toolbelt' export const resolveDependency = async (token: InjectionToken, interval: number = 500): Promise => { - while(!container.isRegistered(token, true)) { + while (!container.isRegistered(token, true)) { await new Promise(resolve => setTimeout(resolve, interval)) } diff --git a/src/utils/functions/fs.ts b/src/utils/functions/files.ts similarity index 81% rename from src/utils/functions/fs.ts rename to src/utils/functions/files.ts index 0d4a02ac..54e316a6 100644 --- a/src/utils/functions/fs.ts +++ b/src/utils/functions/files.ts @@ -28,4 +28,8 @@ export const getFiles = (path: string): string[] => { export const fileOrDirectoryExists = (path: string): boolean => { return fs.existsSync(path) +} + +export const getSourceCodeLocation = (): string => { + return process.cwd() + '/' + (process.env['NODE_ENV'] === 'production' ? 'build' : 'src') } \ No newline at end of file diff --git a/src/utils/functions/index.ts b/src/utils/functions/index.ts index e73571e2..f74f5b80 100644 --- a/src/utils/functions/index.ts +++ b/src/utils/functions/index.ts @@ -16,4 +16,4 @@ export * from './devs' export * from './dependency' export * from './error' export * from './localization' -export * from './fs' \ No newline at end of file +export * from './files' \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index d4ecfc2c..cad52f85 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -21,40 +21,41 @@ "baseUrl": ".", "paths": { - "@decorators": ["src/utils/decorators"], - "@decorators/*": ["src/plugins/*/utils/decorators"], - "@errors": ["src/utils/errors"], - "@errors/*": ["src/plugins/*/utils/errors"], + "@decorators": ["src/utils/decorators"], + "@decorators/*": ["src/plugins/*/utils/decorators"], - "@entities": ["src/entities"], - "@entities/*": ["src/plugins/*/entities"], + "@errors": ["src/utils/errors"], + "@errors/*": ["src/plugins/*/utils/errors"], - "@guards": ["src/guards"], - "@guards/*": ["src/plugins/*/guards"], + "@entities": ["src/entities"], + "@entities/*": ["src/plugins/*/entities"], + + "@guards": ["src/guards"], + "@guards/*": ["src/plugins/*/guards"], - "@services": ["src/services"], - "@services/*": ["src/plugins/*/services"], + "@services": ["src/services"], + "@services/*": ["src/plugins/*/services"], - "@i18n": ["src/i18n"], - "@i18n/*": ["src/plugins/*/i18n"], + "@i18n": ["src/i18n"], + "@i18n/*": ["src/plugins/*/i18n"], - "@config": ["src/config"], - "@config/*": ["src/plugins/*/config"], + "@config": ["src/config"], + "@config/*": ["src/plugins/*/config"], - "@utils/classes": ["src/utils/classes"], - "@utils/classes/*": ["src/plugins/*/utils/classes"], + "@utils/classes": ["src/utils/classes"], + "@utils/classes/*": ["src/plugins/*/utils/classes"], - "@utils/functions": ["src/utils/functions"], - "@utils/functions/*": ["src/plugins/*/utils/functions"], + "@utils/functions": ["src/utils/functions"], + "@utils/functions/*": ["src/plugins/*/utils/functions"], - "@api/controllers": ["src/api/controllers"], - "@api/controllers/*": ["src/plugins/*/api/controllers"], + "@api/controllers": ["src/api/controllers"], + "@api/controllers/*": ["src/plugins/*/api/controllers"], - "@api/middlewares": ["src/api/middlewares"], - "@api/middlewares/*": ["src/plugins/*/api/middlewares"], + "@api/middlewares": ["src/api/middlewares"], + "@api/middlewares/*": ["src/plugins/*/api/middlewares"], - "@api/server": ["src/api/server.ts"] + "@api/server": ["src/api/server.ts"] } }, From 8c39f276424184a3ebeacd40ef4d721ca762d477 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartholom=C3=A9=20Gili?= Date: Mon, 17 Oct 2022 09:21:20 +0200 Subject: [PATCH 26/29] fix(#73): plugins packages install on build --- .docker/app/Dockerfile | 4 ++-- package-lock.json | 30 +++++++++++++++--------------- package.json | 10 +++++----- src/services/PluginsManager.ts | 2 -- 4 files changed, 22 insertions(+), 24 deletions(-) diff --git a/.docker/app/Dockerfile b/.docker/app/Dockerfile index 5ce83164..6f715954 100644 --- a/.docker/app/Dockerfile +++ b/.docker/app/Dockerfile @@ -11,7 +11,7 @@ COPY src ./src # Install dependencies from package-lock.json # and install dependencies for plugins (because postinstall script doesn't work in docker) -RUN npm ci && find src/plugins ! -path "*/node_modules/*" -name "package.json" -execdir npm install \; +RUN npm ci COPY .swcrc . COPY tsconfig.json . @@ -38,7 +38,7 @@ COPY --from=build-runner /tmp/app/build /app/build # Install dependencies from package-lock.json # and install dependencies for plugins (because plugins:install script doesn't work in docker) -RUN npm ci --omit=dev && mkdir -p build/plugins && find build/plugins ! -path "*/node_modules/*" -name "package.json" -execdir npm install --omit=dev \; && npm cache clean --force +RUN npm ci --omit=dev && npm cache clean --force # Finaly start the bot CMD ["node", "build/main.js"] \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index beb7da88..c36f7b4c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -50,7 +50,7 @@ "http-status-codes": "~2.2.0", "image-hash": "~5.3.1", "imgur": "~2.2.0", - "installoop": "^1.0.4", + "installoop": "^1.1.0", "joi": "~17.6.2", "node-os-utils": "~1.3.7", "ora": "~5.4.1", @@ -5830,12 +5830,12 @@ } }, "node_modules/installoop": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/installoop/-/installoop-1.0.4.tgz", - "integrity": "sha512-77PRTph037Q1hXn9iEnbGYd1pgpKoU0Y3LmmenwOHUhlstKQ+WSVTnAzu9xKPSlPR4mPUd6gnEAtXKcXyhGhig==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/installoop/-/installoop-1.1.0.tgz", + "integrity": "sha512-Yl0Yi/AIlyp6sbeQs9jS6PnPLGv1TluD7ZBU9L+trrf6lkudwDvnWyWF9jSRFt5DCPGZrhl3XJXKg+37ljJTlA==", "dependencies": { "arg": "^5.0.2", - "spawnise": "^1.0.0" + "spawnise": "^1.1.0" }, "bin": { "installoop": "build/index.js" @@ -9618,9 +9618,9 @@ } }, "node_modules/spawnise": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/spawnise/-/spawnise-1.0.0.tgz", - "integrity": "sha512-HRmGun1rESPpAeq4oU0Nzpg360ffqxjYvS3w17ZR4hp82MX2jHkvljtT0Z304alO3dNHHpfzeaENdUXdjvFJbw==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/spawnise/-/spawnise-1.1.0.tgz", + "integrity": "sha512-ie/bBCJt9x2lB4nL4brP7wK5sYWv9S79PpJKFO4g4fndQU1QpasHnP1326daR6FrWjzBOLDWIV0mCKdYdZAWKA==", "dependencies": { "bl": "^5.0.0", "cross-spawn": "^7.0.3" @@ -14878,12 +14878,12 @@ } }, "installoop": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/installoop/-/installoop-1.0.4.tgz", - "integrity": "sha512-77PRTph037Q1hXn9iEnbGYd1pgpKoU0Y3LmmenwOHUhlstKQ+WSVTnAzu9xKPSlPR4mPUd6gnEAtXKcXyhGhig==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/installoop/-/installoop-1.1.0.tgz", + "integrity": "sha512-Yl0Yi/AIlyp6sbeQs9jS6PnPLGv1TluD7ZBU9L+trrf6lkudwDvnWyWF9jSRFt5DCPGZrhl3XJXKg+37ljJTlA==", "requires": { "arg": "^5.0.2", - "spawnise": "^1.0.0" + "spawnise": "^1.1.0" }, "dependencies": { "arg": { @@ -17429,9 +17429,9 @@ } }, "spawnise": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/spawnise/-/spawnise-1.0.0.tgz", - "integrity": "sha512-HRmGun1rESPpAeq4oU0Nzpg360ffqxjYvS3w17ZR4hp82MX2jHkvljtT0Z304alO3dNHHpfzeaENdUXdjvFJbw==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/spawnise/-/spawnise-1.1.0.tgz", + "integrity": "sha512-ie/bBCJt9x2lB4nL4brP7wK5sYWv9S79PpJKFO4g4fndQU1QpasHnP1326daR6FrWjzBOLDWIV0mCKdYdZAWKA==", "requires": { "bl": "^5.0.0", "cross-spawn": "^7.0.3" diff --git a/package.json b/package.json index 23816726..d7630e11 100644 --- a/package.json +++ b/package.json @@ -5,10 +5,10 @@ "license": "MIT", "main": "build/main.js", "scripts": { - "build": "npm run build:clean && swc src -d build -D && npm run type:check", - "build:changelog": "npx @discordx/changelog --root=src", + "build": "npm run build:clean && npm run build:compile && npm run plugins:install && npm run type:check", "build:start": "npm run build && npm run start", - "build:clean": "rimraf build", + "build:compile": "swc src -d build -D && rimraf build/plugins/**/node_modules/", + "build:clean": "rimraf build/", "start": "cross-env NODE_ENV=production node build/main.js", "dev": "cross-env NODE_ENV=development nodemon --exec node -r @swc-node/register src/main.ts", "dev:start": "cross-env NODE_ENV=production node -r @swc-node/register src/main.ts", @@ -19,7 +19,7 @@ "migration:up": "npx mikro-orm migration:up", "migration:down": "npx mikro-orm migration:down", "plugins:install": "installoop --rootDir=./src/plugins --rootDir=./build/plugins", - "plop": "plop --plopfile ./cli/plopfile.js" + "postinstall": "npm run plugins:install" }, "dependencies": { "@discordx/importer": "~1.1.10", @@ -63,7 +63,7 @@ "http-status-codes": "~2.2.0", "image-hash": "~5.3.1", "imgur": "~2.2.0", - "installoop": "^1.0.4", + "installoop": "^1.1.0", "joi": "~17.6.2", "node-os-utils": "~1.3.7", "ora": "~5.4.1", diff --git a/src/services/PluginsManager.ts b/src/services/PluginsManager.ts index e5504bbc..9ba4e614 100644 --- a/src/services/PluginsManager.ts +++ b/src/services/PluginsManager.ts @@ -21,8 +21,6 @@ export class PluginsManager { const pluginPaths = resolve(`${getSourceCodeLocation()}/plugins/*`) - console.log(pluginPaths) - for (const path of pluginPaths) { const plugin = new Plugin(path) From 53d2b097898f39b984388ba74bffe3267fd5325a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartholom=C3=A9=20Gili?= Date: Mon, 17 Oct 2022 21:31:00 +0200 Subject: [PATCH 27/29] chore: remove `twilio` plugin from versioning oops --- package.json | 5 +- src/plugins/twilio/.env.example | 3 - src/plugins/twilio/api/controllers/index.ts | 1 - src/plugins/twilio/api/controllers/twilio.ts | 53 - src/plugins/twilio/config/index.ts | 1 - src/plugins/twilio/config/twilio.ts | 9 - src/plugins/twilio/package-lock.json | 1071 ----------------- src/plugins/twilio/package.json | 6 - src/plugins/twilio/plugin.json | 7 - src/plugins/twilio/services/Twilio.ts | 37 - src/plugins/twilio/services/index.ts | 1 - src/plugins/twilio/utils/types/config.d.ts | 7 - .../twilio/utils/types/environements.d.ts | 12 - src/plugins/twilio/utils/types/twilio.d.ts | 30 - 14 files changed, 3 insertions(+), 1240 deletions(-) delete mode 100644 src/plugins/twilio/.env.example delete mode 100644 src/plugins/twilio/api/controllers/index.ts delete mode 100644 src/plugins/twilio/api/controllers/twilio.ts delete mode 100644 src/plugins/twilio/config/index.ts delete mode 100644 src/plugins/twilio/config/twilio.ts delete mode 100644 src/plugins/twilio/package-lock.json delete mode 100644 src/plugins/twilio/package.json delete mode 100644 src/plugins/twilio/plugin.json delete mode 100644 src/plugins/twilio/services/Twilio.ts delete mode 100644 src/plugins/twilio/services/index.ts delete mode 100644 src/plugins/twilio/utils/types/config.d.ts delete mode 100644 src/plugins/twilio/utils/types/environements.d.ts delete mode 100644 src/plugins/twilio/utils/types/twilio.d.ts diff --git a/package.json b/package.json index d7630e11..652b66a9 100644 --- a/package.json +++ b/package.json @@ -5,10 +5,11 @@ "license": "MIT", "main": "build/main.js", "scripts": { - "build": "npm run build:clean && npm run build:compile && npm run plugins:install && npm run type:check", + "build": "npm run build:clean && npm run build:compile && npm run build:plugins && npm run type:check", "build:start": "npm run build && npm run start", "build:compile": "swc src -d build -D && rimraf build/plugins/**/node_modules/", "build:clean": "rimraf build/", + "build:plugins": "installoop --rootDir=./build/plugins", "start": "cross-env NODE_ENV=production node build/main.js", "dev": "cross-env NODE_ENV=development nodemon --exec node -r @swc-node/register src/main.ts", "dev:start": "cross-env NODE_ENV=production node -r @swc-node/register src/main.ts", @@ -18,7 +19,7 @@ "migration:create": "npx mikro-orm migration:create", "migration:up": "npx mikro-orm migration:up", "migration:down": "npx mikro-orm migration:down", - "plugins:install": "installoop --rootDir=./src/plugins --rootDir=./build/plugins", + "plugins:install": "installoop --rootDir=./src/plugins", "postinstall": "npm run plugins:install" }, "dependencies": { diff --git a/src/plugins/twilio/.env.example b/src/plugins/twilio/.env.example deleted file mode 100644 index de818187..00000000 --- a/src/plugins/twilio/.env.example +++ /dev/null @@ -1,3 +0,0 @@ -# Twilio -TWILIO_ACCOUNT_SID="YOUR_TWILIO_ACCOUNT_SID" -TWILIO_AUTH_TOKEN="YOUR_TWILIO_AUTH_TOKEN" \ No newline at end of file diff --git a/src/plugins/twilio/api/controllers/index.ts b/src/plugins/twilio/api/controllers/index.ts deleted file mode 100644 index e5460761..00000000 --- a/src/plugins/twilio/api/controllers/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './twilio' \ No newline at end of file diff --git a/src/plugins/twilio/api/controllers/twilio.ts b/src/plugins/twilio/api/controllers/twilio.ts deleted file mode 100644 index 98ac0359..00000000 --- a/src/plugins/twilio/api/controllers/twilio.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { Context, Controller, PlatformContext, Post, UseBefore } from "@tsed/common" -import { BaseController } from "@utils/classes" -import bodyParser from "body-parser" -import { injectable } from "tsyringe" -import { webhook as TwilioWebhook } from 'twilio' -import MessagingResponse from 'twilio/lib/twiml/MessagingResponse' -import { twilioConfig } from "../../config" -import { Twilio } from "../../services" - -@Controller('/twilio') -@UseBefore(bodyParser.urlencoded({ extended: false })) -@injectable() -export class TwilioController extends BaseController { - - constructor( - private twilio: Twilio - ) { - super() - } - - - @Post("/sms") - @UseBefore(TwilioWebhook( { validate: twilioConfig.apiValidateSource } )) - async status(@Context() { request }: PlatformContext) { - - this.twilio.emit("sms", { - messageSid: request.body.MessageSid, - smsSid: request.body.SmsSid, - accountSid: request.body.AccountSid, - messagingServiceSid: request.body.MessagingServiceSid, - body: request.body.Body, - from: request.body.From, - to: request.body.To, - geo: { - from: { - country: request.body.FromCountry, - state: request.body.FromState, - city: request.body.FromCity, - zip: request.body.FromZip, - }, - to: { - country: request.body.ToCountry, - state: request.body.ToState, - city: request.body.ToCity, - zip: request.body.ToZip, - } - }, - apiVersion: request.body.ApiVersion - }) - - return new MessagingResponse() - } -} \ No newline at end of file diff --git a/src/plugins/twilio/config/index.ts b/src/plugins/twilio/config/index.ts deleted file mode 100644 index e5460761..00000000 --- a/src/plugins/twilio/config/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './twilio' \ No newline at end of file diff --git a/src/plugins/twilio/config/twilio.ts b/src/plugins/twilio/config/twilio.ts deleted file mode 100644 index 8da5705d..00000000 --- a/src/plugins/twilio/config/twilio.ts +++ /dev/null @@ -1,9 +0,0 @@ -export const twilioConfig: TwilioPlugin.ConfigType = { - enabled: false, - debug: false, - apiValidateSource: false, // Set to false if you are using a reverse-proxy -} - -export const twilioPhoneNumbers = [ - "+1XXXXXXXXXX" -] as const \ No newline at end of file diff --git a/src/plugins/twilio/package-lock.json b/src/plugins/twilio/package-lock.json deleted file mode 100644 index 50f79dd9..00000000 --- a/src/plugins/twilio/package-lock.json +++ /dev/null @@ -1,1071 +0,0 @@ -{ - "name": "twilio", - "lockfileVersion": 2, - "requires": true, - "packages": { - "": { - "dependencies": { - "body-parser": "^1.20.0", - "twilio": "^3.82.0" - } - }, - "node_modules/agent-base": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", - "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", - "dependencies": { - "debug": "4" - }, - "engines": { - "node": ">= 6.0.0" - } - }, - "node_modules/agent-base/node_modules/debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/agent-base/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" - }, - "node_modules/asap": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", - "integrity": "sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==" - }, - "node_modules/axios": { - "version": "0.26.1", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz", - "integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==", - "dependencies": { - "follow-redirects": "^1.14.8" - } - }, - "node_modules/body-parser": { - "version": "1.20.1", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz", - "integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==", - "dependencies": { - "bytes": "3.1.2", - "content-type": "~1.0.4", - "debug": "2.6.9", - "depd": "2.0.0", - "destroy": "1.2.0", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "on-finished": "2.4.1", - "qs": "6.11.0", - "raw-body": "2.5.1", - "type-is": "~1.6.18", - "unpipe": "1.0.0" - }, - "engines": { - "node": ">= 0.8", - "npm": "1.2.8000 || >= 1.4.16" - } - }, - "node_modules/buffer-equal-constant-time": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", - "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==" - }, - "node_modules/bytes": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", - "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/call-bind": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", - "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", - "dependencies": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/content-type": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", - "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/dayjs": { - "version": "1.11.5", - "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.5.tgz", - "integrity": "sha512-CAdX5Q3YW3Gclyo5Vpqkgpj8fSdLQcRuzfX6mC6Phy0nfJ0eGYOeS7m4mt2plDWLAtA4TqTakvbboHvUxfe4iA==" - }, - "node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/depd": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", - "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/destroy": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", - "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", - "engines": { - "node": ">= 0.8", - "npm": "1.2.8000 || >= 1.4.16" - } - }, - "node_modules/ecdsa-sig-formatter": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", - "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", - "dependencies": { - "safe-buffer": "^5.0.1" - } - }, - "node_modules/ee-first": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", - "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" - }, - "node_modules/follow-redirects": { - "version": "1.15.2", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", - "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", - "funding": [ - { - "type": "individual", - "url": "https://github.com/sponsors/RubenVerborgh" - } - ], - "engines": { - "node": ">=4.0" - }, - "peerDependenciesMeta": { - "debug": { - "optional": true - } - } - }, - "node_modules/function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" - }, - "node_modules/get-intrinsic": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.3.tgz", - "integrity": "sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==", - "dependencies": { - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "dependencies": { - "function-bind": "^1.1.1" - }, - "engines": { - "node": ">= 0.4.0" - } - }, - "node_modules/has-symbols": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", - "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/http-errors": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", - "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", - "dependencies": { - "depd": "2.0.0", - "inherits": "2.0.4", - "setprototypeof": "1.2.0", - "statuses": "2.0.1", - "toidentifier": "1.0.1" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/https-proxy-agent": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", - "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", - "dependencies": { - "agent-base": "6", - "debug": "4" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/https-proxy-agent/node_modules/debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/https-proxy-agent/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" - }, - "node_modules/iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "dependencies": { - "safer-buffer": ">= 2.1.2 < 3" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" - }, - "node_modules/jsonwebtoken": { - "version": "8.5.1", - "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-8.5.1.tgz", - "integrity": "sha512-XjwVfRS6jTMsqYs0EsuJ4LGxXV14zQybNd4L2r0UvbVnSF9Af8x7p5MzbJ90Ioz/9TI41/hTCvznF/loiSzn8w==", - "dependencies": { - "jws": "^3.2.2", - "lodash.includes": "^4.3.0", - "lodash.isboolean": "^3.0.3", - "lodash.isinteger": "^4.0.4", - "lodash.isnumber": "^3.0.3", - "lodash.isplainobject": "^4.0.6", - "lodash.isstring": "^4.0.1", - "lodash.once": "^4.0.0", - "ms": "^2.1.1", - "semver": "^5.6.0" - }, - "engines": { - "node": ">=4", - "npm": ">=1.4.28" - } - }, - "node_modules/jsonwebtoken/node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" - }, - "node_modules/jwa": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz", - "integrity": "sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA==", - "dependencies": { - "buffer-equal-constant-time": "1.0.1", - "ecdsa-sig-formatter": "1.0.11", - "safe-buffer": "^5.0.1" - } - }, - "node_modules/jws": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz", - "integrity": "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==", - "dependencies": { - "jwa": "^1.4.1", - "safe-buffer": "^5.0.1" - } - }, - "node_modules/lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" - }, - "node_modules/lodash.includes": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", - "integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==" - }, - "node_modules/lodash.isboolean": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz", - "integrity": "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==" - }, - "node_modules/lodash.isinteger": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz", - "integrity": "sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==" - }, - "node_modules/lodash.isnumber": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz", - "integrity": "sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==" - }, - "node_modules/lodash.isplainobject": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", - "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==" - }, - "node_modules/lodash.isstring": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", - "integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==" - }, - "node_modules/lodash.once": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", - "integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==" - }, - "node_modules/media-typer": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", - "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mime-db": { - "version": "1.52.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mime-types": { - "version": "2.1.35", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", - "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", - "dependencies": { - "mime-db": "1.52.0" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" - }, - "node_modules/object-inspect": { - "version": "1.12.2", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.2.tgz", - "integrity": "sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ==", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/on-finished": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", - "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", - "dependencies": { - "ee-first": "1.1.1" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/pop-iterate": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/pop-iterate/-/pop-iterate-1.0.1.tgz", - "integrity": "sha512-HRCx4+KJE30JhX84wBN4+vja9bNfysxg1y28l0DuJmkoaICiv2ZSilKddbS48pq50P8d2erAhqDLbp47yv3MbQ==" - }, - "node_modules/q": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/q/-/q-2.0.3.tgz", - "integrity": "sha512-gv6vLGcmAOg96/fgo3d9tvA4dJNZL3fMyBqVRrGxQ+Q/o4k9QzbJ3NQF9cOO/71wRodoXhaPgphvMFU68qVAJQ==", - "dependencies": { - "asap": "^2.0.0", - "pop-iterate": "^1.0.1", - "weak-map": "^1.0.5" - } - }, - "node_modules/qs": { - "version": "6.11.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", - "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", - "dependencies": { - "side-channel": "^1.0.4" - }, - "engines": { - "node": ">=0.6" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/querystringify": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", - "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==" - }, - "node_modules/raw-body": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz", - "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==", - "dependencies": { - "bytes": "3.1.2", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "unpipe": "1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/requires-port": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", - "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==" - }, - "node_modules/rootpath": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/rootpath/-/rootpath-0.1.2.tgz", - "integrity": "sha512-R3wLbuAYejpxQjL/SjXo1Cjv4wcJECnMRT/FlcCfTwCBhaji9rWaRCoVEQ1SPiTJ4kKK+yh+bZLAV7SCafoDDw==" - }, - "node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" - }, - "node_modules/scmp": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/scmp/-/scmp-2.1.0.tgz", - "integrity": "sha512-o/mRQGk9Rcer/jEEw/yw4mwo3EU/NvYvp577/Btqrym9Qy5/MdWGBqipbALgd2lrdWTJ5/gqDusxfnQBxOxT2Q==" - }, - "node_modules/semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "bin": { - "semver": "bin/semver" - } - }, - "node_modules/setprototypeof": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", - "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" - }, - "node_modules/side-channel": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", - "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", - "dependencies": { - "call-bind": "^1.0.0", - "get-intrinsic": "^1.0.2", - "object-inspect": "^1.9.0" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/statuses": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", - "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/toidentifier": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", - "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", - "engines": { - "node": ">=0.6" - } - }, - "node_modules/twilio": { - "version": "3.82.2", - "resolved": "https://registry.npmjs.org/twilio/-/twilio-3.82.2.tgz", - "integrity": "sha512-LHqTrrpEROY3dqsSIzHTPeJ0sxjv8j0J3N0CRyrJybhs+iLIzJ3OeLrSIzlJo4x+pRFY4F1dBNCfMjTl4fwf2g==", - "dependencies": { - "axios": "^0.26.1", - "dayjs": "^1.8.29", - "https-proxy-agent": "^5.0.0", - "jsonwebtoken": "^8.5.1", - "lodash": "^4.17.21", - "q": "2.0.x", - "qs": "^6.9.4", - "rootpath": "^0.1.2", - "scmp": "^2.1.0", - "url-parse": "^1.5.9", - "xmlbuilder": "^13.0.2" - }, - "engines": { - "node": ">=6.0" - } - }, - "node_modules/type-is": { - "version": "1.6.18", - "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", - "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", - "dependencies": { - "media-typer": "0.3.0", - "mime-types": "~2.1.24" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/unpipe": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", - "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/url-parse": { - "version": "1.5.10", - "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", - "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", - "dependencies": { - "querystringify": "^2.1.1", - "requires-port": "^1.0.0" - } - }, - "node_modules/weak-map": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/weak-map/-/weak-map-1.0.8.tgz", - "integrity": "sha512-lNR9aAefbGPpHO7AEnY0hCFjz1eTkWCXYvkTRrTHs9qv8zJp+SkVYpzfLIFXQQiG3tVvbNFQgVg2bQS8YGgxyw==" - }, - "node_modules/xmlbuilder": { - "version": "13.0.2", - "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-13.0.2.tgz", - "integrity": "sha512-Eux0i2QdDYKbdbA6AM6xE4m6ZTZr4G4xF9kahI2ukSEMCzwce2eX9WlTI5J3s+NU7hpasFsr8hWIONae7LluAQ==", - "engines": { - "node": ">=6.0" - } - } - }, - "dependencies": { - "agent-base": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", - "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", - "requires": { - "debug": "4" - }, - "dependencies": { - "debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "requires": { - "ms": "2.1.2" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" - } - } - }, - "asap": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", - "integrity": "sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==" - }, - "axios": { - "version": "0.26.1", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz", - "integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==", - "requires": { - "follow-redirects": "^1.14.8" - } - }, - "body-parser": { - "version": "1.20.1", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz", - "integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==", - "requires": { - "bytes": "3.1.2", - "content-type": "~1.0.4", - "debug": "2.6.9", - "depd": "2.0.0", - "destroy": "1.2.0", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "on-finished": "2.4.1", - "qs": "6.11.0", - "raw-body": "2.5.1", - "type-is": "~1.6.18", - "unpipe": "1.0.0" - } - }, - "buffer-equal-constant-time": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", - "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==" - }, - "bytes": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", - "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==" - }, - "call-bind": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", - "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", - "requires": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" - } - }, - "content-type": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", - "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" - }, - "dayjs": { - "version": "1.11.5", - "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.5.tgz", - "integrity": "sha512-CAdX5Q3YW3Gclyo5Vpqkgpj8fSdLQcRuzfX6mC6Phy0nfJ0eGYOeS7m4mt2plDWLAtA4TqTakvbboHvUxfe4iA==" - }, - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "requires": { - "ms": "2.0.0" - } - }, - "depd": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", - "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==" - }, - "destroy": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", - "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==" - }, - "ecdsa-sig-formatter": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", - "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", - "requires": { - "safe-buffer": "^5.0.1" - } - }, - "ee-first": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", - "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" - }, - "follow-redirects": { - "version": "1.15.2", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", - "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==" - }, - "function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" - }, - "get-intrinsic": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.3.tgz", - "integrity": "sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==", - "requires": { - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.3" - } - }, - "has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "requires": { - "function-bind": "^1.1.1" - } - }, - "has-symbols": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", - "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==" - }, - "http-errors": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", - "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", - "requires": { - "depd": "2.0.0", - "inherits": "2.0.4", - "setprototypeof": "1.2.0", - "statuses": "2.0.1", - "toidentifier": "1.0.1" - } - }, - "https-proxy-agent": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", - "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", - "requires": { - "agent-base": "6", - "debug": "4" - }, - "dependencies": { - "debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "requires": { - "ms": "2.1.2" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" - } - } - }, - "iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } - }, - "inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" - }, - "jsonwebtoken": { - "version": "8.5.1", - "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-8.5.1.tgz", - "integrity": "sha512-XjwVfRS6jTMsqYs0EsuJ4LGxXV14zQybNd4L2r0UvbVnSF9Af8x7p5MzbJ90Ioz/9TI41/hTCvznF/loiSzn8w==", - "requires": { - "jws": "^3.2.2", - "lodash.includes": "^4.3.0", - "lodash.isboolean": "^3.0.3", - "lodash.isinteger": "^4.0.4", - "lodash.isnumber": "^3.0.3", - "lodash.isplainobject": "^4.0.6", - "lodash.isstring": "^4.0.1", - "lodash.once": "^4.0.0", - "ms": "^2.1.1", - "semver": "^5.6.0" - }, - "dependencies": { - "ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" - } - } - }, - "jwa": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz", - "integrity": "sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA==", - "requires": { - "buffer-equal-constant-time": "1.0.1", - "ecdsa-sig-formatter": "1.0.11", - "safe-buffer": "^5.0.1" - } - }, - "jws": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz", - "integrity": "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==", - "requires": { - "jwa": "^1.4.1", - "safe-buffer": "^5.0.1" - } - }, - "lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" - }, - "lodash.includes": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", - "integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==" - }, - "lodash.isboolean": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz", - "integrity": "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==" - }, - "lodash.isinteger": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz", - "integrity": "sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==" - }, - "lodash.isnumber": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz", - "integrity": "sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==" - }, - "lodash.isplainobject": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", - "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==" - }, - "lodash.isstring": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", - "integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==" - }, - "lodash.once": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", - "integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==" - }, - "media-typer": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", - "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==" - }, - "mime-db": { - "version": "1.52.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==" - }, - "mime-types": { - "version": "2.1.35", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", - "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", - "requires": { - "mime-db": "1.52.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" - }, - "object-inspect": { - "version": "1.12.2", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.2.tgz", - "integrity": "sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ==" - }, - "on-finished": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", - "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", - "requires": { - "ee-first": "1.1.1" - } - }, - "pop-iterate": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/pop-iterate/-/pop-iterate-1.0.1.tgz", - "integrity": "sha512-HRCx4+KJE30JhX84wBN4+vja9bNfysxg1y28l0DuJmkoaICiv2ZSilKddbS48pq50P8d2erAhqDLbp47yv3MbQ==" - }, - "q": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/q/-/q-2.0.3.tgz", - "integrity": "sha512-gv6vLGcmAOg96/fgo3d9tvA4dJNZL3fMyBqVRrGxQ+Q/o4k9QzbJ3NQF9cOO/71wRodoXhaPgphvMFU68qVAJQ==", - "requires": { - "asap": "^2.0.0", - "pop-iterate": "^1.0.1", - "weak-map": "^1.0.5" - } - }, - "qs": { - "version": "6.11.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", - "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", - "requires": { - "side-channel": "^1.0.4" - } - }, - "querystringify": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", - "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==" - }, - "raw-body": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz", - "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==", - "requires": { - "bytes": "3.1.2", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "unpipe": "1.0.0" - } - }, - "requires-port": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", - "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==" - }, - "rootpath": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/rootpath/-/rootpath-0.1.2.tgz", - "integrity": "sha512-R3wLbuAYejpxQjL/SjXo1Cjv4wcJECnMRT/FlcCfTwCBhaji9rWaRCoVEQ1SPiTJ4kKK+yh+bZLAV7SCafoDDw==" - }, - "safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" - }, - "safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" - }, - "scmp": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/scmp/-/scmp-2.1.0.tgz", - "integrity": "sha512-o/mRQGk9Rcer/jEEw/yw4mwo3EU/NvYvp577/Btqrym9Qy5/MdWGBqipbALgd2lrdWTJ5/gqDusxfnQBxOxT2Q==" - }, - "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" - }, - "setprototypeof": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", - "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" - }, - "side-channel": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", - "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", - "requires": { - "call-bind": "^1.0.0", - "get-intrinsic": "^1.0.2", - "object-inspect": "^1.9.0" - } - }, - "statuses": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", - "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==" - }, - "toidentifier": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", - "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==" - }, - "twilio": { - "version": "3.82.2", - "resolved": "https://registry.npmjs.org/twilio/-/twilio-3.82.2.tgz", - "integrity": "sha512-LHqTrrpEROY3dqsSIzHTPeJ0sxjv8j0J3N0CRyrJybhs+iLIzJ3OeLrSIzlJo4x+pRFY4F1dBNCfMjTl4fwf2g==", - "requires": { - "axios": "^0.26.1", - "dayjs": "^1.8.29", - "https-proxy-agent": "^5.0.0", - "jsonwebtoken": "^8.5.1", - "lodash": "^4.17.21", - "q": "2.0.x", - "qs": "^6.9.4", - "rootpath": "^0.1.2", - "scmp": "^2.1.0", - "url-parse": "^1.5.9", - "xmlbuilder": "^13.0.2" - } - }, - "type-is": { - "version": "1.6.18", - "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", - "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", - "requires": { - "media-typer": "0.3.0", - "mime-types": "~2.1.24" - } - }, - "unpipe": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", - "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==" - }, - "url-parse": { - "version": "1.5.10", - "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", - "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", - "requires": { - "querystringify": "^2.1.1", - "requires-port": "^1.0.0" - } - }, - "weak-map": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/weak-map/-/weak-map-1.0.8.tgz", - "integrity": "sha512-lNR9aAefbGPpHO7AEnY0hCFjz1eTkWCXYvkTRrTHs9qv8zJp+SkVYpzfLIFXQQiG3tVvbNFQgVg2bQS8YGgxyw==" - }, - "xmlbuilder": { - "version": "13.0.2", - "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-13.0.2.tgz", - "integrity": "sha512-Eux0i2QdDYKbdbA6AM6xE4m6ZTZr4G4xF9kahI2ukSEMCzwce2eX9WlTI5J3s+NU7hpasFsr8hWIONae7LluAQ==" - } - } -} diff --git a/src/plugins/twilio/package.json b/src/plugins/twilio/package.json deleted file mode 100644 index c4a212dc..00000000 --- a/src/plugins/twilio/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "dependencies": { - "body-parser": "^1.20.0", - "twilio": "^3.82.0" - } -} diff --git a/src/plugins/twilio/plugin.json b/src/plugins/twilio/plugin.json deleted file mode 100644 index fd721bfc..00000000 --- a/src/plugins/twilio/plugin.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "author": "Artemus", - "name": "Twilio", - "version": "1.0.1", - "tscordRequiredVersion": ">=2.0.0", - "description": "This plugin allows you to send and receive SMS through Twilio" -} \ No newline at end of file diff --git a/src/plugins/twilio/services/Twilio.ts b/src/plugins/twilio/services/Twilio.ts deleted file mode 100644 index a701e10d..00000000 --- a/src/plugins/twilio/services/Twilio.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { singleton } from 'tsyringe' -import EventEmitter from 'node:events'; -import { Twilio as TwilioSDK } from 'twilio' - -import { twilioConfig, twilioPhoneNumbers } from "../config" - - -@singleton() -export class Twilio extends EventEmitter { - public client: TwilioSDK; - - constructor() { - super() - if (twilioConfig.enabled) this.client = new TwilioSDK( - process.env["TWILIO_ACCOUNT_SID"] as string, - process.env["TWILIO_AUTH_TOKEN"] as string, - { logLevel: twilioConfig.debug ? "debug" : undefined } - ) - } - - public async sendSMS(from: typeof twilioPhoneNumbers[number], to: string, body: string) { - if (!twilioConfig.enabled || !this.client) return; - if (!twilioPhoneNumbers.includes(from)) throw new Error(`Invalid source phone number: ${from}`); - - return this.client.messages.create({ from, to, body }); - } -} - -export interface Twilio { - on( - event: U, listener: TwilioPlugin.Events[U] - ): this; - - emit( - event: U, ...args: Parameters - ): boolean; -} \ No newline at end of file diff --git a/src/plugins/twilio/services/index.ts b/src/plugins/twilio/services/index.ts deleted file mode 100644 index 97ac4a22..00000000 --- a/src/plugins/twilio/services/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './Twilio' \ No newline at end of file diff --git a/src/plugins/twilio/utils/types/config.d.ts b/src/plugins/twilio/utils/types/config.d.ts deleted file mode 100644 index 657b0dad..00000000 --- a/src/plugins/twilio/utils/types/config.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -declare namespace TwilioPlugin { - type ConfigType = { - enabled: boolean, - debug: boolean, - apiValidateSource: boolean, - } -} \ No newline at end of file diff --git a/src/plugins/twilio/utils/types/environements.d.ts b/src/plugins/twilio/utils/types/environements.d.ts deleted file mode 100644 index a05bd3d5..00000000 --- a/src/plugins/twilio/utils/types/environements.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -declare global { - namespace NodeJS { - interface ProcessEnv { - TWILIO_ACCOUNT_SID: string; - TWILIO_AUTH_TOKEN: string; - } - } -} - - // If this file has no import/export statements (i.e. is a script) - // convert it into a module by adding an empty export statement. - export {} \ No newline at end of file diff --git a/src/plugins/twilio/utils/types/twilio.d.ts b/src/plugins/twilio/utils/types/twilio.d.ts deleted file mode 100644 index 4cabf155..00000000 --- a/src/plugins/twilio/utils/types/twilio.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -declare namespace TwilioPlugin { - type IncomingMessage = { - messageSid: string; - smsSid?: string; - accountSid: string; - messagingServiceSid?: string; - body: string; - from: string; - to: string; - geo: { - from: { - country?: string; - state?: string; - city?: string; - zip?: string; - }, - to: { - country?: string; - state?: string; - city?: string; - zip?: string; - } - }; - apiVersion: string; - } - - interface Events { - sms: (incomingMessage: IncomingMessage) => void; - } -} \ No newline at end of file From 6e6960e56298256f9284ce2fbd0bca4e68362410 Mon Sep 17 00:00:00 2001 From: Mr-Artemus <31190188+Mr-Artemus@users.noreply.github.com> Date: Mon, 17 Oct 2022 22:30:56 +0200 Subject: [PATCH 28/29] feat(#73): Add comments to config --- package-lock.json | 1 + src/config/api.ts | 4 ++-- src/config/database.ts | 7 ++++--- src/config/general.ts | 23 +++++++++++++---------- src/config/logs.ts | 10 ++++++++-- src/config/stats.ts | 1 + src/config/websocket.ts | 2 +- 7 files changed, 30 insertions(+), 18 deletions(-) diff --git a/package-lock.json b/package-lock.json index c36f7b4c..d0ef229e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,6 +7,7 @@ "": { "name": "tscord", "version": "1.0.0", + "hasInstallScript": true, "license": "MIT", "dependencies": { "@discordx/importer": "~1.1.10", diff --git a/src/config/api.ts b/src/config/api.ts index c9bda5d1..0f707487 100644 --- a/src/config/api.ts +++ b/src/config/api.ts @@ -1,5 +1,5 @@ export const apiConfig: APIConfigType = { - enabled: false, - port: process.env['API_PORT'] ? parseInt(process.env['API_PORT']) : 4000, + enabled: false, // is the API server enabled or not + port: process.env['API_PORT'] ? parseInt(process.env['API_PORT']) : 4000, // the port on which the API server should be exposed } \ No newline at end of file diff --git a/src/config/database.ts b/src/config/database.ts index d18972fb..0ba3eb84 100644 --- a/src/config/database.ts +++ b/src/config/database.ts @@ -3,11 +3,12 @@ import { SqlHighlighter } from '@mikro-orm/sql-highlighter' export const databaseConfig: DatabaseConfigType = { - path: './database/', + path: './database/', // path to the folder containing the migrations and SQLite database (if used) + // config for setting up an automated backup of the database (ONLY FOR SQLITE) backup: { - enabled: true, - path: './database/backups/' + enabled: false, + path: './database/backups/' // path to the backups folder (should be in the database/ folder) } } diff --git a/src/config/general.ts b/src/config/general.ts index b0572961..c355ba24 100644 --- a/src/config/general.ts +++ b/src/config/general.ts @@ -1,30 +1,32 @@ export const generalConfig: GeneralConfigType = { + // do not touch that __templateVersion: '2.0.0', - name: 'tscord', - description: '', - defaultLocale: 'en', - simpleCommandsPrefix: '!', + name: 'tscord', // the name of your bot + description: '', // the description of your bot + defaultLocale: 'en', // default language of the bot, must be a valid locale + simpleCommandsPrefix: '!', // default prefix for simple command messages (old way to do commands on discord) ownerId: process.env['BOT_OWNER_ID'] || '', - timezone: 'Europe/Paris', + timezone: 'Europe/Paris', // default TimeZone to well format and localize dates (logs, stats, etc) + // useful links links: { invite: 'https://www.change_invite_link_here.com', supportServer: 'https://discord.com/your_invitation_link', gitRemoteRepo: 'https://github.com/barthofu/tscord', }, - automaticUploadImagesToImgur: true, + automaticUploadImagesToImgur: true, // enable or not the automatic assets upload - // you don't have to put the owner id here, it is added automatically - devs: [], + devs: [], // discord IDs of the devs that are working on the bot (you don't have to put the owner's id here) eval: { - name: 'bot', - onlyOwner: false + name: 'bot', // name to trigger the eval command + onlyOwner: false // restrict the eval command to the owner only (if not, all the devs can trigger it) }, + // define the bot activities (phrases under its name). Types can be: PLAYING, LISTENING, WATCHING, STREAMING activities: [ { text: 'discord.js v14', @@ -38,6 +40,7 @@ export const generalConfig: GeneralConfigType = { } +// global colors export const colorsConfig = { primary: '#2F3136' diff --git a/src/config/logs.ts b/src/config/logs.ts index 2e759b14..38f78fa3 100644 --- a/src/config/logs.ts +++ b/src/config/logs.ts @@ -1,12 +1,18 @@ export const logsConfig: LogsConfigType = { - debug: false, - + debug: false, // set the discordx client debug logs + + // for each type of log, you can precise : + // - if the log should be consoled + // - if the log should be saved to the log files + // - if the log should be sent to a discord channel (providing its IP) + interaction: { file: true, console: true, channel: null, + // exclude some interactions types exclude: [ 'BUTTON_INTERACTION', 'SELECT_MENU_INTERACTION' diff --git a/src/config/stats.ts b/src/config/stats.ts index a2d30336..b0601ce0 100644 --- a/src/config/stats.ts +++ b/src/config/stats.ts @@ -2,6 +2,7 @@ export const statsConfig: StatsConfigType = { interaction: { + // exclude interaction types from being recorded as stat exclude: [ 'BUTTON_INTERACTION', 'SELECT_MENU_INTERACTION' diff --git a/src/config/websocket.ts b/src/config/websocket.ts index 73037bea..69c48e3a 100644 --- a/src/config/websocket.ts +++ b/src/config/websocket.ts @@ -1,4 +1,4 @@ export const websocketConfig: WebsocketConfigType = { - enabled: false, + enabled: false, // should the websocket client be enabled or not (if you're not using the Dashboard, just disable it) } \ No newline at end of file From 2a1acf02434d99740a03968ddecd8e038673a1d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartholom=C3=A9=20Gili?= Date: Tue, 18 Oct 2022 10:59:31 +0200 Subject: [PATCH 29/29] refactor(#73): cleaned code --- mikro-orm.config.ts | 10 ++++----- src/api/controllers/bot.ts | 13 ++++++----- src/api/controllers/database.ts | 9 ++++---- src/api/controllers/health.ts | 5 +++-- src/api/controllers/other.ts | 1 + src/api/controllers/stats.ts | 3 ++- src/api/middlewares/authenticated.ts | 5 +++-- src/api/middlewares/botOnline.ts | 3 ++- src/api/middlewares/log.ts | 5 +++-- src/api/server.ts | 13 ++++++----- src/client.ts | 7 +++--- src/commands/Admin/prefix.ts | 12 +++++----- src/commands/General/help.ts | 4 ++-- src/commands/General/info.ts | 14 ++++++------ src/commands/General/invite.ts | 5 ++--- src/commands/General/ping.ts | 4 ++-- src/commands/General/stats.ts | 8 +++---- src/commands/Owner/maintenance.ts | 6 ++--- src/config/database.ts | 4 ++-- src/entities/Data.ts | 1 + src/entities/Guild.ts | 6 ++--- src/entities/Image.ts | 14 ++++++------ src/entities/Pastebin.ts | 4 ++-- src/entities/Stat.ts | 4 ++-- src/entities/User.ts | 6 ++--- src/events/custom/guildAdmin.ts | 12 +++++----- src/events/custom/simpleCommandCreate.ts | 16 +++++++------- src/events/guildCreate.ts | 6 ++--- src/events/guildDelete.ts | 6 ++--- src/events/interactionCreate.ts | 16 +++++++------- src/events/messageCreate.ts | 10 ++++----- src/events/messagePinned.ts | 6 ++--- src/events/ready.ts | 19 ++++++++-------- src/guards/disabled.ts | 8 +++---- src/guards/extractLocale.ts | 9 +++----- src/guards/guildOnly.ts | 8 +++---- src/guards/maintenance.ts | 10 ++++----- src/guards/nsfw.ts | 2 +- src/i18n/detectors.ts | 6 ++--- src/i18n/en/index.ts | 2 +- src/i18n/formatters.ts | 4 ++-- src/i18n/fr/index.ts | 2 +- src/i18n/i18n-node.ts | 4 ++-- src/i18n/i18n-types.ts | 2 +- src/i18n/i18n-util.async.ts | 6 ++--- src/i18n/i18n-util.sync.ts | 10 ++++----- src/i18n/i18n-util.ts | 8 +++---- src/i18n/index.ts | 4 ++-- src/main.ts | 24 ++++++++++---------- src/services/Database.ts | 21 +++++++++--------- src/services/ErrorHandler.ts | 7 +++--- src/services/ImagesUpload.ts | 12 +++++----- src/services/Logger.ts | 28 ++++++++++++------------ src/services/Pastebin.ts | 5 +++-- src/services/PluginsManager.ts | 24 ++++++++++++++------ src/services/Stats.ts | 25 ++++++++++----------- src/services/Store.ts | 4 ++-- src/services/WebSocket.ts | 8 +++---- src/utils/classes/BaseError.ts | 1 - src/utils/classes/Plugin.ts | 8 +++---- src/utils/decorators/ContextMenu.ts | 6 ++--- src/utils/decorators/On.ts | 2 +- src/utils/decorators/Once.ts | 2 +- src/utils/decorators/Schedule.ts | 6 ++--- src/utils/decorators/Slash.ts | 4 ++-- src/utils/decorators/SlashChoice.ts | 3 ++- src/utils/decorators/SlashGroup.ts | 6 ++--- src/utils/decorators/SlashOption.ts | 2 +- src/utils/decorators/WSOn.ts | 2 +- src/utils/errors/InvalidOptionName.ts | 3 ++- src/utils/errors/UnknownReply.ts | 4 ++-- src/utils/functions/colors.ts | 8 ++++++- src/utils/functions/database.ts | 8 +++---- src/utils/functions/date.ts | 4 ++-- src/utils/functions/dependency.ts | 4 ++-- src/utils/functions/embeds.ts | 3 ++- src/utils/functions/eval.ts | 4 ++-- src/utils/functions/files.ts | 2 +- src/utils/functions/image.ts | 4 ++-- src/utils/functions/localization.ts | 4 ++-- src/utils/functions/maintenance.ts | 4 ++-- src/utils/functions/prefix.ts | 8 +++---- src/utils/functions/synchronizer.ts | 4 ++-- 83 files changed, 312 insertions(+), 294 deletions(-) diff --git a/mikro-orm.config.ts b/mikro-orm.config.ts index 8c2b8d08..9a4f274f 100644 --- a/mikro-orm.config.ts +++ b/mikro-orm.config.ts @@ -1,8 +1,8 @@ -import { mikroORMConfig } from './src/config/database' -import * as entities from '@entities' -import { PluginsManager } from '@services' -import { Options } from '@mikro-orm/core' -import { resolveDependency } from '@utils/functions' +import { mikroORMConfig } from "./src/config/database" +import * as entities from "@entities" +import { PluginsManager } from "@services" +import { Options } from "@mikro-orm/core" +import { resolveDependency } from "@utils/functions" export default async () => { const pluginsManager = await resolveDependency(PluginsManager) diff --git a/src/api/controllers/bot.ts b/src/api/controllers/bot.ts index b358227c..59ef5f8a 100644 --- a/src/api/controllers/bot.ts +++ b/src/api/controllers/bot.ts @@ -1,14 +1,15 @@ -import { Authenticated, BotOnline } from "@api/middlewares" -import { generalConfig } from "@config" -import { Guild, User } from '@entities' -import { Database } from "@services" import { BodyParams, Controller, Delete, Get, PathParams, Post, UseBefore } from "@tsed/common" import { NotFound, Unauthorized } from "@tsed/exceptions" import { Required } from "@tsed/schema" +import { BaseGuildTextChannel, BaseGuildVoiceChannel, ChannelType, NewsChannel, PermissionsBitField } from "discord.js" +import { Client, MetadataStorage } from "discordx" + +import { Authenticated, BotOnline } from "@api/middlewares" +import { generalConfig } from "@config" +import { Guild, User } from "@entities" +import { Database } from "@services" import { BaseController } from "@utils/classes" import { getDevs, isDev, isInMaintenance, resolveDependencies, setMaintenance } from "@utils/functions" -import { BaseGuildTextChannel, BaseGuildVoiceChannel, ChannelType, Guild as DGuild, NewsChannel, PermissionsBitField } from "discord.js" -import { Client, MetadataStorage } from "discordx" @Controller('/bot') @UseBefore( diff --git a/src/api/controllers/database.ts b/src/api/controllers/database.ts index fcc5e1c2..8c8964e7 100644 --- a/src/api/controllers/database.ts +++ b/src/api/controllers/database.ts @@ -1,12 +1,13 @@ -import { Authenticated } from "@api/middlewares" -import { databaseConfig } from "@config" -import { Database } from "@services" import { BodyParams, Controller, Get, Post, UseBefore } from "@tsed/common" import { InternalServerError } from "@tsed/exceptions" import { Required } from "@tsed/schema" +import { injectable } from "tsyringe" + +import { Authenticated } from "@api/middlewares" +import { databaseConfig } from "@config" +import { Database } from "@services" import { BaseController } from "@utils/classes" import { formatDate, resolveDependencies } from "@utils/functions" -import { injectable } from "tsyringe" @Controller('/database') @UseBefore( diff --git a/src/api/controllers/health.ts b/src/api/controllers/health.ts index a4ca6461..f6782dcc 100644 --- a/src/api/controllers/health.ts +++ b/src/api/controllers/health.ts @@ -1,9 +1,10 @@ +import { Controller, Get } from "@tsed/common" +import { Client } from "discordx" + import { Data } from "@entities" import { Database, Stats } from "@services" -import { Controller, Get } from "@tsed/common" import { BaseController } from "@utils/classes" import { resolveDependencies } from "@utils/functions" -import { Client } from "discordx" @Controller('/health') export class HealthController extends BaseController { diff --git a/src/api/controllers/other.ts b/src/api/controllers/other.ts index ad73b585..7c670f9b 100644 --- a/src/api/controllers/other.ts +++ b/src/api/controllers/other.ts @@ -1,4 +1,5 @@ import { Controller, Get } from "@tsed/common" + import { BaseController } from "@utils/classes" @Controller('/') diff --git a/src/api/controllers/stats.ts b/src/api/controllers/stats.ts index e079c46f..0c75e270 100644 --- a/src/api/controllers/stats.ts +++ b/src/api/controllers/stats.ts @@ -1,6 +1,7 @@ +import { Controller, Get, QueryParams, UseBefore } from "@tsed/common" + import { Authenticated } from "@api/middlewares" import { Stats } from "@services" -import { Controller, Get, QueryParams, UseBefore } from "@tsed/common" import { BaseController } from "@utils/classes" import { resolveDependencies } from "@utils/functions" diff --git a/src/api/middlewares/authenticated.ts b/src/api/middlewares/authenticated.ts index fb6a6e31..dd7e298c 100644 --- a/src/api/middlewares/authenticated.ts +++ b/src/api/middlewares/authenticated.ts @@ -1,9 +1,10 @@ -import { Store } from "@services" import { Context, Middleware, PlatformContext } from "@tsed/common" import { BadRequest, Unauthorized } from "@tsed/exceptions" -import { isDev, resolveDependency } from "@utils/functions" import DiscordOauth2 from "discord-oauth2" +import { Store } from "@services" +import { isDev, resolveDependency } from "@utils/functions" + const discordOauth2 = new DiscordOauth2() const timeout = 10 * 60 * 1000 diff --git a/src/api/middlewares/botOnline.ts b/src/api/middlewares/botOnline.ts index e5afd0a1..0a11f282 100644 --- a/src/api/middlewares/botOnline.ts +++ b/src/api/middlewares/botOnline.ts @@ -1,8 +1,9 @@ -import { apiConfig } from "@config" import { Middleware } from "@tsed/common" import { InternalServerError } from "@tsed/exceptions" import axios from "axios" +import { apiConfig } from "@config" + const baseUrl = `http://localhost:${apiConfig.port}` @Middleware() diff --git a/src/api/middlewares/log.ts b/src/api/middlewares/log.ts index 86f7ec76..bc7fda51 100644 --- a/src/api/middlewares/log.ts +++ b/src/api/middlewares/log.ts @@ -1,8 +1,9 @@ -import { Logger } from "@services" import { Context, Middleware, PlatformContext } from "@tsed/common" -import { resolveDependency } from "@utils/functions" import chalk from "chalk" +import { Logger } from "@services" +import { resolveDependency } from "@utils/functions" + @Middleware() export class Log { diff --git a/src/api/server.ts b/src/api/server.ts index b2e8cc4d..7fa99eb7 100644 --- a/src/api/server.ts +++ b/src/api/server.ts @@ -1,10 +1,11 @@ -import * as controllers from '@api/controllers' -import { Log } from '@api/middlewares' -import { PluginsManager } from "@services" -import { Inject, PlatformAcceptMimesMiddleware, PlatformApplication } from '@tsed/common' -import { PlatformExpress } from '@tsed/platform-express' +import { Inject, PlatformAcceptMimesMiddleware, PlatformApplication } from "@tsed/common" +import { PlatformExpress } from "@tsed/platform-express" import '@tsed/swagger' -import { singleton } from 'tsyringe' +import { singleton } from "tsyringe" + +import * as controllers from "@api/controllers" +import { Log } from "@api/middlewares" +import { PluginsManager } from "@services" @singleton() export class Server { diff --git a/src/client.ts b/src/client.ts index d8621a83..31d9bb8b 100644 --- a/src/client.ts +++ b/src/client.ts @@ -1,8 +1,7 @@ -import { GatewayIntentBits, Partials } from 'discord.js' +import { GatewayIntentBits, Partials } from "discord.js" -import { ExtractLocale, Maintenance, NotBot } from '@guards' - -import { generalConfig, logsConfig } from '@config' +import { generalConfig, logsConfig } from "@config" +import { ExtractLocale, Maintenance, NotBot } from "@guards" export const clientConfig = { diff --git a/src/commands/Admin/prefix.ts b/src/commands/Admin/prefix.ts index 190f0597..fcdf8012 100644 --- a/src/commands/Admin/prefix.ts +++ b/src/commands/Admin/prefix.ts @@ -1,15 +1,15 @@ -import { Client } from "discordx" import { Category } from "@discordx/utilities" import { ApplicationCommandOptionType, CommandInteraction } from "discord.js" +import { Client } from "discordx" import { injectable } from "tsyringe" -import { Slash, Discord, SlashOption } from "@decorators" -import { Guard, UserPermissions } from "@guards" +import { generalConfig } from "@config" +import { Discord, Slash, SlashOption } from "@decorators" import { Guild } from "@entities" -import { resolveGuild, simpleSuccessEmbed } from "@utils/functions" -import { Database } from "@services" -import { generalConfig } from '@config' import { UnknownReplyError } from "@errors" +import { Guard, UserPermissions } from "@guards" +import { Database } from "@services" +import { resolveGuild, simpleSuccessEmbed } from "@utils/functions" @Discord() @injectable() diff --git a/src/commands/General/help.ts b/src/commands/General/help.ts index 537c7fbf..c8853d3f 100644 --- a/src/commands/General/help.ts +++ b/src/commands/General/help.ts @@ -1,6 +1,6 @@ -import { Client, MetadataStorage, SelectMenuComponent } from "discordx" import { Category } from "@discordx/utilities" -import { Formatters, ActionRowBuilder, EmbedBuilder, SelectMenuBuilder, APISelectMenuOption, CommandInteraction, SelectMenuInteraction } from "discord.js" +import { ActionRowBuilder, APISelectMenuOption, CommandInteraction, EmbedBuilder, Formatters, SelectMenuBuilder, SelectMenuInteraction } from "discord.js" +import { Client, MetadataStorage, SelectMenuComponent } from "discordx" import { Discord, Slash } from "@decorators" import { chunkArray, getColor, validString } from "@utils/functions" diff --git a/src/commands/General/info.ts b/src/commands/General/info.ts index 492bd86c..55b087a1 100644 --- a/src/commands/General/info.ts +++ b/src/commands/General/info.ts @@ -1,18 +1,18 @@ -import { injectable } from "tsyringe" -import { Client } from "discordx" import { Category } from "@discordx/utilities" +import dayjs from "dayjs" +import relativeTime from "dayjs/plugin/relativeTime" import { ActionRowBuilder, ButtonBuilder, ButtonStyle, CommandInteraction, EmbedBuilder, EmbedField } from "discord.js" -import relativeTime from 'dayjs/plugin/relativeTime' -import dayjs from 'dayjs' +import { Client } from "discordx" +import { injectable } from "tsyringe" dayjs.extend(relativeTime) +import { generalConfig } from "@config" import { Discord, Slash } from "@decorators" import { Guard } from "@guards" -import { formatDate, getColor, isValidUrl, timeAgo } from "@utils/functions" -import { generalConfig } from "@config" import { Stats } from "@services" +import { getColor, isValidUrl, timeAgo } from "@utils/functions" -import packageJSON from '../../../package.json' +import packageJSON from "../../../package.json" const links = [ { label: 'Invite me!', url: generalConfig.links.invite }, diff --git a/src/commands/General/invite.ts b/src/commands/General/invite.ts index 75eb9743..f2668c8c 100644 --- a/src/commands/General/invite.ts +++ b/src/commands/General/invite.ts @@ -1,12 +1,11 @@ -import { Client } from "discordx" import { Category } from "@discordx/utilities" import { CommandInteraction, EmbedBuilder } from "discord.js" +import { Client } from "discordx" +import { generalConfig } from "@config" import { Discord, Slash } from "@decorators" import { Guard } from "@guards" import { getColor } from "@utils/functions" -import { generalConfig } from "@config" -import { L } from "@i18n" @Discord() @Category('General') diff --git a/src/commands/General/ping.ts b/src/commands/General/ping.ts index 2aebca79..00fd00b7 100644 --- a/src/commands/General/ping.ts +++ b/src/commands/General/ping.ts @@ -1,8 +1,8 @@ -import { Client } from "discordx" import { Category } from "@discordx/utilities" import type { CommandInteraction, Message } from "discord.js" +import { Client } from "discordx" -import { Slash, Discord } from "@decorators" +import { Discord, Slash } from "@decorators" @Discord() @Category('General') diff --git a/src/commands/General/stats.ts b/src/commands/General/stats.ts index ea42bf5a..3825ba7f 100644 --- a/src/commands/General/stats.ts +++ b/src/commands/General/stats.ts @@ -1,11 +1,11 @@ -import { Client } from "discordx" -import { Category } from "@discordx/utilities" -import { ApplicationCommandOptionType, CommandInteraction, EmbedBuilder, User } from "discord.js" -import { injectable } from "tsyringe" import { Pagination, PaginationType } from "@discordx/pagination" +import { Category } from "@discordx/utilities" +import { ApplicationCommandOptionType, CommandInteraction, EmbedBuilder, User } from "discord.js" +import { Client } from "discordx" +import { injectable } from "tsyringe" import { Discord, Slash, SlashOption } from "@decorators" import { Stats } from "@services" diff --git a/src/commands/Owner/maintenance.ts b/src/commands/Owner/maintenance.ts index a4edf81a..27660fcf 100644 --- a/src/commands/Owner/maintenance.ts +++ b/src/commands/Owner/maintenance.ts @@ -1,9 +1,9 @@ -import { Client } from "discordx" import { ApplicationCommandOptionType, CommandInteraction } from "discord.js" +import { Client } from "discordx" -import { Slash, Discord, SlashOption, Guard } from "@decorators" -import { setMaintenance, simpleSuccessEmbed } from "@utils/functions" +import { Discord, Guard, Slash, SlashOption } from "@decorators" import { Disabled } from "@guards" +import { setMaintenance, simpleSuccessEmbed } from "@utils/functions" @Discord() export default class MaintenanceCommand { diff --git a/src/config/database.ts b/src/config/database.ts index 0ba3eb84..0eba1d34 100644 --- a/src/config/database.ts +++ b/src/config/database.ts @@ -1,5 +1,5 @@ -import { Options } from '@mikro-orm/core' -import { SqlHighlighter } from '@mikro-orm/sql-highlighter' +import { Options } from "@mikro-orm/core" +import { SqlHighlighter } from "@mikro-orm/sql-highlighter" export const databaseConfig: DatabaseConfigType = { diff --git a/src/entities/Data.ts b/src/entities/Data.ts index 062c7002..cd63751a 100644 --- a/src/entities/Data.ts +++ b/src/entities/Data.ts @@ -1,5 +1,6 @@ import { Entity, EntityRepositoryType, PrimaryKey, Property } from "@mikro-orm/core" import { EntityRepository } from "@mikro-orm/sqlite" + import { CustomBaseEntity } from "./BaseEntity" /** diff --git a/src/entities/Guild.ts b/src/entities/Guild.ts index 4c709ed0..5e6de372 100644 --- a/src/entities/Guild.ts +++ b/src/entities/Guild.ts @@ -1,7 +1,7 @@ -import { Entity, PrimaryKey, Property, EntityRepositoryType } from '@mikro-orm/core' -import { EntityRepository } from '@mikro-orm/sqlite' +import { Entity, PrimaryKey, Property, EntityRepositoryType } from "@mikro-orm/core" +import { EntityRepository } from "@mikro-orm/sqlite" -import { CustomBaseEntity } from './BaseEntity' +import { CustomBaseEntity } from "./BaseEntity" // =========================================== // ================= Entity ================== diff --git a/src/entities/Image.ts b/src/entities/Image.ts index 420b5a60..876f7ff8 100644 --- a/src/entities/Image.ts +++ b/src/entities/Image.ts @@ -1,8 +1,7 @@ -import { Entity, PrimaryKey, Property, EntityRepositoryType } from '@mikro-orm/core' -import { EntityRepository } from '@mikro-orm/sqlite' -import { singleton } from 'tsyringe' +import { Entity, EntityRepositoryType, PrimaryKey, Property } from "@mikro-orm/core" +import { EntityRepository } from "@mikro-orm/sqlite" -import { CustomBaseEntity } from './BaseEntity' +import { CustomBaseEntity } from "./BaseEntity" // =========================================== // ================= Entity ================== @@ -43,13 +42,14 @@ export class Image extends CustomBaseEntity { // =========== Custom Repository ============= // =========================================== -@singleton() export class ImageRepository extends EntityRepository { + async findByTags(tags: string[], explicit: boolean = true): Promise { + const rows = await this.find({ $and: tags.map(tag => ({ tags: new RegExp(tag) })) - }); + }) - return explicit ? rows.filter(row => row.tags.length === tags.length) : rows; + return explicit ? rows.filter(row => row.tags.length === tags.length) : rows } } \ No newline at end of file diff --git a/src/entities/Pastebin.ts b/src/entities/Pastebin.ts index ec19ee82..2556a09e 100644 --- a/src/entities/Pastebin.ts +++ b/src/entities/Pastebin.ts @@ -1,5 +1,5 @@ -import { Entity, PrimaryKey, Property, EntityRepositoryType } from '@mikro-orm/core' -import { EntityRepository } from '@mikro-orm/sqlite' +import { Entity, PrimaryKey, Property, EntityRepositoryType } from "@mikro-orm/core" +import { EntityRepository } from "@mikro-orm/sqlite" // =========================================== // ================= Entity ================== diff --git a/src/entities/Stat.ts b/src/entities/Stat.ts index cd3077a1..2b721029 100644 --- a/src/entities/Stat.ts +++ b/src/entities/Stat.ts @@ -1,5 +1,5 @@ -import { Entity, EntityRepositoryType, PrimaryKey, Property } from '@mikro-orm/core' -import { EntityRepository } from '@mikro-orm/sqlite' +import { Entity, EntityRepositoryType, PrimaryKey, Property } from "@mikro-orm/core" +import { EntityRepository } from "@mikro-orm/sqlite" // =========================================== // ================= Entity ================== diff --git a/src/entities/User.ts b/src/entities/User.ts index 51120e17..e6e5ffcc 100644 --- a/src/entities/User.ts +++ b/src/entities/User.ts @@ -1,7 +1,7 @@ -import { Entity, EntityRepositoryType, PrimaryKey, Property } from '@mikro-orm/core' -import { EntityRepository } from '@mikro-orm/sqlite' +import { Entity, EntityRepositoryType, PrimaryKey, Property } from "@mikro-orm/core" +import { EntityRepository } from "@mikro-orm/sqlite" -import { CustomBaseEntity } from './BaseEntity' +import { CustomBaseEntity } from "./BaseEntity" // =========================================== // ================= Entity ================== diff --git a/src/events/custom/guildAdmin.ts b/src/events/custom/guildAdmin.ts index aa511690..0fe70f97 100644 --- a/src/events/custom/guildAdmin.ts +++ b/src/events/custom/guildAdmin.ts @@ -1,10 +1,10 @@ -import { Collection, GuildMember, PermissionFlagsBits, Role } from 'discord.js' -import { Client, ArgsOf } from 'discordx' -import { injectable } from 'tsyringe' +import { Collection, GuildMember, PermissionFlagsBits, Role } from "discord.js" +import { ArgsOf, Client } from "discordx" +import { injectable } from "tsyringe" -import { Logger } from '@services' -import { Maintenance } from '@guards' -import { On, Discord, Guard } from '@decorators' +import { Discord, Guard, On } from "@decorators" +import { Maintenance } from "@guards" +import { Logger } from "@services" @Discord() @injectable() diff --git a/src/events/custom/simpleCommandCreate.ts b/src/events/custom/simpleCommandCreate.ts index 523ebef7..d74cbe2e 100644 --- a/src/events/custom/simpleCommandCreate.ts +++ b/src/events/custom/simpleCommandCreate.ts @@ -1,11 +1,11 @@ -import { ArgsOf, Client, Guard, SimpleCommandMessage } from 'discordx' -import { injectable } from 'tsyringe' - -import { On, Discord } from '@decorators' -import { Stats, Logger, Database } from '@services' -import { Guild, User } from '@entities' -import { Maintenance } from '@guards' -import { getPrefixFromMessage, syncUser } from '@utils/functions' +import { ArgsOf, Client, Guard, SimpleCommandMessage } from "discordx" +import { injectable } from "tsyringe" + +import { Discord, On } from "@decorators" +import { Guild, User } from "@entities" +import { Maintenance } from "@guards" +import { Database, Logger, Stats } from "@services" +import { getPrefixFromMessage, syncUser } from "@utils/functions" @Discord() @injectable() diff --git a/src/events/guildCreate.ts b/src/events/guildCreate.ts index ce1d8fe9..d5f22295 100644 --- a/src/events/guildCreate.ts +++ b/src/events/guildCreate.ts @@ -1,7 +1,7 @@ -import { ArgsOf, Client } from 'discordx' +import { ArgsOf, Client } from "discordx" -import { On, Discord } from '@decorators' -import { syncGuild } from '@utils/functions' +import { Discord, On } from "@decorators" +import { syncGuild } from "@utils/functions" @Discord() export default class GuildCreateEvent { diff --git a/src/events/guildDelete.ts b/src/events/guildDelete.ts index ec8c6326..339578c4 100644 --- a/src/events/guildDelete.ts +++ b/src/events/guildDelete.ts @@ -1,7 +1,7 @@ -import { ArgsOf, Client } from 'discordx' +import { ArgsOf, Client } from "discordx" -import { On, Discord } from '@decorators' -import { syncGuild } from '@utils/functions' +import { Discord, On } from "@decorators" +import { syncGuild } from "@utils/functions" @Discord() export default class GuildDeleteEvent { diff --git a/src/events/interactionCreate.ts b/src/events/interactionCreate.ts index 2fe297c7..94236b35 100644 --- a/src/events/interactionCreate.ts +++ b/src/events/interactionCreate.ts @@ -1,12 +1,12 @@ -import { CommandInteraction} from 'discord.js' -import { Client, ArgsOf } from 'discordx' -import { injectable } from 'tsyringe' +import { CommandInteraction } from "discord.js" +import { ArgsOf, Client } from "discordx" +import { injectable } from "tsyringe" -import { Database, Logger, Stats } from '@services' -import { Maintenance } from '@guards' -import { Guild, User } from '@entities' -import { On, Guard, Discord } from '@decorators' -import { syncUser } from '@utils/functions' +import { Discord, Guard, On } from "@decorators" +import { Guild, User } from "@entities" +import { Maintenance } from "@guards" +import { Database, Logger, Stats } from "@services" +import { syncUser } from "@utils/functions" @Discord() @injectable() diff --git a/src/events/messageCreate.ts b/src/events/messageCreate.ts index 7f3f7736..23433ce6 100644 --- a/src/events/messageCreate.ts +++ b/src/events/messageCreate.ts @@ -1,10 +1,10 @@ -import { Client, ArgsOf } from 'discordx' +import { ArgsOf, Client } from "discordx" -import { Maintenance } from '@guards' -import { On, Guard, Discord } from '@decorators' -import { executeEvalFromMessage, isDev } from '@utils/functions' +import { Discord, Guard, On } from "@decorators" +import { Maintenance } from "@guards" +import { executeEvalFromMessage, isDev } from "@utils/functions" -import { generalConfig } from '@config' +import { generalConfig } from "@config" @Discord() export default class MessageCreateEvent { diff --git a/src/events/messagePinned.ts b/src/events/messagePinned.ts index d0a1acd0..6fd12598 100644 --- a/src/events/messagePinned.ts +++ b/src/events/messagePinned.ts @@ -1,7 +1,7 @@ -import { Client } from 'discordx' -import { Message } from 'discord.js' +import { Message } from "discord.js" +import { Client } from "discordx" -import { On, Discord } from '@decorators' +import { Discord, On } from "@decorators" @Discord() export default class messagePinnedEvent { diff --git a/src/events/ready.ts b/src/events/ready.ts index c5e08419..527d09d0 100644 --- a/src/events/ready.ts +++ b/src/events/ready.ts @@ -1,13 +1,12 @@ -import { Client } from 'discordx' -import { injectable } from 'tsyringe' -import { ActivityType } from 'discord.js' - -import { Data } from '@entities' -import { generalConfig, logsConfig } from '@config' -import { Once, Discord, Schedule } from '@decorators' -import { Database, Logger, Scheduler } from '@services' -import { syncAllGuilds, resolveDependency } from '@utils/functions' - +import { ActivityType } from "discord.js" +import { Client } from "discordx" +import { injectable } from "tsyringe" + +import { generalConfig, logsConfig } from "@config" +import { Discord, Once, Schedule } from "@decorators" +import { Data } from "@entities" +import { Database, Logger, Scheduler } from "@services" +import { resolveDependency, syncAllGuilds } from "@utils/functions" @Discord() @injectable() diff --git a/src/guards/disabled.ts b/src/guards/disabled.ts index 9755d071..8792f0d7 100644 --- a/src/guards/disabled.ts +++ b/src/guards/disabled.ts @@ -1,8 +1,8 @@ -import { GuardFunction, SimpleCommandMessage } from 'discordx' -import { ContextMenuCommandInteraction, CommandInteraction } from 'discord.js' +import { CommandInteraction, ContextMenuCommandInteraction } from "discord.js" +import { GuardFunction, SimpleCommandMessage } from "discordx" -import { getLocaleFromInteraction, L } from '@i18n' -import { resolveUser, replyToInteraction, isDev } from '@utils/functions' +import { getLocaleFromInteraction, L } from "@i18n" +import { isDev, replyToInteraction, resolveUser } from "@utils/functions" /** * Prevent interaction from running when it is disabled diff --git a/src/guards/extractLocale.ts b/src/guards/extractLocale.ts index f79402c9..5af7f48b 100644 --- a/src/guards/extractLocale.ts +++ b/src/guards/extractLocale.ts @@ -1,10 +1,7 @@ -import { GuardFunction, SimpleCommandMessage } from 'discordx' -import { ContextMenuCommandInteraction, CommandInteraction as DCommandInteraction, Interaction, MessageContextMenuCommandInteraction, UserContextMenuCommandInteraction, CommandInteraction, SelectMenuInteraction, ButtonInteraction } from 'discord.js' +import { ButtonInteraction, CommandInteraction, ContextMenuCommandInteraction, Interaction, SelectMenuInteraction } from "discord.js" +import { GuardFunction, SimpleCommandMessage } from "discordx" -import { getLocaleFromInteraction, L } from '@i18n' -import { resolveUser, replyToInteraction } from '@utils/functions' - -import { generalConfig } from '@config' +import { getLocaleFromInteraction, L } from "@i18n" /** * Extract locale from any interaction and pass it as guard data diff --git a/src/guards/guildOnly.ts b/src/guards/guildOnly.ts index 9ecd1224..e7b21880 100644 --- a/src/guards/guildOnly.ts +++ b/src/guards/guildOnly.ts @@ -1,8 +1,8 @@ -import { CommandInteraction } from 'discord.js' -import { GuardFunction, SimpleCommandMessage } from 'discordx' +import { CommandInteraction } from "discord.js" +import { GuardFunction, SimpleCommandMessage } from "discordx" -import { L, getLocaleFromInteraction } from '@i18n' -import { replyToInteraction } from '@utils/functions' +import { getLocaleFromInteraction, L } from "@i18n" +import { replyToInteraction } from "@utils/functions" /** * Prevent the command from running on DM diff --git a/src/guards/maintenance.ts b/src/guards/maintenance.ts index a38a495e..91d04d80 100644 --- a/src/guards/maintenance.ts +++ b/src/guards/maintenance.ts @@ -1,10 +1,8 @@ -import { CommandInteraction, ContextMenuCommandInteraction } from 'discord.js' -import { ArgsOf, GuardFunction, SimpleCommandMessage } from 'discordx' +import { CommandInteraction, ContextMenuCommandInteraction } from "discord.js" +import { ArgsOf, GuardFunction, SimpleCommandMessage } from "discordx" -import { resolveUser, isInMaintenance, replyToInteraction, isDev } from '@utils/functions' -import { getLocaleFromInteraction, L } from '@i18n' - -import { generalConfig } from '@config' +import { getLocaleFromInteraction, L } from "@i18n" +import { isDev, isInMaintenance, replyToInteraction, resolveUser } from "@utils/functions" /** * Prevent interactions from running when bot is in maintenance diff --git a/src/guards/nsfw.ts b/src/guards/nsfw.ts index 47367623..2c966f43 100644 --- a/src/guards/nsfw.ts +++ b/src/guards/nsfw.ts @@ -2,7 +2,7 @@ import { CommandInteraction, TextChannel } from "discord.js" import { GuardFunction, SimpleCommandMessage } from "discordx" import { getLocaleFromInteraction, L } from "@i18n" -import { resolveChannel, replyToInteraction } from "@utils/functions" +import { replyToInteraction, resolveChannel } from "@utils/functions" /** * Prevent NSFW command from running in non-NSFW channels diff --git a/src/i18n/detectors.ts b/src/i18n/detectors.ts index 237170c7..413cfdb9 100644 --- a/src/i18n/detectors.ts +++ b/src/i18n/detectors.ts @@ -1,8 +1,8 @@ -import { detectLocale } from './i18n-util' +import { detectLocale } from "./i18n-util" -import { resolveLocale } from '@utils/functions' +import { resolveLocale } from "@utils/functions" -import { generalConfig } from '@config' +import { generalConfig } from "@config" const allInteractionsLocaleDetector = (interaction: AllInteractions) => { diff --git a/src/i18n/en/index.ts b/src/i18n/en/index.ts index 2051211e..457a3966 100644 --- a/src/i18n/en/index.ts +++ b/src/i18n/en/index.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -import type { BaseTranslation } from '../i18n-types' +import type { BaseTranslation } from "../i18n-types" const en: BaseTranslation = { GUARDS: { diff --git a/src/i18n/formatters.ts b/src/i18n/formatters.ts index 78734f9a..56801f8c 100644 --- a/src/i18n/formatters.ts +++ b/src/i18n/formatters.ts @@ -1,5 +1,5 @@ -import type { FormattersInitializer } from 'typesafe-i18n' -import type { Locales, Formatters } from './i18n-types' +import type { FormattersInitializer } from "typesafe-i18n" +import type { Locales, Formatters } from "./i18n-types" export const initFormatters: FormattersInitializer = (locale: Locales) => { diff --git a/src/i18n/fr/index.ts b/src/i18n/fr/index.ts index be67e8ef..78cca07e 100644 --- a/src/i18n/fr/index.ts +++ b/src/i18n/fr/index.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -import type { Translation } from '../i18n-types' +import type { Translation } from "../i18n-types" const fr: Translation = { GUARDS: { diff --git a/src/i18n/i18n-node.ts b/src/i18n/i18n-node.ts index e5e91a9b..506d9f9f 100644 --- a/src/i18n/i18n-node.ts +++ b/src/i18n/i18n-node.ts @@ -1,8 +1,8 @@ // This file was auto-generated by 'typesafe-i18n'. Any manual changes will be overwritten. /* eslint-disable */ -import { i18n } from './i18n-util' -import { loadAllLocales } from './i18n-util.sync' +import { i18n } from "./i18n-util" +import { loadAllLocales } from "./i18n-util.sync" loadAllLocales() diff --git a/src/i18n/i18n-types.ts b/src/i18n/i18n-types.ts index c94b70c6..355da420 100644 --- a/src/i18n/i18n-types.ts +++ b/src/i18n/i18n-types.ts @@ -1,6 +1,6 @@ // This file was auto-generated by 'typesafe-i18n'. Any manual changes will be overwritten. /* eslint-disable */ -import type { BaseTranslation as BaseTranslationType, LocalizedString, RequiredParams } from 'typesafe-i18n' +import type { BaseTranslation as BaseTranslationType, LocalizedString, RequiredParams } from "typesafe-i18n" export type BaseTranslation = BaseTranslationType export type BaseLocale = 'en' diff --git a/src/i18n/i18n-util.async.ts b/src/i18n/i18n-util.async.ts index 13e8d99f..eb8a9f70 100644 --- a/src/i18n/i18n-util.async.ts +++ b/src/i18n/i18n-util.async.ts @@ -1,9 +1,9 @@ // This file was auto-generated by 'typesafe-i18n'. Any manual changes will be overwritten. /* eslint-disable */ -import { initFormatters } from './formatters' -import type { Locales, Translations } from './i18n-types' -import { loadedFormatters, loadedLocales, locales } from './i18n-util' +import { initFormatters } from "./formatters" +import type { Locales, Translations } from "./i18n-types" +import { loadedFormatters, loadedLocales, locales } from "./i18n-util" const localeTranslationLoaders = { en: () => import('./en'), diff --git a/src/i18n/i18n-util.sync.ts b/src/i18n/i18n-util.sync.ts index fe0ba74f..e71514a2 100644 --- a/src/i18n/i18n-util.sync.ts +++ b/src/i18n/i18n-util.sync.ts @@ -1,12 +1,12 @@ // This file was auto-generated by 'typesafe-i18n'. Any manual changes will be overwritten. /* eslint-disable */ -import { initFormatters } from './formatters' -import type { Locales, Translations } from './i18n-types' -import { loadedFormatters, loadedLocales, locales } from './i18n-util' +import { initFormatters } from "./formatters" +import type { Locales, Translations } from "./i18n-types" +import { loadedFormatters, loadedLocales, locales } from "./i18n-util" -import en from './en' -import fr from './fr' +import en from "./en" +import fr from "./fr" const localeTranslations = { en, diff --git a/src/i18n/i18n-util.ts b/src/i18n/i18n-util.ts index 9088944f..eb53db2e 100644 --- a/src/i18n/i18n-util.ts +++ b/src/i18n/i18n-util.ts @@ -1,10 +1,10 @@ // This file was auto-generated by 'typesafe-i18n'. Any manual changes will be overwritten. /* eslint-disable */ -import { i18n as initI18n, i18nObject as initI18nObject, i18nString as initI18nString } from 'typesafe-i18n' -import type { LocaleDetector } from 'typesafe-i18n/detectors' -import { detectLocale as detectLocaleFn } from 'typesafe-i18n/detectors' -import type { Formatters, Locales, Translations, TranslationFunctions } from './i18n-types' +import { i18n as initI18n, i18nObject as initI18nObject, i18nString as initI18nString } from "typesafe-i18n" +import type { LocaleDetector } from "typesafe-i18n/detectors" +import { detectLocale as detectLocaleFn } from "typesafe-i18n/detectors" +import type { Formatters, Locales, Translations, TranslationFunctions } from "./i18n-types" export const baseLocale: Locales = 'en' diff --git a/src/i18n/index.ts b/src/i18n/index.ts index f7258ee1..b56c924b 100644 --- a/src/i18n/index.ts +++ b/src/i18n/index.ts @@ -1,4 +1,4 @@ -export { L } from './i18n-node' -export { getLocaleFromInteraction } from './detectors' +export { L } from "./i18n-node" +export { getLocaleFromInteraction } from "./detectors" export type { Locales, Translation } from "./i18n-types" export { loadedLocales, locales } from "./i18n-util" \ No newline at end of file diff --git a/src/main.ts b/src/main.ts index dc617964..6567f817 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,18 +1,17 @@ -import 'reflect-metadata' import 'dotenv/config' +import 'reflect-metadata' -import { container } from 'tsyringe' -import discordLogs from 'discord-logs' -import { DIService, Client, tsyringeDependencyRegistryEngine } from 'discordx' -import { importx } from '@discordx/importer' - -import { Database, ImagesUpload, ErrorHandler, Logger, WebSocket, PluginsManager } from '@services' -import { initDataTable, resolveDependency } from '@utils/functions' -import { Server } from '@api/server' +import { importx } from "@discordx/importer" +import discordLogs from "discord-logs" +import { Client, DIService, tsyringeDependencyRegistryEngine } from "discordx" +import { container } from "tsyringe" -import { clientConfig } from './client' -import { apiConfig, generalConfig, websocketConfig } from '@config' -import { NoBotTokenError } from '@errors' +import { Server } from "@api/server" +import { apiConfig, generalConfig, websocketConfig } from "@config" +import { NoBotTokenError } from "@errors" +import { Database, ErrorHandler, ImagesUpload, Logger, PluginsManager, WebSocket } from "@services" +import { initDataTable, resolveDependency } from "@utils/functions" +import { clientConfig } from "./client" async function run() { @@ -49,7 +48,6 @@ async function run() { await importx(__dirname + "/{events,commands}/**/*.{ts,js}") await pluginManager.importCommands() await pluginManager.importEvents() - // init the data table if it doesn't exist await initDataTable() diff --git a/src/services/Database.ts b/src/services/Database.ts index 3971c55d..22b50cac 100644 --- a/src/services/Database.ts +++ b/src/services/Database.ts @@ -1,13 +1,14 @@ -import { databaseConfig, mikroORMConfig } from '@config' -import { Schedule } from '@decorators' -import { EntityName, MikroORM, Options } from '@mikro-orm/core' -import { Logger, PluginsManager } from '@services' -import fastFolderSizeSync from 'fast-folder-size/sync' -import fs from 'fs' -import { backup, restore } from 'saveqlite' -import { delay, inject, singleton } from 'tsyringe' -import * as entities from '@entities' -import { resolveDependency } from '@utils/functions' +import { databaseConfig, mikroORMConfig } from "@config" +import { EntityName, MikroORM, Options } from "@mikro-orm/core" +import fastFolderSizeSync from "fast-folder-size/sync" +import fs from "fs" +import { delay, inject, singleton } from "tsyringe" + +import { Schedule } from "@decorators" +import * as entities from "@entities" +import { Logger, PluginsManager } from "@services" +import { resolveDependency } from "@utils/functions" +import { backup, restore } from "saveqlite" @singleton() export class Database { diff --git a/src/services/ErrorHandler.ts b/src/services/ErrorHandler.ts index 0c3ae772..f0f8f15e 100644 --- a/src/services/ErrorHandler.ts +++ b/src/services/ErrorHandler.ts @@ -1,8 +1,7 @@ -import { Client } from 'discordx' -import { singleton } from 'tsyringe' +import { singleton } from "tsyringe" -import { Logger } from '@services' -import { BaseError } from '@utils/classes' +import { Logger } from "@services" +import { BaseError } from "@utils/classes" @singleton() export class ErrorHandler { diff --git a/src/services/ImagesUpload.ts b/src/services/ImagesUpload.ts index 2f0a622f..ba502e4b 100644 --- a/src/services/ImagesUpload.ts +++ b/src/services/ImagesUpload.ts @@ -1,13 +1,13 @@ -import { singleton } from "tsyringe" -import { ImgurClient } from "imgur" +import axios from "axios" +import chalk from "chalk" import { imageHash as callbackImageHash } from "image-hash" +import { ImgurClient } from "imgur" +import { singleton } from "tsyringe" import { promisify } from "util" -import axios from "axios" -import { Database, Logger } from "@services" import { Image, ImageRepository } from "@entities" -import { base64Encode, getFiles, fileOrDirectoryExists } from "@utils/functions" -import chalk from "chalk" +import { Database, Logger } from "@services" +import { base64Encode, fileOrDirectoryExists, getFiles } from "@utils/functions" const imageHasher = promisify(callbackImageHash) diff --git a/src/services/Logger.ts b/src/services/Logger.ts index a07521ec..945ba064 100644 --- a/src/services/Logger.ts +++ b/src/services/Logger.ts @@ -1,17 +1,17 @@ -import * as controllers from '@api/controllers' -import { apiConfig, logsConfig } from '@config' -import { Pastebin, Scheduler, WebSocket } from '@services' -import { fileOrDirectoryExists, formatDate, getTypeOfInteraction, numberAlign, oneLine, resolveAction, resolveChannel, resolveDependency, resolveGuild, resolveUser, validString } from '@utils/functions' -import boxen from 'boxen' -import { constant } from 'case' -import chalk from 'chalk' -import { BaseMessageOptions, TextChannel, ThreadChannel, User } from 'discord.js' -import { Client, MetadataStorage } from 'discordx' -import fs from 'fs' -import ora from 'ora' -import { parse, StackFrame } from 'stacktrace-parser' -import { delay, inject, singleton } from 'tsyringe' -import { PluginsManager } from './PluginsManager' +import boxen from "boxen" +import { constant } from "case" +import chalk from "chalk" +import { BaseMessageOptions, TextChannel, ThreadChannel, User } from "discord.js" +import { Client, MetadataStorage } from "discordx" +import fs from "fs" +import ora from "ora" +import { parse, StackFrame } from "stacktrace-parser" +import { delay, inject, singleton } from "tsyringe" + +import * as controllers from "@api/controllers" +import { apiConfig, logsConfig } from "@config" +import { Pastebin, PluginsManager, Scheduler, WebSocket } from "@services" +import { fileOrDirectoryExists, formatDate, getTypeOfInteraction, numberAlign, oneLine, resolveAction, resolveChannel, resolveDependency, resolveGuild, resolveUser, validString } from "@utils/functions" @singleton() export class Logger { diff --git a/src/services/Pastebin.ts b/src/services/Pastebin.ts index aabbbbe2..cab237ce 100644 --- a/src/services/Pastebin.ts +++ b/src/services/Pastebin.ts @@ -1,10 +1,10 @@ +import dayjs from "dayjs" import { Paste, RentryClient } from "rentry-pastebin" import { singleton } from "tsyringe" -import dayjs from "dayjs" +import { Schedule } from "@decorators" import { Pastebin as PastebinEntity } from "@entities" import { Database } from "@services" -import { Schedule } from '@decorators' @singleton() export class Pastebin { @@ -57,6 +57,7 @@ export class Pastebin { const pastes = await this.db.get(PastebinEntity).find({ lifetime: { $gt: 0 } }) for (const paste of pastes) { + const diff = dayjs().diff(dayjs(paste.createdAt), 'day') if (diff >= paste.lifetime) { diff --git a/src/services/PluginsManager.ts b/src/services/PluginsManager.ts index 9ba4e614..3c44c6f0 100644 --- a/src/services/PluginsManager.ts +++ b/src/services/PluginsManager.ts @@ -1,13 +1,12 @@ -import { ImportLocaleMapping, storeTranslationsToDisk } from "typesafe-i18n/importer" import { resolve } from "@discordx/importer" -import { singleton } from "tsyringe" +import { AnyEntity, EntityClass } from "@mikro-orm/core" import fs from "fs" - -import { BaseController, Plugin } from "@utils/classes" +import { singleton } from "tsyringe" import { BaseTranslation } from "typesafe-i18n" +import { ImportLocaleMapping, storeTranslationsToDisk } from "typesafe-i18n/importer" + import { locales } from "@i18n" -import { AnyEntity, EntityClass } from "@mikro-orm/core" -import { cwd } from "process" +import { BaseController, Plugin } from "@utils/classes" import { getSourceCodeLocation } from "@utils/functions" @singleton() @@ -47,10 +46,13 @@ export class PluginsManager { } public async initServices(): Promise<{ [key: string]: any }> { + let services: { [key: string]: any } = {} for (const plugin of this._plugins) { + for (const service in plugin.services) { + services[service] = new plugin.services[service]() } } @@ -59,10 +61,14 @@ export class PluginsManager { } public async execMains(): Promise { - for (const plugin of this._plugins) await plugin.execMain() + + for (const plugin of this._plugins) { + await plugin.execMain() + } } public async syncTranslations(): Promise { + let localeMapping: ImportLocaleMapping[] = [] let namespaces: { [key: string]: string[] } = {} let translations: { [key: string]: BaseTranslation } = {} @@ -83,7 +89,9 @@ export class PluginsManager { } for (const locale in translations) { + if (!locales.includes(locale as any)) continue + localeMapping.push({ locale, translations: translations[locale], @@ -92,9 +100,11 @@ export class PluginsManager { } const pluginsName = this._plugins.map(plugin => plugin.name) + for (const path of await resolve(getSourceCodeLocation() + '/i18n/*/*/index.ts')) { const name = path.split("/").at(-2) || "" + if (!pluginsName.includes(name)) { await fs.rmSync(path.slice(0, -8), { recursive: true, force: true }) } diff --git a/src/services/Stats.ts b/src/services/Stats.ts index 8d88b4f5..1cd572c4 100644 --- a/src/services/Stats.ts +++ b/src/services/Stats.ts @@ -1,16 +1,15 @@ -import { Client, SimpleCommandMessage } from 'discordx' -import { delay, inject, singleton } from 'tsyringe' -import { EntityRepository } from '@mikro-orm/core' -import { constant } from 'case' -import osu from 'node-os-utils' -import pidusage from 'pidusage' - -import { Database, WebSocket } from '@services' -import { Guild, Stat, User } from '@entities' -import { formatDate, getTypeOfInteraction, resolveAction, resolveChannel, resolveGuild, resolveUser, datejs, isInMaintenance, resolveDependency } from '@utils/functions' -import { Schedule, WSOn } from '@decorators' - -import { statsConfig, websocketConfig } from '@config' +import { EntityRepository } from "@mikro-orm/core" +import { constant } from "case" +import { Client, SimpleCommandMessage } from "discordx" +import osu from "node-os-utils" +import pidusage from "pidusage" +import { delay, inject, singleton } from "tsyringe" + +import { statsConfig, websocketConfig } from "@config" +import { Schedule, WSOn } from "@decorators" +import { Guild, Stat, User } from "@entities" +import { Database, WebSocket } from "@services" +import { datejs, formatDate, getTypeOfInteraction, isInMaintenance, resolveAction, resolveChannel, resolveGuild, resolveUser } from "@utils/functions" const allInteractions = { $or: [ diff --git a/src/services/Store.ts b/src/services/Store.ts index ff5ad0bd..68a3c6e4 100644 --- a/src/services/Store.ts +++ b/src/services/Store.ts @@ -1,5 +1,5 @@ -import { singleton } from 'tsyringe' -import { Store as RxStore } from 'rxeta' +import { Store as RxStore } from "rxeta" +import { singleton } from "tsyringe" interface State { diff --git a/src/services/WebSocket.ts b/src/services/WebSocket.ts index edd0ff41..89fc33a4 100644 --- a/src/services/WebSocket.ts +++ b/src/services/WebSocket.ts @@ -1,8 +1,8 @@ -import { io, Socket } from 'socket.io-client' -import { singleton } from 'tsyringe' +import { io, Socket } from "socket.io-client" +import { singleton } from "tsyringe" -import { generalConfig } from '@config' -import { getDevs, validString } from '@utils/functions' +import { generalConfig } from "@config" +import { getDevs, validString } from "@utils/functions" @singleton() export class WebSocket { diff --git a/src/utils/classes/BaseError.ts b/src/utils/classes/BaseError.ts index da41eeb3..99c41bba 100644 --- a/src/utils/classes/BaseError.ts +++ b/src/utils/classes/BaseError.ts @@ -1,7 +1,6 @@ import { Logger } from "@services" import { resolveDependency } from "@utils/functions" - export abstract class BaseError extends Error { protected logger: Logger diff --git a/src/utils/classes/Plugin.ts b/src/utils/classes/Plugin.ts index b74535b1..e0db40fc 100644 --- a/src/utils/classes/Plugin.ts +++ b/src/utils/classes/Plugin.ts @@ -1,13 +1,13 @@ -import { AnyEntity, EntityClass } from "@mikro-orm/core" import { importx, resolve } from "@discordx/importer" -import { BaseTranslation } from "typesafe-i18n" -import semver from "semver" +import { AnyEntity, EntityClass } from "@mikro-orm/core" import fs from "fs" +import semver from "semver" +import { BaseTranslation } from "typesafe-i18n" import { generalConfig } from "@config" +import { locales } from "@i18n" import { BaseController } from "@utils/classes" import { getSourceCodeLocation } from "@utils/functions" -import { locales } from "@i18n" export class Plugin { diff --git a/src/utils/decorators/ContextMenu.ts b/src/utils/decorators/ContextMenu.ts index 47ccda95..b2965b1f 100644 --- a/src/utils/decorators/ContextMenu.ts +++ b/src/utils/decorators/ContextMenu.ts @@ -1,7 +1,7 @@ -import { ContextMenu as ContextMenuX } from 'discordx' +import { ApplicationCommandType } from "discord.js" +import { ContextMenu as ContextMenuX } from "discordx" -import { constantPreserveDots, getCallerFile, sanitizeLocales, setOptionsLocalization } from '@utils/functions' -import { ApplicationCommandType } from 'discord.js' +import { constantPreserveDots, getCallerFile, sanitizeLocales, setOptionsLocalization } from "@utils/functions" /** * Interact with context menu with a defined identifier diff --git a/src/utils/decorators/On.ts b/src/utils/decorators/On.ts index f8f415da..2ce175e2 100644 --- a/src/utils/decorators/On.ts +++ b/src/utils/decorators/On.ts @@ -1,4 +1,4 @@ -import { EventOptions, MethodDecoratorEx, DOn, MetadataStorage } from 'discordx' +import { DOn, EventOptions, MetadataStorage, MethodDecoratorEx } from "discordx" /** * Handle both discord and custom events with a defined handler diff --git a/src/utils/decorators/Once.ts b/src/utils/decorators/Once.ts index f80d538c..2c4f4056 100644 --- a/src/utils/decorators/Once.ts +++ b/src/utils/decorators/Once.ts @@ -1,4 +1,4 @@ -import { EventOptions, MethodDecoratorEx, DOn, MetadataStorage } from 'discordx' +import { DOn, EventOptions, MetadataStorage, MethodDecoratorEx } from "discordx" /** * Handle both discord and custom events only **once** with a defined handler diff --git a/src/utils/decorators/Schedule.ts b/src/utils/decorators/Schedule.ts index 726f0f06..8c824b92 100644 --- a/src/utils/decorators/Schedule.ts +++ b/src/utils/decorators/Schedule.ts @@ -1,8 +1,8 @@ -import { container, InjectionToken } from "tsyringe" +import { CronJob } from "cron" import { isValidCron } from "cron-validator" -import { CronJob } from 'cron' +import { container, InjectionToken } from "tsyringe" -import { generalConfig } from '@config' +import { generalConfig } from "@config" import { resolveDependency } from "@utils/functions" /** diff --git a/src/utils/decorators/Slash.ts b/src/utils/decorators/Slash.ts index a775199a..d977fa12 100644 --- a/src/utils/decorators/Slash.ts +++ b/src/utils/decorators/Slash.ts @@ -1,6 +1,6 @@ -import { Slash as SlashX, ApplicationCommandOptions as ApplicationCommandOptionsX, VerifyName } from 'discordx' +import { ApplicationCommandOptions as ApplicationCommandOptionsX, Slash as SlashX, VerifyName } from "discordx" -import { constantPreserveDots, sanitizeLocales, setOptionsLocalization } from '@utils/functions' +import { constantPreserveDots, sanitizeLocales, setOptionsLocalization } from "@utils/functions" /** * Handle a slash command diff --git a/src/utils/decorators/SlashChoice.ts b/src/utils/decorators/SlashChoice.ts index 5a07fa88..8822412b 100644 --- a/src/utils/decorators/SlashChoice.ts +++ b/src/utils/decorators/SlashChoice.ts @@ -1,6 +1,7 @@ -import { constantPreserveDots, sanitizeLocales, setOptionsLocalization } from "@utils/functions" import { SlashChoice as SlashChoiceX } from "discordx" +import { constantPreserveDots, sanitizeLocales, setOptionsLocalization } from "@utils/functions" + /** * The slash command option can implement autocompletion for string and number types * diff --git a/src/utils/decorators/SlashGroup.ts b/src/utils/decorators/SlashGroup.ts index f20145af..cec8e480 100644 --- a/src/utils/decorators/SlashGroup.ts +++ b/src/utils/decorators/SlashGroup.ts @@ -1,7 +1,7 @@ -import { ClassDecoratorEx, ClassMethodDecorator, SlashGroup as SlashGroupX, VerifyName } from 'discordx' -import type { SlashGroupOptions as SlashGroupOptionsX } from 'discordx' +import type { SlashGroupOptions as SlashGroupOptionsX } from "discordx" +import { ClassDecoratorEx, ClassMethodDecorator, SlashGroup as SlashGroupX, VerifyName } from "discordx" -import { constantPreserveDots, sanitizeLocales, setOptionsLocalization } from '@utils/functions' +import { constantPreserveDots, sanitizeLocales, setOptionsLocalization } from "@utils/functions" /** * Create slash group diff --git a/src/utils/decorators/SlashOption.ts b/src/utils/decorators/SlashOption.ts index 7d203200..61d80fdd 100644 --- a/src/utils/decorators/SlashOption.ts +++ b/src/utils/decorators/SlashOption.ts @@ -1,5 +1,5 @@ -import { SlashOption as SlashOptionX, SlashOptionOptions as SlashOptionOptionsX, VerifyName } from "discordx" import { of } from "case" +import { SlashOption as SlashOptionX, SlashOptionOptions as SlashOptionOptionsX, VerifyName } from "discordx" import { InvalidOptionName } from "@errors" import { constantPreserveDots, sanitizeLocales, setOptionsLocalization } from "@utils/functions" diff --git a/src/utils/decorators/WSOn.ts b/src/utils/decorators/WSOn.ts index 880b0d69..0dbe7f21 100644 --- a/src/utils/decorators/WSOn.ts +++ b/src/utils/decorators/WSOn.ts @@ -1,4 +1,4 @@ -import { resolveDependency } from '@utils/functions' +import { resolveDependency } from "@utils/functions" /** * Handle websocket events diff --git a/src/utils/errors/InvalidOptionName.ts b/src/utils/errors/InvalidOptionName.ts index d71076b3..94a8a6df 100644 --- a/src/utils/errors/InvalidOptionName.ts +++ b/src/utils/errors/InvalidOptionName.ts @@ -1,6 +1,7 @@ -import { BaseError } from "@utils/classes" import { snake } from "case" +import { BaseError } from "@utils/classes" + export class InvalidOptionName extends BaseError { constructor(nameOption: string) { diff --git a/src/utils/errors/UnknownReply.ts b/src/utils/errors/UnknownReply.ts index bf172961..de6df011 100644 --- a/src/utils/errors/UnknownReply.ts +++ b/src/utils/errors/UnknownReply.ts @@ -1,8 +1,8 @@ import { CommandInteraction } from "discord.js" -import { getLocaleFromInteraction, L } from '@i18n' -import { simpleErrorEmbed } from '@utils/functions' +import { getLocaleFromInteraction, L } from "@i18n" import { BaseError } from "@utils/classes" +import { simpleErrorEmbed } from "@utils/functions" export class UnknownReplyError extends BaseError { diff --git a/src/utils/functions/colors.ts b/src/utils/functions/colors.ts index b169bbde..d1d71fb2 100644 --- a/src/utils/functions/colors.ts +++ b/src/utils/functions/colors.ts @@ -1,6 +1,12 @@ -import { colorsConfig } from "@config" import { ColorResolvable } from "discord.js" +import { colorsConfig } from "@config" + +/** + * Get a color from the config + * @param colorResolver The color to resolve + * @returns + */ export const getColor = (colorResolver: keyof typeof colorsConfig) => { return colorsConfig[colorResolver] as ColorResolvable diff --git a/src/utils/functions/database.ts b/src/utils/functions/database.ts index 4798fa54..a0876ba5 100644 --- a/src/utils/functions/database.ts +++ b/src/utils/functions/database.ts @@ -1,8 +1,8 @@ -import { Database } from '@services' -import { Data } from '@entities' -import { resolveDependency } from '@utils/functions' +import { Data } from "@entities" +import { Database } from "@services" +import { resolveDependency } from "@utils/functions" -import { defaultData } from '../../entities/Data' +import { defaultData } from "../../entities/Data" type DataType = keyof typeof defaultData diff --git a/src/utils/functions/date.ts b/src/utils/functions/date.ts index 38365c88..dab1d54c 100644 --- a/src/utils/functions/date.ts +++ b/src/utils/functions/date.ts @@ -1,6 +1,6 @@ import dayjs from "dayjs" -import dayjsTimeZone from 'dayjs/plugin/timezone' -import dayjsUTC from 'dayjs/plugin/utc' +import dayjsTimeZone from "dayjs/plugin/timezone" +import dayjsUTC from "dayjs/plugin/utc" import { generalConfig } from "@config" diff --git a/src/utils/functions/dependency.ts b/src/utils/functions/dependency.ts index e4982044..434447ec 100644 --- a/src/utils/functions/dependency.ts +++ b/src/utils/functions/dependency.ts @@ -1,5 +1,5 @@ -import { container, InjectionToken } from 'tsyringe' -import { F } from 'ts-toolbelt' +import { F } from "ts-toolbelt" +import { container, InjectionToken } from "tsyringe" export const resolveDependency = async (token: InjectionToken, interval: number = 500): Promise => { diff --git a/src/utils/functions/embeds.ts b/src/utils/functions/embeds.ts index 0928b367..7704ae26 100644 --- a/src/utils/functions/embeds.ts +++ b/src/utils/functions/embeds.ts @@ -1,5 +1,6 @@ import { CommandInteraction, EmbedBuilder } from "discord.js" -import { replyToInteraction } from '@utils/functions' + +import { replyToInteraction } from "@utils/functions" /** * Send a simple success embed * @param interaction - discord interaction diff --git a/src/utils/functions/eval.ts b/src/utils/functions/eval.ts index 466e5f0d..be3a63ca 100644 --- a/src/utils/functions/eval.ts +++ b/src/utils/functions/eval.ts @@ -1,6 +1,6 @@ -import { Message } from 'discord.js' +import { Message } from "discord.js" -import { generalConfig } from '@config' +import { generalConfig } from "@config" const clean = (text: any) => { if (typeof (text) === 'string') return text.replace(/`/g, '`' + String.fromCharCode(8203)).replace(/@/g, '@' + String.fromCharCode(8203)) diff --git a/src/utils/functions/files.ts b/src/utils/functions/files.ts index 54e316a6..643f57ed 100644 --- a/src/utils/functions/files.ts +++ b/src/utils/functions/files.ts @@ -1,4 +1,4 @@ -import fs from 'fs' +import fs from "fs" /** * recursively get files paths from a directory diff --git a/src/utils/functions/image.ts b/src/utils/functions/image.ts index 240357bb..ebdc438e 100644 --- a/src/utils/functions/image.ts +++ b/src/utils/functions/image.ts @@ -1,6 +1,6 @@ -import { resolveDependency } from "@utils/functions" -import { Database } from "@services" import { Image } from "@entities" +import { Database } from "@services" +import { resolveDependency } from "@utils/functions" /** * Abstraction level for the image repository that will find an image by its name (with or without extension). diff --git a/src/utils/functions/localization.ts b/src/utils/functions/localization.ts index 51e3872f..9be9a657 100644 --- a/src/utils/functions/localization.ts +++ b/src/utils/functions/localization.ts @@ -1,6 +1,6 @@ -import { loadedLocales, locales } from "@i18n" -import type { Locales } from "@i18n" import { generalConfig } from "@config" +import type { Locales } from "@i18n" +import { loadedLocales, locales } from "@i18n" export const getLocalizedInfo = (target: 'NAME' | 'DESCRIPTION', localizationSource: TranslationsNestedPaths) => { diff --git a/src/utils/functions/maintenance.ts b/src/utils/functions/maintenance.ts index 1cc7a0ae..913905a9 100644 --- a/src/utils/functions/maintenance.ts +++ b/src/utils/functions/maintenance.ts @@ -1,6 +1,6 @@ -import { resolveDependency } from "@utils/functions" -import { Database } from "@services" import { Data } from "@entities" +import { Database } from "@services" +import { resolveDependency } from "@utils/functions" /** * Get the maintenance state of the bot. diff --git a/src/utils/functions/prefix.ts b/src/utils/functions/prefix.ts index 94f773fc..0a27581d 100644 --- a/src/utils/functions/prefix.ts +++ b/src/utils/functions/prefix.ts @@ -1,9 +1,9 @@ -import { Message } from 'discord.js' +import { Message } from "discord.js" +import { generalConfig } from "@config" +import { Guild } from "@entities" +import { Database } from "@services" import { resolveDependency } from "@utils/functions" -import { generalConfig } from '@config' -import { Database } from '@services' -import { Guild } from '@entities' /** * Get prefix from the database or from the config file. diff --git a/src/utils/functions/synchronizer.ts b/src/utils/functions/synchronizer.ts index 721bd3fc..b921f4b3 100644 --- a/src/utils/functions/synchronizer.ts +++ b/src/utils/functions/synchronizer.ts @@ -1,7 +1,7 @@ +import { User as DUser } from "discord.js" import { Client } from "discordx" -import { User as DUser} from "discord.js" -import { User, Guild } from "@entities" +import { Guild, User } from "@entities" import { Database, Logger, Stats } from "@services" import { resolveDependencies, resolveDependency } from "@utils/functions"