@seedcord/errors 0.4.2 → 0.5.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.
@@ -17,6 +17,10 @@ declare enum SeedcordErrorCode {
17
17
  ConfigInvalidEnv = 1006,
18
18
  /** A command usable in a guild is registered without the `Guilds` intent that caches guilds. */
19
19
  MissingGuildsIntent = 1007,
20
+ /** The running Node version is below the range seedcord declares in `engines`. */
21
+ UnsupportedNodeVersion = 1008,
22
+ /** `DISCORD_BOT_TOKEN` passed its shape check and carries no readable application id. */
23
+ ConfigTokenUnreadable = 1009,
20
24
  /** Attempted to add lifecycle tasks after startup already completed. */
21
25
  LifecycleAddAfterCompletion = 1101,
22
26
  /** Attempted to add lifecycle tasks while startup is still running. */
@@ -47,10 +51,14 @@ declare enum SeedcordErrorCode {
47
51
  CoreDirectoryUnreadable = 1207,
48
52
  /** A plugin was attached under a key the framework logs on. */
49
53
  CorePluginReservedChannel = 1208,
50
- /** A command deploy ran before the client resolved its application. */
54
+ /** The application id was read before startup resolved it. */
51
55
  CoreApplicationUnavailable = 1209,
52
56
  /** A generated accessor was read before startup resolved its values. */
53
57
  CoreAccessorUnresolved = 1210,
58
+ /** A startup or shutdown task was added to a core built by `createSeedcord`. */
59
+ CoreLifecycleUnavailable = 1211,
60
+ /** `emit` was called on the bus. It reaches listeners and skips every subscriber. */
61
+ CoreBusEmitUnavailable = 1212,
54
62
  /** Interaction middleware decorated with disallowed event filters. */
55
63
  DecoratorInteractionEventFilter = 1301,
56
64
  /** A command decorator attempted to re-register an existing command scope. */
@@ -111,6 +119,16 @@ declare enum SeedcordErrorCode {
111
119
  EventMiddlewareNameUnavailable = 1613,
112
120
  /** An autocomplete payload carried no focused option. */
113
121
  AutocompleteNoFocusedOption = 1614,
122
+ /** A context menu handler's match() has no arm for the command name that fired. */
123
+ ContextMenuMatchArmMissing = 1615,
124
+ /** No field in the submitted modal carries the requested custom id. */
125
+ ModalFieldNotFound = 1616,
126
+ /** A modal field getter was called on a field of another kind. */
127
+ ModalFieldWrongKind = 1617,
128
+ /** Nothing was picked in a modal field read as required. */
129
+ ModalFieldEmpty = 1618,
130
+ /** A channel select field picked a channel outside the types getSelectedChannels() allows. */
131
+ ModalFieldChannelType = 1619,
114
132
  /** A Cooldown gate was given a duration string that is not a well-formed positive duration. */
115
133
  GateInvalidCooldownDuration = 1701,
116
134
  /** A paginator source was given a perPage that is not a positive integer. */
@@ -129,6 +147,8 @@ declare enum SeedcordErrorCode {
129
147
  PluginOptionsRejected = 2001,
130
148
  /** Two or more plugins threw while disposing. */
131
149
  PluginDisposeFailures = 2002,
150
+ /** A plugin declared a lifecycle timeout that is not a positive, finite number of milliseconds. */
151
+ PluginInvalidLifecycleTimeout = 2003,
132
152
  /** Mongoose service class is missing the `@RegisterMongooseService` decorator. */
133
153
  PluginMongooseServiceDecoratorMissing = 2101,
134
154
  /** Mongoose client failed to establish a connection. */
@@ -217,6 +237,8 @@ declare enum SeedcordErrorCode {
217
237
  CliTunnelUnreachable = 3125,
218
238
  /** A config field is present with the wrong shape. */
219
239
  CliConfigInvalidField = 3126,
240
+ /** A class carrying `@RegisterCommand` threw while codegen constructed it. */
241
+ CliCodegenCommandConstructorThrew = 3127,
220
242
  /** A create prompt was cancelled (Ctrl-C), and nothing has been written yet. */
221
243
  CreateCancelled = 3201,
222
244
  /** A flag supplied an answer for a question the earlier answers skip. */
@@ -261,7 +283,9 @@ declare const messages: {
261
283
  1002: (envKey: string) => string;
262
284
  1003: (envKey: string) => string;
263
285
  1001: (count: number, failures: string) => string;
286
+ 1009: () => string;
264
287
  1007: (commands: string) => string;
288
+ 1008: (required: string, running: string) => string;
265
289
  1101: () => string;
266
290
  1102: () => string;
267
291
  1103: () => string;
@@ -279,6 +303,8 @@ declare const messages: {
279
303
  1208: (key: string) => string;
280
304
  1209: () => string;
281
305
  1210: (accessor: string, key: string) => string;
306
+ 1211: (accessor: string) => string;
307
+ 1212: (event: string) => string;
282
308
  1301: () => string;
283
309
  1302: (commandName: string, existingScope: string, requestedScope: string) => string;
284
310
  1303: () => string;
@@ -307,8 +333,13 @@ declare const messages: {
307
333
  1610: (route: string) => string;
308
334
  1611: (field: string) => string;
309
335
  1612: (event: string) => string;
336
+ 1615: (name: string) => string;
310
337
  1613: () => string;
311
338
  1614: () => string;
339
+ 1616: (customId: string) => string;
340
+ 1617: (customId: string, kind: string, getter?: string) => string;
341
+ 1618: (customId: string) => string;
342
+ 1619: (customId: string, picked: string, allowed: string) => string;
312
343
  1701: (input: string) => string;
313
344
  1801: (perPage: number) => string;
314
345
  1802: (count: number) => string;
@@ -318,6 +349,7 @@ declare const messages: {
318
349
  1902: () => string;
319
350
  2001: (pluginName: string, reason: string) => string;
320
351
  2002: (count: number) => string;
352
+ 2003: (pluginName: string, field: string, declared: number) => string;
321
353
  2101: (className: string) => string;
322
354
  2102: (databaseName?: string) => string;
323
355
  2103: () => string;
@@ -351,6 +383,7 @@ declare const messages: {
351
383
  3113: (targetPath: string, reason: string) => string;
352
384
  3114: (route: string, firstFile: string, secondFile: string) => string;
353
385
  3115: (dir: string, reason: string) => string;
386
+ 3127: (name: string, file: string, reason: string) => string;
354
387
  3116: (kind: string, name: string, firstFile: string, secondFile: string) => string;
355
388
  3117: (reason: string) => string;
356
389
  3118: () => string;
@@ -457,4 +490,4 @@ type ErrorCodeFilter<Type extends SeedcordErrorTypeString | undefined, Code exte
457
490
  declare function isSeedcordError<Type extends SeedcordErrorTypeString | undefined, Code extends SeedcordErrorCode | undefined>(error: unknown, type?: Type, code?: Code): error is ErrorCodeFilter<Type, Code>;
458
491
  //#endregion
459
492
  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 };
460
- //# sourceMappingURL=SeedcordError-Crsy6bVo.d.mts.map
493
+ //# sourceMappingURL=SeedcordError-CjuIRGPo.d.mts.map
@@ -19,6 +19,10 @@ let SeedcordErrorCode = /* @__PURE__ */ function(SeedcordErrorCode) {
19
19
  SeedcordErrorCode[SeedcordErrorCode["ConfigInvalidEnv"] = 1006] = "ConfigInvalidEnv";
20
20
  /** A command usable in a guild is registered without the `Guilds` intent that caches guilds. */
21
21
  SeedcordErrorCode[SeedcordErrorCode["MissingGuildsIntent"] = 1007] = "MissingGuildsIntent";
22
+ /** The running Node version is below the range seedcord declares in `engines`. */
23
+ SeedcordErrorCode[SeedcordErrorCode["UnsupportedNodeVersion"] = 1008] = "UnsupportedNodeVersion";
24
+ /** `DISCORD_BOT_TOKEN` passed its shape check and carries no readable application id. */
25
+ SeedcordErrorCode[SeedcordErrorCode["ConfigTokenUnreadable"] = 1009] = "ConfigTokenUnreadable";
22
26
  /** Attempted to add lifecycle tasks after startup already completed. */
23
27
  SeedcordErrorCode[SeedcordErrorCode["LifecycleAddAfterCompletion"] = 1101] = "LifecycleAddAfterCompletion";
24
28
  /** Attempted to add lifecycle tasks while startup is still running. */
@@ -49,10 +53,14 @@ let SeedcordErrorCode = /* @__PURE__ */ function(SeedcordErrorCode) {
49
53
  SeedcordErrorCode[SeedcordErrorCode["CoreDirectoryUnreadable"] = 1207] = "CoreDirectoryUnreadable";
50
54
  /** A plugin was attached under a key the framework logs on. */
51
55
  SeedcordErrorCode[SeedcordErrorCode["CorePluginReservedChannel"] = 1208] = "CorePluginReservedChannel";
52
- /** A command deploy ran before the client resolved its application. */
56
+ /** The application id was read before startup resolved it. */
53
57
  SeedcordErrorCode[SeedcordErrorCode["CoreApplicationUnavailable"] = 1209] = "CoreApplicationUnavailable";
54
58
  /** A generated accessor was read before startup resolved its values. */
55
59
  SeedcordErrorCode[SeedcordErrorCode["CoreAccessorUnresolved"] = 1210] = "CoreAccessorUnresolved";
60
+ /** A startup or shutdown task was added to a core built by `createSeedcord`. */
61
+ SeedcordErrorCode[SeedcordErrorCode["CoreLifecycleUnavailable"] = 1211] = "CoreLifecycleUnavailable";
62
+ /** `emit` was called on the bus. It reaches listeners and skips every subscriber. */
63
+ SeedcordErrorCode[SeedcordErrorCode["CoreBusEmitUnavailable"] = 1212] = "CoreBusEmitUnavailable";
56
64
  /** Interaction middleware decorated with disallowed event filters. */
57
65
  SeedcordErrorCode[SeedcordErrorCode["DecoratorInteractionEventFilter"] = 1301] = "DecoratorInteractionEventFilter";
58
66
  /** A command decorator attempted to re-register an existing command scope. */
@@ -113,6 +121,16 @@ let SeedcordErrorCode = /* @__PURE__ */ function(SeedcordErrorCode) {
113
121
  SeedcordErrorCode[SeedcordErrorCode["EventMiddlewareNameUnavailable"] = 1613] = "EventMiddlewareNameUnavailable";
114
122
  /** An autocomplete payload carried no focused option. */
115
123
  SeedcordErrorCode[SeedcordErrorCode["AutocompleteNoFocusedOption"] = 1614] = "AutocompleteNoFocusedOption";
124
+ /** A context menu handler's match() has no arm for the command name that fired. */
125
+ SeedcordErrorCode[SeedcordErrorCode["ContextMenuMatchArmMissing"] = 1615] = "ContextMenuMatchArmMissing";
126
+ /** No field in the submitted modal carries the requested custom id. */
127
+ SeedcordErrorCode[SeedcordErrorCode["ModalFieldNotFound"] = 1616] = "ModalFieldNotFound";
128
+ /** A modal field getter was called on a field of another kind. */
129
+ SeedcordErrorCode[SeedcordErrorCode["ModalFieldWrongKind"] = 1617] = "ModalFieldWrongKind";
130
+ /** Nothing was picked in a modal field read as required. */
131
+ SeedcordErrorCode[SeedcordErrorCode["ModalFieldEmpty"] = 1618] = "ModalFieldEmpty";
132
+ /** A channel select field picked a channel outside the types getSelectedChannels() allows. */
133
+ SeedcordErrorCode[SeedcordErrorCode["ModalFieldChannelType"] = 1619] = "ModalFieldChannelType";
116
134
  /** A Cooldown gate was given a duration string that is not a well-formed positive duration. */
117
135
  SeedcordErrorCode[SeedcordErrorCode["GateInvalidCooldownDuration"] = 1701] = "GateInvalidCooldownDuration";
118
136
  /** A paginator source was given a perPage that is not a positive integer. */
@@ -131,6 +149,8 @@ let SeedcordErrorCode = /* @__PURE__ */ function(SeedcordErrorCode) {
131
149
  SeedcordErrorCode[SeedcordErrorCode["PluginOptionsRejected"] = 2001] = "PluginOptionsRejected";
132
150
  /** Two or more plugins threw while disposing. */
133
151
  SeedcordErrorCode[SeedcordErrorCode["PluginDisposeFailures"] = 2002] = "PluginDisposeFailures";
152
+ /** A plugin declared a lifecycle timeout that is not a positive, finite number of milliseconds. */
153
+ SeedcordErrorCode[SeedcordErrorCode["PluginInvalidLifecycleTimeout"] = 2003] = "PluginInvalidLifecycleTimeout";
134
154
  /** Mongoose service class is missing the `@RegisterMongooseService` decorator. */
135
155
  SeedcordErrorCode[SeedcordErrorCode["PluginMongooseServiceDecoratorMissing"] = 2101] = "PluginMongooseServiceDecoratorMissing";
136
156
  /** Mongoose client failed to establish a connection. */
@@ -219,6 +239,8 @@ let SeedcordErrorCode = /* @__PURE__ */ function(SeedcordErrorCode) {
219
239
  SeedcordErrorCode[SeedcordErrorCode["CliTunnelUnreachable"] = 3125] = "CliTunnelUnreachable";
220
240
  /** A config field is present with the wrong shape. */
221
241
  SeedcordErrorCode[SeedcordErrorCode["CliConfigInvalidField"] = 3126] = "CliConfigInvalidField";
242
+ /** A class carrying `@RegisterCommand` threw while codegen constructed it. */
243
+ SeedcordErrorCode[SeedcordErrorCode["CliCodegenCommandConstructorThrew"] = 3127] = "CliCodegenCommandConstructorThrew";
222
244
  /** A create prompt was cancelled (Ctrl-C), and nothing has been written yet. */
223
245
  SeedcordErrorCode[SeedcordErrorCode["CreateCancelled"] = 3201] = "CreateCancelled";
224
246
  /** A flag supplied an answer for a question the earlier answers skip. */
@@ -266,7 +288,9 @@ const messages = {
266
288
  [1002]: (envKey) => `${envKey} is not a well-formed Discord webhook url.`,
267
289
  [1003]: (envKey) => `The webhook behind ${envKey} does not exist on Discord.`,
268
290
  [1001]: (count, failures) => `Could not resolve ${count} configured emoji${count === 1 ? "" : "s"} at startup.\n${failures}`,
291
+ [1009]: () => "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.",
269
292
  [1007]: (commands) => `Add GatewayIntentBits.Guilds to clientOptions.intents. Without it discord.js doesn't cache any guild, so interaction.guild is null inside these commands: ${commands}.`,
293
+ [1008]: (required, running) => `seedcord requires Node ${required} and this process runs ${running}. Upgrade Node before starting the bot.`,
270
294
  [1101]: () => "Cannot add tasks after startup sequence has already completed.",
271
295
  [1102]: () => "Cannot add tasks while startup sequence is in progress.",
272
296
  [1103]: () => "Cannot remove tasks while startup sequence is in progress.",
@@ -282,8 +306,10 @@ const messages = {
282
306
  [1206]: (file) => `${file} threw while importing.`,
283
307
  [1207]: (dir) => `${dir} could not be read.`,
284
308
  [1208]: (key) => `Plugin key "${key}" is a channel the framework logs on. Pick another key.`,
285
- [1209]: () => "The bot's application id could not be resolved.",
309
+ [1209]: () => "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.",
286
310
  [1210]: (accessor, key) => `${accessor}.${key} has no value yet. ${accessor} fills during startup, and a read at the top of a file runs before that.`,
311
+ [1211]: (accessor) => `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().`,
312
+ [1212]: (event) => `core.bus.emit('${event}') would reach your on() listeners and skip every Subscriber class. Call core.bus.publish('${event}', data) to run both.`,
287
313
  [1301]: () => "Interaction middleware cannot specify event filters.",
288
314
  [1302]: (commandName, existingScope, requestedScope) => `Command "${commandName}" is already registered as a "${existingScope}" command and cannot be re-registered as a "${requestedScope}" command.`,
289
315
  [1303]: () => "RegisterCommand(\"global\") cannot have guilds specified.",
@@ -312,8 +338,13 @@ const messages = {
312
338
  [1610]: (route) => `match() has no arm for the command route ${JSON.stringify(route)}.`,
313
339
  [1611]: (field) => `match() has no arm for the focused field ${JSON.stringify(field)}.`,
314
340
  [1612]: (event) => `match() has no arm for the event ${JSON.stringify(event)}.`,
341
+ [1615]: (name) => `match() has no arm for the context menu command ${JSON.stringify(name)}.`,
315
342
  [1613]: () => `this.eventName is only available on middleware the controller constructed with a fired event name.`,
316
343
  [1614]: () => `Autocomplete payload has no focused option.`,
344
+ [1616]: (customId) => `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.`,
345
+ [1617]: (customId, kind, getter) => getter ? `Modal field ${JSON.stringify(customId)} holds ${kind}. Read it with ${getter}().` : `Modal field ${JSON.stringify(customId)} holds ${kind}. No getter reads that kind.`,
346
+ [1618]: (customId) => `Modal field ${JSON.stringify(customId)} carries no selection. Build the component as required, or read it without the required argument.`,
347
+ [1619]: (customId, picked, allowed) => `Modal field ${JSON.stringify(customId)} picked a ${picked} channel. This read allows ${allowed}.`,
317
348
  [1701]: (input) => `Cooldown duration ${JSON.stringify(input)} is not valid. Pass a number of seconds or a duration string like '30m', '24h', or '500ms'.`,
318
349
  [1801]: (perPage) => `perPage must be a positive integer, got ${perPage}.`,
319
350
  [1802]: (count) => `A control row holds at most 5 buttons, got ${count}.`,
@@ -323,6 +354,7 @@ const messages = {
323
354
  [1902]: () => "Color must be within the range 0 to 16777215 (0xffffff).",
324
355
  [2001]: (pluginName, reason) => `${pluginName} rejected its options, ${reason.replace(/\.$/, "")}.`,
325
356
  [2002]: (count) => `${count} plugins failed to dispose.`,
357
+ [2003]: (pluginName, field, declared) => `${pluginName} declared lifecycle ${field}.timeout as ${declared}. Pass a positive number of milliseconds, or omit it for the default.`,
326
358
  [2101]: (className) => `Missing @RegisterMongooseService on ${className}.`,
327
359
  [2102]: (databaseName) => databaseName ? `Could not connect to MongoDB (${databaseName}).` : "Could not connect to MongoDB.",
328
360
  [2103]: () => "Failed to disconnect from MongoDB cleanly during shutdown.",
@@ -356,6 +388,7 @@ const messages = {
356
388
  [3113]: (targetPath, reason) => `Failed to write bootstrap file at ${targetPath}: ${reason}`,
357
389
  [3114]: (route, firstFile, secondFile) => `Two commands resolve to the same slash route \`${route}\`. Defined in ${firstFile} and ${secondFile}. Rename one.`,
358
390
  [3115]: (dir, reason) => `Could not read the commands directory ${dir} during codegen. ${reason}`,
391
+ [3127]: (name, file, reason) => `${name} threw while codegen constructed it. Fix its constructor in ${file}. ${reason}`,
359
392
  [3116]: (kind, name, firstFile, secondFile) => `Two ${kind} context-menu commands share the name \`${name}\`. Defined in ${firstFile} and ${secondFile}. Rename one.`,
360
393
  [3117]: (reason) => `Could not resolve the application from the bot token. ${reason}`,
361
394
  [3118]: () => "No guilds given. Pass --guild <ids...> or --all-guilds. Global commands are never touched.",
@@ -492,4 +525,4 @@ function isSeedcordError(error, type, code) {
492
525
 
493
526
  //#endregion
494
527
  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 };
495
- //# sourceMappingURL=SeedcordError-BodX4M6e.mjs.map
528
+ //# sourceMappingURL=SeedcordError-DnV6q4mB.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SeedcordError-DnV6q4mB.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\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.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;;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;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;C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,CAAU;CACV,AAAgB,OAAO;CAEvB,YAAY,MAAY,QAA4B,GAAG,MAAmC;EACtF,MAAM,EAAE,MAAM,YAAY,kBAAkB,IAAI;EAChD,MAAM,UAAU,eAAe,MAAM,IAAI;EACzC,MAAM,QAAQ,SAAS,OAAO;EAC9B,KAAK,OAAO;EACZ,KAAK,eAAe,kBAAkB,IAAI;EAC1C,KAAK,OAAO,gBAAgB,WAAW,MAAM,KAAK,cAAc,KAAK,IAAI;EACzE,OAAO,eAAe,MAAM,WAAW,SAAS;EAChD,IAAI,OAAO,MAAM,sBAAsB,YACnC,MAAM,kBAAkB,MAAM,UAAU;CAEhD;AACJ;AAEA,MAAM,uBAAuB,SAAS;;;;;;;;;;AA6DtC,SAAgB,gBAGd,OAAgB,MAAa,MAAmD;CAC9E,IAAI,CAAC,QAAQ,KAAK,GAAG,OAAO;CAC5B,IAAI,QAAQ,MAAM,SAAS,MAAM,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-Crsy6bVo.mjs";
1
+ import { c as paint, l as SeedcordErrorCode, o as isSeedcordError, r as SeedcordErrorTypeString } from "./SeedcordError-CjuIRGPo.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-BodX4M6e.mjs";
1
+ import { a as isSeedcordError, c as SeedcordErrorCode, s as paint } from "./SeedcordError-DnV6q4mB.mjs";
2
2
 
3
3
  //#region src/index.ts
4
4
  /** Package version */
5
- const version = "0.4.2";
5
+ const version = "0.5.0";
6
6
 
7
7
  //#endregion
8
8
  export { SeedcordErrorCode, isSeedcordError, paint, version };
@@ -1,7 +1,10 @@
1
- import { a as SeedcordTypeError, i as SeedcordRangeError, n as SeedcordError, s as BRAND, t as SeedcordAggregateError } from "./SeedcordError-Crsy6bVo.mjs";
1
+ import { a as SeedcordTypeError, i as SeedcordRangeError, n as SeedcordError, s as BRAND, t as SeedcordAggregateError } from "./SeedcordError-CjuIRGPo.mjs";
2
2
  //#region src/validateDiscordToken.d.ts
3
3
  /** @internal */
4
4
  declare function validateDiscordToken(raw: unknown): string;
5
5
  //#endregion
6
- export { BRAND, SeedcordAggregateError, SeedcordError, SeedcordRangeError, SeedcordTypeError, validateDiscordToken };
6
+ //#region src/applicationIdFromToken.d.ts
7
+ declare function applicationIdFromToken(token: string): string;
8
+ //#endregion
9
+ export { BRAND, SeedcordAggregateError, SeedcordError, SeedcordRangeError, SeedcordTypeError, applicationIdFromToken, validateDiscordToken };
7
10
  //# sourceMappingURL=internal.index.d.mts.map
@@ -1,17 +1,39 @@
1
- import { c as SeedcordErrorCode, i as SeedcordTypeError, n as SeedcordError, o as BRAND, r as SeedcordRangeError, t as SeedcordAggregateError } from "./SeedcordError-BodX4M6e.mjs";
1
+ import { c as SeedcordErrorCode, i as SeedcordTypeError, n as SeedcordError, o as BRAND, r as SeedcordRangeError, t as SeedcordAggregateError } from "./SeedcordError-DnV6q4mB.mjs";
2
2
 
3
3
  //#region src/validateDiscordToken.ts
4
4
  const ENV_NAME = "DISCORD_BOT_TOKEN";
5
5
  /** @internal */
6
6
  function validateDiscordToken(raw) {
7
7
  if (raw === null || raw === void 0) throw new SeedcordError(1005, [ENV_NAME]);
8
- if (typeof raw !== "string") throw new SeedcordError(1006, [ENV_NAME]);
8
+ if (typeof raw !== "string") throw new SeedcordTypeError(1006, [ENV_NAME]);
9
9
  const value = raw.trim();
10
10
  if (value === "") throw new SeedcordError(1005, [ENV_NAME]);
11
- if (!/^[A-Za-z\d_-]{24,}\.[A-Za-z\d_-]{6,}\.[A-Za-z\d_-]{27,}$/.test(value)) throw new SeedcordError(1006, [ENV_NAME]);
11
+ if (!/^[A-Za-z\d_-]{24,}\.[A-Za-z\d_-]{6,}\.[A-Za-z\d_-]{27,}$/.test(value)) throw new SeedcordTypeError(1006, [ENV_NAME]);
12
12
  return value;
13
13
  }
14
14
 
15
15
  //#endregion
16
- export { BRAND, SeedcordAggregateError, SeedcordError, SeedcordRangeError, SeedcordTypeError, validateDiscordToken };
16
+ //#region src/applicationIdFromToken.ts
17
+ const URL_SAFE = /[-_]/g;
18
+ const STANDARD = {
19
+ "-": "+",
20
+ _: "/"
21
+ };
22
+ const SNOWFLAKE = /^\d+$/;
23
+ function decode(segment) {
24
+ try {
25
+ return atob(segment.replaceAll(URL_SAFE, (char) => STANDARD[char] ?? char));
26
+ } catch (error) {
27
+ throw new SeedcordTypeError(1009, { cause: error });
28
+ }
29
+ }
30
+ function applicationIdFromToken(token) {
31
+ const [first = ""] = token.split(".");
32
+ const decoded = decode(first);
33
+ if (!SNOWFLAKE.test(decoded)) throw new SeedcordTypeError(1009);
34
+ return decoded;
35
+ }
36
+
37
+ //#endregion
38
+ export { BRAND, SeedcordAggregateError, SeedcordError, SeedcordRangeError, SeedcordTypeError, applicationIdFromToken, validateDiscordToken };
17
39
  //# sourceMappingURL=internal.index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal.index.mjs","names":[],"sources":["../src/validateDiscordToken.ts"],"sourcesContent":["import { SeedcordErrorCode } from './ErrorCodes';\nimport { SeedcordError } from './SeedcordError';\n\nconst ENV_NAME = 'DISCORD_BOT_TOKEN';\n\n/** @internal */\nexport function validateDiscordToken(raw: unknown): string {\n if (raw === null || raw === undefined) {\n throw new SeedcordError(SeedcordErrorCode.ConfigMissingEnv, [ENV_NAME]);\n }\n\n if (typeof raw !== 'string') {\n throw new SeedcordError(SeedcordErrorCode.ConfigInvalidEnv, [ENV_NAME]);\n }\n\n const value = raw.trim();\n if (value === '') {\n throw new SeedcordError(SeedcordErrorCode.ConfigMissingEnv, [ENV_NAME]);\n }\n\n const tokenRegex = /^[A-Za-z\\d_-]{24,}\\.[A-Za-z\\d_-]{6,}\\.[A-Za-z\\d_-]{27,}$/;\n\n if (!tokenRegex.test(value)) {\n throw new SeedcordError(SeedcordErrorCode.ConfigInvalidEnv, [ENV_NAME]);\n }\n\n return value;\n}\n"],"mappings":";;;AAGA,MAAM,WAAW;;AAGjB,SAAgB,qBAAqB,KAAsB;CACvD,IAAI,QAAQ,QAAQ,QAAQ,QACxB,MAAM,IAAI,oBAAkD,CAAC,QAAQ,CAAC;CAG1E,IAAI,OAAO,QAAQ,UACf,MAAM,IAAI,oBAAkD,CAAC,QAAQ,CAAC;CAG1E,MAAM,QAAQ,IAAI,KAAK;CACvB,IAAI,UAAU,IACV,MAAM,IAAI,oBAAkD,CAAC,QAAQ,CAAC;CAK1E,IAAI,CAAC,2DAAW,KAAK,KAAK,GACtB,MAAM,IAAI,oBAAkD,CAAC,QAAQ,CAAC;CAG1E,OAAO;AACX"}
1
+ {"version":3,"file":"internal.index.mjs","names":[],"sources":["../src/validateDiscordToken.ts","../src/applicationIdFromToken.ts"],"sourcesContent":["import { SeedcordErrorCode } from './ErrorCodes';\nimport { SeedcordError, SeedcordTypeError } from './SeedcordError';\n\nconst ENV_NAME = 'DISCORD_BOT_TOKEN';\n\n/** @internal */\nexport function validateDiscordToken(raw: unknown): string {\n if (raw === null || raw === undefined) {\n throw new SeedcordError(SeedcordErrorCode.ConfigMissingEnv, [ENV_NAME]);\n }\n\n if (typeof raw !== 'string') {\n throw new SeedcordTypeError(SeedcordErrorCode.ConfigInvalidEnv, [ENV_NAME]);\n }\n\n const value = raw.trim();\n if (value === '') {\n throw new SeedcordError(SeedcordErrorCode.ConfigMissingEnv, [ENV_NAME]);\n }\n\n const tokenRegex = /^[A-Za-z\\d_-]{24,}\\.[A-Za-z\\d_-]{6,}\\.[A-Za-z\\d_-]{27,}$/;\n\n if (!tokenRegex.test(value)) {\n throw new SeedcordTypeError(SeedcordErrorCode.ConfigInvalidEnv, [ENV_NAME]);\n }\n\n return value;\n}\n","import { SeedcordErrorCode } from './ErrorCodes';\nimport { SeedcordTypeError } from './SeedcordError';\n\nconst URL_SAFE = /[-_]/g;\nconst STANDARD: Record<string, string> = { '-': '+', _: '/' };\nconst SNOWFLAKE = /^\\d+$/;\n\nfunction decode(segment: string): string {\n try {\n return atob(segment.replaceAll(URL_SAFE, (char) => STANDARD[char] ?? char));\n } catch (error) {\n throw new SeedcordTypeError(SeedcordErrorCode.ConfigTokenUnreadable, { cause: error });\n }\n}\n\n// discord builds a bot token as base64(applicationId) followed by two more dot-separated segments\nexport function applicationIdFromToken(token: string): string {\n const [first = ''] = token.split('.');\n const decoded = decode(first);\n\n // a mistyped token can still be valid base64\n if (!SNOWFLAKE.test(decoded)) throw new SeedcordTypeError(SeedcordErrorCode.ConfigTokenUnreadable);\n\n return decoded;\n}\n"],"mappings":";;;AAGA,MAAM,WAAW;;AAGjB,SAAgB,qBAAqB,KAAsB;CACvD,IAAI,QAAQ,QAAQ,QAAQ,QACxB,MAAM,IAAI,oBAAkD,CAAC,QAAQ,CAAC;CAG1E,IAAI,OAAO,QAAQ,UACf,MAAM,IAAI,wBAAsD,CAAC,QAAQ,CAAC;CAG9E,MAAM,QAAQ,IAAI,KAAK;CACvB,IAAI,UAAU,IACV,MAAM,IAAI,oBAAkD,CAAC,QAAQ,CAAC;CAK1E,IAAI,CAAC,2DAAW,KAAK,KAAK,GACtB,MAAM,IAAI,wBAAsD,CAAC,QAAQ,CAAC;CAG9E,OAAO;AACX;;;;ACxBA,MAAM,WAAW;AACjB,MAAM,WAAmC;CAAE,KAAK;CAAK,GAAG;AAAI;AAC5D,MAAM,YAAY;AAElB,SAAS,OAAO,SAAyB;CACrC,IAAI;EACA,OAAO,KAAK,QAAQ,WAAW,WAAW,SAAS,SAAS,SAAS,IAAI,CAAC;CAC9E,SAAS,OAAO;EACZ,MAAM,IAAI,wBAA2D,EAAE,OAAO,MAAM,CAAC;CACzF;AACJ;AAGA,SAAgB,uBAAuB,OAAuB;CAC1D,MAAM,CAAC,QAAQ,MAAM,MAAM,MAAM,GAAG;CACpC,MAAM,UAAU,OAAO,KAAK;CAG5B,IAAI,CAAC,UAAU,KAAK,OAAO,GAAG,MAAM,IAAI,sBAAyD;CAEjG,OAAO;AACX"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@seedcord/errors",
3
3
  "type": "module",
4
- "version": "0.4.2",
4
+ "version": "0.5.0",
5
5
  "engines": {
6
6
  "node": ">=24.11"
7
7
  },
@@ -50,9 +50,9 @@
50
50
  "chalk": "^6.0.0"
51
51
  },
52
52
  "devDependencies": {
53
- "@seedcord/eslint-config": "^1.5.6",
54
- "@seedcord/tsdown-config": "^2.0.1",
53
+ "@seedcord/eslint-config": "^2.1.0",
55
54
  "@seedcord/tsconfig": "^2.0.3",
55
+ "@seedcord/tsdown-config": "^2.0.1",
56
56
  "@seedcord/vitest-config": "^0.0.1"
57
57
  },
58
58
  "publishConfig": {
@@ -1 +0,0 @@
1
- {"version":3,"file":"SeedcordError-BodX4M6e.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\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 /** A command deploy ran before the client resolved its application. */\n CoreApplicationUnavailable = 1209,\n /** A generated accessor was read before startup resolved its values. */\n CoreAccessorUnresolved = 1210,\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\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\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\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.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\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]: () => \"The bot's application id could not be resolved.\",\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\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.SlashMatchArmMissing]: (route: string) =>\n `match() has no arm for the command route ${JSON.stringify(route)}.`,\n [SeedcordErrorCode.AutocompleteMatchArmMissing]: (field: string) =>\n `match() has no arm for the focused field ${JSON.stringify(field)}.`,\n [SeedcordErrorCode.EventMatchArmMissing]: (event: string) =>\n `match() has no arm for the event ${JSON.stringify(event)}.`,\n [SeedcordErrorCode.EventMiddlewareNameUnavailable]: () =>\n `this.eventName is only available on middleware the controller constructed with a fired event name.`,\n [SeedcordErrorCode.AutocompleteNoFocusedOption]: () => `Autocomplete payload has no focused option.`,\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\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.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;;CAGA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAGA;;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;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