@seedcord/services 0.7.0 → 0.7.1

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.
@@ -75,12 +75,36 @@ let SeedcordErrorCode = /* @__PURE__ */ function(SeedcordErrorCode) {
75
75
  SeedcordErrorCode[SeedcordErrorCode["DecoratorCommandGuildWithoutGuilds"] = 1305] = "DecoratorCommandGuildWithoutGuilds";
76
76
  /** Middleware priority provided by the decorator was not a finite number. */
77
77
  SeedcordErrorCode[SeedcordErrorCode["DecoratorInvalidMiddlewarePriority"] = 1306] = "DecoratorInvalidMiddlewarePriority";
78
- /** buildSlashRoute received an invalid argument. */
79
- SeedcordErrorCode[SeedcordErrorCode["UtilInvalidSlashRouteArgument"] = 1403] = "UtilInvalidSlashRouteArgument";
80
78
  /** StrictEventEmitter.waitFor was aborted via its AbortSignal. */
81
79
  SeedcordErrorCode[SeedcordErrorCode["EventEmitterWaitForAborted"] = 1501] = "EventEmitterWaitForAborted";
82
80
  /** StrictEventEmitter.waitFor exceeded its configured timeout. */
83
81
  SeedcordErrorCode[SeedcordErrorCode["EventEmitterWaitForTimeout"] = 1502] = "EventEmitterWaitForTimeout";
82
+ /** A customId definition prefix contains a reserved character (a colon or a control char). */
83
+ SeedcordErrorCode[SeedcordErrorCode["CustomIdInvalidPrefix"] = 1601] = "CustomIdInvalidPrefix";
84
+ /** A customId field name is integer-like, which JS would silently reorder. */
85
+ SeedcordErrorCode[SeedcordErrorCode["CustomIdReservedFieldName"] = 1602] = "CustomIdReservedFieldName";
86
+ /** A oneOf() field was declared with no choices. */
87
+ SeedcordErrorCode[SeedcordErrorCode["CustomIdEmptyChoices"] = 1603] = "CustomIdEmptyChoices";
88
+ /** An int() field was declared with min greater than max. */
89
+ SeedcordErrorCode[SeedcordErrorCode["CustomIdInvalidBounds"] = 1604] = "CustomIdInvalidBounds";
90
+ /** A value passed to encode() is outside its field's allowed range. */
91
+ SeedcordErrorCode[SeedcordErrorCode["CustomIdValueOutOfRange"] = 1605] = "CustomIdValueOutOfRange";
92
+ /** An encoded customId exceeds Discord's 100-character limit. */
93
+ SeedcordErrorCode[SeedcordErrorCode["CustomIdWireTooLong"] = 1606] = "CustomIdWireTooLong";
94
+ /** A field name is declared more than once in the same customId chain. */
95
+ SeedcordErrorCode[SeedcordErrorCode["CustomIdDuplicateFieldName"] = 1607] = "CustomIdDuplicateFieldName";
96
+ /** A component handler is missing its route decorator (\@ButtonRoute / \@ModalRoute / \@SelectMenuRoute). */
97
+ SeedcordErrorCode[SeedcordErrorCode["CustomIdHandlerRouteMissing"] = 1608] = "CustomIdHandlerRouteMissing";
98
+ /** match() received a decoded route with no matching arm. */
99
+ SeedcordErrorCode[SeedcordErrorCode["CustomIdMatchArmMissing"] = 1609] = "CustomIdMatchArmMissing";
100
+ /** A slash handler's match() has no arm for the command route that fired. */
101
+ SeedcordErrorCode[SeedcordErrorCode["SlashMatchArmMissing"] = 1610] = "SlashMatchArmMissing";
102
+ /** An autocomplete handler's match() has no arm for the focused field that fired. */
103
+ SeedcordErrorCode[SeedcordErrorCode["AutocompleteMatchArmMissing"] = 1611] = "AutocompleteMatchArmMissing";
104
+ /** An event handler's match() has no arm for the event name that fired. */
105
+ SeedcordErrorCode[SeedcordErrorCode["EventMatchArmMissing"] = 1612] = "EventMatchArmMissing";
106
+ /** Event middleware read `this.eventName` but was constructed without a fired event name. */
107
+ SeedcordErrorCode[SeedcordErrorCode["EventMiddlewareNameUnavailable"] = 1613] = "EventMiddlewareNameUnavailable";
84
108
  /** Mongo service class is missing the `@RegisterMongoService` decorator. */
85
109
  SeedcordErrorCode[SeedcordErrorCode["PluginMongoServiceDecoratorMissing"] = 2101] = "PluginMongoServiceDecoratorMissing";
86
110
  /** Mongo model class is missing the `@RegisterMongoModel` decorator. */
@@ -153,16 +177,18 @@ let SeedcordErrorCode = /* @__PURE__ */ function(SeedcordErrorCode) {
153
177
  SeedcordErrorCode[SeedcordErrorCode["CliConfigInvalidHmr"] = 3120] = "CliConfigInvalidHmr";
154
178
  /** Config hmr restart patterns must be an array of strings when provided. */
155
179
  SeedcordErrorCode[SeedcordErrorCode["CliConfigInvalidHmrRestart"] = 3121] = "CliConfigInvalidHmrRestart";
180
+ /** Two commands resolve to the same slash route during codegen. */
181
+ SeedcordErrorCode[SeedcordErrorCode["CliCodegenDuplicateRoute"] = 3122] = "CliCodegenDuplicateRoute";
182
+ /** The commands directory could not be read during codegen. */
183
+ SeedcordErrorCode[SeedcordErrorCode["CliCodegenCommandsDirUnreadable"] = 3123] = "CliCodegenCommandsDirUnreadable";
184
+ /** Two context-menu commands of the same kind share a name during codegen. */
185
+ SeedcordErrorCode[SeedcordErrorCode["CliCodegenDuplicateContextMenu"] = 3124] = "CliCodegenDuplicateContextMenu";
156
186
  return SeedcordErrorCode;
157
187
  }({});
158
188
 
159
189
  //#endregion
160
190
  //#region src/Errors/ErrorMessages.ts
161
- /**
162
- * Mapping of Seedcord error codes to their corresponding message formatters.
163
- *
164
- * @internal
165
- */
191
+ /** @internal */
166
192
  const messages = {
167
193
  [1001]: () => "Missing DISCORD_BOT_TOKEN environment variable.",
168
194
  [1004]: () => "Invalid DISCORD_BOT_TOKEN value.",
@@ -185,9 +211,21 @@ const messages = {
185
211
  [1304]: () => "RegisterCommand(\"global\") cannot have guilds specified.",
186
212
  [1305]: () => "RegisterCommand(\"guild\") requires a non-empty guilds array.",
187
213
  [1306]: () => "Middleware priority must be a finite number.",
188
- [1403]: () => "Invalid argument passed to buildSlashRoute.",
189
214
  [1501]: () => "waitFor was aborted via its AbortSignal.",
190
215
  [1502]: (timeout) => `waitFor timed out after ${timeout}ms.`,
216
+ [1601]: (prefix) => `customId prefix ${JSON.stringify(prefix)} must be a non-empty string without a colon or control character.`,
217
+ [1602]: (field) => `customId field name ${JSON.stringify(field)} is integer-like, which JS reorders. Use a non-numeric name.`,
218
+ [1603]: (field) => `customId field ${JSON.stringify(field)} uses oneOf() with no choices.`,
219
+ [1604]: (field, min, max) => `customId field ${JSON.stringify(field)} has min ${min} greater than max ${max}.`,
220
+ [1605]: (field, value) => `customId field ${JSON.stringify(field)} got value ${value} outside its allowed range.`,
221
+ [1606]: (length) => `Encoded customId is ${length} characters, Discord allows at most 100.`,
222
+ [1607]: (field) => `customId field ${JSON.stringify(field)} is already defined in this chain.`,
223
+ [1608]: (className) => `${className} is missing its route decorator (@ButtonRoute, @ModalRoute, or @SelectMenuRoute).`,
224
+ [1609]: (prefix) => `match() has no arm for the decoded route ${JSON.stringify(prefix)}.`,
225
+ [1610]: (route) => `match() has no arm for the command route ${JSON.stringify(route)}.`,
226
+ [1611]: (field) => `match() has no arm for the focused field ${JSON.stringify(field)}.`,
227
+ [1612]: (event) => `match() has no arm for the event ${JSON.stringify(event)}.`,
228
+ [1613]: () => `this.eventName is only available on middleware the controller constructed with a fired event name.`,
191
229
  [2101]: (className) => `Missing @RegisterMongoService on ${className}.`,
192
230
  [2102]: (className) => `Missing @RegisterMongoModel on ${className}.`,
193
231
  [2103]: (databaseName) => databaseName ? `Could not connect to MongoDB (${databaseName}).` : "Could not connect to MongoDB.",
@@ -223,13 +261,12 @@ const messages = {
223
261
  [3118]: (targetPath, reason) => `Failed to write bootstrap file at ${targetPath}: ${reason}.`,
224
262
  [3119]: () => "Config `tsconfig` must be a string when provided.",
225
263
  [3120]: () => "Config `hmr` must be an object when provided.",
226
- [3121]: () => "Config `hmr.restart` must be an array of strings when provided."
264
+ [3121]: () => "Config `hmr.restart` must be an array of strings when provided.",
265
+ [3122]: (route, firstFile, secondFile) => `Two commands resolve to the same slash route \`${route}\`. Defined in ${firstFile} and ${secondFile}. Rename one.`,
266
+ [3123]: (dir, reason) => `Could not read the commands directory ${dir} during codegen. ${reason}.`,
267
+ [3124]: (kind, name, firstFile, secondFile) => `Two ${kind} context-menu commands share the name \`${name}\`. Defined in ${firstFile} and ${secondFile}. Rename one.`
227
268
  };
228
- /**
229
- * Formats a Seedcord error message based on the provided code and arguments.
230
- *
231
- * @internal
232
- */
269
+ /** @internal */
233
270
  function formatSeedcordErrorMessage(code, args) {
234
271
  const formatter = messages[code];
235
272
  return formatter(...args ?? []);
@@ -373,4 +410,4 @@ Object.defineProperty(exports, 'isSeedcordError', {
373
410
  return isSeedcordError;
374
411
  }
375
412
  });
376
- //# sourceMappingURL=SeedcordError-wt7_KePP.cjs.map
413
+ //# sourceMappingURL=SeedcordError-C1GYc1BF.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SeedcordError-C1GYc1BF.cjs","names":[],"sources":["../src/Errors/ErrorCodes.ts","../src/Errors/ErrorMessages.ts","../src/Errors/SeedcordError.ts"],"sourcesContent":["/* eslint-disable no-magic-numbers */\n\n/**\n * All Seedcord error codes.\n */\nexport enum SeedcordErrorCode {\n /** DISCORD_BOT_TOKEN is not present in the environment. */\n ConfigMissingDiscordToken = 1001,\n /** DISCORD_BOT_TOKEN is present but fails validation. */\n ConfigIncorrectDiscordToken = 1004,\n /** UNKNOWN_EXCEPTION_WEBHOOK_URL is missing when configuring the reporter. */\n ConfigUnknownExceptionWebhookMissing = 1002,\n /** UNKNOWN_EXCEPTION_WEBHOOK_URL is present but fails URL validation. */\n ConfigUnknownExceptionWebhookInvalid = 1003,\n\n /** Attempted to add lifecycle tasks after startup already completed. */\n LifecycleAddAfterCompletion = 1101,\n /** Attempted to add lifecycle tasks while startup is still running. */\n LifecycleAddDuringRun = 1102,\n /** Attempted to remove lifecycle tasks while startup is still running. */\n LifecycleRemoveDuringRun = 1103,\n /** Provided lifecycle phase identifier is not recognized. */\n LifecycleUnknownPhase = 1104,\n /** Startup phase completed with one or more task failures. */\n LifecyclePhaseFailures = 1105,\n /** A lifecycle task exceeded its configured timeout. */\n LifecycleTaskTimeout = 1106,\n\n /** Multiple Seedcord instances were created simultaneously. */\n CoreSingletonViolation = 1201,\n /** Plugins cannot be mutated after the core has finished initializing. */\n CorePluginAfterInit = 1202,\n /** A plugin tried to register with a key that already exists. */\n CorePluginKeyExists = 1203,\n /** Bot role lookup failed within the provided guild. */\n CoreBotRoleMissing = 1204,\n /** A bot controller was constructed without its required handlers directory. */\n CoreControllerPathMissing = 1205,\n\n /** Interaction middleware decorated with disallowed event filters. */\n DecoratorInteractionEventFilter = 1301,\n /** A decorator could not find the original method being decorated. */\n DecoratorMethodNotFound = 1302,\n /** A command decorator attempted to re-register an existing command scope. */\n DecoratorCommandAlreadyRegistered = 1303,\n /** A global command decorator specified guild IDs, which is not allowed. */\n DecoratorCommandGlobalWithGuilds = 1304,\n /** A guild command decorator omitted the required guild ID list. */\n DecoratorCommandGuildWithoutGuilds = 1305,\n /** Middleware priority provided by the decorator was not a finite number. */\n DecoratorInvalidMiddlewarePriority = 1306,\n\n /** StrictEventEmitter.waitFor was aborted via its AbortSignal. */\n EventEmitterWaitForAborted = 1501,\n /** StrictEventEmitter.waitFor exceeded its configured timeout. */\n EventEmitterWaitForTimeout = 1502,\n\n /** A customId definition prefix contains a reserved character (a colon or a control char). */\n CustomIdInvalidPrefix = 1601,\n /** A customId field name is integer-like, which JS would silently reorder. */\n CustomIdReservedFieldName = 1602,\n /** A oneOf() field was declared with no choices. */\n CustomIdEmptyChoices = 1603,\n /** An int() field was declared with min greater than max. */\n CustomIdInvalidBounds = 1604,\n /** A value passed to encode() is outside its field's allowed range. */\n CustomIdValueOutOfRange = 1605,\n /** An encoded customId exceeds Discord's 100-character limit. */\n CustomIdWireTooLong = 1606,\n /** A field name is declared more than once in the same customId chain. */\n CustomIdDuplicateFieldName = 1607,\n /** A component handler is missing its route decorator (\\@ButtonRoute / \\@ModalRoute / \\@SelectMenuRoute). */\n CustomIdHandlerRouteMissing = 1608,\n /** match() received a decoded route with no matching arm. */\n CustomIdMatchArmMissing = 1609,\n /** A slash handler's match() has no arm for the command route that fired. */\n SlashMatchArmMissing = 1610,\n /** An autocomplete handler's match() has no arm for the focused field that fired. */\n AutocompleteMatchArmMissing = 1611,\n /** An event handler's match() has no arm for the event name that fired. */\n EventMatchArmMissing = 1612,\n /** Event middleware read `this.eventName` but was constructed without a fired event name. */\n EventMiddlewareNameUnavailable = 1613,\n\n /** Mongo service class is missing the `@RegisterMongoService` decorator. */\n PluginMongoServiceDecoratorMissing = 2101,\n /** Mongo model class is missing the `@RegisterMongoModel` decorator. */\n PluginMongoModelDecoratorMissing = 2102,\n /** Mongo client failed to establish a connection. */\n PluginMongoConnectionFailed = 2103,\n /** Mongo client failed to disconnect cleanly during shutdown. */\n PluginMongoDisconnectFailed = 2104,\n /** Mongo `services` was accessed before the plugin finished initializing. */\n PluginMongoServicesNotReady = 2105,\n\n /** KPG service class is missing the `@RegisterKpgService` decorator. */\n PluginKpgServiceDecoratorMissing = 2201,\n /** KPG service class is missing its table metadata. */\n PluginKpgServiceTableMissing = 2202,\n /** Migration manager received an invalid step count. */\n PluginKpgInvalidStepCount = 2203,\n /** Migration direction was not recognized. */\n PluginKpgUnknownDirection = 2204,\n /** Provided migrations path could not be resolved. */\n PluginKpgUnresolvedMigrationsPath = 2205,\n /** No migration files were found for execution. */\n PluginKpgNoMigrationFiles = 2206,\n /** A migration module failed to export the expected functions. */\n PluginKpgInvalidMigrationModule = 2207,\n /** An arbitrary (non-Error) failure was reported by a migration. */\n PluginKpgNonErrorFailure = 2208,\n /** Postgres pool failed to close cleanly during shutdown. */\n PluginKpgDisconnectFailed = 2209,\n /** KPG `services` was accessed before the plugin finished initializing. */\n PluginKpgServicesNotReady = 2210,\n\n /** Config file default export was not an object. */\n CliConfigInvalidExport = 3101,\n /** Config is missing the required instance string. */\n CliConfigMissingInstance = 3102,\n /** Config root was provided but not a string. */\n CliConfigInvalidRoot = 3103,\n /** Unable to locate a Seedcord config file. */\n CliConfigNotFound = 3104,\n /** CLI entry file does not exist. */\n CliEntryNotFound = 3105,\n /** tsx failed to import the provided entry file. */\n CliTsxImportFailed = 3106,\n /** Native import and jiti fallback both failed. */\n CliImportFailed = 3107,\n /** Seedcord instance export is missing a start() method. */\n CliInstanceInvalid = 3108,\n /** Seedcord instance threw during startup. */\n CliStartFailed = 3109,\n /** Config is missing the required entry string. */\n CliConfigMissingEntry = 3110,\n /** Config build options must be an object when provided. */\n CliConfigInvalidBuild = 3111,\n /** Config build outDir must be a string when provided. */\n CliConfigInvalidBuildOutDir = 3112,\n /** Config build tsconfig must be a string when provided. */\n CliConfigInvalidBuildTsconfig = 3113,\n /** Config build bootstrap must be a string when provided. */\n CliConfigInvalidBuildBootstrap = 3114,\n /** Entry file must be inside the configured root directory. */\n CliConfigEntryOutsideRoot = 3115,\n /** Unable to locate a TypeScript config file for builds. */\n CliBuildTsconfigNotFound = 3116,\n /** TypeScript reported diagnostics during emit. */\n CliBuildFailed = 3117,\n /** Unable to write the generated bootstrap file. */\n CliBootstrapWriteFailed = 3118,\n /** Config tsconfig must be a string when provided. */\n CliConfigInvalidTsconfig = 3119,\n /** Config hmr options must be an object when provided. */\n CliConfigInvalidHmr = 3120,\n /** Config hmr restart patterns must be an array of strings when provided. */\n CliConfigInvalidHmrRestart = 3121,\n /** Two commands resolve to the same slash route during codegen. */\n CliCodegenDuplicateRoute = 3122,\n /** The commands directory could not be read during codegen. */\n CliCodegenCommandsDirUnreadable = 3123,\n /** Two context-menu commands of the same kind share a name during codegen. */\n CliCodegenDuplicateContextMenu = 3124\n}\n","import { SeedcordErrorCode } from './ErrorCodes';\n\n/** @internal */\nconst messages = {\n [SeedcordErrorCode.ConfigMissingDiscordToken]: () => 'Missing DISCORD_BOT_TOKEN environment variable.',\n [SeedcordErrorCode.ConfigIncorrectDiscordToken]: () => 'Invalid DISCORD_BOT_TOKEN value.',\n [SeedcordErrorCode.ConfigUnknownExceptionWebhookMissing]: () =>\n 'Missing UNKNOWN_EXCEPTION_WEBHOOK_URL environment variable.',\n [SeedcordErrorCode.ConfigUnknownExceptionWebhookInvalid]: () => 'Invalid UNKNOWN_EXCEPTION_WEBHOOK_URL value.',\n\n [SeedcordErrorCode.LifecycleAddAfterCompletion]: () =>\n 'Cannot add tasks after startup sequence has already completed.',\n [SeedcordErrorCode.LifecycleAddDuringRun]: () => 'Cannot add tasks while startup sequence is in progress.',\n [SeedcordErrorCode.LifecycleRemoveDuringRun]: () => 'Cannot remove tasks while startup sequence is in progress.',\n [SeedcordErrorCode.LifecycleUnknownPhase]: (phase: unknown) => `Unknown phase: ${String(phase)}.`,\n [SeedcordErrorCode.LifecyclePhaseFailures]: (phase: string, failures: number) =>\n `Phase ${phase} completed with ${failures} failed task${failures === 1 ? '' : 's'}.`,\n [SeedcordErrorCode.LifecycleTaskTimeout]: (taskName: string, timeout: number) =>\n `Task \"${taskName}\" timed out after ${timeout}ms.`,\n\n [SeedcordErrorCode.CoreSingletonViolation]: () =>\n 'Seedcord can only be instantiated once. Use the existing instance instead.',\n [SeedcordErrorCode.CorePluginAfterInit]: () => 'Cannot attach a plugin after initialization.',\n [SeedcordErrorCode.CorePluginKeyExists]: (key: string) => `Plugin with key \"${key}\" already exists.`,\n [SeedcordErrorCode.CoreBotRoleMissing]: (guildId?: string) =>\n guildId ? `Bot role not found in guild ${guildId}.` : 'Bot role not found in guild.',\n [SeedcordErrorCode.CoreControllerPathMissing]: (controllerName: string, pathKind: string) =>\n `${controllerName} was instantiated without a ${pathKind} path.`,\n\n [SeedcordErrorCode.DecoratorInteractionEventFilter]: () => 'Interaction middleware cannot specify event filters.',\n [SeedcordErrorCode.DecoratorMethodNotFound]: () =>\n 'Decorator could not locate the original method. Ensure the method exists before applying the decorator.',\n [SeedcordErrorCode.DecoratorCommandAlreadyRegistered]: (\n commandName: string,\n existingScope: string,\n requestedScope: string\n ) =>\n `Command \"${commandName}\" is already registered as a \"${existingScope}\" command and cannot be re-registered as a \"${requestedScope}\" command.`,\n [SeedcordErrorCode.DecoratorCommandGlobalWithGuilds]: () =>\n 'RegisterCommand(\"global\") cannot have guilds specified.',\n [SeedcordErrorCode.DecoratorCommandGuildWithoutGuilds]: () =>\n 'RegisterCommand(\"guild\") requires a non-empty guilds array.',\n [SeedcordErrorCode.DecoratorInvalidMiddlewarePriority]: () => 'Middleware priority must be a finite number.',\n\n [SeedcordErrorCode.EventEmitterWaitForAborted]: () => 'waitFor was aborted via its AbortSignal.',\n [SeedcordErrorCode.EventEmitterWaitForTimeout]: (timeout: number) => `waitFor timed out after ${timeout}ms.`,\n\n [SeedcordErrorCode.CustomIdInvalidPrefix]: (prefix: string) =>\n `customId prefix ${JSON.stringify(prefix)} must be a non-empty string without a colon or control character.`,\n [SeedcordErrorCode.CustomIdReservedFieldName]: (field: string) =>\n `customId field name ${JSON.stringify(field)} is integer-like, which JS reorders. Use a non-numeric name.`,\n [SeedcordErrorCode.CustomIdEmptyChoices]: (field: string) =>\n `customId field ${JSON.stringify(field)} uses oneOf() with no choices.`,\n [SeedcordErrorCode.CustomIdInvalidBounds]: (field: string, min: number, max: number) =>\n `customId field ${JSON.stringify(field)} has min ${min} greater than max ${max}.`,\n [SeedcordErrorCode.CustomIdValueOutOfRange]: (field: string, value: string) =>\n `customId field ${JSON.stringify(field)} got value ${value} outside its allowed range.`,\n [SeedcordErrorCode.CustomIdWireTooLong]: (length: number) =>\n `Encoded customId is ${length} characters, Discord allows at most 100.`,\n [SeedcordErrorCode.CustomIdDuplicateFieldName]: (field: string) =>\n `customId field ${JSON.stringify(field)} is already defined in this chain.`,\n [SeedcordErrorCode.CustomIdHandlerRouteMissing]: (className: string) =>\n `${className} is missing its route decorator (@ButtonRoute, @ModalRoute, or @SelectMenuRoute).`,\n [SeedcordErrorCode.CustomIdMatchArmMissing]: (prefix: string) =>\n `match() has no arm for the decoded route ${JSON.stringify(prefix)}.`,\n [SeedcordErrorCode.SlashMatchArmMissing]: (route: string) =>\n `match() has no arm for the command route ${JSON.stringify(route)}.`,\n [SeedcordErrorCode.AutocompleteMatchArmMissing]: (field: string) =>\n `match() has no arm for the focused field ${JSON.stringify(field)}.`,\n [SeedcordErrorCode.EventMatchArmMissing]: (event: string) =>\n `match() has no arm for the event ${JSON.stringify(event)}.`,\n [SeedcordErrorCode.EventMiddlewareNameUnavailable]: () =>\n `this.eventName is only available on middleware the controller constructed with a fired event name.`,\n\n [SeedcordErrorCode.PluginMongoServiceDecoratorMissing]: (className: string) =>\n `Missing @RegisterMongoService on ${className}.`,\n [SeedcordErrorCode.PluginMongoModelDecoratorMissing]: (className: string) =>\n `Missing @RegisterMongoModel on ${className}.`,\n [SeedcordErrorCode.PluginMongoConnectionFailed]: (databaseName?: string) =>\n databaseName ? `Could not connect to MongoDB (${databaseName}).` : 'Could not connect to MongoDB.',\n [SeedcordErrorCode.PluginMongoDisconnectFailed]: () => 'Failed to disconnect from MongoDB cleanly during shutdown.',\n [SeedcordErrorCode.PluginMongoServicesNotReady]: () =>\n 'Mongo services accessed before the plugin finished initializing.',\n\n [SeedcordErrorCode.PluginKpgServiceDecoratorMissing]: (className: string) =>\n `Missing @RegisterKpgService on ${className}.`,\n [SeedcordErrorCode.PluginKpgServiceTableMissing]: (className: string) =>\n `Missing table metadata for ${className}. Provide a table via @RegisterKpgService().`,\n [SeedcordErrorCode.PluginKpgInvalidStepCount]: () => 'Migration step count must be a non-negative integer.',\n [SeedcordErrorCode.PluginKpgUnknownDirection]: (direction: unknown) =>\n `Unknown migration direction: ${String(direction)}.`,\n [SeedcordErrorCode.PluginKpgUnresolvedMigrationsPath]: (label: string) =>\n `Unable to resolve migrations at path: ${label}.`,\n [SeedcordErrorCode.PluginKpgNoMigrationFiles]: () => 'No migration files provided.',\n [SeedcordErrorCode.PluginKpgInvalidMigrationModule]: (filePath: string) =>\n `Migration file ${filePath} must export async functions up and down.`,\n [SeedcordErrorCode.PluginKpgNonErrorFailure]: (message: string) => `Migration failure: ${message}.`,\n [SeedcordErrorCode.PluginKpgDisconnectFailed]: () => 'Failed to close the Postgres pool cleanly during shutdown.',\n [SeedcordErrorCode.PluginKpgServicesNotReady]: () =>\n 'KPG services accessed before the plugin finished initializing.',\n\n [SeedcordErrorCode.CliConfigInvalidExport]: () => 'Config file must default export an object.',\n [SeedcordErrorCode.CliConfigMissingInstance]: () =>\n 'Config must include an `instance` string that points to your Seedcord default export.',\n [SeedcordErrorCode.CliConfigInvalidRoot]: () => 'Config `root` must be a string when provided.',\n [SeedcordErrorCode.CliConfigNotFound]: (baseDir: string, candidates: readonly string[]) =>\n `Unable to locate a Seedcord config in ${baseDir}. Searched for ${candidates.join(', ')}.`,\n [SeedcordErrorCode.CliConfigMissingEntry]: () =>\n 'Config must include an `entry` string that points to your startup script.',\n [SeedcordErrorCode.CliConfigInvalidBuild]: () => 'Config `build` must be an object when provided.',\n [SeedcordErrorCode.CliConfigInvalidBuildOutDir]: () => 'Config `build.outDir` must be a string when provided.',\n [SeedcordErrorCode.CliConfigInvalidBuildTsconfig]: () => 'Config `build.tsconfig` must be a string when provided.',\n [SeedcordErrorCode.CliConfigInvalidBuildBootstrap]: () =>\n 'Config `build.bootstrap` must be a string when provided.',\n [SeedcordErrorCode.CliConfigEntryOutsideRoot]: (entryPath: string, root: string) =>\n `Entry file ${entryPath} must reside inside configured root ${root}.`,\n [SeedcordErrorCode.CliEntryNotFound]: (entryPath: string) => `Cannot find entry file at ${entryPath}.`,\n [SeedcordErrorCode.CliTsxImportFailed]: (entryPath: string, reason: string) =>\n `Failed to import ${entryPath} via tsx: ${reason}.`,\n [SeedcordErrorCode.CliImportFailed]: (entryPath: string, nativeReason: string, fallbackReason: string) =>\n `Failed to import ${entryPath}: ${nativeReason}. Fallback via jiti also failed: ${fallbackReason}.`,\n [SeedcordErrorCode.CliInstanceInvalid]: () =>\n 'Seedcord instance must default export an object with a start() method.',\n [SeedcordErrorCode.CliStartFailed]: (instancePath: string, reason: string) =>\n `Failed to start Seedcord from ${instancePath}: ${reason}.`,\n [SeedcordErrorCode.CliBuildTsconfigNotFound]: (hint: string) =>\n `Unable to resolve a tsconfig for builds (${hint}). Provide build.tsconfig or add tsconfig.build.json / tsconfig.json.`,\n [SeedcordErrorCode.CliBuildFailed]: (diagnostics: string) => `TypeScript build failed:\\n${diagnostics}`,\n [SeedcordErrorCode.CliBootstrapWriteFailed]: (targetPath: string, reason: string) =>\n `Failed to write bootstrap file at ${targetPath}: ${reason}.`,\n [SeedcordErrorCode.CliConfigInvalidTsconfig]: () => 'Config `tsconfig` must be a string when provided.',\n [SeedcordErrorCode.CliConfigInvalidHmr]: () => 'Config `hmr` must be an object when provided.',\n [SeedcordErrorCode.CliConfigInvalidHmrRestart]: () =>\n 'Config `hmr.restart` must be an array of strings when provided.',\n [SeedcordErrorCode.CliCodegenDuplicateRoute]: (route: string, firstFile: string, secondFile: string) =>\n `Two commands resolve to the same slash route \\`${route}\\`. Defined in ${firstFile} and ${secondFile}. Rename one.`,\n [SeedcordErrorCode.CliCodegenCommandsDirUnreadable]: (dir: string, reason: string) =>\n `Could not read the commands directory ${dir} during codegen. ${reason}.`,\n [SeedcordErrorCode.CliCodegenDuplicateContextMenu]: (\n kind: string,\n name: string,\n firstFile: string,\n secondFile: string\n ) =>\n `Two ${kind} context-menu commands share the name \\`${name}\\`. Defined in ${firstFile} and ${secondFile}. Rename one.`\n} satisfies Record<SeedcordErrorCode, (...args: never[]) => string>;\n\n/** @internal */\nexport type SeedcordErrorArguments<Code extends SeedcordErrorCode> = Parameters<(typeof messages)[Code]>;\n\n/** @internal */\nexport function formatSeedcordErrorMessage<Code extends SeedcordErrorCode>(\n code: Code,\n args?: SeedcordErrorArguments<Code>\n): string {\n const formatter = messages[code];\n const resolvedArgs = (args ?? []) as unknown[];\n return (formatter as (...params: unknown[]) => string)(...resolvedArgs);\n}\n","/* eslint-disable @typescript-eslint/no-unnecessary-condition */\nimport chalk from 'chalk';\n\nimport { SeedcordErrorCode } from './ErrorCodes';\nimport { formatSeedcordErrorMessage, type SeedcordErrorArguments } from './ErrorMessages';\n\n/**\n * String literal type for Seedcord error identifiers.\n *\n * @internal\n */\ntype SeedcordErrorIdentifier = keyof typeof SeedcordErrorCode;\n\n/**\n * Options for Seedcord errors.\n *\n * @internal\n */\ninterface SeedcordErrorOptions extends ErrorOptions {}\n\nfunction resolveIdentifier(code: SeedcordErrorCode): SeedcordErrorIdentifier {\n return SeedcordErrorCode[code] as SeedcordErrorIdentifier;\n}\n\ntype SeedcordErrorPayload<Code extends SeedcordErrorCode> = SeedcordErrorArguments<Code> | undefined;\n\ntype SeedcordErrorCtorRest<Code extends SeedcordErrorCode> =\n SeedcordErrorArguments<Code> extends []\n ? [options?: SeedcordErrorOptions]\n : [args: SeedcordErrorArguments<Code>, options?: SeedcordErrorOptions];\n\nfunction resolveCtorInputs<Code extends SeedcordErrorCode>(\n rest: SeedcordErrorCtorRest<Code>\n): { args: SeedcordErrorPayload<Code>; options?: SeedcordErrorOptions } {\n const [maybeArgsOrOptions, maybeOptions] = rest;\n if (Array.isArray(maybeArgsOrOptions)) {\n const result: { args: SeedcordErrorPayload<Code>; options?: SeedcordErrorOptions } = {\n args: maybeArgsOrOptions\n };\n\n if (maybeOptions !== undefined) {\n result.options = maybeOptions;\n }\n\n return result;\n }\n\n const result: { args: SeedcordErrorPayload<Code>; options?: SeedcordErrorOptions } = {\n args: undefined\n };\n\n if (maybeArgsOrOptions !== undefined) {\n result.options = maybeArgsOrOptions;\n }\n\n return result;\n}\n\nfunction resolveMessage<Code extends SeedcordErrorCode>(code: Code, args: SeedcordErrorPayload<Code>): string {\n return formatSeedcordErrorMessage(code, args);\n}\n\nfunction formatErrorName(name: string, _identifier: SeedcordErrorIdentifier, code: SeedcordErrorCode): string {\n return `${chalk.bold.red(name)}[${chalk.gray(code)}]`;\n}\n\n/**\n * String literal type for Seedcord error class names.\n *\n * @internal\n */\nexport type SeedcordErrorTypeString = `Seedcord${'Error' | 'TypeError' | 'RangeError'}`;\n\n/**\n * Base interface for Seedcord error instances.\n *\n * @internal\n */\nexport interface BaseSeedcordError {\n readonly code: SeedcordErrorCode;\n readonly identifier: SeedcordErrorIdentifier;\n readonly type: SeedcordErrorTypeString;\n}\n\n/**\n * Base class for Seedcord errors.\n *\n * @internal\n */\nexport class SeedcordError<Code extends SeedcordErrorCode = SeedcordErrorCode>\n extends Error\n implements BaseSeedcordError\n{\n public readonly code: Code;\n public readonly identifier: SeedcordErrorIdentifier;\n public readonly type = 'SeedcordError';\n\n constructor(code: Code, ...rest: SeedcordErrorCtorRest<Code>) {\n const { args, options } = resolveCtorInputs(rest);\n const message = resolveMessage(code, args);\n super(message, options);\n this.code = code;\n this.identifier = resolveIdentifier(code);\n this.name = formatErrorName(new.target.name, this.identifier, this.code);\n Object.setPrototypeOf(this, new.target.prototype);\n if (typeof Error.captureStackTrace === 'function') {\n Error.captureStackTrace(this, new.target);\n }\n }\n}\n\n/**\n * TypeError class for Seedcord errors.\n *\n * @internal\n */\nexport class SeedcordTypeError<Code extends SeedcordErrorCode = SeedcordErrorCode>\n extends TypeError\n implements BaseSeedcordError\n{\n public readonly code: Code;\n public readonly identifier: SeedcordErrorIdentifier;\n public readonly type = 'SeedcordTypeError';\n\n constructor(code: Code, ...rest: SeedcordErrorCtorRest<Code>) {\n const { args, options } = resolveCtorInputs(rest);\n const message = resolveMessage(code, args);\n super(message, options);\n this.code = code;\n this.identifier = resolveIdentifier(code);\n this.name = formatErrorName(new.target.name, this.identifier, this.code);\n Object.setPrototypeOf(this, new.target.prototype);\n if (typeof Error.captureStackTrace === 'function') {\n Error.captureStackTrace(this, new.target);\n }\n }\n}\n\n/**\n * RangeError class for Seedcord errors.\n *\n * @internal\n */\nexport class SeedcordRangeError<Code extends SeedcordErrorCode = SeedcordErrorCode>\n extends RangeError\n implements BaseSeedcordError\n{\n public readonly code: Code;\n public readonly identifier: SeedcordErrorIdentifier;\n public readonly type = 'SeedcordRangeError';\n\n constructor(code: Code, ...rest: SeedcordErrorCtorRest<Code>) {\n const { args, options } = resolveCtorInputs(rest);\n const message = resolveMessage(code, args);\n super(message, options);\n this.code = code;\n this.identifier = resolveIdentifier(code);\n this.name = formatErrorName(new.target.name, this.identifier, this.code);\n Object.setPrototypeOf(this, new.target.prototype);\n if (typeof Error.captureStackTrace === 'function') {\n Error.captureStackTrace(this, new.target);\n }\n }\n}\n\n/**\n * Variant type for Seedcord error classes.\n *\n * @internal\n */\ntype SeedcordErrorVariant<\n Type extends SeedcordErrorTypeString,\n Code extends SeedcordErrorCode\n> = Type extends 'SeedcordError'\n ? SeedcordError<Code>\n : Type extends 'SeedcordTypeError'\n ? SeedcordTypeError<Code>\n : SeedcordRangeError<Code>;\n\n/**\n * Union type of all Seedcord error variants for a specific error code.\n *\n * @internal\n */\ntype AnySeedcordErrorForCode<Code extends SeedcordErrorCode> = {\n [Variant in SeedcordErrorTypeString]: SeedcordErrorVariant<Variant, Code>;\n}[SeedcordErrorTypeString];\n\n/**\n * Union type of all Seedcord errors filtered by error class.\n *\n * @internal\n */\ntype ErrorTypeFilter<Type extends SeedcordErrorTypeString | undefined> = Type extends SeedcordErrorTypeString\n ? {\n [Code in SeedcordErrorCode]: SeedcordErrorVariant<Type, Code>;\n }[SeedcordErrorCode]\n : AnySeedcordErrorForCode<SeedcordErrorCode>;\n\n/**\n * Union type of all Seedcord errors filtered by error class and error code.\n *\n * @internal\n */\nexport type ErrorCodeFilter<\n Type extends SeedcordErrorTypeString | undefined,\n Code extends SeedcordErrorCode | undefined\n> = Code extends SeedcordErrorCode\n ? Type extends SeedcordErrorTypeString\n ? SeedcordErrorVariant<Type, Code>\n : AnySeedcordErrorForCode<Code>\n : ErrorTypeFilter<Type>;\n\n/**\n * Determines whether an unknown value is a Seedcord error, with optional narrowing by class and error code.\n *\n * @param error - The value to inspect.\n * @param type - Optional error class discriminator (Error, TypeError, or RangeError).\n * @param code - Optional {@link SeedcordErrorCode} discriminator to narrow by code.\n * @typeParam Type - What kind of {@link SeedcordErrorTypeString} to filter by.\n * @typeParam Code - The specific {@link SeedcordErrorCode} to filter by.\n */\nexport function isSeedcordError<\n Type extends SeedcordErrorTypeString | undefined,\n Code extends SeedcordErrorCode | undefined\n>(error: unknown, type?: Type, code?: Code): error is ErrorCodeFilter<Type, Code> {\n const isSeedcordErrorInstance = error instanceof SeedcordError && error.type === 'SeedcordError';\n const isSeedcordTypeErrorInstance = error instanceof SeedcordTypeError && error.type === 'SeedcordTypeError';\n const isSeedcordRangeErrorInstance = error instanceof SeedcordRangeError && error.type === 'SeedcordRangeError';\n\n if (!isSeedcordErrorInstance && !isSeedcordTypeErrorInstance && !isSeedcordRangeErrorInstance) {\n return false;\n }\n\n const matchesType = type\n ? (type === 'SeedcordError' && isSeedcordErrorInstance) ||\n (type === 'SeedcordTypeError' && isSeedcordTypeErrorInstance) ||\n (type === 'SeedcordRangeError' && isSeedcordRangeErrorInstance)\n : true;\n\n if (!matchesType) return false;\n if (code === undefined) return true;\n return error.code === code;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,IAAY,oBAAL;;CAEH;;CAEA;;CAEA;;CAEA;;CAGA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAGA;;CAEA;;CAEA;;CAEA;;CAEA;;CAGA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAGA;;CAEA;;CAGA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAGA;;CAEA;;CAEA;;CAEA;;CAEA;;CAGA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAGA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;AACJ;;;;;ACjKA,MAAM,WAAW;eACwC;eACE;eAEnD;eAC4D;eAG5D;eAC6C;eACG;UACR,UAAmB,kBAAkB,OAAO,KAAK,EAAE;UAClD,OAAe,aACxD,SAAS,MAAM,kBAAkB,SAAS,cAAc,aAAa,IAAI,KAAK,IAAI;UAC3C,UAAkB,YACzD,SAAS,SAAS,oBAAoB,QAAQ;eAG9C;eAC2C;UACL,QAAgB,oBAAoB,IAAI;UACzC,YACrC,UAA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I,OAAO,SAAS;EAChD,IAAI,OAAO,MAAM,sBAAsB,YACnC,MAAM,kBAAkB,MAAM,IAAI,MAAM;CAEhD;AACJ;;;;;;;;;;AA2DA,SAAgB,gBAGd,OAAgB,MAAa,MAAmD;CAC9E,MAAM,0BAA0B,iBAAiB,iBAAiB,MAAM,SAAS;CACjF,MAAM,8BAA8B,iBAAiB,qBAAqB,MAAM,SAAS;CACzF,MAAM,+BAA+B,iBAAiB,sBAAsB,MAAM,SAAS;CAE3F,IAAI,CAAC,2BAA2B,CAAC,+BAA+B,CAAC,8BAC7D,OAAO;CASX,IAAI,EANgB,OACb,SAAS,mBAAmB,2BAC5B,SAAS,uBAAuB,+BAChC,SAAS,wBAAwB,+BAClC,OAEY,OAAO;CACzB,IAAI,SAAS,QAAW,OAAO;CAC/B,OAAO,MAAM,SAAS;AAC1B"}
@@ -45,12 +45,36 @@ declare enum SeedcordErrorCode {
45
45
  DecoratorCommandGuildWithoutGuilds = 1305,
46
46
  /** Middleware priority provided by the decorator was not a finite number. */
47
47
  DecoratorInvalidMiddlewarePriority = 1306,
48
- /** buildSlashRoute received an invalid argument. */
49
- UtilInvalidSlashRouteArgument = 1403,
50
48
  /** StrictEventEmitter.waitFor was aborted via its AbortSignal. */
51
49
  EventEmitterWaitForAborted = 1501,
52
50
  /** StrictEventEmitter.waitFor exceeded its configured timeout. */
53
51
  EventEmitterWaitForTimeout = 1502,
52
+ /** A customId definition prefix contains a reserved character (a colon or a control char). */
53
+ CustomIdInvalidPrefix = 1601,
54
+ /** A customId field name is integer-like, which JS would silently reorder. */
55
+ CustomIdReservedFieldName = 1602,
56
+ /** A oneOf() field was declared with no choices. */
57
+ CustomIdEmptyChoices = 1603,
58
+ /** An int() field was declared with min greater than max. */
59
+ CustomIdInvalidBounds = 1604,
60
+ /** A value passed to encode() is outside its field's allowed range. */
61
+ CustomIdValueOutOfRange = 1605,
62
+ /** An encoded customId exceeds Discord's 100-character limit. */
63
+ CustomIdWireTooLong = 1606,
64
+ /** A field name is declared more than once in the same customId chain. */
65
+ CustomIdDuplicateFieldName = 1607,
66
+ /** A component handler is missing its route decorator (\@ButtonRoute / \@ModalRoute / \@SelectMenuRoute). */
67
+ CustomIdHandlerRouteMissing = 1608,
68
+ /** match() received a decoded route with no matching arm. */
69
+ CustomIdMatchArmMissing = 1609,
70
+ /** A slash handler's match() has no arm for the command route that fired. */
71
+ SlashMatchArmMissing = 1610,
72
+ /** An autocomplete handler's match() has no arm for the focused field that fired. */
73
+ AutocompleteMatchArmMissing = 1611,
74
+ /** An event handler's match() has no arm for the event name that fired. */
75
+ EventMatchArmMissing = 1612,
76
+ /** Event middleware read `this.eventName` but was constructed without a fired event name. */
77
+ EventMiddlewareNameUnavailable = 1613,
54
78
  /** Mongo service class is missing the `@RegisterMongoService` decorator. */
55
79
  PluginMongoServiceDecoratorMissing = 2101,
56
80
  /** Mongo model class is missing the `@RegisterMongoModel` decorator. */
@@ -122,15 +146,17 @@ declare enum SeedcordErrorCode {
122
146
  /** Config hmr options must be an object when provided. */
123
147
  CliConfigInvalidHmr = 3120,
124
148
  /** Config hmr restart patterns must be an array of strings when provided. */
125
- CliConfigInvalidHmrRestart = 3121
149
+ CliConfigInvalidHmrRestart = 3121,
150
+ /** Two commands resolve to the same slash route during codegen. */
151
+ CliCodegenDuplicateRoute = 3122,
152
+ /** The commands directory could not be read during codegen. */
153
+ CliCodegenCommandsDirUnreadable = 3123,
154
+ /** Two context-menu commands of the same kind share a name during codegen. */
155
+ CliCodegenDuplicateContextMenu = 3124
126
156
  }
127
157
  //#endregion
128
158
  //#region src/Errors/ErrorMessages.d.ts
129
- /**
130
- * Mapping of Seedcord error codes to their corresponding message formatters.
131
- *
132
- * @internal
133
- */
159
+ /** @internal */
134
160
  declare const messages: {
135
161
  1001: () => string;
136
162
  1004: () => string;
@@ -153,9 +179,21 @@ declare const messages: {
153
179
  1304: () => string;
154
180
  1305: () => string;
155
181
  1306: () => string;
156
- 1403: () => string;
157
182
  1501: () => string;
158
183
  1502: (timeout: number) => string;
184
+ 1601: (prefix: string) => string;
185
+ 1602: (field: string) => string;
186
+ 1603: (field: string) => string;
187
+ 1604: (field: string, min: number, max: number) => string;
188
+ 1605: (field: string, value: string) => string;
189
+ 1606: (length: number) => string;
190
+ 1607: (field: string) => string;
191
+ 1608: (className: string) => string;
192
+ 1609: (prefix: string) => string;
193
+ 1610: (route: string) => string;
194
+ 1611: (field: string) => string;
195
+ 1612: (event: string) => string;
196
+ 1613: () => string;
159
197
  2101: (className: string) => string;
160
198
  2102: (className: string) => string;
161
199
  2103: (databaseName?: string) => string;
@@ -192,12 +230,11 @@ declare const messages: {
192
230
  3119: () => string;
193
231
  3120: () => string;
194
232
  3121: () => string;
233
+ 3122: (route: string, firstFile: string, secondFile: string) => string;
234
+ 3123: (dir: string, reason: string) => string;
235
+ 3124: (kind: string, name: string, firstFile: string, secondFile: string) => string;
195
236
  };
196
- /**
197
- * Argument types for Seedcord error messages.
198
- *
199
- * @internal
200
- */
237
+ /** @internal */
201
238
  type SeedcordErrorArguments<Code extends SeedcordErrorCode> = Parameters<(typeof messages)[Code]>;
202
239
  //#endregion
203
240
  //#region src/Errors/SeedcordError.d.ts
@@ -299,4 +336,4 @@ type ErrorCodeFilter<Type extends SeedcordErrorTypeString | undefined, Code exte
299
336
  declare function isSeedcordError<Type extends SeedcordErrorTypeString | undefined, Code extends SeedcordErrorCode | undefined>(error: unknown, type?: Type, code?: Code): error is ErrorCodeFilter<Type, Code>;
300
337
  //#endregion
301
338
  export { SeedcordTypeError as a, SeedcordRangeError as i, SeedcordError as n, isSeedcordError as o, SeedcordErrorTypeString as r, SeedcordErrorCode as s, BaseSeedcordError as t };
302
- //# sourceMappingURL=SeedcordError-BuWVIe6m.d.mts.map
339
+ //# sourceMappingURL=SeedcordError-D6uPv6qc.d.mts.map
@@ -47,12 +47,36 @@ let SeedcordErrorCode = /* @__PURE__ */ function(SeedcordErrorCode) {
47
47
  SeedcordErrorCode[SeedcordErrorCode["DecoratorCommandGuildWithoutGuilds"] = 1305] = "DecoratorCommandGuildWithoutGuilds";
48
48
  /** Middleware priority provided by the decorator was not a finite number. */
49
49
  SeedcordErrorCode[SeedcordErrorCode["DecoratorInvalidMiddlewarePriority"] = 1306] = "DecoratorInvalidMiddlewarePriority";
50
- /** buildSlashRoute received an invalid argument. */
51
- SeedcordErrorCode[SeedcordErrorCode["UtilInvalidSlashRouteArgument"] = 1403] = "UtilInvalidSlashRouteArgument";
52
50
  /** StrictEventEmitter.waitFor was aborted via its AbortSignal. */
53
51
  SeedcordErrorCode[SeedcordErrorCode["EventEmitterWaitForAborted"] = 1501] = "EventEmitterWaitForAborted";
54
52
  /** StrictEventEmitter.waitFor exceeded its configured timeout. */
55
53
  SeedcordErrorCode[SeedcordErrorCode["EventEmitterWaitForTimeout"] = 1502] = "EventEmitterWaitForTimeout";
54
+ /** A customId definition prefix contains a reserved character (a colon or a control char). */
55
+ SeedcordErrorCode[SeedcordErrorCode["CustomIdInvalidPrefix"] = 1601] = "CustomIdInvalidPrefix";
56
+ /** A customId field name is integer-like, which JS would silently reorder. */
57
+ SeedcordErrorCode[SeedcordErrorCode["CustomIdReservedFieldName"] = 1602] = "CustomIdReservedFieldName";
58
+ /** A oneOf() field was declared with no choices. */
59
+ SeedcordErrorCode[SeedcordErrorCode["CustomIdEmptyChoices"] = 1603] = "CustomIdEmptyChoices";
60
+ /** An int() field was declared with min greater than max. */
61
+ SeedcordErrorCode[SeedcordErrorCode["CustomIdInvalidBounds"] = 1604] = "CustomIdInvalidBounds";
62
+ /** A value passed to encode() is outside its field's allowed range. */
63
+ SeedcordErrorCode[SeedcordErrorCode["CustomIdValueOutOfRange"] = 1605] = "CustomIdValueOutOfRange";
64
+ /** An encoded customId exceeds Discord's 100-character limit. */
65
+ SeedcordErrorCode[SeedcordErrorCode["CustomIdWireTooLong"] = 1606] = "CustomIdWireTooLong";
66
+ /** A field name is declared more than once in the same customId chain. */
67
+ SeedcordErrorCode[SeedcordErrorCode["CustomIdDuplicateFieldName"] = 1607] = "CustomIdDuplicateFieldName";
68
+ /** A component handler is missing its route decorator (\@ButtonRoute / \@ModalRoute / \@SelectMenuRoute). */
69
+ SeedcordErrorCode[SeedcordErrorCode["CustomIdHandlerRouteMissing"] = 1608] = "CustomIdHandlerRouteMissing";
70
+ /** match() received a decoded route with no matching arm. */
71
+ SeedcordErrorCode[SeedcordErrorCode["CustomIdMatchArmMissing"] = 1609] = "CustomIdMatchArmMissing";
72
+ /** A slash handler's match() has no arm for the command route that fired. */
73
+ SeedcordErrorCode[SeedcordErrorCode["SlashMatchArmMissing"] = 1610] = "SlashMatchArmMissing";
74
+ /** An autocomplete handler's match() has no arm for the focused field that fired. */
75
+ SeedcordErrorCode[SeedcordErrorCode["AutocompleteMatchArmMissing"] = 1611] = "AutocompleteMatchArmMissing";
76
+ /** An event handler's match() has no arm for the event name that fired. */
77
+ SeedcordErrorCode[SeedcordErrorCode["EventMatchArmMissing"] = 1612] = "EventMatchArmMissing";
78
+ /** Event middleware read `this.eventName` but was constructed without a fired event name. */
79
+ SeedcordErrorCode[SeedcordErrorCode["EventMiddlewareNameUnavailable"] = 1613] = "EventMiddlewareNameUnavailable";
56
80
  /** Mongo service class is missing the `@RegisterMongoService` decorator. */
57
81
  SeedcordErrorCode[SeedcordErrorCode["PluginMongoServiceDecoratorMissing"] = 2101] = "PluginMongoServiceDecoratorMissing";
58
82
  /** Mongo model class is missing the `@RegisterMongoModel` decorator. */
@@ -125,16 +149,18 @@ let SeedcordErrorCode = /* @__PURE__ */ function(SeedcordErrorCode) {
125
149
  SeedcordErrorCode[SeedcordErrorCode["CliConfigInvalidHmr"] = 3120] = "CliConfigInvalidHmr";
126
150
  /** Config hmr restart patterns must be an array of strings when provided. */
127
151
  SeedcordErrorCode[SeedcordErrorCode["CliConfigInvalidHmrRestart"] = 3121] = "CliConfigInvalidHmrRestart";
152
+ /** Two commands resolve to the same slash route during codegen. */
153
+ SeedcordErrorCode[SeedcordErrorCode["CliCodegenDuplicateRoute"] = 3122] = "CliCodegenDuplicateRoute";
154
+ /** The commands directory could not be read during codegen. */
155
+ SeedcordErrorCode[SeedcordErrorCode["CliCodegenCommandsDirUnreadable"] = 3123] = "CliCodegenCommandsDirUnreadable";
156
+ /** Two context-menu commands of the same kind share a name during codegen. */
157
+ SeedcordErrorCode[SeedcordErrorCode["CliCodegenDuplicateContextMenu"] = 3124] = "CliCodegenDuplicateContextMenu";
128
158
  return SeedcordErrorCode;
129
159
  }({});
130
160
 
131
161
  //#endregion
132
162
  //#region src/Errors/ErrorMessages.ts
133
- /**
134
- * Mapping of Seedcord error codes to their corresponding message formatters.
135
- *
136
- * @internal
137
- */
163
+ /** @internal */
138
164
  const messages = {
139
165
  [1001]: () => "Missing DISCORD_BOT_TOKEN environment variable.",
140
166
  [1004]: () => "Invalid DISCORD_BOT_TOKEN value.",
@@ -157,9 +183,21 @@ const messages = {
157
183
  [1304]: () => "RegisterCommand(\"global\") cannot have guilds specified.",
158
184
  [1305]: () => "RegisterCommand(\"guild\") requires a non-empty guilds array.",
159
185
  [1306]: () => "Middleware priority must be a finite number.",
160
- [1403]: () => "Invalid argument passed to buildSlashRoute.",
161
186
  [1501]: () => "waitFor was aborted via its AbortSignal.",
162
187
  [1502]: (timeout) => `waitFor timed out after ${timeout}ms.`,
188
+ [1601]: (prefix) => `customId prefix ${JSON.stringify(prefix)} must be a non-empty string without a colon or control character.`,
189
+ [1602]: (field) => `customId field name ${JSON.stringify(field)} is integer-like, which JS reorders. Use a non-numeric name.`,
190
+ [1603]: (field) => `customId field ${JSON.stringify(field)} uses oneOf() with no choices.`,
191
+ [1604]: (field, min, max) => `customId field ${JSON.stringify(field)} has min ${min} greater than max ${max}.`,
192
+ [1605]: (field, value) => `customId field ${JSON.stringify(field)} got value ${value} outside its allowed range.`,
193
+ [1606]: (length) => `Encoded customId is ${length} characters, Discord allows at most 100.`,
194
+ [1607]: (field) => `customId field ${JSON.stringify(field)} is already defined in this chain.`,
195
+ [1608]: (className) => `${className} is missing its route decorator (@ButtonRoute, @ModalRoute, or @SelectMenuRoute).`,
196
+ [1609]: (prefix) => `match() has no arm for the decoded route ${JSON.stringify(prefix)}.`,
197
+ [1610]: (route) => `match() has no arm for the command route ${JSON.stringify(route)}.`,
198
+ [1611]: (field) => `match() has no arm for the focused field ${JSON.stringify(field)}.`,
199
+ [1612]: (event) => `match() has no arm for the event ${JSON.stringify(event)}.`,
200
+ [1613]: () => `this.eventName is only available on middleware the controller constructed with a fired event name.`,
163
201
  [2101]: (className) => `Missing @RegisterMongoService on ${className}.`,
164
202
  [2102]: (className) => `Missing @RegisterMongoModel on ${className}.`,
165
203
  [2103]: (databaseName) => databaseName ? `Could not connect to MongoDB (${databaseName}).` : "Could not connect to MongoDB.",
@@ -195,13 +233,12 @@ const messages = {
195
233
  [3118]: (targetPath, reason) => `Failed to write bootstrap file at ${targetPath}: ${reason}.`,
196
234
  [3119]: () => "Config `tsconfig` must be a string when provided.",
197
235
  [3120]: () => "Config `hmr` must be an object when provided.",
198
- [3121]: () => "Config `hmr.restart` must be an array of strings when provided."
236
+ [3121]: () => "Config `hmr.restart` must be an array of strings when provided.",
237
+ [3122]: (route, firstFile, secondFile) => `Two commands resolve to the same slash route \`${route}\`. Defined in ${firstFile} and ${secondFile}. Rename one.`,
238
+ [3123]: (dir, reason) => `Could not read the commands directory ${dir} during codegen. ${reason}.`,
239
+ [3124]: (kind, name, firstFile, secondFile) => `Two ${kind} context-menu commands share the name \`${name}\`. Defined in ${firstFile} and ${secondFile}. Rename one.`
199
240
  };
200
- /**
201
- * Formats a Seedcord error message based on the provided code and arguments.
202
- *
203
- * @internal
204
- */
241
+ /** @internal */
205
242
  function formatSeedcordErrorMessage(code, args) {
206
243
  const formatter = messages[code];
207
244
  return formatter(...args ?? []);
@@ -310,4 +347,4 @@ function isSeedcordError(error, type, code) {
310
347
 
311
348
  //#endregion
312
349
  export { SeedcordErrorCode as a, isSeedcordError as i, SeedcordRangeError as n, SeedcordTypeError as r, SeedcordError as t };
313
- //# sourceMappingURL=SeedcordError-xd-Ib_-z.mjs.map
350
+ //# sourceMappingURL=SeedcordError-E2D_RTuy.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SeedcordError-E2D_RTuy.mjs","names":[],"sources":["../src/Errors/ErrorCodes.ts","../src/Errors/ErrorMessages.ts","../src/Errors/SeedcordError.ts"],"sourcesContent":["/* eslint-disable no-magic-numbers */\n\n/**\n * All Seedcord error codes.\n */\nexport enum SeedcordErrorCode {\n /** DISCORD_BOT_TOKEN is not present in the environment. */\n ConfigMissingDiscordToken = 1001,\n /** DISCORD_BOT_TOKEN is present but fails validation. */\n ConfigIncorrectDiscordToken = 1004,\n /** UNKNOWN_EXCEPTION_WEBHOOK_URL is missing when configuring the reporter. */\n ConfigUnknownExceptionWebhookMissing = 1002,\n /** UNKNOWN_EXCEPTION_WEBHOOK_URL is present but fails URL validation. */\n ConfigUnknownExceptionWebhookInvalid = 1003,\n\n /** Attempted to add lifecycle tasks after startup already completed. */\n LifecycleAddAfterCompletion = 1101,\n /** Attempted to add lifecycle tasks while startup is still running. */\n LifecycleAddDuringRun = 1102,\n /** Attempted to remove lifecycle tasks while startup is still running. */\n LifecycleRemoveDuringRun = 1103,\n /** Provided lifecycle phase identifier is not recognized. */\n LifecycleUnknownPhase = 1104,\n /** Startup phase completed with one or more task failures. */\n LifecyclePhaseFailures = 1105,\n /** A lifecycle task exceeded its configured timeout. */\n LifecycleTaskTimeout = 1106,\n\n /** Multiple Seedcord instances were created simultaneously. */\n CoreSingletonViolation = 1201,\n /** Plugins cannot be mutated after the core has finished initializing. */\n CorePluginAfterInit = 1202,\n /** A plugin tried to register with a key that already exists. */\n CorePluginKeyExists = 1203,\n /** Bot role lookup failed within the provided guild. */\n CoreBotRoleMissing = 1204,\n /** A bot controller was constructed without its required handlers directory. */\n CoreControllerPathMissing = 1205,\n\n /** Interaction middleware decorated with disallowed event filters. */\n DecoratorInteractionEventFilter = 1301,\n /** A decorator could not find the original method being decorated. */\n DecoratorMethodNotFound = 1302,\n /** A command decorator attempted to re-register an existing command scope. */\n DecoratorCommandAlreadyRegistered = 1303,\n /** A global command decorator specified guild IDs, which is not allowed. */\n DecoratorCommandGlobalWithGuilds = 1304,\n /** A guild command decorator omitted the required guild ID list. */\n DecoratorCommandGuildWithoutGuilds = 1305,\n /** Middleware priority provided by the decorator was not a finite number. */\n DecoratorInvalidMiddlewarePriority = 1306,\n\n /** StrictEventEmitter.waitFor was aborted via its AbortSignal. */\n EventEmitterWaitForAborted = 1501,\n /** StrictEventEmitter.waitFor exceeded its configured timeout. */\n EventEmitterWaitForTimeout = 1502,\n\n /** A customId definition prefix contains a reserved character (a colon or a control char). */\n CustomIdInvalidPrefix = 1601,\n /** A customId field name is integer-like, which JS would silently reorder. */\n CustomIdReservedFieldName = 1602,\n /** A oneOf() field was declared with no choices. */\n CustomIdEmptyChoices = 1603,\n /** An int() field was declared with min greater than max. */\n CustomIdInvalidBounds = 1604,\n /** A value passed to encode() is outside its field's allowed range. */\n CustomIdValueOutOfRange = 1605,\n /** An encoded customId exceeds Discord's 100-character limit. */\n CustomIdWireTooLong = 1606,\n /** A field name is declared more than once in the same customId chain. */\n CustomIdDuplicateFieldName = 1607,\n /** A component handler is missing its route decorator (\\@ButtonRoute / \\@ModalRoute / \\@SelectMenuRoute). */\n CustomIdHandlerRouteMissing = 1608,\n /** match() received a decoded route with no matching arm. */\n CustomIdMatchArmMissing = 1609,\n /** A slash handler's match() has no arm for the command route that fired. */\n SlashMatchArmMissing = 1610,\n /** An autocomplete handler's match() has no arm for the focused field that fired. */\n AutocompleteMatchArmMissing = 1611,\n /** An event handler's match() has no arm for the event name that fired. */\n EventMatchArmMissing = 1612,\n /** Event middleware read `this.eventName` but was constructed without a fired event name. */\n EventMiddlewareNameUnavailable = 1613,\n\n /** Mongo service class is missing the `@RegisterMongoService` decorator. */\n PluginMongoServiceDecoratorMissing = 2101,\n /** Mongo model class is missing the `@RegisterMongoModel` decorator. */\n PluginMongoModelDecoratorMissing = 2102,\n /** Mongo client failed to establish a connection. */\n PluginMongoConnectionFailed = 2103,\n /** Mongo client failed to disconnect cleanly during shutdown. */\n PluginMongoDisconnectFailed = 2104,\n /** Mongo `services` was accessed before the plugin finished initializing. */\n PluginMongoServicesNotReady = 2105,\n\n /** KPG service class is missing the `@RegisterKpgService` decorator. */\n PluginKpgServiceDecoratorMissing = 2201,\n /** KPG service class is missing its table metadata. */\n PluginKpgServiceTableMissing = 2202,\n /** Migration manager received an invalid step count. */\n PluginKpgInvalidStepCount = 2203,\n /** Migration direction was not recognized. */\n PluginKpgUnknownDirection = 2204,\n /** Provided migrations path could not be resolved. */\n PluginKpgUnresolvedMigrationsPath = 2205,\n /** No migration files were found for execution. */\n PluginKpgNoMigrationFiles = 2206,\n /** A migration module failed to export the expected functions. */\n PluginKpgInvalidMigrationModule = 2207,\n /** An arbitrary (non-Error) failure was reported by a migration. */\n PluginKpgNonErrorFailure = 2208,\n /** Postgres pool failed to close cleanly during shutdown. */\n PluginKpgDisconnectFailed = 2209,\n /** KPG `services` was accessed before the plugin finished initializing. */\n PluginKpgServicesNotReady = 2210,\n\n /** Config file default export was not an object. */\n CliConfigInvalidExport = 3101,\n /** Config is missing the required instance string. */\n CliConfigMissingInstance = 3102,\n /** Config root was provided but not a string. */\n CliConfigInvalidRoot = 3103,\n /** Unable to locate a Seedcord config file. */\n CliConfigNotFound = 3104,\n /** CLI entry file does not exist. */\n CliEntryNotFound = 3105,\n /** tsx failed to import the provided entry file. */\n CliTsxImportFailed = 3106,\n /** Native import and jiti fallback both failed. */\n CliImportFailed = 3107,\n /** Seedcord instance export is missing a start() method. */\n CliInstanceInvalid = 3108,\n /** Seedcord instance threw during startup. */\n CliStartFailed = 3109,\n /** Config is missing the required entry string. */\n CliConfigMissingEntry = 3110,\n /** Config build options must be an object when provided. */\n CliConfigInvalidBuild = 3111,\n /** Config build outDir must be a string when provided. */\n CliConfigInvalidBuildOutDir = 3112,\n /** Config build tsconfig must be a string when provided. */\n CliConfigInvalidBuildTsconfig = 3113,\n /** Config build bootstrap must be a string when provided. */\n CliConfigInvalidBuildBootstrap = 3114,\n /** Entry file must be inside the configured root directory. */\n CliConfigEntryOutsideRoot = 3115,\n /** Unable to locate a TypeScript config file for builds. */\n CliBuildTsconfigNotFound = 3116,\n /** TypeScript reported diagnostics during emit. */\n CliBuildFailed = 3117,\n /** Unable to write the generated bootstrap file. */\n CliBootstrapWriteFailed = 3118,\n /** Config tsconfig must be a string when provided. */\n CliConfigInvalidTsconfig = 3119,\n /** Config hmr options must be an object when provided. */\n CliConfigInvalidHmr = 3120,\n /** Config hmr restart patterns must be an array of strings when provided. */\n CliConfigInvalidHmrRestart = 3121,\n /** Two commands resolve to the same slash route during codegen. */\n CliCodegenDuplicateRoute = 3122,\n /** The commands directory could not be read during codegen. */\n CliCodegenCommandsDirUnreadable = 3123,\n /** Two context-menu commands of the same kind share a name during codegen. */\n CliCodegenDuplicateContextMenu = 3124\n}\n","import { SeedcordErrorCode } from './ErrorCodes';\n\n/** @internal */\nconst messages = {\n [SeedcordErrorCode.ConfigMissingDiscordToken]: () => 'Missing DISCORD_BOT_TOKEN environment variable.',\n [SeedcordErrorCode.ConfigIncorrectDiscordToken]: () => 'Invalid DISCORD_BOT_TOKEN value.',\n [SeedcordErrorCode.ConfigUnknownExceptionWebhookMissing]: () =>\n 'Missing UNKNOWN_EXCEPTION_WEBHOOK_URL environment variable.',\n [SeedcordErrorCode.ConfigUnknownExceptionWebhookInvalid]: () => 'Invalid UNKNOWN_EXCEPTION_WEBHOOK_URL value.',\n\n [SeedcordErrorCode.LifecycleAddAfterCompletion]: () =>\n 'Cannot add tasks after startup sequence has already completed.',\n [SeedcordErrorCode.LifecycleAddDuringRun]: () => 'Cannot add tasks while startup sequence is in progress.',\n [SeedcordErrorCode.LifecycleRemoveDuringRun]: () => 'Cannot remove tasks while startup sequence is in progress.',\n [SeedcordErrorCode.LifecycleUnknownPhase]: (phase: unknown) => `Unknown phase: ${String(phase)}.`,\n [SeedcordErrorCode.LifecyclePhaseFailures]: (phase: string, failures: number) =>\n `Phase ${phase} completed with ${failures} failed task${failures === 1 ? '' : 's'}.`,\n [SeedcordErrorCode.LifecycleTaskTimeout]: (taskName: string, timeout: number) =>\n `Task \"${taskName}\" timed out after ${timeout}ms.`,\n\n [SeedcordErrorCode.CoreSingletonViolation]: () =>\n 'Seedcord can only be instantiated once. Use the existing instance instead.',\n [SeedcordErrorCode.CorePluginAfterInit]: () => 'Cannot attach a plugin after initialization.',\n [SeedcordErrorCode.CorePluginKeyExists]: (key: string) => `Plugin with key \"${key}\" already exists.`,\n [SeedcordErrorCode.CoreBotRoleMissing]: (guildId?: string) =>\n guildId ? `Bot role not found in guild ${guildId}.` : 'Bot role not found in guild.',\n [SeedcordErrorCode.CoreControllerPathMissing]: (controllerName: string, pathKind: string) =>\n `${controllerName} was instantiated without a ${pathKind} path.`,\n\n [SeedcordErrorCode.DecoratorInteractionEventFilter]: () => 'Interaction middleware cannot specify event filters.',\n [SeedcordErrorCode.DecoratorMethodNotFound]: () =>\n 'Decorator could not locate the original method. Ensure the method exists before applying the decorator.',\n [SeedcordErrorCode.DecoratorCommandAlreadyRegistered]: (\n commandName: string,\n existingScope: string,\n requestedScope: string\n ) =>\n `Command \"${commandName}\" is already registered as a \"${existingScope}\" command and cannot be re-registered as a \"${requestedScope}\" command.`,\n [SeedcordErrorCode.DecoratorCommandGlobalWithGuilds]: () =>\n 'RegisterCommand(\"global\") cannot have guilds specified.',\n [SeedcordErrorCode.DecoratorCommandGuildWithoutGuilds]: () =>\n 'RegisterCommand(\"guild\") requires a non-empty guilds array.',\n [SeedcordErrorCode.DecoratorInvalidMiddlewarePriority]: () => 'Middleware priority must be a finite number.',\n\n [SeedcordErrorCode.EventEmitterWaitForAborted]: () => 'waitFor was aborted via its AbortSignal.',\n [SeedcordErrorCode.EventEmitterWaitForTimeout]: (timeout: number) => `waitFor timed out after ${timeout}ms.`,\n\n [SeedcordErrorCode.CustomIdInvalidPrefix]: (prefix: string) =>\n `customId prefix ${JSON.stringify(prefix)} must be a non-empty string without a colon or control character.`,\n [SeedcordErrorCode.CustomIdReservedFieldName]: (field: string) =>\n `customId field name ${JSON.stringify(field)} is integer-like, which JS reorders. Use a non-numeric name.`,\n [SeedcordErrorCode.CustomIdEmptyChoices]: (field: string) =>\n `customId field ${JSON.stringify(field)} uses oneOf() with no choices.`,\n [SeedcordErrorCode.CustomIdInvalidBounds]: (field: string, min: number, max: number) =>\n `customId field ${JSON.stringify(field)} has min ${min} greater than max ${max}.`,\n [SeedcordErrorCode.CustomIdValueOutOfRange]: (field: string, value: string) =>\n `customId field ${JSON.stringify(field)} got value ${value} outside its allowed range.`,\n [SeedcordErrorCode.CustomIdWireTooLong]: (length: number) =>\n `Encoded customId is ${length} characters, Discord allows at most 100.`,\n [SeedcordErrorCode.CustomIdDuplicateFieldName]: (field: string) =>\n `customId field ${JSON.stringify(field)} is already defined in this chain.`,\n [SeedcordErrorCode.CustomIdHandlerRouteMissing]: (className: string) =>\n `${className} is missing its route decorator (@ButtonRoute, @ModalRoute, or @SelectMenuRoute).`,\n [SeedcordErrorCode.CustomIdMatchArmMissing]: (prefix: string) =>\n `match() has no arm for the decoded route ${JSON.stringify(prefix)}.`,\n [SeedcordErrorCode.SlashMatchArmMissing]: (route: string) =>\n `match() has no arm for the command route ${JSON.stringify(route)}.`,\n [SeedcordErrorCode.AutocompleteMatchArmMissing]: (field: string) =>\n `match() has no arm for the focused field ${JSON.stringify(field)}.`,\n [SeedcordErrorCode.EventMatchArmMissing]: (event: string) =>\n `match() has no arm for the event ${JSON.stringify(event)}.`,\n [SeedcordErrorCode.EventMiddlewareNameUnavailable]: () =>\n `this.eventName is only available on middleware the controller constructed with a fired event name.`,\n\n [SeedcordErrorCode.PluginMongoServiceDecoratorMissing]: (className: string) =>\n `Missing @RegisterMongoService on ${className}.`,\n [SeedcordErrorCode.PluginMongoModelDecoratorMissing]: (className: string) =>\n `Missing @RegisterMongoModel on ${className}.`,\n [SeedcordErrorCode.PluginMongoConnectionFailed]: (databaseName?: string) =>\n databaseName ? `Could not connect to MongoDB (${databaseName}).` : 'Could not connect to MongoDB.',\n [SeedcordErrorCode.PluginMongoDisconnectFailed]: () => 'Failed to disconnect from MongoDB cleanly during shutdown.',\n [SeedcordErrorCode.PluginMongoServicesNotReady]: () =>\n 'Mongo services accessed before the plugin finished initializing.',\n\n [SeedcordErrorCode.PluginKpgServiceDecoratorMissing]: (className: string) =>\n `Missing @RegisterKpgService on ${className}.`,\n [SeedcordErrorCode.PluginKpgServiceTableMissing]: (className: string) =>\n `Missing table metadata for ${className}. Provide a table via @RegisterKpgService().`,\n [SeedcordErrorCode.PluginKpgInvalidStepCount]: () => 'Migration step count must be a non-negative integer.',\n [SeedcordErrorCode.PluginKpgUnknownDirection]: (direction: unknown) =>\n `Unknown migration direction: ${String(direction)}.`,\n [SeedcordErrorCode.PluginKpgUnresolvedMigrationsPath]: (label: string) =>\n `Unable to resolve migrations at path: ${label}.`,\n [SeedcordErrorCode.PluginKpgNoMigrationFiles]: () => 'No migration files provided.',\n [SeedcordErrorCode.PluginKpgInvalidMigrationModule]: (filePath: string) =>\n `Migration file ${filePath} must export async functions up and down.`,\n [SeedcordErrorCode.PluginKpgNonErrorFailure]: (message: string) => `Migration failure: ${message}.`,\n [SeedcordErrorCode.PluginKpgDisconnectFailed]: () => 'Failed to close the Postgres pool cleanly during shutdown.',\n [SeedcordErrorCode.PluginKpgServicesNotReady]: () =>\n 'KPG services accessed before the plugin finished initializing.',\n\n [SeedcordErrorCode.CliConfigInvalidExport]: () => 'Config file must default export an object.',\n [SeedcordErrorCode.CliConfigMissingInstance]: () =>\n 'Config must include an `instance` string that points to your Seedcord default export.',\n [SeedcordErrorCode.CliConfigInvalidRoot]: () => 'Config `root` must be a string when provided.',\n [SeedcordErrorCode.CliConfigNotFound]: (baseDir: string, candidates: readonly string[]) =>\n `Unable to locate a Seedcord config in ${baseDir}. Searched for ${candidates.join(', ')}.`,\n [SeedcordErrorCode.CliConfigMissingEntry]: () =>\n 'Config must include an `entry` string that points to your startup script.',\n [SeedcordErrorCode.CliConfigInvalidBuild]: () => 'Config `build` must be an object when provided.',\n [SeedcordErrorCode.CliConfigInvalidBuildOutDir]: () => 'Config `build.outDir` must be a string when provided.',\n [SeedcordErrorCode.CliConfigInvalidBuildTsconfig]: () => 'Config `build.tsconfig` must be a string when provided.',\n [SeedcordErrorCode.CliConfigInvalidBuildBootstrap]: () =>\n 'Config `build.bootstrap` must be a string when provided.',\n [SeedcordErrorCode.CliConfigEntryOutsideRoot]: (entryPath: string, root: string) =>\n `Entry file ${entryPath} must reside inside configured root ${root}.`,\n [SeedcordErrorCode.CliEntryNotFound]: (entryPath: string) => `Cannot find entry file at ${entryPath}.`,\n [SeedcordErrorCode.CliTsxImportFailed]: (entryPath: string, reason: string) =>\n `Failed to import ${entryPath} via tsx: ${reason}.`,\n [SeedcordErrorCode.CliImportFailed]: (entryPath: string, nativeReason: string, fallbackReason: string) =>\n `Failed to import ${entryPath}: ${nativeReason}. Fallback via jiti also failed: ${fallbackReason}.`,\n [SeedcordErrorCode.CliInstanceInvalid]: () =>\n 'Seedcord instance must default export an object with a start() method.',\n [SeedcordErrorCode.CliStartFailed]: (instancePath: string, reason: string) =>\n `Failed to start Seedcord from ${instancePath}: ${reason}.`,\n [SeedcordErrorCode.CliBuildTsconfigNotFound]: (hint: string) =>\n `Unable to resolve a tsconfig for builds (${hint}). Provide build.tsconfig or add tsconfig.build.json / tsconfig.json.`,\n [SeedcordErrorCode.CliBuildFailed]: (diagnostics: string) => `TypeScript build failed:\\n${diagnostics}`,\n [SeedcordErrorCode.CliBootstrapWriteFailed]: (targetPath: string, reason: string) =>\n `Failed to write bootstrap file at ${targetPath}: ${reason}.`,\n [SeedcordErrorCode.CliConfigInvalidTsconfig]: () => 'Config `tsconfig` must be a string when provided.',\n [SeedcordErrorCode.CliConfigInvalidHmr]: () => 'Config `hmr` must be an object when provided.',\n [SeedcordErrorCode.CliConfigInvalidHmrRestart]: () =>\n 'Config `hmr.restart` must be an array of strings when provided.',\n [SeedcordErrorCode.CliCodegenDuplicateRoute]: (route: string, firstFile: string, secondFile: string) =>\n `Two commands resolve to the same slash route \\`${route}\\`. Defined in ${firstFile} and ${secondFile}. Rename one.`,\n [SeedcordErrorCode.CliCodegenCommandsDirUnreadable]: (dir: string, reason: string) =>\n `Could not read the commands directory ${dir} during codegen. ${reason}.`,\n [SeedcordErrorCode.CliCodegenDuplicateContextMenu]: (\n kind: string,\n name: string,\n firstFile: string,\n secondFile: string\n ) =>\n `Two ${kind} context-menu commands share the name \\`${name}\\`. Defined in ${firstFile} and ${secondFile}. Rename one.`\n} satisfies Record<SeedcordErrorCode, (...args: never[]) => string>;\n\n/** @internal */\nexport type SeedcordErrorArguments<Code extends SeedcordErrorCode> = Parameters<(typeof messages)[Code]>;\n\n/** @internal */\nexport function formatSeedcordErrorMessage<Code extends SeedcordErrorCode>(\n code: Code,\n args?: SeedcordErrorArguments<Code>\n): string {\n const formatter = messages[code];\n const resolvedArgs = (args ?? []) as unknown[];\n return (formatter as (...params: unknown[]) => string)(...resolvedArgs);\n}\n","/* eslint-disable @typescript-eslint/no-unnecessary-condition */\nimport chalk from 'chalk';\n\nimport { SeedcordErrorCode } from './ErrorCodes';\nimport { formatSeedcordErrorMessage, type SeedcordErrorArguments } from './ErrorMessages';\n\n/**\n * String literal type for Seedcord error identifiers.\n *\n * @internal\n */\ntype SeedcordErrorIdentifier = keyof typeof SeedcordErrorCode;\n\n/**\n * Options for Seedcord errors.\n *\n * @internal\n */\ninterface SeedcordErrorOptions extends ErrorOptions {}\n\nfunction resolveIdentifier(code: SeedcordErrorCode): SeedcordErrorIdentifier {\n return SeedcordErrorCode[code] as SeedcordErrorIdentifier;\n}\n\ntype SeedcordErrorPayload<Code extends SeedcordErrorCode> = SeedcordErrorArguments<Code> | undefined;\n\ntype SeedcordErrorCtorRest<Code extends SeedcordErrorCode> =\n SeedcordErrorArguments<Code> extends []\n ? [options?: SeedcordErrorOptions]\n : [args: SeedcordErrorArguments<Code>, options?: SeedcordErrorOptions];\n\nfunction resolveCtorInputs<Code extends SeedcordErrorCode>(\n rest: SeedcordErrorCtorRest<Code>\n): { args: SeedcordErrorPayload<Code>; options?: SeedcordErrorOptions } {\n const [maybeArgsOrOptions, maybeOptions] = rest;\n if (Array.isArray(maybeArgsOrOptions)) {\n const result: { args: SeedcordErrorPayload<Code>; options?: SeedcordErrorOptions } = {\n args: maybeArgsOrOptions\n };\n\n if (maybeOptions !== undefined) {\n result.options = maybeOptions;\n }\n\n return result;\n }\n\n const result: { args: SeedcordErrorPayload<Code>; options?: SeedcordErrorOptions } = {\n args: undefined\n };\n\n if (maybeArgsOrOptions !== undefined) {\n result.options = maybeArgsOrOptions;\n }\n\n return result;\n}\n\nfunction resolveMessage<Code extends SeedcordErrorCode>(code: Code, args: SeedcordErrorPayload<Code>): string {\n return formatSeedcordErrorMessage(code, args);\n}\n\nfunction formatErrorName(name: string, _identifier: SeedcordErrorIdentifier, code: SeedcordErrorCode): string {\n return `${chalk.bold.red(name)}[${chalk.gray(code)}]`;\n}\n\n/**\n * String literal type for Seedcord error class names.\n *\n * @internal\n */\nexport type SeedcordErrorTypeString = `Seedcord${'Error' | 'TypeError' | 'RangeError'}`;\n\n/**\n * Base interface for Seedcord error instances.\n *\n * @internal\n */\nexport interface BaseSeedcordError {\n readonly code: SeedcordErrorCode;\n readonly identifier: SeedcordErrorIdentifier;\n readonly type: SeedcordErrorTypeString;\n}\n\n/**\n * Base class for Seedcord errors.\n *\n * @internal\n */\nexport class SeedcordError<Code extends SeedcordErrorCode = SeedcordErrorCode>\n extends Error\n implements BaseSeedcordError\n{\n public readonly code: Code;\n public readonly identifier: SeedcordErrorIdentifier;\n public readonly type = 'SeedcordError';\n\n constructor(code: Code, ...rest: SeedcordErrorCtorRest<Code>) {\n const { args, options } = resolveCtorInputs(rest);\n const message = resolveMessage(code, args);\n super(message, options);\n this.code = code;\n this.identifier = resolveIdentifier(code);\n this.name = formatErrorName(new.target.name, this.identifier, this.code);\n Object.setPrototypeOf(this, new.target.prototype);\n if (typeof Error.captureStackTrace === 'function') {\n Error.captureStackTrace(this, new.target);\n }\n }\n}\n\n/**\n * TypeError class for Seedcord errors.\n *\n * @internal\n */\nexport class SeedcordTypeError<Code extends SeedcordErrorCode = SeedcordErrorCode>\n extends TypeError\n implements BaseSeedcordError\n{\n public readonly code: Code;\n public readonly identifier: SeedcordErrorIdentifier;\n public readonly type = 'SeedcordTypeError';\n\n constructor(code: Code, ...rest: SeedcordErrorCtorRest<Code>) {\n const { args, options } = resolveCtorInputs(rest);\n const message = resolveMessage(code, args);\n super(message, options);\n this.code = code;\n this.identifier = resolveIdentifier(code);\n this.name = formatErrorName(new.target.name, this.identifier, this.code);\n Object.setPrototypeOf(this, new.target.prototype);\n if (typeof Error.captureStackTrace === 'function') {\n Error.captureStackTrace(this, new.target);\n }\n }\n}\n\n/**\n * RangeError class for Seedcord errors.\n *\n * @internal\n */\nexport class SeedcordRangeError<Code extends SeedcordErrorCode = SeedcordErrorCode>\n extends RangeError\n implements BaseSeedcordError\n{\n public readonly code: Code;\n public readonly identifier: SeedcordErrorIdentifier;\n public readonly type = 'SeedcordRangeError';\n\n constructor(code: Code, ...rest: SeedcordErrorCtorRest<Code>) {\n const { args, options } = resolveCtorInputs(rest);\n const message = resolveMessage(code, args);\n super(message, options);\n this.code = code;\n this.identifier = resolveIdentifier(code);\n this.name = formatErrorName(new.target.name, this.identifier, this.code);\n Object.setPrototypeOf(this, new.target.prototype);\n if (typeof Error.captureStackTrace === 'function') {\n Error.captureStackTrace(this, new.target);\n }\n }\n}\n\n/**\n * Variant type for Seedcord error classes.\n *\n * @internal\n */\ntype SeedcordErrorVariant<\n Type extends SeedcordErrorTypeString,\n Code extends SeedcordErrorCode\n> = Type extends 'SeedcordError'\n ? SeedcordError<Code>\n : Type extends 'SeedcordTypeError'\n ? SeedcordTypeError<Code>\n : SeedcordRangeError<Code>;\n\n/**\n * Union type of all Seedcord error variants for a specific error code.\n *\n * @internal\n */\ntype AnySeedcordErrorForCode<Code extends SeedcordErrorCode> = {\n [Variant in SeedcordErrorTypeString]: SeedcordErrorVariant<Variant, Code>;\n}[SeedcordErrorTypeString];\n\n/**\n * Union type of all Seedcord errors filtered by error class.\n *\n * @internal\n */\ntype ErrorTypeFilter<Type extends SeedcordErrorTypeString | undefined> = Type extends SeedcordErrorTypeString\n ? {\n [Code in SeedcordErrorCode]: SeedcordErrorVariant<Type, Code>;\n }[SeedcordErrorCode]\n : AnySeedcordErrorForCode<SeedcordErrorCode>;\n\n/**\n * Union type of all Seedcord errors filtered by error class and error code.\n *\n * @internal\n */\nexport type ErrorCodeFilter<\n Type extends SeedcordErrorTypeString | undefined,\n Code extends SeedcordErrorCode | undefined\n> = Code extends SeedcordErrorCode\n ? Type extends SeedcordErrorTypeString\n ? SeedcordErrorVariant<Type, Code>\n : AnySeedcordErrorForCode<Code>\n : ErrorTypeFilter<Type>;\n\n/**\n * Determines whether an unknown value is a Seedcord error, with optional narrowing by class and error code.\n *\n * @param error - The value to inspect.\n * @param type - Optional error class discriminator (Error, TypeError, or RangeError).\n * @param code - Optional {@link SeedcordErrorCode} discriminator to narrow by code.\n * @typeParam Type - What kind of {@link SeedcordErrorTypeString} to filter by.\n * @typeParam Code - The specific {@link SeedcordErrorCode} to filter by.\n */\nexport function isSeedcordError<\n Type extends SeedcordErrorTypeString | undefined,\n Code extends SeedcordErrorCode | undefined\n>(error: unknown, type?: Type, code?: Code): error is ErrorCodeFilter<Type, Code> {\n const isSeedcordErrorInstance = error instanceof SeedcordError && error.type === 'SeedcordError';\n const isSeedcordTypeErrorInstance = error instanceof SeedcordTypeError && error.type === 'SeedcordTypeError';\n const isSeedcordRangeErrorInstance = error instanceof SeedcordRangeError && error.type === 'SeedcordRangeError';\n\n if (!isSeedcordErrorInstance && !isSeedcordTypeErrorInstance && !isSeedcordRangeErrorInstance) {\n return false;\n }\n\n const matchesType = type\n ? (type === 'SeedcordError' && isSeedcordErrorInstance) ||\n (type === 'SeedcordTypeError' && isSeedcordTypeErrorInstance) ||\n (type === 'SeedcordRangeError' && isSeedcordRangeErrorInstance)\n : true;\n\n if (!matchesType) return false;\n if (code === undefined) return true;\n return error.code === code;\n}\n"],"mappings":";;;;;;AAKA,IAAY,oBAAL;;CAEH;;CAEA;;CAEA;;CAEA;;CAGA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAGA;;CAEA;;CAEA;;CAEA;;CAEA;;CAGA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAGA;;CAEA;;CAGA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAGA;;CAEA;;CAEA;;CAEA;;CAEA;;CAGA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAGA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;AACJ;;;;;ACjKA,MAAM,WAAW;eACwC;eACE;eAEnD;eAC4D;eAG5D;eAC6C;eACG;UACR,UAAmB,kBAAkB,OAAO,KAAK,EAAE;UAClD,OAAe,aACxD,SAAS,MAAM,kBAAkB,SAAS,cAAc,aAAa,IAAI,KAAK,IAAI;UAC3C,UAAkB,YACzD,SAAS,SAAS,oBAAoB,QAAQ;eAG9C;eAC2C;UACL,QAAgB,oBAAoB,IAAI;UACzC,YACrC,UAAU,+BAA+B,QAAQ,KAAK;UACV,gBAAwB,aACpE,GAAG,eAAe,8BAA8B,SAAS;eAEF;eAEvD;UAEA,aACA,eACA,mBAEA,YAAY,YAAY,gCAAgC,cAAc,8CAA8C,eAAe;eAEnI;eAEA;eAC0D;eAER;UACL,YAAoB,2BAA2B,Q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M,SAAS;CACjF,MAAM,8BAA8B,iBAAiB,qBAAqB,MAAM,SAAS;CACzF,MAAM,+BAA+B,iBAAiB,sBAAsB,MAAM,SAAS;CAE3F,IAAI,CAAC,2BAA2B,CAAC,+BAA+B,CAAC,8BAC7D,OAAO;CASX,IAAI,EANgB,OACb,SAAS,mBAAmB,2BAC5B,SAAS,uBAAuB,+BAChC,SAAS,wBAAwB,+BAClC,OAEY,OAAO;CACzB,IAAI,SAAS,QAAW,OAAO;CAC/B,OAAO,MAAM,SAAS;AAC1B"}
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_SeedcordError = require('./SeedcordError-wt7_KePP.cjs');
2
+ const require_SeedcordError = require('./SeedcordError-C1GYc1BF.cjs');
3
3
  let envapt = require("envapt");
4
4
  let node_path = require("node:path");
5
5
  node_path = require_SeedcordError.__toESM(node_path, 1);
@@ -1498,7 +1498,7 @@ var CoordinatedStartup = class extends CoordinatedLifecycle {
1498
1498
  //#endregion
1499
1499
  //#region src/index.ts
1500
1500
  /** Package version */
1501
- const version = "0.7.0";
1501
+ const version = "0.7.1";
1502
1502
 
1503
1503
  //#endregion
1504
1504
  exports.CooldownManager = CooldownManager;
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { o as isSeedcordError, r as SeedcordErrorTypeString, s as SeedcordErrorCode, t as BaseSeedcordError } from "./SeedcordError-BuWVIe6m.mjs";
1
+ import { o as isSeedcordError, r as SeedcordErrorTypeString, s as SeedcordErrorCode, t as BaseSeedcordError } from "./SeedcordError-D6uPv6qc.mjs";
2
2
  import { Logform, Logger as Logger$1 } from "winston";
3
3
  import TransportStream from "winston-transport";
4
4
  import { EventEmitter } from "node:events";
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { a as SeedcordErrorCode, i as isSeedcordError, t as SeedcordError } from "./SeedcordError-xd-Ib_-z.mjs";
1
+ import { a as SeedcordErrorCode, i as isSeedcordError, t as SeedcordError } from "./SeedcordError-E2D_RTuy.mjs";
2
2
  import { Envapter } from "envapt";
3
3
  import path from "node:path";
4
4
  import winston, { createLogger, format, transports } from "winston";
@@ -1491,7 +1491,7 @@ var CoordinatedStartup = class extends CoordinatedLifecycle {
1491
1491
  //#endregion
1492
1492
  //#region src/index.ts
1493
1493
  /** Package version */
1494
- const version = "0.7.0";
1494
+ const version = "0.7.1";
1495
1495
 
1496
1496
  //#endregion
1497
1497
  export { CooldownManager, CoordinatedLifecycle, CoordinatedShutdown, CoordinatedStartup, HealthCheck, Logger, LoggerChannelRegistry, LoggerUtilities, SeedcordErrorCode, ShutdownPhase, StartupPhase, StrictEventEmitter, isSeedcordError, version };
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_SeedcordError = require('./SeedcordError-wt7_KePP.cjs');
2
+ const require_SeedcordError = require('./SeedcordError-C1GYc1BF.cjs');
3
3
 
4
4
  exports.SeedcordError = require_SeedcordError.SeedcordError;
5
5
  exports.SeedcordRangeError = require_SeedcordError.SeedcordRangeError;
@@ -1,2 +1,2 @@
1
- import { a as SeedcordTypeError, i as SeedcordRangeError, n as SeedcordError } from "./SeedcordError-BuWVIe6m.mjs";
1
+ import { a as SeedcordTypeError, i as SeedcordRangeError, n as SeedcordError } from "./SeedcordError-D6uPv6qc.mjs";
2
2
  export { SeedcordError, SeedcordRangeError, SeedcordTypeError };
@@ -1,3 +1,3 @@
1
- import { n as SeedcordRangeError, r as SeedcordTypeError, t as SeedcordError } from "./SeedcordError-xd-Ib_-z.mjs";
1
+ import { n as SeedcordRangeError, r as SeedcordTypeError, t as SeedcordError } from "./SeedcordError-E2D_RTuy.mjs";
2
2
 
3
3
  export { SeedcordError, SeedcordRangeError, SeedcordTypeError };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@seedcord/services",
3
3
  "type": "module",
4
- "version": "0.7.0",
4
+ "version": "0.7.1",
5
5
  "description": "Services for Seedcord packages",
6
6
  "repository": {
7
7
  "type": "git",
@@ -46,8 +46,8 @@
46
46
  "strip-ansi": "^7.2.0",
47
47
  "winston": "^3.19.0",
48
48
  "winston-transport": "^4.9.0",
49
- "@seedcord/types": "0.4.0",
50
- "@seedcord/utils": "0.4.0"
49
+ "@seedcord/types": "0.5.0",
50
+ "@seedcord/utils": "0.5.0"
51
51
  },
52
52
  "devDependencies": {
53
53
  "type-fest": "^5.6.0",
@@ -1 +0,0 @@
1
- {"version":3,"file":"SeedcordError-wt7_KePP.cjs","names":[],"sources":["../src/Errors/ErrorCodes.ts","../src/Errors/ErrorMessages.ts","../src/Errors/SeedcordError.ts"],"sourcesContent":["/* eslint-disable no-magic-numbers */\n\n/**\n * All Seedcord error codes.\n */\nexport enum SeedcordErrorCode {\n /** DISCORD_BOT_TOKEN is not present in the environment. */\n ConfigMissingDiscordToken = 1001,\n /** DISCORD_BOT_TOKEN is present but fails validation. */\n ConfigIncorrectDiscordToken = 1004,\n /** UNKNOWN_EXCEPTION_WEBHOOK_URL is missing when configuring the reporter. */\n ConfigUnknownExceptionWebhookMissing = 1002,\n /** UNKNOWN_EXCEPTION_WEBHOOK_URL is present but fails URL validation. */\n ConfigUnknownExceptionWebhookInvalid = 1003,\n\n /** Attempted to add lifecycle tasks after startup already completed. */\n LifecycleAddAfterCompletion = 1101,\n /** Attempted to add lifecycle tasks while startup is still running. */\n LifecycleAddDuringRun = 1102,\n /** Attempted to remove lifecycle tasks while startup is still running. */\n LifecycleRemoveDuringRun = 1103,\n /** Provided lifecycle phase identifier is not recognized. */\n LifecycleUnknownPhase = 1104,\n /** Startup phase completed with one or more task failures. */\n LifecyclePhaseFailures = 1105,\n /** A lifecycle task exceeded its configured timeout. */\n LifecycleTaskTimeout = 1106,\n\n /** Multiple Seedcord instances were created simultaneously. */\n CoreSingletonViolation = 1201,\n /** Plugins cannot be mutated after the core has finished initializing. */\n CorePluginAfterInit = 1202,\n /** A plugin tried to register with a key that already exists. */\n CorePluginKeyExists = 1203,\n /** Bot role lookup failed within the provided guild. */\n CoreBotRoleMissing = 1204,\n /** A bot controller was constructed without its required handlers directory. */\n CoreControllerPathMissing = 1205,\n\n /** Interaction middleware decorated with disallowed event filters. */\n DecoratorInteractionEventFilter = 1301,\n /** A decorator could not find the original method being decorated. */\n DecoratorMethodNotFound = 1302,\n /** A command decorator attempted to re-register an existing command scope. */\n DecoratorCommandAlreadyRegistered = 1303,\n /** A global command decorator specified guild IDs, which is not allowed. */\n DecoratorCommandGlobalWithGuilds = 1304,\n /** A guild command decorator omitted the required guild ID list. */\n DecoratorCommandGuildWithoutGuilds = 1305,\n /** Middleware priority provided by the decorator was not a finite number. */\n DecoratorInvalidMiddlewarePriority = 1306,\n\n /** buildSlashRoute received an invalid argument. */\n UtilInvalidSlashRouteArgument = 1403,\n\n /** StrictEventEmitter.waitFor was aborted via its AbortSignal. */\n EventEmitterWaitForAborted = 1501,\n /** StrictEventEmitter.waitFor exceeded its configured timeout. */\n EventEmitterWaitForTimeout = 1502,\n\n /** Mongo service class is missing the `@RegisterMongoService` decorator. */\n PluginMongoServiceDecoratorMissing = 2101,\n /** Mongo model class is missing the `@RegisterMongoModel` decorator. */\n PluginMongoModelDecoratorMissing = 2102,\n /** Mongo client failed to establish a connection. */\n PluginMongoConnectionFailed = 2103,\n /** Mongo client failed to disconnect cleanly during shutdown. */\n PluginMongoDisconnectFailed = 2104,\n /** Mongo `services` was accessed before the plugin finished initializing. */\n PluginMongoServicesNotReady = 2105,\n\n /** KPG service class is missing the `@RegisterKpgService` decorator. */\n PluginKpgServiceDecoratorMissing = 2201,\n /** KPG service class is missing its table metadata. */\n PluginKpgServiceTableMissing = 2202,\n /** Migration manager received an invalid step count. */\n PluginKpgInvalidStepCount = 2203,\n /** Migration direction was not recognized. */\n PluginKpgUnknownDirection = 2204,\n /** Provided migrations path could not be resolved. */\n PluginKpgUnresolvedMigrationsPath = 2205,\n /** No migration files were found for execution. */\n PluginKpgNoMigrationFiles = 2206,\n /** A migration module failed to export the expected functions. */\n PluginKpgInvalidMigrationModule = 2207,\n /** An arbitrary (non-Error) failure was reported by a migration. */\n PluginKpgNonErrorFailure = 2208,\n /** Postgres pool failed to close cleanly during shutdown. */\n PluginKpgDisconnectFailed = 2209,\n /** KPG `services` was accessed before the plugin finished initializing. */\n PluginKpgServicesNotReady = 2210,\n\n /** Config file default export was not an object. */\n CliConfigInvalidExport = 3101,\n /** Config is missing the required instance string. */\n CliConfigMissingInstance = 3102,\n /** Config root was provided but not a string. */\n CliConfigInvalidRoot = 3103,\n /** Unable to locate a Seedcord config file. */\n CliConfigNotFound = 3104,\n /** CLI entry file does not exist. */\n CliEntryNotFound = 3105,\n /** tsx failed to import the provided entry file. */\n CliTsxImportFailed = 3106,\n /** Native import and jiti fallback both failed. */\n CliImportFailed = 3107,\n /** Seedcord instance export is missing a start() method. */\n CliInstanceInvalid = 3108,\n /** Seedcord instance threw during startup. */\n CliStartFailed = 3109,\n /** Config is missing the required entry string. */\n CliConfigMissingEntry = 3110,\n /** Config build options must be an object when provided. */\n CliConfigInvalidBuild = 3111,\n /** Config build outDir must be a string when provided. */\n CliConfigInvalidBuildOutDir = 3112,\n /** Config build tsconfig must be a string when provided. */\n CliConfigInvalidBuildTsconfig = 3113,\n /** Config build bootstrap must be a string when provided. */\n CliConfigInvalidBuildBootstrap = 3114,\n /** Entry file must be inside the configured root directory. */\n CliConfigEntryOutsideRoot = 3115,\n /** Unable to locate a TypeScript config file for builds. */\n CliBuildTsconfigNotFound = 3116,\n /** TypeScript reported diagnostics during emit. */\n CliBuildFailed = 3117,\n /** Unable to write the generated bootstrap file. */\n CliBootstrapWriteFailed = 3118,\n /** Config tsconfig must be a string when provided. */\n CliConfigInvalidTsconfig = 3119,\n /** Config hmr options must be an object when provided. */\n CliConfigInvalidHmr = 3120,\n /** Config hmr restart patterns must be an array of strings when provided. */\n CliConfigInvalidHmrRestart = 3121\n}\n","import { SeedcordErrorCode } from './ErrorCodes';\n\n/**\n * Mapping of Seedcord error codes to their corresponding message formatters.\n *\n * @internal\n */\nconst messages = {\n [SeedcordErrorCode.ConfigMissingDiscordToken]: () => 'Missing DISCORD_BOT_TOKEN environment variable.',\n [SeedcordErrorCode.ConfigIncorrectDiscordToken]: () => 'Invalid DISCORD_BOT_TOKEN value.',\n [SeedcordErrorCode.ConfigUnknownExceptionWebhookMissing]: () =>\n 'Missing UNKNOWN_EXCEPTION_WEBHOOK_URL environment variable.',\n [SeedcordErrorCode.ConfigUnknownExceptionWebhookInvalid]: () => 'Invalid UNKNOWN_EXCEPTION_WEBHOOK_URL value.',\n\n [SeedcordErrorCode.LifecycleAddAfterCompletion]: () =>\n 'Cannot add tasks after startup sequence has already completed.',\n [SeedcordErrorCode.LifecycleAddDuringRun]: () => 'Cannot add tasks while startup sequence is in progress.',\n [SeedcordErrorCode.LifecycleRemoveDuringRun]: () => 'Cannot remove tasks while startup sequence is in progress.',\n [SeedcordErrorCode.LifecycleUnknownPhase]: (phase: unknown) => `Unknown phase: ${String(phase)}.`,\n [SeedcordErrorCode.LifecyclePhaseFailures]: (phase: string, failures: number) =>\n `Phase ${phase} completed with ${failures} failed task${failures === 1 ? '' : 's'}.`,\n [SeedcordErrorCode.LifecycleTaskTimeout]: (taskName: string, timeout: number) =>\n `Task \"${taskName}\" timed out after ${timeout}ms.`,\n\n [SeedcordErrorCode.CoreSingletonViolation]: () =>\n 'Seedcord can only be instantiated once. Use the existing instance instead.',\n [SeedcordErrorCode.CorePluginAfterInit]: () => 'Cannot attach a plugin after initialization.',\n [SeedcordErrorCode.CorePluginKeyExists]: (key: string) => `Plugin with key \"${key}\" already exists.`,\n [SeedcordErrorCode.CoreBotRoleMissing]: (guildId?: string) =>\n guildId ? `Bot role not found in guild ${guildId}.` : 'Bot role not found in guild.',\n [SeedcordErrorCode.CoreControllerPathMissing]: (controllerName: string, pathKind: string) =>\n `${controllerName} was instantiated without a ${pathKind} path.`,\n\n [SeedcordErrorCode.DecoratorInteractionEventFilter]: () => 'Interaction middleware cannot specify event filters.',\n [SeedcordErrorCode.DecoratorMethodNotFound]: () =>\n 'Decorator could not locate the original method. Ensure the method exists before applying the decorator.',\n [SeedcordErrorCode.DecoratorCommandAlreadyRegistered]: (\n commandName: string,\n existingScope: string,\n requestedScope: string\n ) =>\n `Command \"${commandName}\" is already registered as a \"${existingScope}\" command and cannot be re-registered as a \"${requestedScope}\" command.`,\n [SeedcordErrorCode.DecoratorCommandGlobalWithGuilds]: () =>\n 'RegisterCommand(\"global\") cannot have guilds specified.',\n [SeedcordErrorCode.DecoratorCommandGuildWithoutGuilds]: () =>\n 'RegisterCommand(\"guild\") requires a non-empty guilds array.',\n [SeedcordErrorCode.DecoratorInvalidMiddlewarePriority]: () => 'Middleware priority must be a finite number.',\n\n [SeedcordErrorCode.UtilInvalidSlashRouteArgument]: () => 'Invalid argument passed to buildSlashRoute.',\n\n [SeedcordErrorCode.EventEmitterWaitForAborted]: () => 'waitFor was aborted via its AbortSignal.',\n [SeedcordErrorCode.EventEmitterWaitForTimeout]: (timeout: number) => `waitFor timed out after ${timeout}ms.`,\n\n [SeedcordErrorCode.PluginMongoServiceDecoratorMissing]: (className: string) =>\n `Missing @RegisterMongoService on ${className}.`,\n [SeedcordErrorCode.PluginMongoModelDecoratorMissing]: (className: string) =>\n `Missing @RegisterMongoModel on ${className}.`,\n [SeedcordErrorCode.PluginMongoConnectionFailed]: (databaseName?: string) =>\n databaseName ? `Could not connect to MongoDB (${databaseName}).` : 'Could not connect to MongoDB.',\n [SeedcordErrorCode.PluginMongoDisconnectFailed]: () => 'Failed to disconnect from MongoDB cleanly during shutdown.',\n [SeedcordErrorCode.PluginMongoServicesNotReady]: () =>\n 'Mongo services accessed before the plugin finished initializing.',\n\n [SeedcordErrorCode.PluginKpgServiceDecoratorMissing]: (className: string) =>\n `Missing @RegisterKpgService on ${className}.`,\n [SeedcordErrorCode.PluginKpgServiceTableMissing]: (className: string) =>\n `Missing table metadata for ${className}. Provide a table via @RegisterKpgService().`,\n [SeedcordErrorCode.PluginKpgInvalidStepCount]: () => 'Migration step count must be a non-negative integer.',\n [SeedcordErrorCode.PluginKpgUnknownDirection]: (direction: unknown) =>\n `Unknown migration direction: ${String(direction)}.`,\n [SeedcordErrorCode.PluginKpgUnresolvedMigrationsPath]: (label: string) =>\n `Unable to resolve migrations at path: ${label}.`,\n [SeedcordErrorCode.PluginKpgNoMigrationFiles]: () => 'No migration files provided.',\n [SeedcordErrorCode.PluginKpgInvalidMigrationModule]: (filePath: string) =>\n `Migration file ${filePath} must export async functions up and down.`,\n [SeedcordErrorCode.PluginKpgNonErrorFailure]: (message: string) => `Migration failure: ${message}.`,\n [SeedcordErrorCode.PluginKpgDisconnectFailed]: () => 'Failed to close the Postgres pool cleanly during shutdown.',\n [SeedcordErrorCode.PluginKpgServicesNotReady]: () =>\n 'KPG services accessed before the plugin finished initializing.',\n\n [SeedcordErrorCode.CliConfigInvalidExport]: () => 'Config file must default export an object.',\n [SeedcordErrorCode.CliConfigMissingInstance]: () =>\n 'Config must include an `instance` string that points to your Seedcord default export.',\n [SeedcordErrorCode.CliConfigInvalidRoot]: () => 'Config `root` must be a string when provided.',\n [SeedcordErrorCode.CliConfigNotFound]: (baseDir: string, candidates: readonly string[]) =>\n `Unable to locate a Seedcord config in ${baseDir}. Searched for ${candidates.join(', ')}.`,\n [SeedcordErrorCode.CliConfigMissingEntry]: () =>\n 'Config must include an `entry` string that points to your startup script.',\n [SeedcordErrorCode.CliConfigInvalidBuild]: () => 'Config `build` must be an object when provided.',\n [SeedcordErrorCode.CliConfigInvalidBuildOutDir]: () => 'Config `build.outDir` must be a string when provided.',\n [SeedcordErrorCode.CliConfigInvalidBuildTsconfig]: () => 'Config `build.tsconfig` must be a string when provided.',\n [SeedcordErrorCode.CliConfigInvalidBuildBootstrap]: () =>\n 'Config `build.bootstrap` must be a string when provided.',\n [SeedcordErrorCode.CliConfigEntryOutsideRoot]: (entryPath: string, root: string) =>\n `Entry file ${entryPath} must reside inside configured root ${root}.`,\n [SeedcordErrorCode.CliEntryNotFound]: (entryPath: string) => `Cannot find entry file at ${entryPath}.`,\n [SeedcordErrorCode.CliTsxImportFailed]: (entryPath: string, reason: string) =>\n `Failed to import ${entryPath} via tsx: ${reason}.`,\n [SeedcordErrorCode.CliImportFailed]: (entryPath: string, nativeReason: string, fallbackReason: string) =>\n `Failed to import ${entryPath}: ${nativeReason}. Fallback via jiti also failed: ${fallbackReason}.`,\n [SeedcordErrorCode.CliInstanceInvalid]: () =>\n 'Seedcord instance must default export an object with a start() method.',\n [SeedcordErrorCode.CliStartFailed]: (instancePath: string, reason: string) =>\n `Failed to start Seedcord from ${instancePath}: ${reason}.`,\n [SeedcordErrorCode.CliBuildTsconfigNotFound]: (hint: string) =>\n `Unable to resolve a tsconfig for builds (${hint}). Provide build.tsconfig or add tsconfig.build.json / tsconfig.json.`,\n [SeedcordErrorCode.CliBuildFailed]: (diagnostics: string) => `TypeScript build failed:\\n${diagnostics}`,\n [SeedcordErrorCode.CliBootstrapWriteFailed]: (targetPath: string, reason: string) =>\n `Failed to write bootstrap file at ${targetPath}: ${reason}.`,\n [SeedcordErrorCode.CliConfigInvalidTsconfig]: () => 'Config `tsconfig` must be a string when provided.',\n [SeedcordErrorCode.CliConfigInvalidHmr]: () => 'Config `hmr` must be an object when provided.',\n [SeedcordErrorCode.CliConfigInvalidHmrRestart]: () =>\n 'Config `hmr.restart` must be an array of strings when provided.'\n} satisfies Record<SeedcordErrorCode, (...args: any[]) => string>;\n\n/**\n * Argument types for Seedcord error messages.\n *\n * @internal\n */\nexport type SeedcordErrorArguments<Code extends SeedcordErrorCode> = Parameters<(typeof messages)[Code]>;\n\n/**\n * Formats a Seedcord error message based on the provided code and arguments.\n *\n * @internal\n */\nexport function formatSeedcordErrorMessage<Code extends SeedcordErrorCode>(\n code: Code,\n args?: SeedcordErrorArguments<Code>\n): string {\n const formatter = messages[code];\n const resolvedArgs = (args ?? []) as unknown[];\n return (formatter as (...params: unknown[]) => string)(...resolvedArgs);\n}\n","/* eslint-disable @typescript-eslint/no-unnecessary-condition */\nimport chalk from 'chalk';\n\nimport { SeedcordErrorCode } from './ErrorCodes';\nimport { formatSeedcordErrorMessage, type SeedcordErrorArguments } from './ErrorMessages';\n\n/**\n * String literal type for Seedcord error identifiers.\n *\n * @internal\n */\ntype SeedcordErrorIdentifier = keyof typeof SeedcordErrorCode;\n\n/**\n * Options for Seedcord errors.\n *\n * @internal\n */\ninterface SeedcordErrorOptions extends ErrorOptions {}\n\nfunction resolveIdentifier(code: SeedcordErrorCode): SeedcordErrorIdentifier {\n return SeedcordErrorCode[code] as SeedcordErrorIdentifier;\n}\n\ntype SeedcordErrorPayload<Code extends SeedcordErrorCode> = SeedcordErrorArguments<Code> | undefined;\n\ntype SeedcordErrorCtorRest<Code extends SeedcordErrorCode> =\n SeedcordErrorArguments<Code> extends []\n ? [options?: SeedcordErrorOptions]\n : [args: SeedcordErrorArguments<Code>, options?: SeedcordErrorOptions];\n\nfunction resolveCtorInputs<Code extends SeedcordErrorCode>(\n rest: SeedcordErrorCtorRest<Code>\n): { args: SeedcordErrorPayload<Code>; options?: SeedcordErrorOptions } {\n const [maybeArgsOrOptions, maybeOptions] = rest;\n if (Array.isArray(maybeArgsOrOptions)) {\n const result: { args: SeedcordErrorPayload<Code>; options?: SeedcordErrorOptions } = {\n args: maybeArgsOrOptions\n };\n\n if (maybeOptions !== undefined) {\n result.options = maybeOptions;\n }\n\n return result;\n }\n\n const result: { args: SeedcordErrorPayload<Code>; options?: SeedcordErrorOptions } = {\n args: undefined\n };\n\n if (maybeArgsOrOptions !== undefined) {\n result.options = maybeArgsOrOptions;\n }\n\n return result;\n}\n\nfunction resolveMessage<Code extends SeedcordErrorCode>(code: Code, args: SeedcordErrorPayload<Code>): string {\n return formatSeedcordErrorMessage(code, args);\n}\n\nfunction formatErrorName(name: string, _identifier: SeedcordErrorIdentifier, code: SeedcordErrorCode): string {\n return `${chalk.bold.red(name)}[${chalk.gray(code)}]`;\n}\n\n/**\n * String literal type for Seedcord error class names.\n *\n * @internal\n */\nexport type SeedcordErrorTypeString = `Seedcord${'Error' | 'TypeError' | 'RangeError'}`;\n\n/**\n * Base interface for Seedcord error instances.\n *\n * @internal\n */\nexport interface BaseSeedcordError {\n readonly code: SeedcordErrorCode;\n readonly identifier: SeedcordErrorIdentifier;\n readonly type: SeedcordErrorTypeString;\n}\n\n/**\n * Base class for Seedcord errors.\n *\n * @internal\n */\nexport class SeedcordError<Code extends SeedcordErrorCode = SeedcordErrorCode>\n extends Error\n implements BaseSeedcordError\n{\n public readonly code: Code;\n public readonly identifier: SeedcordErrorIdentifier;\n public readonly type = 'SeedcordError';\n\n constructor(code: Code, ...rest: SeedcordErrorCtorRest<Code>) {\n const { args, options } = resolveCtorInputs(rest);\n const message = resolveMessage(code, args);\n super(message, options);\n this.code = code;\n this.identifier = resolveIdentifier(code);\n this.name = formatErrorName(new.target.name, this.identifier, this.code);\n Object.setPrototypeOf(this, new.target.prototype);\n if (typeof Error.captureStackTrace === 'function') {\n Error.captureStackTrace(this, new.target);\n }\n }\n}\n\n/**\n * TypeError class for Seedcord errors.\n *\n * @internal\n */\nexport class SeedcordTypeError<Code extends SeedcordErrorCode = SeedcordErrorCode>\n extends TypeError\n implements BaseSeedcordError\n{\n public readonly code: Code;\n public readonly identifier: SeedcordErrorIdentifier;\n public readonly type = 'SeedcordTypeError';\n\n constructor(code: Code, ...rest: SeedcordErrorCtorRest<Code>) {\n const { args, options } = resolveCtorInputs(rest);\n const message = resolveMessage(code, args);\n super(message, options);\n this.code = code;\n this.identifier = resolveIdentifier(code);\n this.name = formatErrorName(new.target.name, this.identifier, this.code);\n Object.setPrototypeOf(this, new.target.prototype);\n if (typeof Error.captureStackTrace === 'function') {\n Error.captureStackTrace(this, new.target);\n }\n }\n}\n\n/**\n * RangeError class for Seedcord errors.\n *\n * @internal\n */\nexport class SeedcordRangeError<Code extends SeedcordErrorCode = SeedcordErrorCode>\n extends RangeError\n implements BaseSeedcordError\n{\n public readonly code: Code;\n public readonly identifier: SeedcordErrorIdentifier;\n public readonly type = 'SeedcordRangeError';\n\n constructor(code: Code, ...rest: SeedcordErrorCtorRest<Code>) {\n const { args, options } = resolveCtorInputs(rest);\n const message = resolveMessage(code, args);\n super(message, options);\n this.code = code;\n this.identifier = resolveIdentifier(code);\n this.name = formatErrorName(new.target.name, this.identifier, this.code);\n Object.setPrototypeOf(this, new.target.prototype);\n if (typeof Error.captureStackTrace === 'function') {\n Error.captureStackTrace(this, new.target);\n }\n }\n}\n\n/**\n * Variant type for Seedcord error classes.\n *\n * @internal\n */\ntype SeedcordErrorVariant<\n Type extends SeedcordErrorTypeString,\n Code extends SeedcordErrorCode\n> = Type extends 'SeedcordError'\n ? SeedcordError<Code>\n : Type extends 'SeedcordTypeError'\n ? SeedcordTypeError<Code>\n : SeedcordRangeError<Code>;\n\n/**\n * Union type of all Seedcord error variants for a specific error code.\n *\n * @internal\n */\ntype AnySeedcordErrorForCode<Code extends SeedcordErrorCode> = {\n [Variant in SeedcordErrorTypeString]: SeedcordErrorVariant<Variant, Code>;\n}[SeedcordErrorTypeString];\n\n/**\n * Union type of all Seedcord errors filtered by error class.\n *\n * @internal\n */\ntype ErrorTypeFilter<Type extends SeedcordErrorTypeString | undefined> = Type extends SeedcordErrorTypeString\n ? {\n [Code in SeedcordErrorCode]: SeedcordErrorVariant<Type, Code>;\n }[SeedcordErrorCode]\n : AnySeedcordErrorForCode<SeedcordErrorCode>;\n\n/**\n * Union type of all Seedcord errors filtered by error class and error code.\n *\n * @internal\n */\nexport type ErrorCodeFilter<\n Type extends SeedcordErrorTypeString | undefined,\n Code extends SeedcordErrorCode | undefined\n> = Code extends SeedcordErrorCode\n ? Type extends SeedcordErrorTypeString\n ? SeedcordErrorVariant<Type, Code>\n : AnySeedcordErrorForCode<Code>\n : ErrorTypeFilter<Type>;\n\n/**\n * Determines whether an unknown value is a Seedcord error, with optional narrowing by class and error code.\n *\n * @param error - The value to inspect.\n * @param type - Optional error class discriminator (Error, TypeError, or RangeError).\n * @param code - Optional {@link SeedcordErrorCode} discriminator to narrow by code.\n * @typeParam Type - What kind of {@link SeedcordErrorTypeString} to filter by.\n * @typeParam Code - The specific {@link SeedcordErrorCode} to filter by.\n */\nexport function isSeedcordError<\n Type extends SeedcordErrorTypeString | undefined,\n Code extends SeedcordErrorCode | undefined\n>(error: unknown, type?: Type, code?: Code): error is ErrorCodeFilter<Type, Code> {\n const isSeedcordErrorInstance = error instanceof SeedcordError && error.type === 'SeedcordError';\n const isSeedcordTypeErrorInstance = error instanceof SeedcordTypeError && error.type === 'SeedcordTypeError';\n const isSeedcordRangeErrorInstance = error instanceof SeedcordRangeError && error.type === 'SeedcordRangeError';\n\n if (!isSeedcordErrorInstance && !isSeedcordTypeErrorInstance && !isSeedcordRangeErrorInstance) {\n return false;\n }\n\n const matchesType = type\n ? (type === 'SeedcordError' && isSeedcordErrorInstance) ||\n (type === 'SeedcordTypeError' && isSeedcordTypeErrorInstance) ||\n (type === 'SeedcordRangeError' && isSeedcordRangeErrorInstance)\n : true;\n\n if (!matchesType) return false;\n if (code === undefined) return true;\n return error.code === code;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,IAAY,oBAAL;;CAEH;;CAEA;;CAEA;;CAEA;;CAGA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAGA;;CAEA;;CAEA;;CAEA;;CAEA;;CAGA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAGA;;CAGA;;CAEA;;CAGA;;CAEA;;CAEA;;CAEA;;CAEA;;CAGA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAGA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;AACJ;;;;;;;;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IAAI,SAAS,QAAW,OAAO;CAC/B,OAAO,MAAM,SAAS;AAC1B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"SeedcordError-xd-Ib_-z.mjs","names":[],"sources":["../src/Errors/ErrorCodes.ts","../src/Errors/ErrorMessages.ts","../src/Errors/SeedcordError.ts"],"sourcesContent":["/* eslint-disable no-magic-numbers */\n\n/**\n * All Seedcord error codes.\n */\nexport enum SeedcordErrorCode {\n /** DISCORD_BOT_TOKEN is not present in the environment. */\n ConfigMissingDiscordToken = 1001,\n /** DISCORD_BOT_TOKEN is present but fails validation. */\n ConfigIncorrectDiscordToken = 1004,\n /** UNKNOWN_EXCEPTION_WEBHOOK_URL is missing when configuring the reporter. */\n ConfigUnknownExceptionWebhookMissing = 1002,\n /** UNKNOWN_EXCEPTION_WEBHOOK_URL is present but fails URL validation. */\n ConfigUnknownExceptionWebhookInvalid = 1003,\n\n /** Attempted to add lifecycle tasks after startup already completed. */\n LifecycleAddAfterCompletion = 1101,\n /** Attempted to add lifecycle tasks while startup is still running. */\n LifecycleAddDuringRun = 1102,\n /** Attempted to remove lifecycle tasks while startup is still running. */\n LifecycleRemoveDuringRun = 1103,\n /** Provided lifecycle phase identifier is not recognized. */\n LifecycleUnknownPhase = 1104,\n /** Startup phase completed with one or more task failures. */\n LifecyclePhaseFailures = 1105,\n /** A lifecycle task exceeded its configured timeout. */\n LifecycleTaskTimeout = 1106,\n\n /** Multiple Seedcord instances were created simultaneously. */\n CoreSingletonViolation = 1201,\n /** Plugins cannot be mutated after the core has finished initializing. */\n CorePluginAfterInit = 1202,\n /** A plugin tried to register with a key that already exists. */\n CorePluginKeyExists = 1203,\n /** Bot role lookup failed within the provided guild. */\n CoreBotRoleMissing = 1204,\n /** A bot controller was constructed without its required handlers directory. */\n CoreControllerPathMissing = 1205,\n\n /** Interaction middleware decorated with disallowed event filters. */\n DecoratorInteractionEventFilter = 1301,\n /** A decorator could not find the original method being decorated. */\n DecoratorMethodNotFound = 1302,\n /** A command decorator attempted to re-register an existing command scope. */\n DecoratorCommandAlreadyRegistered = 1303,\n /** A global command decorator specified guild IDs, which is not allowed. */\n DecoratorCommandGlobalWithGuilds = 1304,\n /** A guild command decorator omitted the required guild ID list. */\n DecoratorCommandGuildWithoutGuilds = 1305,\n /** Middleware priority provided by the decorator was not a finite number. */\n DecoratorInvalidMiddlewarePriority = 1306,\n\n /** buildSlashRoute received an invalid argument. */\n UtilInvalidSlashRouteArgument = 1403,\n\n /** StrictEventEmitter.waitFor was aborted via its AbortSignal. */\n EventEmitterWaitForAborted = 1501,\n /** StrictEventEmitter.waitFor exceeded its configured timeout. */\n EventEmitterWaitForTimeout = 1502,\n\n /** Mongo service class is missing the `@RegisterMongoService` decorator. */\n PluginMongoServiceDecoratorMissing = 2101,\n /** Mongo model class is missing the `@RegisterMongoModel` decorator. */\n PluginMongoModelDecoratorMissing = 2102,\n /** Mongo client failed to establish a connection. */\n PluginMongoConnectionFailed = 2103,\n /** Mongo client failed to disconnect cleanly during shutdown. */\n PluginMongoDisconnectFailed = 2104,\n /** Mongo `services` was accessed before the plugin finished initializing. */\n PluginMongoServicesNotReady = 2105,\n\n /** KPG service class is missing the `@RegisterKpgService` decorator. */\n PluginKpgServiceDecoratorMissing = 2201,\n /** KPG service class is missing its table metadata. */\n PluginKpgServiceTableMissing = 2202,\n /** Migration manager received an invalid step count. */\n PluginKpgInvalidStepCount = 2203,\n /** Migration direction was not recognized. */\n PluginKpgUnknownDirection = 2204,\n /** Provided migrations path could not be resolved. */\n PluginKpgUnresolvedMigrationsPath = 2205,\n /** No migration files were found for execution. */\n PluginKpgNoMigrationFiles = 2206,\n /** A migration module failed to export the expected functions. */\n PluginKpgInvalidMigrationModule = 2207,\n /** An arbitrary (non-Error) failure was reported by a migration. */\n PluginKpgNonErrorFailure = 2208,\n /** Postgres pool failed to close cleanly during shutdown. */\n PluginKpgDisconnectFailed = 2209,\n /** KPG `services` was accessed before the plugin finished initializing. */\n PluginKpgServicesNotReady = 2210,\n\n /** Config file default export was not an object. */\n CliConfigInvalidExport = 3101,\n /** Config is missing the required instance string. */\n CliConfigMissingInstance = 3102,\n /** Config root was provided but not a string. */\n CliConfigInvalidRoot = 3103,\n /** Unable to locate a Seedcord config file. */\n CliConfigNotFound = 3104,\n /** CLI entry file does not exist. */\n CliEntryNotFound = 3105,\n /** tsx failed to import the provided entry file. */\n CliTsxImportFailed = 3106,\n /** Native import and jiti fallback both failed. */\n CliImportFailed = 3107,\n /** Seedcord instance export is missing a start() method. */\n CliInstanceInvalid = 3108,\n /** Seedcord instance threw during startup. */\n CliStartFailed = 3109,\n /** Config is missing the required entry string. */\n CliConfigMissingEntry = 3110,\n /** Config build options must be an object when provided. */\n CliConfigInvalidBuild = 3111,\n /** Config build outDir must be a string when provided. */\n CliConfigInvalidBuildOutDir = 3112,\n /** Config build tsconfig must be a string when provided. */\n CliConfigInvalidBuildTsconfig = 3113,\n /** Config build bootstrap must be a string when provided. */\n CliConfigInvalidBuildBootstrap = 3114,\n /** Entry file must be inside the configured root directory. */\n CliConfigEntryOutsideRoot = 3115,\n /** Unable to locate a TypeScript config file for builds. */\n CliBuildTsconfigNotFound = 3116,\n /** TypeScript reported diagnostics during emit. */\n CliBuildFailed = 3117,\n /** Unable to write the generated bootstrap file. */\n CliBootstrapWriteFailed = 3118,\n /** Config tsconfig must be a string when provided. */\n CliConfigInvalidTsconfig = 3119,\n /** Config hmr options must be an object when provided. */\n CliConfigInvalidHmr = 3120,\n /** Config hmr restart patterns must be an array of strings when provided. */\n CliConfigInvalidHmrRestart = 3121\n}\n","import { SeedcordErrorCode } from './ErrorCodes';\n\n/**\n * Mapping of Seedcord error codes to their corresponding message formatters.\n *\n * @internal\n */\nconst messages = {\n [SeedcordErrorCode.ConfigMissingDiscordToken]: () => 'Missing DISCORD_BOT_TOKEN environment variable.',\n [SeedcordErrorCode.ConfigIncorrectDiscordToken]: () => 'Invalid DISCORD_BOT_TOKEN value.',\n [SeedcordErrorCode.ConfigUnknownExceptionWebhookMissing]: () =>\n 'Missing UNKNOWN_EXCEPTION_WEBHOOK_URL environment variable.',\n [SeedcordErrorCode.ConfigUnknownExceptionWebhookInvalid]: () => 'Invalid UNKNOWN_EXCEPTION_WEBHOOK_URL value.',\n\n [SeedcordErrorCode.LifecycleAddAfterCompletion]: () =>\n 'Cannot add tasks after startup sequence has already completed.',\n [SeedcordErrorCode.LifecycleAddDuringRun]: () => 'Cannot add tasks while startup sequence is in progress.',\n [SeedcordErrorCode.LifecycleRemoveDuringRun]: () => 'Cannot remove tasks while startup sequence is in progress.',\n [SeedcordErrorCode.LifecycleUnknownPhase]: (phase: unknown) => `Unknown phase: ${String(phase)}.`,\n [SeedcordErrorCode.LifecyclePhaseFailures]: (phase: string, failures: number) =>\n `Phase ${phase} completed with ${failures} failed task${failures === 1 ? '' : 's'}.`,\n [SeedcordErrorCode.LifecycleTaskTimeout]: (taskName: string, timeout: number) =>\n `Task \"${taskName}\" timed out after ${timeout}ms.`,\n\n [SeedcordErrorCode.CoreSingletonViolation]: () =>\n 'Seedcord can only be instantiated once. Use the existing instance instead.',\n [SeedcordErrorCode.CorePluginAfterInit]: () => 'Cannot attach a plugin after initialization.',\n [SeedcordErrorCode.CorePluginKeyExists]: (key: string) => `Plugin with key \"${key}\" already exists.`,\n [SeedcordErrorCode.CoreBotRoleMissing]: (guildId?: string) =>\n guildId ? `Bot role not found in guild ${guildId}.` : 'Bot role not found in guild.',\n [SeedcordErrorCode.CoreControllerPathMissing]: (controllerName: string, pathKind: string) =>\n `${controllerName} was instantiated without a ${pathKind} path.`,\n\n [SeedcordErrorCode.DecoratorInteractionEventFilter]: () => 'Interaction middleware cannot specify event filters.',\n [SeedcordErrorCode.DecoratorMethodNotFound]: () =>\n 'Decorator could not locate the original method. Ensure the method exists before applying the decorator.',\n [SeedcordErrorCode.DecoratorCommandAlreadyRegistered]: (\n commandName: string,\n existingScope: string,\n requestedScope: string\n ) =>\n `Command \"${commandName}\" is already registered as a \"${existingScope}\" command and cannot be re-registered as a \"${requestedScope}\" command.`,\n [SeedcordErrorCode.DecoratorCommandGlobalWithGuilds]: () =>\n 'RegisterCommand(\"global\") cannot have guilds specified.',\n [SeedcordErrorCode.DecoratorCommandGuildWithoutGuilds]: () =>\n 'RegisterCommand(\"guild\") requires a non-empty guilds array.',\n [SeedcordErrorCode.DecoratorInvalidMiddlewarePriority]: () => 'Middleware priority must be a finite number.',\n\n [SeedcordErrorCode.UtilInvalidSlashRouteArgument]: () => 'Invalid argument passed to buildSlashRoute.',\n\n [SeedcordErrorCode.EventEmitterWaitForAborted]: () => 'waitFor was aborted via its AbortSignal.',\n [SeedcordErrorCode.EventEmitterWaitForTimeout]: (timeout: number) => `waitFor timed out after ${timeout}ms.`,\n\n [SeedcordErrorCode.PluginMongoServiceDecoratorMissing]: (className: string) =>\n `Missing @RegisterMongoService on ${className}.`,\n [SeedcordErrorCode.PluginMongoModelDecoratorMissing]: (className: string) =>\n `Missing @RegisterMongoModel on ${className}.`,\n [SeedcordErrorCode.PluginMongoConnectionFailed]: (databaseName?: string) =>\n databaseName ? `Could not connect to MongoDB (${databaseName}).` : 'Could not connect to MongoDB.',\n [SeedcordErrorCode.PluginMongoDisconnectFailed]: () => 'Failed to disconnect from MongoDB cleanly during shutdown.',\n [SeedcordErrorCode.PluginMongoServicesNotReady]: () =>\n 'Mongo services accessed before the plugin finished initializing.',\n\n [SeedcordErrorCode.PluginKpgServiceDecoratorMissing]: (className: string) =>\n `Missing @RegisterKpgService on ${className}.`,\n [SeedcordErrorCode.PluginKpgServiceTableMissing]: (className: string) =>\n `Missing table metadata for ${className}. Provide a table via @RegisterKpgService().`,\n [SeedcordErrorCode.PluginKpgInvalidStepCount]: () => 'Migration step count must be a non-negative integer.',\n [SeedcordErrorCode.PluginKpgUnknownDirection]: (direction: unknown) =>\n `Unknown migration direction: ${String(direction)}.`,\n [SeedcordErrorCode.PluginKpgUnresolvedMigrationsPath]: (label: string) =>\n `Unable to resolve migrations at path: ${label}.`,\n [SeedcordErrorCode.PluginKpgNoMigrationFiles]: () => 'No migration files provided.',\n [SeedcordErrorCode.PluginKpgInvalidMigrationModule]: (filePath: string) =>\n `Migration file ${filePath} must export async functions up and down.`,\n [SeedcordErrorCode.PluginKpgNonErrorFailure]: (message: string) => `Migration failure: ${message}.`,\n [SeedcordErrorCode.PluginKpgDisconnectFailed]: () => 'Failed to close the Postgres pool cleanly during shutdown.',\n [SeedcordErrorCode.PluginKpgServicesNotReady]: () =>\n 'KPG services accessed before the plugin finished initializing.',\n\n [SeedcordErrorCode.CliConfigInvalidExport]: () => 'Config file must default export an object.',\n [SeedcordErrorCode.CliConfigMissingInstance]: () =>\n 'Config must include an `instance` string that points to your Seedcord default export.',\n [SeedcordErrorCode.CliConfigInvalidRoot]: () => 'Config `root` must be a string when provided.',\n [SeedcordErrorCode.CliConfigNotFound]: (baseDir: string, candidates: readonly string[]) =>\n `Unable to locate a Seedcord config in ${baseDir}. Searched for ${candidates.join(', ')}.`,\n [SeedcordErrorCode.CliConfigMissingEntry]: () =>\n 'Config must include an `entry` string that points to your startup script.',\n [SeedcordErrorCode.CliConfigInvalidBuild]: () => 'Config `build` must be an object when provided.',\n [SeedcordErrorCode.CliConfigInvalidBuildOutDir]: () => 'Config `build.outDir` must be a string when provided.',\n [SeedcordErrorCode.CliConfigInvalidBuildTsconfig]: () => 'Config `build.tsconfig` must be a string when provided.',\n [SeedcordErrorCode.CliConfigInvalidBuildBootstrap]: () =>\n 'Config `build.bootstrap` must be a string when provided.',\n [SeedcordErrorCode.CliConfigEntryOutsideRoot]: (entryPath: string, root: string) =>\n `Entry file ${entryPath} must reside inside configured root ${root}.`,\n [SeedcordErrorCode.CliEntryNotFound]: (entryPath: string) => `Cannot find entry file at ${entryPath}.`,\n [SeedcordErrorCode.CliTsxImportFailed]: (entryPath: string, reason: string) =>\n `Failed to import ${entryPath} via tsx: ${reason}.`,\n [SeedcordErrorCode.CliImportFailed]: (entryPath: string, nativeReason: string, fallbackReason: string) =>\n `Failed to import ${entryPath}: ${nativeReason}. Fallback via jiti also failed: ${fallbackReason}.`,\n [SeedcordErrorCode.CliInstanceInvalid]: () =>\n 'Seedcord instance must default export an object with a start() method.',\n [SeedcordErrorCode.CliStartFailed]: (instancePath: string, reason: string) =>\n `Failed to start Seedcord from ${instancePath}: ${reason}.`,\n [SeedcordErrorCode.CliBuildTsconfigNotFound]: (hint: string) =>\n `Unable to resolve a tsconfig for builds (${hint}). Provide build.tsconfig or add tsconfig.build.json / tsconfig.json.`,\n [SeedcordErrorCode.CliBuildFailed]: (diagnostics: string) => `TypeScript build failed:\\n${diagnostics}`,\n [SeedcordErrorCode.CliBootstrapWriteFailed]: (targetPath: string, reason: string) =>\n `Failed to write bootstrap file at ${targetPath}: ${reason}.`,\n [SeedcordErrorCode.CliConfigInvalidTsconfig]: () => 'Config `tsconfig` must be a string when provided.',\n [SeedcordErrorCode.CliConfigInvalidHmr]: () => 'Config `hmr` must be an object when provided.',\n [SeedcordErrorCode.CliConfigInvalidHmrRestart]: () =>\n 'Config `hmr.restart` must be an array of strings when provided.'\n} satisfies Record<SeedcordErrorCode, (...args: any[]) => string>;\n\n/**\n * Argument types for Seedcord error messages.\n *\n * @internal\n */\nexport type SeedcordErrorArguments<Code extends SeedcordErrorCode> = Parameters<(typeof messages)[Code]>;\n\n/**\n * Formats a Seedcord error message based on the provided code and arguments.\n *\n * @internal\n */\nexport function formatSeedcordErrorMessage<Code extends SeedcordErrorCode>(\n code: Code,\n args?: SeedcordErrorArguments<Code>\n): string {\n const formatter = messages[code];\n const resolvedArgs = (args ?? []) as unknown[];\n return (formatter as (...params: unknown[]) => string)(...resolvedArgs);\n}\n","/* eslint-disable @typescript-eslint/no-unnecessary-condition */\nimport chalk from 'chalk';\n\nimport { SeedcordErrorCode } from './ErrorCodes';\nimport { formatSeedcordErrorMessage, type SeedcordErrorArguments } from './ErrorMessages';\n\n/**\n * String literal type for Seedcord error identifiers.\n *\n * @internal\n */\ntype SeedcordErrorIdentifier = keyof typeof SeedcordErrorCode;\n\n/**\n * Options for Seedcord errors.\n *\n * @internal\n */\ninterface SeedcordErrorOptions extends ErrorOptions {}\n\nfunction resolveIdentifier(code: SeedcordErrorCode): SeedcordErrorIdentifier {\n return SeedcordErrorCode[code] as SeedcordErrorIdentifier;\n}\n\ntype SeedcordErrorPayload<Code extends SeedcordErrorCode> = SeedcordErrorArguments<Code> | undefined;\n\ntype SeedcordErrorCtorRest<Code extends SeedcordErrorCode> =\n SeedcordErrorArguments<Code> extends []\n ? [options?: SeedcordErrorOptions]\n : [args: SeedcordErrorArguments<Code>, options?: SeedcordErrorOptions];\n\nfunction resolveCtorInputs<Code extends SeedcordErrorCode>(\n rest: SeedcordErrorCtorRest<Code>\n): { args: SeedcordErrorPayload<Code>; options?: SeedcordErrorOptions } {\n const [maybeArgsOrOptions, maybeOptions] = rest;\n if (Array.isArray(maybeArgsOrOptions)) {\n const result: { args: SeedcordErrorPayload<Code>; options?: SeedcordErrorOptions } = {\n args: maybeArgsOrOptions\n };\n\n if (maybeOptions !== undefined) {\n result.options = maybeOptions;\n }\n\n return result;\n }\n\n const result: { args: SeedcordErrorPayload<Code>; options?: SeedcordErrorOptions } = {\n args: undefined\n };\n\n if (maybeArgsOrOptions !== undefined) {\n result.options = maybeArgsOrOptions;\n }\n\n return result;\n}\n\nfunction resolveMessage<Code extends SeedcordErrorCode>(code: Code, args: SeedcordErrorPayload<Code>): string {\n return formatSeedcordErrorMessage(code, args);\n}\n\nfunction formatErrorName(name: string, _identifier: SeedcordErrorIdentifier, code: SeedcordErrorCode): string {\n return `${chalk.bold.red(name)}[${chalk.gray(code)}]`;\n}\n\n/**\n * String literal type for Seedcord error class names.\n *\n * @internal\n */\nexport type SeedcordErrorTypeString = `Seedcord${'Error' | 'TypeError' | 'RangeError'}`;\n\n/**\n * Base interface for Seedcord error instances.\n *\n * @internal\n */\nexport interface BaseSeedcordError {\n readonly code: SeedcordErrorCode;\n readonly identifier: SeedcordErrorIdentifier;\n readonly type: SeedcordErrorTypeString;\n}\n\n/**\n * Base class for Seedcord errors.\n *\n * @internal\n */\nexport class SeedcordError<Code extends SeedcordErrorCode = SeedcordErrorCode>\n extends Error\n implements BaseSeedcordError\n{\n public readonly code: Code;\n public readonly identifier: SeedcordErrorIdentifier;\n public readonly type = 'SeedcordError';\n\n constructor(code: Code, ...rest: SeedcordErrorCtorRest<Code>) {\n const { args, options } = resolveCtorInputs(rest);\n const message = resolveMessage(code, args);\n super(message, options);\n this.code = code;\n this.identifier = resolveIdentifier(code);\n this.name = formatErrorName(new.target.name, this.identifier, this.code);\n Object.setPrototypeOf(this, new.target.prototype);\n if (typeof Error.captureStackTrace === 'function') {\n Error.captureStackTrace(this, new.target);\n }\n }\n}\n\n/**\n * TypeError class for Seedcord errors.\n *\n * @internal\n */\nexport class SeedcordTypeError<Code extends SeedcordErrorCode = SeedcordErrorCode>\n extends TypeError\n implements BaseSeedcordError\n{\n public readonly code: Code;\n public readonly identifier: SeedcordErrorIdentifier;\n public readonly type = 'SeedcordTypeError';\n\n constructor(code: Code, ...rest: SeedcordErrorCtorRest<Code>) {\n const { args, options } = resolveCtorInputs(rest);\n const message = resolveMessage(code, args);\n super(message, options);\n this.code = code;\n this.identifier = resolveIdentifier(code);\n this.name = formatErrorName(new.target.name, this.identifier, this.code);\n Object.setPrototypeOf(this, new.target.prototype);\n if (typeof Error.captureStackTrace === 'function') {\n Error.captureStackTrace(this, new.target);\n }\n }\n}\n\n/**\n * RangeError class for Seedcord errors.\n *\n * @internal\n */\nexport class SeedcordRangeError<Code extends SeedcordErrorCode = SeedcordErrorCode>\n extends RangeError\n implements BaseSeedcordError\n{\n public readonly code: Code;\n public readonly identifier: SeedcordErrorIdentifier;\n public readonly type = 'SeedcordRangeError';\n\n constructor(code: Code, ...rest: SeedcordErrorCtorRest<Code>) {\n const { args, options } = resolveCtorInputs(rest);\n const message = resolveMessage(code, args);\n super(message, options);\n this.code = code;\n this.identifier = resolveIdentifier(code);\n this.name = formatErrorName(new.target.name, this.identifier, this.code);\n Object.setPrototypeOf(this, new.target.prototype);\n if (typeof Error.captureStackTrace === 'function') {\n Error.captureStackTrace(this, new.target);\n }\n }\n}\n\n/**\n * Variant type for Seedcord error classes.\n *\n * @internal\n */\ntype SeedcordErrorVariant<\n Type extends SeedcordErrorTypeString,\n Code extends SeedcordErrorCode\n> = Type extends 'SeedcordError'\n ? SeedcordError<Code>\n : Type extends 'SeedcordTypeError'\n ? SeedcordTypeError<Code>\n : SeedcordRangeError<Code>;\n\n/**\n * Union type of all Seedcord error variants for a specific error code.\n *\n * @internal\n */\ntype AnySeedcordErrorForCode<Code extends SeedcordErrorCode> = {\n [Variant in SeedcordErrorTypeString]: SeedcordErrorVariant<Variant, Code>;\n}[SeedcordErrorTypeString];\n\n/**\n * Union type of all Seedcord errors filtered by error class.\n *\n * @internal\n */\ntype ErrorTypeFilter<Type extends SeedcordErrorTypeString | undefined> = Type extends SeedcordErrorTypeString\n ? {\n [Code in SeedcordErrorCode]: SeedcordErrorVariant<Type, Code>;\n }[SeedcordErrorCode]\n : AnySeedcordErrorForCode<SeedcordErrorCode>;\n\n/**\n * Union type of all Seedcord errors filtered by error class and error code.\n *\n * @internal\n */\nexport type ErrorCodeFilter<\n Type extends SeedcordErrorTypeString | undefined,\n Code extends SeedcordErrorCode | undefined\n> = Code extends SeedcordErrorCode\n ? Type extends SeedcordErrorTypeString\n ? SeedcordErrorVariant<Type, Code>\n : AnySeedcordErrorForCode<Code>\n : ErrorTypeFilter<Type>;\n\n/**\n * Determines whether an unknown value is a Seedcord error, with optional narrowing by class and error code.\n *\n * @param error - The value to inspect.\n * @param type - Optional error class discriminator (Error, TypeError, or RangeError).\n * @param code - Optional {@link SeedcordErrorCode} discriminator to narrow by code.\n * @typeParam Type - What kind of {@link SeedcordErrorTypeString} to filter by.\n * @typeParam Code - The specific {@link SeedcordErrorCode} to filter by.\n */\nexport function isSeedcordError<\n Type extends SeedcordErrorTypeString | undefined,\n Code extends SeedcordErrorCode | undefined\n>(error: unknown, type?: Type, code?: Code): error is ErrorCodeFilter<Type, Code> {\n const isSeedcordErrorInstance = error instanceof SeedcordError && error.type === 'SeedcordError';\n const isSeedcordTypeErrorInstance = error instanceof SeedcordTypeError && error.type === 'SeedcordTypeError';\n const isSeedcordRangeErrorInstance = error instanceof SeedcordRangeError && error.type === 'SeedcordRangeError';\n\n if (!isSeedcordErrorInstance && !isSeedcordTypeErrorInstance && !isSeedcordRangeErrorInstance) {\n return false;\n }\n\n const matchesType = type\n ? (type === 'SeedcordError' && isSeedcordErrorInstance) ||\n (type === 'SeedcordTypeError' && isSeedcordTypeErrorInstance) ||\n (type === 'SeedcordRangeError' && isSeedcordRangeErrorInstance)\n : true;\n\n if (!matchesType) return false;\n if (code === undefined) return true;\n return error.code === code;\n}\n"],"mappings":";;;;;;AAKA,IAAY,oBAAL;;CAEH;;CAEA;;CAEA;;CAEA;;CAGA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAGA;;CAEA;;CAEA;;CAEA;;CAEA;;CAGA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAGA;;CAGA;;CAEA;;CAGA;;CAEA;;CAEA;;CAEA;;CAEA;;CAGA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAGA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;AACJ;;;;;;;;;AC/HA,MAAM,WAAW;eACwC;eACE;eAEnD;eAC4D;eAG5D;eAC6C;eACG;UACR,UAAmB,kBAAkB,OAAO,KAAK,EAAE;UAClD,OAAe,aACxD,SAAS,MAAM,kBAAkB,SAAS,cAAc,aAAa,IAAI,KAAK,IAAI;UAC3C,UAAkB,YACzD,SAAS,SAAS,oBAAoB,QAAQ;eAG9C;eAC2C;UACL,QAAgB,oBAAoB,IAAI;UACzC,YACr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