commandkit 1.0.0-dev.20250809125132 → 1.0.0-dev.20250809133202
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{CommandKitEventsChannel-BSdcgY3Q.js → CommandKitEventsChannel-Bgw0XCOl.js} +1 -1
- package/dist/{CommandKitEventsChannel-BSdcgY3Q.js.map → CommandKitEventsChannel-Bgw0XCOl.js.map} +1 -1
- package/dist/{CommandsRouter-Bs9UuowL.js → CommandsRouter-CJJ0_WSr.js} +1 -1
- package/dist/{CommandsRouter-Bs9UuowL.js.map → CommandsRouter-CJJ0_WSr.js.map} +1 -1
- package/dist/{EventWorkerContext-DxfS_0fJ.js → EventWorkerContext-CSlD9rbx.js} +1 -1
- package/dist/{EventWorkerContext-DxfS_0fJ.js.map → EventWorkerContext-CSlD9rbx.js.map} +1 -1
- package/dist/{EventWorkerContext-CGIqPuh6.d.ts → EventWorkerContext-DtIbRhLz.d.ts} +2 -2
- package/dist/{EventsRouter-B7oifgM6.js → EventsRouter-C_J0M3uO.js} +1 -1
- package/dist/{EventsRouter-B7oifgM6.js.map → EventsRouter-C_J0M3uO.js.map} +1 -1
- package/dist/{MessageCommandParser-CGhN3xNN.js → MessageCommandParser-B_BEQ3p8.js} +1 -1
- package/dist/{MessageCommandParser-CGhN3xNN.js.map → MessageCommandParser-B_BEQ3p8.js.map} +1 -1
- package/dist/analytics/analytics-engine.d.ts +1 -1
- package/dist/analytics/analytics-engine.js +14 -13
- package/dist/analytics/analytics-provider.d.ts +1 -1
- package/dist/analytics/constants.js +1 -1
- package/dist/analytics/utils.js +14 -13
- package/dist/{analytics-engine-CA_TBn6w.d.ts → analytics-engine-Dkf4obI8.d.ts} +56 -17
- package/dist/app/commands/AppCommandRunner.d.ts +1 -1
- package/dist/app/commands/AppCommandRunner.js +14 -13
- package/dist/app/commands/Context.d.ts +1 -1
- package/dist/app/commands/Context.js +14 -13
- package/dist/app/commands/MessageCommandParser.js +1 -1
- package/dist/app/commands/helpers.js +1 -1
- package/dist/app/events/EventWorkerContext.d.ts +2 -2
- package/dist/app/events/EventWorkerContext.js +1 -1
- package/dist/app/handlers/AppCommandHandler.d.ts +1 -1
- package/dist/app/handlers/AppCommandHandler.js +14 -13
- package/dist/app/handlers/AppEventsHandler.d.ts +1 -1
- package/dist/app/handlers/AppEventsHandler.js +14 -13
- package/dist/app/index.d.ts +1 -1
- package/dist/app/index.js +16 -15
- package/dist/app/interrupt/signals.js +2 -2
- package/dist/app/register/CommandRegistrar.d.ts +1 -1
- package/dist/app/register/CommandRegistrar.js +14 -13
- package/dist/app/router/CommandsRouter.js +1 -1
- package/dist/app/router/EventsRouter.js +1 -1
- package/dist/app/router/index.js +3 -3
- package/dist/{app-process-BnB1YZV6.js → app-process-CjMovpoZ.js} +3 -3
- package/dist/{app-process-BnB1YZV6.js.map → app-process-CjMovpoZ.js.map} +1 -1
- package/dist/{build-D8P0ENm6.js → build-Bgk8Y78-.js} +22 -16
- package/dist/build-Bgk8Y78-.js.map +1 -0
- package/dist/cli/app-process.js +4 -4
- package/dist/cli/build.d.ts +1 -1
- package/dist/cli/build.js +17 -16
- package/dist/cli/common.d.ts +1 -1
- package/dist/cli/common.js +2 -2
- package/dist/cli/development.js +18 -17
- package/dist/cli/development.js.map +1 -1
- package/dist/cli/env.js +1 -1
- package/dist/cli/generators.js +2 -2
- package/dist/cli/information.js +1 -1
- package/dist/cli/init.js +15 -14
- package/dist/cli/production.js +20 -19
- package/dist/cli/production.js.map +1 -1
- package/dist/cli/type-checker.js +3 -3
- package/dist/cli/utils.js +1 -1
- package/dist/{commandkit-CUFTPuzm.js → commandkit-DvT6a16t.js} +43 -20
- package/dist/commandkit-DvT6a16t.js.map +1 -0
- package/dist/commandkit.d.ts +1 -1
- package/dist/commandkit.js +14 -13
- package/dist/{common-DoZjgUs0.js → common-DNADUU3_.js} +2 -2
- package/dist/{common-DoZjgUs0.js.map → common-DNADUU3_.js.map} +1 -1
- package/dist/components/index.js +14 -13
- package/dist/components/v1/button/Button.js +14 -13
- package/dist/components/v1/button/ButtonKit.js +14 -13
- package/dist/components/v1/modal/Modal.js +14 -13
- package/dist/components/v1/modal/ModalKit.js +14 -13
- package/dist/components/v1/select-menu/ChannelSelectMenuKit.js +14 -13
- package/dist/components/v1/select-menu/MentionableSelectMenuKit.js +14 -13
- package/dist/components/v1/select-menu/RoleSelectMenuKit.js +14 -13
- package/dist/components/v1/select-menu/SelectMenu.js +14 -13
- package/dist/components/v1/select-menu/StringSelectMenuKit.js +14 -13
- package/dist/components/v1/select-menu/UserSelectMenuKit.js +14 -13
- package/dist/config/config.d.ts +2 -2
- package/dist/config/config.js +14 -13
- package/dist/config/default.d.ts +1 -1
- package/dist/config/default.js +14 -13
- package/dist/config/loader.d.ts +2 -2
- package/dist/config/loader.js +14 -13
- package/dist/config/types.d.ts +2 -2
- package/dist/config/utils.d.ts +1 -1
- package/dist/config/utils.js +2 -18
- package/dist/{config-GcJ2yAdr.d.ts → config-DEktVjaq.d.ts} +2 -2
- package/dist/{constants-DYSMm0U6.js → constants-4oxxvaJA.js} +1 -1
- package/dist/{constants-DYSMm0U6.js.map → constants-4oxxvaJA.js.map} +1 -1
- package/dist/{constants-R96vEAFD.js → constants-CUND8XkG.js} +1 -1
- package/dist/{constants-R96vEAFD.js.map → constants-CUND8XkG.js.map} +1 -1
- package/dist/context/async-context.d.ts +1 -1
- package/dist/context/async-context.js +14 -13
- package/dist/context/environment.d.ts +1 -1
- package/dist/context/environment.js +14 -13
- package/dist/{dotprops-C22abhGZ.js → dotprops-C_4L7RPD.js} +1 -1
- package/dist/{dotprops-C22abhGZ.js.map → dotprops-C_4L7RPD.js.map} +1 -1
- package/dist/{env-DakvrBzy.js → env-_68PRRoA.js} +1 -1
- package/dist/{env-DakvrBzy.js.map → env-_68PRRoA.js.map} +1 -1
- package/dist/events/CommandKitEventsChannel.d.ts +1 -1
- package/dist/events/CommandKitEventsChannel.js +1 -1
- package/dist/{feature-flags-CNRFFY4k.js → feature-flags-Rel_00Fx.js} +4 -4
- package/dist/{feature-flags-CNRFFY4k.js.map → feature-flags-Rel_00Fx.js.map} +1 -1
- package/dist/flags/FlagProvider.d.ts +1 -1
- package/dist/flags/feature-flags.d.ts +1 -1
- package/dist/flags/feature-flags.js +15 -14
- package/dist/flags/store.d.ts +1 -1
- package/dist/flags/store.js +1 -1
- package/dist/{helpers-DfV6HlgI.js → helpers-BUlN3lIz.js} +1 -1
- package/dist/{helpers-DfV6HlgI.js.map → helpers-BUlN3lIz.js.map} +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +20 -19
- package/dist/index.js.map +1 -1
- package/dist/{init-Dc4Qbgpg.js → init-CoNEUBBr.js} +4 -4
- package/dist/{init-Dc4Qbgpg.js.map → init-CoNEUBBr.js.map} +1 -1
- package/dist/kv/constants.js +1 -1
- package/dist/kv/dotprops.js +1 -1
- package/dist/kv/kv.js +3 -3
- package/dist/kv/serde.js +2 -2
- package/dist/logger/DefaultLogger.js +14 -13
- package/dist/logger/ILogger.js +1 -1
- package/dist/logger/Logger.js +14 -13
- package/dist/plugins/CompilerPlugin.d.ts +1 -1
- package/dist/plugins/PluginCommon.d.ts +1 -1
- package/dist/plugins/RuntimePlugin.d.ts +1 -1
- package/dist/plugins/index.d.ts +1 -1
- package/dist/plugins/index.js +14 -13
- package/dist/plugins/plugin-runtime/CommandKitPluginRuntime.d.ts +1 -1
- package/dist/plugins/plugin-runtime/CommandKitPluginRuntime.js +14 -13
- package/dist/plugins/plugin-runtime/CompilerPluginRuntime.d.ts +1 -1
- package/dist/plugins/plugin-runtime/CompilerPluginRuntime.js +14 -13
- package/dist/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.d.ts +1 -1
- package/dist/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.js +14 -13
- package/dist/plugins/plugin-runtime/builtin/MacroPlugin.d.ts +1 -1
- package/dist/plugins/plugin-runtime/builtin/MacroPlugin.js +14 -13
- package/dist/plugins/plugin-runtime/runtime.d.ts +1 -1
- package/dist/plugins/types.d.ts +1 -1
- package/dist/{resolve-file-url-9aPt6A_n.js → resolve-file-url-DHTQj2mU.js} +1 -1
- package/dist/{resolve-file-url-9aPt6A_n.js.map → resolve-file-url-DHTQj2mU.js.map} +1 -1
- package/dist/{serde-CXY4F7OD.js → serde-CHySNpFr.js} +2 -2
- package/dist/{serde-CXY4F7OD.js.map → serde-CHySNpFr.js.map} +1 -1
- package/dist/{signals-Bu7gndaS.js → signals-DHdYrd-n.js} +2 -2
- package/dist/{signals-Bu7gndaS.js.map → signals-DHdYrd-n.js.map} +1 -1
- package/dist/{store-CyzliDXj.js → store-CiqLHedg.js} +1 -1
- package/dist/{store-CyzliDXj.js.map → store-CiqLHedg.js.map} +1 -1
- package/dist/{type-checker-DDHZIEBi.js → type-checker-1Iu1jJcy.js} +2 -2
- package/dist/{type-checker-DDHZIEBi.js.map → type-checker-1Iu1jJcy.js.map} +1 -1
- package/dist/{types-package-Dwub9JsW.js → types-package-DrnIdWLg.js} +1 -1
- package/dist/{types-package-Dwub9JsW.js.map → types-package-DrnIdWLg.js.map} +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/utils/dev-hooks.d.ts +1 -1
- package/dist/utils/dev-hooks.js +14 -13
- package/dist/utils/resolve-file-url.js +1 -1
- package/dist/utils/types-package.js +1 -1
- package/dist/utils/utilities.js +14 -13
- package/dist/utils-BnXM4eKk.js +34 -0
- package/dist/utils-BnXM4eKk.js.map +1 -0
- package/dist/{utils-n4MoGDDR.js → utils-DCSnVAZ6.js} +1 -1
- package/dist/{utils-n4MoGDDR.js.map → utils-DCSnVAZ6.js.map} +1 -1
- package/dist/{version-DPy6hMLq.js → version-DrtNWmx0.js} +2 -2
- package/dist/{version-DPy6hMLq.js.map → version-DrtNWmx0.js.map} +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
- package/dist/build-D8P0ENm6.js.map +0 -1
- package/dist/commandkit-CUFTPuzm.js.map +0 -1
- package/dist/config/utils.js.map +0 -1
- /package/dist/{ILogger-BMIMljYD.js → ILogger-dQ7Y9X1f.js} +0 -0
- /package/dist/{app-gCenKq8k.js → app-HN1cVg8J.js} +0 -0
- /package/dist/{router-wA3kFzES.js → router-DHnFRADH.js} +0 -0
package/dist/{CommandKitEventsChannel-BSdcgY3Q.js.map → CommandKitEventsChannel-Bgw0XCOl.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandKitEventsChannel-
|
|
1
|
+
{"version":3,"file":"CommandKitEventsChannel-Bgw0XCOl.js","names":[],"sources":["../src/events/CommandKitEventsChannel.ts"],"sourcesContent":["import EventEmitter from 'node:events';\nimport type { CommandKit } from '../commandkit';\nimport type { AsyncFunction, GenericFunction } from '../context/async-context';\n\n/**\n * The function type for event listeners.\n */\nexport type ListenerFunction = GenericFunction | AsyncFunction;\n\n/**\n * Represents a channel for emitting and listening to events in CommandKit.\n * This class provides methods to manage event listeners and emit events\n * within a specific namespace.\n */\nexport class CommandKitEventsChannel {\n private emitter = new EventEmitter();\n\n /**\n * Creates a new instance of CommandKitEventsChannel.\n * @param commandkit The CommandKit instance that this channel belongs to.\n */\n public constructor(public readonly commandkit: CommandKit) {}\n\n /**\n * Creates a namespaced event channel. This allows you to manage events\n * within a specific namespace, preventing conflicts with other event channels.\n * This is useful for organizing events related to different parts of your application.\n * @param namespace The namespace for the event channel.\n * @returns An object containing methods for managing events within the namespace.\n * @example commandkit.events.to('customNamespace').emit('eventName', data);\n */\n public to(namespace: string) {\n return {\n on: this.on.bind(this, namespace),\n off: this.off.bind(this, namespace),\n once: this.once.bind(this, namespace),\n emit: this.emit.bind(this, namespace),\n removeAllListeners: this.removeAllListeners.bind(this, namespace),\n };\n }\n\n /**\n * Register an event listener for a specific event within the namespace.\n * @param namespace The namespace for the event channel.\n * @param event The name of the event to listen for.\n * @param listener The function to call when the event is emitted.\n */\n public on(namespace: string, event: string, listener: ListenerFunction) {\n this.emitter.on(`${namespace}:${event}`, listener);\n }\n\n /**\n * Unregister an event listener for a specific event within the namespace.\n * @param namespace The namespace for the event channel.\n * @param event The name of the event to stop listening for.\n * @param listener The function that was registered as the listener.\n */\n public off(namespace: string, event: string, listener: ListenerFunction) {\n this.emitter.off(`${namespace}:${event}`, listener);\n }\n\n /**\n * Register an event listener that will be called only once for a specific event\n * within the namespace.\n * @param namespace The namespace for the event channel.\n * @param event The name of the event to listen for.\n * @param listener The function to call when the event is emitted.\n */\n public once(namespace: string, event: string, listener: ListenerFunction) {\n this.emitter.once(`${namespace}:${event}`, listener);\n }\n\n /**\n * Emit an event within the specified namespace, calling all registered listeners.\n * @param namespace The namespace for the event channel.\n * @param event The name of the event to emit.\n * @param args The arguments to pass to the listeners.\n * @returns A boolean indicating whether any listeners were called.\n */\n public emit(namespace: string, event: string, ...args: any[]) {\n return this.emitter.emit(`${namespace}:${event}`, ...args);\n }\n\n /**\n * Remove all listeners for a specific event or all events within the namespace.\n * @param namespace The namespace for the event channel.\n * @param event The name of the event to remove listeners for. If not provided, all listeners for all events in the namespace will be removed.\n */\n public removeAllListeners(namespace: string): void;\n public removeAllListeners(namespace: string, event: string): void;\n public removeAllListeners(namespace: string, event?: string): void {\n if (event) {\n this.emitter.removeAllListeners(`${namespace}:${event}`);\n } else {\n this.emitter.removeAllListeners(namespace);\n }\n }\n}\n"],"mappings":";;;;;;;;;AAcA,IAAa,0BAAb,MAAqC;CACnC,AAAQ,UAAU,IAAI;;;;;CAMtB,AAAO,YAA4B,YAAwB;EAAxB;CAAyB;;;;;;;;;CAU5D,AAAO,GAAG,WAAmB;AAC3B,SAAO;GACL,IAAI,KAAK,GAAG,KAAK,MAAM,UAAU;GACjC,KAAK,KAAK,IAAI,KAAK,MAAM,UAAU;GACnC,MAAM,KAAK,KAAK,KAAK,MAAM,UAAU;GACrC,MAAM,KAAK,KAAK,KAAK,MAAM,UAAU;GACrC,oBAAoB,KAAK,mBAAmB,KAAK,MAAM,UAAU;EAClE;CACH;;;;;;;CAQA,AAAO,GAAG,WAAmB,OAAe,UAA4B;EACtE,KAAK,QAAQ,GAAG,GAAG,UAAU,CAAC,EAAE,OAAO,EAAE,SAAS;CACpD;;;;;;;CAQA,AAAO,IAAI,WAAmB,OAAe,UAA4B;EACvE,KAAK,QAAQ,IAAI,GAAG,UAAU,CAAC,EAAE,OAAO,EAAE,SAAS;CACrD;;;;;;;;CASA,AAAO,KAAK,WAAmB,OAAe,UAA4B;EACxE,KAAK,QAAQ,KAAK,GAAG,UAAU,CAAC,EAAE,OAAO,EAAE,SAAS;CACtD;;;;;;;;CASA,AAAO,KAAK,WAAmB,OAAe,GAAG,MAAa;AAC5D,SAAO,KAAK,QAAQ,KAAK,GAAG,UAAU,CAAC,EAAE,OAAO,EAAE,GAAG,KAAK;CAC5D;CASA,AAAO,mBAAmB,WAAmB,OAAsB;AACjE,MAAI,OACF,KAAK,QAAQ,mBAAmB,GAAG,UAAU,CAAC,EAAE,OAAO,CAAC;OAExD,KAAK,QAAQ,mBAAmB,UAAU;CAE9C;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandsRouter-Bs9UuowL.js","names":[],"sources":["../src/app/router/CommandsRouter.ts"],"sourcesContent":["import { Collection } from 'discord.js';\nimport { Dirent, existsSync } from 'node:fs';\nimport { readdir } from 'node:fs/promises';\nimport { basename, extname, join, normalize } from 'node:path';\n\n/**\n * Represents a command with its metadata and middleware associations.\n */\nexport interface Command {\n id: string;\n name: string;\n path: string;\n relativePath: string;\n parentPath: string;\n middlewares: Array<string>;\n category: string | null;\n}\n\n/**\n * Represents a middleware with its metadata and scope.\n */\nexport interface Middleware {\n id: string;\n name: string;\n path: string;\n relativePath: string;\n parentPath: string;\n global: boolean;\n command: string | null;\n}\n\n/**\n * Data structure containing parsed commands and middleware.\n */\nexport interface ParsedCommandData {\n commands: Record<string, Command>;\n middlewares: Record<string, Middleware>;\n}\n\n/**\n * Configuration options for the commands router.\n */\nexport interface CommandsRouterOptions {\n entrypoint: string;\n}\n\n/**\n * @private\n * @internal\n */\nconst MIDDLEWARE_PATTERN = /^\\+middleware\\.(m|c)?(j|t)sx?$/;\n\n/**\n * @private\n * @internal\n */\nconst COMMAND_MIDDLEWARE_PATTERN =\n /^\\+([^+().][^().]*)\\.middleware\\.(m|c)?(j|t)sx?$/;\n\n/**\n * @private\n * @internal\n */\nconst GLOBAL_MIDDLEWARE_PATTERN = /^\\+global-middleware\\.(m|c)?(j|t)sx?$/;\n\n/**\n * @private\n * @internal\n */\nconst COMMAND_PATTERN = /^([^+().][^().]*)\\.(m|c)?(j|t)sx?$/;\n\n/**\n * @private\n * @internal\n */\nconst CATEGORY_PATTERN = /^\\(.+\\)$/;\n\n/**\n * Handles discovery and parsing of command and middleware files in the filesystem.\n */\nexport class CommandsRouter {\n /**\n * @private\n * @internal\n */\n private commands = new Collection<string, Command>();\n\n /**\n * @private\n * @internal\n */\n private middlewares = new Collection<string, Middleware>();\n\n /**\n * Creates a new CommandsRouter instance.\n * @param options - Configuration options for the router\n */\n public constructor(private readonly options: CommandsRouterOptions) {}\n\n /**\n * Populates the router with existing command and middleware data.\n * @param data - Parsed command data to populate with\n */\n public populate(data: ParsedCommandData) {\n for (const [id, command] of Object.entries(data.commands)) {\n this.commands.set(id, command);\n }\n\n for (const [id, middleware] of Object.entries(data.middlewares)) {\n this.middlewares.set(id, middleware);\n }\n }\n\n /**\n * Checks if the configured entrypoint path exists.\n * @returns True if the path exists\n */\n public isValidPath(): boolean {\n return existsSync(this.options.entrypoint);\n }\n\n /**\n * @private\n * @internal\n */\n private isCommand(name: string): boolean {\n return COMMAND_PATTERN.test(name);\n }\n\n /**\n * @private\n * @internal\n */\n private isMiddleware(name: string): boolean {\n return (\n MIDDLEWARE_PATTERN.test(name) ||\n GLOBAL_MIDDLEWARE_PATTERN.test(name) ||\n COMMAND_MIDDLEWARE_PATTERN.test(name)\n );\n }\n\n /**\n * @private\n * @internal\n */\n private isCategory(name: string): boolean {\n return CATEGORY_PATTERN.test(name);\n }\n\n /**\n * Clears all loaded commands and middleware.\n */\n public clear() {\n this.commands.clear();\n this.middlewares.clear();\n }\n\n /**\n * Scans the filesystem for commands and middleware files.\n * @returns Parsed command data\n */\n public async scan() {\n const entries = await readdir(this.options.entrypoint, {\n withFileTypes: true,\n });\n\n for (const entry of entries) {\n // ignore _ prefixed files\n if (entry.name.startsWith('_')) continue;\n\n const fullPath = join(this.options.entrypoint, entry.name);\n\n if (entry.isDirectory()) {\n const category = this.isCategory(entry.name)\n ? entry.name.slice(1, -1)\n : null;\n\n await this.traverse(fullPath, category);\n } else {\n await this.handle(entry);\n }\n }\n\n await this.applyMiddlewares();\n\n return this.toJSON();\n }\n\n /**\n * Gets the raw command and middleware collections.\n * @returns Object containing commands and middlewares collections\n */\n public getData() {\n return {\n commands: this.commands,\n middlewares: this.middlewares,\n };\n }\n\n /**\n * Converts the loaded data to a JSON-serializable format.\n * @returns Plain object with commands and middlewares\n */\n public toJSON() {\n return {\n commands: Object.fromEntries(this.commands.entries()),\n middlewares: Object.fromEntries(this.middlewares.entries()),\n };\n }\n\n /**\n * @private\n * @internal\n */\n private async traverse(path: string, category: string | null) {\n const entries = await readdir(path, {\n withFileTypes: true,\n });\n\n for (const entry of entries) {\n // ignore _ prefixed files\n if (entry.name.startsWith('_')) continue;\n\n if (entry.isFile()) {\n if (this.isCommand(entry.name) || this.isMiddleware(entry.name)) {\n await this.handle(entry, category);\n }\n } else if (\n entry.isDirectory() &&\n this.isCategory(entry.name) &&\n category\n ) {\n // nested category\n const nestedCategory = this.isCategory(entry.name)\n ? `${category}:${entry.name.slice(1, -1)}`\n : null;\n await this.traverse(join(path, entry.name), nestedCategory);\n }\n\n // TODO: handle subcommands\n }\n }\n\n /**\n * @private\n * @internal\n */\n private async handle(entry: Dirent, category: string | null = null) {\n const name = entry.name;\n const path = join(entry.parentPath, entry.name);\n\n if (this.isCommand(name)) {\n const command: Command = {\n id: crypto.randomUUID(),\n name: basename(path, extname(path)),\n path,\n category,\n parentPath: entry.parentPath,\n relativePath: this.replaceEntrypoint(path),\n middlewares: [],\n };\n\n this.commands.set(command.id, command);\n } else if (this.isMiddleware(name)) {\n const middleware: Middleware = {\n id: crypto.randomUUID(),\n name: basename(path, extname(path)),\n path,\n relativePath: this.replaceEntrypoint(path),\n parentPath: entry.parentPath,\n global: GLOBAL_MIDDLEWARE_PATTERN.test(name),\n command: COMMAND_MIDDLEWARE_PATTERN.test(name)\n ? name.split('.')[0] || null\n : null,\n };\n\n this.middlewares.set(middleware.id, middleware);\n }\n }\n\n /**\n * @private\n * @internal\n */\n private applyMiddlewares() {\n this.commands.forEach((command) => {\n const commandPath = command.parentPath;\n const samePathMiddlewares = Array.from(this.middlewares.values())\n .filter((middleware) => {\n if (middleware.global) return true;\n if (middleware.command) return middleware.command === command.name;\n return middleware.parentPath === commandPath;\n })\n .map((middleware) => middleware.id);\n\n command.middlewares = Array.from(\n new Set([...command.middlewares, ...samePathMiddlewares]),\n );\n });\n }\n\n /**\n * @private\n * @internal\n */\n private replaceEntrypoint(path: string) {\n const normalized = normalize(path);\n return normalized.replace(this.options.entrypoint, '');\n }\n}\n"],"mappings":";;;;;;;;;;;AAkDA,MAAM,qBAAqB;;;;;AAM3B,MAAM,6BACN;;;;;AAMA,MAAM,4BAA4B;;;;;AAMlC,MAAM,kBAAkB;;;;;AAMxB,MAAM,mBAAmB;;;;AAKzB,IAAa,iBAAb,MAA4B;;;;;CAK1B,AAAQ,WAAW,IAAI;;;;;CAMvB,AAAQ,cAAc,IAAI;;;;;CAM1B,AAAO,YAA6B,SAAgC;EAAhC;CAAiC;;;;;CAMrE,AAAO,SAAS,MAAyB;AACvC,OAAK,MAAM,CAAC,IAAI,QAAQ,IAAI,OAAO,QAAQ,KAAK,SAAS,EACvD,KAAK,SAAS,IAAI,IAAI,QAAQ;AAGhC,OAAK,MAAM,CAAC,IAAI,WAAW,IAAI,OAAO,QAAQ,KAAK,YAAY,EAC7D,KAAK,YAAY,IAAI,IAAI,WAAW;CAExC;;;;;CAM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AAQ,CAAA,CAChE,OAAO,CAAC,eAAe;AACrB,QAAI,WAAW,OAAQ,QAAO;AAC9B,QAAI,WAAW,QAAS,QAAO,WAAW,YAAY,QAAQ;AAC9D,WAAO,WAAW,eAAe;GAClC,EAAC,CACF,IAAI,CAAC,eAAe,WAAW,GAAG;GAElC,QAAQ,cAAc,MAAM,KAC1B,IAAI,IAAI,CAAC,GAAG,QAAQ,aAAa,GAAG,mBAAoB,GACzD;EACF,EAAC;CACJ;;;;;CAMA,AAAQ,kBAAkB,MAAc;EACtC,MAAM,sCAAuB,KAAK;AAClC,SAAO,WAAW,QAAQ,KAAK,QAAQ,YAAY,GAAG;CACxD;AACF"}
|
|
1
|
+
{"version":3,"file":"CommandsRouter-CJJ0_WSr.js","names":[],"sources":["../src/app/router/CommandsRouter.ts"],"sourcesContent":["import { Collection } from 'discord.js';\nimport { Dirent, existsSync } from 'node:fs';\nimport { readdir } from 'node:fs/promises';\nimport { basename, extname, join, normalize } from 'node:path';\n\n/**\n * Represents a command with its metadata and middleware associations.\n */\nexport interface Command {\n id: string;\n name: string;\n path: string;\n relativePath: string;\n parentPath: string;\n middlewares: Array<string>;\n category: string | null;\n}\n\n/**\n * Represents a middleware with its metadata and scope.\n */\nexport interface Middleware {\n id: string;\n name: string;\n path: string;\n relativePath: string;\n parentPath: string;\n global: boolean;\n command: string | null;\n}\n\n/**\n * Data structure containing parsed commands and middleware.\n */\nexport interface ParsedCommandData {\n commands: Record<string, Command>;\n middlewares: Record<string, Middleware>;\n}\n\n/**\n * Configuration options for the commands router.\n */\nexport interface CommandsRouterOptions {\n entrypoint: string;\n}\n\n/**\n * @private\n * @internal\n */\nconst MIDDLEWARE_PATTERN = /^\\+middleware\\.(m|c)?(j|t)sx?$/;\n\n/**\n * @private\n * @internal\n */\nconst COMMAND_MIDDLEWARE_PATTERN =\n /^\\+([^+().][^().]*)\\.middleware\\.(m|c)?(j|t)sx?$/;\n\n/**\n * @private\n * @internal\n */\nconst GLOBAL_MIDDLEWARE_PATTERN = /^\\+global-middleware\\.(m|c)?(j|t)sx?$/;\n\n/**\n * @private\n * @internal\n */\nconst COMMAND_PATTERN = /^([^+().][^().]*)\\.(m|c)?(j|t)sx?$/;\n\n/**\n * @private\n * @internal\n */\nconst CATEGORY_PATTERN = /^\\(.+\\)$/;\n\n/**\n * Handles discovery and parsing of command and middleware files in the filesystem.\n */\nexport class CommandsRouter {\n /**\n * @private\n * @internal\n */\n private commands = new Collection<string, Command>();\n\n /**\n * @private\n * @internal\n */\n private middlewares = new Collection<string, Middleware>();\n\n /**\n * Creates a new CommandsRouter instance.\n * @param options - Configuration options for the router\n */\n public constructor(private readonly options: CommandsRouterOptions) {}\n\n /**\n * Populates the router with existing command and middleware data.\n * @param data - Parsed command data to populate with\n */\n public populate(data: ParsedCommandData) {\n for (const [id, command] of Object.entries(data.commands)) {\n this.commands.set(id, command);\n }\n\n for (const [id, middleware] of Object.entries(data.middlewares)) {\n this.middlewares.set(id, middleware);\n }\n }\n\n /**\n * Checks if the configured entrypoint path exists.\n * @returns True if the path exists\n */\n public isValidPath(): boolean {\n return existsSync(this.options.entrypoint);\n }\n\n /**\n * @private\n * @internal\n */\n private isCommand(name: string): boolean {\n return COMMAND_PATTERN.test(name);\n }\n\n /**\n * @private\n * @internal\n */\n private isMiddleware(name: string): boolean {\n return (\n MIDDLEWARE_PATTERN.test(name) ||\n GLOBAL_MIDDLEWARE_PATTERN.test(name) ||\n COMMAND_MIDDLEWARE_PATTERN.test(name)\n );\n }\n\n /**\n * @private\n * @internal\n */\n private isCategory(name: string): boolean {\n return CATEGORY_PATTERN.test(name);\n }\n\n /**\n * Clears all loaded commands and middleware.\n */\n public clear() {\n this.commands.clear();\n this.middlewares.clear();\n }\n\n /**\n * Scans the filesystem for commands and middleware files.\n * @returns Parsed command data\n */\n public async scan() {\n const entries = await readdir(this.options.entrypoint, {\n withFileTypes: true,\n });\n\n for (const entry of entries) {\n // ignore _ prefixed files\n if (entry.name.startsWith('_')) continue;\n\n const fullPath = join(this.options.entrypoint, entry.name);\n\n if (entry.isDirectory()) {\n const category = this.isCategory(entry.name)\n ? entry.name.slice(1, -1)\n : null;\n\n await this.traverse(fullPath, category);\n } else {\n await this.handle(entry);\n }\n }\n\n await this.applyMiddlewares();\n\n return this.toJSON();\n }\n\n /**\n * Gets the raw command and middleware collections.\n * @returns Object containing commands and middlewares collections\n */\n public getData() {\n return {\n commands: this.commands,\n middlewares: this.middlewares,\n };\n }\n\n /**\n * Converts the loaded data to a JSON-serializable format.\n * @returns Plain object with commands and middlewares\n */\n public toJSON() {\n return {\n commands: Object.fromEntries(this.commands.entries()),\n middlewares: Object.fromEntries(this.middlewares.entries()),\n };\n }\n\n /**\n * @private\n * @internal\n */\n private async traverse(path: string, category: string | null) {\n const entries = await readdir(path, {\n withFileTypes: true,\n });\n\n for (const entry of entries) {\n // ignore _ prefixed files\n if (entry.name.startsWith('_')) continue;\n\n if (entry.isFile()) {\n if (this.isCommand(entry.name) || this.isMiddleware(entry.name)) {\n await this.handle(entry, category);\n }\n } else if (\n entry.isDirectory() &&\n this.isCategory(entry.name) &&\n category\n ) {\n // nested category\n const nestedCategory = this.isCategory(entry.name)\n ? `${category}:${entry.name.slice(1, -1)}`\n : null;\n await this.traverse(join(path, entry.name), nestedCategory);\n }\n\n // TODO: handle subcommands\n }\n }\n\n /**\n * @private\n * @internal\n */\n private async handle(entry: Dirent, category: string | null = null) {\n const name = entry.name;\n const path = join(entry.parentPath, entry.name);\n\n if (this.isCommand(name)) {\n const command: Command = {\n id: crypto.randomUUID(),\n name: basename(path, extname(path)),\n path,\n category,\n parentPath: entry.parentPath,\n relativePath: this.replaceEntrypoint(path),\n middlewares: [],\n };\n\n this.commands.set(command.id, command);\n } else if (this.isMiddleware(name)) {\n const middleware: Middleware = {\n id: crypto.randomUUID(),\n name: basename(path, extname(path)),\n path,\n relativePath: this.replaceEntrypoint(path),\n parentPath: entry.parentPath,\n global: GLOBAL_MIDDLEWARE_PATTERN.test(name),\n command: COMMAND_MIDDLEWARE_PATTERN.test(name)\n ? name.split('.')[0] || null\n : null,\n };\n\n this.middlewares.set(middleware.id, middleware);\n }\n }\n\n /**\n * @private\n * @internal\n */\n private applyMiddlewares() {\n this.commands.forEach((command) => {\n const commandPath = command.parentPath;\n const samePathMiddlewares = Array.from(this.middlewares.values())\n .filter((middleware) => {\n if (middleware.global) return true;\n if (middleware.command) return middleware.command === command.name;\n return middleware.parentPath === commandPath;\n })\n .map((middleware) => middleware.id);\n\n command.middlewares = Array.from(\n new Set([...command.middlewares, ...samePathMiddlewares]),\n );\n });\n }\n\n /**\n * @private\n * @internal\n */\n private replaceEntrypoint(path: string) {\n const normalized = normalize(path);\n return normalized.replace(this.options.entrypoint, '');\n }\n}\n"],"mappings":";;;;;;;;;;;AAkDA,MAAM,qBAAqB;;;;;AAM3B,MAAM,6BACN;;;;;AAMA,MAAM,4BAA4B;;;;;AAMlC,MAAM,kBAAkB;;;;;AAMxB,MAAM,mBAAmB;;;;AAKzB,IAAa,iBAAb,MAA4B;;;;;CAK1B,AAAQ,WAAW,IAAI;;;;;CAMvB,AAAQ,cAAc,IAAI;;;;;CAM1B,AAAO,YAA6B,SAAgC;EAAhC;CAAiC;;;;;CAMrE,AAAO,SAAS,MAAyB;AACvC,OAAK,MAAM,CAAC,IAAI,QAAQ,IAAI,OAAO,QAAQ,KAAK,SAAS,EACvD,KAAK,SAAS,IAAI,IAAI,QAAQ;AAGhC,OAAK,MAAM,CAAC,IAAI,WAAW,IAAI,OAAO,QAAQ,KAAK,YAAY,EAC7D,KAAK,YAAY,IAAI,IAAI,WAAW;CAExC;;;;;CAMA,AAAO,cAAuB;AAC5B,iCAAkB,KAAK,QAAQ,WAAW;CAC5C;;;;;CAMA,AAAQ,UAAU,MAAuB;AACvC,SAAO,gBAAgB,KAAK,KAAK;CACnC;;;;;CAMA,AAAQ,aAAa,MAAuB;AAC1C,SACE,mBAAmB,KAAK,KAAK,IAC7B,0BAA0B,KAAK,KAAK,IACpC,2BAA2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AI,CAAC,GAAG,QAAQ,aAAa,GAAG,mBAAoB,GACzD;EACF,EAAC;CACJ;;;;;CAMA,AAAQ,kBAAkB,MAAc;EACtC,MAAM,sCAAuB,KAAK;AAClC,SAAO,WAAW,QAAQ,KAAK,QAAQ,YAAY,GAAG;CACxD;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EventWorkerContext-
|
|
1
|
+
{"version":3,"file":"EventWorkerContext-CSlD9rbx.js","names":[],"sources":["../src/app/events/EventWorkerContext.ts"],"sourcesContent":["import { AsyncLocalStorage } from 'node:async_hooks';\nimport { ParsedEvent } from '../router';\nimport { CommandKit } from '../../commandkit';\n\n/**\n * Context object containing information about the currently executing event.\n */\nexport interface EventWorkerContext {\n event: string;\n namespace: string | null;\n data: ParsedEvent;\n commandkit: CommandKit;\n arguments: any[];\n variables: Map<string, any>;\n}\n\n/**\n * @private\n * @internal\n */\nconst kEventWorker = Symbol('commandkitEventWorker');\n\n/**\n * Async local storage for event worker context.\n */\nexport const eventWorkerContext = new AsyncLocalStorage<EventWorkerContext>();\n\n/**\n * Runs a callback within an event worker context.\n * @param context - The event worker context\n * @param callback - The callback to execute\n * @returns The result of the callback\n */\nexport function runInEventWorkerContext<T>(\n context: EventWorkerContext,\n callback: () => T,\n): T {\n Reflect.set(context, kEventWorker, true);\n\n return eventWorkerContext.run(context, callback);\n}\n\n/**\n * Gets the current event worker context.\n * @returns The current event worker context\n * @throws Error if no context is found\n */\nexport function getEventWorkerContext(): EventWorkerContext {\n const context = eventWorkerContext.getStore();\n\n if (!context) {\n throw new Error('Event worker context not found');\n }\n\n return context;\n}\n\n/**\n * Type guard to check if an object is an event worker context.\n * @param worker - The object to check\n * @returns True if the object is an event worker context\n */\nexport function isEventWorkerContext(\n worker: any,\n): worker is EventWorkerContext {\n return worker && Reflect.get(worker, kEventWorker) === true;\n}\n"],"mappings":";;;;;;;;AAoBA,MAAM,eAAe,OAAO,wBAAwB;;;;AAKpD,MAAa,qBAAqB,IAAI;;;;;;;AAQtC,SAAgB,wBAChB,SACA,UACI;CACF,QAAQ,IAAI,SAAS,cAAc,KAAK;AAExC,QAAO,mBAAmB,IAAI,SAAS,SAAS;AAClD;;;;;;AAOA,SAAgB,wBAA4C;CAC1D,MAAM,UAAU,mBAAmB,UAAU;AAE7C,KAAI,CAAC,QACH,OAAM,IAAI,MAAM;AAGlB,QAAO;AACT;;;;;;AAOA,SAAgB,qBAChB,QAC+B;AAC7B,QAAO,UAAU,QAAQ,IAAI,QAAQ,aAAa,KAAK;AACzD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CommandKit } from "./analytics-engine-
|
|
1
|
+
import { CommandKit } from "./analytics-engine-Dkf4obI8.js";
|
|
2
2
|
import { ParsedEvent } from "./EventsRouter-BacqK6z3.js";
|
|
3
3
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
4
4
|
|
|
@@ -40,4 +40,4 @@ declare function getEventWorkerContext(): EventWorkerContext;
|
|
|
40
40
|
declare function isEventWorkerContext(worker: any): worker is EventWorkerContext;
|
|
41
41
|
//#endregion
|
|
42
42
|
export { EventWorkerContext, eventWorkerContext, getEventWorkerContext, isEventWorkerContext, runInEventWorkerContext };
|
|
43
|
-
//# sourceMappingURL=EventWorkerContext-
|
|
43
|
+
//# sourceMappingURL=EventWorkerContext-DtIbRhLz.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EventsRouter-
|
|
1
|
+
{"version":3,"file":"EventsRouter-C_J0M3uO.js","names":[],"sources":["../src/app/router/EventsRouter.ts"],"sourcesContent":["import { Collection } from 'discord.js';\nimport { existsSync } from 'node:fs';\nimport { readdir } from 'node:fs/promises';\nimport { join } from 'node:path';\n\n/**\n * Configuration options for the EventsRouter\n * @interface EventsRouterOptions\n */\nexport interface EventsRouterOptions {\n /** Root directory path where event handlers are located */\n entrypoints: string[];\n}\n\n/**\n * Represents a parsed event with its handlers\n * @interface ParsedEvent\n */\nexport interface ParsedEvent {\n /** Name of the event derived from directory name */\n event: string;\n /** Absolute path to the event directory */\n path: string;\n /** Array of file paths to event listener handlers */\n listeners: string[];\n /** Namespace of the event */\n namespace: string | null;\n}\n\n/** Collection of event names to their parsed metadata */\nexport type EventsTree = Record<string, ParsedEvent>;\n\n/**\n * Router for discovering and managing event handler files in a directory structure.\n * Events are represented by directories, and handlers are files within those directories.\n */\nexport class EventsRouter {\n /** Internal storage of parsed events */\n private events = new Collection<string, ParsedEvent>();\n\n /**\n * Creates a new EventsRouter instance\n * @param options - Configuration options for the router\n * @throws Error if entrypoint is not provided\n */\n public constructor(private options: EventsRouterOptions) {\n if (options.entrypoints) {\n options.entrypoints = Array.from(new Set(options.entrypoints));\n }\n\n if (!options.entrypoints?.length) {\n throw new Error('Entrypoint directory must be provided');\n }\n }\n\n /**\n * Adds new entrypoints to the router\n * @param entrypoints - Array of new entrypoint paths\n */\n public addEntrypoints(entrypoints: string[]) {\n this.options.entrypoints = Array.from(\n new Set([...this.options.entrypoints, ...entrypoints]),\n );\n }\n\n /**\n * Find a parsed event by its name\n * @param event - Name of the event to find\n * @returns Parsed event metadata or null if not found\n */\n public match(event: string): ParsedEvent | null {\n return this.events.get(event) ?? null;\n }\n\n /**\n * Get the entrypoint directory path\n * @returns Entrypoint directory path\n */\n public get entrypoints(): string[] {\n return this.options.entrypoints;\n }\n\n /**\n * Checks if the entrypoint path is valid\n */\n public isValidPath() {\n return this.entrypoints.every((entrypoint) => existsSync(entrypoint));\n }\n\n /**\n * Clear all parsed events\n */\n public clear() {\n this.events.clear();\n }\n\n /**\n * Reload and re-scan the entrypoint directory for events\n * @returns Promise resolving to the updated events tree\n */\n public async reload() {\n this.clear();\n return this.scan();\n }\n\n /**\n * Scan the entrypoint directory for events and their handlers\n * @returns Promise resolving to the events tree\n */\n public async scan(): Promise<EventsTree> {\n for (const entrypoint of this.entrypoints) {\n const dirs = await readdir(entrypoint, { withFileTypes: true });\n\n for (const dir of dirs) {\n if (dir.isDirectory()) {\n const path = join(entrypoint, dir.name);\n await this.scanEvent(dir.name, path, null, [], true);\n }\n }\n }\n\n return Object.fromEntries(this.events);\n }\n\n /**\n * Convert the internal events Collection to a plain object\n * @returns Events tree as a plain object\n */\n public toJSON(): EventsTree {\n return Object.fromEntries(this.events);\n }\n\n /**\n * Recursively scan a directory for event handlers\n * @param event - Name of the event\n * @param path - Path to the event directory\n * @param listeners - Array to collect listener file paths\n * @returns Promise resolving to the parsed event metadata\n */\n private async scanEvent(\n event: string,\n path: string,\n _namespace: string | null = null,\n listeners: string[] = [],\n isRoot = false,\n ): Promise<void> {\n const files = await readdir(path, { withFileTypes: true });\n const isNamespace = isRoot && /^\\(.+\\)$/.test(event);\n\n // if event = (something) pattern then namespace is something\n const namespace = isNamespace ? event.slice(1, -1) : (_namespace ?? null);\n\n files.sort((a, b) => a.name.localeCompare(b.name));\n\n for (const file of files) {\n if (file.name.startsWith('_')) continue;\n\n if (file.isDirectory()) {\n const nextPath = join(path, file.name);\n await this.scanEvent(file.name, nextPath, namespace, listeners);\n continue;\n }\n\n if (file.isFile() && /\\.(m|c)?(j|t)sx?$/.test(file.name)) {\n listeners.push(join(file.parentPath, file.name));\n }\n }\n\n if (!isNamespace) {\n const existing = this.events.get(event);\n\n if (existing) {\n existing.listeners = Array.from(\n new Set([...existing.listeners, ...listeners]),\n );\n\n return;\n }\n\n this.events.set(event, { event, path, listeners, namespace });\n }\n }\n}\n"],"mappings":";;;;;;;;;;;AAoCA,IAAa,eAAb,MAA0B;;CAExB,AAAQ,SAAS,IAAI;;;;;;CAOrB,AAAO,YAAoB,SAA8B;;EAA9B;AACzB,MAAI,QAAQ,aACV,QAAQ,cAAc,MAAM,KAAK,IAAI,IAAI,QAAQ,aAAa;AAGhE,MAAI,0BAAC,QAAQ,yFAAa,QACxB,OAAM,IAAI,MAAM;CAEpB;;;;;CAMA,AAAO,eAAe,aAAuB;EAC3C,KAAK,QAAQ,cAAc,MAAM,KAC/B,IAAI,IAAI,CAAC,GAAG,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AAK;IACtC,MAAM,KAAK,UAAU,KAAK,MAAM,UAAU,WAAW,UAAU;AAC/D;GACF;AAEA,OAAI,KAAK,QAAQ,IAAI,oBAAoB,KAAK,KAAK,KAAK,EACtD,UAAU,yBAAU,KAAK,YAAY,KAAK,KAAK,CAAC;EAEpD;AAEA,MAAI,CAAC,aAAa;GAChB,MAAM,WAAW,KAAK,OAAO,IAAI,MAAM;AAEvC,OAAI,UAAU;IACZ,SAAS,YAAY,MAAM,KACzB,IAAI,IAAI,CAAC,GAAG,SAAS,WAAW,GAAG,SAAU,GAC9C;AAED;GACF;GAEA,KAAK,OAAO,IAAI,OAAO;IAAE;IAAO;IAAM;IAAW;GAAW,EAAC;EAC/D;CACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageCommandParser-CGhN3xNN.js","names":[],"sources":["../src/app/commands/MessageCommandParser.ts"],"sourcesContent":["import { Channel } from 'diagnostics_channel';\nimport {\n Message,\n ApplicationCommandOptionType,\n GuildMember,\n Attachment,\n User,\n Role,\n CommandInteractionOption,\n} from 'discord.js';\nimport {\n CommandKitErrorCodes,\n createCommandKitError,\n} from '../../utils/error-codes';\n\n/**\n * Represents a parsed message command with its components.\n */\nexport interface ParsedMessageCommand {\n command: string;\n options: { name: string; value: unknown }[];\n subcommand?: string;\n subcommandGroup?: string;\n}\n\n/**\n * Schema defining the types of options for a message command.\n */\nexport type MessageCommandOptionsSchema = Record<\n string,\n ApplicationCommandOptionType\n>;\n\n/**\n * Parses message content into structured command data with options and subcommands.\n */\nexport class MessageCommandParser {\n /**\n * @private\n * @internal\n */\n #parsed: ParsedMessageCommand | null = null;\n\n /**\n * @private\n * @internal\n */\n #options: MessageCommandOptions | null = null;\n\n /**\n * @private\n * @internal\n */\n #args: string[] = [];\n\n /**\n * Creates a new message command parser.\n * @param message - The Discord message to parse\n * @param prefix - Array of valid command prefixes\n * @param schema - Function that returns the options schema for a command\n */\n public constructor(\n public message: Message,\n private prefix: string[],\n private schema: (command: string) => MessageCommandOptionsSchema,\n ) {}\n\n /**\n * Gets the parsed command arguments.\n * @returns Array of command arguments\n */\n public getArgs() {\n void this.parse();\n return this.#args;\n }\n\n /**\n * Gets the message command options object for easy access to typed option values.\n */\n public get options() {\n if (!this.#options) {\n this.#options = new MessageCommandOptions(this);\n }\n\n return this.#options;\n }\n\n /**\n * Gets a specific option value by name.\n * @param name - The option name\n * @returns The option value or undefined if not found\n */\n public getOption<T>(name: string): T | undefined {\n return this.parse().options.find((o) => o.name === name)?.value as T;\n }\n\n /**\n * Gets the main command name.\n * @returns The command name\n */\n public getCommand(): string {\n return this.parse().command;\n }\n\n /**\n * Gets the subcommand name if present.\n * @returns The subcommand name or undefined\n */\n public getSubcommand(): string | undefined {\n return this.parse().subcommand;\n }\n\n /**\n * Gets the subcommand group name if present.\n * @returns The subcommand group name or undefined\n */\n public getSubcommandGroup(): string | undefined {\n return this.parse().subcommandGroup;\n }\n\n /**\n * Gets the prefix used in the message.\n * @returns The matched prefix or undefined\n */\n public getPrefix() {\n for (const p of this.prefix) {\n if (this.message.content.startsWith(p)) {\n return p;\n }\n }\n }\n\n /**\n * Gets the full command including subcommand group and subcommand.\n * @returns The complete command string\n */\n public getFullCommand() {\n return [this.getCommand(), this.getSubcommandGroup(), this.getSubcommand()]\n .filter((v) => v)\n .join(' ');\n }\n\n /**\n * Parses the message content into structured command data.\n * @returns The parsed command data\n */\n public parse(): ParsedMessageCommand {\n if (this.#parsed) {\n return this.#parsed;\n }\n\n const content = this.message.content;\n\n const prefix = this.getPrefix();\n\n if (!prefix) {\n throw createCommandKitError(CommandKitErrorCodes.InvalidCommandPrefix);\n }\n\n const parts = content.slice(prefix.length).trim().split(' ');\n const command = parts.shift();\n\n this.#args = parts;\n\n let subcommandGroup: string | undefined;\n let subcommand: string | undefined;\n\n if (command?.includes(':')) {\n const [, group, cmd] = command.split(':');\n\n if (!cmd && group) {\n subcommand = group;\n } else if (cmd && group) {\n subcommandGroup = group;\n subcommand = cmd;\n }\n }\n\n const schema = this.schema(\n [command, subcommandGroup, subcommand].filter(Boolean).join(' ').trim(),\n );\n\n const options = parts\n .map((part) => {\n try {\n const [name, value] = part.split(':');\n\n if (!(name in schema)) return null;\n\n switch (schema[name]) {\n case ApplicationCommandOptionType.Boolean:\n return { name, value: value === 'true' };\n case ApplicationCommandOptionType.Integer:\n return { name, value: parseInt(value, 10) };\n case ApplicationCommandOptionType.Number:\n return { name, value: parseFloat(value) };\n case ApplicationCommandOptionType.String:\n return { name, value };\n case ApplicationCommandOptionType.User:\n return {\n name,\n value: this.message.mentions.users.find((u) => {\n return u.id === value.replace(/[<@!>]/g, '');\n }),\n };\n case ApplicationCommandOptionType.Channel:\n return {\n name,\n value: this.message.mentions.channels.find((c) => {\n return c.id === value.replace(/[<#>]/g, '');\n }),\n };\n case ApplicationCommandOptionType.Role:\n return {\n name,\n value: this.message.mentions.roles.find((r) => {\n return r.id === value.replace(/[<@&>]/g, '');\n }),\n };\n case ApplicationCommandOptionType.Attachment:\n return {\n name,\n value: this.message.attachments.find((a) => {\n return a.name === value;\n }),\n };\n default:\n return null;\n }\n } catch {\n // Invalid option\n return null;\n }\n })\n .filter((v) => v !== null);\n\n this.#parsed = {\n command: command!,\n options,\n subcommand,\n subcommandGroup,\n };\n\n return this.#parsed;\n }\n}\n\n/**\n * Provides typed access to message command options with methods similar to Discord.js interaction options.\n */\nexport class MessageCommandOptions {\n /**\n * Creates a new message command options instance.\n * @param parser - The message command parser instance\n */\n public constructor(private parser: MessageCommandParser) {}\n\n /**\n * @private\n * @internal\n */\n private assertOption<T>(name: string, required = false) {\n const option = this.parser.getOption<T>(name);\n\n if (required && option === undefined) {\n throw new Error(`Option \"${name}\" is required.`);\n }\n\n return option ?? null;\n }\n\n /**\n * Gets a guild member from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The guild member or null if not found\n */\n getMember(name: string): GuildMember | null;\n getMember(name: string, required: true): GuildMember;\n getMember(name: string, required = false) {\n const user = this.assertOption<User>(name, required);\n const member = this.parser.message.guild?.members.cache.get(user?.id!);\n\n if (required && !member) {\n throw new Error(`Member \"${name}\" is required.`);\n }\n\n return member ?? null;\n }\n\n /**\n * Gets an attachment from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The attachment or null if not found\n */\n getAttachment(name: string): Attachment | null;\n getAttachment(name: string, required: true): Attachment;\n getAttachment(name: string, required = false) {\n return this.assertOption<Attachment>(name, required);\n }\n\n /**\n * Gets a boolean value from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The boolean value or null if not found\n */\n getBoolean(name: string): boolean | null;\n getBoolean(name: string, required: true): boolean;\n getBoolean(name: string, required = false) {\n return this.assertOption<boolean>(name, required);\n }\n\n /**\n * Gets a number value from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The number value or null if not found\n */\n getNumber(name: string): number | null;\n getNumber(name: string, required: true): number;\n getNumber(name: string, required = false) {\n return this.assertOption<number>(name, required);\n }\n\n /**\n * Gets a string value from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The string value or null if not found\n */\n getString(name: string): string | null;\n getString(name: string, required: true): string;\n getString(name: string, required = false) {\n return this.assertOption<string>(name, required);\n }\n\n /**\n * Gets an integer value from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The integer value or null if not found\n */\n getInteger(name: string): number | null;\n getInteger(name: string, required: true): number;\n getInteger(name: string, required = false) {\n return this.assertOption<number>(name, required);\n }\n\n /**\n * Gets a user from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The user or null if not found\n */\n getUser(name: string): User | null;\n getUser(name: string, required: true): User;\n getUser(name: string, required = false) {\n return this.assertOption<User>(name, required);\n }\n\n /**\n * Gets a channel from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The channel or null if not found\n */\n getChannel(name: string): Channel | null;\n getChannel(name: string, required: true): Channel;\n getChannel(name: string, required = false) {\n return this.assertOption<Channel>(name, required);\n }\n\n /**\n * Gets a role from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The role or null if not found\n */\n getRole(name: string): Role | null;\n getRole(name: string, required: true): Role;\n getRole(name: string, required = false) {\n return this.assertOption<Role>(name, required);\n }\n\n /**\n * Gets a mentionable (user, member, or role) from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The mentionable or null if not found\n */\n getMentionable(\n name: string,\n ): NonNullable<CommandInteractionOption['member' | 'role' | 'user']> | null;\n getMentionable(\n name: string,\n required: true,\n ): NonNullable<CommandInteractionOption['member' | 'role' | 'user']>;\n getMentionable(\n name: string,\n required = false,\n ): NonNullable<CommandInteractionOption['member' | 'role' | 'user']> | null {\n const target = this.assertOption(name, required);\n\n if (\n target instanceof GuildMember ||\n target instanceof User ||\n target instanceof Role\n ) {\n return target;\n }\n\n if (required) {\n throw new Error(`Mentionable \"${name}\" is required.`);\n }\n\n return null;\n }\n\n /**\n * Gets the subcommand name from the command.\n * @param required - Whether the subcommand is required\n * @returns The subcommand name or null if not found\n */\n getSubcommand(): string | null;\n getSubcommand(required: true): string;\n getSubcommand(required = false) {\n const sub = this.parser.getSubcommand();\n\n if (required && sub === undefined) {\n throw new Error('Subcommand is required.');\n }\n\n return sub ?? null;\n }\n\n /**\n * Gets the subcommand group name from the command.\n * @param required - Whether the subcommand group is required\n * @returns The subcommand group name or null if not found\n */\n getSubcommandGroup(): string | null;\n getSubcommandGroup(required: true): string;\n getSubcommandGroup(required = false) {\n const sub = this.parser.getSubcommandGroup();\n\n if (required && sub === undefined) {\n throw new Error('Subcommand group is required.');\n }\n\n return sub ?? null;\n }\n}\n"],"mappings":";;;;;;;;AAoCA,IAAa,uBAAb,MAAkC;;;;;CAKhC,UAAuC;;;;;CAMvC,WAAyC;;;;;CAMzC,QAAkB,CAAE;;;;;;;CAQpB,AAAO,YACA,SACC,QACA,QACR;EAHO;EACC;EACA;CACN;;;;;CAMF,AAAO,UAAU;EACV,KAAK,OAAO;AACjB,SAAO,KAAK;C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,SAAS;AAEhD,MACA,kBAAkB,0BAClB,kBAAkB,mBAClB,kBAAkB,gBAEhB,QAAO;AAGT,MAAI,SACF,OAAM,IAAI,MAAM,CAAC,aAAa,EAAE,KAAK,cAAc,CAAC;AAGtD,SAAO;CACT;CASA,cAAc,WAAW,OAAO;EAC9B,MAAM,MAAM,KAAK,OAAO,eAAe;AAEvC,MAAI,YAAY,QAAQ,OACtB,OAAM,IAAI,MAAM;AAGlB,SAAO,OAAO;CAChB;CASA,mBAAmB,WAAW,OAAO;EACnC,MAAM,MAAM,KAAK,OAAO,oBAAoB;AAE5C,MAAI,YAAY,QAAQ,OACtB,OAAM,IAAI,MAAM;AAGlB,SAAO,OAAO;CAChB;AACF"}
|
|
1
|
+
{"version":3,"file":"MessageCommandParser-B_BEQ3p8.js","names":[],"sources":["../src/app/commands/MessageCommandParser.ts"],"sourcesContent":["import { Channel } from 'diagnostics_channel';\nimport {\n Message,\n ApplicationCommandOptionType,\n GuildMember,\n Attachment,\n User,\n Role,\n CommandInteractionOption,\n} from 'discord.js';\nimport {\n CommandKitErrorCodes,\n createCommandKitError,\n} from '../../utils/error-codes';\n\n/**\n * Represents a parsed message command with its components.\n */\nexport interface ParsedMessageCommand {\n command: string;\n options: { name: string; value: unknown }[];\n subcommand?: string;\n subcommandGroup?: string;\n}\n\n/**\n * Schema defining the types of options for a message command.\n */\nexport type MessageCommandOptionsSchema = Record<\n string,\n ApplicationCommandOptionType\n>;\n\n/**\n * Parses message content into structured command data with options and subcommands.\n */\nexport class MessageCommandParser {\n /**\n * @private\n * @internal\n */\n #parsed: ParsedMessageCommand | null = null;\n\n /**\n * @private\n * @internal\n */\n #options: MessageCommandOptions | null = null;\n\n /**\n * @private\n * @internal\n */\n #args: string[] = [];\n\n /**\n * Creates a new message command parser.\n * @param message - The Discord message to parse\n * @param prefix - Array of valid command prefixes\n * @param schema - Function that returns the options schema for a command\n */\n public constructor(\n public message: Message,\n private prefix: string[],\n private schema: (command: string) => MessageCommandOptionsSchema,\n ) {}\n\n /**\n * Gets the parsed command arguments.\n * @returns Array of command arguments\n */\n public getArgs() {\n void this.parse();\n return this.#args;\n }\n\n /**\n * Gets the message command options object for easy access to typed option values.\n */\n public get options() {\n if (!this.#options) {\n this.#options = new MessageCommandOptions(this);\n }\n\n return this.#options;\n }\n\n /**\n * Gets a specific option value by name.\n * @param name - The option name\n * @returns The option value or undefined if not found\n */\n public getOption<T>(name: string): T | undefined {\n return this.parse().options.find((o) => o.name === name)?.value as T;\n }\n\n /**\n * Gets the main command name.\n * @returns The command name\n */\n public getCommand(): string {\n return this.parse().command;\n }\n\n /**\n * Gets the subcommand name if present.\n * @returns The subcommand name or undefined\n */\n public getSubcommand(): string | undefined {\n return this.parse().subcommand;\n }\n\n /**\n * Gets the subcommand group name if present.\n * @returns The subcommand group name or undefined\n */\n public getSubcommandGroup(): string | undefined {\n return this.parse().subcommandGroup;\n }\n\n /**\n * Gets the prefix used in the message.\n * @returns The matched prefix or undefined\n */\n public getPrefix() {\n for (const p of this.prefix) {\n if (this.message.content.startsWith(p)) {\n return p;\n }\n }\n }\n\n /**\n * Gets the full command including subcommand group and subcommand.\n * @returns The complete command string\n */\n public getFullCommand() {\n return [this.getCommand(), this.getSubcommandGroup(), this.getSubcommand()]\n .filter((v) => v)\n .join(' ');\n }\n\n /**\n * Parses the message content into structured command data.\n * @returns The parsed command data\n */\n public parse(): ParsedMessageCommand {\n if (this.#parsed) {\n return this.#parsed;\n }\n\n const content = this.message.content;\n\n const prefix = this.getPrefix();\n\n if (!prefix) {\n throw createCommandKitError(CommandKitErrorCodes.InvalidCommandPrefix);\n }\n\n const parts = content.slice(prefix.length).trim().split(' ');\n const command = parts.shift();\n\n this.#args = parts;\n\n let subcommandGroup: string | undefined;\n let subcommand: string | undefined;\n\n if (command?.includes(':')) {\n const [, group, cmd] = command.split(':');\n\n if (!cmd && group) {\n subcommand = group;\n } else if (cmd && group) {\n subcommandGroup = group;\n subcommand = cmd;\n }\n }\n\n const schema = this.schema(\n [command, subcommandGroup, subcommand].filter(Boolean).join(' ').trim(),\n );\n\n const options = parts\n .map((part) => {\n try {\n const [name, value] = part.split(':');\n\n if (!(name in schema)) return null;\n\n switch (schema[name]) {\n case ApplicationCommandOptionType.Boolean:\n return { name, value: value === 'true' };\n case ApplicationCommandOptionType.Integer:\n return { name, value: parseInt(value, 10) };\n case ApplicationCommandOptionType.Number:\n return { name, value: parseFloat(value) };\n case ApplicationCommandOptionType.String:\n return { name, value };\n case ApplicationCommandOptionType.User:\n return {\n name,\n value: this.message.mentions.users.find((u) => {\n return u.id === value.replace(/[<@!>]/g, '');\n }),\n };\n case ApplicationCommandOptionType.Channel:\n return {\n name,\n value: this.message.mentions.channels.find((c) => {\n return c.id === value.replace(/[<#>]/g, '');\n }),\n };\n case ApplicationCommandOptionType.Role:\n return {\n name,\n value: this.message.mentions.roles.find((r) => {\n return r.id === value.replace(/[<@&>]/g, '');\n }),\n };\n case ApplicationCommandOptionType.Attachment:\n return {\n name,\n value: this.message.attachments.find((a) => {\n return a.name === value;\n }),\n };\n default:\n return null;\n }\n } catch {\n // Invalid option\n return null;\n }\n })\n .filter((v) => v !== null);\n\n this.#parsed = {\n command: command!,\n options,\n subcommand,\n subcommandGroup,\n };\n\n return this.#parsed;\n }\n}\n\n/**\n * Provides typed access to message command options with methods similar to Discord.js interaction options.\n */\nexport class MessageCommandOptions {\n /**\n * Creates a new message command options instance.\n * @param parser - The message command parser instance\n */\n public constructor(private parser: MessageCommandParser) {}\n\n /**\n * @private\n * @internal\n */\n private assertOption<T>(name: string, required = false) {\n const option = this.parser.getOption<T>(name);\n\n if (required && option === undefined) {\n throw new Error(`Option \"${name}\" is required.`);\n }\n\n return option ?? null;\n }\n\n /**\n * Gets a guild member from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The guild member or null if not found\n */\n getMember(name: string): GuildMember | null;\n getMember(name: string, required: true): GuildMember;\n getMember(name: string, required = false) {\n const user = this.assertOption<User>(name, required);\n const member = this.parser.message.guild?.members.cache.get(user?.id!);\n\n if (required && !member) {\n throw new Error(`Member \"${name}\" is required.`);\n }\n\n return member ?? null;\n }\n\n /**\n * Gets an attachment from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The attachment or null if not found\n */\n getAttachment(name: string): Attachment | null;\n getAttachment(name: string, required: true): Attachment;\n getAttachment(name: string, required = false) {\n return this.assertOption<Attachment>(name, required);\n }\n\n /**\n * Gets a boolean value from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The boolean value or null if not found\n */\n getBoolean(name: string): boolean | null;\n getBoolean(name: string, required: true): boolean;\n getBoolean(name: string, required = false) {\n return this.assertOption<boolean>(name, required);\n }\n\n /**\n * Gets a number value from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The number value or null if not found\n */\n getNumber(name: string): number | null;\n getNumber(name: string, required: true): number;\n getNumber(name: string, required = false) {\n return this.assertOption<number>(name, required);\n }\n\n /**\n * Gets a string value from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The string value or null if not found\n */\n getString(name: string): string | null;\n getString(name: string, required: true): string;\n getString(name: string, required = false) {\n return this.assertOption<string>(name, required);\n }\n\n /**\n * Gets an integer value from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The integer value or null if not found\n */\n getInteger(name: string): number | null;\n getInteger(name: string, required: true): number;\n getInteger(name: string, required = false) {\n return this.assertOption<number>(name, required);\n }\n\n /**\n * Gets a user from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The user or null if not found\n */\n getUser(name: string): User | null;\n getUser(name: string, required: true): User;\n getUser(name: string, required = false) {\n return this.assertOption<User>(name, required);\n }\n\n /**\n * Gets a channel from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The channel or null if not found\n */\n getChannel(name: string): Channel | null;\n getChannel(name: string, required: true): Channel;\n getChannel(name: string, required = false) {\n return this.assertOption<Channel>(name, required);\n }\n\n /**\n * Gets a role from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The role or null if not found\n */\n getRole(name: string): Role | null;\n getRole(name: string, required: true): Role;\n getRole(name: string, required = false) {\n return this.assertOption<Role>(name, required);\n }\n\n /**\n * Gets a mentionable (user, member, or role) from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The mentionable or null if not found\n */\n getMentionable(\n name: string,\n ): NonNullable<CommandInteractionOption['member' | 'role' | 'user']> | null;\n getMentionable(\n name: string,\n required: true,\n ): NonNullable<CommandInteractionOption['member' | 'role' | 'user']>;\n getMentionable(\n name: string,\n required = false,\n ): NonNullable<CommandInteractionOption['member' | 'role' | 'user']> | null {\n const target = this.assertOption(name, required);\n\n if (\n target instanceof GuildMember ||\n target instanceof User ||\n target instanceof Role\n ) {\n return target;\n }\n\n if (required) {\n throw new Error(`Mentionable \"${name}\" is required.`);\n }\n\n return null;\n }\n\n /**\n * Gets the subcommand name from the command.\n * @param required - Whether the subcommand is required\n * @returns The subcommand name or null if not found\n */\n getSubcommand(): string | null;\n getSubcommand(required: true): string;\n getSubcommand(required = false) {\n const sub = this.parser.getSubcommand();\n\n if (required && sub === undefined) {\n throw new Error('Subcommand is required.');\n }\n\n return sub ?? null;\n }\n\n /**\n * Gets the subcommand group name from the command.\n * @param required - Whether the subcommand group is required\n * @returns The subcommand group name or null if not found\n */\n getSubcommandGroup(): string | null;\n getSubcommandGroup(required: true): string;\n getSubcommandGroup(required = false) {\n const sub = this.parser.getSubcommandGroup();\n\n if (required && sub === undefined) {\n throw new Error('Subcommand group is required.');\n }\n\n return sub ?? null;\n }\n}\n"],"mappings":";;;;;;;;AAoCA,IAAa,uBAAb,MAAkC;;;;;CAKhC,UAAuC;;;;;CAMvC,WAAyC;;;;;CAMzC,QAAkB,CAAE;;;;;;;CAQpB,AAAO,YACA,SACC,QACA,QACR;EAHO;EACC;EACA;CACN;;;;;CAMF,AAAO,UAAU;EACV,KAAK,OAAO;AACjB,SAAO,KAAK;CACd;;;;CAKA,IAAW,UAAU;A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,0BAClB,kBAAkB,mBAClB,kBAAkB,gBAEhB,QAAO;AAGT,MAAI,SACF,OAAM,IAAI,MAAM,CAAC,aAAa,EAAE,KAAK,cAAc,CAAC;AAGtD,SAAO;CACT;CASA,cAAc,WAAW,OAAO;EAC9B,MAAM,MAAM,KAAK,OAAO,eAAe;AAEvC,MAAI,YAAY,QAAQ,OACtB,OAAM,IAAI,MAAM;AAGlB,SAAO,OAAO;CAChB;CASA,mBAAmB,WAAW,OAAO;EACnC,MAAM,MAAM,KAAK,OAAO,oBAAoB;AAE5C,MAAI,YAAY,QAAQ,OACtB,OAAM,IAAI,MAAM;AAGlB,SAAO,OAAO;CAChB;AACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnalyticsEngine, FilterFunction } from "../analytics-engine-
|
|
1
|
+
import { AnalyticsEngine, FilterFunction } from "../analytics-engine-Dkf4obI8.js";
|
|
2
2
|
import "../EventInterceptor-x-R2qshQ.js";
|
|
3
3
|
import "../ButtonKit-C7r7RPNf.js";
|
|
4
4
|
import "../ModalKit-Btz58KYn.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require('../colors-Cd4Oz-r-.js');
|
|
2
2
|
require('../ActionRow-CmTHbo2t.js');
|
|
3
3
|
require('../error-codes-C-ViHyu-.js');
|
|
4
|
-
const require_commandkit = require('../commandkit-
|
|
4
|
+
const require_commandkit = require('../commandkit-DvT6a16t.js');
|
|
5
5
|
require('../common-CcfjYnPG.js');
|
|
6
6
|
require('../common-vnMIelAE.js');
|
|
7
7
|
require('../container-DCjIgp-B.js');
|
|
@@ -20,17 +20,18 @@ require('../CompilerPlugin-CjoZAAR8.js');
|
|
|
20
20
|
require('../RuntimePlugin-CBgBLXTG.js');
|
|
21
21
|
require('../types-q0Nm882H.js');
|
|
22
22
|
require('../runtime-5fxB4uhe.js');
|
|
23
|
-
require('../
|
|
24
|
-
require('../
|
|
25
|
-
require('../
|
|
26
|
-
require('../
|
|
27
|
-
require('../
|
|
28
|
-
require('../
|
|
29
|
-
require('../
|
|
30
|
-
require('../
|
|
31
|
-
require('../
|
|
32
|
-
require('../
|
|
33
|
-
require('../
|
|
34
|
-
require('../
|
|
23
|
+
require('../utils-BnXM4eKk.js');
|
|
24
|
+
require('../resolve-file-url-DHTQj2mU.js');
|
|
25
|
+
require('../types-package-DrnIdWLg.js');
|
|
26
|
+
require('../EventWorkerContext-CSlD9rbx.js');
|
|
27
|
+
require('../signals-DHdYrd-n.js');
|
|
28
|
+
require('../constants-CUND8XkG.js');
|
|
29
|
+
require('../MessageCommandParser-B_BEQ3p8.js');
|
|
30
|
+
require('../CommandsRouter-CJJ0_WSr.js');
|
|
31
|
+
require('../EventsRouter-C_J0M3uO.js');
|
|
32
|
+
require('../router-DHnFRADH.js');
|
|
33
|
+
require('../common-DNADUU3_.js');
|
|
34
|
+
require('../CommandKitEventsChannel-Bgw0XCOl.js');
|
|
35
|
+
require('../store-CiqLHedg.js');
|
|
35
36
|
|
|
36
37
|
exports.AnalyticsEngine = require_commandkit.AnalyticsEngine;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnalyticsEvent, AnalyticsProvider, IdentifyEvent } from "../analytics-engine-
|
|
1
|
+
import { AnalyticsEvent, AnalyticsProvider, IdentifyEvent } from "../analytics-engine-Dkf4obI8.js";
|
|
2
2
|
import "../EventInterceptor-x-R2qshQ.js";
|
|
3
3
|
import "../ButtonKit-C7r7RPNf.js";
|
|
4
4
|
import "../ModalKit-Btz58KYn.js";
|
package/dist/analytics/utils.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require('../colors-Cd4Oz-r-.js');
|
|
2
2
|
require('../ActionRow-CmTHbo2t.js');
|
|
3
3
|
require('../error-codes-C-ViHyu-.js');
|
|
4
|
-
const require_commandkit = require('../commandkit-
|
|
4
|
+
const require_commandkit = require('../commandkit-DvT6a16t.js');
|
|
5
5
|
require('../common-CcfjYnPG.js');
|
|
6
6
|
require('../common-vnMIelAE.js');
|
|
7
7
|
require('../container-DCjIgp-B.js');
|
|
@@ -20,18 +20,19 @@ require('../CompilerPlugin-CjoZAAR8.js');
|
|
|
20
20
|
require('../RuntimePlugin-CBgBLXTG.js');
|
|
21
21
|
require('../types-q0Nm882H.js');
|
|
22
22
|
require('../runtime-5fxB4uhe.js');
|
|
23
|
-
require('../
|
|
24
|
-
require('../
|
|
25
|
-
require('../
|
|
26
|
-
require('../
|
|
27
|
-
require('../
|
|
28
|
-
require('../
|
|
29
|
-
require('../
|
|
30
|
-
require('../
|
|
31
|
-
require('../
|
|
32
|
-
require('../
|
|
33
|
-
require('../
|
|
34
|
-
require('../
|
|
23
|
+
require('../utils-BnXM4eKk.js');
|
|
24
|
+
require('../resolve-file-url-DHTQj2mU.js');
|
|
25
|
+
require('../types-package-DrnIdWLg.js');
|
|
26
|
+
require('../EventWorkerContext-CSlD9rbx.js');
|
|
27
|
+
require('../signals-DHdYrd-n.js');
|
|
28
|
+
require('../constants-CUND8XkG.js');
|
|
29
|
+
require('../MessageCommandParser-B_BEQ3p8.js');
|
|
30
|
+
require('../CommandsRouter-CJJ0_WSr.js');
|
|
31
|
+
require('../EventsRouter-C_J0M3uO.js');
|
|
32
|
+
require('../router-DHnFRADH.js');
|
|
33
|
+
require('../common-DNADUU3_.js');
|
|
34
|
+
require('../CommandKitEventsChannel-Bgw0XCOl.js');
|
|
35
|
+
require('../store-CiqLHedg.js');
|
|
35
36
|
|
|
36
37
|
exports.getDoNotTrack = require_commandkit.getDoNotTrack;
|
|
37
38
|
exports.noAnalytics = require_commandkit.noAnalytics;
|
|
@@ -8,6 +8,7 @@ import { HMREventType } from "./constants-MKu-Q1jh.js";
|
|
|
8
8
|
import EventEmitter from "node:events";
|
|
9
9
|
import { AutocompleteInteraction, Awaitable, CacheType, ChatInputCommandInteraction, Client, ClientEvents, Collection, Constructable, ContextMenuCommandBuilder, ContextMenuCommandInteraction, Guild, Interaction, Locale, Message, MessageContextMenuCommandInteraction, RESTPostAPIApplicationCommandsJSONBody, SlashCommandBuilder, TextBasedChannel, UserContextMenuCommandInteraction } from "discord.js";
|
|
10
10
|
import { DirectiveTransformerOptions } from "directive-to-hof";
|
|
11
|
+
import { Options } from "tsdown";
|
|
11
12
|
|
|
12
13
|
//#region src/types.d.ts
|
|
13
14
|
type Prettify<T> = { [K in keyof T]: T[K] } & {};
|
|
@@ -1758,6 +1759,28 @@ declare function flag<Returns = boolean, Entity = Record<any, any>>(options: Fea
|
|
|
1758
1759
|
declare class FlagStore extends Collection<string, FeatureFlag<any, any>> {}
|
|
1759
1760
|
//#endregion
|
|
1760
1761
|
//#region src/config/types.d.ts
|
|
1762
|
+
interface CommandKitCompilerOptions {
|
|
1763
|
+
/**
|
|
1764
|
+
* The macro compiler options to use with CommandKit.
|
|
1765
|
+
*/
|
|
1766
|
+
macro?: {
|
|
1767
|
+
/**
|
|
1768
|
+
* Whether to enable macro function compilation in development mode.
|
|
1769
|
+
* @default false
|
|
1770
|
+
*/
|
|
1771
|
+
development?: boolean;
|
|
1772
|
+
};
|
|
1773
|
+
/**
|
|
1774
|
+
* The tsdown compiler options to use with CommandKit.
|
|
1775
|
+
* **DO NOT USE THIS UNLESS YOU KNOW WHAT YOU ARE DOING** as it alters the behavior of the build process.
|
|
1776
|
+
*/
|
|
1777
|
+
tsdown?: Partial<Options>;
|
|
1778
|
+
/**
|
|
1779
|
+
* Disables chunking of the output (production only, development never chunks).
|
|
1780
|
+
* @default false
|
|
1781
|
+
*/
|
|
1782
|
+
disableChunking?: boolean;
|
|
1783
|
+
}
|
|
1761
1784
|
interface CommandKitConfig {
|
|
1762
1785
|
/**
|
|
1763
1786
|
* The plugins to use with CommandKit.
|
|
@@ -1768,21 +1791,15 @@ interface CommandKitConfig {
|
|
|
1768
1791
|
* The rolldown plugins to use with CommandKit.
|
|
1769
1792
|
*/
|
|
1770
1793
|
rolldownPlugins?: any[];
|
|
1794
|
+
/**
|
|
1795
|
+
* The list of additional entrypoints to compile. Eg, `dir` or `dir/index.ts` or `dir/*.ts`, etc.
|
|
1796
|
+
* Similarly, negative patterns can be used to exclude files. Eg, `!dir/index.ts` or `!dir/*.ts`, etc.
|
|
1797
|
+
*/
|
|
1798
|
+
entrypoints?: string[];
|
|
1771
1799
|
/**
|
|
1772
1800
|
* The compiler options to use with CommandKit.
|
|
1773
1801
|
*/
|
|
1774
|
-
compilerOptions?:
|
|
1775
|
-
/**
|
|
1776
|
-
* Macro compiler configuration.
|
|
1777
|
-
*/
|
|
1778
|
-
macro?: {
|
|
1779
|
-
/**
|
|
1780
|
-
* Whether to enable macro function compilation in development mode.
|
|
1781
|
-
* @default false
|
|
1782
|
-
*/
|
|
1783
|
-
development?: boolean;
|
|
1784
|
-
};
|
|
1785
|
-
};
|
|
1802
|
+
compilerOptions?: CommandKitCompilerOptions;
|
|
1786
1803
|
/**
|
|
1787
1804
|
* The typescript configuration to use with CommandKit.
|
|
1788
1805
|
*/
|
|
@@ -1805,6 +1822,21 @@ interface CommandKitConfig {
|
|
|
1805
1822
|
* @default `dist`
|
|
1806
1823
|
*/
|
|
1807
1824
|
distDir?: string;
|
|
1825
|
+
/**
|
|
1826
|
+
* The anti-crash script configuration.
|
|
1827
|
+
*/
|
|
1828
|
+
antiCrashScript?: {
|
|
1829
|
+
/**
|
|
1830
|
+
* Whether to enable the anti-crash script in development mode.
|
|
1831
|
+
* @default true
|
|
1832
|
+
*/
|
|
1833
|
+
development?: boolean;
|
|
1834
|
+
/**
|
|
1835
|
+
* Whether to enable the anti-crash script in production mode. Usually, you should use other means to handle errors.
|
|
1836
|
+
* @default false
|
|
1837
|
+
*/
|
|
1838
|
+
production?: boolean;
|
|
1839
|
+
};
|
|
1808
1840
|
/**
|
|
1809
1841
|
* Whether or not to enable the source map generation.
|
|
1810
1842
|
*/
|
|
@@ -1839,16 +1871,23 @@ interface CommandKitConfig {
|
|
|
1839
1871
|
/**
|
|
1840
1872
|
* @private
|
|
1841
1873
|
*/
|
|
1842
|
-
type DeepRequired<T> = { [P in keyof T]-?: DeepRequired<T[P]> };
|
|
1874
|
+
type DeepRequired<T, OptionalKeys extends keyof T = never> = { [P in keyof T]-?: P extends OptionalKeys ? Partial<T[P]> : DeepRequired<T[P]> };
|
|
1843
1875
|
/**
|
|
1844
1876
|
* @private
|
|
1845
1877
|
*/
|
|
1846
1878
|
type DeepPartial<T> = { [P in keyof T]?: DeepPartial<T[P]> };
|
|
1847
1879
|
/**
|
|
1848
1880
|
* @private
|
|
1881
|
+
* @example
|
|
1882
|
+
* ```ts
|
|
1883
|
+
* const target = { a: 1, b: { c: 2 } };
|
|
1884
|
+
* const source = { b: { d: 3 } };
|
|
1885
|
+
* const result = mergeDeep(target, source);
|
|
1886
|
+
* // result = { a: 1, b: { c: 2, d: 3 } }
|
|
1887
|
+
* ```
|
|
1849
1888
|
*/
|
|
1850
|
-
declare const mergeDeep: <T extends Record<string, any>>(target: T, source
|
|
1851
|
-
type ResolvedCommandKitConfig = DeepRequired<CommandKitConfig>;
|
|
1889
|
+
declare const mergeDeep: <T extends Record<string, any>>(target: T, source?: T, tracker?: WeakMap<object, boolean>) => T;
|
|
1890
|
+
type ResolvedCommandKitConfig = DeepRequired<CommandKitConfig, 'compilerOptions'>;
|
|
1852
1891
|
//#endregion
|
|
1853
1892
|
//#region src/commandkit.d.ts
|
|
1854
1893
|
/**
|
|
@@ -2136,5 +2175,5 @@ declare class AnalyticsEngine {
|
|
|
2136
2175
|
track(event: AnalyticsEvent): Promise<void>;
|
|
2137
2176
|
}
|
|
2138
2177
|
//#endregion
|
|
2139
|
-
export { AnalyticsEngine, AnalyticsEvent, AnalyticsProvider, AnyCommandExecute, AppCommand, AppCommandHandler, AppCommandNative, AppCommandRunner, AppEventsHandler, AppEventsHandlerLoadedData, AsyncFunction, AutocompleteCommand, AutocompleteCommandContext, AutocompleteCommandMiddlewareContext, BootstrapFunction, ChatInputCommand, ChatInputCommandContext, CommandBuilderLike, CommandContext, CommandContextOptions, CommandData, CommandDataSchema, CommandDataSchemaKey, CommandDataSchemaValue, CommandExecutionMode, CommandFlagContext, CommandKit, CommandKitConfig, CommandKitConfiguration, CommandKitEnvironment, CommandKitEnvironmentInternalData, CommandKitEnvironmentType, CommandKitEventDispatch, CommandKitEventsChannel, CommandKitHMREvent, CommandKitOptions, CommandKitPlugin, CommandKitPluginRuntime, CommandRegistrar, CommandTypeData, CommonDirectiveTransformer, CommonDirectiveTransformerOptions, CommonPluginRuntime, CompilerPlugin, CompilerPluginRuntime, Context, ContextParameters, CustomAppCommandProps, CustomEvaluationContext, CustomEvaluationFunction, DecideFunction, DeepPartial, DeepRequired, EvaluationContext, EventFlagContext, EventListener, FeatureFlag, FeatureFlagDefinition, FilterFunction, FlagConfiguration, FlagProvider, FlagRunner, FlagStore, GenericFunction, IdentifyEvent, IdentifyFunction, InteractionCommandContext, InteractionCommandMiddlewareContext, IpcMessageCommand, JsonFlagProvider, ListenerFunction, LoadedCommand, LoadedEvent, MaybeFalsey, MaybePromise, MessageCommand, MessageCommandContext, MessageCommandMiddlewareContext, MessageContextMenuCommand, MessageContextMenuCommandContext, MessageContextMenuCommandMiddlewareContext, MiddlewareContext, MiddlewareContextArgs, PluginCommon, PluginOptions, PluginTransformParameters, PluginType, PreRegisterCommandsEvent, PreparedAppCommandExecution, ResolvableCommand, ResolvedCommandKitConfig, RunCommand, RunCommandOptions, RuntimePlugin, SlashCommandMiddlewareContext, TemplateHandler, TransformedResult, UserContextMenuCommand, UserContextMenuCommandContext, UserContextMenuCommandMiddlewareContext, after, cancelAfter, commandkit, exitContext, flag, getCommandKit, getContext, isCommandWorkerContext, isCompilerPlugin, isPlugin, isRuntimePlugin, makeContextAwareFunction, mergeDeep, onApplicationBootstrap, onBootstrap, provideContext, registerDevHooks, setFlagProvider, useEnvironment };
|
|
2140
|
-
//# sourceMappingURL=analytics-engine-
|
|
2178
|
+
export { AnalyticsEngine, AnalyticsEvent, AnalyticsProvider, AnyCommandExecute, AppCommand, AppCommandHandler, AppCommandNative, AppCommandRunner, AppEventsHandler, AppEventsHandlerLoadedData, AsyncFunction, AutocompleteCommand, AutocompleteCommandContext, AutocompleteCommandMiddlewareContext, BootstrapFunction, ChatInputCommand, ChatInputCommandContext, CommandBuilderLike, CommandContext, CommandContextOptions, CommandData, CommandDataSchema, CommandDataSchemaKey, CommandDataSchemaValue, CommandExecutionMode, CommandFlagContext, CommandKit, CommandKitCompilerOptions, CommandKitConfig, CommandKitConfiguration, CommandKitEnvironment, CommandKitEnvironmentInternalData, CommandKitEnvironmentType, CommandKitEventDispatch, CommandKitEventsChannel, CommandKitHMREvent, CommandKitOptions, CommandKitPlugin, CommandKitPluginRuntime, CommandRegistrar, CommandTypeData, CommonDirectiveTransformer, CommonDirectiveTransformerOptions, CommonPluginRuntime, CompilerPlugin, CompilerPluginRuntime, Context, ContextParameters, CustomAppCommandProps, CustomEvaluationContext, CustomEvaluationFunction, DecideFunction, DeepPartial, DeepRequired, EvaluationContext, EventFlagContext, EventListener, FeatureFlag, FeatureFlagDefinition, FilterFunction, FlagConfiguration, FlagProvider, FlagRunner, FlagStore, GenericFunction, IdentifyEvent, IdentifyFunction, InteractionCommandContext, InteractionCommandMiddlewareContext, IpcMessageCommand, JsonFlagProvider, ListenerFunction, LoadedCommand, LoadedEvent, MaybeFalsey, MaybePromise, MessageCommand, MessageCommandContext, MessageCommandMiddlewareContext, MessageContextMenuCommand, MessageContextMenuCommandContext, MessageContextMenuCommandMiddlewareContext, MiddlewareContext, MiddlewareContextArgs, PluginCommon, PluginOptions, PluginTransformParameters, PluginType, PreRegisterCommandsEvent, PreparedAppCommandExecution, ResolvableCommand, ResolvedCommandKitConfig, RunCommand, RunCommandOptions, RuntimePlugin, SlashCommandMiddlewareContext, TemplateHandler, TransformedResult, UserContextMenuCommand, UserContextMenuCommandContext, UserContextMenuCommandMiddlewareContext, after, cancelAfter, commandkit, exitContext, flag, getCommandKit, getContext, isCommandWorkerContext, isCompilerPlugin, isPlugin, isRuntimePlugin, makeContextAwareFunction, mergeDeep, onApplicationBootstrap, onBootstrap, provideContext, registerDevHooks, setFlagProvider, useEnvironment };
|
|
2179
|
+
//# sourceMappingURL=analytics-engine-Dkf4obI8.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AppCommandRunner, RunCommandOptions } from "../../analytics-engine-
|
|
1
|
+
import { AppCommandRunner, RunCommandOptions } from "../../analytics-engine-Dkf4obI8.js";
|
|
2
2
|
import "../../EventInterceptor-x-R2qshQ.js";
|
|
3
3
|
import "../../ButtonKit-C7r7RPNf.js";
|
|
4
4
|
import "../../ModalKit-Btz58KYn.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require('../../colors-Cd4Oz-r-.js');
|
|
2
2
|
require('../../ActionRow-CmTHbo2t.js');
|
|
3
3
|
require('../../error-codes-C-ViHyu-.js');
|
|
4
|
-
const require_commandkit = require('../../commandkit-
|
|
4
|
+
const require_commandkit = require('../../commandkit-DvT6a16t.js');
|
|
5
5
|
require('../../common-CcfjYnPG.js');
|
|
6
6
|
require('../../common-vnMIelAE.js');
|
|
7
7
|
require('../../container-DCjIgp-B.js');
|
|
@@ -20,17 +20,18 @@ require('../../CompilerPlugin-CjoZAAR8.js');
|
|
|
20
20
|
require('../../RuntimePlugin-CBgBLXTG.js');
|
|
21
21
|
require('../../types-q0Nm882H.js');
|
|
22
22
|
require('../../runtime-5fxB4uhe.js');
|
|
23
|
-
require('../../
|
|
24
|
-
require('../../
|
|
25
|
-
require('../../
|
|
26
|
-
require('../../
|
|
27
|
-
require('../../
|
|
28
|
-
require('../../
|
|
29
|
-
require('../../
|
|
30
|
-
require('../../
|
|
31
|
-
require('../../
|
|
32
|
-
require('../../
|
|
33
|
-
require('../../
|
|
34
|
-
require('../../
|
|
23
|
+
require('../../utils-BnXM4eKk.js');
|
|
24
|
+
require('../../resolve-file-url-DHTQj2mU.js');
|
|
25
|
+
require('../../types-package-DrnIdWLg.js');
|
|
26
|
+
require('../../EventWorkerContext-CSlD9rbx.js');
|
|
27
|
+
require('../../signals-DHdYrd-n.js');
|
|
28
|
+
require('../../constants-CUND8XkG.js');
|
|
29
|
+
require('../../MessageCommandParser-B_BEQ3p8.js');
|
|
30
|
+
require('../../CommandsRouter-CJJ0_WSr.js');
|
|
31
|
+
require('../../EventsRouter-C_J0M3uO.js');
|
|
32
|
+
require('../../router-DHnFRADH.js');
|
|
33
|
+
require('../../common-DNADUU3_.js');
|
|
34
|
+
require('../../CommandKitEventsChannel-Bgw0XCOl.js');
|
|
35
|
+
require('../../store-CiqLHedg.js');
|
|
35
36
|
|
|
36
37
|
exports.AppCommandRunner = require_commandkit.AppCommandRunner;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnyCommandExecute, AutocompleteCommand, AutocompleteCommandContext, AutocompleteCommandMiddlewareContext, ChatInputCommand, ChatInputCommandContext, CommandContextOptions, CommandExecutionMode, Context, ContextParameters, InteractionCommandContext, InteractionCommandMiddlewareContext, MessageCommand, MessageCommandContext, MessageCommandMiddlewareContext, MessageContextMenuCommand, MessageContextMenuCommandContext, MessageContextMenuCommandMiddlewareContext, MiddlewareContext, MiddlewareContextArgs, SlashCommandMiddlewareContext, UserContextMenuCommand, UserContextMenuCommandContext, UserContextMenuCommandMiddlewareContext } from "../../analytics-engine-
|
|
1
|
+
import { AnyCommandExecute, AutocompleteCommand, AutocompleteCommandContext, AutocompleteCommandMiddlewareContext, ChatInputCommand, ChatInputCommandContext, CommandContextOptions, CommandExecutionMode, Context, ContextParameters, InteractionCommandContext, InteractionCommandMiddlewareContext, MessageCommand, MessageCommandContext, MessageCommandMiddlewareContext, MessageContextMenuCommand, MessageContextMenuCommandContext, MessageContextMenuCommandMiddlewareContext, MiddlewareContext, MiddlewareContextArgs, SlashCommandMiddlewareContext, UserContextMenuCommand, UserContextMenuCommandContext, UserContextMenuCommandMiddlewareContext } from "../../analytics-engine-Dkf4obI8.js";
|
|
2
2
|
import "../../EventInterceptor-x-R2qshQ.js";
|
|
3
3
|
import "../../ButtonKit-C7r7RPNf.js";
|
|
4
4
|
import "../../ModalKit-Btz58KYn.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require('../../colors-Cd4Oz-r-.js');
|
|
2
2
|
require('../../ActionRow-CmTHbo2t.js');
|
|
3
3
|
require('../../error-codes-C-ViHyu-.js');
|
|
4
|
-
const require_commandkit = require('../../commandkit-
|
|
4
|
+
const require_commandkit = require('../../commandkit-DvT6a16t.js');
|
|
5
5
|
require('../../common-CcfjYnPG.js');
|
|
6
6
|
require('../../common-vnMIelAE.js');
|
|
7
7
|
require('../../container-DCjIgp-B.js');
|
|
@@ -20,18 +20,19 @@ require('../../CompilerPlugin-CjoZAAR8.js');
|
|
|
20
20
|
require('../../RuntimePlugin-CBgBLXTG.js');
|
|
21
21
|
require('../../types-q0Nm882H.js');
|
|
22
22
|
require('../../runtime-5fxB4uhe.js');
|
|
23
|
-
require('../../
|
|
24
|
-
require('../../
|
|
25
|
-
require('../../
|
|
26
|
-
require('../../
|
|
27
|
-
require('../../
|
|
28
|
-
require('../../
|
|
29
|
-
require('../../
|
|
30
|
-
require('../../
|
|
31
|
-
require('../../
|
|
32
|
-
require('../../
|
|
33
|
-
require('../../
|
|
34
|
-
require('../../
|
|
23
|
+
require('../../utils-BnXM4eKk.js');
|
|
24
|
+
require('../../resolve-file-url-DHTQj2mU.js');
|
|
25
|
+
require('../../types-package-DrnIdWLg.js');
|
|
26
|
+
require('../../EventWorkerContext-CSlD9rbx.js');
|
|
27
|
+
require('../../signals-DHdYrd-n.js');
|
|
28
|
+
require('../../constants-CUND8XkG.js');
|
|
29
|
+
require('../../MessageCommandParser-B_BEQ3p8.js');
|
|
30
|
+
require('../../CommandsRouter-CJJ0_WSr.js');
|
|
31
|
+
require('../../EventsRouter-C_J0M3uO.js');
|
|
32
|
+
require('../../router-DHnFRADH.js');
|
|
33
|
+
require('../../common-DNADUU3_.js');
|
|
34
|
+
require('../../CommandKitEventsChannel-Bgw0XCOl.js');
|
|
35
|
+
require('../../store-CiqLHedg.js');
|
|
35
36
|
|
|
36
37
|
exports.CommandExecutionMode = require_commandkit.CommandExecutionMode;
|
|
37
38
|
exports.Context = require_commandkit.Context;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
require('../../error-codes-C-ViHyu-.js');
|
|
2
|
-
const require_MessageCommandParser = require('../../MessageCommandParser-
|
|
2
|
+
const require_MessageCommandParser = require('../../MessageCommandParser-B_BEQ3p8.js');
|
|
3
3
|
|
|
4
4
|
exports.MessageCommandOptions = require_MessageCommandParser.MessageCommandOptions;
|
|
5
5
|
exports.MessageCommandParser = require_MessageCommandParser.MessageCommandParser;
|