From eaf5e9dfde9af3da0817c045541fd3101e3e004b Mon Sep 17 00:00:00 2001 From: Jersey Date: Sat, 16 Mar 2024 19:09:39 -0400 Subject: [PATCH 01/13] redo a lot of the structure of core Signed-off-by: Jersey --- packages/bolt-discord/_deps.ts | 2 +- packages/bolt-discord/mod.ts | 4 +- packages/bolt-guilded/_deps.ts | 2 +- packages/bolt-guilded/mod.ts | 4 +- packages/bolt-revolt/deps.ts | 2 +- packages/bolt-revolt/mod.ts | 4 +- packages/bolt/_deps.ts | 9 - packages/bolt/_testdata.ts | 9 +- packages/bolt/_tests.ts | 18 +- packages/bolt/bolt.ts | 59 +- packages/bolt/bridges/_command_functions.ts | 3 +- packages/bolt/bridges/_commands.ts | 3 +- packages/bolt/bridges/_deps.ts | 10 - packages/bolt/bridges/mod.ts | 48 +- packages/bolt/bridges/types.ts | 1 + packages/bolt/cli.ts | 44 +- packages/bolt/cmds/_default.ts | 40 -- packages/bolt/cmds/_deps.ts | 3 - packages/bolt/cmds/mod.ts | 56 -- packages/bolt/cmds/types.ts | 25 - packages/bolt/deno.jsonc | 9 +- packages/bolt/deno.lock | 562 ++++++++++++++++++ packages/bolt/migrations/_utils.ts | 26 - packages/bolt/migrations/mod.ts | 26 - packages/bolt/mod.ts | 22 +- packages/bolt/utils/_deps.ts | 5 - .../_fourbetafive.ts} | 10 +- .../_fourfourbeta.ts} | 23 +- packages/bolt/utils/commands.ts | 122 ++++ packages/bolt/utils/config.ts | 1 + packages/bolt/utils/errors.ts | 46 +- packages/bolt/utils/messages.ts | 10 +- packages/bolt/utils/migrations.ts | 30 + packages/bolt/utils/mod.ts | 26 +- packages/bolt/utils/plugins.ts | 41 +- 35 files changed, 917 insertions(+), 388 deletions(-) delete mode 100644 packages/bolt/_deps.ts delete mode 100644 packages/bolt/bridges/_deps.ts delete mode 100644 packages/bolt/cmds/_default.ts delete mode 100644 packages/bolt/cmds/_deps.ts delete mode 100644 packages/bolt/cmds/mod.ts delete mode 100644 packages/bolt/cmds/types.ts create mode 100644 packages/bolt/deno.lock delete mode 100644 packages/bolt/migrations/_utils.ts delete mode 100644 packages/bolt/migrations/mod.ts delete mode 100644 packages/bolt/utils/_deps.ts rename packages/bolt/{migrations/fourbetatofive.ts => utils/_fourbetafive.ts} (74%) rename packages/bolt/{migrations/fourtofourbeta.ts => utils/_fourfourbeta.ts} (68%) create mode 100644 packages/bolt/utils/commands.ts create mode 100644 packages/bolt/utils/migrations.ts diff --git a/packages/bolt-discord/_deps.ts b/packages/bolt-discord/_deps.ts index 3576edb..ba751c4 100644 --- a/packages/bolt-discord/_deps.ts +++ b/packages/bolt-discord/_deps.ts @@ -11,7 +11,7 @@ export { REST as rest, type RawFile } from 'npm:@discordjs/rest@2.2.0'; export { WebSocketManager as socket } from 'npm:@discordjs/ws@1.0.2'; export { Bolt, - bolt_plugin, + plugin, type bridge_platform, type deleted_message, type message diff --git a/packages/bolt-discord/mod.ts b/packages/bolt-discord/mod.ts index d0e182d..c0740c0 100644 --- a/packages/bolt-discord/mod.ts +++ b/packages/bolt-discord/mod.ts @@ -1,7 +1,7 @@ import { Bolt, Client, - bolt_plugin, + plugin, bridge_platform, deleted_message, message, @@ -18,7 +18,7 @@ export type discord_config = { slash_cmds?: boolean; }; -export class discord_plugin extends bolt_plugin { +export class discord_plugin extends plugin { bot: Client; name = 'bolt-discord'; version = '0.5.8'; diff --git a/packages/bolt-guilded/_deps.ts b/packages/bolt-guilded/_deps.ts index 4f9e0ef..1d9cfed 100644 --- a/packages/bolt-guilded/_deps.ts +++ b/packages/bolt-guilded/_deps.ts @@ -13,7 +13,7 @@ export { } from 'npm:guilded.js@0.23.7'; export { Bolt, - bolt_plugin, + plugin, create_message, type bridge_platform, type deleted_message, diff --git a/packages/bolt-guilded/mod.ts b/packages/bolt-guilded/mod.ts index 9266c59..79f8390 100644 --- a/packages/bolt-guilded/mod.ts +++ b/packages/bolt-guilded/mod.ts @@ -3,7 +3,7 @@ import { Client, WebhookPayload, WebhookClient, - bolt_plugin, + plugin, bridge_platform, deleted_message, message @@ -11,7 +11,7 @@ import { import { bridge_legacy } from './legacybridging.ts'; import { tocore, toguilded } from './messages.ts'; -export class guilded_plugin extends bolt_plugin<{ token: string }> { +export class guilded_plugin extends plugin<{ token: string }> { bot: Client; name = 'bolt-guilded'; version = '0.5.8'; diff --git a/packages/bolt-revolt/deps.ts b/packages/bolt-revolt/deps.ts index 7ce2e50..b0734a0 100644 --- a/packages/bolt-revolt/deps.ts +++ b/packages/bolt-revolt/deps.ts @@ -11,7 +11,7 @@ export { } from 'npm:@williamhorning/revolt.js@7.0.0-beta.10'; export { Bolt, - bolt_plugin, + plugin, type bridge_platform, type message } from '../bolt/mod.ts'; diff --git a/packages/bolt-revolt/mod.ts b/packages/bolt-revolt/mod.ts index e24bbf7..84621ca 100644 --- a/packages/bolt-revolt/mod.ts +++ b/packages/bolt-revolt/mod.ts @@ -2,13 +2,13 @@ import { Bolt, Client, Message, - bolt_plugin, + plugin, bridge_platform, message } from './deps.ts'; import { tocore, torevolt } from './messages.ts'; -export class revolt_plugin extends bolt_plugin<{ token: string }> { +export class revolt_plugin extends plugin<{ token: string }> { bot: Client; name = 'bolt-revolt'; version = '0.5.8'; diff --git a/packages/bolt/_deps.ts b/packages/bolt/_deps.ts deleted file mode 100644 index a29e1c0..0000000 --- a/packages/bolt/_deps.ts +++ /dev/null @@ -1,9 +0,0 @@ -export { EventEmitter } from 'jsr:@denosaurs/event@^2.0.2'; -export { - MongoClient, - type Document, - type Collection -} from 'https://deno.land/x/mongo@v0.32.0/mod.ts'; -export { connect } from 'https://deno.land/x/redis@v0.32.0/mod.ts'; -export { parseArgs } from 'jsr:@std/cli@^0.219.1/parse_args'; -export { assertEquals } from 'jsr:@std/assert@^0.219.1/assert_equals'; diff --git a/packages/bolt/_testdata.ts b/packages/bolt/_testdata.ts index 803a507..8dfa2e5 100644 --- a/packages/bolt/_testdata.ts +++ b/packages/bolt/_testdata.ts @@ -14,8 +14,7 @@ export const cmd_help_output = { platform: { name: 'bolt', message: undefined - }, - uuid: undefined + } }; export const migrations_four_one = [ @@ -102,8 +101,7 @@ export const utils_msg = { platform: { name: 'bolt', message: undefined - }, - uuid: 'test' + } }; export const utils_cfg = { @@ -141,8 +139,7 @@ export const utils_err_return = { platform: { name: 'bolt', message: undefined - }, - uuid: 'test' + } } }; diff --git a/packages/bolt/_tests.ts b/packages/bolt/_tests.ts index f65ca8b..da38427 100644 --- a/packages/bolt/_tests.ts +++ b/packages/bolt/_tests.ts @@ -1,6 +1,4 @@ -// the bolt test suite (incomplete) - -import { assertEquals } from './_deps.ts'; +import { assertEquals } from 'assert_eq'; import { cmd_help_output, migrations_five, @@ -15,17 +13,17 @@ import { utils_err_hook, utils_msg } from './_testdata.ts'; -import { bolt_commands } from './cmds/mod.ts'; import { + Commands, message, apply_migrations, get_migrations, define_config, log_error, create_message -} from './mod.ts'; -import BoltFourToFourBeta from './migrations/fourtofourbeta.ts'; -import BoltFourBetaToFive from './migrations/fourbetatofive.ts'; +} from './utils/mod.ts'; +import BoltFourToFourBeta from './utils/_fourfourbeta.ts'; +import BoltFourBetaToFive from './utils/_fourbetafive.ts'; // override globals @@ -40,7 +38,7 @@ console.log = console.error = () => {}; // cmds Deno.test('bolt/cmds', async t => { - const cmds = new bolt_commands(); + const cmds = new Commands(); await t.step('run help command', async () => { let res: (value: message) => void; @@ -95,7 +93,6 @@ Deno.test('bolt/migrations', async t => { }); await t.step('0.4-beta => 0.5', () => { - // TODO: fix const result = apply_migrations( [BoltFourBetaToFive], migrations_fourbeta @@ -145,8 +142,7 @@ Deno.test('bolt/utils', async t => { await t.step('message creation', () => { const result = create_message({ - text: 'test', - uuid: 'test' + text: 'test' }); result.reply = utils_msg.reply; diff --git a/packages/bolt/bolt.ts b/packages/bolt/bolt.ts index 7c03148..e10a2f5 100644 --- a/packages/bolt/bolt.ts +++ b/packages/bolt/bolt.ts @@ -1,62 +1,39 @@ +import { EventEmitter } from 'event'; +import { MongoClient } from 'mongo'; +import { RedisClient } from 'r2d2'; import { bolt_bridges } from './bridges/mod.ts'; -import { bolt_commands } from './cmds/mod.ts'; -import { connect, EventEmitter, MongoClient } from './_deps.ts'; import { - bolt_plugin, + Commands, + plugin, config, - define_config, + create_plugin, log_error, - plugin_events, - create_plugin + plugin_events } from './utils/mod.ts'; export class Bolt extends EventEmitter { bridge: bolt_bridges; - cmds: bolt_commands = new bolt_commands(); + cmds: Commands = new Commands(); config: config; db: { mongo: MongoClient; - redis: Awaited>; }; - plugins: Map> = new Map< - string, - bolt_plugin - >(); + redis: RedisClient; + plugins: Map> = new Map>(); - static async setup(cfg: Partial): Promise { - const config = define_config(cfg); + // TODO: replace deno.* specific stuff if possible - Deno.env.set('BOLT_ERROR_HOOK', config.errorURL || ''); - - const mongo = new MongoClient(); - - let redis: Bolt['db']['redis'] | undefined; - - try { - await mongo.connect(config.mongo_uri); - redis = await connect({ - hostname: config.redis_host, - port: config.redis_port - }); - } catch (e) { - await log_error(e, { config }); - Deno.exit(1); - } - - return new Bolt(config, mongo, redis); - } - - private constructor( - config: config, - mongo: MongoClient, - redis: Bolt['db']['redis'] - ) { + constructor(config: config, mongo: MongoClient, redis_conn: Deno.TcpConn) { super(); this.config = config; - this.db = { mongo, redis }; + this.db = { mongo }; + this.redis = new RedisClient(redis_conn); this.bridge = new bolt_bridges(this); + } + + async setup() { this.cmds.listen(this); - this.load(this.config.plugins); + await this.load(this.config.plugins); } async load(plugins: { type: create_plugin; config: unknown }[]) { diff --git a/packages/bolt/bridges/_command_functions.ts b/packages/bolt/bridges/_command_functions.ts index 1546b6b..fd701c3 100644 --- a/packages/bolt/bridges/_command_functions.ts +++ b/packages/bolt/bridges/_command_functions.ts @@ -1,4 +1,5 @@ -import { Bolt, command_arguments, create_message, log_error } from './_deps.ts'; +import { Bolt } from '../bolt.ts'; +import { command_arguments, create_message, log_error } from '../utils/mod.ts'; /** join a bridge */ export async function join( diff --git a/packages/bolt/bridges/_commands.ts b/packages/bolt/bridges/_commands.ts index 9442877..6b92c8e 100644 --- a/packages/bolt/bridges/_commands.ts +++ b/packages/bolt/bridges/_commands.ts @@ -1,5 +1,6 @@ import { join, leave, reset, toggle, status } from './_command_functions.ts'; -import { Bolt, command, create_message } from './_deps.ts'; +import { command, create_message } from '../utils/mod.ts'; +import { Bolt } from '../bolt.ts'; export function bridge_commands(bolt: Bolt): command { return { diff --git a/packages/bolt/bridges/_deps.ts b/packages/bolt/bridges/_deps.ts deleted file mode 100644 index f01fcc6..0000000 --- a/packages/bolt/bridges/_deps.ts +++ /dev/null @@ -1,10 +0,0 @@ -export { type Collection } from '../_deps.ts'; -export { Bolt } from '../bolt.ts'; -export { type command, type command_arguments } from '../cmds/mod.ts'; -export { - bolt_plugin, - create_message, - log_error, - type message, - type deleted_message -} from '../utils/mod.ts'; diff --git a/packages/bolt/bridges/mod.ts b/packages/bolt/bridges/mod.ts index 6979f5f..d231cd0 100644 --- a/packages/bolt/bridges/mod.ts +++ b/packages/bolt/bridges/mod.ts @@ -1,12 +1,7 @@ import { bridge_commands } from './_commands.ts'; -import { - Bolt, - Collection, - message, - deleted_message, - log_error, - bolt_plugin -} from './_deps.ts'; +import { Bolt } from '../bolt.ts'; +import { Collection } from 'mongo'; +import { message, deleted_message, log_error, plugin } from '../utils/mod.ts'; import { bridge_document, bridge_platform } from './types.ts'; export class bolt_bridges { @@ -39,9 +34,12 @@ export class bolt_bridges { } async get_bridge_message(id: string): Promise { - const redis_data = await this.bolt.db.redis.get(`bolt-bridge-${id}`); - if (redis_data === null) return [] as bridge_platform[]; - return JSON.parse(redis_data) as bridge_platform[]; + const rdata = await this.bolt.redis.sendCommand([ + 'JSON.GET', + `bolt-bridge-${id}` + ]); + if (!rdata) return [] as bridge_platform[]; + return rdata as bridge_platform[]; } is_bridged(msg: deleted_message): boolean { @@ -76,14 +74,6 @@ export class bolt_bridges { }); } - private async handle_message( - msg: deleted_message, - action: 'delete_message' - ): Promise; - private async handle_message( - msg: message, - action: 'create_message' | 'edit_message' - ): Promise; private async handle_message( msg: message | deleted_message, action: 'create_message' | 'edit_message' | 'delete_message' @@ -130,10 +120,20 @@ export class bolt_bridges { } for (const i of data) { - await this.bolt.db.redis.set(`bolt-bridge-${i.id}`, JSON.stringify(data)); + await this.bolt.redis.writeCommand([ + 'JSON.SET', + `bolt-bridge-${i.id}`, + '$', + `'${JSON.stringify(data)}'` + ]); } - await this.bolt.db.redis.set(`bolt-bridge-${msg.id}`, JSON.stringify(data)); + await this.bolt.redis.writeCommand([ + 'JSON.SET', + `bolt-bridge-${msg.id}`, + '$', + `'${JSON.stringify(data)}'` + ]); } private async get_platforms( @@ -177,7 +177,7 @@ export class bolt_bridges { platform: bridge_platform, action: 'create_message' | 'edit_message' | 'delete_message' ): Promise<{ - plugin?: bolt_plugin; + plugin?: plugin; platform?: bridge_platform & { id: string }; }> { const plugin = this.bolt.plugins.get(platform.plugin); @@ -191,10 +191,8 @@ export class bolt_bridges { return {}; return { plugin, platform: platform } as { - plugin: bolt_plugin; + plugin: plugin; platform: bridge_platform & { id: string }; }; } } - -export * from './types.ts'; diff --git a/packages/bolt/bridges/types.ts b/packages/bolt/bridges/types.ts index dceccc6..f85ca40 100644 --- a/packages/bolt/bridges/types.ts +++ b/packages/bolt/bridges/types.ts @@ -7,6 +7,7 @@ export interface bridge_document { }; } +/** platform within a bridge */ export interface bridge_platform { channel: string; plugin: string; diff --git a/packages/bolt/cli.ts b/packages/bolt/cli.ts index 9ee4304..9fb36a4 100644 --- a/packages/bolt/cli.ts +++ b/packages/bolt/cli.ts @@ -1,16 +1,20 @@ +import { Bolt } from './bolt.ts'; +import { parseArgs } from 'std_args'; +import { MongoClient } from 'mongo'; import { apply_migrations, get_migrations, - versions -} from './migrations/mod.ts'; -import { Bolt } from './bolt.ts'; -import { MongoClient, parseArgs } from './_deps.ts'; -import { config } from './utils/mod.ts'; + versions, + config, + define_config +} from './utils/mod.ts'; function log(text: string, color?: string, type?: 'error' | 'log') { console[type || 'log'](`%c${text}`, `color: ${color || 'white'}`); } +// TODO: remove deno-specific stuff + const f = parseArgs(Deno.args, { boolean: ['help', 'version', 'run', 'migrations'], string: ['config'] @@ -34,16 +38,32 @@ if (!f.run && !f.migrations) { } try { - const cfg = (await import(f.config || `${Deno.cwd()}/config.ts`))?.default; - if (f.run) await Bolt.setup(cfg); - if (f.migrations) await migrations(cfg); + const cfg = define_config( + (await import(f.config || `${Deno.cwd()}/config.ts`))?.default + ); + + Deno.env.set('BOLT_ERROR_HOOK', cfg.errorURL || ''); + + const mongo = new MongoClient(); + await mongo.connect(cfg.mongo_uri); + + if (f.run) { + const redis = await Deno.connect({ + hostname: cfg.redis_host, + port: cfg.redis_port || 6379 + }); + const bolt = new Bolt(cfg, mongo, redis); + await bolt.setup(); + } else if (f.migrations) { + await migrations(cfg, mongo); + } } catch (e) { log('Something went wrong, exiting..', 'red', 'error'); console.error(e); Deno.exit(1); } -async function migrations(cfg: config) { +async function migrations(cfg: config, mongo: MongoClient) { log(`Available versions are: ${Object.values(versions).join(', ')}`, 'blue'); const from = prompt('what version is the DB currently set up for?'); @@ -58,10 +78,6 @@ async function migrations(cfg: config) { if (migrationlist.length < 1) Deno.exit(); - const mongo = new MongoClient(); - - await mongo.connect(cfg.mongo_uri); - const database = mongo.database(cfg.mongo_database); log('Migrating your data..', 'blue'); @@ -91,4 +107,6 @@ async function migrations(cfg: config) { ); log('Wrote data to the DB', 'green'); + + Deno.exit(); } diff --git a/packages/bolt/cmds/_default.ts b/packages/bolt/cmds/_default.ts deleted file mode 100644 index d3d6648..0000000 --- a/packages/bolt/cmds/_default.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { create_message } from './_deps.ts'; -import { command } from './types.ts'; - -export const default_commands = [ - [ - 'help', - { - name: 'help', - description: 'get help', - execute: () => - create_message({ - text: 'check out [the docs](https://williamhorning.dev/bolt/) for help.' - }) - } - ], - [ - 'version', - { - name: 'version', - description: "get bolt's version", - execute: () => - create_message({ - text: 'hello from bolt 0.5.8!' - }) - } - ], - [ - 'ping', - { - name: 'ping', - description: 'pong', - execute: ({ timestamp }) => - create_message({ - text: `Pong! 🏓 ${Temporal.Now.instant() - .since(timestamp) - .total('milliseconds')}ms` - }) - } - ] -] as [string, command][]; diff --git a/packages/bolt/cmds/_deps.ts b/packages/bolt/cmds/_deps.ts deleted file mode 100644 index 596d413..0000000 --- a/packages/bolt/cmds/_deps.ts +++ /dev/null @@ -1,3 +0,0 @@ -export { parseArgs } from '../_deps.ts'; -export { Bolt } from '../bolt.ts'; -export { create_message, log_error, type message } from '../utils/mod.ts'; diff --git a/packages/bolt/cmds/mod.ts b/packages/bolt/cmds/mod.ts deleted file mode 100644 index 8750d0b..0000000 --- a/packages/bolt/cmds/mod.ts +++ /dev/null @@ -1,56 +0,0 @@ -import { default_commands } from './_default.ts'; -import { Bolt, log_error, parseArgs } from './_deps.ts'; -import { command, command_arguments } from './types.ts'; - -export class bolt_commands extends Map { - constructor() { - super(default_commands); - } - - listen(bolt: Bolt) { - bolt.on('create_nonbridged_message', msg => { - if (msg.content?.startsWith('!bolt')) { - const args = parseArgs(msg.content.split(' ')); - args._.shift(); - this.run({ - channel: msg.channel, - cmd: args._.shift() as string, - subcmd: args._.shift() as string, - opts: args as Record, - platform: msg.platform.name, - timestamp: msg.timestamp, - replyfn: msg.reply - }); - } - }); - - bolt.on('create_command', async cmd => { - await this.run(cmd); - }); - } - - async run(opts: command_arguments) { - const cmd = this.get(opts.cmd) || this.get('help')!; - const cmd_opts = { ...opts, commands: this }; - let reply; - try { - let execute; - if (cmd.options?.subcommands && opts.subcmd) { - execute = cmd.options.subcommands.find( - i => i.name === opts.subcmd - )?.execute; - } - if (!execute) execute = cmd.execute; - reply = await execute(cmd_opts); - } catch (e) { - reply = (await log_error(e, { ...opts, reply: undefined })).message; - } - try { - await opts.replyfn(reply, false); - } catch (e) { - await log_error(e, { ...opts, reply: undefined }); - } - } -} - -export * from './types.ts'; diff --git a/packages/bolt/cmds/types.ts b/packages/bolt/cmds/types.ts deleted file mode 100644 index 51127ac..0000000 --- a/packages/bolt/cmds/types.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { message } from './_deps.ts'; - -export type command_arguments = { - channel: string; - cmd: string; - opts: Record; - platform: string; - replyfn: message['reply']; - subcmd?: string; - timestamp: Temporal.Instant; -}; - -export type command = { - name: string; - description?: string; - options?: { - default?: boolean; - argument_name?: string; - argument_required?: boolean; - subcommands?: command[]; - }; - execute: ( - opts: command_arguments - ) => Promise> | message; -}; diff --git a/packages/bolt/deno.jsonc b/packages/bolt/deno.jsonc index e8127c0..533a53e 100644 --- a/packages/bolt/deno.jsonc +++ b/packages/bolt/deno.jsonc @@ -1,11 +1,14 @@ { "exports": "./mod.ts", - // TODO: move deps over here "imports": { - + "assert_eq": "jsr:@std/assert@^0.219.1/assert_equals", + "event": "jsr:@denosaurs/event@^2.0.2", + "std_args": "jsr:@std/cli@^0.219.1/parse_args", + "r2d2": "https://deno.land/x/r2d2@v2.0.0/mod.ts", + "mongo": "https://deno.land/x/mongo@v0.32.0/mod.ts" }, // TODO: DO NOT PUBLISH UNDER THE BOLT NAME - "name": "@jersey/bolt", + "name": "@jersey/unknown", "unstable": ["temporal"], "test": { "include": ["./_tests.ts"] diff --git a/packages/bolt/deno.lock b/packages/bolt/deno.lock new file mode 100644 index 0000000..b76e201 --- /dev/null +++ b/packages/bolt/deno.lock @@ -0,0 +1,562 @@ +{ + "version": "3", + "packages": { + "specifiers": { + "jsr:@denosaurs/event@^2.0.2": "jsr:@denosaurs/event@2.0.2", + "jsr:@std/assert@^0.219.1": "jsr:@std/assert@0.219.1", + "jsr:@std/cli@^0.219.1": "jsr:@std/cli@0.219.1", + "npm:@discordjs/core@1.1.1": "npm:@discordjs/core@1.1.1", + "npm:@discordjs/rest@2.2.0": "npm:@discordjs/rest@2.2.0", + "npm:@discordjs/ws@1.0.2": "npm:@discordjs/ws@1.0.2", + "npm:@williamhorning/revolt.js@7.0.0-beta.10": "npm:@williamhorning/revolt.js@7.0.0-beta.10_solid-js@1.8.15__seroval@1.0.4", + "npm:guilded-api-typings@0.13.2": "npm:guilded-api-typings@0.13.2", + "npm:guilded.js@0.23.7": "npm:guilded.js@0.23.7" + }, + "jsr": { + "@denosaurs/event@2.0.2": { + "integrity": "3310ba1a9e94dd60ccb09c6084fc818cc1cd50e543c56ef0c6199f1b89073392" + }, + "@std/assert@0.219.1": { + "integrity": "e76c2a1799a78f0f4db7de04bdc9b908a7a4b821bb65eda0285885297d4fb8af" + }, + "@std/cli@0.219.1": { + "integrity": "715a9926b58b89ef8a3c91e91633ac5f8176e0f02f6b3a16f0a67309e41a2911", + "dependencies": [ + "jsr:@std/assert@^0.219.1" + ] + } + }, + "npm": { + "@discordjs/collection@1.5.3": { + "integrity": "sha512-SVb428OMd3WO1paV3rm6tSjM4wC+Kecaa1EUGX7vc6/fddvw/6lg90z4QtCqm21zvVe92vMMDt9+DkIvjXImQQ==", + "dependencies": {} + }, + "@discordjs/collection@2.0.0": { + "integrity": "sha512-YTWIXLrf5FsrLMycpMM9Q6vnZoR/lN2AWX23/Cuo8uOOtS8eHB2dyQaaGnaF8aZPYnttf2bkLMcXn/j6JUOi3w==", + "dependencies": {} + }, + "@discordjs/core@1.1.1": { + "integrity": "sha512-3tDqc6KCAtE0CxNl5300uPzFnNsY/GAmJhc6oGutbl/la+4mRv5zVb4N68cmcaeD2Il/ySH4zIc00sq+cyhtUA==", + "dependencies": { + "@discordjs/rest": "@discordjs/rest@2.2.0", + "@discordjs/util": "@discordjs/util@1.0.2", + "@discordjs/ws": "@discordjs/ws@1.0.2", + "@sapphire/snowflake": "@sapphire/snowflake@3.5.3", + "@vladfrangu/async_event_emitter": "@vladfrangu/async_event_emitter@2.2.4", + "discord-api-types": "discord-api-types@0.37.61" + } + }, + "@discordjs/rest@2.2.0": { + "integrity": "sha512-nXm9wT8oqrYFRMEqTXQx9DUTeEtXUDMmnUKIhZn6O2EeDY9VCdwj23XCPq7fkqMPKdF7ldAfeVKyxxFdbZl59A==", + "dependencies": { + "@discordjs/collection": "@discordjs/collection@2.0.0", + "@discordjs/util": "@discordjs/util@1.0.2", + "@sapphire/async-queue": "@sapphire/async-queue@1.5.2", + "@sapphire/snowflake": "@sapphire/snowflake@3.5.3", + "@vladfrangu/async_event_emitter": "@vladfrangu/async_event_emitter@2.2.4", + "discord-api-types": "discord-api-types@0.37.61", + "magic-bytes.js": "magic-bytes.js@1.10.0", + "tslib": "tslib@2.6.2", + "undici": "undici@5.27.2" + } + }, + "@discordjs/util@1.0.2": { + "integrity": "sha512-IRNbimrmfb75GMNEjyznqM1tkI7HrZOf14njX7tCAAUetyZM1Pr8hX/EK2lxBCOgWDRmigbp24fD1hdMfQK5lw==", + "dependencies": {} + }, + "@discordjs/ws@1.0.2": { + "integrity": "sha512-+XI82Rm2hKnFwAySXEep4A7Kfoowt6weO6381jgW+wVdTpMS/56qCvoXyFRY0slcv7c/U8My2PwIB2/wEaAh7Q==", + "dependencies": { + "@discordjs/collection": "@discordjs/collection@2.0.0", + "@discordjs/rest": "@discordjs/rest@2.2.0", + "@discordjs/util": "@discordjs/util@1.0.2", + "@sapphire/async-queue": "@sapphire/async-queue@1.5.2", + "@types/ws": "@types/ws@8.5.10", + "@vladfrangu/async_event_emitter": "@vladfrangu/async_event_emitter@2.2.4", + "discord-api-types": "discord-api-types@0.37.61", + "tslib": "tslib@2.6.2", + "ws": "ws@8.16.0" + } + }, + "@fastify/busboy@2.1.1": { + "integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==", + "dependencies": {} + }, + "@guildedjs/api@0.3.2": { + "integrity": "sha512-Tn2DUQm2sPJn1jKLe+GGw1uwL837WCgtNAj5WjIMnM6zHaEoFgIWXM2uMZQ5GTWsC1ZTUu8XiCniGv7YvItv3Q==", + "dependencies": { + "@types/ws": "@types/ws@8.5.4", + "form-data": "form-data@4.0.0", + "node-fetch": "node-fetch@2.6.11", + "qs": "qs@6.11.2", + "typed-emitter": "typed-emitter@2.1.0", + "ws": "ws@8.13.0" + } + }, + "@insertish/oapi@0.1.18": { + "integrity": "sha512-LZLUk3WmzUjCM0quensexvQx/Kk1MpFBtCLJRnRrPOiaFT37JpOmWUFlrdu0sPS6B9wi2edEBeLcsnIiq85WMA==", + "dependencies": { + "axios": "axios@0.26.1", + "openapi-typescript": "openapi-typescript@5.4.1", + "typescript": "typescript@4.9.5" + } + }, + "@sapphire/async-queue@1.5.2": { + "integrity": "sha512-7X7FFAA4DngXUl95+hYbUF19bp1LGiffjJtu7ygrZrbdCSsdDDBaSjB7Akw0ZbOu6k0xpXyljnJ6/RZUvLfRdg==", + "dependencies": {} + }, + "@sapphire/snowflake@3.5.3": { + "integrity": "sha512-jjmJywLAFoWeBi1W7994zZyiNWPIiqRRNAmSERxyg93xRGzNYvGjlZ0gR6x0F4gPRi2+0O6S71kOZYyr3cxaIQ==", + "dependencies": {} + }, + "@solid-primitives/map@0.4.10_solid-js@1.8.15__seroval@1.0.4": { + "integrity": "sha512-Y4aTvQN1DjMmTQeNS3H1Fc+fVVPVslYGAOxD8gIMgQtHn+yLd4Zc4pm/x0m/lsy7NnEi0nskz4G7vbEd9M5sOA==", + "dependencies": { + "@solid-primitives/trigger": "@solid-primitives/trigger@1.0.10_solid-js@1.8.15__seroval@1.0.4", + "solid-js": "solid-js@1.8.15_seroval@1.0.4" + } + }, + "@solid-primitives/set@0.4.10_solid-js@1.8.15__seroval@1.0.4": { + "integrity": "sha512-YAoKFKfpHCjnZQV/TnzH01cSXRpDJS4gpuwGpLiiJvCt7rhAMImLMJj+nTt5WWE6DtolWuup4kLloO9tS/vE/g==", + "dependencies": { + "@solid-primitives/trigger": "@solid-primitives/trigger@1.0.10_solid-js@1.8.15__seroval@1.0.4", + "solid-js": "solid-js@1.8.15_seroval@1.0.4" + } + }, + "@solid-primitives/trigger@1.0.10_solid-js@1.8.15__seroval@1.0.4": { + "integrity": "sha512-gPNhmIBMxaJm2gWAAqUkpF5Vk6yZgaJ9+MFQN5eIRQ//GPIUqkNtSSar5sU+iG2I5QmS4iU7gOnvv3XvxXI1fg==", + "dependencies": { + "@solid-primitives/utils": "@solid-primitives/utils@6.2.3_solid-js@1.8.15__seroval@1.0.4", + "solid-js": "solid-js@1.8.15_seroval@1.0.4" + } + }, + "@solid-primitives/utils@6.2.3_solid-js@1.8.15__seroval@1.0.4": { + "integrity": "sha512-CqAwKb2T5Vi72+rhebSsqNZ9o67buYRdEJrIFzRXz3U59QqezuuxPsyzTSVCacwS5Pf109VRsgCJQoxKRoECZQ==", + "dependencies": { + "solid-js": "solid-js@1.8.15_seroval@1.0.4" + } + }, + "@types/node@18.16.19": { + "integrity": "sha512-IXl7o+R9iti9eBW4Wg2hx1xQDig183jj7YLn8F7udNceyfkbn1ZxmzZXuak20gR40D7pIkIY1kYGx5VIGbaHKA==", + "dependencies": {} + }, + "@types/ws@8.5.10": { + "integrity": "sha512-vmQSUcfalpIq0R9q7uTo2lXs6eGIpt9wtnLdMv9LVpIjCA/+ufZRozlVoVelIYixx1ugCBKDhn89vnsEGOCx9A==", + "dependencies": { + "@types/node": "@types/node@18.16.19" + } + }, + "@types/ws@8.5.4": { + "integrity": "sha512-zdQDHKUgcX/zBc4GrwsE/7dVdAD8JR4EuiAXiiUhhfyIJXXb2+PrGshFyeXWQPMmmZ2XxgaqclgpIC7eTXc1mg==", + "dependencies": { + "@types/node": "@types/node@18.16.19" + } + }, + "@vladfrangu/async_event_emitter@2.2.4": { + "integrity": "sha512-ButUPz9E9cXMLgvAW8aLAKKJJsPu1dY1/l/E8xzLFuysowXygs6GBcyunK9rnGC4zTsnIc2mQo71rGw9U+Ykug==", + "dependencies": {} + }, + "@williamhorning/revolt.js@7.0.0-beta.10_solid-js@1.8.15__seroval@1.0.4": { + "integrity": "sha512-w9rw5Z3HiHzwq3+QOxzceljzQAA1DUNg8lV+ClZw8CvkajLEIUn6C+9v8aEzSEz9ABaZCDA46KnrIPZN3l72Xw==", + "dependencies": { + "@solid-primitives/map": "@solid-primitives/map@0.4.10_solid-js@1.8.15__seroval@1.0.4", + "@solid-primitives/set": "@solid-primitives/set@0.4.10_solid-js@1.8.15__seroval@1.0.4", + "long": "long@5.2.3", + "revolt-api": "revolt-api@0.6.5", + "solid-js": "solid-js@1.8.15_seroval@1.0.4", + "ulid": "ulid@2.3.0", + "ws": "ws@8.16.0" + } + }, + "argparse@2.0.1": { + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dependencies": {} + }, + "asynckit@0.4.0": { + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", + "dependencies": {} + }, + "axios@0.26.1": { + "integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==", + "dependencies": { + "follow-redirects": "follow-redirects@1.15.5" + } + }, + "call-bind@1.0.7": { + "integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==", + "dependencies": { + "es-define-property": "es-define-property@1.0.0", + "es-errors": "es-errors@1.3.0", + "function-bind": "function-bind@1.1.2", + "get-intrinsic": "get-intrinsic@1.2.4", + "set-function-length": "set-function-length@1.2.1" + } + }, + "combined-stream@1.0.8": { + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dependencies": { + "delayed-stream": "delayed-stream@1.0.0" + } + }, + "csstype@3.1.3": { + "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==", + "dependencies": {} + }, + "define-data-property@1.1.4": { + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "dependencies": { + "es-define-property": "es-define-property@1.0.0", + "es-errors": "es-errors@1.3.0", + "gopd": "gopd@1.0.1" + } + }, + "delayed-stream@1.0.0": { + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "dependencies": {} + }, + "discord-api-types@0.37.61": { + "integrity": "sha512-o/dXNFfhBpYHpQFdT6FWzeO7pKc838QeeZ9d91CfVAtpr5XLK4B/zYxQbYgPdoMiTDvJfzcsLW5naXgmHGDNXw==", + "dependencies": {} + }, + "es-define-property@1.0.0": { + "integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==", + "dependencies": { + "get-intrinsic": "get-intrinsic@1.2.4" + } + }, + "es-errors@1.3.0": { + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "dependencies": {} + }, + "follow-redirects@1.15.5": { + "integrity": "sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw==", + "dependencies": {} + }, + "form-data@4.0.0": { + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "dependencies": { + "asynckit": "asynckit@0.4.0", + "combined-stream": "combined-stream@1.0.8", + "mime-types": "mime-types@2.1.35" + } + }, + "function-bind@1.1.2": { + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dependencies": {} + }, + "get-intrinsic@1.2.4": { + "integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==", + "dependencies": { + "es-errors": "es-errors@1.3.0", + "function-bind": "function-bind@1.1.2", + "has-proto": "has-proto@1.0.3", + "has-symbols": "has-symbols@1.0.3", + "hasown": "hasown@2.0.1" + } + }, + "globalyzer@0.1.0": { + "integrity": "sha512-40oNTM9UfG6aBmuKxk/giHn5nQ8RVz/SS4Ir6zgzOv9/qC3kKZ9v4etGTcJbEl/NyVQH7FGU7d+X1egr57Md2Q==", + "dependencies": {} + }, + "globrex@0.1.2": { + "integrity": "sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==", + "dependencies": {} + }, + "gopd@1.0.1": { + "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "dependencies": { + "get-intrinsic": "get-intrinsic@1.2.4" + } + }, + "guilded-api-typings@0.13.2": { + "integrity": "sha512-Fleko3u0WbYis/WyZoD/x6ZaqXiI4IYvVou+tLqHHLNWZGPvnNErEffxTb7q4QBzi4oX8KkKLAeMsmqpsnz5ew==", + "dependencies": {} + }, + "guilded.js@0.23.7": { + "integrity": "sha512-W7UkWqZhaIEtJmbe7cMXwTIuWlJ++vbOIluCQOfjayzScJx8o1KVmn3niAvONN/tJV/zNBJ5+pyXzMC8bhuEyQ==", + "dependencies": { + "@discordjs/collection": "@discordjs/collection@1.5.3", + "@guildedjs/api": "@guildedjs/api@0.3.2", + "typed-emitter": "typed-emitter@2.1.0" + } + }, + "has-property-descriptors@1.0.2": { + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "dependencies": { + "es-define-property": "es-define-property@1.0.0" + } + }, + "has-proto@1.0.3": { + "integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==", + "dependencies": {} + }, + "has-symbols@1.0.3": { + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "dependencies": {} + }, + "hasown@2.0.1": { + "integrity": "sha512-1/th4MHjnwncwXsIW6QMzlvYL9kG5e/CpVvLRZe4XPa8TOUNbCELqmvhDmnkNsAjwaG4+I8gJJL0JBvTTLO9qA==", + "dependencies": { + "function-bind": "function-bind@1.1.2" + } + }, + "js-yaml@4.1.0": { + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dependencies": { + "argparse": "argparse@2.0.1" + } + }, + "lodash.defaultsdeep@4.6.1": { + "integrity": "sha512-3j8wdDzYuWO3lM3Reg03MuQR957t287Rpcxp1njpEa8oDrikb+FwGdW3n+FELh/A6qib6yPit0j/pv9G/yeAqA==", + "dependencies": {} + }, + "long@5.2.3": { + "integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==", + "dependencies": {} + }, + "magic-bytes.js@1.10.0": { + "integrity": "sha512-/k20Lg2q8LE5xiaaSkMXk4sfvI+9EGEykFS4b0CHHGWqDYU0bGUFSwchNOMA56D7TCs9GwVTkqe9als1/ns8UQ==", + "dependencies": {} + }, + "mime-db@1.52.0": { + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "dependencies": {} + }, + "mime-types@2.1.35": { + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dependencies": { + "mime-db": "mime-db@1.52.0" + } + }, + "mime@3.0.0": { + "integrity": "sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==", + "dependencies": {} + }, + "node-fetch@2.6.11": { + "integrity": "sha512-4I6pdBY1EthSqDmJkiNk3JIT8cswwR9nfeW/cPdUagJYEQG7R95WRH74wpz7ma8Gh/9dI9FP+OU+0E4FvtA55w==", + "dependencies": { + "whatwg-url": "whatwg-url@5.0.0" + } + }, + "object-inspect@1.13.1": { + "integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==", + "dependencies": {} + }, + "openapi-typescript@5.4.1": { + "integrity": "sha512-AGB2QiZPz4rE7zIwV3dRHtoUC/CWHhUjuzGXvtmMQN2AFV8xCTLKcZUHLcdPQmt/83i22nRE7+TxXOXkK+gf4Q==", + "dependencies": { + "js-yaml": "js-yaml@4.1.0", + "mime": "mime@3.0.0", + "prettier": "prettier@2.8.8", + "tiny-glob": "tiny-glob@0.2.9", + "undici": "undici@5.27.2", + "yargs-parser": "yargs-parser@21.1.1" + } + }, + "prettier@2.8.8": { + "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", + "dependencies": {} + }, + "qs@6.11.2": { + "integrity": "sha512-tDNIz22aBzCDxLtVH++VnTfzxlfeK5CbqohpSqpJgj1Wg/cQbStNAz3NuqCs5vV+pjBsK4x4pN9HlVh7rcYRiA==", + "dependencies": { + "side-channel": "side-channel@1.0.5" + } + }, + "revolt-api@0.6.5": { + "integrity": "sha512-1PNcc6DvWplwt4v9unEKKVVqa/X2gE0yT0RgPR8pM5uerpzPKDhikrbr5zudqnoBQ1t+92rKKDdMMAeBWH0mUA==", + "dependencies": { + "@insertish/oapi": "@insertish/oapi@0.1.18", + "axios": "axios@0.26.1", + "lodash.defaultsdeep": "lodash.defaultsdeep@4.6.1" + } + }, + "rxjs@7.8.1": { + "integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==", + "dependencies": { + "tslib": "tslib@2.6.2" + } + }, + "seroval-plugins@1.0.4_seroval@1.0.4": { + "integrity": "sha512-DQ2IK6oQVvy8k+c2V5x5YCtUa/GGGsUwUBNN9UqohrZ0rWdUapBFpNMYP1bCyRHoxOJjdKGl+dieacFIpU/i1A==", + "dependencies": { + "seroval": "seroval@1.0.4" + } + }, + "seroval@1.0.4": { + "integrity": "sha512-qQs/N+KfJu83rmszFQaTxcoJoPn6KNUruX4KmnmyD0oZkUoiNvJ1rpdYKDf4YHM05k+HOgCxa3yvf15QbVijGg==", + "dependencies": {} + }, + "set-function-length@1.2.1": { + "integrity": "sha512-j4t6ccc+VsKwYHso+kElc5neZpjtq9EnRICFZtWyBsLojhmeF/ZBd/elqm22WJh/BziDe/SBiOeAt0m2mfLD0g==", + "dependencies": { + "define-data-property": "define-data-property@1.1.4", + "es-errors": "es-errors@1.3.0", + "function-bind": "function-bind@1.1.2", + "get-intrinsic": "get-intrinsic@1.2.4", + "gopd": "gopd@1.0.1", + "has-property-descriptors": "has-property-descriptors@1.0.2" + } + }, + "side-channel@1.0.5": { + "integrity": "sha512-QcgiIWV4WV7qWExbN5llt6frQB/lBven9pqliLXfGPB+K9ZYXxDozp0wLkHS24kWCm+6YXH/f0HhnObZnZOBnQ==", + "dependencies": { + "call-bind": "call-bind@1.0.7", + "es-errors": "es-errors@1.3.0", + "get-intrinsic": "get-intrinsic@1.2.4", + "object-inspect": "object-inspect@1.13.1" + } + }, + "solid-js@1.8.15_seroval@1.0.4": { + "integrity": "sha512-d0QP/efr3UVcwGgWVPveQQ0IHOH6iU7yUhc2piy8arNG8wxKmvUy1kFxyF8owpmfCWGB87usDKMaVnsNYZm+Vw==", + "dependencies": { + "csstype": "csstype@3.1.3", + "seroval": "seroval@1.0.4", + "seroval-plugins": "seroval-plugins@1.0.4_seroval@1.0.4" + } + }, + "tiny-glob@0.2.9": { + "integrity": "sha512-g/55ssRPUjShh+xkfx9UPDXqhckHEsHr4Vd9zX55oSdGZc/MD0m3sferOkwWtp98bv+kcVfEHtRJgBVJzelrzg==", + "dependencies": { + "globalyzer": "globalyzer@0.1.0", + "globrex": "globrex@0.1.2" + } + }, + "tr46@0.0.3": { + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", + "dependencies": {} + }, + "tslib@2.6.2": { + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", + "dependencies": {} + }, + "typed-emitter@2.1.0": { + "integrity": "sha512-g/KzbYKbH5C2vPkaXGu8DJlHrGKHLsM25Zg9WuC9pMGfuvT+X25tZQWo5fK1BjBm8+UrVE9LDCvaY0CQk+fXDA==", + "dependencies": { + "rxjs": "rxjs@7.8.1" + } + }, + "typescript@4.9.5": { + "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", + "dependencies": {} + }, + "ulid@2.3.0": { + "integrity": "sha512-keqHubrlpvT6G2wH0OEfSW4mquYRcbe/J8NMmveoQOjUqmo+hXtO+ORCpWhdbZ7k72UtY61BL7haGxW6enBnjw==", + "dependencies": {} + }, + "undici@5.27.2": { + "integrity": "sha512-iS857PdOEy/y3wlM3yRp+6SNQQ6xU0mmZcwRSriqk+et/cwWAtwmIGf6WkoDN2EK/AMdCO/dfXzIwi+rFMrjjQ==", + "dependencies": { + "@fastify/busboy": "@fastify/busboy@2.1.1" + } + }, + "webidl-conversions@3.0.1": { + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", + "dependencies": {} + }, + "whatwg-url@5.0.0": { + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dependencies": { + "tr46": "tr46@0.0.3", + "webidl-conversions": "webidl-conversions@3.0.1" + } + }, + "ws@8.13.0": { + "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", + "dependencies": {} + }, + "ws@8.16.0": { + "integrity": "sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ==", + "dependencies": {} + }, + "yargs-parser@21.1.1": { + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dependencies": {} + } + } + }, + "remote": { + "https://deno.land/std@0.154.0/_util/assert.ts": "e94f2eb37cebd7f199952e242c77654e43333c1ac4c5c700e929ea3aa5489f74", + "https://deno.land/std@0.154.0/_wasm_crypto/lib/deno_std_wasm_crypto.generated.mjs": "dfcd6777d05345362c70f9f2c49abba3ed3f925fccfcf725abe2d16d51819433", + "https://deno.land/std@0.154.0/_wasm_crypto/mod.ts": "6c60d332716147ded0eece0861780678d51b560f533b27db2e15c64a4ef83665", + "https://deno.land/std@0.154.0/async/deferred.ts": "c01de44b9192359cebd3fe93273fcebf9e95110bf3360023917da9a2d1489fae", + "https://deno.land/std@0.154.0/bytes/bytes_list.ts": "aba5e2369e77d426b10af1de0dcc4531acecec27f9b9056f4f7bfbf8ac147ab4", + "https://deno.land/std@0.154.0/bytes/equals.ts": "3c3558c3ae85526f84510aa2b48ab2ad7bdd899e2e0f5b7a8ffc85acb3a6043a", + "https://deno.land/std@0.154.0/bytes/mod.ts": "763f97d33051cc3f28af1a688dfe2830841192a9fea0cbaa55f927b49d49d0bf", + "https://deno.land/std@0.154.0/crypto/_fnv/fnv32.ts": "aa9bddead8c6345087d3abd4ef35fb9655622afc333fc41fff382b36e64280b5", + "https://deno.land/std@0.154.0/crypto/_fnv/fnv64.ts": "625d7e7505b6cb2e9801b5fd6ed0a89256bac12b2bbb3e4664b85a88b0ec5bef", + "https://deno.land/std@0.154.0/crypto/_fnv/index.ts": "a8f6a361b4c6d54e5e89c16098f99b6962a1dd6ad1307dbc97fa1ecac5d7060a", + "https://deno.land/std@0.154.0/crypto/_fnv/util.ts": "4848313bed7f00f55be3cb080aa0583fc007812ba965b03e4009665bde614ce3", + "https://deno.land/std@0.154.0/crypto/keystack.ts": "e481eed28007395e554a435e880fee83a5c73b9259ed8a135a75e4b1e4f381f7", + "https://deno.land/std@0.154.0/crypto/mod.ts": "0ef11f063cd0f9759485a3c9051e15125e1bde3b47c23b47e79b6e13cfcf9481", + "https://deno.land/std@0.154.0/crypto/timing_safe_equal.ts": "82a29b737bc8932d75d7a20c404136089d5d23629e94ba14efa98a8cc066c73e", + "https://deno.land/std@0.154.0/encoding/base64.ts": "c57868ca7fa2fbe919f57f88a623ad34e3d970d675bdc1ff3a9d02bba7409db2", + "https://deno.land/std@0.154.0/encoding/base64url.ts": "a5f82a9fa703bd85a5eb8e7c1296bc6529e601ebd9642cc2b5eaa6b38fa9e05a", + "https://deno.land/std@0.154.0/encoding/hex.ts": "4cc5324417cbb4ac9b828453d35aed45b9cc29506fad658f1f138d981ae33795", + "https://deno.land/std@0.154.0/fmt/colors.ts": "ff7dc9c9f33a72bd48bc24b21bbc1b4545d8494a431f17894dbc5fe92a938fc4", + "https://deno.land/std@0.154.0/io/buffer.ts": "fae02290f52301c4e0188670e730cd902f9307fb732d79c4aa14ebdc82497289", + "https://deno.land/std@0.154.0/io/files.ts": "d199ef64e918a256320ba8d8d44ae91de87c9077df8f8d6cca013f1b9fbbe285", + "https://deno.land/std@0.154.0/io/mod.ts": "33507cf2460ab67d0d90fb5749fa6fecb33897642b49d54a6bb1ac81e4768f69", + "https://deno.land/std@0.154.0/io/readers.ts": "45847ad404afd2f605eae1cff193f223462bc55eeb9ae313c2f3db28aada0fd6", + "https://deno.land/std@0.154.0/io/streams.ts": "988a19155b52161f0035ce539e2f1d12edbc4c389fa7633da832a64e6edbe1a0", + "https://deno.land/std@0.154.0/io/util.ts": "078da53bba767bec0d45f7da44411f6dbf269e51ef7fcfea5e3714e04681c674", + "https://deno.land/std@0.154.0/io/writers.ts": "2e1c63ffd0cfba411b1fd8374609abff9ea86187c9d4d885d42e6fc20325ef0e", + "https://deno.land/std@0.154.0/streams/conversion.ts": "fc4eb76a14148c43f0b85e903a5a1526391aa40ed9434dc21e34f88304eb823e", + "https://deno.land/std@0.154.0/testing/_diff.ts": "141f978a283defc367eeee3ff7b58aa8763cf7c8e0c585132eae614468e9d7b8", + "https://deno.land/std@0.154.0/testing/_format.ts": "cd11136e1797791045e639e9f0f4640d5b4166148796cad37e6ef75f7d7f3832", + "https://deno.land/std@0.154.0/testing/asserts.ts": "ac295f7fd22a7af107580e2475402a8c386cb1bf18bf837ae266ac0665786026", + "https://deno.land/std@0.203.0/bytes/bytes_list.ts": "ecf5098c230b793970f43c06e8f30d70b937c031658365aeb3de9a8ae4d406a3", + "https://deno.land/std@0.203.0/bytes/concat.ts": "d26d6f3d7922e6d663dacfcd357563b7bf4a380ce5b9c2bbe0c8586662f25ce2", + "https://deno.land/std@0.203.0/collections/chunk.ts": "f82c52a82ad9338018570c42f6de0fb132fcb14914c31a444e360ac104d7b55b", + "https://deno.land/std@0.203.0/io/read_delim.ts": "8ea988eac1503c7118bfcf00b4e4a422450548af8e18328f6f599553cfe78012", + "https://deno.land/std@0.203.0/streams/write_all.ts": "4cdd36256f892fe7aead46338054f6ea813a63765e87bda4c60e8c5a57d1c5c1", + "https://deno.land/x/mongo@v0.32.0/deps.ts": "1b53a32fbc115195d74ab78e7d21026ea4b6590e5b558b388017cc1a9b8181e6", + "https://deno.land/x/mongo@v0.32.0/mod.ts": "0989f34d08c40440b8786140abdaf863e964e23df5d1a80e661d3d4170d9d21e", + "https://deno.land/x/mongo@v0.32.0/src/auth/base.ts": "7fe14cf0a63d6bbc4ba69a000a04b3b184d26842504d94652a6af2d0c9494944", + "https://deno.land/x/mongo@v0.32.0/src/auth/mod.ts": "b161611bd5be9e9d1b4497227c8ea93ad4daadcd98038c9e5a707bc5da7a25ca", + "https://deno.land/x/mongo@v0.32.0/src/auth/pbkdf2.ts": "1f1db192fd37869d118ab34780b64567ebcf0ad83a03ef28b3d740cae9adb47a", + "https://deno.land/x/mongo@v0.32.0/src/auth/scram.ts": "187db02e94e7e5423ec902e87d6839028770dca57830dca7f154dcd22a959c0f", + "https://deno.land/x/mongo@v0.32.0/src/auth/x509.ts": "a75b27c549707dd441434ae400a3e6a24da7fe7d4e0e80c9bb79dfc6426b651e", + "https://deno.land/x/mongo@v0.32.0/src/client.ts": "368cac10b3df3bfbc2dfba468d1bbd1332c359a643e0bb81a13d7220a58b43ff", + "https://deno.land/x/mongo@v0.32.0/src/cluster.ts": "cff69bf284a5c7fcaff231494f1ab56ca652e725e58622723e402fbb61448d0e", + "https://deno.land/x/mongo@v0.32.0/src/collection/collection.ts": "6748479b4e9992f9f2ce8e22f891f8917349c1a0e53cb89da5a66cf2b44b9016", + "https://deno.land/x/mongo@v0.32.0/src/collection/commands/aggregate.ts": "440906a670adb46edb36fd95573ffa83f192775108b621520be992165910e895", + "https://deno.land/x/mongo@v0.32.0/src/collection/commands/find.ts": "5c3b750d8c82ce08d865a381bc71f600406cbc4912c4aa689238755579fb71f8", + "https://deno.land/x/mongo@v0.32.0/src/collection/commands/list_indexes.ts": "d32a5120305d0547497026b4f5ab2ecc2f40ff7f44c405b99c2a0287765333f5", + "https://deno.land/x/mongo@v0.32.0/src/collection/commands/update.ts": "cf352108a5dd34f0928c2196a432383d366b8ed292676c71358b9ecf1289418d", + "https://deno.land/x/mongo@v0.32.0/src/collection/mod.ts": "bd791a0b9b46be4365f88c54893584eadec2f8cd799db9eb05e0b5b4c8d72b8e", + "https://deno.land/x/mongo@v0.32.0/src/database.ts": "c7b677beddd3eb16f79e8d3c9473b5f86e45541b8a04cc896aabe04d029fa7a0", + "https://deno.land/x/mongo@v0.32.0/src/error.ts": "8180a822b0831a94a6a28815865b5b40e3996220684bea60fcb81b272ddd06eb", + "https://deno.land/x/mongo@v0.32.0/src/gridfs/bucket.ts": "a4452d63f6928f57486a214a499b54b80b98cc0d13e3d85a6841b34d5ff12a61", + "https://deno.land/x/mongo@v0.32.0/src/gridfs/indexes.ts": "7d302114fb4d81c4a873614a51d11ddb8b471f967179dddb8269c39b3cadf4e3", + "https://deno.land/x/mongo@v0.32.0/src/gridfs/upload.ts": "6a54a21b00c6f22ad0da6ceef7a2932dc600560f594c2551abd8e4a64976abae", + "https://deno.land/x/mongo@v0.32.0/src/protocol/cursor.ts": "c370a28856fa236129cc2d7abf7ebc4ac6cdd60acb93e0e7371433f7332394cb", + "https://deno.land/x/mongo@v0.32.0/src/protocol/handshake.ts": "3c3ba547d5322751b9756ce9a4750f3cf18febee0a64edca5b007634bd80e0fe", + "https://deno.land/x/mongo@v0.32.0/src/protocol/header.ts": "0f28db842f886e57b7013606c1391affab2e2960a1a4568d2502e7b788117716", + "https://deno.land/x/mongo@v0.32.0/src/protocol/message.ts": "7b4e38489070fc6281d1b3f13e99504310f09273baa8bcb11d82b1e30ea04202", + "https://deno.land/x/mongo@v0.32.0/src/protocol/mod.ts": "4e24d563049c0a236234598ca786ca13778dc17fdb80ac543ac6c75d0c5094d7", + "https://deno.land/x/mongo@v0.32.0/src/protocol/protocol.ts": "92568dd86e6ef3f54054113d9f5620f158fc1dfee2a7c9d13623975835d5996a", + "https://deno.land/x/mongo@v0.32.0/src/types.ts": "355c91b0abc0c77aa1f8fd0dcfcbc47505518f561b72d8fefd4a929b12bc7e48", + "https://deno.land/x/mongo@v0.32.0/src/types/geojson.ts": "14690e2fa1591939253ddc9de181b0664051e9462db131b72be5fb9d064dff44", + "https://deno.land/x/mongo@v0.32.0/src/types/geospatial.ts": "c73ee13536365fa5d868b65ab47b3488a5f223a67e1e059761886f750db70ef9", + "https://deno.land/x/mongo@v0.32.0/src/types/gridfs.ts": "e1fd12c3ca58d437267e7a8557d745d23b9d8916d1da34c1847e5e373728dfa0", + "https://deno.land/x/mongo@v0.32.0/src/types/read_write_concern.ts": "d00f35eb85520e776741888685d08d479766a19e9a0a970b53f4594c9db00496", + "https://deno.land/x/mongo@v0.32.0/src/utils/ns.ts": "fb0c57b8dc4d31f8993112d267dec3c163d3e8862198d1cd03b2b51bcc3caad9", + "https://deno.land/x/mongo@v0.32.0/src/utils/saslprep/deps.ts": "95ceb81b353110526dacf2a98854bc79d6e17d7f173af8806e91c05555d7b8c7", + "https://deno.land/x/mongo@v0.32.0/src/utils/saslprep/load_code_points.ts": "f6a4ef2eb2345eac40ffbf1a30661cca803f399865f2a0fadafb71f57d4c97bf", + "https://deno.land/x/mongo@v0.32.0/src/utils/saslprep/memory_pager.ts": "f55a79a13ec569c21630c3915a9af0c6fc0aa2b899121fa2a85a813c6dd4afba", + "https://deno.land/x/mongo@v0.32.0/src/utils/saslprep/mod.ts": "0a8a39a0784d065a79c54ce63d7d7b103d0b94addc5b7bcf985517ba2442c8a1", + "https://deno.land/x/mongo@v0.32.0/src/utils/saslprep/sparse_bitfield.ts": "07d6fe2ecd4ba5f711c44c1ae409bb9c1fe3a3cfc09e27434d231d4aae46dd2d", + "https://deno.land/x/mongo@v0.32.0/src/utils/srv.ts": "ed5f78ffe6480faac68291a87e51e3674eff5f28aec937ee97248e99e1317b16", + "https://deno.land/x/mongo@v0.32.0/src/utils/uri.ts": "dcfab8e1dcfcc875c75ada1d9f366664480c03b65594990d6342ed88925452e5", + "https://deno.land/x/r2d2@v2.0.0/mod.ts": "9dd57845ed23db1a80e8df3ebaec4bd1ff1a39bbf533b4ee2a40f9c895cd662b", + "https://deno.land/x/web_bson@v0.3.0/mod.js": "8e14aecd31ee63abd30e2dbaa284b4b67abb7ba51fcef5b96af74727cb7c7940" + }, + "workspace": { + "dependencies": [ + "jsr:@denosaurs/event@^2.0.2", + "jsr:@std/assert@^0.219.1", + "jsr:@std/cli@^0.219.1" + ] + } +} diff --git a/packages/bolt/migrations/_utils.ts b/packages/bolt/migrations/_utils.ts deleted file mode 100644 index 72aedde..0000000 --- a/packages/bolt/migrations/_utils.ts +++ /dev/null @@ -1,26 +0,0 @@ -export function map_plugins(pluginname: string): string { - if (pluginname === 'discord') return 'bolt-discord'; - if (pluginname === 'guilded') return 'bolt-guilded'; - if (pluginname === 'revolt') return 'bolt-revolt'; - return 'unknown'; -} - -export function is_channel(channel: string): boolean { - if ( - channel.match( - /^[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}$/i - ) - ) { - return true; - } - if (channel.match(/[0-7][0-9A-HJKMNP-TV-Z]{25}/gm)) return true; - if (!isNaN(Number(channel))) return true; - if ( - channel.startsWith('discord-') || - channel.startsWith('guilded-') || - channel.startsWith('revolt-') - ) { - return true; - } - return false; -} diff --git a/packages/bolt/migrations/mod.ts b/packages/bolt/migrations/mod.ts deleted file mode 100644 index cbc92f4..0000000 --- a/packages/bolt/migrations/mod.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { Document } from '../_deps.ts'; -import BoltFourToFourBeta from './fourtofourbeta.ts'; -import BoltFourBetaToFive from './fourtofourbeta.ts'; - -const list_migrations = [BoltFourBetaToFive, BoltFourToFourBeta]; - -export type migration = (typeof list_migrations)[number]; - -export enum versions { - Four = '0.4', - FourBeta = '0.4-beta', - Five = '0.5' -} - -export function get_migrations(from: string, to: string): migration[] { - const indexoffrom = list_migrations.findIndex(i => i.from === from); - const indexofto = list_migrations.findLastIndex(i => i.to === to); - return list_migrations.slice(indexoffrom, indexofto); -} - -export function apply_migrations( - migrations: migration[], - data: Document[] -): Document[] { - return migrations.reduce((acc, migration) => migration.translate(acc), data); -} diff --git a/packages/bolt/mod.ts b/packages/bolt/mod.ts index 9316c54..8d528c0 100644 --- a/packages/bolt/mod.ts +++ b/packages/bolt/mod.ts @@ -1,21 +1,3 @@ +export { type bridge_document, type bridge_platform } from './bridges/types.ts'; +export * from './utils/mod.ts'; export { Bolt } from './bolt.ts'; -export { type bridge_platform } from './bridges/mod.ts'; -export { type command, type command_arguments } from './cmds/mod.ts'; -export { - apply_migrations, - get_migrations, - versions, - type migration -} from './migrations/mod.ts'; -export { - bolt_plugin, - create_message, - define_config, - log_error, - type config, - type deleted_message, - type embed, - type embed_media, - type message, - type plugin_events -} from './utils/mod.ts'; diff --git a/packages/bolt/utils/_deps.ts b/packages/bolt/utils/_deps.ts deleted file mode 100644 index 0b2a570..0000000 --- a/packages/bolt/utils/_deps.ts +++ /dev/null @@ -1,5 +0,0 @@ -export { nanoid } from 'https://deno.land/x/nanoid@v3.0.0/mod.ts'; -export { Bolt } from '../bolt.ts'; -export { type bridge_platform } from '../bridges/mod.ts'; -export { type command_arguments } from '../cmds/mod.ts'; -export { EventEmitter } from '../_deps.ts'; diff --git a/packages/bolt/migrations/fourbetatofive.ts b/packages/bolt/utils/_fourbetafive.ts similarity index 74% rename from packages/bolt/migrations/fourbetatofive.ts rename to packages/bolt/utils/_fourbetafive.ts index 4ae630d..7578ea4 100644 --- a/packages/bolt/migrations/fourbetatofive.ts +++ b/packages/bolt/utils/_fourbetafive.ts @@ -1,5 +1,4 @@ -import { Document } from '../_deps.ts'; -import { map_plugins } from './_utils.ts'; +import { Document } from 'mongo'; export default { from: '0.4-beta', @@ -38,3 +37,10 @@ export default { ]; }) as Document[] }; + +function map_plugins(pluginname: string): string { + if (pluginname === 'discord') return 'bolt-discord'; + if (pluginname === 'guilded') return 'bolt-guilded'; + if (pluginname === 'revolt') return 'bolt-revolt'; + return 'unknown'; +} diff --git a/packages/bolt/migrations/fourtofourbeta.ts b/packages/bolt/utils/_fourfourbeta.ts similarity index 68% rename from packages/bolt/migrations/fourtofourbeta.ts rename to packages/bolt/utils/_fourfourbeta.ts index a322f64..390cb4c 100644 --- a/packages/bolt/migrations/fourtofourbeta.ts +++ b/packages/bolt/utils/_fourfourbeta.ts @@ -1,5 +1,4 @@ -import { Document } from '../_deps.ts'; -import { is_channel } from './_utils.ts'; +import { Document } from 'mongo'; export default { from: '0.4', @@ -51,3 +50,23 @@ export default { return documents; } }; + +function is_channel(channel: string): boolean { + if ( + channel.match( + /^[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}$/i + ) + ) { + return true; + } + if (channel.match(/[0-7][0-9A-HJKMNP-TV-Z]{25}/gm)) return true; + if (!isNaN(Number(channel))) return true; + if ( + channel.startsWith('discord-') || + channel.startsWith('guilded-') || + channel.startsWith('revolt-') + ) { + return true; + } + return false; +} diff --git a/packages/bolt/utils/commands.ts b/packages/bolt/utils/commands.ts new file mode 100644 index 0000000..4e6e82a --- /dev/null +++ b/packages/bolt/utils/commands.ts @@ -0,0 +1,122 @@ +import { Bolt } from '../bolt.ts'; +import { log_error } from './errors.ts'; +import { parseArgs } from 'std_args'; +import { create_message, message } from './messages.ts'; + +/** a class that provides text-based commands that reply to messages */ +export class Commands extends Map { + /** + * create a commands instance using the commands given or the default set + */ + constructor(default_cmds: [string, command][] = default_commands) { + super(default_cmds); + } + + /** + * listen for commands on a given bolt instance + */ + listen(bolt: Bolt) { + bolt.on('create_nonbridged_message', msg => { + if (msg.content?.startsWith('!bolt')) { + const args = parseArgs(msg.content.split(' ')); + args._.shift(); + this.run({ + channel: msg.channel, + cmd: args._.shift() as string, + subcmd: args._.shift() as string, + opts: args as Record, + platform: msg.platform.name, + timestamp: msg.timestamp, + replyfn: msg.reply + }); + } + }); + bolt.on('create_command', async cmd => { + await this.run(cmd); + }); + } + + /** + * attempt to run a command + */ + async run(opts: command_arguments) { + let reply; + try { + const cmd = this.get(opts.cmd) || this.get('help')!; + const execute = + cmd.options?.subcommands && opts.subcmd + ? cmd.options.subcommands.find(i => i.name === opts.subcmd) + ?.execute || cmd.execute + : cmd.execute; + reply = await execute(opts); + } catch (e) { + reply = (await log_error(e, { ...opts, reply: undefined })).message; + } + try { + await opts.replyfn(reply, false); + } catch (e) { + await log_error(e, { ...opts, reply: undefined }); + } + } +} + +const default_commands: [string, command][] = [ + [ + 'help', + { + name: 'help', + description: 'get help', + execute: () => + create_message({ + text: 'check out [the docs](https://williamhorning.dev/bolt/) for help.' + }) + } + ], + [ + 'version', + { + name: 'version', + description: "get bolt's version", + execute: () => + create_message({ + text: 'hello from bolt 0.5.8!' + }) + } + ], + [ + 'ping', + { + name: 'ping', + description: 'pong', + execute: ({ timestamp }) => + create_message({ + text: `Pong! 🏓 ${Temporal.Now.instant() + .since(timestamp) + .total('milliseconds')}ms` + }) + } + ] +]; + +export type command_arguments = { + channel: string; + cmd: string; + opts: Record; + platform: string; + replyfn: message['reply']; + subcmd?: string; + timestamp: Temporal.Instant; +}; + +export type command = { + name: string; + description?: string; + options?: { + argument_name?: string; + argument_required?: boolean; + subcommands?: command[]; + }; + execute: ( + opts: command_arguments + ) => Promise> | message; +}; diff --git a/packages/bolt/utils/config.ts b/packages/bolt/utils/config.ts index 5d05d23..ebb1c60 100644 --- a/packages/bolt/utils/config.ts +++ b/packages/bolt/utils/config.ts @@ -1,5 +1,6 @@ import { create_plugin } from './plugins.ts'; +/** a function that returns a config object when given a partial config object */ export function define_config(config?: Partial): config { if (!config) config = {}; if (!config.prod) config.prod = false; diff --git a/packages/bolt/utils/errors.ts b/packages/bolt/utils/errors.ts index 5af2973..777872b 100644 --- a/packages/bolt/utils/errors.ts +++ b/packages/bolt/utils/errors.ts @@ -1,34 +1,19 @@ -import { nanoid } from './_deps.ts'; import { create_message, message } from './messages.ts'; -function get_replacer() { - const seen = new WeakSet(); - return (_: string, value: unknown) => { - if (typeof value === 'object' && value !== null) { - if (seen.has(value)) { - return '[Circular]'; - } - seen.add(value); - } - if (typeof value === 'bigint') { - return value.toString(); - } - return value; - }; -} - +/** logs an error and returns a unique id and a message for users */ export async function log_error( e: Error, extra: Record = {}, - _id: () => string = nanoid + _id: () => string = crypto.randomUUID ): Promise<{ e: Error; extra: Record; uuid: string; - message: message & { uuid?: string }; + message: message; }> { const uuid = _id(); + // TODO: replace deno.env const error_hook = Deno.env.get('BOLT_ERROR_HOOK'); if (error_hook && error_hook !== '') { @@ -50,13 +35,13 @@ export async function log_error( ...extra, uuid }, - get_replacer(), + replacer(), 2 )}\`\`\`` } ] }, - get_replacer() + replacer() ) }) ).text(); @@ -70,8 +55,23 @@ export async function log_error( uuid, extra, message: create_message({ - text: `Something went wrong! Check [the docs](https://williamhorning.dev/bolt/docs/Using/) for help.\n\`\`\`\n${e.message}\n${uuid}\n\`\`\``, - uuid + text: `Something went wrong! Check [the docs](https://williamhorning.dev/bolt/docs/Using/) for help.\n\`\`\`\n${e.message}\n${uuid}\n\`\`\`` }) }; } + +function replacer() { + const seen = new WeakSet(); + return (_: string, value: unknown) => { + if (typeof value === 'object' && value !== null) { + if (seen.has(value)) { + return '[Circular]'; + } + seen.add(value); + } + if (typeof value === 'bigint') { + return value.toString(); + } + return value; + }; +} diff --git a/packages/bolt/utils/messages.ts b/packages/bolt/utils/messages.ts index 72e1d51..759409b 100644 --- a/packages/bolt/utils/messages.ts +++ b/packages/bolt/utils/messages.ts @@ -1,10 +1,9 @@ +/** creates a message given text and an optional uuid */ export function create_message({ - text, - uuid + text }: { text?: string; - uuid?: string; -}): message & { uuid?: string } { +}): message { const data = { author: { username: 'Bolt', @@ -21,8 +20,7 @@ export function create_message({ platform: { name: 'bolt', message: undefined - }, - uuid + } }; return data; } diff --git a/packages/bolt/utils/migrations.ts b/packages/bolt/utils/migrations.ts new file mode 100644 index 0000000..9f17f9d --- /dev/null +++ b/packages/bolt/utils/migrations.ts @@ -0,0 +1,30 @@ +import { Document } from 'mongo'; +import fourfourbeta from './_fourfourbeta.ts'; +import fourbetafive from './_fourfourbeta.ts'; + +const migrations = [fourbetafive, fourfourbeta]; + +/** the type of a migration */ +export type migration = (typeof migrations)[number]; + +/** all of the versions with migrations to/from them */ +export enum versions { + Four = '0.4', + FourBeta = '0.4-beta', + Five = '0.5' +} + +/** get migrations that can then be applied */ +export function get_migrations(from: string, to: string): migration[] { + const indexoffrom = migrations.findIndex(i => i.from === from); + const indexofto = migrations.findLastIndex(i => i.to === to); + return migrations.slice(indexoffrom, indexofto); +} + +/** apply many migrations */ +export function apply_migrations( + migrations: migration[], + data: Document[] +): Document[] { + return migrations.reduce((acc, migration) => migration.translate(acc), data); +} diff --git a/packages/bolt/utils/mod.ts b/packages/bolt/utils/mod.ts index 0677158..d6c8a51 100644 --- a/packages/bolt/utils/mod.ts +++ b/packages/bolt/utils/mod.ts @@ -1,4 +1,22 @@ -export * from './config.ts'; -export * from './messages.ts'; -export * from './plugins.ts'; -export * from './errors.ts'; +/** + * Various utilities for Bolt + * @module + */ + +export { Commands, type command, type command_arguments } from './commands.ts'; +export { type config, define_config } from './config.ts'; +export { log_error } from './errors.ts'; +export { + create_message, + type deleted_message, + type embed, + type embed_media, + type message +} from './messages.ts'; +export { + apply_migrations, + get_migrations, + type migration, + versions +} from './migrations.ts'; +export { plugin, type create_plugin, type plugin_events } from './plugins.ts'; diff --git a/packages/bolt/utils/plugins.ts b/packages/bolt/utils/plugins.ts index 1a2263a..b962bc9 100644 --- a/packages/bolt/utils/plugins.ts +++ b/packages/bolt/utils/plugins.ts @@ -1,49 +1,48 @@ -import { - Bolt, - EventEmitter, - bridge_platform, - command_arguments -} from './_deps.ts'; -import { deleted_message, message } from './messages.ts'; +import { EventEmitter } from 'event'; +import { Bolt } from '../bolt.ts'; +import { bridge_platform } from '../bridges/types.ts'; +import { message, deleted_message } from './messages.ts'; +import { command_arguments } from './commands.ts'; -export abstract class bolt_plugin extends EventEmitter { +/** a plugin for bolt */ +export abstract class plugin extends EventEmitter { + /** access the instance of bolt you're connected to */ bolt: Bolt; + /** access the config passed to you by bolt */ config: t; - /** the name of your plugin (like bolt-discord) */ + /** the name of your plugin */ abstract name: string; - - /** the version of your plugin (like 0.0.1) */ + /** the version of your plugin */ abstract version: string; - - /** the versions of bolt your plugin was made for (array of strings like `[0.5.0, 0.5.5]` that only includes breaking releases) */ + /** a list of major versions supported by your plugin, should include 0.5 */ abstract support: string[]; - /** constructor */ constructor(bolt: Bolt, config: t) { super(); this.bolt = bolt; this.config = config; } - /** create data needed to bridge */ + + /** this should return the data you need to send to the channel given */ abstract create_bridge(channel: string): Promise; - /** checks if message is bridged */ + /** this is used to check whether or not a message is bridged, return query if you don't know for sure */ abstract is_bridged(message: deleted_message): boolean | 'query'; - /** bridge a message */ + /** this is used to bridge a NEW message */ abstract create_message( message: message, bridge: bridge_platform ): Promise; - /** edit a bridged message */ + /** this is used to bridge an EDITED message */ abstract edit_message( new_message: message, bridge: bridge_platform & { id: string } ): Promise; - /** delete a bridged message */ + /** this is used to bridge a DELETED message */ abstract delete_message( message: deleted_message, bridge: bridge_platform & { id: string } @@ -60,6 +59,6 @@ export type plugin_events = { }; export interface create_plugin { - new (bolt: Bolt, config: unknown): bolt_plugin; - readonly prototype: bolt_plugin; + new (bolt: Bolt, config: unknown): plugin; + readonly prototype: plugin; } From c1e59f417d2658ce9888cc6fcc4e750dcc957e3e Mon Sep 17 00:00:00 2001 From: Jersey Date: Sat, 16 Mar 2024 20:32:50 -0400 Subject: [PATCH 02/13] move *some* stuff away from deno specific apis testing, redis support, and migrations still use deno apis but we could try to find a workaround Signed-off-by: Jersey --- packages/bolt/_tests.ts | 3 ++- packages/bolt/cli.ts | 26 ++++++++++++++------------ packages/bolt/deno.jsonc | 6 ++++-- packages/bolt/deno.lock | 34 ++++++++++++++++++++++++++++++++++ packages/bolt/utils/errors.ts | 4 ++-- 5 files changed, 56 insertions(+), 17 deletions(-) diff --git a/packages/bolt/_tests.ts b/packages/bolt/_tests.ts index da38427..e86b61d 100644 --- a/packages/bolt/_tests.ts +++ b/packages/bolt/_tests.ts @@ -1,4 +1,5 @@ import { assertEquals } from 'assert_eq'; +import { setEnv } from 'cross_env'; import { cmd_help_output, migrations_five, @@ -120,7 +121,7 @@ Deno.test('bolt/utils', async t => { }); await t.step('webhooks', async () => { - Deno.env.set('BOLT_ERROR_HOOK', 'http://localhost:8000'); + setEnv('BOLT_ERROR_HOOK', 'http://localhost:8000'); let res: (value: unknown) => void; diff --git a/packages/bolt/cli.ts b/packages/bolt/cli.ts index 9fb36a4..56a6702 100644 --- a/packages/bolt/cli.ts +++ b/packages/bolt/cli.ts @@ -1,4 +1,6 @@ import { Bolt } from './bolt.ts'; +import { setEnv } from 'cross_env'; +import { args, exit, cwd } from 'cross_utils'; import { parseArgs } from 'std_args'; import { MongoClient } from 'mongo'; import { @@ -13,16 +15,14 @@ function log(text: string, color?: string, type?: 'error' | 'log') { console[type || 'log'](`%c${text}`, `color: ${color || 'white'}`); } -// TODO: remove deno-specific stuff - -const f = parseArgs(Deno.args, { +const f = parseArgs(args(), { boolean: ['help', 'version', 'run', 'migrations'], string: ['config'] }); if (f.version) { console.log('0.5.8'); - Deno.exit(); + exit(); } if (!f.run && !f.migrations) { @@ -34,15 +34,17 @@ if (!f.run && !f.migrations) { log('--config : absolute path to config file'); log('--run: run an of bolt using the settings in config.ts'); log('--migrations: start interactive tool to migrate databases'); - Deno.exit(); + exit(); } try { + if (!Deno) throw new Error('not running on deno, exiting...'); + const cfg = define_config( - (await import(f.config || `${Deno.cwd()}/config.ts`))?.default + (await import(f.config || `${cwd()}/config.ts`))?.default ); - Deno.env.set('BOLT_ERROR_HOOK', cfg.errorURL || ''); + setEnv('BOLT_ERROR_HOOK', cfg.errorURL || ''); const mongo = new MongoClient(); await mongo.connect(cfg.mongo_uri); @@ -60,7 +62,7 @@ try { } catch (e) { log('Something went wrong, exiting..', 'red', 'error'); console.error(e); - Deno.exit(1); + exit(1); } async function migrations(cfg: config, mongo: MongoClient) { @@ -72,11 +74,11 @@ async function migrations(cfg: config, mongo: MongoClient) { const is_invalid = (val: string) => !(Object.values(versions) as string[]).includes(val); - if (!from || !to || is_invalid(from) || is_invalid(to)) Deno.exit(1); + if (!from || !to || is_invalid(from) || is_invalid(to)) return exit(1); const migrationlist = get_migrations(from, to); - if (migrationlist.length < 1) Deno.exit(); + if (migrationlist.length < 1) exit(); const database = mongo.database(cfg.mongo_database); @@ -96,7 +98,7 @@ async function migrations(cfg: config, mongo: MongoClient) { `Do you want to write the data at ${filepath} to the DB?` ); - if (!writeconfirm) Deno.exit(); + if (!writeconfirm) exit(); const tocollection = database.collection(migrationlist.slice(-1)[0].to_db); @@ -108,5 +110,5 @@ async function migrations(cfg: config, mongo: MongoClient) { log('Wrote data to the DB', 'green'); - Deno.exit(); + exit(); } diff --git a/packages/bolt/deno.jsonc b/packages/bolt/deno.jsonc index 533a53e..d5f14d0 100644 --- a/packages/bolt/deno.jsonc +++ b/packages/bolt/deno.jsonc @@ -2,10 +2,12 @@ "exports": "./mod.ts", "imports": { "assert_eq": "jsr:@std/assert@^0.219.1/assert_equals", + "cross_env": "jsr:@cross/env@^0.2.7", + "cross_utils": "jsr:@cross/utils@^0.5.0", "event": "jsr:@denosaurs/event@^2.0.2", - "std_args": "jsr:@std/cli@^0.219.1/parse_args", + "mongo": "https://deno.land/x/mongo@v0.32.0/mod.ts", "r2d2": "https://deno.land/x/r2d2@v2.0.0/mod.ts", - "mongo": "https://deno.land/x/mongo@v0.32.0/mod.ts" + "std_args": "jsr:@std/cli@^0.219.1/parse_args" }, // TODO: DO NOT PUBLISH UNDER THE BOLT NAME "name": "@jersey/unknown", diff --git a/packages/bolt/deno.lock b/packages/bolt/deno.lock index b76e201..5496dab 100644 --- a/packages/bolt/deno.lock +++ b/packages/bolt/deno.lock @@ -2,17 +2,48 @@ "version": "3", "packages": { "specifiers": { + "jsr:@cross/deepmerge@^0.2.0": "jsr:@cross/deepmerge@0.2.1", + "jsr:@cross/env@^0.2.7": "jsr:@cross/env@0.2.7", + "jsr:@cross/runtime@^0.0.17": "jsr:@cross/runtime@0.0.17", + "jsr:@cross/test@^0.0.8": "jsr:@cross/test@0.0.8", + "jsr:@cross/utils@^0.5.0": "jsr:@cross/utils@0.5.0", "jsr:@denosaurs/event@^2.0.2": "jsr:@denosaurs/event@2.0.2", "jsr:@std/assert@^0.219.1": "jsr:@std/assert@0.219.1", "jsr:@std/cli@^0.219.1": "jsr:@std/cli@0.219.1", "npm:@discordjs/core@1.1.1": "npm:@discordjs/core@1.1.1", "npm:@discordjs/rest@2.2.0": "npm:@discordjs/rest@2.2.0", "npm:@discordjs/ws@1.0.2": "npm:@discordjs/ws@1.0.2", + "npm:@types/node": "npm:@types/node@18.16.19", "npm:@williamhorning/revolt.js@7.0.0-beta.10": "npm:@williamhorning/revolt.js@7.0.0-beta.10_solid-js@1.8.15__seroval@1.0.4", "npm:guilded-api-typings@0.13.2": "npm:guilded-api-typings@0.13.2", "npm:guilded.js@0.23.7": "npm:guilded.js@0.23.7" }, "jsr": { + "@cross/deepmerge@0.2.1": { + "integrity": "c547bef63d95e478e48810fbfe9a5cd549c0dd3582d5a307b39cf253404cf2ba" + }, + "@cross/env@0.2.7": { + "integrity": "80a24c263dfb0a84d38c01ed30c97b8e905b524be32e586f13718877a1a2f6fa", + "dependencies": [ + "jsr:@cross/deepmerge@^0.2.0", + "jsr:@cross/runtime@^0.0.17" + ] + }, + "@cross/runtime@0.0.17": { + "integrity": "23e08c6825fc2c81fb4e341d8c51731154039d19cfc44e60de4cf9ce23e36004" + }, + "@cross/test@0.0.8": { + "integrity": "7041ed67081f98fd4780af4d9d29ed33af47327dd3c57d6e5e6f8c37dc4dc9e2", + "dependencies": [ + "jsr:@cross/runtime@^0.0.17" + ] + }, + "@cross/utils@0.5.0": { + "integrity": "4b6c02e79f3cd6d7c90aff1d08f589ee74e04ab6e16ba7b1cd21ea7e6054a94b", + "dependencies": [ + "jsr:@cross/runtime@^0.0.17" + ] + }, "@denosaurs/event@2.0.2": { "integrity": "3310ba1a9e94dd60ccb09c6084fc818cc1cd50e543c56ef0c6199f1b89073392" }, @@ -554,6 +585,9 @@ }, "workspace": { "dependencies": [ + "jsr:@cross/env@^0.2.7", + "jsr:@cross/test@^0.0.8", + "jsr:@cross/utils@^0.5.0", "jsr:@denosaurs/event@^2.0.2", "jsr:@std/assert@^0.219.1", "jsr:@std/cli@^0.219.1" diff --git a/packages/bolt/utils/errors.ts b/packages/bolt/utils/errors.ts index 777872b..6e7d906 100644 --- a/packages/bolt/utils/errors.ts +++ b/packages/bolt/utils/errors.ts @@ -1,4 +1,5 @@ import { create_message, message } from './messages.ts'; +import { getEnv } from 'cross_env'; /** logs an error and returns a unique id and a message for users */ export async function log_error( @@ -13,8 +14,7 @@ export async function log_error( }> { const uuid = _id(); - // TODO: replace deno.env - const error_hook = Deno.env.get('BOLT_ERROR_HOOK'); + const error_hook = getEnv('BOLT_ERROR_HOOK'); if (error_hook && error_hook !== '') { delete extra.msg; From 2056c28f3c485cbac8ff9b1bd38d51c96e063341 Mon Sep 17 00:00:00 2001 From: Jersey Date: Sun, 17 Mar 2024 01:02:54 -0400 Subject: [PATCH 03/13] update public api stuff Signed-off-by: Jersey --- packages/bolt/_testdata.ts | 7 +- packages/bolt/_tests.ts | 7 +- packages/bolt/bolt.ts | 2 - packages/bolt/bridges/_command_functions.ts | 44 +- packages/bolt/bridges/_commands.ts | 4 +- packages/bolt/cli.ts | 4 +- packages/bolt/deno.jsonc | 3 - packages/bolt/deno.lock | 596 -------------------- packages/bolt/mod.ts | 4 + packages/bolt/utils/_fourbetafive.ts | 38 +- packages/bolt/utils/_fourfourbeta.ts | 28 +- packages/bolt/utils/commands.ts | 28 +- packages/bolt/utils/config.ts | 17 +- packages/bolt/utils/errors.ts | 48 +- packages/bolt/utils/messages.ts | 6 +- packages/bolt/utils/migrations.ts | 2 +- 16 files changed, 92 insertions(+), 746 deletions(-) delete mode 100644 packages/bolt/deno.lock diff --git a/packages/bolt/_testdata.ts b/packages/bolt/_testdata.ts index 8dfa2e5..85ae6d2 100644 --- a/packages/bolt/_testdata.ts +++ b/packages/bolt/_testdata.ts @@ -109,7 +109,8 @@ export const utils_cfg = { plugins: [], mongo_uri: 'mongodb://localhost:27017', mongo_database: 'bolt-testing', - redis_host: 'localhost' + redis_host: 'localhost', + redis_port: 6379 }; export const utils_err = new Error('test'); @@ -131,7 +132,7 @@ export const utils_err_return = { id: 'bolt' }, content: - 'Something went wrong! Check [the docs](https://williamhorning.dev/bolt/docs/Using/) for help.\n```\ntest\ntest\n```', + 'Something went wrong! [Look here](https://williamhorning.dev/bolt) for help.\n```\ntest\ntest\n```', channel: '', id: '', reply: async () => {}, @@ -147,7 +148,7 @@ export const utils_err_hook = { embeds: [ { title: utils_err.message, - description: `\`\`\`${utils_err.stack}\`\`\`\n\`\`\`js\n${JSON.stringify( + description: `\`\`\`js\n${utils_err.stack}\n${JSON.stringify( { ...utils_extra, uuid: 'test' diff --git a/packages/bolt/_tests.ts b/packages/bolt/_tests.ts index e86b61d..f1f1a4c 100644 --- a/packages/bolt/_tests.ts +++ b/packages/bolt/_tests.ts @@ -25,6 +25,7 @@ import { } from './utils/mod.ts'; import BoltFourToFourBeta from './utils/_fourfourbeta.ts'; import BoltFourBetaToFive from './utils/_fourbetafive.ts'; +import { versions } from './utils/migrations.ts'; // override globals @@ -70,7 +71,7 @@ Deno.test('bolt/cmds', async t => { Deno.test('bolt/migrations', async t => { await t.step('get a migration', () => { - const migrations = get_migrations('0.4', '0.4-beta'); + const migrations = get_migrations(versions.Four, versions.FourBeta); assertEquals(migrations, [BoltFourToFourBeta]); }); @@ -142,9 +143,7 @@ Deno.test('bolt/utils', async t => { }); await t.step('message creation', () => { - const result = create_message({ - text: 'test' - }); + const result = create_message('test'); result.reply = utils_msg.reply; diff --git a/packages/bolt/bolt.ts b/packages/bolt/bolt.ts index e10a2f5..5e86dbb 100644 --- a/packages/bolt/bolt.ts +++ b/packages/bolt/bolt.ts @@ -21,8 +21,6 @@ export class Bolt extends EventEmitter { redis: RedisClient; plugins: Map> = new Map>(); - // TODO: replace deno.* specific stuff if possible - constructor(config: config, mongo: MongoClient, redis_conn: Deno.TcpConn) { super(); this.config = config; diff --git a/packages/bolt/bridges/_command_functions.ts b/packages/bolt/bridges/_command_functions.ts index fd701c3..59f6da4 100644 --- a/packages/bolt/bridges/_command_functions.ts +++ b/packages/bolt/bridges/_command_functions.ts @@ -1,7 +1,6 @@ import { Bolt } from '../bolt.ts'; import { command_arguments, create_message, log_error } from '../utils/mod.ts'; -/** join a bridge */ export async function join( { channel, platform, opts }: command_arguments, bolt: Bolt @@ -14,9 +13,9 @@ export async function join( if (current || !_idraw) { return { - text: create_message({ - text: "to do this, you can't be in a bridge and need to name your bridge, see `!bolt help`" - }) + text: create_message( + "to do this, you can't be in a bridge and need to name your bridge, see `!bolt help`" + ) }; } else if (!plugin || !plugin.create_bridge) { return { @@ -37,7 +36,7 @@ export async function join( }); await bolt.bridge.update_bridge(bridge); return { - text: create_message({ text: 'Joined a bridge!' }), + text: create_message('Joined a bridge!'), ok: true }; } catch (e) { @@ -46,7 +45,6 @@ export async function join( } } -/** leave a bridge */ export async function leave( { channel, platform }: command_arguments, bolt: Bolt @@ -55,9 +53,9 @@ export async function leave( if (!current) { return { - text: create_message({ - text: 'To run this command you need to be in a bridge. To learn more, run `!bolt help`.' - }), + text: create_message( + 'To run this command you need to be in a bridge. To learn more, run `!bolt help`.' + ), ok: true }; } else { @@ -70,7 +68,7 @@ export async function leave( }); return { - text: create_message({ text: 'Left a bridge!' }), + text: create_message('Left a bridge!'), ok: true }; } catch (e) { @@ -81,7 +79,6 @@ export async function leave( } } -/** reset a bridge (leave then join) */ export async function reset(args: command_arguments, bolt: Bolt) { if (!args.opts.name) { const [_, ...rest] = ( @@ -93,32 +90,27 @@ export async function reset(args: command_arguments, bolt: Bolt) { if (!result.ok) return result; result = await join(args, bolt); if (!result.ok) return result; - return { text: create_message({ text: 'Reset this bridge!' }) }; + return { text: create_message('Reset this bridge!') }; } -/** toggle a setting on a bridge */ export async function toggle(args: command_arguments, bolt: Bolt) { const current = await bolt.bridge.get_bridge(args); if (!current) { return { - text: create_message({ - text: 'You need to be in a bridge to toggle settings' - }) + text: create_message('You need to be in a bridge to toggle settings') }; } if (!args.opts.setting) { return { - text: create_message({ - text: 'You need to specify a setting to toggle' - }) + text: create_message('You need to specify a setting to toggle') }; } if (!['realnames', 'editing_allowed'].includes(args.opts.setting)) { return { - text: create_message({ text: "That setting doesn't exist" }) + text: create_message("That setting doesn't exist") }; } @@ -135,7 +127,7 @@ export async function toggle(args: command_arguments, bolt: Bolt) { try { await bolt.bridge.update_bridge(bridge); return { - text: create_message({ text: 'Toggled that setting!' }) + text: create_message('Toggled that setting!') }; } catch (e) { return { @@ -149,9 +141,7 @@ export async function status(args: command_arguments, bolt: Bolt) { if (!current) { return { - text: create_message({ - text: "You're not in any bridges right now." - }) + text: create_message("You're not in any bridges right now.") }; } @@ -165,10 +155,10 @@ export async function status(args: command_arguments, bolt: Bolt) { : 'as well as no settings'; return { - text: create_message({ - text: `This channel is connected to \`${current._id}\`, a bridge with ${ + text: create_message( + `This channel is connected to \`${current._id}\`, a bridge with ${ current.platforms.length - 1 } other channels connected to it, ${settings_text}` - }) + ) }; } diff --git a/packages/bolt/bridges/_commands.ts b/packages/bolt/bridges/_commands.ts index 6b92c8e..4e92e68 100644 --- a/packages/bolt/bridges/_commands.ts +++ b/packages/bolt/bridges/_commands.ts @@ -7,9 +7,7 @@ export function bridge_commands(bolt: Bolt): command { name: 'bridge', description: 'bridge this channel to somewhere else', execute: () => - create_message({ - text: 'Try running `!bolt help` for help with bridges' - }), + create_message('Try running `!bolt help` for help with bridges'), options: { subcommands: [ { diff --git a/packages/bolt/cli.ts b/packages/bolt/cli.ts index 56a6702..6ad154c 100644 --- a/packages/bolt/cli.ts +++ b/packages/bolt/cli.ts @@ -60,7 +60,7 @@ try { await migrations(cfg, mongo); } } catch (e) { - log('Something went wrong, exiting..', 'red', 'error'); + log('Something went wrong, exiting...', 'red', 'error'); console.error(e); exit(1); } @@ -76,7 +76,7 @@ async function migrations(cfg: config, mongo: MongoClient) { if (!from || !to || is_invalid(from) || is_invalid(to)) return exit(1); - const migrationlist = get_migrations(from, to); + const migrationlist = get_migrations(from as versions, to as versions); if (migrationlist.length < 1) exit(); diff --git a/packages/bolt/deno.jsonc b/packages/bolt/deno.jsonc index d5f14d0..ad3e330 100644 --- a/packages/bolt/deno.jsonc +++ b/packages/bolt/deno.jsonc @@ -12,8 +12,5 @@ // TODO: DO NOT PUBLISH UNDER THE BOLT NAME "name": "@jersey/unknown", "unstable": ["temporal"], - "test": { - "include": ["./_tests.ts"] - }, "version": "0.5.9" } diff --git a/packages/bolt/deno.lock b/packages/bolt/deno.lock deleted file mode 100644 index 5496dab..0000000 --- a/packages/bolt/deno.lock +++ /dev/null @@ -1,596 +0,0 @@ -{ - "version": "3", - "packages": { - "specifiers": { - "jsr:@cross/deepmerge@^0.2.0": "jsr:@cross/deepmerge@0.2.1", - "jsr:@cross/env@^0.2.7": "jsr:@cross/env@0.2.7", - "jsr:@cross/runtime@^0.0.17": "jsr:@cross/runtime@0.0.17", - "jsr:@cross/test@^0.0.8": "jsr:@cross/test@0.0.8", - "jsr:@cross/utils@^0.5.0": "jsr:@cross/utils@0.5.0", - "jsr:@denosaurs/event@^2.0.2": "jsr:@denosaurs/event@2.0.2", - "jsr:@std/assert@^0.219.1": "jsr:@std/assert@0.219.1", - "jsr:@std/cli@^0.219.1": "jsr:@std/cli@0.219.1", - "npm:@discordjs/core@1.1.1": "npm:@discordjs/core@1.1.1", - "npm:@discordjs/rest@2.2.0": "npm:@discordjs/rest@2.2.0", - "npm:@discordjs/ws@1.0.2": "npm:@discordjs/ws@1.0.2", - "npm:@types/node": "npm:@types/node@18.16.19", - "npm:@williamhorning/revolt.js@7.0.0-beta.10": "npm:@williamhorning/revolt.js@7.0.0-beta.10_solid-js@1.8.15__seroval@1.0.4", - "npm:guilded-api-typings@0.13.2": "npm:guilded-api-typings@0.13.2", - "npm:guilded.js@0.23.7": "npm:guilded.js@0.23.7" - }, - "jsr": { - "@cross/deepmerge@0.2.1": { - "integrity": "c547bef63d95e478e48810fbfe9a5cd549c0dd3582d5a307b39cf253404cf2ba" - }, - "@cross/env@0.2.7": { - "integrity": "80a24c263dfb0a84d38c01ed30c97b8e905b524be32e586f13718877a1a2f6fa", - "dependencies": [ - "jsr:@cross/deepmerge@^0.2.0", - "jsr:@cross/runtime@^0.0.17" - ] - }, - "@cross/runtime@0.0.17": { - "integrity": "23e08c6825fc2c81fb4e341d8c51731154039d19cfc44e60de4cf9ce23e36004" - }, - "@cross/test@0.0.8": { - "integrity": "7041ed67081f98fd4780af4d9d29ed33af47327dd3c57d6e5e6f8c37dc4dc9e2", - "dependencies": [ - "jsr:@cross/runtime@^0.0.17" - ] - }, - "@cross/utils@0.5.0": { - "integrity": "4b6c02e79f3cd6d7c90aff1d08f589ee74e04ab6e16ba7b1cd21ea7e6054a94b", - "dependencies": [ - "jsr:@cross/runtime@^0.0.17" - ] - }, - "@denosaurs/event@2.0.2": { - "integrity": "3310ba1a9e94dd60ccb09c6084fc818cc1cd50e543c56ef0c6199f1b89073392" - }, - "@std/assert@0.219.1": { - "integrity": "e76c2a1799a78f0f4db7de04bdc9b908a7a4b821bb65eda0285885297d4fb8af" - }, - "@std/cli@0.219.1": { - "integrity": "715a9926b58b89ef8a3c91e91633ac5f8176e0f02f6b3a16f0a67309e41a2911", - "dependencies": [ - "jsr:@std/assert@^0.219.1" - ] - } - }, - "npm": { - "@discordjs/collection@1.5.3": { - "integrity": "sha512-SVb428OMd3WO1paV3rm6tSjM4wC+Kecaa1EUGX7vc6/fddvw/6lg90z4QtCqm21zvVe92vMMDt9+DkIvjXImQQ==", - "dependencies": {} - }, - "@discordjs/collection@2.0.0": { - "integrity": "sha512-YTWIXLrf5FsrLMycpMM9Q6vnZoR/lN2AWX23/Cuo8uOOtS8eHB2dyQaaGnaF8aZPYnttf2bkLMcXn/j6JUOi3w==", - "dependencies": {} - }, - "@discordjs/core@1.1.1": { - "integrity": "sha512-3tDqc6KCAtE0CxNl5300uPzFnNsY/GAmJhc6oGutbl/la+4mRv5zVb4N68cmcaeD2Il/ySH4zIc00sq+cyhtUA==", - "dependencies": { - "@discordjs/rest": "@discordjs/rest@2.2.0", - "@discordjs/util": "@discordjs/util@1.0.2", - "@discordjs/ws": "@discordjs/ws@1.0.2", - "@sapphire/snowflake": "@sapphire/snowflake@3.5.3", - "@vladfrangu/async_event_emitter": "@vladfrangu/async_event_emitter@2.2.4", - "discord-api-types": "discord-api-types@0.37.61" - } - }, - "@discordjs/rest@2.2.0": { - "integrity": "sha512-nXm9wT8oqrYFRMEqTXQx9DUTeEtXUDMmnUKIhZn6O2EeDY9VCdwj23XCPq7fkqMPKdF7ldAfeVKyxxFdbZl59A==", - "dependencies": { - "@discordjs/collection": "@discordjs/collection@2.0.0", - "@discordjs/util": "@discordjs/util@1.0.2", - "@sapphire/async-queue": "@sapphire/async-queue@1.5.2", - "@sapphire/snowflake": "@sapphire/snowflake@3.5.3", - "@vladfrangu/async_event_emitter": "@vladfrangu/async_event_emitter@2.2.4", - "discord-api-types": "discord-api-types@0.37.61", - "magic-bytes.js": "magic-bytes.js@1.10.0", - "tslib": "tslib@2.6.2", - "undici": "undici@5.27.2" - } - }, - "@discordjs/util@1.0.2": { - "integrity": "sha512-IRNbimrmfb75GMNEjyznqM1tkI7HrZOf14njX7tCAAUetyZM1Pr8hX/EK2lxBCOgWDRmigbp24fD1hdMfQK5lw==", - "dependencies": {} - }, - "@discordjs/ws@1.0.2": { - "integrity": "sha512-+XI82Rm2hKnFwAySXEep4A7Kfoowt6weO6381jgW+wVdTpMS/56qCvoXyFRY0slcv7c/U8My2PwIB2/wEaAh7Q==", - "dependencies": { - "@discordjs/collection": "@discordjs/collection@2.0.0", - "@discordjs/rest": "@discordjs/rest@2.2.0", - "@discordjs/util": "@discordjs/util@1.0.2", - "@sapphire/async-queue": "@sapphire/async-queue@1.5.2", - "@types/ws": "@types/ws@8.5.10", - "@vladfrangu/async_event_emitter": "@vladfrangu/async_event_emitter@2.2.4", - "discord-api-types": "discord-api-types@0.37.61", - "tslib": "tslib@2.6.2", - "ws": "ws@8.16.0" - } - }, - "@fastify/busboy@2.1.1": { - "integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==", - "dependencies": {} - }, - "@guildedjs/api@0.3.2": { - "integrity": "sha512-Tn2DUQm2sPJn1jKLe+GGw1uwL837WCgtNAj5WjIMnM6zHaEoFgIWXM2uMZQ5GTWsC1ZTUu8XiCniGv7YvItv3Q==", - "dependencies": { - "@types/ws": "@types/ws@8.5.4", - "form-data": "form-data@4.0.0", - "node-fetch": "node-fetch@2.6.11", - "qs": "qs@6.11.2", - "typed-emitter": "typed-emitter@2.1.0", - "ws": "ws@8.13.0" - } - }, - "@insertish/oapi@0.1.18": { - "integrity": "sha512-LZLUk3WmzUjCM0quensexvQx/Kk1MpFBtCLJRnRrPOiaFT37JpOmWUFlrdu0sPS6B9wi2edEBeLcsnIiq85WMA==", - "dependencies": { - "axios": "axios@0.26.1", - "openapi-typescript": "openapi-typescript@5.4.1", - "typescript": "typescript@4.9.5" - } - }, - "@sapphire/async-queue@1.5.2": { - "integrity": "sha512-7X7FFAA4DngXUl95+hYbUF19bp1LGiffjJtu7ygrZrbdCSsdDDBaSjB7Akw0ZbOu6k0xpXyljnJ6/RZUvLfRdg==", - "dependencies": {} - }, - "@sapphire/snowflake@3.5.3": { - "integrity": "sha512-jjmJywLAFoWeBi1W7994zZyiNWPIiqRRNAmSERxyg93xRGzNYvGjlZ0gR6x0F4gPRi2+0O6S71kOZYyr3cxaIQ==", - "dependencies": {} - }, - "@solid-primitives/map@0.4.10_solid-js@1.8.15__seroval@1.0.4": { - "integrity": "sha512-Y4aTvQN1DjMmTQeNS3H1Fc+fVVPVslYGAOxD8gIMgQtHn+yLd4Zc4pm/x0m/lsy7NnEi0nskz4G7vbEd9M5sOA==", - "dependencies": { - "@solid-primitives/trigger": "@solid-primitives/trigger@1.0.10_solid-js@1.8.15__seroval@1.0.4", - "solid-js": "solid-js@1.8.15_seroval@1.0.4" - } - }, - "@solid-primitives/set@0.4.10_solid-js@1.8.15__seroval@1.0.4": { - "integrity": "sha512-YAoKFKfpHCjnZQV/TnzH01cSXRpDJS4gpuwGpLiiJvCt7rhAMImLMJj+nTt5WWE6DtolWuup4kLloO9tS/vE/g==", - "dependencies": { - "@solid-primitives/trigger": "@solid-primitives/trigger@1.0.10_solid-js@1.8.15__seroval@1.0.4", - "solid-js": "solid-js@1.8.15_seroval@1.0.4" - } - }, - "@solid-primitives/trigger@1.0.10_solid-js@1.8.15__seroval@1.0.4": { - "integrity": "sha512-gPNhmIBMxaJm2gWAAqUkpF5Vk6yZgaJ9+MFQN5eIRQ//GPIUqkNtSSar5sU+iG2I5QmS4iU7gOnvv3XvxXI1fg==", - "dependencies": { - "@solid-primitives/utils": "@solid-primitives/utils@6.2.3_solid-js@1.8.15__seroval@1.0.4", - "solid-js": "solid-js@1.8.15_seroval@1.0.4" - } - }, - "@solid-primitives/utils@6.2.3_solid-js@1.8.15__seroval@1.0.4": { - "integrity": "sha512-CqAwKb2T5Vi72+rhebSsqNZ9o67buYRdEJrIFzRXz3U59QqezuuxPsyzTSVCacwS5Pf109VRsgCJQoxKRoECZQ==", - "dependencies": { - "solid-js": "solid-js@1.8.15_seroval@1.0.4" - } - }, - "@types/node@18.16.19": { - "integrity": "sha512-IXl7o+R9iti9eBW4Wg2hx1xQDig183jj7YLn8F7udNceyfkbn1ZxmzZXuak20gR40D7pIkIY1kYGx5VIGbaHKA==", - "dependencies": {} - }, - "@types/ws@8.5.10": { - "integrity": "sha512-vmQSUcfalpIq0R9q7uTo2lXs6eGIpt9wtnLdMv9LVpIjCA/+ufZRozlVoVelIYixx1ugCBKDhn89vnsEGOCx9A==", - "dependencies": { - "@types/node": "@types/node@18.16.19" - } - }, - "@types/ws@8.5.4": { - "integrity": "sha512-zdQDHKUgcX/zBc4GrwsE/7dVdAD8JR4EuiAXiiUhhfyIJXXb2+PrGshFyeXWQPMmmZ2XxgaqclgpIC7eTXc1mg==", - "dependencies": { - "@types/node": "@types/node@18.16.19" - } - }, - "@vladfrangu/async_event_emitter@2.2.4": { - "integrity": "sha512-ButUPz9E9cXMLgvAW8aLAKKJJsPu1dY1/l/E8xzLFuysowXygs6GBcyunK9rnGC4zTsnIc2mQo71rGw9U+Ykug==", - "dependencies": {} - }, - "@williamhorning/revolt.js@7.0.0-beta.10_solid-js@1.8.15__seroval@1.0.4": { - "integrity": "sha512-w9rw5Z3HiHzwq3+QOxzceljzQAA1DUNg8lV+ClZw8CvkajLEIUn6C+9v8aEzSEz9ABaZCDA46KnrIPZN3l72Xw==", - "dependencies": { - "@solid-primitives/map": "@solid-primitives/map@0.4.10_solid-js@1.8.15__seroval@1.0.4", - "@solid-primitives/set": "@solid-primitives/set@0.4.10_solid-js@1.8.15__seroval@1.0.4", - "long": "long@5.2.3", - "revolt-api": "revolt-api@0.6.5", - "solid-js": "solid-js@1.8.15_seroval@1.0.4", - "ulid": "ulid@2.3.0", - "ws": "ws@8.16.0" - } - }, - "argparse@2.0.1": { - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dependencies": {} - }, - "asynckit@0.4.0": { - "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", - "dependencies": {} - }, - "axios@0.26.1": { - "integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==", - "dependencies": { - "follow-redirects": "follow-redirects@1.15.5" - } - }, - "call-bind@1.0.7": { - "integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==", - "dependencies": { - "es-define-property": "es-define-property@1.0.0", - "es-errors": "es-errors@1.3.0", - "function-bind": "function-bind@1.1.2", - "get-intrinsic": "get-intrinsic@1.2.4", - "set-function-length": "set-function-length@1.2.1" - } - }, - "combined-stream@1.0.8": { - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "dependencies": { - "delayed-stream": "delayed-stream@1.0.0" - } - }, - "csstype@3.1.3": { - "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==", - "dependencies": {} - }, - "define-data-property@1.1.4": { - "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", - "dependencies": { - "es-define-property": "es-define-property@1.0.0", - "es-errors": "es-errors@1.3.0", - "gopd": "gopd@1.0.1" - } - }, - "delayed-stream@1.0.0": { - "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", - "dependencies": {} - }, - "discord-api-types@0.37.61": { - "integrity": "sha512-o/dXNFfhBpYHpQFdT6FWzeO7pKc838QeeZ9d91CfVAtpr5XLK4B/zYxQbYgPdoMiTDvJfzcsLW5naXgmHGDNXw==", - "dependencies": {} - }, - "es-define-property@1.0.0": { - "integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==", - "dependencies": { - "get-intrinsic": "get-intrinsic@1.2.4" - } - }, - "es-errors@1.3.0": { - "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", - "dependencies": {} - }, - "follow-redirects@1.15.5": { - "integrity": "sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw==", - "dependencies": {} - }, - "form-data@4.0.0": { - "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", - "dependencies": { - "asynckit": "asynckit@0.4.0", - "combined-stream": "combined-stream@1.0.8", - "mime-types": "mime-types@2.1.35" - } - }, - "function-bind@1.1.2": { - "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", - "dependencies": {} - }, - "get-intrinsic@1.2.4": { - "integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==", - "dependencies": { - "es-errors": "es-errors@1.3.0", - "function-bind": "function-bind@1.1.2", - "has-proto": "has-proto@1.0.3", - "has-symbols": "has-symbols@1.0.3", - "hasown": "hasown@2.0.1" - } - }, - "globalyzer@0.1.0": { - "integrity": "sha512-40oNTM9UfG6aBmuKxk/giHn5nQ8RVz/SS4Ir6zgzOv9/qC3kKZ9v4etGTcJbEl/NyVQH7FGU7d+X1egr57Md2Q==", - "dependencies": {} - }, - "globrex@0.1.2": { - "integrity": "sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==", - "dependencies": {} - }, - "gopd@1.0.1": { - "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", - "dependencies": { - "get-intrinsic": "get-intrinsic@1.2.4" - } - }, - "guilded-api-typings@0.13.2": { - "integrity": "sha512-Fleko3u0WbYis/WyZoD/x6ZaqXiI4IYvVou+tLqHHLNWZGPvnNErEffxTb7q4QBzi4oX8KkKLAeMsmqpsnz5ew==", - "dependencies": {} - }, - "guilded.js@0.23.7": { - "integrity": "sha512-W7UkWqZhaIEtJmbe7cMXwTIuWlJ++vbOIluCQOfjayzScJx8o1KVmn3niAvONN/tJV/zNBJ5+pyXzMC8bhuEyQ==", - "dependencies": { - "@discordjs/collection": "@discordjs/collection@1.5.3", - "@guildedjs/api": "@guildedjs/api@0.3.2", - "typed-emitter": "typed-emitter@2.1.0" - } - }, - "has-property-descriptors@1.0.2": { - "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", - "dependencies": { - "es-define-property": "es-define-property@1.0.0" - } - }, - "has-proto@1.0.3": { - "integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==", - "dependencies": {} - }, - "has-symbols@1.0.3": { - "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", - "dependencies": {} - }, - "hasown@2.0.1": { - "integrity": "sha512-1/th4MHjnwncwXsIW6QMzlvYL9kG5e/CpVvLRZe4XPa8TOUNbCELqmvhDmnkNsAjwaG4+I8gJJL0JBvTTLO9qA==", - "dependencies": { - "function-bind": "function-bind@1.1.2" - } - }, - "js-yaml@4.1.0": { - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dependencies": { - "argparse": "argparse@2.0.1" - } - }, - "lodash.defaultsdeep@4.6.1": { - "integrity": "sha512-3j8wdDzYuWO3lM3Reg03MuQR957t287Rpcxp1njpEa8oDrikb+FwGdW3n+FELh/A6qib6yPit0j/pv9G/yeAqA==", - "dependencies": {} - }, - "long@5.2.3": { - "integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==", - "dependencies": {} - }, - "magic-bytes.js@1.10.0": { - "integrity": "sha512-/k20Lg2q8LE5xiaaSkMXk4sfvI+9EGEykFS4b0CHHGWqDYU0bGUFSwchNOMA56D7TCs9GwVTkqe9als1/ns8UQ==", - "dependencies": {} - }, - "mime-db@1.52.0": { - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", - "dependencies": {} - }, - "mime-types@2.1.35": { - "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", - "dependencies": { - "mime-db": "mime-db@1.52.0" - } - }, - "mime@3.0.0": { - "integrity": "sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==", - "dependencies": {} - }, - "node-fetch@2.6.11": { - "integrity": "sha512-4I6pdBY1EthSqDmJkiNk3JIT8cswwR9nfeW/cPdUagJYEQG7R95WRH74wpz7ma8Gh/9dI9FP+OU+0E4FvtA55w==", - "dependencies": { - "whatwg-url": "whatwg-url@5.0.0" - } - }, - "object-inspect@1.13.1": { - "integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==", - "dependencies": {} - }, - "openapi-typescript@5.4.1": { - "integrity": "sha512-AGB2QiZPz4rE7zIwV3dRHtoUC/CWHhUjuzGXvtmMQN2AFV8xCTLKcZUHLcdPQmt/83i22nRE7+TxXOXkK+gf4Q==", - "dependencies": { - "js-yaml": "js-yaml@4.1.0", - "mime": "mime@3.0.0", - "prettier": "prettier@2.8.8", - "tiny-glob": "tiny-glob@0.2.9", - "undici": "undici@5.27.2", - "yargs-parser": "yargs-parser@21.1.1" - } - }, - "prettier@2.8.8": { - "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", - "dependencies": {} - }, - "qs@6.11.2": { - "integrity": "sha512-tDNIz22aBzCDxLtVH++VnTfzxlfeK5CbqohpSqpJgj1Wg/cQbStNAz3NuqCs5vV+pjBsK4x4pN9HlVh7rcYRiA==", - "dependencies": { - "side-channel": "side-channel@1.0.5" - } - }, - "revolt-api@0.6.5": { - "integrity": "sha512-1PNcc6DvWplwt4v9unEKKVVqa/X2gE0yT0RgPR8pM5uerpzPKDhikrbr5zudqnoBQ1t+92rKKDdMMAeBWH0mUA==", - "dependencies": { - "@insertish/oapi": "@insertish/oapi@0.1.18", - "axios": "axios@0.26.1", - "lodash.defaultsdeep": "lodash.defaultsdeep@4.6.1" - } - }, - "rxjs@7.8.1": { - "integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==", - "dependencies": { - "tslib": "tslib@2.6.2" - } - }, - "seroval-plugins@1.0.4_seroval@1.0.4": { - "integrity": "sha512-DQ2IK6oQVvy8k+c2V5x5YCtUa/GGGsUwUBNN9UqohrZ0rWdUapBFpNMYP1bCyRHoxOJjdKGl+dieacFIpU/i1A==", - "dependencies": { - "seroval": "seroval@1.0.4" - } - }, - "seroval@1.0.4": { - "integrity": "sha512-qQs/N+KfJu83rmszFQaTxcoJoPn6KNUruX4KmnmyD0oZkUoiNvJ1rpdYKDf4YHM05k+HOgCxa3yvf15QbVijGg==", - "dependencies": {} - }, - "set-function-length@1.2.1": { - "integrity": "sha512-j4t6ccc+VsKwYHso+kElc5neZpjtq9EnRICFZtWyBsLojhmeF/ZBd/elqm22WJh/BziDe/SBiOeAt0m2mfLD0g==", - "dependencies": { - "define-data-property": "define-data-property@1.1.4", - "es-errors": "es-errors@1.3.0", - "function-bind": "function-bind@1.1.2", - "get-intrinsic": "get-intrinsic@1.2.4", - "gopd": "gopd@1.0.1", - "has-property-descriptors": "has-property-descriptors@1.0.2" - } - }, - "side-channel@1.0.5": { - "integrity": "sha512-QcgiIWV4WV7qWExbN5llt6frQB/lBven9pqliLXfGPB+K9ZYXxDozp0wLkHS24kWCm+6YXH/f0HhnObZnZOBnQ==", - "dependencies": { - "call-bind": "call-bind@1.0.7", - "es-errors": "es-errors@1.3.0", - "get-intrinsic": "get-intrinsic@1.2.4", - "object-inspect": "object-inspect@1.13.1" - } - }, - "solid-js@1.8.15_seroval@1.0.4": { - "integrity": "sha512-d0QP/efr3UVcwGgWVPveQQ0IHOH6iU7yUhc2piy8arNG8wxKmvUy1kFxyF8owpmfCWGB87usDKMaVnsNYZm+Vw==", - "dependencies": { - "csstype": "csstype@3.1.3", - "seroval": "seroval@1.0.4", - "seroval-plugins": "seroval-plugins@1.0.4_seroval@1.0.4" - } - }, - "tiny-glob@0.2.9": { - "integrity": "sha512-g/55ssRPUjShh+xkfx9UPDXqhckHEsHr4Vd9zX55oSdGZc/MD0m3sferOkwWtp98bv+kcVfEHtRJgBVJzelrzg==", - "dependencies": { - "globalyzer": "globalyzer@0.1.0", - "globrex": "globrex@0.1.2" - } - }, - "tr46@0.0.3": { - "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", - "dependencies": {} - }, - "tslib@2.6.2": { - "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", - "dependencies": {} - }, - "typed-emitter@2.1.0": { - "integrity": "sha512-g/KzbYKbH5C2vPkaXGu8DJlHrGKHLsM25Zg9WuC9pMGfuvT+X25tZQWo5fK1BjBm8+UrVE9LDCvaY0CQk+fXDA==", - "dependencies": { - "rxjs": "rxjs@7.8.1" - } - }, - "typescript@4.9.5": { - "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", - "dependencies": {} - }, - "ulid@2.3.0": { - "integrity": "sha512-keqHubrlpvT6G2wH0OEfSW4mquYRcbe/J8NMmveoQOjUqmo+hXtO+ORCpWhdbZ7k72UtY61BL7haGxW6enBnjw==", - "dependencies": {} - }, - "undici@5.27.2": { - "integrity": "sha512-iS857PdOEy/y3wlM3yRp+6SNQQ6xU0mmZcwRSriqk+et/cwWAtwmIGf6WkoDN2EK/AMdCO/dfXzIwi+rFMrjjQ==", - "dependencies": { - "@fastify/busboy": "@fastify/busboy@2.1.1" - } - }, - "webidl-conversions@3.0.1": { - "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", - "dependencies": {} - }, - "whatwg-url@5.0.0": { - "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", - "dependencies": { - "tr46": "tr46@0.0.3", - "webidl-conversions": "webidl-conversions@3.0.1" - } - }, - "ws@8.13.0": { - "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", - "dependencies": {} - }, - "ws@8.16.0": { - "integrity": "sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ==", - "dependencies": {} - }, - "yargs-parser@21.1.1": { - "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", - "dependencies": {} - } - } - }, - "remote": { - "https://deno.land/std@0.154.0/_util/assert.ts": "e94f2eb37cebd7f199952e242c77654e43333c1ac4c5c700e929ea3aa5489f74", - "https://deno.land/std@0.154.0/_wasm_crypto/lib/deno_std_wasm_crypto.generated.mjs": "dfcd6777d05345362c70f9f2c49abba3ed3f925fccfcf725abe2d16d51819433", - "https://deno.land/std@0.154.0/_wasm_crypto/mod.ts": "6c60d332716147ded0eece0861780678d51b560f533b27db2e15c64a4ef83665", - "https://deno.land/std@0.154.0/async/deferred.ts": "c01de44b9192359cebd3fe93273fcebf9e95110bf3360023917da9a2d1489fae", - "https://deno.land/std@0.154.0/bytes/bytes_list.ts": "aba5e2369e77d426b10af1de0dcc4531acecec27f9b9056f4f7bfbf8ac147ab4", - "https://deno.land/std@0.154.0/bytes/equals.ts": "3c3558c3ae85526f84510aa2b48ab2ad7bdd899e2e0f5b7a8ffc85acb3a6043a", - "https://deno.land/std@0.154.0/bytes/mod.ts": "763f97d33051cc3f28af1a688dfe2830841192a9fea0cbaa55f927b49d49d0bf", - "https://deno.land/std@0.154.0/crypto/_fnv/fnv32.ts": "aa9bddead8c6345087d3abd4ef35fb9655622afc333fc41fff382b36e64280b5", - "https://deno.land/std@0.154.0/crypto/_fnv/fnv64.ts": "625d7e7505b6cb2e9801b5fd6ed0a89256bac12b2bbb3e4664b85a88b0ec5bef", - "https://deno.land/std@0.154.0/crypto/_fnv/index.ts": "a8f6a361b4c6d54e5e89c16098f99b6962a1dd6ad1307dbc97fa1ecac5d7060a", - "https://deno.land/std@0.154.0/crypto/_fnv/util.ts": "4848313bed7f00f55be3cb080aa0583fc007812ba965b03e4009665bde614ce3", - "https://deno.land/std@0.154.0/crypto/keystack.ts": "e481eed28007395e554a435e880fee83a5c73b9259ed8a135a75e4b1e4f381f7", - "https://deno.land/std@0.154.0/crypto/mod.ts": "0ef11f063cd0f9759485a3c9051e15125e1bde3b47c23b47e79b6e13cfcf9481", - "https://deno.land/std@0.154.0/crypto/timing_safe_equal.ts": "82a29b737bc8932d75d7a20c404136089d5d23629e94ba14efa98a8cc066c73e", - "https://deno.land/std@0.154.0/encoding/base64.ts": "c57868ca7fa2fbe919f57f88a623ad34e3d970d675bdc1ff3a9d02bba7409db2", - "https://deno.land/std@0.154.0/encoding/base64url.ts": "a5f82a9fa703bd85a5eb8e7c1296bc6529e601ebd9642cc2b5eaa6b38fa9e05a", - "https://deno.land/std@0.154.0/encoding/hex.ts": "4cc5324417cbb4ac9b828453d35aed45b9cc29506fad658f1f138d981ae33795", - "https://deno.land/std@0.154.0/fmt/colors.ts": "ff7dc9c9f33a72bd48bc24b21bbc1b4545d8494a431f17894dbc5fe92a938fc4", - "https://deno.land/std@0.154.0/io/buffer.ts": "fae02290f52301c4e0188670e730cd902f9307fb732d79c4aa14ebdc82497289", - "https://deno.land/std@0.154.0/io/files.ts": "d199ef64e918a256320ba8d8d44ae91de87c9077df8f8d6cca013f1b9fbbe285", - "https://deno.land/std@0.154.0/io/mod.ts": "33507cf2460ab67d0d90fb5749fa6fecb33897642b49d54a6bb1ac81e4768f69", - "https://deno.land/std@0.154.0/io/readers.ts": "45847ad404afd2f605eae1cff193f223462bc55eeb9ae313c2f3db28aada0fd6", - "https://deno.land/std@0.154.0/io/streams.ts": "988a19155b52161f0035ce539e2f1d12edbc4c389fa7633da832a64e6edbe1a0", - "https://deno.land/std@0.154.0/io/util.ts": "078da53bba767bec0d45f7da44411f6dbf269e51ef7fcfea5e3714e04681c674", - "https://deno.land/std@0.154.0/io/writers.ts": "2e1c63ffd0cfba411b1fd8374609abff9ea86187c9d4d885d42e6fc20325ef0e", - "https://deno.land/std@0.154.0/streams/conversion.ts": "fc4eb76a14148c43f0b85e903a5a1526391aa40ed9434dc21e34f88304eb823e", - "https://deno.land/std@0.154.0/testing/_diff.ts": "141f978a283defc367eeee3ff7b58aa8763cf7c8e0c585132eae614468e9d7b8", - "https://deno.land/std@0.154.0/testing/_format.ts": "cd11136e1797791045e639e9f0f4640d5b4166148796cad37e6ef75f7d7f3832", - "https://deno.land/std@0.154.0/testing/asserts.ts": "ac295f7fd22a7af107580e2475402a8c386cb1bf18bf837ae266ac0665786026", - "https://deno.land/std@0.203.0/bytes/bytes_list.ts": "ecf5098c230b793970f43c06e8f30d70b937c031658365aeb3de9a8ae4d406a3", - "https://deno.land/std@0.203.0/bytes/concat.ts": "d26d6f3d7922e6d663dacfcd357563b7bf4a380ce5b9c2bbe0c8586662f25ce2", - "https://deno.land/std@0.203.0/collections/chunk.ts": "f82c52a82ad9338018570c42f6de0fb132fcb14914c31a444e360ac104d7b55b", - "https://deno.land/std@0.203.0/io/read_delim.ts": "8ea988eac1503c7118bfcf00b4e4a422450548af8e18328f6f599553cfe78012", - "https://deno.land/std@0.203.0/streams/write_all.ts": "4cdd36256f892fe7aead46338054f6ea813a63765e87bda4c60e8c5a57d1c5c1", - "https://deno.land/x/mongo@v0.32.0/deps.ts": "1b53a32fbc115195d74ab78e7d21026ea4b6590e5b558b388017cc1a9b8181e6", - "https://deno.land/x/mongo@v0.32.0/mod.ts": "0989f34d08c40440b8786140abdaf863e964e23df5d1a80e661d3d4170d9d21e", - "https://deno.land/x/mongo@v0.32.0/src/auth/base.ts": "7fe14cf0a63d6bbc4ba69a000a04b3b184d26842504d94652a6af2d0c9494944", - "https://deno.land/x/mongo@v0.32.0/src/auth/mod.ts": "b161611bd5be9e9d1b4497227c8ea93ad4daadcd98038c9e5a707bc5da7a25ca", - "https://deno.land/x/mongo@v0.32.0/src/auth/pbkdf2.ts": "1f1db192fd37869d118ab34780b64567ebcf0ad83a03ef28b3d740cae9adb47a", - "https://deno.land/x/mongo@v0.32.0/src/auth/scram.ts": "187db02e94e7e5423ec902e87d6839028770dca57830dca7f154dcd22a959c0f", - "https://deno.land/x/mongo@v0.32.0/src/auth/x509.ts": "a75b27c549707dd441434ae400a3e6a24da7fe7d4e0e80c9bb79dfc6426b651e", - "https://deno.land/x/mongo@v0.32.0/src/client.ts": "368cac10b3df3bfbc2dfba468d1bbd1332c359a643e0bb81a13d7220a58b43ff", - "https://deno.land/x/mongo@v0.32.0/src/cluster.ts": "cff69bf284a5c7fcaff231494f1ab56ca652e725e58622723e402fbb61448d0e", - "https://deno.land/x/mongo@v0.32.0/src/collection/collection.ts": "6748479b4e9992f9f2ce8e22f891f8917349c1a0e53cb89da5a66cf2b44b9016", - "https://deno.land/x/mongo@v0.32.0/src/collection/commands/aggregate.ts": "440906a670adb46edb36fd95573ffa83f192775108b621520be992165910e895", - "https://deno.land/x/mongo@v0.32.0/src/collection/commands/find.ts": "5c3b750d8c82ce08d865a381bc71f600406cbc4912c4aa689238755579fb71f8", - "https://deno.land/x/mongo@v0.32.0/src/collection/commands/list_indexes.ts": "d32a5120305d0547497026b4f5ab2ecc2f40ff7f44c405b99c2a0287765333f5", - "https://deno.land/x/mongo@v0.32.0/src/collection/commands/update.ts": "cf352108a5dd34f0928c2196a432383d366b8ed292676c71358b9ecf1289418d", - "https://deno.land/x/mongo@v0.32.0/src/collection/mod.ts": "bd791a0b9b46be4365f88c54893584eadec2f8cd799db9eb05e0b5b4c8d72b8e", - "https://deno.land/x/mongo@v0.32.0/src/database.ts": "c7b677beddd3eb16f79e8d3c9473b5f86e45541b8a04cc896aabe04d029fa7a0", - "https://deno.land/x/mongo@v0.32.0/src/error.ts": "8180a822b0831a94a6a28815865b5b40e3996220684bea60fcb81b272ddd06eb", - "https://deno.land/x/mongo@v0.32.0/src/gridfs/bucket.ts": "a4452d63f6928f57486a214a499b54b80b98cc0d13e3d85a6841b34d5ff12a61", - "https://deno.land/x/mongo@v0.32.0/src/gridfs/indexes.ts": "7d302114fb4d81c4a873614a51d11ddb8b471f967179dddb8269c39b3cadf4e3", - "https://deno.land/x/mongo@v0.32.0/src/gridfs/upload.ts": "6a54a21b00c6f22ad0da6ceef7a2932dc600560f594c2551abd8e4a64976abae", - "https://deno.land/x/mongo@v0.32.0/src/protocol/cursor.ts": "c370a28856fa236129cc2d7abf7ebc4ac6cdd60acb93e0e7371433f7332394cb", - "https://deno.land/x/mongo@v0.32.0/src/protocol/handshake.ts": "3c3ba547d5322751b9756ce9a4750f3cf18febee0a64edca5b007634bd80e0fe", - "https://deno.land/x/mongo@v0.32.0/src/protocol/header.ts": "0f28db842f886e57b7013606c1391affab2e2960a1a4568d2502e7b788117716", - "https://deno.land/x/mongo@v0.32.0/src/protocol/message.ts": "7b4e38489070fc6281d1b3f13e99504310f09273baa8bcb11d82b1e30ea04202", - "https://deno.land/x/mongo@v0.32.0/src/protocol/mod.ts": "4e24d563049c0a236234598ca786ca13778dc17fdb80ac543ac6c75d0c5094d7", - "https://deno.land/x/mongo@v0.32.0/src/protocol/protocol.ts": "92568dd86e6ef3f54054113d9f5620f158fc1dfee2a7c9d13623975835d5996a", - "https://deno.land/x/mongo@v0.32.0/src/types.ts": "355c91b0abc0c77aa1f8fd0dcfcbc47505518f561b72d8fefd4a929b12bc7e48", - "https://deno.land/x/mongo@v0.32.0/src/types/geojson.ts": "14690e2fa1591939253ddc9de181b0664051e9462db131b72be5fb9d064dff44", - "https://deno.land/x/mongo@v0.32.0/src/types/geospatial.ts": "c73ee13536365fa5d868b65ab47b3488a5f223a67e1e059761886f750db70ef9", - "https://deno.land/x/mongo@v0.32.0/src/types/gridfs.ts": "e1fd12c3ca58d437267e7a8557d745d23b9d8916d1da34c1847e5e373728dfa0", - "https://deno.land/x/mongo@v0.32.0/src/types/read_write_concern.ts": "d00f35eb85520e776741888685d08d479766a19e9a0a970b53f4594c9db00496", - "https://deno.land/x/mongo@v0.32.0/src/utils/ns.ts": "fb0c57b8dc4d31f8993112d267dec3c163d3e8862198d1cd03b2b51bcc3caad9", - "https://deno.land/x/mongo@v0.32.0/src/utils/saslprep/deps.ts": "95ceb81b353110526dacf2a98854bc79d6e17d7f173af8806e91c05555d7b8c7", - "https://deno.land/x/mongo@v0.32.0/src/utils/saslprep/load_code_points.ts": "f6a4ef2eb2345eac40ffbf1a30661cca803f399865f2a0fadafb71f57d4c97bf", - "https://deno.land/x/mongo@v0.32.0/src/utils/saslprep/memory_pager.ts": "f55a79a13ec569c21630c3915a9af0c6fc0aa2b899121fa2a85a813c6dd4afba", - "https://deno.land/x/mongo@v0.32.0/src/utils/saslprep/mod.ts": "0a8a39a0784d065a79c54ce63d7d7b103d0b94addc5b7bcf985517ba2442c8a1", - "https://deno.land/x/mongo@v0.32.0/src/utils/saslprep/sparse_bitfield.ts": "07d6fe2ecd4ba5f711c44c1ae409bb9c1fe3a3cfc09e27434d231d4aae46dd2d", - "https://deno.land/x/mongo@v0.32.0/src/utils/srv.ts": "ed5f78ffe6480faac68291a87e51e3674eff5f28aec937ee97248e99e1317b16", - "https://deno.land/x/mongo@v0.32.0/src/utils/uri.ts": "dcfab8e1dcfcc875c75ada1d9f366664480c03b65594990d6342ed88925452e5", - "https://deno.land/x/r2d2@v2.0.0/mod.ts": "9dd57845ed23db1a80e8df3ebaec4bd1ff1a39bbf533b4ee2a40f9c895cd662b", - "https://deno.land/x/web_bson@v0.3.0/mod.js": "8e14aecd31ee63abd30e2dbaa284b4b67abb7ba51fcef5b96af74727cb7c7940" - }, - "workspace": { - "dependencies": [ - "jsr:@cross/env@^0.2.7", - "jsr:@cross/test@^0.0.8", - "jsr:@cross/utils@^0.5.0", - "jsr:@denosaurs/event@^2.0.2", - "jsr:@std/assert@^0.219.1", - "jsr:@std/cli@^0.219.1" - ] - } -} diff --git a/packages/bolt/mod.ts b/packages/bolt/mod.ts index 8d528c0..b597448 100644 --- a/packages/bolt/mod.ts +++ b/packages/bolt/mod.ts @@ -1,3 +1,7 @@ +/** + * @module + */ + export { type bridge_document, type bridge_platform } from './bridges/types.ts'; export * from './utils/mod.ts'; export { Bolt } from './bolt.ts'; diff --git a/packages/bolt/utils/_fourbetafive.ts b/packages/bolt/utils/_fourbetafive.ts index 7578ea4..fc87cd3 100644 --- a/packages/bolt/utils/_fourbetafive.ts +++ b/packages/bolt/utils/_fourbetafive.ts @@ -1,38 +1,28 @@ import { Document } from 'mongo'; +type doc = { + _id: string; + value: { + bridges: { platform: string; channel: string; senddata: unknown }[]; + }; +}; + export default { from: '0.4-beta', to: '0.5', from_db: 'bridgev1', to_db: 'bridges', - translate: ( - itemslist: ( - | Document - | { - _id: string; - value: { - bridges: { platform: string; channel: string; senddata: unknown }[]; - }; - } - )[] - ) => - itemslist.flatMap<{ - _id: string; - platforms: { plugin: string; channel: string; senddata: unknown }[]; - }>(({ _id, value }) => { + translate: (itemslist: (doc | Document)[]) => + (itemslist as doc[]).flatMap(({ _id, value }) => { if (_id.startsWith('message-')) return []; return [ { _id, - platforms: value.bridges.map( - (i: { platform: string; channel: string; senddata: unknown }) => { - return { - plugin: map_plugins(i.platform), - channel: i.channel, - senddata: i.senddata - }; - } - ) + platforms: value.bridges.map(({ platform, channel, senddata }) => ({ + plugin: map_plugins(platform), + channel, + senddata + })) } ]; }) as Document[] diff --git a/packages/bolt/utils/_fourfourbeta.ts b/packages/bolt/utils/_fourfourbeta.ts index 390cb4c..9be33d0 100644 --- a/packages/bolt/utils/_fourfourbeta.ts +++ b/packages/bolt/utils/_fourfourbeta.ts @@ -20,9 +20,9 @@ export default { const [platform, ...join] = item._id.split('-'); const name = join.join('-'); if (is_channel(name)) continue; - const _id = items.find(i => { - return i._id.startsWith(platform) && i.value === name; - })?._id; + const _id = items.find( + i => i._id.startsWith(platform) && i.value === name + )?._id; if (!_id) continue; if (!obj[name]) obj[name] = []; obj[name].push({ @@ -32,22 +32,12 @@ export default { }); } - const documents = []; - - for (const _id in obj) { - const value = obj[_id]; - if (!value) continue; - if (is_channel(_id)) continue; - if (value.length < 2) continue; - documents.push({ - _id, - value: { - bridges: value - } - }); - } - - return documents; + return Object.entries(obj) + .filter(([key, value]) => !is_channel(key) && value.length >= 2) + .map(([key, value]) => ({ + _id: key, + value: { bridges: value } + })); } }; diff --git a/packages/bolt/utils/commands.ts b/packages/bolt/utils/commands.ts index 4e6e82a..d8355c1 100644 --- a/packages/bolt/utils/commands.ts +++ b/packages/bolt/utils/commands.ts @@ -3,18 +3,11 @@ import { log_error } from './errors.ts'; import { parseArgs } from 'std_args'; import { create_message, message } from './messages.ts'; -/** a class that provides text-based commands that reply to messages */ export class Commands extends Map { - /** - * create a commands instance using the commands given or the default set - */ constructor(default_cmds: [string, command][] = default_commands) { super(default_cmds); } - /** - * listen for commands on a given bolt instance - */ listen(bolt: Bolt) { bolt.on('create_nonbridged_message', msg => { if (msg.content?.startsWith('!bolt')) { @@ -31,14 +24,12 @@ export class Commands extends Map { }); } }); + bolt.on('create_command', async cmd => { await this.run(cmd); }); } - /** - * attempt to run a command - */ async run(opts: command_arguments) { let reply; try { @@ -67,9 +58,9 @@ const default_commands: [string, command][] = [ name: 'help', description: 'get help', execute: () => - create_message({ - text: 'check out [the docs](https://williamhorning.dev/bolt/) for help.' - }) + create_message( + 'check out [the docs](https://williamhorning.dev/bolt/) for help.' + ) } ], [ @@ -77,10 +68,7 @@ const default_commands: [string, command][] = [ { name: 'version', description: "get bolt's version", - execute: () => - create_message({ - text: 'hello from bolt 0.5.8!' - }) + execute: () => create_message('hello from bolt 0.5.8!') } ], [ @@ -89,11 +77,11 @@ const default_commands: [string, command][] = [ name: 'ping', description: 'pong', execute: ({ timestamp }) => - create_message({ - text: `Pong! 🏓 ${Temporal.Now.instant() + create_message( + `Pong! 🏓 ${Temporal.Now.instant() .since(timestamp) .total('milliseconds')}ms` - }) + ) } ] ]; diff --git a/packages/bolt/utils/config.ts b/packages/bolt/utils/config.ts index ebb1c60..5a3e411 100644 --- a/packages/bolt/utils/config.ts +++ b/packages/bolt/utils/config.ts @@ -2,14 +2,15 @@ import { create_plugin } from './plugins.ts'; /** a function that returns a config object when given a partial config object */ export function define_config(config?: Partial): config { - if (!config) config = {}; - if (!config.prod) config.prod = false; - if (!config.plugins) config.plugins = []; - if (!config.mongo_uri) config.mongo_uri = 'mongodb://localhost:27017'; - if (!config.mongo_database) - config.mongo_database = config.prod ? 'bolt' : 'bolt-testing'; - if (!config.redis_host) config.redis_host = 'localhost'; - return config as config; + return { + ...(config || {}), + prod: false, + plugins: [], + mongo_uri: 'mongodb://localhost:27017', + mongo_database: config?.prod ? 'bolt' : 'bolt-testing', + redis_host: 'localhost', + redis_port: 6379 + }; } export interface config { diff --git a/packages/bolt/utils/errors.ts b/packages/bolt/utils/errors.ts index 6e7d906..c63288f 100644 --- a/packages/bolt/utils/errors.ts +++ b/packages/bolt/utils/errors.ts @@ -13,54 +13,44 @@ export async function log_error( message: message; }> { const uuid = _id(); + const error_hook = getEnv('BOLT_ERROR_HOOK') || ''; - const error_hook = getEnv('BOLT_ERROR_HOOK'); - - if (error_hook && error_hook !== '') { + if (error_hook !== '') { delete extra.msg; await ( await fetch(error_hook, { method: 'POST', headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify( - { - embeds: [ - { - title: e.message, - description: `\`\`\`${ - e.stack - }\`\`\`\n\`\`\`js\n${JSON.stringify( - { - ...extra, - uuid - }, - replacer(), - 2 - )}\`\`\`` - } - ] - }, - replacer() - ) + body: JSON.stringify({ + embeds: [ + { + title: e.message, + description: `\`\`\`js\n${e.stack}\n${JSON.stringify( + { ...extra, uuid }, + r(), + 2 + )}\`\`\`` + } + ] + }) }) ).text(); } - console.error(`\x1b[1;31mBolt Error - '${uuid}'\x1b[0m`); - console.error(e, extra); + console.error(`%cBolt Error ${uuid}`, 'color: red', e, extra); return { e, uuid, extra, - message: create_message({ - text: `Something went wrong! Check [the docs](https://williamhorning.dev/bolt/docs/Using/) for help.\n\`\`\`\n${e.message}\n${uuid}\n\`\`\`` - }) + message: create_message( + `Something went wrong! [Look here](https://williamhorning.dev/bolt) for help.\n\`\`\`\n${e.message}\n${uuid}\n\`\`\`` + ) }; } -function replacer() { +function r() { const seen = new WeakSet(); return (_: string, value: unknown) => { if (typeof value === 'object' && value !== null) { diff --git a/packages/bolt/utils/messages.ts b/packages/bolt/utils/messages.ts index 759409b..b749707 100644 --- a/packages/bolt/utils/messages.ts +++ b/packages/bolt/utils/messages.ts @@ -1,9 +1,5 @@ /** creates a message given text and an optional uuid */ -export function create_message({ - text -}: { - text?: string; -}): message { +export function create_message(text: string): message { const data = { author: { username: 'Bolt', diff --git a/packages/bolt/utils/migrations.ts b/packages/bolt/utils/migrations.ts index 9f17f9d..10a7cd7 100644 --- a/packages/bolt/utils/migrations.ts +++ b/packages/bolt/utils/migrations.ts @@ -15,7 +15,7 @@ export enum versions { } /** get migrations that can then be applied */ -export function get_migrations(from: string, to: string): migration[] { +export function get_migrations(from: versions, to: versions): migration[] { const indexoffrom = migrations.findIndex(i => i.from === from); const indexofto = migrations.findLastIndex(i => i.to === to); return migrations.slice(indexoffrom, indexofto); From ee0f544a0b72146ca22f07523e512e3aec0f823f Mon Sep 17 00:00:00 2001 From: Jersey Date: Sun, 17 Mar 2024 13:54:43 -0400 Subject: [PATCH 04/13] fix editing for real Signed-off-by: Jersey --- packages/bolt/bolt.ts | 5 +- packages/bolt/bridges/mod.ts | 10 +- packages/bolt/cli.ts | 16 +- packages/bolt/deno.lock | 587 ++++++++++++++++++++++++++++++++++ packages/bolt/utils/config.ts | 4 +- 5 files changed, 603 insertions(+), 19 deletions(-) create mode 100644 packages/bolt/deno.lock diff --git a/packages/bolt/bolt.ts b/packages/bolt/bolt.ts index 5e86dbb..8806543 100644 --- a/packages/bolt/bolt.ts +++ b/packages/bolt/bolt.ts @@ -27,11 +27,8 @@ export class Bolt extends EventEmitter { this.db = { mongo }; this.redis = new RedisClient(redis_conn); this.bridge = new bolt_bridges(this); - } - - async setup() { this.cmds.listen(this); - await this.load(this.config.plugins); + this.load(this.config.plugins); } async load(plugins: { type: create_plugin; config: unknown }[]) { diff --git a/packages/bolt/bridges/mod.ts b/packages/bolt/bridges/mod.ts index d231cd0..f8dee9b 100644 --- a/packages/bolt/bridges/mod.ts +++ b/packages/bolt/bridges/mod.ts @@ -39,7 +39,7 @@ export class bolt_bridges { `bolt-bridge-${id}` ]); if (!rdata) return [] as bridge_platform[]; - return rdata as bridge_platform[]; + return JSON.parse(rdata as string) as bridge_platform[]; } is_bridged(msg: deleted_message): boolean { @@ -120,19 +120,19 @@ export class bolt_bridges { } for (const i of data) { - await this.bolt.redis.writeCommand([ + await this.bolt.redis.sendCommand([ 'JSON.SET', `bolt-bridge-${i.id}`, '$', - `'${JSON.stringify(data)}'` + JSON.stringify(data) ]); } - await this.bolt.redis.writeCommand([ + await this.bolt.redis.sendCommand([ 'JSON.SET', `bolt-bridge-${msg.id}`, '$', - `'${JSON.stringify(data)}'` + JSON.stringify(data) ]); } diff --git a/packages/bolt/cli.ts b/packages/bolt/cli.ts index 6ad154c..fe09e60 100644 --- a/packages/bolt/cli.ts +++ b/packages/bolt/cli.ts @@ -21,7 +21,7 @@ const f = parseArgs(args(), { }); if (f.version) { - console.log('0.5.8'); + log('0.5.8'); exit(); } @@ -49,19 +49,19 @@ try { const mongo = new MongoClient(); await mongo.connect(cfg.mongo_uri); + const redis = await Deno.connect({ + hostname: cfg.redis_host, + port: cfg.redis_port || 6379 + }); + if (f.run) { - const redis = await Deno.connect({ - hostname: cfg.redis_host, - port: cfg.redis_port || 6379 - }); - const bolt = new Bolt(cfg, mongo, redis); - await bolt.setup(); + new Bolt(cfg, mongo, redis); } else if (f.migrations) { await migrations(cfg, mongo); } } catch (e) { log('Something went wrong, exiting...', 'red', 'error'); - console.error(e); + log(e, 'red', 'error'); exit(1); } diff --git a/packages/bolt/deno.lock b/packages/bolt/deno.lock new file mode 100644 index 0000000..b3a321c --- /dev/null +++ b/packages/bolt/deno.lock @@ -0,0 +1,587 @@ +{ + "version": "3", + "packages": { + "specifiers": { + "jsr:@cross/deepmerge@^0.2.0": "jsr:@cross/deepmerge@0.2.1", + "jsr:@cross/env@^0.2.7": "jsr:@cross/env@0.2.7", + "jsr:@cross/runtime@^0.0.17": "jsr:@cross/runtime@0.0.17", + "jsr:@cross/utils@^0.5.0": "jsr:@cross/utils@0.5.0", + "jsr:@denosaurs/event@^2.0.2": "jsr:@denosaurs/event@2.0.2", + "jsr:@std/assert@^0.219.1": "jsr:@std/assert@0.219.1", + "jsr:@std/cli@^0.219.1": "jsr:@std/cli@0.219.1", + "npm:@discordjs/core@1.1.1": "npm:@discordjs/core@1.1.1", + "npm:@discordjs/rest@2.2.0": "npm:@discordjs/rest@2.2.0", + "npm:@discordjs/ws@1.0.2": "npm:@discordjs/ws@1.0.2", + "npm:@williamhorning/revolt.js@7.0.0-beta.10": "npm:@williamhorning/revolt.js@7.0.0-beta.10_solid-js@1.8.15__seroval@1.0.4", + "npm:guilded-api-typings@0.13.2": "npm:guilded-api-typings@0.13.2", + "npm:guilded.js@0.23.7": "npm:guilded.js@0.23.7" + }, + "jsr": { + "@cross/deepmerge@0.2.1": { + "integrity": "c547bef63d95e478e48810fbfe9a5cd549c0dd3582d5a307b39cf253404cf2ba" + }, + "@cross/env@0.2.7": { + "integrity": "80a24c263dfb0a84d38c01ed30c97b8e905b524be32e586f13718877a1a2f6fa", + "dependencies": [ + "jsr:@cross/deepmerge@^0.2.0", + "jsr:@cross/runtime@^0.0.17" + ] + }, + "@cross/runtime@0.0.17": { + "integrity": "23e08c6825fc2c81fb4e341d8c51731154039d19cfc44e60de4cf9ce23e36004" + }, + "@cross/utils@0.5.0": { + "integrity": "4b6c02e79f3cd6d7c90aff1d08f589ee74e04ab6e16ba7b1cd21ea7e6054a94b", + "dependencies": [ + "jsr:@cross/runtime@^0.0.17" + ] + }, + "@denosaurs/event@2.0.2": { + "integrity": "3310ba1a9e94dd60ccb09c6084fc818cc1cd50e543c56ef0c6199f1b89073392" + }, + "@std/assert@0.219.1": { + "integrity": "e76c2a1799a78f0f4db7de04bdc9b908a7a4b821bb65eda0285885297d4fb8af" + }, + "@std/cli@0.219.1": { + "integrity": "715a9926b58b89ef8a3c91e91633ac5f8176e0f02f6b3a16f0a67309e41a2911", + "dependencies": [ + "jsr:@std/assert@^0.219.1" + ] + } + }, + "npm": { + "@discordjs/collection@1.5.3": { + "integrity": "sha512-SVb428OMd3WO1paV3rm6tSjM4wC+Kecaa1EUGX7vc6/fddvw/6lg90z4QtCqm21zvVe92vMMDt9+DkIvjXImQQ==", + "dependencies": {} + }, + "@discordjs/collection@2.0.0": { + "integrity": "sha512-YTWIXLrf5FsrLMycpMM9Q6vnZoR/lN2AWX23/Cuo8uOOtS8eHB2dyQaaGnaF8aZPYnttf2bkLMcXn/j6JUOi3w==", + "dependencies": {} + }, + "@discordjs/core@1.1.1": { + "integrity": "sha512-3tDqc6KCAtE0CxNl5300uPzFnNsY/GAmJhc6oGutbl/la+4mRv5zVb4N68cmcaeD2Il/ySH4zIc00sq+cyhtUA==", + "dependencies": { + "@discordjs/rest": "@discordjs/rest@2.2.0", + "@discordjs/util": "@discordjs/util@1.0.2", + "@discordjs/ws": "@discordjs/ws@1.0.2", + "@sapphire/snowflake": "@sapphire/snowflake@3.5.3", + "@vladfrangu/async_event_emitter": "@vladfrangu/async_event_emitter@2.2.4", + "discord-api-types": "discord-api-types@0.37.61" + } + }, + "@discordjs/rest@2.2.0": { + "integrity": "sha512-nXm9wT8oqrYFRMEqTXQx9DUTeEtXUDMmnUKIhZn6O2EeDY9VCdwj23XCPq7fkqMPKdF7ldAfeVKyxxFdbZl59A==", + "dependencies": { + "@discordjs/collection": "@discordjs/collection@2.0.0", + "@discordjs/util": "@discordjs/util@1.0.2", + "@sapphire/async-queue": "@sapphire/async-queue@1.5.2", + "@sapphire/snowflake": "@sapphire/snowflake@3.5.3", + "@vladfrangu/async_event_emitter": "@vladfrangu/async_event_emitter@2.2.4", + "discord-api-types": "discord-api-types@0.37.61", + "magic-bytes.js": "magic-bytes.js@1.10.0", + "tslib": "tslib@2.6.2", + "undici": "undici@5.27.2" + } + }, + "@discordjs/util@1.0.2": { + "integrity": "sha512-IRNbimrmfb75GMNEjyznqM1tkI7HrZOf14njX7tCAAUetyZM1Pr8hX/EK2lxBCOgWDRmigbp24fD1hdMfQK5lw==", + "dependencies": {} + }, + "@discordjs/ws@1.0.2": { + "integrity": "sha512-+XI82Rm2hKnFwAySXEep4A7Kfoowt6weO6381jgW+wVdTpMS/56qCvoXyFRY0slcv7c/U8My2PwIB2/wEaAh7Q==", + "dependencies": { + "@discordjs/collection": "@discordjs/collection@2.0.0", + "@discordjs/rest": "@discordjs/rest@2.2.0", + "@discordjs/util": "@discordjs/util@1.0.2", + "@sapphire/async-queue": "@sapphire/async-queue@1.5.2", + "@types/ws": "@types/ws@8.5.10", + "@vladfrangu/async_event_emitter": "@vladfrangu/async_event_emitter@2.2.4", + "discord-api-types": "discord-api-types@0.37.61", + "tslib": "tslib@2.6.2", + "ws": "ws@8.16.0" + } + }, + "@fastify/busboy@2.1.1": { + "integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==", + "dependencies": {} + }, + "@guildedjs/api@0.3.2": { + "integrity": "sha512-Tn2DUQm2sPJn1jKLe+GGw1uwL837WCgtNAj5WjIMnM6zHaEoFgIWXM2uMZQ5GTWsC1ZTUu8XiCniGv7YvItv3Q==", + "dependencies": { + "@types/ws": "@types/ws@8.5.4", + "form-data": "form-data@4.0.0", + "node-fetch": "node-fetch@2.6.11", + "qs": "qs@6.11.2", + "typed-emitter": "typed-emitter@2.1.0", + "ws": "ws@8.13.0" + } + }, + "@insertish/oapi@0.1.18": { + "integrity": "sha512-LZLUk3WmzUjCM0quensexvQx/Kk1MpFBtCLJRnRrPOiaFT37JpOmWUFlrdu0sPS6B9wi2edEBeLcsnIiq85WMA==", + "dependencies": { + "axios": "axios@0.26.1", + "openapi-typescript": "openapi-typescript@5.4.1", + "typescript": "typescript@4.9.5" + } + }, + "@sapphire/async-queue@1.5.2": { + "integrity": "sha512-7X7FFAA4DngXUl95+hYbUF19bp1LGiffjJtu7ygrZrbdCSsdDDBaSjB7Akw0ZbOu6k0xpXyljnJ6/RZUvLfRdg==", + "dependencies": {} + }, + "@sapphire/snowflake@3.5.3": { + "integrity": "sha512-jjmJywLAFoWeBi1W7994zZyiNWPIiqRRNAmSERxyg93xRGzNYvGjlZ0gR6x0F4gPRi2+0O6S71kOZYyr3cxaIQ==", + "dependencies": {} + }, + "@solid-primitives/map@0.4.10_solid-js@1.8.15__seroval@1.0.4": { + "integrity": "sha512-Y4aTvQN1DjMmTQeNS3H1Fc+fVVPVslYGAOxD8gIMgQtHn+yLd4Zc4pm/x0m/lsy7NnEi0nskz4G7vbEd9M5sOA==", + "dependencies": { + "@solid-primitives/trigger": "@solid-primitives/trigger@1.0.10_solid-js@1.8.15__seroval@1.0.4", + "solid-js": "solid-js@1.8.15_seroval@1.0.4" + } + }, + "@solid-primitives/set@0.4.10_solid-js@1.8.15__seroval@1.0.4": { + "integrity": "sha512-YAoKFKfpHCjnZQV/TnzH01cSXRpDJS4gpuwGpLiiJvCt7rhAMImLMJj+nTt5WWE6DtolWuup4kLloO9tS/vE/g==", + "dependencies": { + "@solid-primitives/trigger": "@solid-primitives/trigger@1.0.10_solid-js@1.8.15__seroval@1.0.4", + "solid-js": "solid-js@1.8.15_seroval@1.0.4" + } + }, + "@solid-primitives/trigger@1.0.10_solid-js@1.8.15__seroval@1.0.4": { + "integrity": "sha512-gPNhmIBMxaJm2gWAAqUkpF5Vk6yZgaJ9+MFQN5eIRQ//GPIUqkNtSSar5sU+iG2I5QmS4iU7gOnvv3XvxXI1fg==", + "dependencies": { + "@solid-primitives/utils": "@solid-primitives/utils@6.2.3_solid-js@1.8.15__seroval@1.0.4", + "solid-js": "solid-js@1.8.15_seroval@1.0.4" + } + }, + "@solid-primitives/utils@6.2.3_solid-js@1.8.15__seroval@1.0.4": { + "integrity": "sha512-CqAwKb2T5Vi72+rhebSsqNZ9o67buYRdEJrIFzRXz3U59QqezuuxPsyzTSVCacwS5Pf109VRsgCJQoxKRoECZQ==", + "dependencies": { + "solid-js": "solid-js@1.8.15_seroval@1.0.4" + } + }, + "@types/node@18.16.19": { + "integrity": "sha512-IXl7o+R9iti9eBW4Wg2hx1xQDig183jj7YLn8F7udNceyfkbn1ZxmzZXuak20gR40D7pIkIY1kYGx5VIGbaHKA==", + "dependencies": {} + }, + "@types/ws@8.5.10": { + "integrity": "sha512-vmQSUcfalpIq0R9q7uTo2lXs6eGIpt9wtnLdMv9LVpIjCA/+ufZRozlVoVelIYixx1ugCBKDhn89vnsEGOCx9A==", + "dependencies": { + "@types/node": "@types/node@18.16.19" + } + }, + "@types/ws@8.5.4": { + "integrity": "sha512-zdQDHKUgcX/zBc4GrwsE/7dVdAD8JR4EuiAXiiUhhfyIJXXb2+PrGshFyeXWQPMmmZ2XxgaqclgpIC7eTXc1mg==", + "dependencies": { + "@types/node": "@types/node@18.16.19" + } + }, + "@vladfrangu/async_event_emitter@2.2.4": { + "integrity": "sha512-ButUPz9E9cXMLgvAW8aLAKKJJsPu1dY1/l/E8xzLFuysowXygs6GBcyunK9rnGC4zTsnIc2mQo71rGw9U+Ykug==", + "dependencies": {} + }, + "@williamhorning/revolt.js@7.0.0-beta.10_solid-js@1.8.15__seroval@1.0.4": { + "integrity": "sha512-w9rw5Z3HiHzwq3+QOxzceljzQAA1DUNg8lV+ClZw8CvkajLEIUn6C+9v8aEzSEz9ABaZCDA46KnrIPZN3l72Xw==", + "dependencies": { + "@solid-primitives/map": "@solid-primitives/map@0.4.10_solid-js@1.8.15__seroval@1.0.4", + "@solid-primitives/set": "@solid-primitives/set@0.4.10_solid-js@1.8.15__seroval@1.0.4", + "long": "long@5.2.3", + "revolt-api": "revolt-api@0.6.5", + "solid-js": "solid-js@1.8.15_seroval@1.0.4", + "ulid": "ulid@2.3.0", + "ws": "ws@8.16.0" + } + }, + "argparse@2.0.1": { + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dependencies": {} + }, + "asynckit@0.4.0": { + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", + "dependencies": {} + }, + "axios@0.26.1": { + "integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==", + "dependencies": { + "follow-redirects": "follow-redirects@1.15.5" + } + }, + "call-bind@1.0.7": { + "integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==", + "dependencies": { + "es-define-property": "es-define-property@1.0.0", + "es-errors": "es-errors@1.3.0", + "function-bind": "function-bind@1.1.2", + "get-intrinsic": "get-intrinsic@1.2.4", + "set-function-length": "set-function-length@1.2.1" + } + }, + "combined-stream@1.0.8": { + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dependencies": { + "delayed-stream": "delayed-stream@1.0.0" + } + }, + "csstype@3.1.3": { + "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==", + "dependencies": {} + }, + "define-data-property@1.1.4": { + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "dependencies": { + "es-define-property": "es-define-property@1.0.0", + "es-errors": "es-errors@1.3.0", + "gopd": "gopd@1.0.1" + } + }, + "delayed-stream@1.0.0": { + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "dependencies": {} + }, + "discord-api-types@0.37.61": { + "integrity": "sha512-o/dXNFfhBpYHpQFdT6FWzeO7pKc838QeeZ9d91CfVAtpr5XLK4B/zYxQbYgPdoMiTDvJfzcsLW5naXgmHGDNXw==", + "dependencies": {} + }, + "es-define-property@1.0.0": { + "integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==", + "dependencies": { + "get-intrinsic": "get-intrinsic@1.2.4" + } + }, + "es-errors@1.3.0": { + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "dependencies": {} + }, + "follow-redirects@1.15.5": { + "integrity": "sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw==", + "dependencies": {} + }, + "form-data@4.0.0": { + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "dependencies": { + "asynckit": "asynckit@0.4.0", + "combined-stream": "combined-stream@1.0.8", + "mime-types": "mime-types@2.1.35" + } + }, + "function-bind@1.1.2": { + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dependencies": {} + }, + "get-intrinsic@1.2.4": { + "integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==", + "dependencies": { + "es-errors": "es-errors@1.3.0", + "function-bind": "function-bind@1.1.2", + "has-proto": "has-proto@1.0.3", + "has-symbols": "has-symbols@1.0.3", + "hasown": "hasown@2.0.1" + } + }, + "globalyzer@0.1.0": { + "integrity": "sha512-40oNTM9UfG6aBmuKxk/giHn5nQ8RVz/SS4Ir6zgzOv9/qC3kKZ9v4etGTcJbEl/NyVQH7FGU7d+X1egr57Md2Q==", + "dependencies": {} + }, + "globrex@0.1.2": { + "integrity": "sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==", + "dependencies": {} + }, + "gopd@1.0.1": { + "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "dependencies": { + "get-intrinsic": "get-intrinsic@1.2.4" + } + }, + "guilded-api-typings@0.13.2": { + "integrity": "sha512-Fleko3u0WbYis/WyZoD/x6ZaqXiI4IYvVou+tLqHHLNWZGPvnNErEffxTb7q4QBzi4oX8KkKLAeMsmqpsnz5ew==", + "dependencies": {} + }, + "guilded.js@0.23.7": { + "integrity": "sha512-W7UkWqZhaIEtJmbe7cMXwTIuWlJ++vbOIluCQOfjayzScJx8o1KVmn3niAvONN/tJV/zNBJ5+pyXzMC8bhuEyQ==", + "dependencies": { + "@discordjs/collection": "@discordjs/collection@1.5.3", + "@guildedjs/api": "@guildedjs/api@0.3.2", + "typed-emitter": "typed-emitter@2.1.0" + } + }, + "has-property-descriptors@1.0.2": { + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "dependencies": { + "es-define-property": "es-define-property@1.0.0" + } + }, + "has-proto@1.0.3": { + "integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==", + "dependencies": {} + }, + "has-symbols@1.0.3": { + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "dependencies": {} + }, + "hasown@2.0.1": { + "integrity": "sha512-1/th4MHjnwncwXsIW6QMzlvYL9kG5e/CpVvLRZe4XPa8TOUNbCELqmvhDmnkNsAjwaG4+I8gJJL0JBvTTLO9qA==", + "dependencies": { + "function-bind": "function-bind@1.1.2" + } + }, + "js-yaml@4.1.0": { + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dependencies": { + "argparse": "argparse@2.0.1" + } + }, + "lodash.defaultsdeep@4.6.1": { + "integrity": "sha512-3j8wdDzYuWO3lM3Reg03MuQR957t287Rpcxp1njpEa8oDrikb+FwGdW3n+FELh/A6qib6yPit0j/pv9G/yeAqA==", + "dependencies": {} + }, + "long@5.2.3": { + "integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==", + "dependencies": {} + }, + "magic-bytes.js@1.10.0": { + "integrity": "sha512-/k20Lg2q8LE5xiaaSkMXk4sfvI+9EGEykFS4b0CHHGWqDYU0bGUFSwchNOMA56D7TCs9GwVTkqe9als1/ns8UQ==", + "dependencies": {} + }, + "mime-db@1.52.0": { + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "dependencies": {} + }, + "mime-types@2.1.35": { + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dependencies": { + "mime-db": "mime-db@1.52.0" + } + }, + "mime@3.0.0": { + "integrity": "sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==", + "dependencies": {} + }, + "node-fetch@2.6.11": { + "integrity": "sha512-4I6pdBY1EthSqDmJkiNk3JIT8cswwR9nfeW/cPdUagJYEQG7R95WRH74wpz7ma8Gh/9dI9FP+OU+0E4FvtA55w==", + "dependencies": { + "whatwg-url": "whatwg-url@5.0.0" + } + }, + "object-inspect@1.13.1": { + "integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==", + "dependencies": {} + }, + "openapi-typescript@5.4.1": { + "integrity": "sha512-AGB2QiZPz4rE7zIwV3dRHtoUC/CWHhUjuzGXvtmMQN2AFV8xCTLKcZUHLcdPQmt/83i22nRE7+TxXOXkK+gf4Q==", + "dependencies": { + "js-yaml": "js-yaml@4.1.0", + "mime": "mime@3.0.0", + "prettier": "prettier@2.8.8", + "tiny-glob": "tiny-glob@0.2.9", + "undici": "undici@5.27.2", + "yargs-parser": "yargs-parser@21.1.1" + } + }, + "prettier@2.8.8": { + "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", + "dependencies": {} + }, + "qs@6.11.2": { + "integrity": "sha512-tDNIz22aBzCDxLtVH++VnTfzxlfeK5CbqohpSqpJgj1Wg/cQbStNAz3NuqCs5vV+pjBsK4x4pN9HlVh7rcYRiA==", + "dependencies": { + "side-channel": "side-channel@1.0.5" + } + }, + "revolt-api@0.6.5": { + "integrity": "sha512-1PNcc6DvWplwt4v9unEKKVVqa/X2gE0yT0RgPR8pM5uerpzPKDhikrbr5zudqnoBQ1t+92rKKDdMMAeBWH0mUA==", + "dependencies": { + "@insertish/oapi": "@insertish/oapi@0.1.18", + "axios": "axios@0.26.1", + "lodash.defaultsdeep": "lodash.defaultsdeep@4.6.1" + } + }, + "rxjs@7.8.1": { + "integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==", + "dependencies": { + "tslib": "tslib@2.6.2" + } + }, + "seroval-plugins@1.0.4_seroval@1.0.4": { + "integrity": "sha512-DQ2IK6oQVvy8k+c2V5x5YCtUa/GGGsUwUBNN9UqohrZ0rWdUapBFpNMYP1bCyRHoxOJjdKGl+dieacFIpU/i1A==", + "dependencies": { + "seroval": "seroval@1.0.4" + } + }, + "seroval@1.0.4": { + "integrity": "sha512-qQs/N+KfJu83rmszFQaTxcoJoPn6KNUruX4KmnmyD0oZkUoiNvJ1rpdYKDf4YHM05k+HOgCxa3yvf15QbVijGg==", + "dependencies": {} + }, + "set-function-length@1.2.1": { + "integrity": "sha512-j4t6ccc+VsKwYHso+kElc5neZpjtq9EnRICFZtWyBsLojhmeF/ZBd/elqm22WJh/BziDe/SBiOeAt0m2mfLD0g==", + "dependencies": { + "define-data-property": "define-data-property@1.1.4", + "es-errors": "es-errors@1.3.0", + "function-bind": "function-bind@1.1.2", + "get-intrinsic": "get-intrinsic@1.2.4", + "gopd": "gopd@1.0.1", + "has-property-descriptors": "has-property-descriptors@1.0.2" + } + }, + "side-channel@1.0.5": { + "integrity": "sha512-QcgiIWV4WV7qWExbN5llt6frQB/lBven9pqliLXfGPB+K9ZYXxDozp0wLkHS24kWCm+6YXH/f0HhnObZnZOBnQ==", + "dependencies": { + "call-bind": "call-bind@1.0.7", + "es-errors": "es-errors@1.3.0", + "get-intrinsic": "get-intrinsic@1.2.4", + "object-inspect": "object-inspect@1.13.1" + } + }, + "solid-js@1.8.15_seroval@1.0.4": { + "integrity": "sha512-d0QP/efr3UVcwGgWVPveQQ0IHOH6iU7yUhc2piy8arNG8wxKmvUy1kFxyF8owpmfCWGB87usDKMaVnsNYZm+Vw==", + "dependencies": { + "csstype": "csstype@3.1.3", + "seroval": "seroval@1.0.4", + "seroval-plugins": "seroval-plugins@1.0.4_seroval@1.0.4" + } + }, + "tiny-glob@0.2.9": { + "integrity": "sha512-g/55ssRPUjShh+xkfx9UPDXqhckHEsHr4Vd9zX55oSdGZc/MD0m3sferOkwWtp98bv+kcVfEHtRJgBVJzelrzg==", + "dependencies": { + "globalyzer": "globalyzer@0.1.0", + "globrex": "globrex@0.1.2" + } + }, + "tr46@0.0.3": { + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", + "dependencies": {} + }, + "tslib@2.6.2": { + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", + "dependencies": {} + }, + "typed-emitter@2.1.0": { + "integrity": "sha512-g/KzbYKbH5C2vPkaXGu8DJlHrGKHLsM25Zg9WuC9pMGfuvT+X25tZQWo5fK1BjBm8+UrVE9LDCvaY0CQk+fXDA==", + "dependencies": { + "rxjs": "rxjs@7.8.1" + } + }, + "typescript@4.9.5": { + "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", + "dependencies": {} + }, + "ulid@2.3.0": { + "integrity": "sha512-keqHubrlpvT6G2wH0OEfSW4mquYRcbe/J8NMmveoQOjUqmo+hXtO+ORCpWhdbZ7k72UtY61BL7haGxW6enBnjw==", + "dependencies": {} + }, + "undici@5.27.2": { + "integrity": "sha512-iS857PdOEy/y3wlM3yRp+6SNQQ6xU0mmZcwRSriqk+et/cwWAtwmIGf6WkoDN2EK/AMdCO/dfXzIwi+rFMrjjQ==", + "dependencies": { + "@fastify/busboy": "@fastify/busboy@2.1.1" + } + }, + "webidl-conversions@3.0.1": { + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", + "dependencies": {} + }, + "whatwg-url@5.0.0": { + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dependencies": { + "tr46": "tr46@0.0.3", + "webidl-conversions": "webidl-conversions@3.0.1" + } + }, + "ws@8.13.0": { + "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", + "dependencies": {} + }, + "ws@8.16.0": { + "integrity": "sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ==", + "dependencies": {} + }, + "yargs-parser@21.1.1": { + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dependencies": {} + } + } + }, + "remote": { + "https://deno.land/std@0.154.0/_util/assert.ts": "e94f2eb37cebd7f199952e242c77654e43333c1ac4c5c700e929ea3aa5489f74", + "https://deno.land/std@0.154.0/_wasm_crypto/lib/deno_std_wasm_crypto.generated.mjs": "dfcd6777d05345362c70f9f2c49abba3ed3f925fccfcf725abe2d16d51819433", + "https://deno.land/std@0.154.0/_wasm_crypto/mod.ts": "6c60d332716147ded0eece0861780678d51b560f533b27db2e15c64a4ef83665", + "https://deno.land/std@0.154.0/async/deferred.ts": "c01de44b9192359cebd3fe93273fcebf9e95110bf3360023917da9a2d1489fae", + "https://deno.land/std@0.154.0/bytes/bytes_list.ts": "aba5e2369e77d426b10af1de0dcc4531acecec27f9b9056f4f7bfbf8ac147ab4", + "https://deno.land/std@0.154.0/bytes/equals.ts": "3c3558c3ae85526f84510aa2b48ab2ad7bdd899e2e0f5b7a8ffc85acb3a6043a", + "https://deno.land/std@0.154.0/bytes/mod.ts": "763f97d33051cc3f28af1a688dfe2830841192a9fea0cbaa55f927b49d49d0bf", + "https://deno.land/std@0.154.0/crypto/_fnv/fnv32.ts": "aa9bddead8c6345087d3abd4ef35fb9655622afc333fc41fff382b36e64280b5", + "https://deno.land/std@0.154.0/crypto/_fnv/fnv64.ts": "625d7e7505b6cb2e9801b5fd6ed0a89256bac12b2bbb3e4664b85a88b0ec5bef", + "https://deno.land/std@0.154.0/crypto/_fnv/index.ts": "a8f6a361b4c6d54e5e89c16098f99b6962a1dd6ad1307dbc97fa1ecac5d7060a", + "https://deno.land/std@0.154.0/crypto/_fnv/util.ts": "4848313bed7f00f55be3cb080aa0583fc007812ba965b03e4009665bde614ce3", + "https://deno.land/std@0.154.0/crypto/keystack.ts": "e481eed28007395e554a435e880fee83a5c73b9259ed8a135a75e4b1e4f381f7", + "https://deno.land/std@0.154.0/crypto/mod.ts": "0ef11f063cd0f9759485a3c9051e15125e1bde3b47c23b47e79b6e13cfcf9481", + "https://deno.land/std@0.154.0/crypto/timing_safe_equal.ts": "82a29b737bc8932d75d7a20c404136089d5d23629e94ba14efa98a8cc066c73e", + "https://deno.land/std@0.154.0/encoding/base64.ts": "c57868ca7fa2fbe919f57f88a623ad34e3d970d675bdc1ff3a9d02bba7409db2", + "https://deno.land/std@0.154.0/encoding/base64url.ts": "a5f82a9fa703bd85a5eb8e7c1296bc6529e601ebd9642cc2b5eaa6b38fa9e05a", + "https://deno.land/std@0.154.0/encoding/hex.ts": "4cc5324417cbb4ac9b828453d35aed45b9cc29506fad658f1f138d981ae33795", + "https://deno.land/std@0.154.0/fmt/colors.ts": "ff7dc9c9f33a72bd48bc24b21bbc1b4545d8494a431f17894dbc5fe92a938fc4", + "https://deno.land/std@0.154.0/io/buffer.ts": "fae02290f52301c4e0188670e730cd902f9307fb732d79c4aa14ebdc82497289", + "https://deno.land/std@0.154.0/io/files.ts": "d199ef64e918a256320ba8d8d44ae91de87c9077df8f8d6cca013f1b9fbbe285", + "https://deno.land/std@0.154.0/io/mod.ts": "33507cf2460ab67d0d90fb5749fa6fecb33897642b49d54a6bb1ac81e4768f69", + "https://deno.land/std@0.154.0/io/readers.ts": "45847ad404afd2f605eae1cff193f223462bc55eeb9ae313c2f3db28aada0fd6", + "https://deno.land/std@0.154.0/io/streams.ts": "988a19155b52161f0035ce539e2f1d12edbc4c389fa7633da832a64e6edbe1a0", + "https://deno.land/std@0.154.0/io/util.ts": "078da53bba767bec0d45f7da44411f6dbf269e51ef7fcfea5e3714e04681c674", + "https://deno.land/std@0.154.0/io/writers.ts": "2e1c63ffd0cfba411b1fd8374609abff9ea86187c9d4d885d42e6fc20325ef0e", + "https://deno.land/std@0.154.0/streams/conversion.ts": "fc4eb76a14148c43f0b85e903a5a1526391aa40ed9434dc21e34f88304eb823e", + "https://deno.land/std@0.154.0/testing/_diff.ts": "141f978a283defc367eeee3ff7b58aa8763cf7c8e0c585132eae614468e9d7b8", + "https://deno.land/std@0.154.0/testing/_format.ts": "cd11136e1797791045e639e9f0f4640d5b4166148796cad37e6ef75f7d7f3832", + "https://deno.land/std@0.154.0/testing/asserts.ts": "ac295f7fd22a7af107580e2475402a8c386cb1bf18bf837ae266ac0665786026", + "https://deno.land/std@0.203.0/bytes/bytes_list.ts": "ecf5098c230b793970f43c06e8f30d70b937c031658365aeb3de9a8ae4d406a3", + "https://deno.land/std@0.203.0/bytes/concat.ts": "d26d6f3d7922e6d663dacfcd357563b7bf4a380ce5b9c2bbe0c8586662f25ce2", + "https://deno.land/std@0.203.0/collections/chunk.ts": "f82c52a82ad9338018570c42f6de0fb132fcb14914c31a444e360ac104d7b55b", + "https://deno.land/std@0.203.0/io/read_delim.ts": "8ea988eac1503c7118bfcf00b4e4a422450548af8e18328f6f599553cfe78012", + "https://deno.land/std@0.203.0/streams/write_all.ts": "4cdd36256f892fe7aead46338054f6ea813a63765e87bda4c60e8c5a57d1c5c1", + "https://deno.land/x/mongo@v0.32.0/deps.ts": "1b53a32fbc115195d74ab78e7d21026ea4b6590e5b558b388017cc1a9b8181e6", + "https://deno.land/x/mongo@v0.32.0/mod.ts": "0989f34d08c40440b8786140abdaf863e964e23df5d1a80e661d3d4170d9d21e", + "https://deno.land/x/mongo@v0.32.0/src/auth/base.ts": "7fe14cf0a63d6bbc4ba69a000a04b3b184d26842504d94652a6af2d0c9494944", + "https://deno.land/x/mongo@v0.32.0/src/auth/mod.ts": "b161611bd5be9e9d1b4497227c8ea93ad4daadcd98038c9e5a707bc5da7a25ca", + "https://deno.land/x/mongo@v0.32.0/src/auth/pbkdf2.ts": "1f1db192fd37869d118ab34780b64567ebcf0ad83a03ef28b3d740cae9adb47a", + "https://deno.land/x/mongo@v0.32.0/src/auth/scram.ts": "187db02e94e7e5423ec902e87d6839028770dca57830dca7f154dcd22a959c0f", + "https://deno.land/x/mongo@v0.32.0/src/auth/x509.ts": "a75b27c549707dd441434ae400a3e6a24da7fe7d4e0e80c9bb79dfc6426b651e", + "https://deno.land/x/mongo@v0.32.0/src/client.ts": "368cac10b3df3bfbc2dfba468d1bbd1332c359a643e0bb81a13d7220a58b43ff", + "https://deno.land/x/mongo@v0.32.0/src/cluster.ts": "cff69bf284a5c7fcaff231494f1ab56ca652e725e58622723e402fbb61448d0e", + "https://deno.land/x/mongo@v0.32.0/src/collection/collection.ts": "6748479b4e9992f9f2ce8e22f891f8917349c1a0e53cb89da5a66cf2b44b9016", + "https://deno.land/x/mongo@v0.32.0/src/collection/commands/aggregate.ts": "440906a670adb46edb36fd95573ffa83f192775108b621520be992165910e895", + "https://deno.land/x/mongo@v0.32.0/src/collection/commands/find.ts": "5c3b750d8c82ce08d865a381bc71f600406cbc4912c4aa689238755579fb71f8", + "https://deno.land/x/mongo@v0.32.0/src/collection/commands/list_indexes.ts": "d32a5120305d0547497026b4f5ab2ecc2f40ff7f44c405b99c2a0287765333f5", + "https://deno.land/x/mongo@v0.32.0/src/collection/commands/update.ts": "cf352108a5dd34f0928c2196a432383d366b8ed292676c71358b9ecf1289418d", + "https://deno.land/x/mongo@v0.32.0/src/collection/mod.ts": "bd791a0b9b46be4365f88c54893584eadec2f8cd799db9eb05e0b5b4c8d72b8e", + "https://deno.land/x/mongo@v0.32.0/src/database.ts": "c7b677beddd3eb16f79e8d3c9473b5f86e45541b8a04cc896aabe04d029fa7a0", + "https://deno.land/x/mongo@v0.32.0/src/error.ts": "8180a822b0831a94a6a28815865b5b40e3996220684bea60fcb81b272ddd06eb", + "https://deno.land/x/mongo@v0.32.0/src/gridfs/bucket.ts": "a4452d63f6928f57486a214a499b54b80b98cc0d13e3d85a6841b34d5ff12a61", + "https://deno.land/x/mongo@v0.32.0/src/gridfs/indexes.ts": "7d302114fb4d81c4a873614a51d11ddb8b471f967179dddb8269c39b3cadf4e3", + "https://deno.land/x/mongo@v0.32.0/src/gridfs/upload.ts": "6a54a21b00c6f22ad0da6ceef7a2932dc600560f594c2551abd8e4a64976abae", + "https://deno.land/x/mongo@v0.32.0/src/protocol/cursor.ts": "c370a28856fa236129cc2d7abf7ebc4ac6cdd60acb93e0e7371433f7332394cb", + "https://deno.land/x/mongo@v0.32.0/src/protocol/handshake.ts": "3c3ba547d5322751b9756ce9a4750f3cf18febee0a64edca5b007634bd80e0fe", + "https://deno.land/x/mongo@v0.32.0/src/protocol/header.ts": "0f28db842f886e57b7013606c1391affab2e2960a1a4568d2502e7b788117716", + "https://deno.land/x/mongo@v0.32.0/src/protocol/message.ts": "7b4e38489070fc6281d1b3f13e99504310f09273baa8bcb11d82b1e30ea04202", + "https://deno.land/x/mongo@v0.32.0/src/protocol/mod.ts": "4e24d563049c0a236234598ca786ca13778dc17fdb80ac543ac6c75d0c5094d7", + "https://deno.land/x/mongo@v0.32.0/src/protocol/protocol.ts": "92568dd86e6ef3f54054113d9f5620f158fc1dfee2a7c9d13623975835d5996a", + "https://deno.land/x/mongo@v0.32.0/src/types.ts": "355c91b0abc0c77aa1f8fd0dcfcbc47505518f561b72d8fefd4a929b12bc7e48", + "https://deno.land/x/mongo@v0.32.0/src/types/geojson.ts": "14690e2fa1591939253ddc9de181b0664051e9462db131b72be5fb9d064dff44", + "https://deno.land/x/mongo@v0.32.0/src/types/geospatial.ts": "c73ee13536365fa5d868b65ab47b3488a5f223a67e1e059761886f750db70ef9", + "https://deno.land/x/mongo@v0.32.0/src/types/gridfs.ts": "e1fd12c3ca58d437267e7a8557d745d23b9d8916d1da34c1847e5e373728dfa0", + "https://deno.land/x/mongo@v0.32.0/src/types/read_write_concern.ts": "d00f35eb85520e776741888685d08d479766a19e9a0a970b53f4594c9db00496", + "https://deno.land/x/mongo@v0.32.0/src/utils/ns.ts": "fb0c57b8dc4d31f8993112d267dec3c163d3e8862198d1cd03b2b51bcc3caad9", + "https://deno.land/x/mongo@v0.32.0/src/utils/saslprep/deps.ts": "95ceb81b353110526dacf2a98854bc79d6e17d7f173af8806e91c05555d7b8c7", + "https://deno.land/x/mongo@v0.32.0/src/utils/saslprep/load_code_points.ts": "f6a4ef2eb2345eac40ffbf1a30661cca803f399865f2a0fadafb71f57d4c97bf", + "https://deno.land/x/mongo@v0.32.0/src/utils/saslprep/memory_pager.ts": "f55a79a13ec569c21630c3915a9af0c6fc0aa2b899121fa2a85a813c6dd4afba", + "https://deno.land/x/mongo@v0.32.0/src/utils/saslprep/mod.ts": "0a8a39a0784d065a79c54ce63d7d7b103d0b94addc5b7bcf985517ba2442c8a1", + "https://deno.land/x/mongo@v0.32.0/src/utils/saslprep/sparse_bitfield.ts": "07d6fe2ecd4ba5f711c44c1ae409bb9c1fe3a3cfc09e27434d231d4aae46dd2d", + "https://deno.land/x/mongo@v0.32.0/src/utils/srv.ts": "ed5f78ffe6480faac68291a87e51e3674eff5f28aec937ee97248e99e1317b16", + "https://deno.land/x/mongo@v0.32.0/src/utils/uri.ts": "dcfab8e1dcfcc875c75ada1d9f366664480c03b65594990d6342ed88925452e5", + "https://deno.land/x/r2d2@v2.0.0/mod.ts": "9dd57845ed23db1a80e8df3ebaec4bd1ff1a39bbf533b4ee2a40f9c895cd662b", + "https://deno.land/x/web_bson@v0.3.0/mod.js": "8e14aecd31ee63abd30e2dbaa284b4b67abb7ba51fcef5b96af74727cb7c7940" + }, + "workspace": { + "dependencies": [ + "jsr:@cross/env@^0.2.7", + "jsr:@cross/utils@^0.5.0", + "jsr:@denosaurs/event@^2.0.2", + "jsr:@std/assert@^0.219.1", + "jsr:@std/cli@^0.219.1" + ] + } +} diff --git a/packages/bolt/utils/config.ts b/packages/bolt/utils/config.ts index 5a3e411..cb8b3d3 100644 --- a/packages/bolt/utils/config.ts +++ b/packages/bolt/utils/config.ts @@ -3,13 +3,13 @@ import { create_plugin } from './plugins.ts'; /** a function that returns a config object when given a partial config object */ export function define_config(config?: Partial): config { return { - ...(config || {}), prod: false, plugins: [], mongo_uri: 'mongodb://localhost:27017', mongo_database: config?.prod ? 'bolt' : 'bolt-testing', redis_host: 'localhost', - redis_port: 6379 + redis_port: 6379, + ...(config || {}) }; } From 78d94a9d1ecc0ff3f3f51b0b77a43ce95944854f Mon Sep 17 00:00:00 2001 From: Jersey Date: Sun, 17 Mar 2024 16:03:44 -0400 Subject: [PATCH 05/13] clean up api and add docs!!!! Signed-off-by: Jersey --- packages/bolt/_tests.ts | 4 +- packages/bolt/bolt.ts | 24 ++-- packages/bolt/bridges/_internal.ts | 144 ++++++++++++++++++++++++ packages/bolt/bridges/mod.ts | 158 ++++----------------------- packages/bolt/bridges/types.ts | 21 +++- packages/bolt/deno.lock | 10 +- packages/bolt/mod.ts | 7 +- packages/bolt/utils/_fourbetafive.ts | 5 +- packages/bolt/utils/_fourfourbeta.ts | 5 +- packages/bolt/utils/commands.ts | 31 +++++- packages/bolt/utils/config.ts | 10 ++ packages/bolt/utils/errors.ts | 7 +- packages/bolt/utils/messages.ts | 77 +++++++++---- packages/bolt/utils/migrations.ts | 24 +++- packages/bolt/utils/mod.ts | 6 +- packages/bolt/utils/plugins.ts | 17 ++- 16 files changed, 354 insertions(+), 196 deletions(-) create mode 100644 packages/bolt/bridges/_internal.ts diff --git a/packages/bolt/_tests.ts b/packages/bolt/_tests.ts index f1f1a4c..1f2b4f3 100644 --- a/packages/bolt/_tests.ts +++ b/packages/bolt/_tests.ts @@ -15,7 +15,7 @@ import { utils_msg } from './_testdata.ts'; import { - Commands, + commands, message, apply_migrations, get_migrations, @@ -40,7 +40,7 @@ console.log = console.error = () => {}; // cmds Deno.test('bolt/cmds', async t => { - const cmds = new Commands(); + const cmds = new commands(); await t.step('run help command', async () => { let res: (value: message) => void; diff --git a/packages/bolt/bolt.ts b/packages/bolt/bolt.ts index 8806543..3bd9fc3 100644 --- a/packages/bolt/bolt.ts +++ b/packages/bolt/bolt.ts @@ -1,9 +1,9 @@ import { EventEmitter } from 'event'; import { MongoClient } from 'mongo'; import { RedisClient } from 'r2d2'; -import { bolt_bridges } from './bridges/mod.ts'; +import { bridges } from './bridges/mod.ts'; import { - Commands, + commands, plugin, config, create_plugin, @@ -11,26 +11,32 @@ import { plugin_events } from './utils/mod.ts'; +/** an instance of bolt */ export class Bolt extends EventEmitter { - bridge: bolt_bridges; - cmds: Commands = new Commands(); + bridge: bridges; + /** a command handler */ + cmds: commands = new commands(); + /** the config used */ config: config; - db: { - mongo: MongoClient; - }; + /** a mongo client */ + mongo: MongoClient; + /** a redis client */ redis: RedisClient; + /** the plugins loaded */ plugins: Map> = new Map>(); + /** setup an instance with the given config, mongo instance, and redis connection */ constructor(config: config, mongo: MongoClient, redis_conn: Deno.TcpConn) { super(); this.config = config; - this.db = { mongo }; + this.mongo = mongo; this.redis = new RedisClient(redis_conn); - this.bridge = new bolt_bridges(this); + this.bridge = new bridges(this); this.cmds.listen(this); this.load(this.config.plugins); } + /** load plugins */ async load(plugins: { type: create_plugin; config: unknown }[]) { for (const { type, config } of plugins) { const plugin = new type(this, config); diff --git a/packages/bolt/bridges/_internal.ts b/packages/bolt/bridges/_internal.ts new file mode 100644 index 0000000..b5d069b --- /dev/null +++ b/packages/bolt/bridges/_internal.ts @@ -0,0 +1,144 @@ +import { bridges } from './mod.ts'; +import { message, deleted_message, log_error, plugin } from '../utils/mod.ts'; +import { bridge_platform } from './types.ts'; +import { Bolt } from '../bolt.ts'; + +export class bridge_internals_dont_use_or_look_at { + private bridges: bridges; + private bolt: Bolt; + // TODO: find a better way to do this, maps work BUT don't't scale well + private bridged_message_id_map = new Map(); + + constructor(bridge: bridges, bolt: Bolt) { + this.bolt = bolt; + this.bridges = bridge; + } + + is_bridged_internal(msg: deleted_message): boolean { + return Boolean(this.bridged_message_id_map.get(msg.id)); + } + + async handle_message( + msg: message | deleted_message, + action: 'create_message' | 'edit_message' | 'delete_message' + ): Promise { + const bridge_info = await this.get_platforms(msg, action); + if (!bridge_info) return; + + if (bridge_info.bridge.settings?.realnames === true) { + if ('author' in msg && msg.author) { + msg.author.username = msg.author.rawname; + } + } + + const data: (bridge_platform & { id: string })[] = []; + + for (const plat of bridge_info.platforms) { + const { plugin, platform } = await this.get_sane_plugin(plat, action); + if (!plugin || !platform) continue; + + let dat; + + try { + dat = await plugin[action]( + { + ...msg, + replytoid: await this.get_replytoid(msg, platform) + } as message, + platform + ); + } catch (e) { + if (action === 'delete_message') continue; + const err = await log_error(e, { platform, action }); + try { + dat = await plugin[action](err.message, platform); + } catch (e) { + await log_error( + new Error(`logging failed for ${err.uuid}`, { cause: e }) + ); + continue; + } + } + this.bridged_message_id_map.set(dat.id!, true); + data.push(dat as bridge_platform & { id: string }); + } + + for (const i of data) { + await this.bolt.redis.sendCommand([ + 'JSON.SET', + `bolt-bridge-${i.id}`, + '$', + JSON.stringify(data) + ]); + } + + await this.bolt.redis.sendCommand([ + 'JSON.SET', + `bolt-bridge-${msg.id}`, + '$', + JSON.stringify(data) + ]); + } + + private async get_platforms( + msg: message | deleted_message, + action: 'create_message' | 'edit_message' | 'delete_message' + ) { + const bridge = await this.bridges.get_bridge(msg); + if (!bridge) return; + if ( + action !== 'create_message' && + bridge.settings?.editing_allowed !== true + ) + return; + + const platforms = + action === 'create_message' + ? bridge.platforms.filter(i => i.channel !== msg.channel) + : await this.bridges.get_bridge_message(msg.id); + if (!platforms || platforms.length < 1) return; + return { platforms, bridge }; + } + + private async get_replytoid( + msg: message | deleted_message, + platform: bridge_platform + ) { + let replytoid; + if ('replytoid' in msg && msg.replytoid) { + try { + replytoid = ( + await this.bridges.get_bridge_message(msg.replytoid) + )?.find( + i => i.channel === platform.channel && i.plugin === platform.plugin + )?.id; + } catch { + replytoid = undefined; + } + } + return replytoid; + } + + private async get_sane_plugin( + platform: bridge_platform, + action: 'create_message' | 'edit_message' | 'delete_message' + ): Promise<{ + plugin?: plugin; + platform?: bridge_platform & { id: string }; + }> { + const plugin = this.bolt.plugins.get(platform.plugin); + + if (!plugin || !plugin[action]) { + await log_error(new Error(`plugin ${platform.plugin} has no ${action}`)); + return {}; + } + + if (!platform.senddata || (action !== 'create_message' && !platform.id)) + return {}; + + return { plugin, platform: platform } as { + plugin: plugin; + platform: bridge_platform & { id: string }; + }; + } +} diff --git a/packages/bolt/bridges/mod.ts b/packages/bolt/bridges/mod.ts index f8dee9b..c4fb229 100644 --- a/packages/bolt/bridges/mod.ts +++ b/packages/bolt/bridges/mod.ts @@ -1,38 +1,45 @@ import { bridge_commands } from './_commands.ts'; import { Bolt } from '../bolt.ts'; import { Collection } from 'mongo'; -import { message, deleted_message, log_error, plugin } from '../utils/mod.ts'; +import { deleted_message } from '../utils/mod.ts'; import { bridge_document, bridge_platform } from './types.ts'; +import { bridge_internals_dont_use_or_look_at } from './_internal.ts'; -export class bolt_bridges { +/** a thing that bridges messages between platforms defined by plugins */ +export class bridges { + /** the parent instance of bolt */ private bolt: Bolt; + /** the database collection containing all the bridges */ private bridge_collection: Collection; - // TODO: find a better way to do this, maps work BUT don't't scale well - private bridged_message_id_map = new Map(); + /** the scary internals that you never want to look at */ + private internals: bridge_internals_dont_use_or_look_at; + /** create a bridge instance and attach to bolt */ constructor(bolt: Bolt) { this.bolt = bolt; - this.bridge_collection = bolt.db.mongo + this.internals = new bridge_internals_dont_use_or_look_at(this, bolt); + this.bridge_collection = bolt.mongo .database(bolt.config.mongo_database) .collection('bridges'); - this.bolt.on('create_message', async msg => { + bolt.on('create_message', async msg => { await new Promise(res => setTimeout(res, 250)); if (this.is_bridged(msg)) return; bolt.emit('create_nonbridged_message', msg); - await this.handle_message(msg, 'create_message'); + await this.internals.handle_message(msg, 'create_message'); }); - this.bolt.on('edit_message', async msg => { + bolt.on('edit_message', async msg => { await new Promise(res => setTimeout(res, 250)); if (this.is_bridged(msg)) return; - await this.handle_message(msg, 'edit_message'); + await this.internals.handle_message(msg, 'edit_message'); }); - this.bolt.on('delete_message', async msg => { + bolt.on('delete_message', async msg => { await new Promise(res => setTimeout(res, 400)); - await this.handle_message(msg, 'delete_message'); + await this.internals.handle_message(msg, 'delete_message'); }); - this.bolt.cmds.set('bridge', bridge_commands(bolt)); + bolt.cmds.set('bridge', bridge_commands(bolt)); } + /** get all the platforms a message was bridged to */ async get_bridge_message(id: string): Promise { const rdata = await this.bolt.redis.sendCommand([ 'JSON.GET', @@ -42,14 +49,16 @@ export class bolt_bridges { return JSON.parse(rdata as string) as bridge_platform[]; } + /** check if a message was bridged */ is_bridged(msg: deleted_message): boolean { const platform = this.bolt.plugins.get(msg.platform.name); if (!platform) return false; const platsays = platform.is_bridged(msg); if (platsays !== 'query') return platsays; - return Boolean(this.bridged_message_id_map.get(msg.id)); + return this.internals.is_bridged_internal(msg); } + /** get a bridge using the bridges name or a channel in it */ async get_bridge({ _id, channel @@ -68,131 +77,10 @@ export class bolt_bridges { return (await this.bridge_collection.findOne(query)) || undefined; } + /** update a bridge in a database */ async update_bridge(bridge: bridge_document): Promise { await this.bridge_collection.replaceOne({ _id: bridge._id }, bridge, { upsert: true }); } - - private async handle_message( - msg: message | deleted_message, - action: 'create_message' | 'edit_message' | 'delete_message' - ): Promise { - const bridge_info = await this.get_platforms(msg, action); - if (!bridge_info) return; - - if (bridge_info.bridge.settings?.realnames === true) { - if ('author' in msg && msg.author) { - msg.author.username = msg.author.rawname; - } - } - - const data: (bridge_platform & { id: string })[] = []; - - for (const plat of bridge_info.platforms) { - const { plugin, platform } = await this.get_sane_plugin(plat, action); - if (!plugin || !platform) continue; - - let dat; - - try { - dat = await plugin[action]( - { - ...msg, - replytoid: await this.get_replytoid(msg, platform) - } as message, - platform - ); - } catch (e) { - if (action === 'delete_message') continue; - const err = await log_error(e, { platform, action }); - try { - dat = await plugin[action](err.message, platform); - } catch (e) { - await log_error( - new Error(`logging failed for ${err.uuid}`, { cause: e }) - ); - continue; - } - } - this.bridged_message_id_map.set(dat.id!, true); - data.push(dat as bridge_platform & { id: string }); - } - - for (const i of data) { - await this.bolt.redis.sendCommand([ - 'JSON.SET', - `bolt-bridge-${i.id}`, - '$', - JSON.stringify(data) - ]); - } - - await this.bolt.redis.sendCommand([ - 'JSON.SET', - `bolt-bridge-${msg.id}`, - '$', - JSON.stringify(data) - ]); - } - - private async get_platforms( - msg: message | deleted_message, - action: 'create_message' | 'edit_message' | 'delete_message' - ) { - const bridge = await this.get_bridge(msg); - if (!bridge) return; - if ( - action !== 'create_message' && - bridge.settings?.editing_allowed !== true - ) - return; - - const platforms = - action === 'create_message' - ? bridge.platforms.filter(i => i.channel !== msg.channel) - : await this.get_bridge_message(msg.id); - if (!platforms || platforms.length < 1) return; - return { platforms, bridge }; - } - - private async get_replytoid( - msg: message | deleted_message, - platform: bridge_platform - ) { - let replytoid; - if ('replytoid' in msg && msg.replytoid) { - try { - replytoid = (await this.get_bridge_message(msg.replytoid))?.find( - i => i.channel === platform.channel && i.plugin === platform.plugin - )?.id; - } catch { - replytoid = undefined; - } - } - return replytoid; - } - - private async get_sane_plugin( - platform: bridge_platform, - action: 'create_message' | 'edit_message' | 'delete_message' - ): Promise<{ - plugin?: plugin; - platform?: bridge_platform & { id: string }; - }> { - const plugin = this.bolt.plugins.get(platform.plugin); - - if (!plugin || !plugin[action]) { - await log_error(new Error(`plugin ${platform.plugin} has no ${action}`)); - return {}; - } - - if (!platform.senddata || (action !== 'create_message' && !platform.id)) - return {}; - - return { plugin, platform: platform } as { - plugin: plugin; - platform: bridge_platform & { id: string }; - }; - } } diff --git a/packages/bolt/bridges/types.ts b/packages/bolt/bridges/types.ts index f85ca40..0e8696d 100644 --- a/packages/bolt/bridges/types.ts +++ b/packages/bolt/bridges/types.ts @@ -1,16 +1,29 @@ +/** the database's representation of a bridge */ export interface bridge_document { + /** the bridge's id */ _id: string; + /** each platform within the bridge */ platforms: bridge_platform[]; - settings?: { - realnames?: boolean; - editing_allowed?: boolean; - }; + /** the settings for the bridge */ + settings?: bridge_settings; } /** platform within a bridge */ export interface bridge_platform { + /** the channel to be bridged */ channel: string; + /** the plugin used for this platform */ plugin: string; + /** the data needed for a message to be sent */ senddata: unknown; + /** the id of a sent message */ id?: string; } + +/** bridge settings */ +export interface bridge_settings { + /** use an authors rawname instead of username */ + realnames?: boolean; + /** whether or not to allow editing to be bridged */ + editing_allowed?: boolean; +} diff --git a/packages/bolt/deno.lock b/packages/bolt/deno.lock index b3a321c..955d426 100644 --- a/packages/bolt/deno.lock +++ b/packages/bolt/deno.lock @@ -9,9 +9,11 @@ "jsr:@denosaurs/event@^2.0.2": "jsr:@denosaurs/event@2.0.2", "jsr:@std/assert@^0.219.1": "jsr:@std/assert@0.219.1", "jsr:@std/cli@^0.219.1": "jsr:@std/cli@0.219.1", + "jsr:@std/fmt@^0.219.1": "jsr:@std/fmt@0.219.1", "npm:@discordjs/core@1.1.1": "npm:@discordjs/core@1.1.1", "npm:@discordjs/rest@2.2.0": "npm:@discordjs/rest@2.2.0", "npm:@discordjs/ws@1.0.2": "npm:@discordjs/ws@1.0.2", + "npm:@types/node": "npm:@types/node@18.16.19", "npm:@williamhorning/revolt.js@7.0.0-beta.10": "npm:@williamhorning/revolt.js@7.0.0-beta.10_solid-js@1.8.15__seroval@1.0.4", "npm:guilded-api-typings@0.13.2": "npm:guilded-api-typings@0.13.2", "npm:guilded.js@0.23.7": "npm:guilded.js@0.23.7" @@ -40,13 +42,19 @@ "integrity": "3310ba1a9e94dd60ccb09c6084fc818cc1cd50e543c56ef0c6199f1b89073392" }, "@std/assert@0.219.1": { - "integrity": "e76c2a1799a78f0f4db7de04bdc9b908a7a4b821bb65eda0285885297d4fb8af" + "integrity": "e76c2a1799a78f0f4db7de04bdc9b908a7a4b821bb65eda0285885297d4fb8af", + "dependencies": [ + "jsr:@std/fmt@^0.219.1" + ] }, "@std/cli@0.219.1": { "integrity": "715a9926b58b89ef8a3c91e91633ac5f8176e0f02f6b3a16f0a67309e41a2911", "dependencies": [ "jsr:@std/assert@^0.219.1" ] + }, + "@std/fmt@0.219.1": { + "integrity": "2432152e927df249a207177aa048a6d9465956ea0047653ee6abd4f514db504f" } }, "npm": { diff --git a/packages/bolt/mod.ts b/packages/bolt/mod.ts index b597448..51f7bd6 100644 --- a/packages/bolt/mod.ts +++ b/packages/bolt/mod.ts @@ -2,6 +2,11 @@ * @module */ -export { type bridge_document, type bridge_platform } from './bridges/types.ts'; +export { bridges } from './bridges/mod.ts'; +export { + type bridge_document, + type bridge_platform, + type bridge_settings +} from './bridges/types.ts'; export * from './utils/mod.ts'; export { Bolt } from './bolt.ts'; diff --git a/packages/bolt/utils/_fourbetafive.ts b/packages/bolt/utils/_fourbetafive.ts index fc87cd3..ab06423 100644 --- a/packages/bolt/utils/_fourbetafive.ts +++ b/packages/bolt/utils/_fourbetafive.ts @@ -1,4 +1,5 @@ import { Document } from 'mongo'; +import { versions } from './migrations.ts'; type doc = { _id: string; @@ -8,8 +9,8 @@ type doc = { }; export default { - from: '0.4-beta', - to: '0.5', + from: '0.4-beta' as versions, + to: '0.5' as versions, from_db: 'bridgev1', to_db: 'bridges', translate: (itemslist: (doc | Document)[]) => diff --git a/packages/bolt/utils/_fourfourbeta.ts b/packages/bolt/utils/_fourfourbeta.ts index 9be33d0..690810e 100644 --- a/packages/bolt/utils/_fourfourbeta.ts +++ b/packages/bolt/utils/_fourfourbeta.ts @@ -1,8 +1,9 @@ import { Document } from 'mongo'; +import { versions } from './migrations.ts'; export default { - from: '0.4', - to: '0.4-beta', + from: '0.4' as versions, + to: '0.4-beta' as versions, from_db: 'bridge', to_db: 'bridgev1', translate: ( diff --git a/packages/bolt/utils/commands.ts b/packages/bolt/utils/commands.ts index d8355c1..f92fe91 100644 --- a/packages/bolt/utils/commands.ts +++ b/packages/bolt/utils/commands.ts @@ -3,11 +3,21 @@ import { log_error } from './errors.ts'; import { parseArgs } from 'std_args'; import { create_message, message } from './messages.ts'; -export class Commands extends Map { +/** + * commands implements simple command handling for bolt that others may find useful + */ +export class commands extends Map { + /** + * creates a command handler instance with the given commands + * @param default_cmds - the commands to use by default, should include help as a fallback command + */ constructor(default_cmds: [string, command][] = default_commands) { super(default_cmds); } + /** + * listen for commands on the given bolt instance + */ listen(bolt: Bolt) { bolt.on('create_nonbridged_message', msg => { if (msg.content?.startsWith('!bolt')) { @@ -30,6 +40,9 @@ export class Commands extends Map { }); } + /** + * run a command given the options that would be passed to it + */ async run(opts: command_arguments) { let reply; try { @@ -86,7 +99,7 @@ const default_commands: [string, command][] = [ ] ]; -export type command_arguments = { +export interface command_arguments { channel: string; cmd: string; opts: Record; @@ -94,17 +107,23 @@ export type command_arguments = { replyfn: message['reply']; subcmd?: string; timestamp: Temporal.Instant; -}; +} -export type command = { +export interface command { + /** the name of the command */ name: string; + /** an optional description */ description?: string; options?: { + /** this will be the key passed to options.opts in the execute function */ argument_name?: string; + /** whether or not the argument provided is required */ argument_required?: boolean; + /** an array of commands that show as subcommands */ subcommands?: command[]; }; + /** a function that returns a message */ execute: ( - opts: command_arguments + options: command_arguments ) => Promise> | message; -}; +} diff --git a/packages/bolt/utils/config.ts b/packages/bolt/utils/config.ts index cb8b3d3..75a56cd 100644 --- a/packages/bolt/utils/config.ts +++ b/packages/bolt/utils/config.ts @@ -14,11 +14,21 @@ export function define_config(config?: Partial): config { } export interface config { + /** + * whether or not bolt is in production mode + * @deprecated + * */ prod: boolean; + /** a list of plugins */ plugins: { type: create_plugin; config: unknown }[]; + /** the URI that points to your instance of mongodb */ mongo_uri: string; + /** the database to use */ mongo_database: string; + /** the hostname of your redis instance */ redis_host: string; + /** the port of your redis instance */ redis_port?: number; + /** the webhook used to send errors to */ errorURL?: string; } diff --git a/packages/bolt/utils/errors.ts b/packages/bolt/utils/errors.ts index c63288f..6b5d41b 100644 --- a/packages/bolt/utils/errors.ts +++ b/packages/bolt/utils/errors.ts @@ -1,7 +1,12 @@ import { create_message, message } from './messages.ts'; import { getEnv } from 'cross_env'; -/** logs an error and returns a unique id and a message for users */ +/** + * logs an error and returns a unique id and a message for users + * @param e the error to log + * @param extra any extra data to log + * @param _id a function that returns a unique id (used for testing) + */ export async function log_error( e: Error, extra: Record = {}, diff --git a/packages/bolt/utils/messages.ts b/packages/bolt/utils/messages.ts index b749707..335c466 100644 --- a/packages/bolt/utils/messages.ts +++ b/packages/bolt/utils/messages.ts @@ -1,4 +1,7 @@ -/** creates a message given text and an optional uuid */ +/** + * creates a message that can be sent using bolt + * @param text the text of the message (can be markdown) + */ export function create_message(text: string): message { const data = { author: { @@ -21,8 +24,38 @@ export function create_message(text: string): message { return data; } -export type embed_media = { height?: number; url: string; width?: number }; +export interface attachment { + /** alt text for images */ + alt?: string; + /** a URL pointing to the file */ + file: string; + /** the file's name */ + name?: string; + /** whether or not the file has a spoiler */ + spoiler?: boolean; + /** + * file size + * @deprecated + */ + size: number; +} + +export interface platform { + /** the name of a plugin */ + name: string; + /** the platforms representation of a message */ + message: t; + /** the webhook the message was sent with */ + webhookid?: string; +} + +export interface embed_media { + height?: number; + url: string; + width?: number; +} +/** a discord-style embed */ export interface embed { author?: { name: string; url?: string; icon_url?: string }; color?: number; @@ -37,42 +70,42 @@ export interface embed { video?: Omit & { url?: string }; } -export interface message { - attachments?: { - alt?: string; - file: string; - name?: string; - spoiler?: boolean; - size: number; - }[]; +export interface message extends deleted_message { + attachments?: attachment[]; author: { + /** the nickname of the author */ username: string; + /** the author's username */ rawname: string; + /** a url pointing to the authors profile picture */ profile?: string; + /** a url pointing to the authors banner */ banner?: string; + /** the author's id on their platform */ id: string; + /** the color of an author */ color?: string; }; + /** message content (can be markdown) */ content?: string; + /** discord-style embeds */ embeds?: embed[]; + /** a function to reply to a message */ reply: (message: message, optional?: unknown) => Promise; + /** the id of the message replied to */ replytoid?: string; - id: string; - platform: { - name: string; - message: t; - webhookid?: string; - }; - channel: string; - timestamp: Temporal.Instant; } export interface deleted_message { + /** the message's id */ id: string; + /** the channel the message was sent in */ channel: string; - platform: { - name: string; - message: t; - }; + /** the platform the message was sent on */ + platform: platform; + /** + * the time the message was sent/edited as a temporal instant + * @see https://tc39.es/proposal-temporal/docs/instant.html + */ timestamp: Temporal.Instant; } diff --git a/packages/bolt/utils/migrations.ts b/packages/bolt/utils/migrations.ts index 10a7cd7..ce5f435 100644 --- a/packages/bolt/utils/migrations.ts +++ b/packages/bolt/utils/migrations.ts @@ -2,26 +2,40 @@ import { Document } from 'mongo'; import fourfourbeta from './_fourfourbeta.ts'; import fourbetafive from './_fourfourbeta.ts'; -const migrations = [fourbetafive, fourfourbeta]; - /** the type of a migration */ -export type migration = (typeof migrations)[number]; +export interface migration { + /** the version to translate from */ + from: versions; + /** the version to translate to */ + to: versions; + /** the database to translate from */ + from_db: string; + /** the database to translate to */ + to_db: string; + /** translate a document from one version to another */ + translate: (data: Document[]) => Document[]; +} /** all of the versions with migrations to/from them */ export enum versions { + /** all versions below 0.5 */ Four = '0.4', + /** versions after commit 7de1cf2 but below 0.5 */ FourBeta = '0.4-beta', + /** versions 0.5 and above */ Five = '0.5' } -/** get migrations that can then be applied */ +const migrations: migration[] = [fourbetafive, fourfourbeta]; + +/** get migrations that can then be applied using apply_migrations */ export function get_migrations(from: versions, to: versions): migration[] { const indexoffrom = migrations.findIndex(i => i.from === from); const indexofto = migrations.findLastIndex(i => i.to === to); return migrations.slice(indexoffrom, indexofto); } -/** apply many migrations */ +/** apply many migrations given mongodb documents */ export function apply_migrations( migrations: migration[], data: Document[] diff --git a/packages/bolt/utils/mod.ts b/packages/bolt/utils/mod.ts index d6c8a51..2724de9 100644 --- a/packages/bolt/utils/mod.ts +++ b/packages/bolt/utils/mod.ts @@ -3,7 +3,7 @@ * @module */ -export { Commands, type command, type command_arguments } from './commands.ts'; +export { commands, type command, type command_arguments } from './commands.ts'; export { type config, define_config } from './config.ts'; export { log_error } from './errors.ts'; export { @@ -11,7 +11,9 @@ export { type deleted_message, type embed, type embed_media, - type message + type message, + type platform, + type attachment } from './messages.ts'; export { apply_migrations, diff --git a/packages/bolt/utils/plugins.ts b/packages/bolt/utils/plugins.ts index b962bc9..32a5cfd 100644 --- a/packages/bolt/utils/plugins.ts +++ b/packages/bolt/utils/plugins.ts @@ -4,12 +4,14 @@ import { bridge_platform } from '../bridges/types.ts'; import { message, deleted_message } from './messages.ts'; import { command_arguments } from './commands.ts'; -/** a plugin for bolt */ -export abstract class plugin extends EventEmitter { +/** + * a plugin for bolt + */ +export abstract class plugin extends EventEmitter { /** access the instance of bolt you're connected to */ bolt: Bolt; /** access the config passed to you by bolt */ - config: t; + config: cfg; /** the name of your plugin */ abstract name: string; @@ -18,7 +20,7 @@ export abstract class plugin extends EventEmitter { /** a list of major versions supported by your plugin, should include 0.5 */ abstract support: string[]; - constructor(bolt: Bolt, config: t) { + constructor(bolt: Bolt, config: cfg) { super(); this.bolt = bolt; this.config = config; @@ -50,14 +52,21 @@ export abstract class plugin extends EventEmitter { } export type plugin_events = { + /** when a message is created */ create_message: [message]; + /** when a command is run (not a text command) */ create_command: [command_arguments]; + /** when a message isn't already bridged (don't emit outside of core) */ create_nonbridged_message: [message]; + /** when a message is edited */ edit_message: [message]; + /** when a message is deleted */ delete_message: [deleted_message]; + /** when your plugin is ready */ ready: []; }; +/** the constructor for a plugin */ export interface create_plugin { new (bolt: Bolt, config: unknown): plugin; readonly prototype: plugin; From 39005f9cfb47bdfbd7100b0a817c952286c2afe3 Mon Sep 17 00:00:00 2001 From: Jersey Date: Sun, 17 Mar 2024 16:06:18 -0400 Subject: [PATCH 06/13] looks unrealistic for this to work on node/bun Signed-off-by: Jersey --- packages/bolt/_tests.ts | 3 +-- packages/bolt/cli.ts | 22 ++++++++++------------ packages/bolt/deno.jsonc | 2 -- packages/bolt/utils/errors.ts | 3 +-- 4 files changed, 12 insertions(+), 18 deletions(-) diff --git a/packages/bolt/_tests.ts b/packages/bolt/_tests.ts index 1f2b4f3..cac1279 100644 --- a/packages/bolt/_tests.ts +++ b/packages/bolt/_tests.ts @@ -1,5 +1,4 @@ import { assertEquals } from 'assert_eq'; -import { setEnv } from 'cross_env'; import { cmd_help_output, migrations_five, @@ -122,7 +121,7 @@ Deno.test('bolt/utils', async t => { }); await t.step('webhooks', async () => { - setEnv('BOLT_ERROR_HOOK', 'http://localhost:8000'); + Deno.env.set('BOLT_ERROR_HOOK', 'http://localhost:8000'); let res: (value: unknown) => void; diff --git a/packages/bolt/cli.ts b/packages/bolt/cli.ts index fe09e60..9db829a 100644 --- a/packages/bolt/cli.ts +++ b/packages/bolt/cli.ts @@ -1,6 +1,4 @@ import { Bolt } from './bolt.ts'; -import { setEnv } from 'cross_env'; -import { args, exit, cwd } from 'cross_utils'; import { parseArgs } from 'std_args'; import { MongoClient } from 'mongo'; import { @@ -15,14 +13,14 @@ function log(text: string, color?: string, type?: 'error' | 'log') { console[type || 'log'](`%c${text}`, `color: ${color || 'white'}`); } -const f = parseArgs(args(), { +const f = parseArgs(Deno.args, { boolean: ['help', 'version', 'run', 'migrations'], string: ['config'] }); if (f.version) { log('0.5.8'); - exit(); + Deno.exit(); } if (!f.run && !f.migrations) { @@ -34,17 +32,17 @@ if (!f.run && !f.migrations) { log('--config : absolute path to config file'); log('--run: run an of bolt using the settings in config.ts'); log('--migrations: start interactive tool to migrate databases'); - exit(); + Deno.exit(); } try { if (!Deno) throw new Error('not running on deno, exiting...'); const cfg = define_config( - (await import(f.config || `${cwd()}/config.ts`))?.default + (await import(f.config || `${Deno.cwd()}/config.ts`))?.default ); - setEnv('BOLT_ERROR_HOOK', cfg.errorURL || ''); + Deno.env.set('BOLT_ERROR_HOOK', cfg.errorURL || ''); const mongo = new MongoClient(); await mongo.connect(cfg.mongo_uri); @@ -62,7 +60,7 @@ try { } catch (e) { log('Something went wrong, exiting...', 'red', 'error'); log(e, 'red', 'error'); - exit(1); + Deno.exit(1); } async function migrations(cfg: config, mongo: MongoClient) { @@ -74,11 +72,11 @@ async function migrations(cfg: config, mongo: MongoClient) { const is_invalid = (val: string) => !(Object.values(versions) as string[]).includes(val); - if (!from || !to || is_invalid(from) || is_invalid(to)) return exit(1); + if (!from || !to || is_invalid(from) || is_invalid(to)) return Deno.exit(1); const migrationlist = get_migrations(from as versions, to as versions); - if (migrationlist.length < 1) exit(); + if (migrationlist.length < 1) Deno.exit(); const database = mongo.database(cfg.mongo_database); @@ -98,7 +96,7 @@ async function migrations(cfg: config, mongo: MongoClient) { `Do you want to write the data at ${filepath} to the DB?` ); - if (!writeconfirm) exit(); + if (!writeconfirm) Deno.exit(); const tocollection = database.collection(migrationlist.slice(-1)[0].to_db); @@ -110,5 +108,5 @@ async function migrations(cfg: config, mongo: MongoClient) { log('Wrote data to the DB', 'green'); - exit(); + Deno.exit(); } diff --git a/packages/bolt/deno.jsonc b/packages/bolt/deno.jsonc index ad3e330..986b67e 100644 --- a/packages/bolt/deno.jsonc +++ b/packages/bolt/deno.jsonc @@ -2,8 +2,6 @@ "exports": "./mod.ts", "imports": { "assert_eq": "jsr:@std/assert@^0.219.1/assert_equals", - "cross_env": "jsr:@cross/env@^0.2.7", - "cross_utils": "jsr:@cross/utils@^0.5.0", "event": "jsr:@denosaurs/event@^2.0.2", "mongo": "https://deno.land/x/mongo@v0.32.0/mod.ts", "r2d2": "https://deno.land/x/r2d2@v2.0.0/mod.ts", diff --git a/packages/bolt/utils/errors.ts b/packages/bolt/utils/errors.ts index 6b5d41b..3a9bec6 100644 --- a/packages/bolt/utils/errors.ts +++ b/packages/bolt/utils/errors.ts @@ -1,5 +1,4 @@ import { create_message, message } from './messages.ts'; -import { getEnv } from 'cross_env'; /** * logs an error and returns a unique id and a message for users @@ -18,7 +17,7 @@ export async function log_error( message: message; }> { const uuid = _id(); - const error_hook = getEnv('BOLT_ERROR_HOOK') || ''; + const error_hook = Deno.env.get('BOLT_ERROR_HOOK') || ''; if (error_hook !== '') { delete extra.msg; From 01621453375bf563599d83df073a2e41a096a79e Mon Sep 17 00:00:00 2001 From: Jersey Date: Sun, 17 Mar 2024 16:55:55 -0400 Subject: [PATCH 07/13] change stuff to lightning from bolt Signed-off-by: Jersey --- packages/bolt/_testdata.ts | 21 +- packages/bolt/_tests.ts | 33 +- packages/bolt/bridges/_command_functions.ts | 48 +- packages/bolt/bridges/_commands.ts | 20 +- packages/bolt/bridges/_internal.ts | 18 +- packages/bolt/bridges/mod.ts | 34 +- packages/bolt/cli.ts | 20 +- packages/bolt/deno.jsonc | 19 +- packages/bolt/deno.lock | 595 -------------------- packages/bolt/{bolt.ts => lightning.ts} | 8 +- packages/bolt/mod.ts | 9 +- packages/bolt/utils/_fourbetafive.ts | 1 + packages/bolt/utils/commands.ts | 28 +- packages/bolt/utils/config.ts | 8 +- packages/bolt/utils/errors.ts | 4 +- packages/bolt/utils/messages.ts | 11 +- packages/bolt/utils/mod.ts | 2 +- packages/bolt/utils/plugins.ts | 24 +- 18 files changed, 164 insertions(+), 739 deletions(-) delete mode 100644 packages/bolt/deno.lock rename packages/bolt/{bolt.ts => lightning.ts} (87%) diff --git a/packages/bolt/_testdata.ts b/packages/bolt/_testdata.ts index 85ae6d2..7ef70e3 100644 --- a/packages/bolt/_testdata.ts +++ b/packages/bolt/_testdata.ts @@ -3,8 +3,8 @@ export const cmd_help_output = { username: 'Bolt', profile: 'https://cdn.discordapp.com/icons/1011741670510968862/2d4ce9ff3f384c027d8781fa16a38b07.png?size=1024', - rawname: 'bolt', - id: 'bolt' + rawname: 'lightning', + id: 'lightning' }, content: 'check out [the docs](https://williamhorning.dev/bolt/) for help.', channel: '', @@ -12,7 +12,7 @@ export const cmd_help_output = { reply: async () => {}, timestamp: Temporal.Instant.from('2021-01-01T00:00:00Z'), platform: { - name: 'bolt', + name: 'lightning', message: undefined } }; @@ -90,8 +90,8 @@ export const utils_msg = { username: 'Bolt', profile: 'https://cdn.discordapp.com/icons/1011741670510968862/2d4ce9ff3f384c027d8781fa16a38b07.png?size=1024', - rawname: 'bolt', - id: 'bolt' + rawname: 'lightning', + id: 'lightning' }, content: 'test', channel: '', @@ -99,16 +99,15 @@ export const utils_msg = { reply: async () => {}, timestamp: Temporal.Instant.from('2021-01-01T00:00:00Z'), platform: { - name: 'bolt', + name: 'lightning', message: undefined } }; export const utils_cfg = { - prod: false, plugins: [], mongo_uri: 'mongodb://localhost:27017', - mongo_database: 'bolt-testing', + mongo_database: 'lightning', redis_host: 'localhost', redis_port: 6379 }; @@ -128,8 +127,8 @@ export const utils_err_return = { username: 'Bolt', profile: 'https://cdn.discordapp.com/icons/1011741670510968862/2d4ce9ff3f384c027d8781fa16a38b07.png?size=1024', - rawname: 'bolt', - id: 'bolt' + rawname: 'lightning', + id: 'lightning' }, content: 'Something went wrong! [Look here](https://williamhorning.dev/bolt) for help.\n```\ntest\ntest\n```', @@ -138,7 +137,7 @@ export const utils_err_return = { reply: async () => {}, timestamp: Temporal.Instant.from('2021-01-01T00:00:00Z'), platform: { - name: 'bolt', + name: 'lightning', message: undefined } } diff --git a/packages/bolt/_tests.ts b/packages/bolt/_tests.ts index cac1279..6922058 100644 --- a/packages/bolt/_tests.ts +++ b/packages/bolt/_tests.ts @@ -22,8 +22,8 @@ import { log_error, create_message } from './utils/mod.ts'; -import BoltFourToFourBeta from './utils/_fourfourbeta.ts'; -import BoltFourBetaToFive from './utils/_fourbetafive.ts'; +import fourfourbeta from './utils/_fourfourbeta.ts'; +import fourbetafive from './utils/_fourbetafive.ts'; import { versions } from './utils/migrations.ts'; // override globals @@ -38,7 +38,7 @@ console.log = console.error = () => {}; // cmds -Deno.test('bolt/cmds', async t => { +Deno.test('cmds', async t => { const cmds = new commands(); await t.step('run help command', async () => { @@ -52,7 +52,7 @@ Deno.test('bolt/cmds', async t => { channel: '', cmd: 'help', opts: {}, - platform: 'bolt', + platform: 'lightning', // deno-lint-ignore require-await replyfn: async msg => res(msg), timestamp: temporal_instant @@ -68,36 +68,27 @@ Deno.test('bolt/cmds', async t => { // migrations -Deno.test('bolt/migrations', async t => { +Deno.test('migrations', async t => { await t.step('get a migration', () => { const migrations = get_migrations(versions.Four, versions.FourBeta); - assertEquals(migrations, [BoltFourToFourBeta]); + assertEquals(migrations, [fourfourbeta]); }); await t.step('apply migrations', async t => { await t.step('0.4 => 0.4-beta (one platform)', () => { - const result = apply_migrations( - [BoltFourToFourBeta], - migrations_four_one - ); + const result = apply_migrations([fourfourbeta], migrations_four_one); assertEquals(result, []); }); await t.step('0.4 => 0.4-beta (two platforms)', () => { - const result = apply_migrations( - [BoltFourToFourBeta], - migrations_four_two - ); + const result = apply_migrations([fourfourbeta], migrations_four_two); assertEquals(result, migrations_fourbeta); }); await t.step('0.4-beta => 0.5', () => { - const result = apply_migrations( - [BoltFourBetaToFive], - migrations_fourbeta - ); + const result = apply_migrations([fourbetafive], migrations_fourbeta); assertEquals(result, migrations_five); }); @@ -106,13 +97,15 @@ Deno.test('bolt/migrations', async t => { // utils -Deno.test('bolt/utils', async t => { +Deno.test('utils', async t => { await t.step('config handling', () => { assertEquals(define_config(), utils_cfg); }); await t.step('error handling', async t => { await t.step('basic', async () => { + Deno.env.set('LIGHTNING_ERROR_HOOK', ''); + const result = await log_error(utils_err, utils_extra, utils_err_id); result.message.reply = utils_err_return.message.reply; @@ -121,7 +114,7 @@ Deno.test('bolt/utils', async t => { }); await t.step('webhooks', async () => { - Deno.env.set('BOLT_ERROR_HOOK', 'http://localhost:8000'); + Deno.env.set('LIGHTNING_ERROR_HOOK', 'http://localhost:8000'); let res: (value: unknown) => void; diff --git a/packages/bolt/bridges/_command_functions.ts b/packages/bolt/bridges/_command_functions.ts index 59f6da4..242d1b8 100644 --- a/packages/bolt/bridges/_command_functions.ts +++ b/packages/bolt/bridges/_command_functions.ts @@ -1,20 +1,20 @@ -import { Bolt } from '../bolt.ts'; +import { lightning } from '../lightning.ts'; import { command_arguments, create_message, log_error } from '../utils/mod.ts'; export async function join( - { channel, platform, opts }: command_arguments, - bolt: Bolt + { channel, platform, opts, commands }: command_arguments, + l: lightning ) { const _idraw = opts.name?.split(' ')[0]; const _id = `bridge-${_idraw}`; - const current = await bolt.bridge.get_bridge({ channel }); + const current = await l.bridge.get_bridge({ channel }); const errorargs = { channel, platform, _id }; - const plugin = bolt.plugins.get(platform); + const plugin = l.plugins.get(platform); if (current || !_idraw) { return { text: create_message( - "to do this, you can't be in a bridge and need to name your bridge, see `!bolt help`" + `to do this, you can't be in a bridge and need to name your bridge, see \`${commands.prefix} help\`` ) }; } else if (!plugin || !plugin.create_bridge) { @@ -24,7 +24,7 @@ export async function join( ).message }; } else { - const bridge = (await bolt.bridge.get_bridge({ _id })) || { + const bridge = (await l.bridge.get_bridge({ _id })) || { _id, platforms: [] }; @@ -34,7 +34,7 @@ export async function join( plugin: platform, senddata: await plugin.create_bridge(channel) }); - await bolt.bridge.update_bridge(bridge); + await l.bridge.update_bridge(bridge); return { text: create_message('Joined a bridge!'), ok: true @@ -46,21 +46,21 @@ export async function join( } export async function leave( - { channel, platform }: command_arguments, - bolt: Bolt + { channel, platform, commands }: command_arguments, + l: lightning ) { - const current = await bolt.bridge.get_bridge({ channel }); + const current = await l.bridge.get_bridge({ channel }); if (!current) { return { text: create_message( - 'To run this command you need to be in a bridge. To learn more, run `!bolt help`.' + `To run this command you need to be in a bridge. To learn more, run \`${commands.prefix} help\`.` ), ok: true }; } else { try { - await bolt.bridge.update_bridge({ + await l.bridge.update_bridge({ _id: current._id, platforms: current.platforms.filter( i => i.channel !== channel && i.plugin !== platform @@ -79,22 +79,22 @@ export async function leave( } } -export async function reset(args: command_arguments, bolt: Bolt) { +export async function reset(args: command_arguments, l: lightning) { if (!args.opts.name) { - const [_, ...rest] = ( - (await bolt.bridge.get_bridge(args))?._id || '' - ).split('bridge-'); + const [_, ...rest] = ((await l.bridge.get_bridge(args))?._id || '').split( + 'bridge-' + ); args.opts.name = rest.join('bridge-'); } - let result = await leave(args, bolt); + let result = await leave(args, l); if (!result.ok) return result; - result = await join(args, bolt); + result = await join(args, l); if (!result.ok) return result; return { text: create_message('Reset this bridge!') }; } -export async function toggle(args: command_arguments, bolt: Bolt) { - const current = await bolt.bridge.get_bridge(args); +export async function toggle(args: command_arguments, l: lightning) { + const current = await l.bridge.get_bridge(args); if (!current) { return { @@ -125,7 +125,7 @@ export async function toggle(args: command_arguments, bolt: Bolt) { }; try { - await bolt.bridge.update_bridge(bridge); + await l.bridge.update_bridge(bridge); return { text: create_message('Toggled that setting!') }; @@ -136,8 +136,8 @@ export async function toggle(args: command_arguments, bolt: Bolt) { } } -export async function status(args: command_arguments, bolt: Bolt) { - const current = await bolt.bridge.get_bridge(args); +export async function status(args: command_arguments, l: lightning) { + const current = await l.bridge.get_bridge(args); if (!current) { return { diff --git a/packages/bolt/bridges/_commands.ts b/packages/bolt/bridges/_commands.ts index 4e92e68..ce8810b 100644 --- a/packages/bolt/bridges/_commands.ts +++ b/packages/bolt/bridges/_commands.ts @@ -1,36 +1,38 @@ import { join, leave, reset, toggle, status } from './_command_functions.ts'; import { command, create_message } from '../utils/mod.ts'; -import { Bolt } from '../bolt.ts'; +import { lightning } from '../lightning.ts'; -export function bridge_commands(bolt: Bolt): command { +export function bridge_commands(l: lightning): command { return { name: 'bridge', description: 'bridge this channel to somewhere else', - execute: () => - create_message('Try running `!bolt help` for help with bridges'), + execute: ({ commands }) => + create_message( + `Try running \`${commands.prefix} help\` for help with bridges` + ), options: { subcommands: [ { name: 'join', description: 'join a bridge', - execute: async opts => (await join(opts, bolt)).text, + execute: async opts => (await join(opts, l)).text, options: { argument_name: 'name', argument_required: true } }, { name: 'leave', description: 'leave a bridge', - execute: async opts => (await leave(opts, bolt)).text + execute: async opts => (await leave(opts, l)).text }, { name: 'reset', description: 'reset a bridge', - execute: async opts => (await reset(opts, bolt)).text, + execute: async opts => (await reset(opts, l)).text, options: { argument_name: 'name' } }, { name: 'toggle', description: 'toggle a setting on a bridge', - execute: async opts => (await toggle(opts, bolt)).text, + execute: async opts => (await toggle(opts, l)).text, options: { argument_name: 'setting', argument_required: true @@ -39,7 +41,7 @@ export function bridge_commands(bolt: Bolt): command { { name: 'status', description: 'see what bridges you are in', - execute: async opts => (await status(opts, bolt)).text + execute: async opts => (await status(opts, l)).text } ] } diff --git a/packages/bolt/bridges/_internal.ts b/packages/bolt/bridges/_internal.ts index b5d069b..db852cf 100644 --- a/packages/bolt/bridges/_internal.ts +++ b/packages/bolt/bridges/_internal.ts @@ -1,16 +1,16 @@ import { bridges } from './mod.ts'; import { message, deleted_message, log_error, plugin } from '../utils/mod.ts'; import { bridge_platform } from './types.ts'; -import { Bolt } from '../bolt.ts'; +import { lightning } from '../lightning.ts'; export class bridge_internals_dont_use_or_look_at { private bridges: bridges; - private bolt: Bolt; + private l: lightning; // TODO: find a better way to do this, maps work BUT don't't scale well private bridged_message_id_map = new Map(); - constructor(bridge: bridges, bolt: Bolt) { - this.bolt = bolt; + constructor(bridge: bridges, l: lightning) { + this.l = l; this.bridges = bridge; } @@ -64,17 +64,17 @@ export class bridge_internals_dont_use_or_look_at { } for (const i of data) { - await this.bolt.redis.sendCommand([ + await this.l.redis.sendCommand([ 'JSON.SET', - `bolt-bridge-${i.id}`, + `lightning-bridge-${i.id}`, '$', JSON.stringify(data) ]); } - await this.bolt.redis.sendCommand([ + await this.l.redis.sendCommand([ 'JSON.SET', - `bolt-bridge-${msg.id}`, + `lightning-bridge-${msg.id}`, '$', JSON.stringify(data) ]); @@ -126,7 +126,7 @@ export class bridge_internals_dont_use_or_look_at { plugin?: plugin; platform?: bridge_platform & { id: string }; }> { - const plugin = this.bolt.plugins.get(platform.plugin); + const plugin = this.l.plugins.get(platform.plugin); if (!plugin || !plugin[action]) { await log_error(new Error(`plugin ${platform.plugin} has no ${action}`)); diff --git a/packages/bolt/bridges/mod.ts b/packages/bolt/bridges/mod.ts index c4fb229..8c47f4e 100644 --- a/packages/bolt/bridges/mod.ts +++ b/packages/bolt/bridges/mod.ts @@ -1,5 +1,5 @@ import { bridge_commands } from './_commands.ts'; -import { Bolt } from '../bolt.ts'; +import { lightning } from '../lightning.ts'; import { Collection } from 'mongo'; import { deleted_message } from '../utils/mod.ts'; import { bridge_document, bridge_platform } from './types.ts'; @@ -7,43 +7,43 @@ import { bridge_internals_dont_use_or_look_at } from './_internal.ts'; /** a thing that bridges messages between platforms defined by plugins */ export class bridges { - /** the parent instance of bolt */ - private bolt: Bolt; + /** the parent instance of lightning */ + private l: lightning; /** the database collection containing all the bridges */ private bridge_collection: Collection; /** the scary internals that you never want to look at */ private internals: bridge_internals_dont_use_or_look_at; - /** create a bridge instance and attach to bolt */ - constructor(bolt: Bolt) { - this.bolt = bolt; - this.internals = new bridge_internals_dont_use_or_look_at(this, bolt); - this.bridge_collection = bolt.mongo - .database(bolt.config.mongo_database) + /** create a bridge instance and attach to lightning */ + constructor(l: lightning) { + this.l = l; + this.internals = new bridge_internals_dont_use_or_look_at(this, l); + this.bridge_collection = l.mongo + .database(l.config.mongo_database) .collection('bridges'); - bolt.on('create_message', async msg => { + l.on('create_message', async msg => { await new Promise(res => setTimeout(res, 250)); if (this.is_bridged(msg)) return; - bolt.emit('create_nonbridged_message', msg); + l.emit('create_nonbridged_message', msg); await this.internals.handle_message(msg, 'create_message'); }); - bolt.on('edit_message', async msg => { + l.on('edit_message', async msg => { await new Promise(res => setTimeout(res, 250)); if (this.is_bridged(msg)) return; await this.internals.handle_message(msg, 'edit_message'); }); - bolt.on('delete_message', async msg => { + l.on('delete_message', async msg => { await new Promise(res => setTimeout(res, 400)); await this.internals.handle_message(msg, 'delete_message'); }); - bolt.cmds.set('bridge', bridge_commands(bolt)); + l.cmds.set('bridge', bridge_commands(l)); } /** get all the platforms a message was bridged to */ async get_bridge_message(id: string): Promise { - const rdata = await this.bolt.redis.sendCommand([ + const rdata = await this.l.redis.sendCommand([ 'JSON.GET', - `bolt-bridge-${id}` + `lightning-bridge-${id}` ]); if (!rdata) return [] as bridge_platform[]; return JSON.parse(rdata as string) as bridge_platform[]; @@ -51,7 +51,7 @@ export class bridges { /** check if a message was bridged */ is_bridged(msg: deleted_message): boolean { - const platform = this.bolt.plugins.get(msg.platform.name); + const platform = this.l.plugins.get(msg.platform.name); if (!platform) return false; const platsays = platform.is_bridged(msg); if (platsays !== 'query') return platsays; diff --git a/packages/bolt/cli.ts b/packages/bolt/cli.ts index 9db829a..4922806 100644 --- a/packages/bolt/cli.ts +++ b/packages/bolt/cli.ts @@ -1,4 +1,4 @@ -import { Bolt } from './bolt.ts'; +import { lightning } from './lightning.ts'; import { parseArgs } from 'std_args'; import { MongoClient } from 'mongo'; import { @@ -6,7 +6,8 @@ import { get_migrations, versions, config, - define_config + define_config, + log_error } from './utils/mod.ts'; function log(text: string, color?: string, type?: 'error' | 'log') { @@ -24,13 +25,13 @@ if (f.version) { } if (!f.run && !f.migrations) { - log('bolt v0.5.8 - cross-platform bot connecting communities', 'blue'); - log('Usage: bolt [options]', 'purple'); + log('lightning v0.5.8 - cross-platform bot connecting communities', 'blue'); + log('Usage: lightning [options]', 'purple'); log('Options:', 'green'); log('--help: show this'); log('--version: shows version'); log('--config : absolute path to config file'); - log('--run: run an of bolt using the settings in config.ts'); + log('--run: run an of lightning using the settings in config.ts'); log('--migrations: start interactive tool to migrate databases'); Deno.exit(); } @@ -42,7 +43,7 @@ try { (await import(f.config || `${Deno.cwd()}/config.ts`))?.default ); - Deno.env.set('BOLT_ERROR_HOOK', cfg.errorURL || ''); + Deno.env.set('LIGHTNING_ERROR_HOOK', cfg.errorURL || ''); const mongo = new MongoClient(); await mongo.connect(cfg.mongo_uri); @@ -53,13 +54,12 @@ try { }); if (f.run) { - new Bolt(cfg, mongo, redis); + new lightning(cfg, mongo, redis); } else if (f.migrations) { await migrations(cfg, mongo); } } catch (e) { - log('Something went wrong, exiting...', 'red', 'error'); - log(e, 'red', 'error'); + await log_error(e); Deno.exit(1); } @@ -67,7 +67,7 @@ async function migrations(cfg: config, mongo: MongoClient) { log(`Available versions are: ${Object.values(versions).join(', ')}`, 'blue'); const from = prompt('what version is the DB currently set up for?'); - const to = prompt('what version of bolt do you want to move to?'); + const to = prompt('what version of lightning do you want to move to?'); const is_invalid = (val: string) => !(Object.values(versions) as string[]).includes(val); diff --git a/packages/bolt/deno.jsonc b/packages/bolt/deno.jsonc index 986b67e..61a2401 100644 --- a/packages/bolt/deno.jsonc +++ b/packages/bolt/deno.jsonc @@ -1,5 +1,14 @@ { - "exports": "./mod.ts", + "name": "@jersey/lightning", + "version": "...", + "lint": { + "exclude": ["./_testdata.ts","./_tests.ts"] + }, + "lock": false, + "unstable": ["temporal"], + "test": { + "include": ["./_tests.ts"] + }, "imports": { "assert_eq": "jsr:@std/assert@^0.219.1/assert_equals", "event": "jsr:@denosaurs/event@^2.0.2", @@ -7,8 +16,8 @@ "r2d2": "https://deno.land/x/r2d2@v2.0.0/mod.ts", "std_args": "jsr:@std/cli@^0.219.1/parse_args" }, - // TODO: DO NOT PUBLISH UNDER THE BOLT NAME - "name": "@jersey/unknown", - "unstable": ["temporal"], - "version": "0.5.9" + "exports": { + ".": "./mod.ts", + "./utils": "./utils/mod.ts" + } } diff --git a/packages/bolt/deno.lock b/packages/bolt/deno.lock deleted file mode 100644 index 955d426..0000000 --- a/packages/bolt/deno.lock +++ /dev/null @@ -1,595 +0,0 @@ -{ - "version": "3", - "packages": { - "specifiers": { - "jsr:@cross/deepmerge@^0.2.0": "jsr:@cross/deepmerge@0.2.1", - "jsr:@cross/env@^0.2.7": "jsr:@cross/env@0.2.7", - "jsr:@cross/runtime@^0.0.17": "jsr:@cross/runtime@0.0.17", - "jsr:@cross/utils@^0.5.0": "jsr:@cross/utils@0.5.0", - "jsr:@denosaurs/event@^2.0.2": "jsr:@denosaurs/event@2.0.2", - "jsr:@std/assert@^0.219.1": "jsr:@std/assert@0.219.1", - "jsr:@std/cli@^0.219.1": "jsr:@std/cli@0.219.1", - "jsr:@std/fmt@^0.219.1": "jsr:@std/fmt@0.219.1", - "npm:@discordjs/core@1.1.1": "npm:@discordjs/core@1.1.1", - "npm:@discordjs/rest@2.2.0": "npm:@discordjs/rest@2.2.0", - "npm:@discordjs/ws@1.0.2": "npm:@discordjs/ws@1.0.2", - "npm:@types/node": "npm:@types/node@18.16.19", - "npm:@williamhorning/revolt.js@7.0.0-beta.10": "npm:@williamhorning/revolt.js@7.0.0-beta.10_solid-js@1.8.15__seroval@1.0.4", - "npm:guilded-api-typings@0.13.2": "npm:guilded-api-typings@0.13.2", - "npm:guilded.js@0.23.7": "npm:guilded.js@0.23.7" - }, - "jsr": { - "@cross/deepmerge@0.2.1": { - "integrity": "c547bef63d95e478e48810fbfe9a5cd549c0dd3582d5a307b39cf253404cf2ba" - }, - "@cross/env@0.2.7": { - "integrity": "80a24c263dfb0a84d38c01ed30c97b8e905b524be32e586f13718877a1a2f6fa", - "dependencies": [ - "jsr:@cross/deepmerge@^0.2.0", - "jsr:@cross/runtime@^0.0.17" - ] - }, - "@cross/runtime@0.0.17": { - "integrity": "23e08c6825fc2c81fb4e341d8c51731154039d19cfc44e60de4cf9ce23e36004" - }, - "@cross/utils@0.5.0": { - "integrity": "4b6c02e79f3cd6d7c90aff1d08f589ee74e04ab6e16ba7b1cd21ea7e6054a94b", - "dependencies": [ - "jsr:@cross/runtime@^0.0.17" - ] - }, - "@denosaurs/event@2.0.2": { - "integrity": "3310ba1a9e94dd60ccb09c6084fc818cc1cd50e543c56ef0c6199f1b89073392" - }, - "@std/assert@0.219.1": { - "integrity": "e76c2a1799a78f0f4db7de04bdc9b908a7a4b821bb65eda0285885297d4fb8af", - "dependencies": [ - "jsr:@std/fmt@^0.219.1" - ] - }, - "@std/cli@0.219.1": { - "integrity": "715a9926b58b89ef8a3c91e91633ac5f8176e0f02f6b3a16f0a67309e41a2911", - "dependencies": [ - "jsr:@std/assert@^0.219.1" - ] - }, - "@std/fmt@0.219.1": { - "integrity": "2432152e927df249a207177aa048a6d9465956ea0047653ee6abd4f514db504f" - } - }, - "npm": { - "@discordjs/collection@1.5.3": { - "integrity": "sha512-SVb428OMd3WO1paV3rm6tSjM4wC+Kecaa1EUGX7vc6/fddvw/6lg90z4QtCqm21zvVe92vMMDt9+DkIvjXImQQ==", - "dependencies": {} - }, - "@discordjs/collection@2.0.0": { - "integrity": "sha512-YTWIXLrf5FsrLMycpMM9Q6vnZoR/lN2AWX23/Cuo8uOOtS8eHB2dyQaaGnaF8aZPYnttf2bkLMcXn/j6JUOi3w==", - "dependencies": {} - }, - "@discordjs/core@1.1.1": { - "integrity": "sha512-3tDqc6KCAtE0CxNl5300uPzFnNsY/GAmJhc6oGutbl/la+4mRv5zVb4N68cmcaeD2Il/ySH4zIc00sq+cyhtUA==", - "dependencies": { - "@discordjs/rest": "@discordjs/rest@2.2.0", - "@discordjs/util": "@discordjs/util@1.0.2", - "@discordjs/ws": "@discordjs/ws@1.0.2", - "@sapphire/snowflake": "@sapphire/snowflake@3.5.3", - "@vladfrangu/async_event_emitter": "@vladfrangu/async_event_emitter@2.2.4", - "discord-api-types": "discord-api-types@0.37.61" - } - }, - "@discordjs/rest@2.2.0": { - "integrity": "sha512-nXm9wT8oqrYFRMEqTXQx9DUTeEtXUDMmnUKIhZn6O2EeDY9VCdwj23XCPq7fkqMPKdF7ldAfeVKyxxFdbZl59A==", - "dependencies": { - "@discordjs/collection": "@discordjs/collection@2.0.0", - "@discordjs/util": "@discordjs/util@1.0.2", - "@sapphire/async-queue": "@sapphire/async-queue@1.5.2", - "@sapphire/snowflake": "@sapphire/snowflake@3.5.3", - "@vladfrangu/async_event_emitter": "@vladfrangu/async_event_emitter@2.2.4", - "discord-api-types": "discord-api-types@0.37.61", - "magic-bytes.js": "magic-bytes.js@1.10.0", - "tslib": "tslib@2.6.2", - "undici": "undici@5.27.2" - } - }, - "@discordjs/util@1.0.2": { - "integrity": "sha512-IRNbimrmfb75GMNEjyznqM1tkI7HrZOf14njX7tCAAUetyZM1Pr8hX/EK2lxBCOgWDRmigbp24fD1hdMfQK5lw==", - "dependencies": {} - }, - "@discordjs/ws@1.0.2": { - "integrity": "sha512-+XI82Rm2hKnFwAySXEep4A7Kfoowt6weO6381jgW+wVdTpMS/56qCvoXyFRY0slcv7c/U8My2PwIB2/wEaAh7Q==", - "dependencies": { - "@discordjs/collection": "@discordjs/collection@2.0.0", - "@discordjs/rest": "@discordjs/rest@2.2.0", - "@discordjs/util": "@discordjs/util@1.0.2", - "@sapphire/async-queue": "@sapphire/async-queue@1.5.2", - "@types/ws": "@types/ws@8.5.10", - "@vladfrangu/async_event_emitter": "@vladfrangu/async_event_emitter@2.2.4", - "discord-api-types": "discord-api-types@0.37.61", - "tslib": "tslib@2.6.2", - "ws": "ws@8.16.0" - } - }, - "@fastify/busboy@2.1.1": { - "integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==", - "dependencies": {} - }, - "@guildedjs/api@0.3.2": { - "integrity": "sha512-Tn2DUQm2sPJn1jKLe+GGw1uwL837WCgtNAj5WjIMnM6zHaEoFgIWXM2uMZQ5GTWsC1ZTUu8XiCniGv7YvItv3Q==", - "dependencies": { - "@types/ws": "@types/ws@8.5.4", - "form-data": "form-data@4.0.0", - "node-fetch": "node-fetch@2.6.11", - "qs": "qs@6.11.2", - "typed-emitter": "typed-emitter@2.1.0", - "ws": "ws@8.13.0" - } - }, - "@insertish/oapi@0.1.18": { - "integrity": "sha512-LZLUk3WmzUjCM0quensexvQx/Kk1MpFBtCLJRnRrPOiaFT37JpOmWUFlrdu0sPS6B9wi2edEBeLcsnIiq85WMA==", - "dependencies": { - "axios": "axios@0.26.1", - "openapi-typescript": "openapi-typescript@5.4.1", - "typescript": "typescript@4.9.5" - } - }, - "@sapphire/async-queue@1.5.2": { - "integrity": "sha512-7X7FFAA4DngXUl95+hYbUF19bp1LGiffjJtu7ygrZrbdCSsdDDBaSjB7Akw0ZbOu6k0xpXyljnJ6/RZUvLfRdg==", - "dependencies": {} - }, - "@sapphire/snowflake@3.5.3": { - "integrity": "sha512-jjmJywLAFoWeBi1W7994zZyiNWPIiqRRNAmSERxyg93xRGzNYvGjlZ0gR6x0F4gPRi2+0O6S71kOZYyr3cxaIQ==", - "dependencies": {} - }, - "@solid-primitives/map@0.4.10_solid-js@1.8.15__seroval@1.0.4": { - "integrity": "sha512-Y4aTvQN1DjMmTQeNS3H1Fc+fVVPVslYGAOxD8gIMgQtHn+yLd4Zc4pm/x0m/lsy7NnEi0nskz4G7vbEd9M5sOA==", - "dependencies": { - "@solid-primitives/trigger": "@solid-primitives/trigger@1.0.10_solid-js@1.8.15__seroval@1.0.4", - "solid-js": "solid-js@1.8.15_seroval@1.0.4" - } - }, - "@solid-primitives/set@0.4.10_solid-js@1.8.15__seroval@1.0.4": { - "integrity": "sha512-YAoKFKfpHCjnZQV/TnzH01cSXRpDJS4gpuwGpLiiJvCt7rhAMImLMJj+nTt5WWE6DtolWuup4kLloO9tS/vE/g==", - "dependencies": { - "@solid-primitives/trigger": "@solid-primitives/trigger@1.0.10_solid-js@1.8.15__seroval@1.0.4", - "solid-js": "solid-js@1.8.15_seroval@1.0.4" - } - }, - "@solid-primitives/trigger@1.0.10_solid-js@1.8.15__seroval@1.0.4": { - "integrity": "sha512-gPNhmIBMxaJm2gWAAqUkpF5Vk6yZgaJ9+MFQN5eIRQ//GPIUqkNtSSar5sU+iG2I5QmS4iU7gOnvv3XvxXI1fg==", - "dependencies": { - "@solid-primitives/utils": "@solid-primitives/utils@6.2.3_solid-js@1.8.15__seroval@1.0.4", - "solid-js": "solid-js@1.8.15_seroval@1.0.4" - } - }, - "@solid-primitives/utils@6.2.3_solid-js@1.8.15__seroval@1.0.4": { - "integrity": "sha512-CqAwKb2T5Vi72+rhebSsqNZ9o67buYRdEJrIFzRXz3U59QqezuuxPsyzTSVCacwS5Pf109VRsgCJQoxKRoECZQ==", - "dependencies": { - "solid-js": "solid-js@1.8.15_seroval@1.0.4" - } - }, - "@types/node@18.16.19": { - "integrity": "sha512-IXl7o+R9iti9eBW4Wg2hx1xQDig183jj7YLn8F7udNceyfkbn1ZxmzZXuak20gR40D7pIkIY1kYGx5VIGbaHKA==", - "dependencies": {} - }, - "@types/ws@8.5.10": { - "integrity": "sha512-vmQSUcfalpIq0R9q7uTo2lXs6eGIpt9wtnLdMv9LVpIjCA/+ufZRozlVoVelIYixx1ugCBKDhn89vnsEGOCx9A==", - "dependencies": { - "@types/node": "@types/node@18.16.19" - } - }, - "@types/ws@8.5.4": { - "integrity": "sha512-zdQDHKUgcX/zBc4GrwsE/7dVdAD8JR4EuiAXiiUhhfyIJXXb2+PrGshFyeXWQPMmmZ2XxgaqclgpIC7eTXc1mg==", - "dependencies": { - "@types/node": "@types/node@18.16.19" - } - }, - "@vladfrangu/async_event_emitter@2.2.4": { - "integrity": "sha512-ButUPz9E9cXMLgvAW8aLAKKJJsPu1dY1/l/E8xzLFuysowXygs6GBcyunK9rnGC4zTsnIc2mQo71rGw9U+Ykug==", - "dependencies": {} - }, - "@williamhorning/revolt.js@7.0.0-beta.10_solid-js@1.8.15__seroval@1.0.4": { - "integrity": "sha512-w9rw5Z3HiHzwq3+QOxzceljzQAA1DUNg8lV+ClZw8CvkajLEIUn6C+9v8aEzSEz9ABaZCDA46KnrIPZN3l72Xw==", - "dependencies": { - "@solid-primitives/map": "@solid-primitives/map@0.4.10_solid-js@1.8.15__seroval@1.0.4", - "@solid-primitives/set": "@solid-primitives/set@0.4.10_solid-js@1.8.15__seroval@1.0.4", - "long": "long@5.2.3", - "revolt-api": "revolt-api@0.6.5", - "solid-js": "solid-js@1.8.15_seroval@1.0.4", - "ulid": "ulid@2.3.0", - "ws": "ws@8.16.0" - } - }, - "argparse@2.0.1": { - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dependencies": {} - }, - "asynckit@0.4.0": { - "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", - "dependencies": {} - }, - "axios@0.26.1": { - "integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==", - "dependencies": { - "follow-redirects": "follow-redirects@1.15.5" - } - }, - "call-bind@1.0.7": { - "integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==", - "dependencies": { - "es-define-property": "es-define-property@1.0.0", - "es-errors": "es-errors@1.3.0", - "function-bind": "function-bind@1.1.2", - "get-intrinsic": "get-intrinsic@1.2.4", - "set-function-length": "set-function-length@1.2.1" - } - }, - "combined-stream@1.0.8": { - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "dependencies": { - "delayed-stream": "delayed-stream@1.0.0" - } - }, - "csstype@3.1.3": { - "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==", - "dependencies": {} - }, - "define-data-property@1.1.4": { - "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", - "dependencies": { - "es-define-property": "es-define-property@1.0.0", - "es-errors": "es-errors@1.3.0", - "gopd": "gopd@1.0.1" - } - }, - "delayed-stream@1.0.0": { - "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", - "dependencies": {} - }, - "discord-api-types@0.37.61": { - "integrity": "sha512-o/dXNFfhBpYHpQFdT6FWzeO7pKc838QeeZ9d91CfVAtpr5XLK4B/zYxQbYgPdoMiTDvJfzcsLW5naXgmHGDNXw==", - "dependencies": {} - }, - "es-define-property@1.0.0": { - "integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==", - "dependencies": { - "get-intrinsic": "get-intrinsic@1.2.4" - } - }, - "es-errors@1.3.0": { - "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", - "dependencies": {} - }, - "follow-redirects@1.15.5": { - "integrity": "sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw==", - "dependencies": {} - }, - "form-data@4.0.0": { - "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", - "dependencies": { - "asynckit": "asynckit@0.4.0", - "combined-stream": "combined-stream@1.0.8", - "mime-types": "mime-types@2.1.35" - } - }, - "function-bind@1.1.2": { - "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", - "dependencies": {} - }, - "get-intrinsic@1.2.4": { - "integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==", - "dependencies": { - "es-errors": "es-errors@1.3.0", - "function-bind": "function-bind@1.1.2", - "has-proto": "has-proto@1.0.3", - "has-symbols": "has-symbols@1.0.3", - "hasown": "hasown@2.0.1" - } - }, - "globalyzer@0.1.0": { - "integrity": "sha512-40oNTM9UfG6aBmuKxk/giHn5nQ8RVz/SS4Ir6zgzOv9/qC3kKZ9v4etGTcJbEl/NyVQH7FGU7d+X1egr57Md2Q==", - "dependencies": {} - }, - "globrex@0.1.2": { - "integrity": "sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==", - "dependencies": {} - }, - "gopd@1.0.1": { - "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", - "dependencies": { - "get-intrinsic": "get-intrinsic@1.2.4" - } - }, - "guilded-api-typings@0.13.2": { - "integrity": "sha512-Fleko3u0WbYis/WyZoD/x6ZaqXiI4IYvVou+tLqHHLNWZGPvnNErEffxTb7q4QBzi4oX8KkKLAeMsmqpsnz5ew==", - "dependencies": {} - }, - "guilded.js@0.23.7": { - "integrity": "sha512-W7UkWqZhaIEtJmbe7cMXwTIuWlJ++vbOIluCQOfjayzScJx8o1KVmn3niAvONN/tJV/zNBJ5+pyXzMC8bhuEyQ==", - "dependencies": { - "@discordjs/collection": "@discordjs/collection@1.5.3", - "@guildedjs/api": "@guildedjs/api@0.3.2", - "typed-emitter": "typed-emitter@2.1.0" - } - }, - "has-property-descriptors@1.0.2": { - "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", - "dependencies": { - "es-define-property": "es-define-property@1.0.0" - } - }, - "has-proto@1.0.3": { - "integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==", - "dependencies": {} - }, - "has-symbols@1.0.3": { - "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", - "dependencies": {} - }, - "hasown@2.0.1": { - "integrity": "sha512-1/th4MHjnwncwXsIW6QMzlvYL9kG5e/CpVvLRZe4XPa8TOUNbCELqmvhDmnkNsAjwaG4+I8gJJL0JBvTTLO9qA==", - "dependencies": { - "function-bind": "function-bind@1.1.2" - } - }, - "js-yaml@4.1.0": { - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dependencies": { - "argparse": "argparse@2.0.1" - } - }, - "lodash.defaultsdeep@4.6.1": { - "integrity": "sha512-3j8wdDzYuWO3lM3Reg03MuQR957t287Rpcxp1njpEa8oDrikb+FwGdW3n+FELh/A6qib6yPit0j/pv9G/yeAqA==", - "dependencies": {} - }, - "long@5.2.3": { - "integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==", - "dependencies": {} - }, - "magic-bytes.js@1.10.0": { - "integrity": "sha512-/k20Lg2q8LE5xiaaSkMXk4sfvI+9EGEykFS4b0CHHGWqDYU0bGUFSwchNOMA56D7TCs9GwVTkqe9als1/ns8UQ==", - "dependencies": {} - }, - "mime-db@1.52.0": { - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", - "dependencies": {} - }, - "mime-types@2.1.35": { - "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", - "dependencies": { - "mime-db": "mime-db@1.52.0" - } - }, - "mime@3.0.0": { - "integrity": "sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==", - "dependencies": {} - }, - "node-fetch@2.6.11": { - "integrity": "sha512-4I6pdBY1EthSqDmJkiNk3JIT8cswwR9nfeW/cPdUagJYEQG7R95WRH74wpz7ma8Gh/9dI9FP+OU+0E4FvtA55w==", - "dependencies": { - "whatwg-url": "whatwg-url@5.0.0" - } - }, - "object-inspect@1.13.1": { - "integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==", - "dependencies": {} - }, - "openapi-typescript@5.4.1": { - "integrity": "sha512-AGB2QiZPz4rE7zIwV3dRHtoUC/CWHhUjuzGXvtmMQN2AFV8xCTLKcZUHLcdPQmt/83i22nRE7+TxXOXkK+gf4Q==", - "dependencies": { - "js-yaml": "js-yaml@4.1.0", - "mime": "mime@3.0.0", - "prettier": "prettier@2.8.8", - "tiny-glob": "tiny-glob@0.2.9", - "undici": "undici@5.27.2", - "yargs-parser": "yargs-parser@21.1.1" - } - }, - "prettier@2.8.8": { - "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", - "dependencies": {} - }, - "qs@6.11.2": { - "integrity": "sha512-tDNIz22aBzCDxLtVH++VnTfzxlfeK5CbqohpSqpJgj1Wg/cQbStNAz3NuqCs5vV+pjBsK4x4pN9HlVh7rcYRiA==", - "dependencies": { - "side-channel": "side-channel@1.0.5" - } - }, - "revolt-api@0.6.5": { - "integrity": "sha512-1PNcc6DvWplwt4v9unEKKVVqa/X2gE0yT0RgPR8pM5uerpzPKDhikrbr5zudqnoBQ1t+92rKKDdMMAeBWH0mUA==", - "dependencies": { - "@insertish/oapi": "@insertish/oapi@0.1.18", - "axios": "axios@0.26.1", - "lodash.defaultsdeep": "lodash.defaultsdeep@4.6.1" - } - }, - "rxjs@7.8.1": { - "integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==", - "dependencies": { - "tslib": "tslib@2.6.2" - } - }, - "seroval-plugins@1.0.4_seroval@1.0.4": { - "integrity": "sha512-DQ2IK6oQVvy8k+c2V5x5YCtUa/GGGsUwUBNN9UqohrZ0rWdUapBFpNMYP1bCyRHoxOJjdKGl+dieacFIpU/i1A==", - "dependencies": { - "seroval": "seroval@1.0.4" - } - }, - "seroval@1.0.4": { - "integrity": "sha512-qQs/N+KfJu83rmszFQaTxcoJoPn6KNUruX4KmnmyD0oZkUoiNvJ1rpdYKDf4YHM05k+HOgCxa3yvf15QbVijGg==", - "dependencies": {} - }, - "set-function-length@1.2.1": { - "integrity": "sha512-j4t6ccc+VsKwYHso+kElc5neZpjtq9EnRICFZtWyBsLojhmeF/ZBd/elqm22WJh/BziDe/SBiOeAt0m2mfLD0g==", - "dependencies": { - "define-data-property": "define-data-property@1.1.4", - "es-errors": "es-errors@1.3.0", - "function-bind": "function-bind@1.1.2", - "get-intrinsic": "get-intrinsic@1.2.4", - "gopd": "gopd@1.0.1", - "has-property-descriptors": "has-property-descriptors@1.0.2" - } - }, - "side-channel@1.0.5": { - "integrity": "sha512-QcgiIWV4WV7qWExbN5llt6frQB/lBven9pqliLXfGPB+K9ZYXxDozp0wLkHS24kWCm+6YXH/f0HhnObZnZOBnQ==", - "dependencies": { - "call-bind": "call-bind@1.0.7", - "es-errors": "es-errors@1.3.0", - "get-intrinsic": "get-intrinsic@1.2.4", - "object-inspect": "object-inspect@1.13.1" - } - }, - "solid-js@1.8.15_seroval@1.0.4": { - "integrity": "sha512-d0QP/efr3UVcwGgWVPveQQ0IHOH6iU7yUhc2piy8arNG8wxKmvUy1kFxyF8owpmfCWGB87usDKMaVnsNYZm+Vw==", - "dependencies": { - "csstype": "csstype@3.1.3", - "seroval": "seroval@1.0.4", - "seroval-plugins": "seroval-plugins@1.0.4_seroval@1.0.4" - } - }, - "tiny-glob@0.2.9": { - "integrity": "sha512-g/55ssRPUjShh+xkfx9UPDXqhckHEsHr4Vd9zX55oSdGZc/MD0m3sferOkwWtp98bv+kcVfEHtRJgBVJzelrzg==", - "dependencies": { - "globalyzer": "globalyzer@0.1.0", - "globrex": "globrex@0.1.2" - } - }, - "tr46@0.0.3": { - "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", - "dependencies": {} - }, - "tslib@2.6.2": { - "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", - "dependencies": {} - }, - "typed-emitter@2.1.0": { - "integrity": "sha512-g/KzbYKbH5C2vPkaXGu8DJlHrGKHLsM25Zg9WuC9pMGfuvT+X25tZQWo5fK1BjBm8+UrVE9LDCvaY0CQk+fXDA==", - "dependencies": { - "rxjs": "rxjs@7.8.1" - } - }, - "typescript@4.9.5": { - "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", - "dependencies": {} - }, - "ulid@2.3.0": { - "integrity": "sha512-keqHubrlpvT6G2wH0OEfSW4mquYRcbe/J8NMmveoQOjUqmo+hXtO+ORCpWhdbZ7k72UtY61BL7haGxW6enBnjw==", - "dependencies": {} - }, - "undici@5.27.2": { - "integrity": "sha512-iS857PdOEy/y3wlM3yRp+6SNQQ6xU0mmZcwRSriqk+et/cwWAtwmIGf6WkoDN2EK/AMdCO/dfXzIwi+rFMrjjQ==", - "dependencies": { - "@fastify/busboy": "@fastify/busboy@2.1.1" - } - }, - "webidl-conversions@3.0.1": { - "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", - "dependencies": {} - }, - "whatwg-url@5.0.0": { - "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", - "dependencies": { - "tr46": "tr46@0.0.3", - "webidl-conversions": "webidl-conversions@3.0.1" - } - }, - "ws@8.13.0": { - "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", - "dependencies": {} - }, - "ws@8.16.0": { - "integrity": "sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ==", - "dependencies": {} - }, - "yargs-parser@21.1.1": { - "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", - "dependencies": {} - } - } - }, - "remote": { - "https://deno.land/std@0.154.0/_util/assert.ts": "e94f2eb37cebd7f199952e242c77654e43333c1ac4c5c700e929ea3aa5489f74", - "https://deno.land/std@0.154.0/_wasm_crypto/lib/deno_std_wasm_crypto.generated.mjs": "dfcd6777d05345362c70f9f2c49abba3ed3f925fccfcf725abe2d16d51819433", - "https://deno.land/std@0.154.0/_wasm_crypto/mod.ts": "6c60d332716147ded0eece0861780678d51b560f533b27db2e15c64a4ef83665", - "https://deno.land/std@0.154.0/async/deferred.ts": "c01de44b9192359cebd3fe93273fcebf9e95110bf3360023917da9a2d1489fae", - "https://deno.land/std@0.154.0/bytes/bytes_list.ts": "aba5e2369e77d426b10af1de0dcc4531acecec27f9b9056f4f7bfbf8ac147ab4", - "https://deno.land/std@0.154.0/bytes/equals.ts": "3c3558c3ae85526f84510aa2b48ab2ad7bdd899e2e0f5b7a8ffc85acb3a6043a", - "https://deno.land/std@0.154.0/bytes/mod.ts": "763f97d33051cc3f28af1a688dfe2830841192a9fea0cbaa55f927b49d49d0bf", - "https://deno.land/std@0.154.0/crypto/_fnv/fnv32.ts": "aa9bddead8c6345087d3abd4ef35fb9655622afc333fc41fff382b36e64280b5", - "https://deno.land/std@0.154.0/crypto/_fnv/fnv64.ts": "625d7e7505b6cb2e9801b5fd6ed0a89256bac12b2bbb3e4664b85a88b0ec5bef", - "https://deno.land/std@0.154.0/crypto/_fnv/index.ts": "a8f6a361b4c6d54e5e89c16098f99b6962a1dd6ad1307dbc97fa1ecac5d7060a", - "https://deno.land/std@0.154.0/crypto/_fnv/util.ts": "4848313bed7f00f55be3cb080aa0583fc007812ba965b03e4009665bde614ce3", - "https://deno.land/std@0.154.0/crypto/keystack.ts": "e481eed28007395e554a435e880fee83a5c73b9259ed8a135a75e4b1e4f381f7", - "https://deno.land/std@0.154.0/crypto/mod.ts": "0ef11f063cd0f9759485a3c9051e15125e1bde3b47c23b47e79b6e13cfcf9481", - "https://deno.land/std@0.154.0/crypto/timing_safe_equal.ts": "82a29b737bc8932d75d7a20c404136089d5d23629e94ba14efa98a8cc066c73e", - "https://deno.land/std@0.154.0/encoding/base64.ts": "c57868ca7fa2fbe919f57f88a623ad34e3d970d675bdc1ff3a9d02bba7409db2", - "https://deno.land/std@0.154.0/encoding/base64url.ts": "a5f82a9fa703bd85a5eb8e7c1296bc6529e601ebd9642cc2b5eaa6b38fa9e05a", - "https://deno.land/std@0.154.0/encoding/hex.ts": "4cc5324417cbb4ac9b828453d35aed45b9cc29506fad658f1f138d981ae33795", - "https://deno.land/std@0.154.0/fmt/colors.ts": "ff7dc9c9f33a72bd48bc24b21bbc1b4545d8494a431f17894dbc5fe92a938fc4", - "https://deno.land/std@0.154.0/io/buffer.ts": "fae02290f52301c4e0188670e730cd902f9307fb732d79c4aa14ebdc82497289", - "https://deno.land/std@0.154.0/io/files.ts": "d199ef64e918a256320ba8d8d44ae91de87c9077df8f8d6cca013f1b9fbbe285", - "https://deno.land/std@0.154.0/io/mod.ts": "33507cf2460ab67d0d90fb5749fa6fecb33897642b49d54a6bb1ac81e4768f69", - "https://deno.land/std@0.154.0/io/readers.ts": "45847ad404afd2f605eae1cff193f223462bc55eeb9ae313c2f3db28aada0fd6", - "https://deno.land/std@0.154.0/io/streams.ts": "988a19155b52161f0035ce539e2f1d12edbc4c389fa7633da832a64e6edbe1a0", - "https://deno.land/std@0.154.0/io/util.ts": "078da53bba767bec0d45f7da44411f6dbf269e51ef7fcfea5e3714e04681c674", - "https://deno.land/std@0.154.0/io/writers.ts": "2e1c63ffd0cfba411b1fd8374609abff9ea86187c9d4d885d42e6fc20325ef0e", - "https://deno.land/std@0.154.0/streams/conversion.ts": "fc4eb76a14148c43f0b85e903a5a1526391aa40ed9434dc21e34f88304eb823e", - "https://deno.land/std@0.154.0/testing/_diff.ts": "141f978a283defc367eeee3ff7b58aa8763cf7c8e0c585132eae614468e9d7b8", - "https://deno.land/std@0.154.0/testing/_format.ts": "cd11136e1797791045e639e9f0f4640d5b4166148796cad37e6ef75f7d7f3832", - "https://deno.land/std@0.154.0/testing/asserts.ts": "ac295f7fd22a7af107580e2475402a8c386cb1bf18bf837ae266ac0665786026", - "https://deno.land/std@0.203.0/bytes/bytes_list.ts": "ecf5098c230b793970f43c06e8f30d70b937c031658365aeb3de9a8ae4d406a3", - "https://deno.land/std@0.203.0/bytes/concat.ts": "d26d6f3d7922e6d663dacfcd357563b7bf4a380ce5b9c2bbe0c8586662f25ce2", - "https://deno.land/std@0.203.0/collections/chunk.ts": "f82c52a82ad9338018570c42f6de0fb132fcb14914c31a444e360ac104d7b55b", - "https://deno.land/std@0.203.0/io/read_delim.ts": "8ea988eac1503c7118bfcf00b4e4a422450548af8e18328f6f599553cfe78012", - "https://deno.land/std@0.203.0/streams/write_all.ts": "4cdd36256f892fe7aead46338054f6ea813a63765e87bda4c60e8c5a57d1c5c1", - "https://deno.land/x/mongo@v0.32.0/deps.ts": "1b53a32fbc115195d74ab78e7d21026ea4b6590e5b558b388017cc1a9b8181e6", - "https://deno.land/x/mongo@v0.32.0/mod.ts": "0989f34d08c40440b8786140abdaf863e964e23df5d1a80e661d3d4170d9d21e", - "https://deno.land/x/mongo@v0.32.0/src/auth/base.ts": "7fe14cf0a63d6bbc4ba69a000a04b3b184d26842504d94652a6af2d0c9494944", - "https://deno.land/x/mongo@v0.32.0/src/auth/mod.ts": "b161611bd5be9e9d1b4497227c8ea93ad4daadcd98038c9e5a707bc5da7a25ca", - "https://deno.land/x/mongo@v0.32.0/src/auth/pbkdf2.ts": "1f1db192fd37869d118ab34780b64567ebcf0ad83a03ef28b3d740cae9adb47a", - "https://deno.land/x/mongo@v0.32.0/src/auth/scram.ts": "187db02e94e7e5423ec902e87d6839028770dca57830dca7f154dcd22a959c0f", - "https://deno.land/x/mongo@v0.32.0/src/auth/x509.ts": "a75b27c549707dd441434ae400a3e6a24da7fe7d4e0e80c9bb79dfc6426b651e", - "https://deno.land/x/mongo@v0.32.0/src/client.ts": "368cac10b3df3bfbc2dfba468d1bbd1332c359a643e0bb81a13d7220a58b43ff", - "https://deno.land/x/mongo@v0.32.0/src/cluster.ts": "cff69bf284a5c7fcaff231494f1ab56ca652e725e58622723e402fbb61448d0e", - "https://deno.land/x/mongo@v0.32.0/src/collection/collection.ts": "6748479b4e9992f9f2ce8e22f891f8917349c1a0e53cb89da5a66cf2b44b9016", - "https://deno.land/x/mongo@v0.32.0/src/collection/commands/aggregate.ts": "440906a670adb46edb36fd95573ffa83f192775108b621520be992165910e895", - "https://deno.land/x/mongo@v0.32.0/src/collection/commands/find.ts": "5c3b750d8c82ce08d865a381bc71f600406cbc4912c4aa689238755579fb71f8", - "https://deno.land/x/mongo@v0.32.0/src/collection/commands/list_indexes.ts": "d32a5120305d0547497026b4f5ab2ecc2f40ff7f44c405b99c2a0287765333f5", - "https://deno.land/x/mongo@v0.32.0/src/collection/commands/update.ts": "cf352108a5dd34f0928c2196a432383d366b8ed292676c71358b9ecf1289418d", - "https://deno.land/x/mongo@v0.32.0/src/collection/mod.ts": "bd791a0b9b46be4365f88c54893584eadec2f8cd799db9eb05e0b5b4c8d72b8e", - "https://deno.land/x/mongo@v0.32.0/src/database.ts": "c7b677beddd3eb16f79e8d3c9473b5f86e45541b8a04cc896aabe04d029fa7a0", - "https://deno.land/x/mongo@v0.32.0/src/error.ts": "8180a822b0831a94a6a28815865b5b40e3996220684bea60fcb81b272ddd06eb", - "https://deno.land/x/mongo@v0.32.0/src/gridfs/bucket.ts": "a4452d63f6928f57486a214a499b54b80b98cc0d13e3d85a6841b34d5ff12a61", - "https://deno.land/x/mongo@v0.32.0/src/gridfs/indexes.ts": "7d302114fb4d81c4a873614a51d11ddb8b471f967179dddb8269c39b3cadf4e3", - "https://deno.land/x/mongo@v0.32.0/src/gridfs/upload.ts": "6a54a21b00c6f22ad0da6ceef7a2932dc600560f594c2551abd8e4a64976abae", - "https://deno.land/x/mongo@v0.32.0/src/protocol/cursor.ts": "c370a28856fa236129cc2d7abf7ebc4ac6cdd60acb93e0e7371433f7332394cb", - "https://deno.land/x/mongo@v0.32.0/src/protocol/handshake.ts": "3c3ba547d5322751b9756ce9a4750f3cf18febee0a64edca5b007634bd80e0fe", - "https://deno.land/x/mongo@v0.32.0/src/protocol/header.ts": "0f28db842f886e57b7013606c1391affab2e2960a1a4568d2502e7b788117716", - "https://deno.land/x/mongo@v0.32.0/src/protocol/message.ts": "7b4e38489070fc6281d1b3f13e99504310f09273baa8bcb11d82b1e30ea04202", - "https://deno.land/x/mongo@v0.32.0/src/protocol/mod.ts": "4e24d563049c0a236234598ca786ca13778dc17fdb80ac543ac6c75d0c5094d7", - "https://deno.land/x/mongo@v0.32.0/src/protocol/protocol.ts": "92568dd86e6ef3f54054113d9f5620f158fc1dfee2a7c9d13623975835d5996a", - "https://deno.land/x/mongo@v0.32.0/src/types.ts": "355c91b0abc0c77aa1f8fd0dcfcbc47505518f561b72d8fefd4a929b12bc7e48", - "https://deno.land/x/mongo@v0.32.0/src/types/geojson.ts": "14690e2fa1591939253ddc9de181b0664051e9462db131b72be5fb9d064dff44", - "https://deno.land/x/mongo@v0.32.0/src/types/geospatial.ts": "c73ee13536365fa5d868b65ab47b3488a5f223a67e1e059761886f750db70ef9", - "https://deno.land/x/mongo@v0.32.0/src/types/gridfs.ts": "e1fd12c3ca58d437267e7a8557d745d23b9d8916d1da34c1847e5e373728dfa0", - "https://deno.land/x/mongo@v0.32.0/src/types/read_write_concern.ts": "d00f35eb85520e776741888685d08d479766a19e9a0a970b53f4594c9db00496", - "https://deno.land/x/mongo@v0.32.0/src/utils/ns.ts": "fb0c57b8dc4d31f8993112d267dec3c163d3e8862198d1cd03b2b51bcc3caad9", - "https://deno.land/x/mongo@v0.32.0/src/utils/saslprep/deps.ts": "95ceb81b353110526dacf2a98854bc79d6e17d7f173af8806e91c05555d7b8c7", - "https://deno.land/x/mongo@v0.32.0/src/utils/saslprep/load_code_points.ts": "f6a4ef2eb2345eac40ffbf1a30661cca803f399865f2a0fadafb71f57d4c97bf", - "https://deno.land/x/mongo@v0.32.0/src/utils/saslprep/memory_pager.ts": "f55a79a13ec569c21630c3915a9af0c6fc0aa2b899121fa2a85a813c6dd4afba", - "https://deno.land/x/mongo@v0.32.0/src/utils/saslprep/mod.ts": "0a8a39a0784d065a79c54ce63d7d7b103d0b94addc5b7bcf985517ba2442c8a1", - "https://deno.land/x/mongo@v0.32.0/src/utils/saslprep/sparse_bitfield.ts": "07d6fe2ecd4ba5f711c44c1ae409bb9c1fe3a3cfc09e27434d231d4aae46dd2d", - "https://deno.land/x/mongo@v0.32.0/src/utils/srv.ts": "ed5f78ffe6480faac68291a87e51e3674eff5f28aec937ee97248e99e1317b16", - "https://deno.land/x/mongo@v0.32.0/src/utils/uri.ts": "dcfab8e1dcfcc875c75ada1d9f366664480c03b65594990d6342ed88925452e5", - "https://deno.land/x/r2d2@v2.0.0/mod.ts": "9dd57845ed23db1a80e8df3ebaec4bd1ff1a39bbf533b4ee2a40f9c895cd662b", - "https://deno.land/x/web_bson@v0.3.0/mod.js": "8e14aecd31ee63abd30e2dbaa284b4b67abb7ba51fcef5b96af74727cb7c7940" - }, - "workspace": { - "dependencies": [ - "jsr:@cross/env@^0.2.7", - "jsr:@cross/utils@^0.5.0", - "jsr:@denosaurs/event@^2.0.2", - "jsr:@std/assert@^0.219.1", - "jsr:@std/cli@^0.219.1" - ] - } -} diff --git a/packages/bolt/bolt.ts b/packages/bolt/lightning.ts similarity index 87% rename from packages/bolt/bolt.ts rename to packages/bolt/lightning.ts index 3bd9fc3..0fdfb47 100644 --- a/packages/bolt/bolt.ts +++ b/packages/bolt/lightning.ts @@ -11,8 +11,8 @@ import { plugin_events } from './utils/mod.ts'; -/** an instance of bolt */ -export class Bolt extends EventEmitter { +/** an instance of lightning */ +export class lightning extends EventEmitter { bridge: bridges; /** a command handler */ cmds: commands = new commands(); @@ -43,7 +43,9 @@ export class Bolt extends EventEmitter { if (!plugin.support.includes('0.5.5')) { throw ( await log_error( - new Error(`plugin '${plugin.name}' doesn't support bolt 0.5.5`) + new Error( + `plugin '${plugin.name}' doesn't support lightning 0.5.5 or above` + ) ) ).e; } else { diff --git a/packages/bolt/mod.ts b/packages/bolt/mod.ts index 51f7bd6..cdb8228 100644 --- a/packages/bolt/mod.ts +++ b/packages/bolt/mod.ts @@ -9,4 +9,11 @@ export { type bridge_settings } from './bridges/types.ts'; export * from './utils/mod.ts'; -export { Bolt } from './bolt.ts'; +export { + lightning, + /** + * TODO: remove in 0.7.0 + * @deprecated will be removed in 0.7.0 + */ + lightning as Bolt +} from './lightning.ts'; diff --git a/packages/bolt/utils/_fourbetafive.ts b/packages/bolt/utils/_fourbetafive.ts index ab06423..88378e5 100644 --- a/packages/bolt/utils/_fourbetafive.ts +++ b/packages/bolt/utils/_fourbetafive.ts @@ -30,6 +30,7 @@ export default { }; function map_plugins(pluginname: string): string { + // the use of bolt is intentional if (pluginname === 'discord') return 'bolt-discord'; if (pluginname === 'guilded') return 'bolt-guilded'; if (pluginname === 'revolt') return 'bolt-revolt'; diff --git a/packages/bolt/utils/commands.ts b/packages/bolt/utils/commands.ts index f92fe91..66ff97f 100644 --- a/packages/bolt/utils/commands.ts +++ b/packages/bolt/utils/commands.ts @@ -1,12 +1,15 @@ -import { Bolt } from '../bolt.ts'; +import { lightning } from '../lightning.ts'; import { log_error } from './errors.ts'; import { parseArgs } from 'std_args'; import { create_message, message } from './messages.ts'; /** - * commands implements simple command handling for bolt that others may find useful + * commands implements simple command handling for lightning that others may find useful */ export class commands extends Map { + // TODO: make this configurable + prefix = '!bolt'; + /** * creates a command handler instance with the given commands * @param default_cmds - the commands to use by default, should include help as a fallback command @@ -16,11 +19,11 @@ export class commands extends Map { } /** - * listen for commands on the given bolt instance + * listen for commands on the given lightning instance */ - listen(bolt: Bolt) { - bolt.on('create_nonbridged_message', msg => { - if (msg.content?.startsWith('!bolt')) { + listen(l: lightning) { + l.on('create_nonbridged_message', msg => { + if (msg.content?.startsWith(this.prefix)) { const args = parseArgs(msg.content.split(' ')); args._.shift(); this.run({ @@ -35,7 +38,7 @@ export class commands extends Map { } }); - bolt.on('create_command', async cmd => { + l.on('create_command', async cmd => { await this.run(cmd); }); } @@ -43,7 +46,7 @@ export class commands extends Map { /** * run a command given the options that would be passed to it */ - async run(opts: command_arguments) { + async run(opts: Omit) { let reply; try { const cmd = this.get(opts.cmd) || this.get('help')!; @@ -52,7 +55,7 @@ export class commands extends Map { ? cmd.options.subcommands.find(i => i.name === opts.subcmd) ?.execute || cmd.execute : cmd.execute; - reply = await execute(opts); + reply = await execute({ ...opts, commands: this }); } catch (e) { reply = (await log_error(e, { ...opts, reply: undefined })).message; } @@ -64,6 +67,8 @@ export class commands extends Map { } } +// TODO: remove in 0.7.0 and make its own package + const default_commands: [string, command][] = [ [ 'help', @@ -80,8 +85,8 @@ const default_commands: [string, command][] = [ 'version', { name: 'version', - description: "get bolt's version", - execute: () => create_message('hello from bolt 0.5.8!') + description: "get lightning's version", + execute: () => create_message('hello from lightning (bolt) v0.6.0!') } ], [ @@ -107,6 +112,7 @@ export interface command_arguments { replyfn: message['reply']; subcmd?: string; timestamp: Temporal.Instant; + commands: commands; } export interface command { diff --git a/packages/bolt/utils/config.ts b/packages/bolt/utils/config.ts index 75a56cd..d7612df 100644 --- a/packages/bolt/utils/config.ts +++ b/packages/bolt/utils/config.ts @@ -3,10 +3,9 @@ import { create_plugin } from './plugins.ts'; /** a function that returns a config object when given a partial config object */ export function define_config(config?: Partial): config { return { - prod: false, plugins: [], mongo_uri: 'mongodb://localhost:27017', - mongo_database: config?.prod ? 'bolt' : 'bolt-testing', + mongo_database: 'lightning', redis_host: 'localhost', redis_port: 6379, ...(config || {}) @@ -14,11 +13,6 @@ export function define_config(config?: Partial): config { } export interface config { - /** - * whether or not bolt is in production mode - * @deprecated - * */ - prod: boolean; /** a list of plugins */ plugins: { type: create_plugin; config: unknown }[]; /** the URI that points to your instance of mongodb */ diff --git a/packages/bolt/utils/errors.ts b/packages/bolt/utils/errors.ts index 3a9bec6..5867722 100644 --- a/packages/bolt/utils/errors.ts +++ b/packages/bolt/utils/errors.ts @@ -17,7 +17,7 @@ export async function log_error( message: message; }> { const uuid = _id(); - const error_hook = Deno.env.get('BOLT_ERROR_HOOK') || ''; + const error_hook = Deno.env.get('LIGHTNING_ERROR_HOOK') || ''; if (error_hook !== '') { delete extra.msg; @@ -42,7 +42,7 @@ export async function log_error( ).text(); } - console.error(`%cBolt Error ${uuid}`, 'color: red', e, extra); + console.error(`%cLightning Error ${uuid}`, 'color: red', e, extra); return { e, diff --git a/packages/bolt/utils/messages.ts b/packages/bolt/utils/messages.ts index 335c466..9beb69d 100644 --- a/packages/bolt/utils/messages.ts +++ b/packages/bolt/utils/messages.ts @@ -1,15 +1,16 @@ /** - * creates a message that can be sent using bolt + * creates a message that can be sent using lightning * @param text the text of the message (can be markdown) */ export function create_message(text: string): message { const data = { author: { + // TODO: make this configurable username: 'Bolt', profile: 'https://cdn.discordapp.com/icons/1011741670510968862/2d4ce9ff3f384c027d8781fa16a38b07.png?size=1024', - rawname: 'bolt', - id: 'bolt' + rawname: 'lightning', + id: 'lightning' }, content: text, channel: '', @@ -17,7 +18,7 @@ export function create_message(text: string): message { reply: async () => {}, timestamp: Temporal.Now.instant(), platform: { - name: 'bolt', + name: 'lightning', message: undefined } }; @@ -35,7 +36,7 @@ export interface attachment { spoiler?: boolean; /** * file size - * @deprecated + * @deprecated will be removed in 0.7.0 */ size: number; } diff --git a/packages/bolt/utils/mod.ts b/packages/bolt/utils/mod.ts index 2724de9..ed5c4da 100644 --- a/packages/bolt/utils/mod.ts +++ b/packages/bolt/utils/mod.ts @@ -1,5 +1,5 @@ /** - * Various utilities for Bolt + * Various utilities for lightning * @module */ diff --git a/packages/bolt/utils/plugins.ts b/packages/bolt/utils/plugins.ts index 32a5cfd..2f5190e 100644 --- a/packages/bolt/utils/plugins.ts +++ b/packages/bolt/utils/plugins.ts @@ -1,28 +1,34 @@ import { EventEmitter } from 'event'; -import { Bolt } from '../bolt.ts'; +import { lightning } from '../lightning.ts'; import { bridge_platform } from '../bridges/types.ts'; import { message, deleted_message } from './messages.ts'; import { command_arguments } from './commands.ts'; /** - * a plugin for bolt + * a plugin for lightning */ export abstract class plugin extends EventEmitter { - /** access the instance of bolt you're connected to */ - bolt: Bolt; - /** access the config passed to you by bolt */ + /** + * access the instance of lightning you're connected to + * @deprecated use `l` instead, will be removed in 0.7.0 + */ + bolt: lightning; + /** access the instance of lightning you're connected to */ + lightning: lightning; + /** access the config passed to you by lightning */ config: cfg; /** the name of your plugin */ abstract name: string; /** the version of your plugin */ abstract version: string; - /** a list of major versions supported by your plugin, should include 0.5 */ + /** a list of major versions supported by your plugin, should include 0.5.5 */ abstract support: string[]; - constructor(bolt: Bolt, config: cfg) { + constructor(l: lightning, config: cfg) { super(); - this.bolt = bolt; + this.bolt = l; + this.lightning = l; this.config = config; } @@ -68,6 +74,6 @@ export type plugin_events = { /** the constructor for a plugin */ export interface create_plugin { - new (bolt: Bolt, config: unknown): plugin; + new (l: lightning, config: unknown): plugin; readonly prototype: plugin; } From e9e021babbea66b09d695a158404a746bbd51123 Mon Sep 17 00:00:00 2001 From: Jersey Date: Sun, 17 Mar 2024 18:03:42 -0400 Subject: [PATCH 08/13] make vscodes lsp shut up, redo plugin config, other fun stuff Signed-off-by: Jersey --- deno.jsonc | 9 +++++++++ docker-compose.example.yml | 2 +- dockerfile | 12 ++++++------ packages/bolt-discord/_deps.ts | 2 +- packages/bolt-discord/commands.ts | 10 +++++----- packages/bolt-discord/mod.ts | 8 ++++---- packages/bolt-guilded/_deps.ts | 2 +- packages/bolt-guilded/legacybridging.ts | 18 ++++++++++-------- packages/bolt-guilded/mod.ts | 11 ++++++----- packages/bolt-revolt/deps.ts | 2 +- packages/bolt-revolt/mod.ts | 6 +++--- packages/bolt/utils/config.ts | 3 ++- packages/bolt/utils/plugins.ts | 15 +++++++++++---- 13 files changed, 60 insertions(+), 40 deletions(-) create mode 100644 deno.jsonc diff --git a/deno.jsonc b/deno.jsonc new file mode 100644 index 0000000..2c40bb6 --- /dev/null +++ b/deno.jsonc @@ -0,0 +1,9 @@ +{ + "imports": { + "assert_eq": "jsr:@std/assert@^0.219.1/assert_equals", + "event": "jsr:@denosaurs/event@^2.0.2", + "mongo": "https://deno.land/x/mongo@v0.32.0/mod.ts", + "r2d2": "https://deno.land/x/r2d2@v2.0.0/mod.ts", + "std_args": "jsr:@std/cli@^0.219.1/parse_args" + } +} diff --git a/docker-compose.example.yml b/docker-compose.example.yml index 5bf9f8a..bf12648 100644 --- a/docker-compose.example.yml +++ b/docker-compose.example.yml @@ -1,7 +1,7 @@ version: '2' services: - bolt: + lightning: build: . volumes: - ./config/data:/app/data diff --git a/dockerfile b/dockerfile index 5f1a289..2fc3a83 100644 --- a/dockerfile +++ b/dockerfile @@ -1,12 +1,12 @@ -ARG DENO_VERSION=v1.40.4 +ARG DENO_VERSION=v1.41.3 -FROM docker.io/lukechannings/deno:${DENO_VERSION} +FROM docker.io/denoland/deno:${DENO_VERSION} -# add bolt to the image +# add lightning to the image WORKDIR /app ADD ./packages/bolt /app -RUN deno install -A --unstable-temporal -n bolt /app/cli.ts +RUN deno install -A --unstable-temporal -n lightning /app/cli.ts -# set bolt as the entrypoint and use the run command by default -ENTRYPOINT [ "bolt" ] +# set lightning as the entrypoint and use the run command by default +ENTRYPOINT [ "lightning" ] CMD [ "--run", "--config", "./data/config.ts"] diff --git a/packages/bolt-discord/_deps.ts b/packages/bolt-discord/_deps.ts index ba751c4..3a4888b 100644 --- a/packages/bolt-discord/_deps.ts +++ b/packages/bolt-discord/_deps.ts @@ -10,7 +10,7 @@ export { export { REST as rest, type RawFile } from 'npm:@discordjs/rest@2.2.0'; export { WebSocketManager as socket } from 'npm:@discordjs/ws@1.0.2'; export { - Bolt, + lightning, plugin, type bridge_platform, type deleted_message, diff --git a/packages/bolt-discord/commands.ts b/packages/bolt-discord/commands.ts index 36d9ca1..13e8efe 100644 --- a/packages/bolt-discord/commands.ts +++ b/packages/bolt-discord/commands.ts @@ -1,14 +1,14 @@ -import { API, Bolt, cmd_body } from './_deps.ts'; +import { API, lightning, cmd_body } from './_deps.ts'; import { discord_config } from './mod.ts'; export async function register_commands( config: discord_config, api: API, - bolt: Bolt + l: lightning ) { if (!config.slash_cmds) return; - const data: cmd_body = [...bolt.cmds.values()].map(command => { + const data: cmd_body = [...l.cmds.values()].map(command => { const opts = []; if (command.options?.argument_name) { @@ -35,7 +35,7 @@ export async function register_commands( type: 3, required: i.options.argument_required || false } - ] + ] : undefined }; }) @@ -45,7 +45,7 @@ export async function register_commands( return { name: command.name, type: 1, - description: command.description || 'a bolt command', + description: command.description || 'a command', options: opts }; }); diff --git a/packages/bolt-discord/mod.ts b/packages/bolt-discord/mod.ts index c0740c0..a7da985 100644 --- a/packages/bolt-discord/mod.ts +++ b/packages/bolt-discord/mod.ts @@ -1,5 +1,5 @@ import { - Bolt, + lightning, Client, plugin, bridge_platform, @@ -24,8 +24,8 @@ export class discord_plugin extends plugin { version = '0.5.8'; support = ['0.5.5']; - constructor(bolt: Bolt, config: discord_config) { - super(bolt, config); + constructor(l: lightning, config: discord_config) { + super(l, config); this.config = config; const rest_client = new rest({ version: '10' }).setToken(config.token); const gateway = new socket({ @@ -35,7 +35,7 @@ export class discord_plugin extends plugin { }); this.bot = new Client({ rest: rest_client, gateway }); register_events(this); - register_commands(this.config, this.bot.api, bolt); + register_commands(this.config, this.bot.api, l); gateway.connect(); } diff --git a/packages/bolt-guilded/_deps.ts b/packages/bolt-guilded/_deps.ts index 1d9cfed..3aa260e 100644 --- a/packages/bolt-guilded/_deps.ts +++ b/packages/bolt-guilded/_deps.ts @@ -12,7 +12,7 @@ export { type WebhookPayload } from 'npm:guilded.js@0.23.7'; export { - Bolt, + lightning, plugin, create_message, type bridge_platform, diff --git a/packages/bolt-guilded/legacybridging.ts b/packages/bolt-guilded/legacybridging.ts index 0652e20..0de0ee5 100644 --- a/packages/bolt-guilded/legacybridging.ts +++ b/packages/bolt-guilded/legacybridging.ts @@ -25,10 +25,10 @@ export async function bridge_legacy( await guilded.bot.messages.send( senddata, toguildedid( - create_message({ - text: `In the next major version of Bolt, embed-based bridges like this one won't be supported anymore. - See https://github.com/williamhorning/bolt/issues/36 for more information.` - }) + create_message( + `In the next major version of bolt-guilded, embed-based bridges like this one won't be supported anymore. + See https://github.com/williamhorning/bolt/issues/36 for more information.` + ) ) ); } @@ -36,12 +36,14 @@ export async function bridge_legacy( } async function migrate_bridge(channel: string, guilded: guilded_plugin) { - if (!guilded.bolt.db.redis.get(`guilded-embed-migration-${channel}`)) { - await guilded.bolt.db.redis.set( + if (!guilded.lightning.redis.get(`guilded-embed-migration-${channel}`)) { + await guilded.lightning.redis.set( `guilded-embed-migration-${channel}`, 'true' ); - const current = await guilded.bolt.bridge.get_bridge({ channel: channel }); + const current = await guilded.lightning.bridge.get_bridge({ + channel: channel + }); if (current) { current.platforms[ current.platforms.findIndex(i => i.channel === channel) @@ -50,7 +52,7 @@ async function migrate_bridge(channel: string, guilded: guilded_plugin) { plugin: 'bolt-guilded', senddata: await guilded.create_bridge(channel) }; - await guilded.bolt.bridge.update_bridge(current); + await guilded.lightning.bridge.update_bridge(current); } } } diff --git a/packages/bolt-guilded/mod.ts b/packages/bolt-guilded/mod.ts index 79f8390..395b908 100644 --- a/packages/bolt-guilded/mod.ts +++ b/packages/bolt-guilded/mod.ts @@ -1,5 +1,5 @@ import { - Bolt, + lightning, Client, WebhookPayload, WebhookClient, @@ -17,8 +17,8 @@ export class guilded_plugin extends plugin<{ token: string }> { version = '0.5.8'; support = ['0.5.5']; - constructor(bolt: Bolt, config: { token: string }) { - super(bolt, config); + constructor(l: lightning, config: { token: string }) { + super(l, config); this.bot = new Client(config); this.bot.on('ready', () => { this.emit('ready'); @@ -61,7 +61,8 @@ export class guilded_plugin extends plugin<{ token: string }> { }); const srvhooks = (await srvwhs.json()).webhooks; const found_wh = srvhooks.find((wh: WebhookPayload) => { - if (wh.name === 'Bolt Bridges' && wh.channelId === channel) return true; + if (wh.name === 'Lightning Bridges' && wh.channelId === channel) + return true; return false; }); if (found_wh && found_wh.token) @@ -75,7 +76,7 @@ export class guilded_plugin extends plugin<{ token: string }> { 'Content-Type': 'application/json' }, body: JSON.stringify({ - name: 'Bolt Bridges', + name: 'Lightning Bridges', channelId: channel }) } diff --git a/packages/bolt-revolt/deps.ts b/packages/bolt-revolt/deps.ts index b0734a0..5696b23 100644 --- a/packages/bolt-revolt/deps.ts +++ b/packages/bolt-revolt/deps.ts @@ -10,7 +10,7 @@ export { UserSystemMessage } from 'npm:@williamhorning/revolt.js@7.0.0-beta.10'; export { - Bolt, + lightning, plugin, type bridge_platform, type message diff --git a/packages/bolt-revolt/mod.ts b/packages/bolt-revolt/mod.ts index 84621ca..ff73cc7 100644 --- a/packages/bolt-revolt/mod.ts +++ b/packages/bolt-revolt/mod.ts @@ -1,5 +1,5 @@ import { - Bolt, + lightning, Client, Message, plugin, @@ -14,8 +14,8 @@ export class revolt_plugin extends plugin<{ token: string }> { version = '0.5.8'; support = ['0.5.5']; - constructor(bolt: Bolt, config: { token: string }) { - super(bolt, config); + constructor(l: lightning, config: { token: string }) { + super(l, config); this.bot = new Client(); this.bot.on('messageCreate', message => { if (message.systemMessage) return; diff --git a/packages/bolt/utils/config.ts b/packages/bolt/utils/config.ts index d7612df..1dab495 100644 --- a/packages/bolt/utils/config.ts +++ b/packages/bolt/utils/config.ts @@ -14,7 +14,8 @@ export function define_config(config?: Partial): config { export interface config { /** a list of plugins */ - plugins: { type: create_plugin; config: unknown }[]; + // deno-lint-ignore no-explicit-any + plugins: create_plugin[]; /** the URI that points to your instance of mongodb */ mongo_uri: string; /** the database to use */ diff --git a/packages/bolt/utils/plugins.ts b/packages/bolt/utils/plugins.ts index 2f5190e..007f73b 100644 --- a/packages/bolt/utils/plugins.ts +++ b/packages/bolt/utils/plugins.ts @@ -25,6 +25,13 @@ export abstract class plugin extends EventEmitter { /** a list of major versions supported by your plugin, should include 0.5.5 */ abstract support: string[]; + /** create a new plugin instance */ + static new>( + this: new (l: lightning, config: T['config']) => T, + config: T['config'] + ): create_plugin { + return { type: this, config }; + } constructor(l: lightning, config: cfg) { super(); this.bolt = l; @@ -61,7 +68,7 @@ export type plugin_events = { /** when a message is created */ create_message: [message]; /** when a command is run (not a text command) */ - create_command: [command_arguments]; + create_command: [Omit]; /** when a message isn't already bridged (don't emit outside of core) */ create_nonbridged_message: [message]; /** when a message is edited */ @@ -73,7 +80,7 @@ export type plugin_events = { }; /** the constructor for a plugin */ -export interface create_plugin { - new (l: lightning, config: unknown): plugin; - readonly prototype: plugin; +export interface create_plugin> { + type: new (l: lightning, config: T['config']) => T; + config: T['config']; } From 70fda7fa2acb851dda979d099ef36a192172f91f Mon Sep 17 00:00:00 2001 From: Jersey Date: Sun, 17 Mar 2024 18:20:10 -0400 Subject: [PATCH 09/13] update various versions Signed-off-by: Jersey --- .github/workflows/{docker.yml => publish.yml} | 30 +++++++++---- packages/bolt-discord/mod.ts | 2 +- packages/bolt-guilded/mod.ts | 2 +- packages/bolt-revolt/mod.ts | 2 +- packages/bolt/cli.ts | 4 +- packages/bolt/deno.jsonc | 42 +++++++++---------- packages/bolt/lightning.ts | 4 +- 7 files changed, 51 insertions(+), 35 deletions(-) rename .github/workflows/{docker.yml => publish.yml} (60%) diff --git a/.github/workflows/docker.yml b/.github/workflows/publish.yml similarity index 60% rename from .github/workflows/docker.yml rename to .github/workflows/publish.yml index 01c4e6c..8c0e6c6 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/publish.yml @@ -9,15 +9,31 @@ permissions: packages: write jobs: - build: + jsr: + runs-on: ubuntu-latest + permissions: + contents: read + id-token: write # auth w/JSR + steps: + - name: checkout + uses: actions/checkout@v4 + - name: setup deno + uses: denoland/setup-deno@v1 + with: + deno-version: v1.41.3 + - name: publish to jsr + run: | + cd packages/bolt + deno publish + docker: runs-on: ubuntu-latest steps: # Get the repository's code - - name: Checkout - uses: actions/checkout@v2 - - name: Set up QEMU + - name: checkout + uses: actions/checkout@v4 + - name: set up QEMU uses: docker/setup-qemu-action@v1 - - name: Set up Docker Buildx + - name: set up buildx id: buildx uses: docker/setup-buildx-action@v1 - name: Login to Docker Hub @@ -25,13 +41,13 @@ jobs: with: username: williamfromnj password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Docker meta + - name: metadata id: yo uses: docker/metadata-action@v3 with: images: williamfromnj/bolt tags: type=ref,event=tag - - name: Build and push + - name: build and push uses: docker/build-push-action@v2 with: context: . diff --git a/packages/bolt-discord/mod.ts b/packages/bolt-discord/mod.ts index a7da985..01a240b 100644 --- a/packages/bolt-discord/mod.ts +++ b/packages/bolt-discord/mod.ts @@ -21,7 +21,7 @@ export type discord_config = { export class discord_plugin extends plugin { bot: Client; name = 'bolt-discord'; - version = '0.5.8'; + version = '0.6.0'; support = ['0.5.5']; constructor(l: lightning, config: discord_config) { diff --git a/packages/bolt-guilded/mod.ts b/packages/bolt-guilded/mod.ts index 395b908..6bc7599 100644 --- a/packages/bolt-guilded/mod.ts +++ b/packages/bolt-guilded/mod.ts @@ -14,7 +14,7 @@ import { tocore, toguilded } from './messages.ts'; export class guilded_plugin extends plugin<{ token: string }> { bot: Client; name = 'bolt-guilded'; - version = '0.5.8'; + version = '0.6.0'; support = ['0.5.5']; constructor(l: lightning, config: { token: string }) { diff --git a/packages/bolt-revolt/mod.ts b/packages/bolt-revolt/mod.ts index ff73cc7..dbdd28a 100644 --- a/packages/bolt-revolt/mod.ts +++ b/packages/bolt-revolt/mod.ts @@ -11,7 +11,7 @@ import { tocore, torevolt } from './messages.ts'; export class revolt_plugin extends plugin<{ token: string }> { bot: Client; name = 'bolt-revolt'; - version = '0.5.8'; + version = '0.6.0'; support = ['0.5.5']; constructor(l: lightning, config: { token: string }) { diff --git a/packages/bolt/cli.ts b/packages/bolt/cli.ts index 4922806..9794842 100644 --- a/packages/bolt/cli.ts +++ b/packages/bolt/cli.ts @@ -20,12 +20,12 @@ const f = parseArgs(Deno.args, { }); if (f.version) { - log('0.5.8'); + log('0.6.0'); Deno.exit(); } if (!f.run && !f.migrations) { - log('lightning v0.5.8 - cross-platform bot connecting communities', 'blue'); + log('lightning v0.6.0 - cross-platform bot connecting communities', 'blue'); log('Usage: lightning [options]', 'purple'); log('Options:', 'green'); log('--help: show this'); diff --git a/packages/bolt/deno.jsonc b/packages/bolt/deno.jsonc index 61a2401..293f4c1 100644 --- a/packages/bolt/deno.jsonc +++ b/packages/bolt/deno.jsonc @@ -1,23 +1,23 @@ { - "name": "@jersey/lightning", - "version": "...", - "lint": { - "exclude": ["./_testdata.ts","./_tests.ts"] - }, - "lock": false, - "unstable": ["temporal"], - "test": { - "include": ["./_tests.ts"] - }, - "imports": { - "assert_eq": "jsr:@std/assert@^0.219.1/assert_equals", - "event": "jsr:@denosaurs/event@^2.0.2", - "mongo": "https://deno.land/x/mongo@v0.32.0/mod.ts", - "r2d2": "https://deno.land/x/r2d2@v2.0.0/mod.ts", - "std_args": "jsr:@std/cli@^0.219.1/parse_args" - }, - "exports": { - ".": "./mod.ts", - "./utils": "./utils/mod.ts" - } + "name": "@jersey/lightning", + "version": "0.6.0", + "lint": { + "exclude": ["./_testdata.ts", "./_tests.ts"] + }, + "lock": false, + "unstable": ["temporal"], + "test": { + "include": ["./_tests.ts"] + }, + "imports": { + "assert_eq": "jsr:@std/assert@^0.219.1/assert_equals", + "event": "jsr:@denosaurs/event@^2.0.2", + "mongo": "https://deno.land/x/mongo@v0.32.0/mod.ts", + "r2d2": "https://deno.land/x/r2d2@v2.0.0/mod.ts", + "std_args": "jsr:@std/cli@^0.219.1/parse_args" + }, + "exports": { + ".": "./mod.ts", + "./utils": "./utils/mod.ts" + } } diff --git a/packages/bolt/lightning.ts b/packages/bolt/lightning.ts index 0fdfb47..8be0771 100644 --- a/packages/bolt/lightning.ts +++ b/packages/bolt/lightning.ts @@ -37,14 +37,14 @@ export class lightning extends EventEmitter { } /** load plugins */ - async load(plugins: { type: create_plugin; config: unknown }[]) { + async load(plugins: create_plugin>[]) { for (const { type, config } of plugins) { const plugin = new type(this, config); if (!plugin.support.includes('0.5.5')) { throw ( await log_error( new Error( - `plugin '${plugin.name}' doesn't support lightning 0.5.5 or above` + `plugin '${plugin.name}' doesn't support this version of lightning` ) ) ).e; From 618afbd9c866b106430154788c39cf78c21825ad Mon Sep 17 00:00:00 2001 From: Jersey Date: Sun, 17 Mar 2024 18:25:11 -0400 Subject: [PATCH 10/13] fix broken symlink Signed-off-by: Jersey --- .github/security.md | 1 - 1 file changed, 1 deletion(-) delete mode 120000 .github/security.md diff --git a/.github/security.md b/.github/security.md deleted file mode 120000 index 4681017..0000000 --- a/.github/security.md +++ /dev/null @@ -1 +0,0 @@ -packages/bolt-dash/docs/content/security.md \ No newline at end of file From 8ff66a2848b5975bf133ba1d905790e80e47075a Mon Sep 17 00:00:00 2001 From: Jersey Date: Sun, 17 Mar 2024 18:46:25 -0400 Subject: [PATCH 11/13] move folder Signed-off-by: Jersey --- packages/bolt | 1 + packages/bolt-discord/_deps.ts | 2 +- packages/bolt-guilded/_deps.ts | 2 +- packages/bolt-revolt/deps.ts | 2 +- packages/{bolt => lightning}/_testdata.ts | 0 packages/{bolt => lightning}/_tests.ts | 0 packages/{bolt => lightning}/bridges/_command_functions.ts | 0 packages/{bolt => lightning}/bridges/_commands.ts | 0 packages/{bolt => lightning}/bridges/_internal.ts | 0 packages/{bolt => lightning}/bridges/mod.ts | 0 packages/{bolt => lightning}/bridges/types.ts | 0 packages/{bolt => lightning}/cli.ts | 0 packages/{bolt => lightning}/deno.jsonc | 0 packages/{bolt => lightning}/lightning.ts | 0 packages/{bolt => lightning}/mod.ts | 0 packages/{bolt => lightning}/utils/_fourbetafive.ts | 0 packages/{bolt => lightning}/utils/_fourfourbeta.ts | 0 packages/{bolt => lightning}/utils/commands.ts | 0 packages/{bolt => lightning}/utils/config.ts | 0 packages/{bolt => lightning}/utils/errors.ts | 0 packages/{bolt => lightning}/utils/messages.ts | 0 packages/{bolt => lightning}/utils/migrations.ts | 0 packages/{bolt => lightning}/utils/mod.ts | 0 packages/{bolt => lightning}/utils/plugins.ts | 0 24 files changed, 4 insertions(+), 3 deletions(-) create mode 120000 packages/bolt rename packages/{bolt => lightning}/_testdata.ts (100%) rename packages/{bolt => lightning}/_tests.ts (100%) rename packages/{bolt => lightning}/bridges/_command_functions.ts (100%) rename packages/{bolt => lightning}/bridges/_commands.ts (100%) rename packages/{bolt => lightning}/bridges/_internal.ts (100%) rename packages/{bolt => lightning}/bridges/mod.ts (100%) rename packages/{bolt => lightning}/bridges/types.ts (100%) rename packages/{bolt => lightning}/cli.ts (100%) rename packages/{bolt => lightning}/deno.jsonc (100%) rename packages/{bolt => lightning}/lightning.ts (100%) rename packages/{bolt => lightning}/mod.ts (100%) rename packages/{bolt => lightning}/utils/_fourbetafive.ts (100%) rename packages/{bolt => lightning}/utils/_fourfourbeta.ts (100%) rename packages/{bolt => lightning}/utils/commands.ts (100%) rename packages/{bolt => lightning}/utils/config.ts (100%) rename packages/{bolt => lightning}/utils/errors.ts (100%) rename packages/{bolt => lightning}/utils/messages.ts (100%) rename packages/{bolt => lightning}/utils/migrations.ts (100%) rename packages/{bolt => lightning}/utils/mod.ts (100%) rename packages/{bolt => lightning}/utils/plugins.ts (100%) diff --git a/packages/bolt b/packages/bolt new file mode 120000 index 0000000..f57def2 --- /dev/null +++ b/packages/bolt @@ -0,0 +1 @@ +lightning \ No newline at end of file diff --git a/packages/bolt-discord/_deps.ts b/packages/bolt-discord/_deps.ts index 3a4888b..26ada80 100644 --- a/packages/bolt-discord/_deps.ts +++ b/packages/bolt-discord/_deps.ts @@ -15,4 +15,4 @@ export { type bridge_platform, type deleted_message, type message -} from '../bolt/mod.ts'; +} from '../lightning/mod.ts'; diff --git a/packages/bolt-guilded/_deps.ts b/packages/bolt-guilded/_deps.ts index 3aa260e..be4f9d5 100644 --- a/packages/bolt-guilded/_deps.ts +++ b/packages/bolt-guilded/_deps.ts @@ -19,4 +19,4 @@ export { type deleted_message, type embed, type message -} from '../bolt/mod.ts'; +} from '../lightning/mod.ts'; diff --git a/packages/bolt-revolt/deps.ts b/packages/bolt-revolt/deps.ts index 5696b23..239e015 100644 --- a/packages/bolt-revolt/deps.ts +++ b/packages/bolt-revolt/deps.ts @@ -14,4 +14,4 @@ export { plugin, type bridge_platform, type message -} from '../bolt/mod.ts'; +} from '../lightning/mod.ts'; diff --git a/packages/bolt/_testdata.ts b/packages/lightning/_testdata.ts similarity index 100% rename from packages/bolt/_testdata.ts rename to packages/lightning/_testdata.ts diff --git a/packages/bolt/_tests.ts b/packages/lightning/_tests.ts similarity index 100% rename from packages/bolt/_tests.ts rename to packages/lightning/_tests.ts diff --git a/packages/bolt/bridges/_command_functions.ts b/packages/lightning/bridges/_command_functions.ts similarity index 100% rename from packages/bolt/bridges/_command_functions.ts rename to packages/lightning/bridges/_command_functions.ts diff --git a/packages/bolt/bridges/_commands.ts b/packages/lightning/bridges/_commands.ts similarity index 100% rename from packages/bolt/bridges/_commands.ts rename to packages/lightning/bridges/_commands.ts diff --git a/packages/bolt/bridges/_internal.ts b/packages/lightning/bridges/_internal.ts similarity index 100% rename from packages/bolt/bridges/_internal.ts rename to packages/lightning/bridges/_internal.ts diff --git a/packages/bolt/bridges/mod.ts b/packages/lightning/bridges/mod.ts similarity index 100% rename from packages/bolt/bridges/mod.ts rename to packages/lightning/bridges/mod.ts diff --git a/packages/bolt/bridges/types.ts b/packages/lightning/bridges/types.ts similarity index 100% rename from packages/bolt/bridges/types.ts rename to packages/lightning/bridges/types.ts diff --git a/packages/bolt/cli.ts b/packages/lightning/cli.ts similarity index 100% rename from packages/bolt/cli.ts rename to packages/lightning/cli.ts diff --git a/packages/bolt/deno.jsonc b/packages/lightning/deno.jsonc similarity index 100% rename from packages/bolt/deno.jsonc rename to packages/lightning/deno.jsonc diff --git a/packages/bolt/lightning.ts b/packages/lightning/lightning.ts similarity index 100% rename from packages/bolt/lightning.ts rename to packages/lightning/lightning.ts diff --git a/packages/bolt/mod.ts b/packages/lightning/mod.ts similarity index 100% rename from packages/bolt/mod.ts rename to packages/lightning/mod.ts diff --git a/packages/bolt/utils/_fourbetafive.ts b/packages/lightning/utils/_fourbetafive.ts similarity index 100% rename from packages/bolt/utils/_fourbetafive.ts rename to packages/lightning/utils/_fourbetafive.ts diff --git a/packages/bolt/utils/_fourfourbeta.ts b/packages/lightning/utils/_fourfourbeta.ts similarity index 100% rename from packages/bolt/utils/_fourfourbeta.ts rename to packages/lightning/utils/_fourfourbeta.ts diff --git a/packages/bolt/utils/commands.ts b/packages/lightning/utils/commands.ts similarity index 100% rename from packages/bolt/utils/commands.ts rename to packages/lightning/utils/commands.ts diff --git a/packages/bolt/utils/config.ts b/packages/lightning/utils/config.ts similarity index 100% rename from packages/bolt/utils/config.ts rename to packages/lightning/utils/config.ts diff --git a/packages/bolt/utils/errors.ts b/packages/lightning/utils/errors.ts similarity index 100% rename from packages/bolt/utils/errors.ts rename to packages/lightning/utils/errors.ts diff --git a/packages/bolt/utils/messages.ts b/packages/lightning/utils/messages.ts similarity index 100% rename from packages/bolt/utils/messages.ts rename to packages/lightning/utils/messages.ts diff --git a/packages/bolt/utils/migrations.ts b/packages/lightning/utils/migrations.ts similarity index 100% rename from packages/bolt/utils/migrations.ts rename to packages/lightning/utils/migrations.ts diff --git a/packages/bolt/utils/mod.ts b/packages/lightning/utils/mod.ts similarity index 100% rename from packages/bolt/utils/mod.ts rename to packages/lightning/utils/mod.ts diff --git a/packages/bolt/utils/plugins.ts b/packages/lightning/utils/plugins.ts similarity index 100% rename from packages/bolt/utils/plugins.ts rename to packages/lightning/utils/plugins.ts From c202db4f6ffc97cfe80bb9a600a2f4023f5c0fe6 Mon Sep 17 00:00:00 2001 From: Jersey Date: Wed, 20 Mar 2024 13:22:45 -0400 Subject: [PATCH 12/13] some build stuff & r2d2 Signed-off-by: Jersey --- .github/workflows/publish.yml | 2 +- deno.jsonc | 9 --------- dockerfile | 3 ++- packages/bolt | 1 - packages/lightning/deno.jsonc | 2 +- 5 files changed, 4 insertions(+), 13 deletions(-) delete mode 100644 deno.jsonc delete mode 120000 packages/bolt diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 8c0e6c6..36e83cd 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -23,7 +23,7 @@ jobs: deno-version: v1.41.3 - name: publish to jsr run: | - cd packages/bolt + cd packages/lightning deno publish docker: runs-on: ubuntu-latest diff --git a/deno.jsonc b/deno.jsonc deleted file mode 100644 index 2c40bb6..0000000 --- a/deno.jsonc +++ /dev/null @@ -1,9 +0,0 @@ -{ - "imports": { - "assert_eq": "jsr:@std/assert@^0.219.1/assert_equals", - "event": "jsr:@denosaurs/event@^2.0.2", - "mongo": "https://deno.land/x/mongo@v0.32.0/mod.ts", - "r2d2": "https://deno.land/x/r2d2@v2.0.0/mod.ts", - "std_args": "jsr:@std/cli@^0.219.1/parse_args" - } -} diff --git a/dockerfile b/dockerfile index 2fc3a83..581a87f 100644 --- a/dockerfile +++ b/dockerfile @@ -4,7 +4,8 @@ FROM docker.io/denoland/deno:${DENO_VERSION} # add lightning to the image WORKDIR /app -ADD ./packages/bolt /app +# TODO: change when repos split +ADD ./packages/lightning /app RUN deno install -A --unstable-temporal -n lightning /app/cli.ts # set lightning as the entrypoint and use the run command by default diff --git a/packages/bolt b/packages/bolt deleted file mode 120000 index f57def2..0000000 --- a/packages/bolt +++ /dev/null @@ -1 +0,0 @@ -lightning \ No newline at end of file diff --git a/packages/lightning/deno.jsonc b/packages/lightning/deno.jsonc index 293f4c1..f21f7eb 100644 --- a/packages/lightning/deno.jsonc +++ b/packages/lightning/deno.jsonc @@ -13,7 +13,7 @@ "assert_eq": "jsr:@std/assert@^0.219.1/assert_equals", "event": "jsr:@denosaurs/event@^2.0.2", "mongo": "https://deno.land/x/mongo@v0.32.0/mod.ts", - "r2d2": "https://deno.land/x/r2d2@v2.0.0/mod.ts", + "r2d2": "jsr:@iuioiua/r2d2@2.1.1", "std_args": "jsr:@std/cli@^0.219.1/parse_args" }, "exports": { From a983d10b81067e1f5627aa9f360ef0ac4d7c654c Mon Sep 17 00:00:00 2001 From: Jersey Date: Tue, 26 Mar 2024 12:41:28 -0400 Subject: [PATCH 13/13] mongo on jsr now Signed-off-by: Jersey --- packages/lightning/deno.jsonc | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/packages/lightning/deno.jsonc b/packages/lightning/deno.jsonc index f21f7eb..b399064 100644 --- a/packages/lightning/deno.jsonc +++ b/packages/lightning/deno.jsonc @@ -1,23 +1,26 @@ { "name": "@jersey/lightning", "version": "0.6.0", - "lint": { - "exclude": ["./_testdata.ts", "./_tests.ts"] - }, - "lock": false, - "unstable": ["temporal"], - "test": { - "include": ["./_tests.ts"] - }, "imports": { "assert_eq": "jsr:@std/assert@^0.219.1/assert_equals", "event": "jsr:@denosaurs/event@^2.0.2", - "mongo": "https://deno.land/x/mongo@v0.32.0/mod.ts", + "mongo": "jsr:@db/mongo@^0.33.0", "r2d2": "jsr:@iuioiua/r2d2@2.1.1", "std_args": "jsr:@std/cli@^0.219.1/parse_args" }, "exports": { ".": "./mod.ts", "./utils": "./utils/mod.ts" - } + }, + "publish": { + "exclude": ["./_testdata.ts", "./_tests.ts"] + }, + "test": { + "include": ["./_tests.ts"] + }, + "lint": { + "exclude": ["./_testdata.ts", "./_tests.ts"] + }, + "lock": false, + "unstable": ["temporal"] }