@seedcord/errors 0.5.1 → 0.7.0

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.
@@ -35,6 +35,8 @@ declare enum SeedcordErrorCode {
35
35
  LifecycleTaskTimeout = 1106,
36
36
  /** A host whose startup failed was started again. */
37
37
  LifecycleRestartAfterFailure = 1107,
38
+ /** The configured shutdown deadline is zero, negative, or not finite. */
39
+ LifecycleInvalidShutdownDeadline = 1108,
38
40
  /** Multiple Seedcord instances were created simultaneously. */
39
41
  CoreSingletonViolation = 1201,
40
42
  /** Plugins cannot be mutated after the core has finished initializing. */
@@ -95,17 +97,17 @@ declare enum SeedcordErrorCode {
95
97
  CustomIdInvalidPrefix = 1601,
96
98
  /** A customId field name is integer-like, which JS would silently reorder. */
97
99
  CustomIdReservedFieldName = 1602,
98
- /** A oneOf() field was declared with no choices. */
100
+ /** A oneOf() or someOf() field was declared with no choices. */
99
101
  CustomIdEmptyChoices = 1603,
100
102
  /** An int() field was declared with min greater than max. */
101
103
  CustomIdInvalidBounds = 1604,
102
- /** A value passed to encode() is outside its field's allowed range. */
103
- CustomIdValueOutOfRange = 1605,
104
+ /** A field rejected the value given to encode(). */
105
+ CustomIdValueRejected = 1605,
104
106
  /** An encoded customId exceeds Discord's 100-character limit. */
105
107
  CustomIdWireTooLong = 1606,
106
108
  /** A field name is declared more than once in the same customId chain. */
107
109
  CustomIdDuplicateFieldName = 1607,
108
- /** A component handler is missing its route decorator (\@ButtonRoute / \@ModalRoute / \@SelectMenuRoute). */
110
+ /** A component handler is missing the route decorator that matches its base. */
109
111
  CustomIdHandlerRouteMissing = 1608,
110
112
  /** match() received a decoded route with no matching arm. */
111
113
  CustomIdMatchArmMissing = 1609,
@@ -297,6 +299,7 @@ declare const messages: {
297
299
  1105: (phase: string, failures: number) => string;
298
300
  1106: (taskName: string, timeout: number) => string;
299
301
  1107: () => string;
302
+ 1108: (declared: number) => string;
300
303
  1201: () => string;
301
304
  1202: () => string;
302
305
  1203: (key: string) => string;
@@ -327,9 +330,9 @@ declare const messages: {
327
330
  1505: (method: string, routeId: string) => string;
328
331
  1601: (prefix: string) => string;
329
332
  1602: (field: string) => string;
330
- 1603: (field: string) => string;
333
+ 1603: (field: string, method: string) => string;
331
334
  1604: (field: string, min: number, max: number) => string;
332
- 1605: (field: string, value: string) => string;
335
+ 1605: (field: string, expected: string, value: string) => string;
333
336
  1606: (length: number) => string;
334
337
  1607: (field: string) => string;
335
338
  1608: (className: string) => string;
@@ -496,4 +499,4 @@ type ErrorCodeFilter<Type extends SeedcordErrorTypeString | undefined, Code exte
496
499
  declare function isSeedcordError<Type extends SeedcordErrorTypeString | undefined, Code extends SeedcordErrorCode | undefined>(error: unknown, type?: Type, code?: Code): error is ErrorCodeFilter<Type, Code>;
497
500
  //#endregion
498
501
  export { SeedcordTypeError as a, paint as c, SeedcordRangeError as i, SeedcordErrorCode as l, SeedcordError as n, isSeedcordError as o, SeedcordErrorTypeString as r, BRAND as s, SeedcordAggregateError as t };
499
- //# sourceMappingURL=SeedcordError-BAPFVzz-.d.mts.map
502
+ //# sourceMappingURL=SeedcordError-ej3a21SJ.d.mts.map
@@ -37,6 +37,8 @@ let SeedcordErrorCode = /* @__PURE__ */ function(SeedcordErrorCode) {
37
37
  SeedcordErrorCode[SeedcordErrorCode["LifecycleTaskTimeout"] = 1106] = "LifecycleTaskTimeout";
38
38
  /** A host whose startup failed was started again. */
39
39
  SeedcordErrorCode[SeedcordErrorCode["LifecycleRestartAfterFailure"] = 1107] = "LifecycleRestartAfterFailure";
40
+ /** The configured shutdown deadline is zero, negative, or not finite. */
41
+ SeedcordErrorCode[SeedcordErrorCode["LifecycleInvalidShutdownDeadline"] = 1108] = "LifecycleInvalidShutdownDeadline";
40
42
  /** Multiple Seedcord instances were created simultaneously. */
41
43
  SeedcordErrorCode[SeedcordErrorCode["CoreSingletonViolation"] = 1201] = "CoreSingletonViolation";
42
44
  /** Plugins cannot be mutated after the core has finished initializing. */
@@ -97,17 +99,17 @@ let SeedcordErrorCode = /* @__PURE__ */ function(SeedcordErrorCode) {
97
99
  SeedcordErrorCode[SeedcordErrorCode["CustomIdInvalidPrefix"] = 1601] = "CustomIdInvalidPrefix";
98
100
  /** A customId field name is integer-like, which JS would silently reorder. */
99
101
  SeedcordErrorCode[SeedcordErrorCode["CustomIdReservedFieldName"] = 1602] = "CustomIdReservedFieldName";
100
- /** A oneOf() field was declared with no choices. */
102
+ /** A oneOf() or someOf() field was declared with no choices. */
101
103
  SeedcordErrorCode[SeedcordErrorCode["CustomIdEmptyChoices"] = 1603] = "CustomIdEmptyChoices";
102
104
  /** An int() field was declared with min greater than max. */
103
105
  SeedcordErrorCode[SeedcordErrorCode["CustomIdInvalidBounds"] = 1604] = "CustomIdInvalidBounds";
104
- /** A value passed to encode() is outside its field's allowed range. */
105
- SeedcordErrorCode[SeedcordErrorCode["CustomIdValueOutOfRange"] = 1605] = "CustomIdValueOutOfRange";
106
+ /** A field rejected the value given to encode(). */
107
+ SeedcordErrorCode[SeedcordErrorCode["CustomIdValueRejected"] = 1605] = "CustomIdValueRejected";
106
108
  /** An encoded customId exceeds Discord's 100-character limit. */
107
109
  SeedcordErrorCode[SeedcordErrorCode["CustomIdWireTooLong"] = 1606] = "CustomIdWireTooLong";
108
110
  /** A field name is declared more than once in the same customId chain. */
109
111
  SeedcordErrorCode[SeedcordErrorCode["CustomIdDuplicateFieldName"] = 1607] = "CustomIdDuplicateFieldName";
110
- /** A component handler is missing its route decorator (\@ButtonRoute / \@ModalRoute / \@SelectMenuRoute). */
112
+ /** A component handler is missing the route decorator that matches its base. */
111
113
  SeedcordErrorCode[SeedcordErrorCode["CustomIdHandlerRouteMissing"] = 1608] = "CustomIdHandlerRouteMissing";
112
114
  /** match() received a decoded route with no matching arm. */
113
115
  SeedcordErrorCode[SeedcordErrorCode["CustomIdMatchArmMissing"] = 1609] = "CustomIdMatchArmMissing";
@@ -302,6 +304,7 @@ const messages = {
302
304
  [1105]: (phase, failures) => `Phase ${phase} completed with ${failures} failed task${failures === 1 ? "" : "s"}.`,
303
305
  [1106]: (taskName, timeout) => `Task "${taskName}" timed out after ${timeout}ms.`,
304
306
  [1107]: () => "Startup failed and this host cannot start again. Construct a new instance.",
307
+ [1108]: (declared) => `lifecycle.shutdownDeadline is ${declared}. Pass a positive number of milliseconds, or omit it for the default.`,
305
308
  [1201]: () => "Seedcord can only be instantiated once. Use the existing instance instead.",
306
309
  [1202]: () => "Cannot attach a plugin after initialization.",
307
310
  [1203]: (key) => `Plugin with key "${key}" already exists.`,
@@ -332,12 +335,12 @@ const messages = {
332
335
  [1505]: (method, routeId) => `The interaction callback for ${paint.sky(`${method}()`)} returned no message. (route ${paint.mute(routeId)})`,
333
336
  [1601]: (prefix) => `customId prefix ${JSON.stringify(prefix)} must be a non-empty string without a colon or control character.`,
334
337
  [1602]: (field) => `customId field name ${JSON.stringify(field)} is integer-like, which JS reorders. Use a non-numeric name.`,
335
- [1603]: (field) => `customId field ${JSON.stringify(field)} uses oneOf() with no choices.`,
338
+ [1603]: (field, method) => `customId field ${JSON.stringify(field)} uses ${method}() with no choices. Make the field nullable or provide at least one choice.`,
336
339
  [1604]: (field, min, max) => `customId field ${JSON.stringify(field)} has min ${min} greater than max ${max}.`,
337
- [1605]: (field, value) => `customId field ${JSON.stringify(field)} got value ${value} outside its allowed range.`,
340
+ [1605]: (field, expected, value) => `customId field ${JSON.stringify(field)} expects ${expected}, got ${value}.`,
338
341
  [1606]: (length) => `Encoded customId is ${length} characters, Discord allows at most 100.`,
339
342
  [1607]: (field) => `customId field ${JSON.stringify(field)} is already defined in this chain.`,
340
- [1608]: (className) => `${className} is missing its route decorator (@ButtonRoute, @ModalRoute, or @SelectMenuRoute).`,
343
+ [1608]: (className) => `${className} is missing its route decorator. Add the one that matches its base, for example @ButtonRoute or @UserMenuRoute.`,
341
344
  [1609]: (prefix) => `match() has no arm for the decoded route ${JSON.stringify(prefix)}.`,
342
345
  [1620]: (prefix) => `customId ${JSON.stringify(prefix)} was minted under an older shape of this definition. Adding, removing, changing, or moving a field changes the layout hash.`,
343
346
  [1621]: (detail) => `customId could not be decoded. ${detail}.`,
@@ -441,8 +444,8 @@ function resolveMessage(code, args) {
441
444
  function formatErrorName(name, _identifier, code) {
442
445
  return `${paint.coral.bold(name)}[${paint.mute(code)}]`;
443
446
  }
444
- const kIdentifier = Symbol.for("seedcord.errors.identifier");
445
- const CODED = Symbol.for("seedcord.errors.coded");
447
+ const kIdentifier = Symbol.for("seedcord:errors:identifier");
448
+ const CODED = Symbol.for("seedcord:errors:coded");
446
449
  function brand(prototype) {
447
450
  Object.defineProperty(prototype, CODED, { value: true });
448
451
  }
@@ -531,4 +534,4 @@ function isSeedcordError(error, type, code) {
531
534
 
532
535
  //#endregion
533
536
  export { isSeedcordError as a, SeedcordErrorCode as c, SeedcordTypeError as i, SeedcordError as n, BRAND as o, SeedcordRangeError as r, paint as s, SeedcordAggregateError as t };
534
- //# sourceMappingURL=SeedcordError-BusWc3a-.mjs.map
537
+ //# sourceMappingURL=SeedcordError-kjcK2zQB.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SeedcordError-kjcK2zQB.mjs","names":[],"sources":["../src/ErrorCodes.ts","../src/palette.ts","../src/ErrorMessages.ts","../src/SeedcordError.ts"],"sourcesContent":["/* eslint-disable no-magic-numbers */\n\n/**\n * All Seedcord error codes.\n */\nexport enum SeedcordErrorCode {\n /** One or more configured emojis could not be resolved at startup. */\n ConfigEmojiUnresolved = 1001,\n /** A webhook reporter's env var is set but fails webhook URL validation. */\n ConfigWebhookUrlInvalid = 1002,\n /** A configured webhook does not exist on Discord (deleted, or a wrong id or token). */\n ConfigWebhookNotFound = 1003,\n /** The generated route manifest was imported before `seedcord build` generated it. */\n ConfigManifestNotGenerated = 1004,\n /** A required environment variable is not present. */\n ConfigMissingEnv = 1005,\n /** An environment variable is present and fails validation. */\n ConfigInvalidEnv = 1006,\n /** A command usable in a guild is registered without the `Guilds` intent that caches guilds. */\n MissingGuildsIntent = 1007,\n /** The running Node version is below the range seedcord declares in `engines`. */\n UnsupportedNodeVersion = 1008,\n /** `DISCORD_BOT_TOKEN` passed its shape check and carries no readable application id. */\n ConfigTokenUnreadable = 1009,\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 /** A host whose startup failed was started again. */\n LifecycleRestartAfterFailure = 1107,\n /** The configured shutdown deadline is zero, negative, or not finite. */\n LifecycleInvalidShutdownDeadline = 1108,\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 /** A file in a scanned directory threw while being imported. */\n CoreDirectoryImportFailed = 1206,\n /** A scanned directory could not be read. */\n CoreDirectoryUnreadable = 1207,\n /** A plugin was attached under a key the framework logs on. */\n CorePluginReservedChannel = 1208,\n /** The application id was read before startup resolved it. */\n CoreApplicationUnavailable = 1209,\n /** A generated accessor was read before startup resolved its values. */\n CoreAccessorUnresolved = 1210,\n /** A startup or shutdown task was added to a core built by `createSeedcord`. */\n CoreLifecycleUnavailable = 1211,\n /** `emit` was called on the bus. It reaches listeners and skips every subscriber. */\n CoreBusEmitUnavailable = 1212,\n\n /** Interaction middleware decorated with disallowed event filters. */\n DecoratorInteractionEventFilter = 1301,\n /** A command decorator attempted to re-register an existing command scope. */\n DecoratorCommandAlreadyRegistered = 1302,\n /** A global command decorator specified guild IDs, which is not allowed. */\n DecoratorCommandGlobalWithGuilds = 1303,\n /** A guild command decorator omitted the required guild ID list. */\n DecoratorCommandGuildWithoutGuilds = 1304,\n /** Middleware priority provided by the decorator was not a finite number. */\n DecoratorInvalidMiddlewarePriority = 1305,\n /** A WebhookLog subclass is missing its `@WebhookUrl` decorator. */\n DecoratorWebhookUrlMissing = 1306,\n\n /** Two interaction handlers registered the same route within a scope. */\n InteractionDuplicateRoute = 1401,\n /** Two different interaction middleware classes share a class name. */\n InteractionDuplicateMiddleware = 1402,\n /** A route manifest row gives an export name its module does not have. */\n InteractionRouteExportMissing = 1403,\n /** A subscriber manifest row specifies an export that does not extend `Subscriber`. */\n SubscriberRouteNotASubscriber = 1404,\n /** A manifest row's module threw while importing. */\n RouteModuleLoadFailed = 1405,\n\n /** A reply method was called in an ack state where it is illegal. */\n ReplyIllegalAckState = 1501,\n /** A reply component failed to serialize to raw API data. */\n ReplyComponentSerialization = 1502,\n /** edit() was passed a message the interaction did not send. */\n ReplyForeignEditTarget = 1503,\n /** update() or deferUpdate() was called on a modal with no source message. */\n ReplyUpdateWithoutSource = 1504,\n /** A withResponse interaction callback returned no created message. */\n ReplyCallbackMissingMessage = 1505,\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() or someOf() 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 field rejected the value given to encode(). */\n CustomIdValueRejected = 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 the route decorator that matches its base. */\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 /** An autocomplete payload carried no focused option. */\n AutocompleteNoFocusedOption = 1614,\n /** A context menu handler's match() has no arm for the command name that fired. */\n ContextMenuMatchArmMissing = 1615,\n /** No field in the submitted modal carries the requested custom id. */\n ModalFieldNotFound = 1616,\n /** A modal field getter was called on a field of another kind. */\n ModalFieldWrongKind = 1617,\n /** Nothing was picked in a modal field read as required. */\n ModalFieldEmpty = 1618,\n /** A channel select field picked a channel outside the types getSelectedChannels() allows. */\n ModalFieldChannelType = 1619,\n /** A customId was minted under an older shape of the same definition. */\n CustomIdWireStale = 1620,\n /** A customId wire is corrupt, truncated, or was minted by a different definition. */\n CustomIdWireInvalid = 1621,\n\n /** A Cooldown gate was given a duration string that is not a well-formed positive duration. */\n GateInvalidCooldownDuration = 1701,\n\n /** A paginator source was given a perPage that is not a positive integer. */\n PaginationInvalidPerPage = 1801,\n /** A control row was assembled with more than the five buttons Discord allows. */\n PaginationTooManyControls = 1802,\n /** A control row was assembled with no controls. */\n PaginationEmptyControls = 1803,\n /** A control row repeats the same control, which would collide the custom_ids. */\n PaginationDuplicateControls = 1804,\n\n /** A color value could not be resolved to a Discord color integer. */\n ColorUnresolvable = 1901,\n /** A resolved color fell outside Discord's 0x000000 to 0xffffff range. */\n ColorOutOfRange = 1902,\n\n /** A plugin's constructor rejected its options through `rejectOptions`. */\n PluginOptionsRejected = 2001,\n /** Two or more plugins threw while disposing. */\n PluginDisposeFailures = 2002,\n /** A plugin declared a lifecycle timeout that is not a positive, finite number of milliseconds. */\n PluginInvalidLifecycleTimeout = 2003,\n\n /** Mongoose service class is missing the `@RegisterMongooseService` decorator. */\n PluginMongooseServiceDecoratorMissing = 2101,\n /** Mongoose client failed to establish a connection. */\n PluginMongooseConnectionFailed = 2102,\n /** Mongoose client failed to disconnect cleanly during shutdown. */\n PluginMongooseDisconnectFailed = 2103,\n /** Mongoose `services` was accessed before the plugin finished initializing. */\n PluginMongooseServicesNotReady = 2104,\n /** Mongoose rejected the model, usually a duplicate model name or an absent schema. */\n PluginMongooseModelCreationFailed = 2105,\n /** A mongoose service was registered with an empty model name override. */\n PluginMongooseModelNameMissing = 2106,\n\n /** Kysely service class is missing the `@RegisterKyselyService` decorator. */\n PluginKyselyServiceDecoratorMissing = 2201,\n /** Kysely service class is missing its table metadata. */\n PluginKyselyServiceTableMissing = 2202,\n /** Migration manager received an invalid step count. */\n PluginKyselyInvalidStepCount = 2203,\n /** Migration direction was not recognized. */\n PluginKyselyUnknownDirection = 2204,\n /** Provided migrations path could not be resolved. */\n PluginKyselyUnresolvedMigrationsPath = 2205,\n /** No migration files were found for execution. */\n PluginKyselyNoMigrationFiles = 2206,\n /** A migration module failed to export the expected functions. */\n PluginKyselyInvalidMigrationModule = 2207,\n /** An arbitrary (non-Error) failure was reported by a migration. */\n PluginKyselyNonErrorFailure = 2208,\n /** Postgres pool failed to close cleanly during shutdown. */\n PluginKyselyDisconnectFailed = 2209,\n /** Kysely `services` was accessed before the plugin finished initializing. */\n PluginKyselyServicesNotReady = 2210,\n /** Postgres pool failed to establish a connection. */\n PluginKyselyConnectionFailed = 2211,\n /** Bootstrapper failed to ensure the target Postgres database exists. */\n PluginKyselyBootstrapFailed = 2212,\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 /** Unable to locate a Seedcord config file. */\n CliConfigNotFound = 3103,\n /** CLI entry file does not exist. */\n CliEntryNotFound = 3104,\n /** tsx failed to import the provided entry file. */\n CliTsxImportFailed = 3105,\n /** Native import and jiti fallback both failed. */\n CliImportFailed = 3106,\n /** Seedcord instance export is missing a start() method. */\n CliInstanceInvalid = 3107,\n /** Seedcord instance threw during startup. */\n CliStartFailed = 3108,\n /** Config is missing the required entry string. */\n CliConfigMissingEntry = 3109,\n /** Entry file must be inside the configured root directory. */\n CliConfigEntryOutsideRoot = 3110,\n /** Unable to locate a TypeScript config file for builds. */\n CliBuildTsconfigNotFound = 3111,\n /** TypeScript reported diagnostics during emit. */\n CliBuildFailed = 3112,\n /** Unable to write the generated bootstrap file. */\n CliBootstrapWriteFailed = 3113,\n /** Two commands resolve to the same slash route during codegen. */\n CliCodegenDuplicateRoute = 3114,\n /** The commands directory could not be read during codegen. */\n CliCodegenCommandsDirUnreadable = 3115,\n /** Two context-menu commands of the same kind share a name during codegen. */\n CliCodegenDuplicateContextMenu = 3116,\n /** Could not resolve the application from the bot token during `commands --clean`. */\n CliCleanAppFetchFailed = 3117,\n /** `commands --clean` ran with neither --guild nor --all-guilds. */\n CliCleanNoGuilds = 3118,\n /** `commands --clean` combined --purge with --all-guilds, which would wipe every guild. */\n CliCleanPurgeAllGuilds = 3119,\n /** An interactive prompt was cancelled (Ctrl-C), so the command aborts without changes. */\n CliCancelled = 3120,\n /** `commands --clean --all-guilds` matched more guilds than the safety threshold without `--yes`. */\n CliCleanLargeBotUnconfirmed = 3121,\n /** `commands --clean --apply` ran in a non-interactive environment without `--yes`, where it cannot prompt. */\n CliCleanApplyNeedsYes = 3122,\n /** The cloudflared metrics server never reported a quick-tunnel hostname. */\n CliTunnelUrlUnavailable = 3123,\n /** Discord rejected the tunnel URL as an interactions endpoint. */\n CliTunnelNotVerified = 3124,\n /** The tunnel URL never answered its health probe. */\n CliTunnelUnreachable = 3125,\n /** A config field is present with the wrong shape. */\n CliConfigInvalidField = 3126,\n /** A class carrying `@RegisterCommand` threw while codegen constructed it. */\n CliCodegenCommandConstructorThrew = 3127,\n\n /** A create prompt was cancelled (Ctrl-C), and nothing has been written yet. */\n CreateCancelled = 3201,\n /** A flag supplied an answer for a question the earlier answers skip. */\n CreateFlagNotApplicable = 3202,\n /** A flag carried a value its question rejects. */\n CreateInvalidAnswer = 3203,\n /** The command line did not parse. */\n CreateBadUsage = 3204,\n /** The target path already holds something. */\n CreateTargetNotEmpty = 3205,\n /** A command the scaffolder shelled out to exited non-zero. */\n CreateStepFailed = 3206\n}\n","import chalk from 'chalk';\n\n// @seedcord/ui carries the same three for the web\nexport const BRAND = {\n flesh: '#f04e36',\n rind: '#6fab49',\n pith: '#f8f6e8'\n} as const;\n\n// truecolor because a terminal theme remaps chalk's 16-color names (blue turns orange in monokai)\nexport const paint = {\n sky: chalk.hex('#8fc7ff'), // what the line is about, one per line\n iris: chalk.hex('#e29bff'), // a count\n mint: chalk.hex('#66d98a'), // success\n amber: chalk.hex('#ffc061'), // go do something about this\n coral: chalk.hex('#ff6b85'), // failure\n // brand marks\n flesh: chalk.hex(BRAND.flesh),\n rind: chalk.hex(BRAND.rind),\n pith: chalk.hex(BRAND.pith),\n mute: chalk.dim, // context around the subject\n // weight and shape\n bold: chalk.bold,\n italic: chalk.italic,\n underline: chalk.underline\n} as const;\n","import { SeedcordErrorCode } from './ErrorCodes';\nimport { paint } from './palette';\n\n/** @internal */\nconst messages = {\n [SeedcordErrorCode.ConfigMissingEnv]: (name: string) => `Missing ${name} environment variable.`,\n [SeedcordErrorCode.ConfigInvalidEnv]: (name: string, expected?: string) =>\n expected ? `Invalid ${name} value. Expected ${expected}.` : `Invalid ${name} value.`,\n [SeedcordErrorCode.ConfigManifestNotGenerated]: () =>\n 'The route manifest is generated by `seedcord build`. Run the build before importing it.',\n [SeedcordErrorCode.ConfigWebhookUrlInvalid]: (envKey: string) =>\n `${envKey} is not a well-formed Discord webhook url.`,\n [SeedcordErrorCode.ConfigWebhookNotFound]: (envKey: string) =>\n `The webhook behind ${envKey} does not exist on Discord.`,\n [SeedcordErrorCode.ConfigEmojiUnresolved]: (count: number, failures: string) =>\n `Could not resolve ${count} configured emoji${count === 1 ? '' : 's'} at startup.\\n${failures}`,\n [SeedcordErrorCode.ConfigTokenUnreadable]: () =>\n \"DISCORD_BOT_TOKEN carries no readable application id. Discord builds the first part of a bot token from that id, so a token failing here is truncated or mistyped. Copy it again from your application's Bot page.\",\n [SeedcordErrorCode.MissingGuildsIntent]: (commands: string) =>\n `Add GatewayIntentBits.Guilds to clientOptions.intents. Without it discord.js doesn't cache any guild, so interaction.guild is null inside these commands: ${commands}.`,\n [SeedcordErrorCode.UnsupportedNodeVersion]: (required: string, running: string) =>\n `seedcord requires Node ${required} and this process runs ${running}. Upgrade Node before starting the bot.`,\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 [SeedcordErrorCode.LifecycleRestartAfterFailure]: () =>\n 'Startup failed and this host cannot start again. Construct a new instance.',\n [SeedcordErrorCode.LifecycleInvalidShutdownDeadline]: (declared: number) =>\n `lifecycle.shutdownDeadline is ${declared}. Pass a positive number of milliseconds, or omit it for the default.`,\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 [SeedcordErrorCode.CoreDirectoryImportFailed]: (file: string) => `${file} threw while importing.`,\n [SeedcordErrorCode.CoreDirectoryUnreadable]: (dir: string) => `${dir} could not be read.`,\n [SeedcordErrorCode.CorePluginReservedChannel]: (key: string) =>\n `Plugin key \"${key}\" is a channel the framework logs on. Pick another key.`,\n [SeedcordErrorCode.CoreApplicationUnavailable]: () =>\n \"The bot's application id resolves during startup. You read it before that. Read it inside a handler, inside a plugin's ready(), or after start() resolves.\",\n [SeedcordErrorCode.CoreAccessorUnresolved]: (accessor: string, key: string) =>\n `${accessor}.${key} has no value yet. ${accessor} fills during startup, and a read at the top of a file runs before that.`,\n [SeedcordErrorCode.CoreLifecycleUnavailable]: (accessor: string) =>\n `core.${accessor}.addTask() does not work here. This bot was built with createSeedcord() whose build never runs startup or shutdown. Your task would never run. Do the work inside your handler instead. To use startup and shutdown, run the bot on node with new Seedcord(config).start().`,\n [SeedcordErrorCode.CoreBusEmitUnavailable]: (event: string) =>\n `core.bus.emit('${event}') would reach your on() listeners and skip every Subscriber class. Call core.bus.publish('${event}', data) to run both.`,\n\n [SeedcordErrorCode.DecoratorInteractionEventFilter]: () => 'Interaction middleware cannot specify event filters.',\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 [SeedcordErrorCode.DecoratorWebhookUrlMissing]: (className: string) =>\n `${className} extends WebhookLog and needs a @WebhookUrl decorator naming its env var.`,\n\n [SeedcordErrorCode.InteractionDuplicateRoute]: (route: string, first: string, second: string) =>\n `Two interaction handlers resolve to the same route \\`${route}\\`. Registered by ${first} and ${second}. Rename one.`,\n [SeedcordErrorCode.InteractionDuplicateMiddleware]: (name: string) =>\n `Two different interaction middleware classes share the name \\`${name}\\`. Rename one so they do not collide.`,\n [SeedcordErrorCode.InteractionRouteExportMissing]: (route: string, exportName: string, from: string) =>\n `Route \\`${route}\\` loads \\`${exportName}\\` from ${from}, which exports no such name.`,\n [SeedcordErrorCode.SubscriberRouteNotASubscriber]: (keys: string, exportName: string, from: string) =>\n `Subscriber row for \\`${keys}\\` loads \\`${exportName}\\` from ${from}, which does not extend Subscriber.`,\n [SeedcordErrorCode.RouteModuleLoadFailed]: (route: string, from: string) =>\n `Route \\`${route}\\` failed to import ${from}.`,\n\n [SeedcordErrorCode.ReplyIllegalAckState]: (method: string, reason: string, alternative: string, routeId: string) =>\n `${paint.sky(`${method}()`)} was called when ${reason}.\\n${alternative} (route ${paint.mute(routeId)})`,\n [SeedcordErrorCode.ReplyComponentSerialization]: (\n componentClass: string,\n index: number,\n detail: string,\n routeId: string\n ) =>\n `${paint.sky(componentClass)} at components[${index}] failed to serialize: ${detail.replace(/\\.$/, '')}. (route ${paint.mute(routeId)})`,\n [SeedcordErrorCode.ReplyForeignEditTarget]: (method: string, targetId: string, routeId: string) =>\n `${paint.sky(`${method}()`)} was passed message ${targetId}, which this interaction did not send.\\nPass a message this interaction sent, returned by reply(), followUp(), edit(), or update(). (route ${paint.mute(routeId)})`,\n [SeedcordErrorCode.ReplyUpdateWithoutSource]: (method: string, routeId: string) =>\n `${paint.sky(`${method}()`)} was called on a modal opened from a command, which has no source message.\\nUse reply() or defer() instead. (route ${paint.mute(routeId)})`,\n [SeedcordErrorCode.ReplyCallbackMissingMessage]: (method: string, routeId: string) =>\n `The interaction callback for ${paint.sky(`${method}()`)} returned no message. (route ${paint.mute(routeId)})`,\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, method: string) =>\n `customId field ${JSON.stringify(field)} uses ${method}() with no choices. Make the field nullable or provide at least one choice.`,\n [SeedcordErrorCode.CustomIdInvalidBounds]: (field: string, min: number, max: number) =>\n `customId field ${JSON.stringify(field)} has min ${min} greater than max ${max}.`,\n [SeedcordErrorCode.CustomIdValueRejected]: (field: string, expected: string, value: string) =>\n `customId field ${JSON.stringify(field)} expects ${expected}, got ${value}.`,\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. Add the one that matches its base, for example @ButtonRoute or @UserMenuRoute.`,\n [SeedcordErrorCode.CustomIdMatchArmMissing]: (prefix: string) =>\n `match() has no arm for the decoded route ${JSON.stringify(prefix)}.`,\n [SeedcordErrorCode.CustomIdWireStale]: (prefix: string) =>\n `customId ${JSON.stringify(prefix)} was minted under an older shape of this definition. Adding, removing, changing, or moving a field changes the layout hash.`,\n [SeedcordErrorCode.CustomIdWireInvalid]: (detail: string) => `customId could not be decoded. ${detail}.`,\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.ContextMenuMatchArmMissing]: (name: string) =>\n `match() has no arm for the context menu command ${JSON.stringify(name)}.`,\n [SeedcordErrorCode.EventMiddlewareNameUnavailable]: () =>\n `this.eventName is only available on middleware the controller constructed with a fired event name.`,\n [SeedcordErrorCode.AutocompleteNoFocusedOption]: () => `Autocomplete payload has no focused option.`,\n [SeedcordErrorCode.ModalFieldNotFound]: (customId: string) =>\n `The submitted modal carries no field with the custom id ${JSON.stringify(customId)}. Check it against the id you gave the component when you built the modal.`,\n [SeedcordErrorCode.ModalFieldWrongKind]: (customId: string, kind: string, getter?: string) =>\n getter\n ? `Modal field ${JSON.stringify(customId)} holds ${kind}. Read it with ${getter}().`\n : `Modal field ${JSON.stringify(customId)} holds ${kind}. No getter reads that kind.`,\n [SeedcordErrorCode.ModalFieldEmpty]: (customId: string) =>\n `Modal field ${JSON.stringify(customId)} carries no selection. Build the component as required, or read it without the required argument.`,\n [SeedcordErrorCode.ModalFieldChannelType]: (customId: string, picked: string, allowed: string) =>\n `Modal field ${JSON.stringify(customId)} picked a ${picked} channel. This read allows ${allowed}.`,\n\n [SeedcordErrorCode.GateInvalidCooldownDuration]: (input: string) =>\n `Cooldown duration ${JSON.stringify(input)} is not valid. Pass a number of seconds or a duration string like '30m', '24h', or '500ms'.`,\n\n [SeedcordErrorCode.PaginationInvalidPerPage]: (perPage: number) =>\n `perPage must be a positive integer, got ${perPage}.`,\n [SeedcordErrorCode.PaginationTooManyControls]: (count: number) =>\n `A control row holds at most 5 buttons, got ${count}.`,\n [SeedcordErrorCode.PaginationEmptyControls]: () => `A control row must hold at least one control.`,\n [SeedcordErrorCode.PaginationDuplicateControls]: (key: string) =>\n `A control row cannot repeat the '${key}' control.`,\n\n [SeedcordErrorCode.ColorUnresolvable]: (value: string) => `Cannot convert ${value} into a color.`,\n [SeedcordErrorCode.ColorOutOfRange]: () => 'Color must be within the range 0 to 16777215 (0xffffff).',\n\n [SeedcordErrorCode.PluginOptionsRejected]: (pluginName: string, reason: string) =>\n `${pluginName} rejected its options, ${reason.replace(/\\.$/, '')}.`,\n [SeedcordErrorCode.PluginDisposeFailures]: (count: number) => `${count} plugins failed to dispose.`,\n [SeedcordErrorCode.PluginInvalidLifecycleTimeout]: (pluginName: string, field: string, declared: number) =>\n `${pluginName} declared lifecycle ${field}.timeout as ${declared}. Pass a positive number of milliseconds, or omit it for the default.`,\n\n [SeedcordErrorCode.PluginMongooseServiceDecoratorMissing]: (className: string) =>\n `Missing @RegisterMongooseService on ${className}.`,\n [SeedcordErrorCode.PluginMongooseConnectionFailed]: (databaseName?: string) =>\n databaseName ? `Could not connect to MongoDB (${databaseName}).` : 'Could not connect to MongoDB.',\n [SeedcordErrorCode.PluginMongooseDisconnectFailed]: () =>\n 'Failed to disconnect from MongoDB cleanly during shutdown.',\n [SeedcordErrorCode.PluginMongooseServicesNotReady]: () =>\n 'Mongoose services accessed before the plugin finished initializing.',\n [SeedcordErrorCode.PluginMongooseModelCreationFailed]: (modelName: string, className: string) =>\n `Could not build the mongoose model ${modelName} for ${className}.`,\n [SeedcordErrorCode.PluginMongooseModelNameMissing]: (className: string) =>\n `Empty model name on ${className}. Provide a non-empty modelName via @RegisterMongooseService().`,\n\n [SeedcordErrorCode.PluginKyselyServiceDecoratorMissing]: (className: string) =>\n `Missing @RegisterKyselyService on ${className}.`,\n [SeedcordErrorCode.PluginKyselyServiceTableMissing]: (className: string) =>\n `Missing table metadata for ${className}. Provide a table via @RegisterKyselyService().`,\n [SeedcordErrorCode.PluginKyselyInvalidStepCount]: () => 'Migration step count must be a non-negative integer.',\n [SeedcordErrorCode.PluginKyselyUnknownDirection]: (direction: unknown) =>\n `Unknown migration direction: ${String(direction)}.`,\n [SeedcordErrorCode.PluginKyselyUnresolvedMigrationsPath]: (label: string) =>\n `Unable to resolve migrations at path: ${label}.`,\n [SeedcordErrorCode.PluginKyselyNoMigrationFiles]: () => 'No migration files provided.',\n [SeedcordErrorCode.PluginKyselyInvalidMigrationModule]: (filePath: string) =>\n `Migration file ${filePath} must export async functions up and down.`,\n [SeedcordErrorCode.PluginKyselyNonErrorFailure]: (message: string) => `Migration failure: ${message}.`,\n [SeedcordErrorCode.PluginKyselyDisconnectFailed]: () =>\n 'Failed to close the Postgres pool cleanly during shutdown.',\n [SeedcordErrorCode.PluginKyselyServicesNotReady]: () =>\n 'Kysely services accessed before the plugin finished initializing.',\n [SeedcordErrorCode.PluginKyselyConnectionFailed]: (databaseName?: string) =>\n databaseName ? `Could not connect to Postgres (${databaseName}).` : 'Could not connect to Postgres.',\n [SeedcordErrorCode.PluginKyselyBootstrapFailed]: (databaseName: string) =>\n `Failed to ensure database ${databaseName} exists.`,\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.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.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} (the jiti fallback 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.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.CliCodegenCommandConstructorThrew]: (name: string, file: string, reason: string) =>\n `${name} threw while codegen constructed it. Fix its constructor in ${file}. ${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 [SeedcordErrorCode.CliCleanAppFetchFailed]: (reason: string) =>\n `Could not resolve the application from the bot token. ${reason}`,\n [SeedcordErrorCode.CliCleanNoGuilds]: () =>\n 'No guilds given. Pass --guild <ids...> or --all-guilds. Global commands are never touched.',\n [SeedcordErrorCode.CliCleanPurgeAllGuilds]: () =>\n '--purge cannot be combined with --all-guilds. Use --guild <ids> to purge specific guilds.',\n [SeedcordErrorCode.CliCancelled]: () => 'Cancelled.',\n [SeedcordErrorCode.CliCleanLargeBotUnconfirmed]: (count: number) =>\n `Refusing to scan ${count} guilds without confirmation. Re-run with --yes, or name specific guilds with --guild <ids>.`,\n [SeedcordErrorCode.CliCleanApplyNeedsYes]: () =>\n 'Refusing to delete without confirmation in a non-interactive environment. Re-run with --yes.',\n [SeedcordErrorCode.CliTunnelUrlUnavailable]: (seconds: number) =>\n `cloudflared did not report a tunnel URL within ${seconds}s. Check that the binary runs and that the network allows it.`,\n [SeedcordErrorCode.CliTunnelNotVerified]: (url: string) => `Discord rejected ${url} as an interactions endpoint.`,\n [SeedcordErrorCode.CliTunnelUnreachable]: (url: string, seconds: number) =>\n `${url} did not answer within ${seconds}s, so nothing was PATCHed to Discord.`,\n [SeedcordErrorCode.CliConfigInvalidField]: (field: string, expected: string) =>\n `Config \\`${field}\\` must be ${expected} when provided.`,\n [SeedcordErrorCode.CreateCancelled]: () => 'Cancelled.',\n [SeedcordErrorCode.CreateFlagNotApplicable]: (flag: string) =>\n `The --${flag} flag does not apply to the answers you gave.`,\n [SeedcordErrorCode.CreateInvalidAnswer]: (flag: string, reason: string) => `--${flag}: ${reason}`,\n // node's parseArgs message ends on an unclosed quote\n [SeedcordErrorCode.CreateBadUsage]: (reason: string) => `${reason}\\nRun with --help for the flag list.`,\n [SeedcordErrorCode.CreateTargetNotEmpty]: (target: string) =>\n `${target} already has files in it. Pick an empty directory or a name that does not exist yet.`,\n [SeedcordErrorCode.CreateStepFailed]: (command: string, reason: string) => `\\`${command}\\` failed.\\n${reason}`\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","import { SeedcordErrorCode } from './ErrorCodes';\nimport { formatSeedcordErrorMessage, type SeedcordErrorArguments } from './ErrorMessages';\nimport { paint } from './palette';\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 `${paint.coral.bold(name)}[${paint.mute(code)}]`;\n}\n\n/**\n * String literal type for Seedcord error class names. Names the `type` argument of\n * {@link isSeedcordError}.\n */\nexport type SeedcordErrorTypeString = `Seedcord${'Error' | 'TypeError' | 'RangeError' | 'AggregateError'}`;\n\n// Symbol.for so two installed copies read the same slot\nconst kIdentifier: unique symbol = Symbol.for('seedcord:errors:identifier');\n\ninterface BaseSeedcordError {\n readonly code: SeedcordErrorCode;\n readonly [kIdentifier]: SeedcordErrorIdentifier;\n readonly type: SeedcordErrorTypeString;\n}\n\n// instanceof fails across two installed copies of this package\nconst CODED = Symbol.for('seedcord:errors:coded');\n\nfunction brand(prototype: object): void {\n Object.defineProperty(prototype, CODED, { value: true });\n}\n\nfunction isCoded(error: unknown): error is BaseSeedcordError {\n return typeof error === 'object' && error !== null && CODED in error;\n}\n\nexport class SeedcordError<Code extends SeedcordErrorCode = SeedcordErrorCode>\n extends Error\n implements BaseSeedcordError\n{\n public readonly code: Code;\n readonly [kIdentifier]: 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[kIdentifier] = resolveIdentifier(code);\n this.name = formatErrorName(new.target.name, this[kIdentifier], 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\nbrand(SeedcordError.prototype);\n\nexport class SeedcordTypeError<Code extends SeedcordErrorCode = SeedcordErrorCode>\n extends TypeError\n implements BaseSeedcordError\n{\n public readonly code: Code;\n readonly [kIdentifier]: 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[kIdentifier] = resolveIdentifier(code);\n this.name = formatErrorName(new.target.name, this[kIdentifier], 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\nbrand(SeedcordTypeError.prototype);\n\nexport class SeedcordRangeError<Code extends SeedcordErrorCode = SeedcordErrorCode>\n extends RangeError\n implements BaseSeedcordError\n{\n public readonly code: Code;\n readonly [kIdentifier]: 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[kIdentifier] = resolveIdentifier(code);\n this.name = formatErrorName(new.target.name, this[kIdentifier], 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\nbrand(SeedcordRangeError.prototype);\n\nexport class SeedcordAggregateError<Code extends SeedcordErrorCode = SeedcordErrorCode>\n extends AggregateError\n implements BaseSeedcordError\n{\n public readonly code: Code;\n readonly [kIdentifier]: SeedcordErrorIdentifier;\n public readonly type = 'SeedcordAggregateError';\n\n constructor(code: Code, errors: readonly unknown[], ...rest: SeedcordErrorCtorRest<Code>) {\n const { args, options } = resolveCtorInputs(rest);\n const message = resolveMessage(code, args);\n super(errors, message, options);\n this.code = code;\n this[kIdentifier] = resolveIdentifier(code);\n this.name = formatErrorName(new.target.name, this[kIdentifier], 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\nbrand(SeedcordAggregateError.prototype);\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 : Type extends 'SeedcordRangeError'\n ? SeedcordRangeError<Code>\n : SeedcordAggregateError<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.\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 if (!isCoded(error)) return false;\n if (type && error.type !== type) return false;\n if (code === undefined) return true;\n // another copy of this package may number the same identifier differently\n return error[kIdentifier] === resolveIdentifier(code);\n}\n"],"mappings":";;;;;;AAKA,IAAY,oBAAL;;CAEH;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAGA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAGA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAGA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAGA;;CAEA;;CAEA;;CAEA;;CAEA;;CAGA;;CAEA;;CAEA;;C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,OAAO;CACxC,IAAI,SAAS,QAAW,OAAO;CAE/B,OAAO,MAAM,iBAAiB,kBAAkB,IAAI;AACxD"}
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { c as paint, l as SeedcordErrorCode, o as isSeedcordError, r as SeedcordErrorTypeString } from "./SeedcordError-BAPFVzz-.mjs";
1
+ import { c as paint, l as SeedcordErrorCode, o as isSeedcordError, r as SeedcordErrorTypeString } from "./SeedcordError-ej3a21SJ.mjs";
2
2
  //#region src/index.d.ts
3
3
  /** Package version */
4
4
  declare const version: string;
package/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
- import { a as isSeedcordError, c as SeedcordErrorCode, s as paint } from "./SeedcordError-BusWc3a-.mjs";
1
+ import { a as isSeedcordError, c as SeedcordErrorCode, s as paint } from "./SeedcordError-kjcK2zQB.mjs";
2
2
 
3
3
  //#region src/index.ts
4
4
  /** Package version */
5
- const version = "0.5.1";
5
+ const version = "0.7.0";
6
6
 
7
7
  //#endregion
8
8
  export { SeedcordErrorCode, isSeedcordError, paint, version };
@@ -1,4 +1,4 @@
1
- import { a as SeedcordTypeError, i as SeedcordRangeError, n as SeedcordError, s as BRAND, t as SeedcordAggregateError } from "./SeedcordError-BAPFVzz-.mjs";
1
+ import { a as SeedcordTypeError, i as SeedcordRangeError, n as SeedcordError, s as BRAND, t as SeedcordAggregateError } from "./SeedcordError-ej3a21SJ.mjs";
2
2
  //#region src/validateDiscordToken.d.ts
3
3
  /** @internal */
4
4
  declare function validateDiscordToken(raw: unknown): string;
@@ -1,4 +1,4 @@
1
- import { c as SeedcordErrorCode, i as SeedcordTypeError, n as SeedcordError, o as BRAND, r as SeedcordRangeError, t as SeedcordAggregateError } from "./SeedcordError-BusWc3a-.mjs";
1
+ import { c as SeedcordErrorCode, i as SeedcordTypeError, n as SeedcordError, o as BRAND, r as SeedcordRangeError, t as SeedcordAggregateError } from "./SeedcordError-kjcK2zQB.mjs";
2
2
 
3
3
  //#region src/validateDiscordToken.ts
4
4
  const ENV_NAME = "DISCORD_BOT_TOKEN";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@seedcord/errors",
3
3
  "type": "module",
4
- "version": "0.5.1",
4
+ "version": "0.7.0",
5
5
  "engines": {
6
6
  "node": ">=24.11"
7
7
  },
@@ -50,7 +50,7 @@
50
50
  "chalk": "^6.0.0"
51
51
  },
52
52
  "devDependencies": {
53
- "@seedcord/eslint-config": "^2.1.0",
53
+ "@seedcord/eslint-config": "^2.2.0",
54
54
  "@seedcord/tsconfig": "^2.0.3",
55
55
  "@seedcord/tsdown-config": "^2.0.1",
56
56
  "@seedcord/vitest-config": "^0.0.1"
@@ -1 +0,0 @@
1
- {"version":3,"file":"SeedcordError-BusWc3a-.mjs","names":[],"sources":["../src/ErrorCodes.ts","../src/palette.ts","../src/ErrorMessages.ts","../src/SeedcordError.ts"],"sourcesContent":["/* eslint-disable no-magic-numbers */\n\n/**\n * All Seedcord error codes.\n */\nexport enum SeedcordErrorCode {\n /** One or more configured emojis could not be resolved at startup. */\n ConfigEmojiUnresolved = 1001,\n /** A webhook reporter's env var is set but fails webhook URL validation. */\n ConfigWebhookUrlInvalid = 1002,\n /** A configured webhook does not exist on Discord (deleted, or a wrong id or token). */\n ConfigWebhookNotFound = 1003,\n /** The generated route manifest was imported before `seedcord build` generated it. */\n ConfigManifestNotGenerated = 1004,\n /** A required environment variable is not present. */\n ConfigMissingEnv = 1005,\n /** An environment variable is present and fails validation. */\n ConfigInvalidEnv = 1006,\n /** A command usable in a guild is registered without the `Guilds` intent that caches guilds. */\n MissingGuildsIntent = 1007,\n /** The running Node version is below the range seedcord declares in `engines`. */\n UnsupportedNodeVersion = 1008,\n /** `DISCORD_BOT_TOKEN` passed its shape check and carries no readable application id. */\n ConfigTokenUnreadable = 1009,\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 /** A host whose startup failed was started again. */\n LifecycleRestartAfterFailure = 1107,\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 /** A file in a scanned directory threw while being imported. */\n CoreDirectoryImportFailed = 1206,\n /** A scanned directory could not be read. */\n CoreDirectoryUnreadable = 1207,\n /** A plugin was attached under a key the framework logs on. */\n CorePluginReservedChannel = 1208,\n /** The application id was read before startup resolved it. */\n CoreApplicationUnavailable = 1209,\n /** A generated accessor was read before startup resolved its values. */\n CoreAccessorUnresolved = 1210,\n /** A startup or shutdown task was added to a core built by `createSeedcord`. */\n CoreLifecycleUnavailable = 1211,\n /** `emit` was called on the bus. It reaches listeners and skips every subscriber. */\n CoreBusEmitUnavailable = 1212,\n\n /** Interaction middleware decorated with disallowed event filters. */\n DecoratorInteractionEventFilter = 1301,\n /** A command decorator attempted to re-register an existing command scope. */\n DecoratorCommandAlreadyRegistered = 1302,\n /** A global command decorator specified guild IDs, which is not allowed. */\n DecoratorCommandGlobalWithGuilds = 1303,\n /** A guild command decorator omitted the required guild ID list. */\n DecoratorCommandGuildWithoutGuilds = 1304,\n /** Middleware priority provided by the decorator was not a finite number. */\n DecoratorInvalidMiddlewarePriority = 1305,\n /** A WebhookLog subclass is missing its `@WebhookUrl` decorator. */\n DecoratorWebhookUrlMissing = 1306,\n\n /** Two interaction handlers registered the same route within a scope. */\n InteractionDuplicateRoute = 1401,\n /** Two different interaction middleware classes share a class name. */\n InteractionDuplicateMiddleware = 1402,\n /** A route manifest row gives an export name its module does not have. */\n InteractionRouteExportMissing = 1403,\n /** A subscriber manifest row specifies an export that does not extend `Subscriber`. */\n SubscriberRouteNotASubscriber = 1404,\n /** A manifest row's module threw while importing. */\n RouteModuleLoadFailed = 1405,\n\n /** A reply method was called in an ack state where it is illegal. */\n ReplyIllegalAckState = 1501,\n /** A reply component failed to serialize to raw API data. */\n ReplyComponentSerialization = 1502,\n /** edit() was passed a message the interaction did not send. */\n ReplyForeignEditTarget = 1503,\n /** update() or deferUpdate() was called on a modal with no source message. */\n ReplyUpdateWithoutSource = 1504,\n /** A withResponse interaction callback returned no created message. */\n ReplyCallbackMissingMessage = 1505,\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 /** An autocomplete payload carried no focused option. */\n AutocompleteNoFocusedOption = 1614,\n /** A context menu handler's match() has no arm for the command name that fired. */\n ContextMenuMatchArmMissing = 1615,\n /** No field in the submitted modal carries the requested custom id. */\n ModalFieldNotFound = 1616,\n /** A modal field getter was called on a field of another kind. */\n ModalFieldWrongKind = 1617,\n /** Nothing was picked in a modal field read as required. */\n ModalFieldEmpty = 1618,\n /** A channel select field picked a channel outside the types getSelectedChannels() allows. */\n ModalFieldChannelType = 1619,\n /** A customId was minted under an older shape of the same definition. */\n CustomIdWireStale = 1620,\n /** A customId wire is corrupt, truncated, or was minted by a different definition. */\n CustomIdWireInvalid = 1621,\n\n /** A Cooldown gate was given a duration string that is not a well-formed positive duration. */\n GateInvalidCooldownDuration = 1701,\n\n /** A paginator source was given a perPage that is not a positive integer. */\n PaginationInvalidPerPage = 1801,\n /** A control row was assembled with more than the five buttons Discord allows. */\n PaginationTooManyControls = 1802,\n /** A control row was assembled with no controls. */\n PaginationEmptyControls = 1803,\n /** A control row repeats the same control, which would collide the custom_ids. */\n PaginationDuplicateControls = 1804,\n\n /** A color value could not be resolved to a Discord color integer. */\n ColorUnresolvable = 1901,\n /** A resolved color fell outside Discord's 0x000000 to 0xffffff range. */\n ColorOutOfRange = 1902,\n\n /** A plugin's constructor rejected its options through `rejectOptions`. */\n PluginOptionsRejected = 2001,\n /** Two or more plugins threw while disposing. */\n PluginDisposeFailures = 2002,\n /** A plugin declared a lifecycle timeout that is not a positive, finite number of milliseconds. */\n PluginInvalidLifecycleTimeout = 2003,\n\n /** Mongoose service class is missing the `@RegisterMongooseService` decorator. */\n PluginMongooseServiceDecoratorMissing = 2101,\n /** Mongoose client failed to establish a connection. */\n PluginMongooseConnectionFailed = 2102,\n /** Mongoose client failed to disconnect cleanly during shutdown. */\n PluginMongooseDisconnectFailed = 2103,\n /** Mongoose `services` was accessed before the plugin finished initializing. */\n PluginMongooseServicesNotReady = 2104,\n /** Mongoose rejected the model, usually a duplicate model name or an absent schema. */\n PluginMongooseModelCreationFailed = 2105,\n /** A mongoose service was registered with an empty model name override. */\n PluginMongooseModelNameMissing = 2106,\n\n /** Kysely service class is missing the `@RegisterKyselyService` decorator. */\n PluginKyselyServiceDecoratorMissing = 2201,\n /** Kysely service class is missing its table metadata. */\n PluginKyselyServiceTableMissing = 2202,\n /** Migration manager received an invalid step count. */\n PluginKyselyInvalidStepCount = 2203,\n /** Migration direction was not recognized. */\n PluginKyselyUnknownDirection = 2204,\n /** Provided migrations path could not be resolved. */\n PluginKyselyUnresolvedMigrationsPath = 2205,\n /** No migration files were found for execution. */\n PluginKyselyNoMigrationFiles = 2206,\n /** A migration module failed to export the expected functions. */\n PluginKyselyInvalidMigrationModule = 2207,\n /** An arbitrary (non-Error) failure was reported by a migration. */\n PluginKyselyNonErrorFailure = 2208,\n /** Postgres pool failed to close cleanly during shutdown. */\n PluginKyselyDisconnectFailed = 2209,\n /** Kysely `services` was accessed before the plugin finished initializing. */\n PluginKyselyServicesNotReady = 2210,\n /** Postgres pool failed to establish a connection. */\n PluginKyselyConnectionFailed = 2211,\n /** Bootstrapper failed to ensure the target Postgres database exists. */\n PluginKyselyBootstrapFailed = 2212,\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 /** Unable to locate a Seedcord config file. */\n CliConfigNotFound = 3103,\n /** CLI entry file does not exist. */\n CliEntryNotFound = 3104,\n /** tsx failed to import the provided entry file. */\n CliTsxImportFailed = 3105,\n /** Native import and jiti fallback both failed. */\n CliImportFailed = 3106,\n /** Seedcord instance export is missing a start() method. */\n CliInstanceInvalid = 3107,\n /** Seedcord instance threw during startup. */\n CliStartFailed = 3108,\n /** Config is missing the required entry string. */\n CliConfigMissingEntry = 3109,\n /** Entry file must be inside the configured root directory. */\n CliConfigEntryOutsideRoot = 3110,\n /** Unable to locate a TypeScript config file for builds. */\n CliBuildTsconfigNotFound = 3111,\n /** TypeScript reported diagnostics during emit. */\n CliBuildFailed = 3112,\n /** Unable to write the generated bootstrap file. */\n CliBootstrapWriteFailed = 3113,\n /** Two commands resolve to the same slash route during codegen. */\n CliCodegenDuplicateRoute = 3114,\n /** The commands directory could not be read during codegen. */\n CliCodegenCommandsDirUnreadable = 3115,\n /** Two context-menu commands of the same kind share a name during codegen. */\n CliCodegenDuplicateContextMenu = 3116,\n /** Could not resolve the application from the bot token during `commands --clean`. */\n CliCleanAppFetchFailed = 3117,\n /** `commands --clean` ran with neither --guild nor --all-guilds. */\n CliCleanNoGuilds = 3118,\n /** `commands --clean` combined --purge with --all-guilds, which would wipe every guild. */\n CliCleanPurgeAllGuilds = 3119,\n /** An interactive prompt was cancelled (Ctrl-C), so the command aborts without changes. */\n CliCancelled = 3120,\n /** `commands --clean --all-guilds` matched more guilds than the safety threshold without `--yes`. */\n CliCleanLargeBotUnconfirmed = 3121,\n /** `commands --clean --apply` ran in a non-interactive environment without `--yes`, where it cannot prompt. */\n CliCleanApplyNeedsYes = 3122,\n /** The cloudflared metrics server never reported a quick-tunnel hostname. */\n CliTunnelUrlUnavailable = 3123,\n /** Discord rejected the tunnel URL as an interactions endpoint. */\n CliTunnelNotVerified = 3124,\n /** The tunnel URL never answered its health probe. */\n CliTunnelUnreachable = 3125,\n /** A config field is present with the wrong shape. */\n CliConfigInvalidField = 3126,\n /** A class carrying `@RegisterCommand` threw while codegen constructed it. */\n CliCodegenCommandConstructorThrew = 3127,\n\n /** A create prompt was cancelled (Ctrl-C), and nothing has been written yet. */\n CreateCancelled = 3201,\n /** A flag supplied an answer for a question the earlier answers skip. */\n CreateFlagNotApplicable = 3202,\n /** A flag carried a value its question rejects. */\n CreateInvalidAnswer = 3203,\n /** The command line did not parse. */\n CreateBadUsage = 3204,\n /** The target path already holds something. */\n CreateTargetNotEmpty = 3205,\n /** A command the scaffolder shelled out to exited non-zero. */\n CreateStepFailed = 3206\n}\n","import chalk from 'chalk';\n\n// @seedcord/ui carries the same three for the web\nexport const BRAND = {\n flesh: '#f04e36',\n rind: '#6fab49',\n pith: '#f8f6e8'\n} as const;\n\n// truecolor because a terminal theme remaps chalk's 16-color names (blue turns orange in monokai)\nexport const paint = {\n sky: chalk.hex('#8fc7ff'), // what the line is about, one per line\n iris: chalk.hex('#e29bff'), // a count\n mint: chalk.hex('#66d98a'), // success\n amber: chalk.hex('#ffc061'), // go do something about this\n coral: chalk.hex('#ff6b85'), // failure\n // brand marks\n flesh: chalk.hex(BRAND.flesh),\n rind: chalk.hex(BRAND.rind),\n pith: chalk.hex(BRAND.pith),\n mute: chalk.dim, // context around the subject\n // weight and shape\n bold: chalk.bold,\n italic: chalk.italic,\n underline: chalk.underline\n} as const;\n","import { SeedcordErrorCode } from './ErrorCodes';\nimport { paint } from './palette';\n\n/** @internal */\nconst messages = {\n [SeedcordErrorCode.ConfigMissingEnv]: (name: string) => `Missing ${name} environment variable.`,\n [SeedcordErrorCode.ConfigInvalidEnv]: (name: string, expected?: string) =>\n expected ? `Invalid ${name} value. Expected ${expected}.` : `Invalid ${name} value.`,\n [SeedcordErrorCode.ConfigManifestNotGenerated]: () =>\n 'The route manifest is generated by `seedcord build`. Run the build before importing it.',\n [SeedcordErrorCode.ConfigWebhookUrlInvalid]: (envKey: string) =>\n `${envKey} is not a well-formed Discord webhook url.`,\n [SeedcordErrorCode.ConfigWebhookNotFound]: (envKey: string) =>\n `The webhook behind ${envKey} does not exist on Discord.`,\n [SeedcordErrorCode.ConfigEmojiUnresolved]: (count: number, failures: string) =>\n `Could not resolve ${count} configured emoji${count === 1 ? '' : 's'} at startup.\\n${failures}`,\n [SeedcordErrorCode.ConfigTokenUnreadable]: () =>\n \"DISCORD_BOT_TOKEN carries no readable application id. Discord builds the first part of a bot token from that id, so a token failing here is truncated or mistyped. Copy it again from your application's Bot page.\",\n [SeedcordErrorCode.MissingGuildsIntent]: (commands: string) =>\n `Add GatewayIntentBits.Guilds to clientOptions.intents. Without it discord.js doesn't cache any guild, so interaction.guild is null inside these commands: ${commands}.`,\n [SeedcordErrorCode.UnsupportedNodeVersion]: (required: string, running: string) =>\n `seedcord requires Node ${required} and this process runs ${running}. Upgrade Node before starting the bot.`,\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 [SeedcordErrorCode.LifecycleRestartAfterFailure]: () =>\n 'Startup failed and this host cannot start again. Construct a new instance.',\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 [SeedcordErrorCode.CoreDirectoryImportFailed]: (file: string) => `${file} threw while importing.`,\n [SeedcordErrorCode.CoreDirectoryUnreadable]: (dir: string) => `${dir} could not be read.`,\n [SeedcordErrorCode.CorePluginReservedChannel]: (key: string) =>\n `Plugin key \"${key}\" is a channel the framework logs on. Pick another key.`,\n [SeedcordErrorCode.CoreApplicationUnavailable]: () =>\n \"The bot's application id resolves during startup. You read it before that. Read it inside a handler, inside a plugin's ready(), or after start() resolves.\",\n [SeedcordErrorCode.CoreAccessorUnresolved]: (accessor: string, key: string) =>\n `${accessor}.${key} has no value yet. ${accessor} fills during startup, and a read at the top of a file runs before that.`,\n [SeedcordErrorCode.CoreLifecycleUnavailable]: (accessor: string) =>\n `core.${accessor}.addTask() does not work here. This bot was built with createSeedcord() whose build never runs startup or shutdown. Your task would never run. Do the work inside your handler instead. To use startup and shutdown, run the bot on node with new Seedcord(config).start().`,\n [SeedcordErrorCode.CoreBusEmitUnavailable]: (event: string) =>\n `core.bus.emit('${event}') would reach your on() listeners and skip every Subscriber class. Call core.bus.publish('${event}', data) to run both.`,\n\n [SeedcordErrorCode.DecoratorInteractionEventFilter]: () => 'Interaction middleware cannot specify event filters.',\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 [SeedcordErrorCode.DecoratorWebhookUrlMissing]: (className: string) =>\n `${className} extends WebhookLog and needs a @WebhookUrl decorator naming its env var.`,\n\n [SeedcordErrorCode.InteractionDuplicateRoute]: (route: string, first: string, second: string) =>\n `Two interaction handlers resolve to the same route \\`${route}\\`. Registered by ${first} and ${second}. Rename one.`,\n [SeedcordErrorCode.InteractionDuplicateMiddleware]: (name: string) =>\n `Two different interaction middleware classes share the name \\`${name}\\`. Rename one so they do not collide.`,\n [SeedcordErrorCode.InteractionRouteExportMissing]: (route: string, exportName: string, from: string) =>\n `Route \\`${route}\\` loads \\`${exportName}\\` from ${from}, which exports no such name.`,\n [SeedcordErrorCode.SubscriberRouteNotASubscriber]: (keys: string, exportName: string, from: string) =>\n `Subscriber row for \\`${keys}\\` loads \\`${exportName}\\` from ${from}, which does not extend Subscriber.`,\n [SeedcordErrorCode.RouteModuleLoadFailed]: (route: string, from: string) =>\n `Route \\`${route}\\` failed to import ${from}.`,\n\n [SeedcordErrorCode.ReplyIllegalAckState]: (method: string, reason: string, alternative: string, routeId: string) =>\n `${paint.sky(`${method}()`)} was called when ${reason}.\\n${alternative} (route ${paint.mute(routeId)})`,\n [SeedcordErrorCode.ReplyComponentSerialization]: (\n componentClass: string,\n index: number,\n detail: string,\n routeId: string\n ) =>\n `${paint.sky(componentClass)} at components[${index}] failed to serialize: ${detail.replace(/\\.$/, '')}. (route ${paint.mute(routeId)})`,\n [SeedcordErrorCode.ReplyForeignEditTarget]: (method: string, targetId: string, routeId: string) =>\n `${paint.sky(`${method}()`)} was passed message ${targetId}, which this interaction did not send.\\nPass a message this interaction sent, returned by reply(), followUp(), edit(), or update(). (route ${paint.mute(routeId)})`,\n [SeedcordErrorCode.ReplyUpdateWithoutSource]: (method: string, routeId: string) =>\n `${paint.sky(`${method}()`)} was called on a modal opened from a command, which has no source message.\\nUse reply() or defer() instead. (route ${paint.mute(routeId)})`,\n [SeedcordErrorCode.ReplyCallbackMissingMessage]: (method: string, routeId: string) =>\n `The interaction callback for ${paint.sky(`${method}()`)} returned no message. (route ${paint.mute(routeId)})`,\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.CustomIdWireStale]: (prefix: string) =>\n `customId ${JSON.stringify(prefix)} was minted under an older shape of this definition. Adding, removing, changing, or moving a field changes the layout hash.`,\n [SeedcordErrorCode.CustomIdWireInvalid]: (detail: string) => `customId could not be decoded. ${detail}.`,\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.ContextMenuMatchArmMissing]: (name: string) =>\n `match() has no arm for the context menu command ${JSON.stringify(name)}.`,\n [SeedcordErrorCode.EventMiddlewareNameUnavailable]: () =>\n `this.eventName is only available on middleware the controller constructed with a fired event name.`,\n [SeedcordErrorCode.AutocompleteNoFocusedOption]: () => `Autocomplete payload has no focused option.`,\n [SeedcordErrorCode.ModalFieldNotFound]: (customId: string) =>\n `The submitted modal carries no field with the custom id ${JSON.stringify(customId)}. Check it against the id you gave the component when you built the modal.`,\n [SeedcordErrorCode.ModalFieldWrongKind]: (customId: string, kind: string, getter?: string) =>\n getter\n ? `Modal field ${JSON.stringify(customId)} holds ${kind}. Read it with ${getter}().`\n : `Modal field ${JSON.stringify(customId)} holds ${kind}. No getter reads that kind.`,\n [SeedcordErrorCode.ModalFieldEmpty]: (customId: string) =>\n `Modal field ${JSON.stringify(customId)} carries no selection. Build the component as required, or read it without the required argument.`,\n [SeedcordErrorCode.ModalFieldChannelType]: (customId: string, picked: string, allowed: string) =>\n `Modal field ${JSON.stringify(customId)} picked a ${picked} channel. This read allows ${allowed}.`,\n\n [SeedcordErrorCode.GateInvalidCooldownDuration]: (input: string) =>\n `Cooldown duration ${JSON.stringify(input)} is not valid. Pass a number of seconds or a duration string like '30m', '24h', or '500ms'.`,\n\n [SeedcordErrorCode.PaginationInvalidPerPage]: (perPage: number) =>\n `perPage must be a positive integer, got ${perPage}.`,\n [SeedcordErrorCode.PaginationTooManyControls]: (count: number) =>\n `A control row holds at most 5 buttons, got ${count}.`,\n [SeedcordErrorCode.PaginationEmptyControls]: () => `A control row must hold at least one control.`,\n [SeedcordErrorCode.PaginationDuplicateControls]: (key: string) =>\n `A control row cannot repeat the '${key}' control.`,\n\n [SeedcordErrorCode.ColorUnresolvable]: (value: string) => `Cannot convert ${value} into a color.`,\n [SeedcordErrorCode.ColorOutOfRange]: () => 'Color must be within the range 0 to 16777215 (0xffffff).',\n\n [SeedcordErrorCode.PluginOptionsRejected]: (pluginName: string, reason: string) =>\n `${pluginName} rejected its options, ${reason.replace(/\\.$/, '')}.`,\n [SeedcordErrorCode.PluginDisposeFailures]: (count: number) => `${count} plugins failed to dispose.`,\n [SeedcordErrorCode.PluginInvalidLifecycleTimeout]: (pluginName: string, field: string, declared: number) =>\n `${pluginName} declared lifecycle ${field}.timeout as ${declared}. Pass a positive number of milliseconds, or omit it for the default.`,\n\n [SeedcordErrorCode.PluginMongooseServiceDecoratorMissing]: (className: string) =>\n `Missing @RegisterMongooseService on ${className}.`,\n [SeedcordErrorCode.PluginMongooseConnectionFailed]: (databaseName?: string) =>\n databaseName ? `Could not connect to MongoDB (${databaseName}).` : 'Could not connect to MongoDB.',\n [SeedcordErrorCode.PluginMongooseDisconnectFailed]: () =>\n 'Failed to disconnect from MongoDB cleanly during shutdown.',\n [SeedcordErrorCode.PluginMongooseServicesNotReady]: () =>\n 'Mongoose services accessed before the plugin finished initializing.',\n [SeedcordErrorCode.PluginMongooseModelCreationFailed]: (modelName: string, className: string) =>\n `Could not build the mongoose model ${modelName} for ${className}.`,\n [SeedcordErrorCode.PluginMongooseModelNameMissing]: (className: string) =>\n `Empty model name on ${className}. Provide a non-empty modelName via @RegisterMongooseService().`,\n\n [SeedcordErrorCode.PluginKyselyServiceDecoratorMissing]: (className: string) =>\n `Missing @RegisterKyselyService on ${className}.`,\n [SeedcordErrorCode.PluginKyselyServiceTableMissing]: (className: string) =>\n `Missing table metadata for ${className}. Provide a table via @RegisterKyselyService().`,\n [SeedcordErrorCode.PluginKyselyInvalidStepCount]: () => 'Migration step count must be a non-negative integer.',\n [SeedcordErrorCode.PluginKyselyUnknownDirection]: (direction: unknown) =>\n `Unknown migration direction: ${String(direction)}.`,\n [SeedcordErrorCode.PluginKyselyUnresolvedMigrationsPath]: (label: string) =>\n `Unable to resolve migrations at path: ${label}.`,\n [SeedcordErrorCode.PluginKyselyNoMigrationFiles]: () => 'No migration files provided.',\n [SeedcordErrorCode.PluginKyselyInvalidMigrationModule]: (filePath: string) =>\n `Migration file ${filePath} must export async functions up and down.`,\n [SeedcordErrorCode.PluginKyselyNonErrorFailure]: (message: string) => `Migration failure: ${message}.`,\n [SeedcordErrorCode.PluginKyselyDisconnectFailed]: () =>\n 'Failed to close the Postgres pool cleanly during shutdown.',\n [SeedcordErrorCode.PluginKyselyServicesNotReady]: () =>\n 'Kysely services accessed before the plugin finished initializing.',\n [SeedcordErrorCode.PluginKyselyConnectionFailed]: (databaseName?: string) =>\n databaseName ? `Could not connect to Postgres (${databaseName}).` : 'Could not connect to Postgres.',\n [SeedcordErrorCode.PluginKyselyBootstrapFailed]: (databaseName: string) =>\n `Failed to ensure database ${databaseName} exists.`,\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.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.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} (the jiti fallback 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.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.CliCodegenCommandConstructorThrew]: (name: string, file: string, reason: string) =>\n `${name} threw while codegen constructed it. Fix its constructor in ${file}. ${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 [SeedcordErrorCode.CliCleanAppFetchFailed]: (reason: string) =>\n `Could not resolve the application from the bot token. ${reason}`,\n [SeedcordErrorCode.CliCleanNoGuilds]: () =>\n 'No guilds given. Pass --guild <ids...> or --all-guilds. Global commands are never touched.',\n [SeedcordErrorCode.CliCleanPurgeAllGuilds]: () =>\n '--purge cannot be combined with --all-guilds. Use --guild <ids> to purge specific guilds.',\n [SeedcordErrorCode.CliCancelled]: () => 'Cancelled.',\n [SeedcordErrorCode.CliCleanLargeBotUnconfirmed]: (count: number) =>\n `Refusing to scan ${count} guilds without confirmation. Re-run with --yes, or name specific guilds with --guild <ids>.`,\n [SeedcordErrorCode.CliCleanApplyNeedsYes]: () =>\n 'Refusing to delete without confirmation in a non-interactive environment. Re-run with --yes.',\n [SeedcordErrorCode.CliTunnelUrlUnavailable]: (seconds: number) =>\n `cloudflared did not report a tunnel URL within ${seconds}s. Check that the binary runs and that the network allows it.`,\n [SeedcordErrorCode.CliTunnelNotVerified]: (url: string) => `Discord rejected ${url} as an interactions endpoint.`,\n [SeedcordErrorCode.CliTunnelUnreachable]: (url: string, seconds: number) =>\n `${url} did not answer within ${seconds}s, so nothing was PATCHed to Discord.`,\n [SeedcordErrorCode.CliConfigInvalidField]: (field: string, expected: string) =>\n `Config \\`${field}\\` must be ${expected} when provided.`,\n [SeedcordErrorCode.CreateCancelled]: () => 'Cancelled.',\n [SeedcordErrorCode.CreateFlagNotApplicable]: (flag: string) =>\n `The --${flag} flag does not apply to the answers you gave.`,\n [SeedcordErrorCode.CreateInvalidAnswer]: (flag: string, reason: string) => `--${flag}: ${reason}`,\n // node's parseArgs message ends on an unclosed quote\n [SeedcordErrorCode.CreateBadUsage]: (reason: string) => `${reason}\\nRun with --help for the flag list.`,\n [SeedcordErrorCode.CreateTargetNotEmpty]: (target: string) =>\n `${target} already has files in it. Pick an empty directory or a name that does not exist yet.`,\n [SeedcordErrorCode.CreateStepFailed]: (command: string, reason: string) => `\\`${command}\\` failed.\\n${reason}`\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","import { SeedcordErrorCode } from './ErrorCodes';\nimport { formatSeedcordErrorMessage, type SeedcordErrorArguments } from './ErrorMessages';\nimport { paint } from './palette';\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 `${paint.coral.bold(name)}[${paint.mute(code)}]`;\n}\n\n/**\n * String literal type for Seedcord error class names. Names the `type` argument of\n * {@link isSeedcordError}.\n */\nexport type SeedcordErrorTypeString = `Seedcord${'Error' | 'TypeError' | 'RangeError' | 'AggregateError'}`;\n\n// Symbol.for so two installed copies read the same slot\nconst kIdentifier: unique symbol = Symbol.for('seedcord.errors.identifier');\n\ninterface BaseSeedcordError {\n readonly code: SeedcordErrorCode;\n readonly [kIdentifier]: SeedcordErrorIdentifier;\n readonly type: SeedcordErrorTypeString;\n}\n\n// instanceof fails across two installed copies of this package\nconst CODED = Symbol.for('seedcord.errors.coded');\n\nfunction brand(prototype: object): void {\n Object.defineProperty(prototype, CODED, { value: true });\n}\n\nfunction isCoded(error: unknown): error is BaseSeedcordError {\n return typeof error === 'object' && error !== null && CODED in error;\n}\n\nexport class SeedcordError<Code extends SeedcordErrorCode = SeedcordErrorCode>\n extends Error\n implements BaseSeedcordError\n{\n public readonly code: Code;\n readonly [kIdentifier]: 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[kIdentifier] = resolveIdentifier(code);\n this.name = formatErrorName(new.target.name, this[kIdentifier], 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\nbrand(SeedcordError.prototype);\n\nexport class SeedcordTypeError<Code extends SeedcordErrorCode = SeedcordErrorCode>\n extends TypeError\n implements BaseSeedcordError\n{\n public readonly code: Code;\n readonly [kIdentifier]: 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[kIdentifier] = resolveIdentifier(code);\n this.name = formatErrorName(new.target.name, this[kIdentifier], 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\nbrand(SeedcordTypeError.prototype);\n\nexport class SeedcordRangeError<Code extends SeedcordErrorCode = SeedcordErrorCode>\n extends RangeError\n implements BaseSeedcordError\n{\n public readonly code: Code;\n readonly [kIdentifier]: 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[kIdentifier] = resolveIdentifier(code);\n this.name = formatErrorName(new.target.name, this[kIdentifier], 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\nbrand(SeedcordRangeError.prototype);\n\nexport class SeedcordAggregateError<Code extends SeedcordErrorCode = SeedcordErrorCode>\n extends AggregateError\n implements BaseSeedcordError\n{\n public readonly code: Code;\n readonly [kIdentifier]: SeedcordErrorIdentifier;\n public readonly type = 'SeedcordAggregateError';\n\n constructor(code: Code, errors: readonly unknown[], ...rest: SeedcordErrorCtorRest<Code>) {\n const { args, options } = resolveCtorInputs(rest);\n const message = resolveMessage(code, args);\n super(errors, message, options);\n this.code = code;\n this[kIdentifier] = resolveIdentifier(code);\n this.name = formatErrorName(new.target.name, this[kIdentifier], 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\nbrand(SeedcordAggregateError.prototype);\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 : Type extends 'SeedcordRangeError'\n ? SeedcordRangeError<Code>\n : SeedcordAggregateError<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.\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 if (!isCoded(error)) return false;\n if (type && error.type !== type) return false;\n if (code === undefined) return true;\n // another copy of this package may number the same identifier differently\n return error[kIdentifier] === resolveIdentifier(code);\n}\n"],"mappings":";;;;;;AAKA,IAAY,oBAAL;;CAEH;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAGA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAGA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAGA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAGA;;CAEA;;CAEA;;CAEA;;CAEA;;CAGA;;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;;CAGA;;CAGA;;CAEA;;CAEA;;CAEA;;CAGA;;CAEA;;CAGA;;CAEA;;CAEA;;CAGA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAGA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAGA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA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