@seedcord/errors 0.3.3 → 0.4.0-next.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.
- package/README.md +47 -8
- package/dist/{SeedcordError-Ce7zH47D.mjs → SeedcordError-BLQ8_el7.mjs} +146 -142
- package/dist/SeedcordError-BLQ8_el7.mjs.map +1 -0
- package/dist/{SeedcordError-0MrsUTlv.d.mts → SeedcordError-t1f0elt6.d.mts} +111 -126
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +3 -3
- package/dist/index.mjs.map +1 -1
- package/dist/internal.index.d.mts +2 -20
- package/dist/internal.index.mjs +7 -26
- package/dist/internal.index.mjs.map +1 -1
- package/package.json +18 -15
- package/dist/SeedcordError-Ce7zH47D.mjs.map +0 -1
- package/dist/SeedcordError-DWH-0O1z.cjs +0 -551
- package/dist/SeedcordError-DWH-0O1z.cjs.map +0 -1
- package/dist/index.cjs +0 -12
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -1
- package/dist/internal.index.cjs +0 -43
- package/dist/internal.index.cjs.map +0 -1
- package/dist/internal.index.d.cts +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SeedcordError-BLQ8_el7.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\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\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;;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;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CA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AK,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"}
|
|
@@ -3,22 +3,18 @@
|
|
|
3
3
|
* All Seedcord error codes.
|
|
4
4
|
*/
|
|
5
5
|
declare enum SeedcordErrorCode {
|
|
6
|
-
/** DISCORD_BOT_TOKEN is not present in the environment. */
|
|
7
|
-
ConfigMissingDiscordToken = 1001,
|
|
8
|
-
/** DISCORD_BOT_TOKEN is present but fails validation. */
|
|
9
|
-
ConfigIncorrectDiscordToken = 1002,
|
|
10
6
|
/** One or more configured emojis could not be resolved at startup. */
|
|
11
|
-
ConfigEmojiUnresolved =
|
|
7
|
+
ConfigEmojiUnresolved = 1001,
|
|
12
8
|
/** A webhook reporter's env var is set but fails webhook URL validation. */
|
|
13
|
-
ConfigWebhookUrlInvalid =
|
|
9
|
+
ConfigWebhookUrlInvalid = 1002,
|
|
14
10
|
/** A configured webhook does not exist on Discord (deleted, or a wrong id or token). */
|
|
15
|
-
ConfigWebhookNotFound =
|
|
16
|
-
/** DISCORD_PUBLIC_KEY is not present in the environment. */
|
|
17
|
-
ConfigMissingPublicKey = 1006,
|
|
18
|
-
/** DISCORD_PUBLIC_KEY is present but fails validation. */
|
|
19
|
-
ConfigIncorrectPublicKey = 1007,
|
|
11
|
+
ConfigWebhookNotFound = 1003,
|
|
20
12
|
/** The generated route manifest was imported before `seedcord build` generated it. */
|
|
21
|
-
ConfigManifestNotGenerated =
|
|
13
|
+
ConfigManifestNotGenerated = 1004,
|
|
14
|
+
/** A required environment variable is not present. */
|
|
15
|
+
ConfigMissingEnv = 1005,
|
|
16
|
+
/** An environment variable is present and fails validation. */
|
|
17
|
+
ConfigInvalidEnv = 1006,
|
|
22
18
|
/** Attempted to add lifecycle tasks after startup already completed. */
|
|
23
19
|
LifecycleAddAfterCompletion = 1101,
|
|
24
20
|
/** Attempted to add lifecycle tasks while startup is still running. */
|
|
@@ -55,18 +51,16 @@ declare enum SeedcordErrorCode {
|
|
|
55
51
|
CoreAccessorUnresolved = 1210,
|
|
56
52
|
/** Interaction middleware decorated with disallowed event filters. */
|
|
57
53
|
DecoratorInteractionEventFilter = 1301,
|
|
58
|
-
/** A decorator could not find the original method being decorated. */
|
|
59
|
-
DecoratorMethodNotFound = 1302,
|
|
60
54
|
/** A command decorator attempted to re-register an existing command scope. */
|
|
61
|
-
DecoratorCommandAlreadyRegistered =
|
|
55
|
+
DecoratorCommandAlreadyRegistered = 1302,
|
|
62
56
|
/** A global command decorator specified guild IDs, which is not allowed. */
|
|
63
|
-
DecoratorCommandGlobalWithGuilds =
|
|
57
|
+
DecoratorCommandGlobalWithGuilds = 1303,
|
|
64
58
|
/** A guild command decorator omitted the required guild ID list. */
|
|
65
|
-
DecoratorCommandGuildWithoutGuilds =
|
|
59
|
+
DecoratorCommandGuildWithoutGuilds = 1304,
|
|
66
60
|
/** Middleware priority provided by the decorator was not a finite number. */
|
|
67
|
-
DecoratorInvalidMiddlewarePriority =
|
|
61
|
+
DecoratorInvalidMiddlewarePriority = 1305,
|
|
68
62
|
/** A WebhookLog subclass is missing its `@WebhookUrl` decorator. */
|
|
69
|
-
DecoratorWebhookUrlMissing =
|
|
63
|
+
DecoratorWebhookUrlMissing = 1306,
|
|
70
64
|
/** Two interaction handlers registered the same route within a scope. */
|
|
71
65
|
InteractionDuplicateRoute = 1401,
|
|
72
66
|
/** Two different interaction middleware classes share a class name. */
|
|
@@ -131,6 +125,8 @@ declare enum SeedcordErrorCode {
|
|
|
131
125
|
ColorOutOfRange = 1902,
|
|
132
126
|
/** A plugin's constructor rejected its options through `rejectOptions`. */
|
|
133
127
|
PluginOptionsRejected = 2001,
|
|
128
|
+
/** Two or more plugins threw while disposing. */
|
|
129
|
+
PluginDisposeFailures = 2002,
|
|
134
130
|
/** Mongoose service class is missing the `@RegisterMongooseService` decorator. */
|
|
135
131
|
PluginMongooseServiceDecoratorMissing = 2101,
|
|
136
132
|
/** Mongoose client failed to establish a connection. */
|
|
@@ -171,72 +167,54 @@ declare enum SeedcordErrorCode {
|
|
|
171
167
|
CliConfigInvalidExport = 3101,
|
|
172
168
|
/** Config is missing the required instance string. */
|
|
173
169
|
CliConfigMissingInstance = 3102,
|
|
174
|
-
/** Config root was provided but not a string. */
|
|
175
|
-
CliConfigInvalidRoot = 3103,
|
|
176
170
|
/** Unable to locate a Seedcord config file. */
|
|
177
|
-
CliConfigNotFound =
|
|
171
|
+
CliConfigNotFound = 3103,
|
|
178
172
|
/** CLI entry file does not exist. */
|
|
179
|
-
CliEntryNotFound =
|
|
173
|
+
CliEntryNotFound = 3104,
|
|
180
174
|
/** tsx failed to import the provided entry file. */
|
|
181
|
-
CliTsxImportFailed =
|
|
175
|
+
CliTsxImportFailed = 3105,
|
|
182
176
|
/** Native import and jiti fallback both failed. */
|
|
183
|
-
CliImportFailed =
|
|
177
|
+
CliImportFailed = 3106,
|
|
184
178
|
/** Seedcord instance export is missing a start() method. */
|
|
185
|
-
CliInstanceInvalid =
|
|
179
|
+
CliInstanceInvalid = 3107,
|
|
186
180
|
/** Seedcord instance threw during startup. */
|
|
187
|
-
CliStartFailed =
|
|
181
|
+
CliStartFailed = 3108,
|
|
188
182
|
/** Config is missing the required entry string. */
|
|
189
|
-
CliConfigMissingEntry =
|
|
190
|
-
/** Config build options must be an object when provided. */
|
|
191
|
-
CliConfigInvalidBuild = 3111,
|
|
192
|
-
/** Config build outDir must be a string when provided. */
|
|
193
|
-
CliConfigInvalidBuildOutDir = 3112,
|
|
194
|
-
/** Config build tsconfig must be a string when provided. */
|
|
195
|
-
CliConfigInvalidBuildTsconfig = 3113,
|
|
196
|
-
/** Config build bootstrap must be a string when provided. */
|
|
197
|
-
CliConfigInvalidBuildBootstrap = 3114,
|
|
183
|
+
CliConfigMissingEntry = 3109,
|
|
198
184
|
/** Entry file must be inside the configured root directory. */
|
|
199
|
-
CliConfigEntryOutsideRoot =
|
|
185
|
+
CliConfigEntryOutsideRoot = 3110,
|
|
200
186
|
/** Unable to locate a TypeScript config file for builds. */
|
|
201
|
-
CliBuildTsconfigNotFound =
|
|
187
|
+
CliBuildTsconfigNotFound = 3111,
|
|
202
188
|
/** TypeScript reported diagnostics during emit. */
|
|
203
|
-
CliBuildFailed =
|
|
189
|
+
CliBuildFailed = 3112,
|
|
204
190
|
/** Unable to write the generated bootstrap file. */
|
|
205
|
-
CliBootstrapWriteFailed =
|
|
206
|
-
/** Config tsconfig must be a string when provided. */
|
|
207
|
-
CliConfigInvalidTsconfig = 3119,
|
|
208
|
-
/** Config hmr options must be an object when provided. */
|
|
209
|
-
CliConfigInvalidHmr = 3120,
|
|
210
|
-
/** Config hmr restart patterns must be an array of strings when provided. */
|
|
211
|
-
CliConfigInvalidHmrRestart = 3121,
|
|
191
|
+
CliBootstrapWriteFailed = 3113,
|
|
212
192
|
/** Two commands resolve to the same slash route during codegen. */
|
|
213
|
-
CliCodegenDuplicateRoute =
|
|
193
|
+
CliCodegenDuplicateRoute = 3114,
|
|
214
194
|
/** The commands directory could not be read during codegen. */
|
|
215
|
-
CliCodegenCommandsDirUnreadable =
|
|
195
|
+
CliCodegenCommandsDirUnreadable = 3115,
|
|
216
196
|
/** Two context-menu commands of the same kind share a name during codegen. */
|
|
217
|
-
CliCodegenDuplicateContextMenu =
|
|
197
|
+
CliCodegenDuplicateContextMenu = 3116,
|
|
218
198
|
/** Could not resolve the application from the bot token during `commands --clean`. */
|
|
219
|
-
CliCleanAppFetchFailed =
|
|
199
|
+
CliCleanAppFetchFailed = 3117,
|
|
220
200
|
/** `commands --clean` ran with neither --guild nor --all-guilds. */
|
|
221
|
-
CliCleanNoGuilds =
|
|
201
|
+
CliCleanNoGuilds = 3118,
|
|
222
202
|
/** `commands --clean` combined --purge with --all-guilds, which would wipe every guild. */
|
|
223
|
-
CliCleanPurgeAllGuilds =
|
|
203
|
+
CliCleanPurgeAllGuilds = 3119,
|
|
224
204
|
/** An interactive prompt was cancelled (Ctrl-C), so the command aborts without changes. */
|
|
225
|
-
CliCancelled =
|
|
205
|
+
CliCancelled = 3120,
|
|
226
206
|
/** `commands --clean --all-guilds` matched more guilds than the safety threshold without `--yes`. */
|
|
227
|
-
CliCleanLargeBotUnconfirmed =
|
|
207
|
+
CliCleanLargeBotUnconfirmed = 3121,
|
|
228
208
|
/** `commands --clean --apply` ran in a non-interactive environment without `--yes`, where it cannot prompt. */
|
|
229
|
-
CliCleanApplyNeedsYes =
|
|
230
|
-
/** Config hmr rollback flag must be a boolean when provided. */
|
|
231
|
-
CliConfigInvalidHmrRollback = 3131,
|
|
232
|
-
/** Config tunnel must be a boolean or an https URL when provided. */
|
|
233
|
-
CliConfigInvalidTunnel = 3132,
|
|
209
|
+
CliCleanApplyNeedsYes = 3122,
|
|
234
210
|
/** The cloudflared metrics server never reported a quick-tunnel hostname. */
|
|
235
|
-
CliTunnelUrlUnavailable =
|
|
211
|
+
CliTunnelUrlUnavailable = 3123,
|
|
236
212
|
/** Discord rejected the tunnel URL as an interactions endpoint. */
|
|
237
|
-
CliTunnelNotVerified =
|
|
213
|
+
CliTunnelNotVerified = 3124,
|
|
238
214
|
/** The tunnel URL never answered its health probe. */
|
|
239
|
-
CliTunnelUnreachable =
|
|
215
|
+
CliTunnelUnreachable = 3125,
|
|
216
|
+
/** A config field is present with the wrong shape. */
|
|
217
|
+
CliConfigInvalidField = 3126,
|
|
240
218
|
/** A create prompt was cancelled (Ctrl-C), and nothing has been written yet. */
|
|
241
219
|
CreateCancelled = 3201,
|
|
242
220
|
/** A flag supplied an answer for a question the earlier answers skip. */
|
|
@@ -251,17 +229,36 @@ declare enum SeedcordErrorCode {
|
|
|
251
229
|
CreateStepFailed = 3206
|
|
252
230
|
}
|
|
253
231
|
//#endregion
|
|
232
|
+
//#region src/palette.d.ts
|
|
233
|
+
declare const BRAND: {
|
|
234
|
+
readonly flesh: "#f04e36";
|
|
235
|
+
readonly rind: "#6fab49";
|
|
236
|
+
readonly pith: "#f8f6e8";
|
|
237
|
+
};
|
|
238
|
+
declare const paint: {
|
|
239
|
+
readonly sky: import("chalk").ChalkInstance;
|
|
240
|
+
readonly iris: import("chalk").ChalkInstance;
|
|
241
|
+
readonly mint: import("chalk").ChalkInstance;
|
|
242
|
+
readonly amber: import("chalk").ChalkInstance;
|
|
243
|
+
readonly coral: import("chalk").ChalkInstance;
|
|
244
|
+
readonly flesh: import("chalk").ChalkInstance;
|
|
245
|
+
readonly rind: import("chalk").ChalkInstance;
|
|
246
|
+
readonly pith: import("chalk").ChalkInstance;
|
|
247
|
+
readonly mute: import("chalk").ChalkInstance;
|
|
248
|
+
readonly bold: import("chalk").ChalkInstance;
|
|
249
|
+
readonly italic: import("chalk").ChalkInstance;
|
|
250
|
+
readonly underline: import("chalk").ChalkInstance;
|
|
251
|
+
};
|
|
252
|
+
//#endregion
|
|
254
253
|
//#region src/ErrorMessages.d.ts
|
|
255
254
|
/** @internal */
|
|
256
255
|
declare const messages: {
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
1005: (envKey: string) => string;
|
|
264
|
-
1003: (count: number, failures: string) => string;
|
|
256
|
+
1005: (name: string) => string;
|
|
257
|
+
1006: (name: string, expected?: string) => string;
|
|
258
|
+
1004: () => string;
|
|
259
|
+
1002: (envKey: string) => string;
|
|
260
|
+
1003: (envKey: string) => string;
|
|
261
|
+
1001: (count: number, failures: string) => string;
|
|
265
262
|
1101: () => string;
|
|
266
263
|
1102: () => string;
|
|
267
264
|
1103: () => string;
|
|
@@ -280,12 +277,11 @@ declare const messages: {
|
|
|
280
277
|
1209: () => string;
|
|
281
278
|
1210: (accessor: string, key: string) => string;
|
|
282
279
|
1301: () => string;
|
|
283
|
-
1302: () => string;
|
|
284
|
-
1303: (
|
|
280
|
+
1302: (commandName: string, existingScope: string, requestedScope: string) => string;
|
|
281
|
+
1303: () => string;
|
|
285
282
|
1304: () => string;
|
|
286
283
|
1305: () => string;
|
|
287
|
-
1306: () => string;
|
|
288
|
-
1307: (className: string) => string;
|
|
284
|
+
1306: (className: string) => string;
|
|
289
285
|
1401: (route: string, first: string, second: string) => string;
|
|
290
286
|
1402: (name: string) => string;
|
|
291
287
|
1403: (route: string, exportName: string, from: string) => string;
|
|
@@ -318,6 +314,7 @@ declare const messages: {
|
|
|
318
314
|
1901: (value: string) => string;
|
|
319
315
|
1902: () => string;
|
|
320
316
|
2001: (pluginName: string, reason: string) => string;
|
|
317
|
+
2002: (count: number) => string;
|
|
321
318
|
2101: (className: string) => string;
|
|
322
319
|
2102: (databaseName?: string) => string;
|
|
323
320
|
2103: () => string;
|
|
@@ -338,39 +335,30 @@ declare const messages: {
|
|
|
338
335
|
2212: (databaseName: string) => string;
|
|
339
336
|
3101: () => string;
|
|
340
337
|
3102: () => string;
|
|
341
|
-
3103: () => string;
|
|
342
|
-
|
|
343
|
-
3110: () => string;
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
3116: (
|
|
355
|
-
3117: (
|
|
356
|
-
3118: (
|
|
338
|
+
3103: (baseDir: string, candidates: readonly string[]) => string;
|
|
339
|
+
3109: () => string;
|
|
340
|
+
3110: (entryPath: string, root: string) => string;
|
|
341
|
+
3104: (entryPath: string) => string;
|
|
342
|
+
3105: (entryPath: string, reason: string) => string;
|
|
343
|
+
3106: (entryPath: string, nativeReason: string, fallbackReason: string) => string;
|
|
344
|
+
3107: () => string;
|
|
345
|
+
3108: (instancePath: string, reason: string) => string;
|
|
346
|
+
3111: (hint: string) => string;
|
|
347
|
+
3112: (diagnostics: string) => string;
|
|
348
|
+
3113: (targetPath: string, reason: string) => string;
|
|
349
|
+
3114: (route: string, firstFile: string, secondFile: string) => string;
|
|
350
|
+
3115: (dir: string, reason: string) => string;
|
|
351
|
+
3116: (kind: string, name: string, firstFile: string, secondFile: string) => string;
|
|
352
|
+
3117: (reason: string) => string;
|
|
353
|
+
3118: () => string;
|
|
357
354
|
3119: () => string;
|
|
358
355
|
3120: () => string;
|
|
359
|
-
3121: () => string;
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
3126: () => string;
|
|
366
|
-
3127: () => string;
|
|
367
|
-
3128: () => string;
|
|
368
|
-
3129: (count: number) => string;
|
|
369
|
-
3130: () => string;
|
|
370
|
-
3132: () => string;
|
|
371
|
-
3133: (seconds: number) => string;
|
|
372
|
-
3134: (url: string) => string;
|
|
373
|
-
3135: (url: string, seconds: number) => string;
|
|
356
|
+
3121: (count: number) => string;
|
|
357
|
+
3122: () => string;
|
|
358
|
+
3123: (seconds: number) => string;
|
|
359
|
+
3124: (url: string) => string;
|
|
360
|
+
3125: (url: string, seconds: number) => string;
|
|
361
|
+
3126: (field: string, expected: string) => string;
|
|
374
362
|
3201: () => string;
|
|
375
363
|
3202: (flag: string) => string;
|
|
376
364
|
3203: (flag: string, reason: string) => string;
|
|
@@ -396,49 +384,46 @@ type SeedcordErrorIdentifier = keyof typeof SeedcordErrorCode;
|
|
|
396
384
|
interface SeedcordErrorOptions extends ErrorOptions {}
|
|
397
385
|
type SeedcordErrorCtorRest<Code extends SeedcordErrorCode> = SeedcordErrorArguments<Code> extends [] ? [options?: SeedcordErrorOptions] : [args: SeedcordErrorArguments<Code>, options?: SeedcordErrorOptions];
|
|
398
386
|
/**
|
|
399
|
-
* String literal type for Seedcord error class names.
|
|
400
|
-
*
|
|
401
|
-
* @internal
|
|
387
|
+
* String literal type for Seedcord error class names. Names the `type` argument of
|
|
388
|
+
* {@link isSeedcordError}.
|
|
402
389
|
*/
|
|
403
|
-
type SeedcordErrorTypeString = `Seedcord${'Error' | 'TypeError' | 'RangeError'}`;
|
|
390
|
+
type SeedcordErrorTypeString = `Seedcord${'Error' | 'TypeError' | 'RangeError' | 'AggregateError'}`;
|
|
391
|
+
declare const kIdentifier: unique symbol;
|
|
404
392
|
interface BaseSeedcordError {
|
|
405
393
|
readonly code: SeedcordErrorCode;
|
|
406
|
-
readonly
|
|
394
|
+
readonly [kIdentifier]: SeedcordErrorIdentifier;
|
|
407
395
|
readonly type: SeedcordErrorTypeString;
|
|
408
396
|
}
|
|
409
|
-
/**
|
|
410
|
-
* Base class for Seedcord errors.
|
|
411
|
-
*/
|
|
412
397
|
declare class SeedcordError<Code extends SeedcordErrorCode = SeedcordErrorCode> extends Error implements BaseSeedcordError {
|
|
413
398
|
readonly code: Code;
|
|
414
|
-
readonly
|
|
399
|
+
readonly [kIdentifier]: SeedcordErrorIdentifier;
|
|
415
400
|
readonly type = "SeedcordError";
|
|
416
401
|
constructor(code: Code, ...rest: SeedcordErrorCtorRest<Code>);
|
|
417
402
|
}
|
|
418
|
-
/**
|
|
419
|
-
* TypeError class for Seedcord errors.
|
|
420
|
-
*/
|
|
421
403
|
declare class SeedcordTypeError<Code extends SeedcordErrorCode = SeedcordErrorCode> extends TypeError implements BaseSeedcordError {
|
|
422
404
|
readonly code: Code;
|
|
423
|
-
readonly
|
|
405
|
+
readonly [kIdentifier]: SeedcordErrorIdentifier;
|
|
424
406
|
readonly type = "SeedcordTypeError";
|
|
425
407
|
constructor(code: Code, ...rest: SeedcordErrorCtorRest<Code>);
|
|
426
408
|
}
|
|
427
|
-
/**
|
|
428
|
-
* RangeError class for Seedcord errors.
|
|
429
|
-
*/
|
|
430
409
|
declare class SeedcordRangeError<Code extends SeedcordErrorCode = SeedcordErrorCode> extends RangeError implements BaseSeedcordError {
|
|
431
410
|
readonly code: Code;
|
|
432
|
-
readonly
|
|
411
|
+
readonly [kIdentifier]: SeedcordErrorIdentifier;
|
|
433
412
|
readonly type = "SeedcordRangeError";
|
|
434
413
|
constructor(code: Code, ...rest: SeedcordErrorCtorRest<Code>);
|
|
435
414
|
}
|
|
415
|
+
declare class SeedcordAggregateError<Code extends SeedcordErrorCode = SeedcordErrorCode> extends AggregateError implements BaseSeedcordError {
|
|
416
|
+
readonly code: Code;
|
|
417
|
+
readonly [kIdentifier]: SeedcordErrorIdentifier;
|
|
418
|
+
readonly type = "SeedcordAggregateError";
|
|
419
|
+
constructor(code: Code, errors: readonly unknown[], ...rest: SeedcordErrorCtorRest<Code>);
|
|
420
|
+
}
|
|
436
421
|
/**
|
|
437
422
|
* Variant type for Seedcord error classes.
|
|
438
423
|
*
|
|
439
424
|
* @internal
|
|
440
425
|
*/
|
|
441
|
-
type SeedcordErrorVariant<Type extends SeedcordErrorTypeString, Code extends SeedcordErrorCode> = Type extends 'SeedcordError' ? SeedcordError<Code> : Type extends 'SeedcordTypeError' ? SeedcordTypeError<Code> : SeedcordRangeError<Code>;
|
|
426
|
+
type SeedcordErrorVariant<Type extends SeedcordErrorTypeString, Code extends SeedcordErrorCode> = Type extends 'SeedcordError' ? SeedcordError<Code> : Type extends 'SeedcordTypeError' ? SeedcordTypeError<Code> : Type extends 'SeedcordRangeError' ? SeedcordRangeError<Code> : SeedcordAggregateError<Code>;
|
|
442
427
|
/**
|
|
443
428
|
* Union type of all Seedcord error variants for a specific error code.
|
|
444
429
|
*
|
|
@@ -461,12 +446,12 @@ type ErrorCodeFilter<Type extends SeedcordErrorTypeString | undefined, Code exte
|
|
|
461
446
|
* Determines whether an unknown value is a Seedcord error, with optional narrowing by class and error code.
|
|
462
447
|
*
|
|
463
448
|
* @param error - The value to inspect.
|
|
464
|
-
* @param type - Optional error class discriminator
|
|
449
|
+
* @param type - Optional error class discriminator.
|
|
465
450
|
* @param code - Optional {@link SeedcordErrorCode} discriminator to narrow by code.
|
|
466
451
|
* @typeParam Type - What kind of {@link SeedcordErrorTypeString} to filter by.
|
|
467
452
|
* @typeParam Code - The specific {@link SeedcordErrorCode} to filter by.
|
|
468
453
|
*/
|
|
469
454
|
declare function isSeedcordError<Type extends SeedcordErrorTypeString | undefined, Code extends SeedcordErrorCode | undefined>(error: unknown, type?: Type, code?: Code): error is ErrorCodeFilter<Type, Code>;
|
|
470
455
|
//#endregion
|
|
471
|
-
export {
|
|
472
|
-
//# sourceMappingURL=SeedcordError-
|
|
456
|
+
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 };
|
|
457
|
+
//# sourceMappingURL=SeedcordError-t1f0elt6.d.mts.map
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as paint, l as SeedcordErrorCode, o as isSeedcordError, r as SeedcordErrorTypeString } from "./SeedcordError-t1f0elt6.mjs";
|
|
2
2
|
//#region src/index.d.ts
|
|
3
3
|
/** Package version */
|
|
4
4
|
declare const version: string;
|
|
5
5
|
//#endregion
|
|
6
|
-
export { SeedcordErrorCode, type SeedcordErrorTypeString, isSeedcordError, version };
|
|
6
|
+
export { SeedcordErrorCode, type SeedcordErrorTypeString, isSeedcordError, paint, version };
|
|
7
7
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { a as SeedcordErrorCode,
|
|
1
|
+
import { a as isSeedcordError, c as SeedcordErrorCode, s as paint } from "./SeedcordError-BLQ8_el7.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/index.ts
|
|
4
4
|
/** Package version */
|
|
5
|
-
const version = "0.
|
|
5
|
+
const version = "0.4.0-next.0";
|
|
6
6
|
|
|
7
7
|
//#endregion
|
|
8
|
-
export { SeedcordErrorCode, isSeedcordError, version };
|
|
8
|
+
export { SeedcordErrorCode, isSeedcordError, paint, version };
|
|
9
9
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["export { SeedcordErrorCode } from './ErrorCodes';\nexport { isSeedcordError, type SeedcordErrorTypeString } from './SeedcordError';\n\n/** Package version */\nexport const version = process.env.PACKAGE_VERSION ?? '0.0.0';\n"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["export { SeedcordErrorCode } from './ErrorCodes';\nexport { paint } from './palette';\nexport { isSeedcordError, type SeedcordErrorTypeString } from './SeedcordError';\n\n/** Package version */\nexport const version = process.env.PACKAGE_VERSION ?? '0.0.0';\n"],"mappings":";;;;AAKA,MAAa"}
|
|
@@ -1,25 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
//#region src/palette.d.ts
|
|
3
|
-
declare const BRAND: {
|
|
4
|
-
readonly flesh: "#f04e36";
|
|
5
|
-
readonly rind: "#6fab49";
|
|
6
|
-
readonly pith: "#f8f6e8";
|
|
7
|
-
};
|
|
8
|
-
declare const paint: {
|
|
9
|
-
readonly sky: import("chalk").ChalkInstance;
|
|
10
|
-
readonly iris: import("chalk").ChalkInstance;
|
|
11
|
-
readonly mint: import("chalk").ChalkInstance;
|
|
12
|
-
readonly amber: import("chalk").ChalkInstance;
|
|
13
|
-
readonly coral: import("chalk").ChalkInstance;
|
|
14
|
-
readonly flesh: import("chalk").ChalkInstance;
|
|
15
|
-
readonly rind: import("chalk").ChalkInstance;
|
|
16
|
-
readonly pith: import("chalk").ChalkInstance;
|
|
17
|
-
readonly mute: import("chalk").ChalkInstance;
|
|
18
|
-
};
|
|
19
|
-
//#endregion
|
|
1
|
+
import { a as SeedcordTypeError, i as SeedcordRangeError, n as SeedcordError, s as BRAND, t as SeedcordAggregateError } from "./SeedcordError-t1f0elt6.mjs";
|
|
20
2
|
//#region src/validateDiscordToken.d.ts
|
|
21
3
|
/** @internal */
|
|
22
4
|
declare function validateDiscordToken(raw: unknown): string;
|
|
23
5
|
//#endregion
|
|
24
|
-
export { BRAND, SeedcordError, SeedcordRangeError, SeedcordTypeError,
|
|
6
|
+
export { BRAND, SeedcordAggregateError, SeedcordError, SeedcordRangeError, SeedcordTypeError, validateDiscordToken };
|
|
25
7
|
//# sourceMappingURL=internal.index.d.mts.map
|
package/dist/internal.index.mjs
CHANGED
|
@@ -1,36 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import chalk from "chalk";
|
|
1
|
+
import { c as SeedcordErrorCode, i as SeedcordTypeError, n as SeedcordError, o as BRAND, r as SeedcordRangeError, t as SeedcordAggregateError } from "./SeedcordError-BLQ8_el7.mjs";
|
|
3
2
|
|
|
4
|
-
//#region src/palette.ts
|
|
5
|
-
const BRAND = {
|
|
6
|
-
flesh: "#f04e36",
|
|
7
|
-
rind: "#6fab49",
|
|
8
|
-
pith: "#f8f6e8"
|
|
9
|
-
};
|
|
10
|
-
const paint = {
|
|
11
|
-
sky: chalk.hex("#8fc7ff"),
|
|
12
|
-
iris: chalk.hex("#e29bff"),
|
|
13
|
-
mint: chalk.hex("#66d98a"),
|
|
14
|
-
amber: chalk.hex("#ffc061"),
|
|
15
|
-
coral: chalk.hex("#ff6b85"),
|
|
16
|
-
flesh: chalk.hex(BRAND.flesh),
|
|
17
|
-
rind: chalk.hex(BRAND.rind),
|
|
18
|
-
pith: chalk.hex(BRAND.pith),
|
|
19
|
-
mute: chalk.dim
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
//#endregion
|
|
23
3
|
//#region src/validateDiscordToken.ts
|
|
4
|
+
const ENV_NAME = "DISCORD_BOT_TOKEN";
|
|
24
5
|
/** @internal */
|
|
25
6
|
function validateDiscordToken(raw) {
|
|
26
|
-
if (raw === null || raw === void 0) throw new SeedcordError(
|
|
27
|
-
if (typeof raw !== "string") throw new SeedcordError(
|
|
7
|
+
if (raw === null || raw === void 0) throw new SeedcordError(1005, [ENV_NAME]);
|
|
8
|
+
if (typeof raw !== "string") throw new SeedcordError(1006, [ENV_NAME]);
|
|
28
9
|
const value = raw.trim();
|
|
29
|
-
if (value === "") throw new SeedcordError(
|
|
30
|
-
if (!/^[A-Za-z\d_-]{24,}\.[A-Za-z\d_-]{6,}\.[A-Za-z\d_-]{27,}$/.test(value)) throw new SeedcordError(
|
|
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]);
|
|
31
12
|
return value;
|
|
32
13
|
}
|
|
33
14
|
|
|
34
15
|
//#endregion
|
|
35
|
-
export { BRAND, SeedcordError, SeedcordRangeError, SeedcordTypeError,
|
|
16
|
+
export { BRAND, SeedcordAggregateError, SeedcordError, SeedcordRangeError, SeedcordTypeError, validateDiscordToken };
|
|
36
17
|
//# sourceMappingURL=internal.index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.index.mjs","names":[],"sources":["../src/
|
|
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"}
|