@seedcord/errors 0.3.0-next.4 → 0.3.0-next.6

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.
@@ -6,17 +6,19 @@ declare enum SeedcordErrorCode {
6
6
  /** DISCORD_BOT_TOKEN is not present in the environment. */
7
7
  ConfigMissingDiscordToken = 1001,
8
8
  /** DISCORD_BOT_TOKEN is present but fails validation. */
9
- ConfigIncorrectDiscordToken = 1004,
9
+ ConfigIncorrectDiscordToken = 1002,
10
10
  /** One or more configured emojis could not be resolved at startup. */
11
- ConfigEmojiUnresolved = 1005,
11
+ ConfigEmojiUnresolved = 1003,
12
12
  /** A webhook reporter's env var is set but fails webhook URL validation. */
13
- ConfigWebhookUrlInvalid = 1006,
13
+ ConfigWebhookUrlInvalid = 1004,
14
14
  /** A configured webhook does not exist on Discord (deleted, or a wrong id or token). */
15
- ConfigWebhookNotFound = 1007,
15
+ ConfigWebhookNotFound = 1005,
16
16
  /** DISCORD_PUBLIC_KEY is not present in the environment. */
17
- ConfigMissingPublicKey = 1008,
17
+ ConfigMissingPublicKey = 1006,
18
18
  /** DISCORD_PUBLIC_KEY is present but fails validation. */
19
- ConfigIncorrectPublicKey = 1009,
19
+ ConfigIncorrectPublicKey = 1007,
20
+ /** The generated route manifest was imported before `seedcord build` generated it. */
21
+ ConfigManifestNotGenerated = 1008,
20
22
  /** Attempted to add lifecycle tasks after startup already completed. */
21
23
  LifecycleAddAfterCompletion = 1101,
22
24
  /** Attempted to add lifecycle tasks while startup is still running. */
@@ -29,6 +31,8 @@ declare enum SeedcordErrorCode {
29
31
  LifecyclePhaseFailures = 1105,
30
32
  /** A lifecycle task exceeded its configured timeout. */
31
33
  LifecycleTaskTimeout = 1106,
34
+ /** A host whose startup failed was started again. */
35
+ LifecycleRestartAfterFailure = 1107,
32
36
  /** Multiple Seedcord instances were created simultaneously. */
33
37
  CoreSingletonViolation = 1201,
34
38
  /** Plugins cannot be mutated after the core has finished initializing. */
@@ -39,6 +43,12 @@ declare enum SeedcordErrorCode {
39
43
  CoreBotRoleMissing = 1204,
40
44
  /** A bot controller was constructed without its required handlers directory. */
41
45
  CoreControllerPathMissing = 1205,
46
+ /** A file in a scanned directory threw while being imported. */
47
+ CoreDirectoryImportFailed = 1206,
48
+ /** A scanned directory could not be read. */
49
+ CoreDirectoryUnreadable = 1207,
50
+ /** A plugin was attached under a key the framework logs on. */
51
+ CorePluginReservedChannel = 1208,
42
52
  /** Interaction middleware decorated with disallowed event filters. */
43
53
  DecoratorInteractionEventFilter = 1301,
44
54
  /** A decorator could not find the original method being decorated. */
@@ -57,6 +67,12 @@ declare enum SeedcordErrorCode {
57
67
  InteractionDuplicateRoute = 1401,
58
68
  /** Two different interaction middleware classes share a class name. */
59
69
  InteractionDuplicateMiddleware = 1402,
70
+ /** A route manifest row gives an export name its module does not have. */
71
+ InteractionRouteExportMissing = 1403,
72
+ /** A subscriber manifest row specifies an export that does not extend `Subscriber`. */
73
+ SubscriberRouteNotASubscriber = 1404,
74
+ /** A manifest row's module threw while importing. */
75
+ RouteModuleLoadFailed = 1405,
60
76
  /** A reply method was called in an ack state where it is illegal. */
61
77
  ReplyIllegalAckState = 1501,
62
78
  /** A reply component failed to serialize to raw API data. */
@@ -109,36 +125,46 @@ declare enum SeedcordErrorCode {
109
125
  ColorUnresolvable = 1901,
110
126
  /** A resolved color fell outside Discord's 0x000000 to 0xffffff range. */
111
127
  ColorOutOfRange = 1902,
112
- /** Mongo service class is missing the `@RegisterMongoService` decorator. */
113
- PluginMongoServiceDecoratorMissing = 2101,
114
- /** Mongo model class is missing the `@RegisterMongoModel` decorator. */
115
- PluginMongoModelDecoratorMissing = 2102,
116
- /** Mongo client failed to establish a connection. */
117
- PluginMongoConnectionFailed = 2103,
118
- /** Mongo client failed to disconnect cleanly during shutdown. */
119
- PluginMongoDisconnectFailed = 2104,
120
- /** Mongo `services` was accessed before the plugin finished initializing. */
121
- PluginMongoServicesNotReady = 2105,
122
- /** KPG service class is missing the `@RegisterKpgService` decorator. */
123
- PluginKpgServiceDecoratorMissing = 2201,
124
- /** KPG service class is missing its table metadata. */
125
- PluginKpgServiceTableMissing = 2202,
128
+ /** A plugin's constructor rejected its options through `rejectOptions`. */
129
+ PluginOptionsRejected = 2001,
130
+ /** A plugin read `this.ctx` before `attach` finalized it. */
131
+ PluginContextBeforeInit = 2002,
132
+ /** Mongoose service class is missing the `@RegisterMongooseService` decorator. */
133
+ PluginMongooseServiceDecoratorMissing = 2101,
134
+ /** Mongoose client failed to establish a connection. */
135
+ PluginMongooseConnectionFailed = 2102,
136
+ /** Mongoose client failed to disconnect cleanly during shutdown. */
137
+ PluginMongooseDisconnectFailed = 2103,
138
+ /** Mongoose `services` was accessed before the plugin finished initializing. */
139
+ PluginMongooseServicesNotReady = 2104,
140
+ /** Mongoose rejected the model, usually a duplicate model name or an absent schema. */
141
+ PluginMongooseModelCreationFailed = 2105,
142
+ /** A mongoose service was registered with an empty model name override. */
143
+ PluginMongooseModelNameMissing = 2106,
144
+ /** Kysely service class is missing the `@RegisterKyselyService` decorator. */
145
+ PluginKyselyServiceDecoratorMissing = 2201,
146
+ /** Kysely service class is missing its table metadata. */
147
+ PluginKyselyServiceTableMissing = 2202,
126
148
  /** Migration manager received an invalid step count. */
127
- PluginKpgInvalidStepCount = 2203,
149
+ PluginKyselyInvalidStepCount = 2203,
128
150
  /** Migration direction was not recognized. */
129
- PluginKpgUnknownDirection = 2204,
151
+ PluginKyselyUnknownDirection = 2204,
130
152
  /** Provided migrations path could not be resolved. */
131
- PluginKpgUnresolvedMigrationsPath = 2205,
153
+ PluginKyselyUnresolvedMigrationsPath = 2205,
132
154
  /** No migration files were found for execution. */
133
- PluginKpgNoMigrationFiles = 2206,
155
+ PluginKyselyNoMigrationFiles = 2206,
134
156
  /** A migration module failed to export the expected functions. */
135
- PluginKpgInvalidMigrationModule = 2207,
157
+ PluginKyselyInvalidMigrationModule = 2207,
136
158
  /** An arbitrary (non-Error) failure was reported by a migration. */
137
- PluginKpgNonErrorFailure = 2208,
159
+ PluginKyselyNonErrorFailure = 2208,
138
160
  /** Postgres pool failed to close cleanly during shutdown. */
139
- PluginKpgDisconnectFailed = 2209,
140
- /** KPG `services` was accessed before the plugin finished initializing. */
141
- PluginKpgServicesNotReady = 2210,
161
+ PluginKyselyDisconnectFailed = 2209,
162
+ /** Kysely `services` was accessed before the plugin finished initializing. */
163
+ PluginKyselyServicesNotReady = 2210,
164
+ /** Postgres pool failed to establish a connection. */
165
+ PluginKyselyConnectionFailed = 2211,
166
+ /** Bootstrapper failed to ensure the target Postgres database exists. */
167
+ PluginKyselyBootstrapFailed = 2212,
142
168
  /** Config file default export was not an object. */
143
169
  CliConfigInvalidExport = 3101,
144
170
  /** Config is missing the required instance string. */
@@ -188,42 +214,47 @@ declare enum SeedcordErrorCode {
188
214
  /** Two context-menu commands of the same kind share a name during codegen. */
189
215
  CliCodegenDuplicateContextMenu = 3124,
190
216
  /** Could not resolve the application from the bot token during `commands --clean`. */
191
- CliCleanAppFetchFailed = 3126,
217
+ CliCleanAppFetchFailed = 3125,
192
218
  /** `commands --clean` ran with neither --guild nor --all-guilds, so there is nothing to scan. */
193
- CliCleanNoGuilds = 3127,
219
+ CliCleanNoGuilds = 3126,
194
220
  /** `commands --clean` combined --purge with --all-guilds, which would wipe every guild. */
195
- CliCleanPurgeAllGuilds = 3128,
221
+ CliCleanPurgeAllGuilds = 3127,
196
222
  /** An interactive prompt was cancelled (Ctrl-C), so the command aborts without changes. */
197
- CliCancelled = 3129,
223
+ CliCancelled = 3128,
198
224
  /** `commands --clean --all-guilds` matched more guilds than the safety threshold without `--yes`. */
199
- CliCleanLargeBotUnconfirmed = 3130,
225
+ CliCleanLargeBotUnconfirmed = 3129,
200
226
  /** `commands --clean --apply` ran in a non-interactive environment without `--yes`, where it cannot prompt. */
201
- CliCleanApplyNeedsYes = 3131,
227
+ CliCleanApplyNeedsYes = 3130,
202
228
  /** Config hmr rollback flag must be a boolean when provided. */
203
- CliConfigInvalidHmrRollback = 3132
229
+ CliConfigInvalidHmrRollback = 3131
204
230
  }
205
231
  //#endregion
206
232
  //#region src/ErrorMessages.d.ts
207
233
  /** @internal */
208
234
  declare const messages: {
209
235
  1001: () => string;
210
- 1004: () => string;
236
+ 1002: () => string;
237
+ 1006: () => string;
238
+ 1007: () => string;
211
239
  1008: () => string;
212
- 1009: () => string;
213
- 1006: (envKey: string) => string;
214
- 1007: (envKey: string) => string;
215
- 1005: (count: number, failures: string) => string;
240
+ 1004: (envKey: string) => string;
241
+ 1005: (envKey: string) => string;
242
+ 1003: (count: number, failures: string) => string;
216
243
  1101: () => string;
217
244
  1102: () => string;
218
245
  1103: () => string;
219
246
  1104: (phase: unknown) => string;
220
247
  1105: (phase: string, failures: number) => string;
221
248
  1106: (taskName: string, timeout: number) => string;
249
+ 1107: () => string;
222
250
  1201: () => string;
223
251
  1202: () => string;
224
252
  1203: (key: string) => string;
225
253
  1204: (guildId?: string) => string;
226
254
  1205: (controllerName: string, pathKind: string) => string;
255
+ 1206: (file: string) => string;
256
+ 1207: (dir: string) => string;
257
+ 1208: (key: string) => string;
227
258
  1301: () => string;
228
259
  1302: () => string;
229
260
  1303: (commandName: string, existingScope: string, requestedScope: string) => string;
@@ -231,8 +262,11 @@ declare const messages: {
231
262
  1305: () => string;
232
263
  1306: () => string;
233
264
  1307: (className: string) => string;
234
- 1401: (route: string, firstClass: string, secondClass: string) => string;
265
+ 1401: (route: string, first: string, second: string) => string;
235
266
  1402: (name: string) => string;
267
+ 1403: (route: string, exportName: string, from: string) => string;
268
+ 1404: (keys: string, exportName: string, from: string) => string;
269
+ 1405: (route: string, from: string) => string;
236
270
  1501: (method: string, reason: string, alternative: string, routeId: string) => string;
237
271
  1502: (componentClass: string, index: number, detail: string, routeId: string) => string;
238
272
  1503: (method: string, targetId: string, routeId: string) => string;
@@ -259,11 +293,14 @@ declare const messages: {
259
293
  1804: (key: string) => string;
260
294
  1901: (value: string) => string;
261
295
  1902: () => string;
296
+ 2001: (pluginName: string, reason: string) => string;
297
+ 2002: (pluginName: string) => string;
262
298
  2101: (className: string) => string;
263
- 2102: (className: string) => string;
264
- 2103: (databaseName?: string) => string;
299
+ 2102: (databaseName?: string) => string;
300
+ 2103: () => string;
265
301
  2104: () => string;
266
- 2105: () => string;
302
+ 2105: (modelName: string, className: string) => string;
303
+ 2106: (className: string) => string;
267
304
  2201: (className: string) => string;
268
305
  2202: (className: string) => string;
269
306
  2203: () => string;
@@ -274,6 +311,8 @@ declare const messages: {
274
311
  2208: (message: string) => string;
275
312
  2209: () => string;
276
313
  2210: () => string;
314
+ 2211: (databaseName?: string) => string;
315
+ 2212: (databaseName: string) => string;
277
316
  3101: () => string;
278
317
  3102: () => string;
279
318
  3103: () => string;
@@ -295,16 +334,16 @@ declare const messages: {
295
334
  3119: () => string;
296
335
  3120: () => string;
297
336
  3121: () => string;
298
- 3132: () => string;
337
+ 3131: () => string;
299
338
  3122: (route: string, firstFile: string, secondFile: string) => string;
300
339
  3123: (dir: string, reason: string) => string;
301
340
  3124: (kind: string, name: string, firstFile: string, secondFile: string) => string;
302
- 3126: (reason: string) => string;
341
+ 3125: (reason: string) => string;
342
+ 3126: () => string;
303
343
  3127: () => string;
304
344
  3128: () => string;
305
- 3129: () => string;
306
- 3130: (count: number) => string;
307
- 3131: () => string;
345
+ 3129: (count: number) => string;
346
+ 3130: () => string;
308
347
  };
309
348
  /** @internal */
310
349
  type SeedcordErrorArguments<Code extends SeedcordErrorCode> = Parameters<(typeof messages)[Code]>;
@@ -397,4 +436,4 @@ type ErrorCodeFilter<Type extends SeedcordErrorTypeString | undefined, Code exte
397
436
  declare function isSeedcordError<Type extends SeedcordErrorTypeString | undefined, Code extends SeedcordErrorCode | undefined>(error: unknown, type?: Type, code?: Code): error is ErrorCodeFilter<Type, Code>;
398
437
  //#endregion
399
438
  export { isSeedcordError as a, SeedcordTypeError as i, SeedcordErrorTypeString as n, SeedcordErrorCode as o, SeedcordRangeError as r, SeedcordError as t };
400
- //# sourceMappingURL=SeedcordError-DJOVXxn_.d.mts.map
439
+ //# sourceMappingURL=SeedcordError-CV8l82MW.d.mts.map
@@ -36,17 +36,19 @@ let SeedcordErrorCode = /* @__PURE__ */ function(SeedcordErrorCode) {
36
36
  /** DISCORD_BOT_TOKEN is not present in the environment. */
37
37
  SeedcordErrorCode[SeedcordErrorCode["ConfigMissingDiscordToken"] = 1001] = "ConfigMissingDiscordToken";
38
38
  /** DISCORD_BOT_TOKEN is present but fails validation. */
39
- SeedcordErrorCode[SeedcordErrorCode["ConfigIncorrectDiscordToken"] = 1004] = "ConfigIncorrectDiscordToken";
39
+ SeedcordErrorCode[SeedcordErrorCode["ConfigIncorrectDiscordToken"] = 1002] = "ConfigIncorrectDiscordToken";
40
40
  /** One or more configured emojis could not be resolved at startup. */
41
- SeedcordErrorCode[SeedcordErrorCode["ConfigEmojiUnresolved"] = 1005] = "ConfigEmojiUnresolved";
41
+ SeedcordErrorCode[SeedcordErrorCode["ConfigEmojiUnresolved"] = 1003] = "ConfigEmojiUnresolved";
42
42
  /** A webhook reporter's env var is set but fails webhook URL validation. */
43
- SeedcordErrorCode[SeedcordErrorCode["ConfigWebhookUrlInvalid"] = 1006] = "ConfigWebhookUrlInvalid";
43
+ SeedcordErrorCode[SeedcordErrorCode["ConfigWebhookUrlInvalid"] = 1004] = "ConfigWebhookUrlInvalid";
44
44
  /** A configured webhook does not exist on Discord (deleted, or a wrong id or token). */
45
- SeedcordErrorCode[SeedcordErrorCode["ConfigWebhookNotFound"] = 1007] = "ConfigWebhookNotFound";
45
+ SeedcordErrorCode[SeedcordErrorCode["ConfigWebhookNotFound"] = 1005] = "ConfigWebhookNotFound";
46
46
  /** DISCORD_PUBLIC_KEY is not present in the environment. */
47
- SeedcordErrorCode[SeedcordErrorCode["ConfigMissingPublicKey"] = 1008] = "ConfigMissingPublicKey";
47
+ SeedcordErrorCode[SeedcordErrorCode["ConfigMissingPublicKey"] = 1006] = "ConfigMissingPublicKey";
48
48
  /** DISCORD_PUBLIC_KEY is present but fails validation. */
49
- SeedcordErrorCode[SeedcordErrorCode["ConfigIncorrectPublicKey"] = 1009] = "ConfigIncorrectPublicKey";
49
+ SeedcordErrorCode[SeedcordErrorCode["ConfigIncorrectPublicKey"] = 1007] = "ConfigIncorrectPublicKey";
50
+ /** The generated route manifest was imported before `seedcord build` generated it. */
51
+ SeedcordErrorCode[SeedcordErrorCode["ConfigManifestNotGenerated"] = 1008] = "ConfigManifestNotGenerated";
50
52
  /** Attempted to add lifecycle tasks after startup already completed. */
51
53
  SeedcordErrorCode[SeedcordErrorCode["LifecycleAddAfterCompletion"] = 1101] = "LifecycleAddAfterCompletion";
52
54
  /** Attempted to add lifecycle tasks while startup is still running. */
@@ -59,6 +61,8 @@ let SeedcordErrorCode = /* @__PURE__ */ function(SeedcordErrorCode) {
59
61
  SeedcordErrorCode[SeedcordErrorCode["LifecyclePhaseFailures"] = 1105] = "LifecyclePhaseFailures";
60
62
  /** A lifecycle task exceeded its configured timeout. */
61
63
  SeedcordErrorCode[SeedcordErrorCode["LifecycleTaskTimeout"] = 1106] = "LifecycleTaskTimeout";
64
+ /** A host whose startup failed was started again. */
65
+ SeedcordErrorCode[SeedcordErrorCode["LifecycleRestartAfterFailure"] = 1107] = "LifecycleRestartAfterFailure";
62
66
  /** Multiple Seedcord instances were created simultaneously. */
63
67
  SeedcordErrorCode[SeedcordErrorCode["CoreSingletonViolation"] = 1201] = "CoreSingletonViolation";
64
68
  /** Plugins cannot be mutated after the core has finished initializing. */
@@ -69,6 +73,12 @@ let SeedcordErrorCode = /* @__PURE__ */ function(SeedcordErrorCode) {
69
73
  SeedcordErrorCode[SeedcordErrorCode["CoreBotRoleMissing"] = 1204] = "CoreBotRoleMissing";
70
74
  /** A bot controller was constructed without its required handlers directory. */
71
75
  SeedcordErrorCode[SeedcordErrorCode["CoreControllerPathMissing"] = 1205] = "CoreControllerPathMissing";
76
+ /** A file in a scanned directory threw while being imported. */
77
+ SeedcordErrorCode[SeedcordErrorCode["CoreDirectoryImportFailed"] = 1206] = "CoreDirectoryImportFailed";
78
+ /** A scanned directory could not be read. */
79
+ SeedcordErrorCode[SeedcordErrorCode["CoreDirectoryUnreadable"] = 1207] = "CoreDirectoryUnreadable";
80
+ /** A plugin was attached under a key the framework logs on. */
81
+ SeedcordErrorCode[SeedcordErrorCode["CorePluginReservedChannel"] = 1208] = "CorePluginReservedChannel";
72
82
  /** Interaction middleware decorated with disallowed event filters. */
73
83
  SeedcordErrorCode[SeedcordErrorCode["DecoratorInteractionEventFilter"] = 1301] = "DecoratorInteractionEventFilter";
74
84
  /** A decorator could not find the original method being decorated. */
@@ -87,6 +97,12 @@ let SeedcordErrorCode = /* @__PURE__ */ function(SeedcordErrorCode) {
87
97
  SeedcordErrorCode[SeedcordErrorCode["InteractionDuplicateRoute"] = 1401] = "InteractionDuplicateRoute";
88
98
  /** Two different interaction middleware classes share a class name. */
89
99
  SeedcordErrorCode[SeedcordErrorCode["InteractionDuplicateMiddleware"] = 1402] = "InteractionDuplicateMiddleware";
100
+ /** A route manifest row gives an export name its module does not have. */
101
+ SeedcordErrorCode[SeedcordErrorCode["InteractionRouteExportMissing"] = 1403] = "InteractionRouteExportMissing";
102
+ /** A subscriber manifest row specifies an export that does not extend `Subscriber`. */
103
+ SeedcordErrorCode[SeedcordErrorCode["SubscriberRouteNotASubscriber"] = 1404] = "SubscriberRouteNotASubscriber";
104
+ /** A manifest row's module threw while importing. */
105
+ SeedcordErrorCode[SeedcordErrorCode["RouteModuleLoadFailed"] = 1405] = "RouteModuleLoadFailed";
90
106
  /** A reply method was called in an ack state where it is illegal. */
91
107
  SeedcordErrorCode[SeedcordErrorCode["ReplyIllegalAckState"] = 1501] = "ReplyIllegalAckState";
92
108
  /** A reply component failed to serialize to raw API data. */
@@ -139,36 +155,46 @@ let SeedcordErrorCode = /* @__PURE__ */ function(SeedcordErrorCode) {
139
155
  SeedcordErrorCode[SeedcordErrorCode["ColorUnresolvable"] = 1901] = "ColorUnresolvable";
140
156
  /** A resolved color fell outside Discord's 0x000000 to 0xffffff range. */
141
157
  SeedcordErrorCode[SeedcordErrorCode["ColorOutOfRange"] = 1902] = "ColorOutOfRange";
142
- /** Mongo service class is missing the `@RegisterMongoService` decorator. */
143
- SeedcordErrorCode[SeedcordErrorCode["PluginMongoServiceDecoratorMissing"] = 2101] = "PluginMongoServiceDecoratorMissing";
144
- /** Mongo model class is missing the `@RegisterMongoModel` decorator. */
145
- SeedcordErrorCode[SeedcordErrorCode["PluginMongoModelDecoratorMissing"] = 2102] = "PluginMongoModelDecoratorMissing";
146
- /** Mongo client failed to establish a connection. */
147
- SeedcordErrorCode[SeedcordErrorCode["PluginMongoConnectionFailed"] = 2103] = "PluginMongoConnectionFailed";
148
- /** Mongo client failed to disconnect cleanly during shutdown. */
149
- SeedcordErrorCode[SeedcordErrorCode["PluginMongoDisconnectFailed"] = 2104] = "PluginMongoDisconnectFailed";
150
- /** Mongo `services` was accessed before the plugin finished initializing. */
151
- SeedcordErrorCode[SeedcordErrorCode["PluginMongoServicesNotReady"] = 2105] = "PluginMongoServicesNotReady";
152
- /** KPG service class is missing the `@RegisterKpgService` decorator. */
153
- SeedcordErrorCode[SeedcordErrorCode["PluginKpgServiceDecoratorMissing"] = 2201] = "PluginKpgServiceDecoratorMissing";
154
- /** KPG service class is missing its table metadata. */
155
- SeedcordErrorCode[SeedcordErrorCode["PluginKpgServiceTableMissing"] = 2202] = "PluginKpgServiceTableMissing";
158
+ /** A plugin's constructor rejected its options through `rejectOptions`. */
159
+ SeedcordErrorCode[SeedcordErrorCode["PluginOptionsRejected"] = 2001] = "PluginOptionsRejected";
160
+ /** A plugin read `this.ctx` before `attach` finalized it. */
161
+ SeedcordErrorCode[SeedcordErrorCode["PluginContextBeforeInit"] = 2002] = "PluginContextBeforeInit";
162
+ /** Mongoose service class is missing the `@RegisterMongooseService` decorator. */
163
+ SeedcordErrorCode[SeedcordErrorCode["PluginMongooseServiceDecoratorMissing"] = 2101] = "PluginMongooseServiceDecoratorMissing";
164
+ /** Mongoose client failed to establish a connection. */
165
+ SeedcordErrorCode[SeedcordErrorCode["PluginMongooseConnectionFailed"] = 2102] = "PluginMongooseConnectionFailed";
166
+ /** Mongoose client failed to disconnect cleanly during shutdown. */
167
+ SeedcordErrorCode[SeedcordErrorCode["PluginMongooseDisconnectFailed"] = 2103] = "PluginMongooseDisconnectFailed";
168
+ /** Mongoose `services` was accessed before the plugin finished initializing. */
169
+ SeedcordErrorCode[SeedcordErrorCode["PluginMongooseServicesNotReady"] = 2104] = "PluginMongooseServicesNotReady";
170
+ /** Mongoose rejected the model, usually a duplicate model name or an absent schema. */
171
+ SeedcordErrorCode[SeedcordErrorCode["PluginMongooseModelCreationFailed"] = 2105] = "PluginMongooseModelCreationFailed";
172
+ /** A mongoose service was registered with an empty model name override. */
173
+ SeedcordErrorCode[SeedcordErrorCode["PluginMongooseModelNameMissing"] = 2106] = "PluginMongooseModelNameMissing";
174
+ /** Kysely service class is missing the `@RegisterKyselyService` decorator. */
175
+ SeedcordErrorCode[SeedcordErrorCode["PluginKyselyServiceDecoratorMissing"] = 2201] = "PluginKyselyServiceDecoratorMissing";
176
+ /** Kysely service class is missing its table metadata. */
177
+ SeedcordErrorCode[SeedcordErrorCode["PluginKyselyServiceTableMissing"] = 2202] = "PluginKyselyServiceTableMissing";
156
178
  /** Migration manager received an invalid step count. */
157
- SeedcordErrorCode[SeedcordErrorCode["PluginKpgInvalidStepCount"] = 2203] = "PluginKpgInvalidStepCount";
179
+ SeedcordErrorCode[SeedcordErrorCode["PluginKyselyInvalidStepCount"] = 2203] = "PluginKyselyInvalidStepCount";
158
180
  /** Migration direction was not recognized. */
159
- SeedcordErrorCode[SeedcordErrorCode["PluginKpgUnknownDirection"] = 2204] = "PluginKpgUnknownDirection";
181
+ SeedcordErrorCode[SeedcordErrorCode["PluginKyselyUnknownDirection"] = 2204] = "PluginKyselyUnknownDirection";
160
182
  /** Provided migrations path could not be resolved. */
161
- SeedcordErrorCode[SeedcordErrorCode["PluginKpgUnresolvedMigrationsPath"] = 2205] = "PluginKpgUnresolvedMigrationsPath";
183
+ SeedcordErrorCode[SeedcordErrorCode["PluginKyselyUnresolvedMigrationsPath"] = 2205] = "PluginKyselyUnresolvedMigrationsPath";
162
184
  /** No migration files were found for execution. */
163
- SeedcordErrorCode[SeedcordErrorCode["PluginKpgNoMigrationFiles"] = 2206] = "PluginKpgNoMigrationFiles";
185
+ SeedcordErrorCode[SeedcordErrorCode["PluginKyselyNoMigrationFiles"] = 2206] = "PluginKyselyNoMigrationFiles";
164
186
  /** A migration module failed to export the expected functions. */
165
- SeedcordErrorCode[SeedcordErrorCode["PluginKpgInvalidMigrationModule"] = 2207] = "PluginKpgInvalidMigrationModule";
187
+ SeedcordErrorCode[SeedcordErrorCode["PluginKyselyInvalidMigrationModule"] = 2207] = "PluginKyselyInvalidMigrationModule";
166
188
  /** An arbitrary (non-Error) failure was reported by a migration. */
167
- SeedcordErrorCode[SeedcordErrorCode["PluginKpgNonErrorFailure"] = 2208] = "PluginKpgNonErrorFailure";
189
+ SeedcordErrorCode[SeedcordErrorCode["PluginKyselyNonErrorFailure"] = 2208] = "PluginKyselyNonErrorFailure";
168
190
  /** Postgres pool failed to close cleanly during shutdown. */
169
- SeedcordErrorCode[SeedcordErrorCode["PluginKpgDisconnectFailed"] = 2209] = "PluginKpgDisconnectFailed";
170
- /** KPG `services` was accessed before the plugin finished initializing. */
171
- SeedcordErrorCode[SeedcordErrorCode["PluginKpgServicesNotReady"] = 2210] = "PluginKpgServicesNotReady";
191
+ SeedcordErrorCode[SeedcordErrorCode["PluginKyselyDisconnectFailed"] = 2209] = "PluginKyselyDisconnectFailed";
192
+ /** Kysely `services` was accessed before the plugin finished initializing. */
193
+ SeedcordErrorCode[SeedcordErrorCode["PluginKyselyServicesNotReady"] = 2210] = "PluginKyselyServicesNotReady";
194
+ /** Postgres pool failed to establish a connection. */
195
+ SeedcordErrorCode[SeedcordErrorCode["PluginKyselyConnectionFailed"] = 2211] = "PluginKyselyConnectionFailed";
196
+ /** Bootstrapper failed to ensure the target Postgres database exists. */
197
+ SeedcordErrorCode[SeedcordErrorCode["PluginKyselyBootstrapFailed"] = 2212] = "PluginKyselyBootstrapFailed";
172
198
  /** Config file default export was not an object. */
173
199
  SeedcordErrorCode[SeedcordErrorCode["CliConfigInvalidExport"] = 3101] = "CliConfigInvalidExport";
174
200
  /** Config is missing the required instance string. */
@@ -218,19 +244,19 @@ let SeedcordErrorCode = /* @__PURE__ */ function(SeedcordErrorCode) {
218
244
  /** Two context-menu commands of the same kind share a name during codegen. */
219
245
  SeedcordErrorCode[SeedcordErrorCode["CliCodegenDuplicateContextMenu"] = 3124] = "CliCodegenDuplicateContextMenu";
220
246
  /** Could not resolve the application from the bot token during `commands --clean`. */
221
- SeedcordErrorCode[SeedcordErrorCode["CliCleanAppFetchFailed"] = 3126] = "CliCleanAppFetchFailed";
247
+ SeedcordErrorCode[SeedcordErrorCode["CliCleanAppFetchFailed"] = 3125] = "CliCleanAppFetchFailed";
222
248
  /** `commands --clean` ran with neither --guild nor --all-guilds, so there is nothing to scan. */
223
- SeedcordErrorCode[SeedcordErrorCode["CliCleanNoGuilds"] = 3127] = "CliCleanNoGuilds";
249
+ SeedcordErrorCode[SeedcordErrorCode["CliCleanNoGuilds"] = 3126] = "CliCleanNoGuilds";
224
250
  /** `commands --clean` combined --purge with --all-guilds, which would wipe every guild. */
225
- SeedcordErrorCode[SeedcordErrorCode["CliCleanPurgeAllGuilds"] = 3128] = "CliCleanPurgeAllGuilds";
251
+ SeedcordErrorCode[SeedcordErrorCode["CliCleanPurgeAllGuilds"] = 3127] = "CliCleanPurgeAllGuilds";
226
252
  /** An interactive prompt was cancelled (Ctrl-C), so the command aborts without changes. */
227
- SeedcordErrorCode[SeedcordErrorCode["CliCancelled"] = 3129] = "CliCancelled";
253
+ SeedcordErrorCode[SeedcordErrorCode["CliCancelled"] = 3128] = "CliCancelled";
228
254
  /** `commands --clean --all-guilds` matched more guilds than the safety threshold without `--yes`. */
229
- SeedcordErrorCode[SeedcordErrorCode["CliCleanLargeBotUnconfirmed"] = 3130] = "CliCleanLargeBotUnconfirmed";
255
+ SeedcordErrorCode[SeedcordErrorCode["CliCleanLargeBotUnconfirmed"] = 3129] = "CliCleanLargeBotUnconfirmed";
230
256
  /** `commands --clean --apply` ran in a non-interactive environment without `--yes`, where it cannot prompt. */
231
- SeedcordErrorCode[SeedcordErrorCode["CliCleanApplyNeedsYes"] = 3131] = "CliCleanApplyNeedsYes";
257
+ SeedcordErrorCode[SeedcordErrorCode["CliCleanApplyNeedsYes"] = 3130] = "CliCleanApplyNeedsYes";
232
258
  /** Config hmr rollback flag must be a boolean when provided. */
233
- SeedcordErrorCode[SeedcordErrorCode["CliConfigInvalidHmrRollback"] = 3132] = "CliConfigInvalidHmrRollback";
259
+ SeedcordErrorCode[SeedcordErrorCode["CliConfigInvalidHmrRollback"] = 3131] = "CliConfigInvalidHmrRollback";
234
260
  return SeedcordErrorCode;
235
261
  }({});
236
262
 
@@ -239,23 +265,28 @@ let SeedcordErrorCode = /* @__PURE__ */ function(SeedcordErrorCode) {
239
265
  /** @internal */
240
266
  const messages = {
241
267
  [1001]: () => "Missing DISCORD_BOT_TOKEN environment variable.",
242
- [1004]: () => "Invalid DISCORD_BOT_TOKEN value.",
243
- [1008]: () => "Missing DISCORD_PUBLIC_KEY environment variable.",
244
- [1009]: () => "Invalid DISCORD_PUBLIC_KEY value. Expected 64 hex characters.",
245
- [1006]: (envKey) => `${envKey} is not a well-formed Discord webhook url.`,
246
- [1007]: (envKey) => `The webhook behind ${envKey} does not exist on Discord.`,
247
- [1005]: (count, failures) => `Could not resolve ${count} configured emoji${count === 1 ? "" : "s"} at startup.\n${failures}`,
268
+ [1002]: () => "Invalid DISCORD_BOT_TOKEN value.",
269
+ [1006]: () => "Missing DISCORD_PUBLIC_KEY environment variable.",
270
+ [1007]: () => "Invalid DISCORD_PUBLIC_KEY value. Expected 64 hex characters.",
271
+ [1008]: () => "The route manifest is generated by `seedcord build`. Run the build before importing it.",
272
+ [1004]: (envKey) => `${envKey} is not a well-formed Discord webhook url.`,
273
+ [1005]: (envKey) => `The webhook behind ${envKey} does not exist on Discord.`,
274
+ [1003]: (count, failures) => `Could not resolve ${count} configured emoji${count === 1 ? "" : "s"} at startup.\n${failures}`,
248
275
  [1101]: () => "Cannot add tasks after startup sequence has already completed.",
249
276
  [1102]: () => "Cannot add tasks while startup sequence is in progress.",
250
277
  [1103]: () => "Cannot remove tasks while startup sequence is in progress.",
251
278
  [1104]: (phase) => `Unknown phase: ${String(phase)}.`,
252
279
  [1105]: (phase, failures) => `Phase ${phase} completed with ${failures} failed task${failures === 1 ? "" : "s"}.`,
253
280
  [1106]: (taskName, timeout) => `Task "${taskName}" timed out after ${timeout}ms.`,
281
+ [1107]: () => "Startup failed and this host cannot start again. Construct a new instance.",
254
282
  [1201]: () => "Seedcord can only be instantiated once. Use the existing instance instead.",
255
283
  [1202]: () => "Cannot attach a plugin after initialization.",
256
284
  [1203]: (key) => `Plugin with key "${key}" already exists.`,
257
285
  [1204]: (guildId) => guildId ? `Bot role not found in guild ${guildId}.` : "Bot role not found in guild.",
258
286
  [1205]: (controllerName, pathKind) => `${controllerName} was instantiated without a ${pathKind} path.`,
287
+ [1206]: (file) => `${file} threw while importing.`,
288
+ [1207]: (dir) => `${dir} could not be read.`,
289
+ [1208]: (key) => `Plugin key "${key}" is a channel the framework logs on. Pick another key.`,
259
290
  [1301]: () => "Interaction middleware cannot specify event filters.",
260
291
  [1302]: () => "Decorator could not locate the original method. Ensure the method exists before applying the decorator.",
261
292
  [1303]: (commandName, existingScope, requestedScope) => `Command "${commandName}" is already registered as a "${existingScope}" command and cannot be re-registered as a "${requestedScope}" command.`,
@@ -263,8 +294,11 @@ const messages = {
263
294
  [1305]: () => "RegisterCommand(\"guild\") requires a non-empty guilds array.",
264
295
  [1306]: () => "Middleware priority must be a finite number.",
265
296
  [1307]: (className) => `${className} extends WebhookLog and needs a @WebhookUrl decorator naming its env var.`,
266
- [1401]: (route, firstClass, secondClass) => `Two interaction handlers resolve to the same route \`${route}\`. Registered by ${firstClass} and ${secondClass}. Rename one.`,
297
+ [1401]: (route, first, second) => `Two interaction handlers resolve to the same route \`${route}\`. Registered by ${first} and ${second}. Rename one.`,
267
298
  [1402]: (name) => `Two different interaction middleware classes share the name \`${name}\`. Rename one so they do not collide.`,
299
+ [1403]: (route, exportName, from) => `Route \`${route}\` loads \`${exportName}\` from ${from}, which exports no such name.`,
300
+ [1404]: (keys, exportName, from) => `Subscriber row for \`${keys}\` loads \`${exportName}\` from ${from}, which does not extend Subscriber.`,
301
+ [1405]: (route, from) => `Route \`${route}\` failed to import ${from}.`,
268
302
  [1501]: (method, reason, alternative, routeId) => `${chalk.default.cyan(`${method}()`)} was called when ${reason}.\n${alternative} (route ${chalk.default.cyan(routeId)})`,
269
303
  [1502]: (componentClass, index, detail, routeId) => `${chalk.default.cyan(componentClass)} at components[${index}] failed to serialize: ${detail.replace(/\.$/, "")}. (route ${chalk.default.cyan(routeId)})`,
270
304
  [1503]: (method, targetId, routeId) => `${chalk.default.cyan(`${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 ${chalk.default.cyan(routeId)})`,
@@ -291,13 +325,16 @@ const messages = {
291
325
  [1804]: (key) => `A control row cannot repeat the '${key}' control.`,
292
326
  [1901]: (value) => `Cannot convert ${value} into a color.`,
293
327
  [1902]: () => "Color must be within the range 0 to 16777215 (0xffffff).",
294
- [2101]: (className) => `Missing @RegisterMongoService on ${className}.`,
295
- [2102]: (className) => `Missing @RegisterMongoModel on ${className}.`,
296
- [2103]: (databaseName) => databaseName ? `Could not connect to MongoDB (${databaseName}).` : "Could not connect to MongoDB.",
297
- [2104]: () => "Failed to disconnect from MongoDB cleanly during shutdown.",
298
- [2105]: () => "Mongo services accessed before the plugin finished initializing.",
299
- [2201]: (className) => `Missing @RegisterKpgService on ${className}.`,
300
- [2202]: (className) => `Missing table metadata for ${className}. Provide a table via @RegisterKpgService().`,
328
+ [2001]: (pluginName, reason) => `${pluginName} rejected its options, ${reason.replace(/\.$/, "")}.`,
329
+ [2002]: (pluginName) => `${pluginName} read this.ctx before attach finalized it. ctx is available from init() onward.`,
330
+ [2101]: (className) => `Missing @RegisterMongooseService on ${className}.`,
331
+ [2102]: (databaseName) => databaseName ? `Could not connect to MongoDB (${databaseName}).` : "Could not connect to MongoDB.",
332
+ [2103]: () => "Failed to disconnect from MongoDB cleanly during shutdown.",
333
+ [2104]: () => "Mongoose services accessed before the plugin finished initializing.",
334
+ [2105]: (modelName, className) => `Could not build the mongoose model ${modelName} for ${className}.`,
335
+ [2106]: (className) => `Empty model name on ${className}. Provide a non-empty modelName via @RegisterMongooseService().`,
336
+ [2201]: (className) => `Missing @RegisterKyselyService on ${className}.`,
337
+ [2202]: (className) => `Missing table metadata for ${className}. Provide a table via @RegisterKyselyService().`,
301
338
  [2203]: () => "Migration step count must be a non-negative integer.",
302
339
  [2204]: (direction) => `Unknown migration direction: ${String(direction)}.`,
303
340
  [2205]: (label) => `Unable to resolve migrations at path: ${label}.`,
@@ -305,7 +342,9 @@ const messages = {
305
342
  [2207]: (filePath) => `Migration file ${filePath} must export async functions up and down.`,
306
343
  [2208]: (message) => `Migration failure: ${message}.`,
307
344
  [2209]: () => "Failed to close the Postgres pool cleanly during shutdown.",
308
- [2210]: () => "KPG services accessed before the plugin finished initializing.",
345
+ [2210]: () => "Kysely services accessed before the plugin finished initializing.",
346
+ [2211]: (databaseName) => databaseName ? `Could not connect to Postgres (${databaseName}).` : "Could not connect to Postgres.",
347
+ [2212]: (databaseName) => `Failed to ensure database ${databaseName} exists.`,
309
348
  [3101]: () => "Config file must default export an object.",
310
349
  [3102]: () => "Config must include an `instance` string that points to your Seedcord default export.",
311
350
  [3103]: () => "Config `root` must be a string when provided.",
@@ -317,26 +356,26 @@ const messages = {
317
356
  [3114]: () => "Config `build.bootstrap` must be a string when provided.",
318
357
  [3115]: (entryPath, root) => `Entry file ${entryPath} must reside inside configured root ${root}.`,
319
358
  [3105]: (entryPath) => `Cannot find entry file at ${entryPath}.`,
320
- [3106]: (entryPath, reason) => `Failed to import ${entryPath} via tsx: ${reason}.`,
321
- [3107]: (entryPath, nativeReason, fallbackReason) => `Failed to import ${entryPath}: ${nativeReason}. Fallback via jiti also failed: ${fallbackReason}.`,
359
+ [3106]: (entryPath, reason) => `Failed to import ${entryPath} via tsx: ${reason}`,
360
+ [3107]: (entryPath, nativeReason, fallbackReason) => `Failed to import ${entryPath}: ${nativeReason} (the jiti fallback also failed: ${fallbackReason})`,
322
361
  [3108]: () => "Seedcord instance must default export an object with a start() method.",
323
- [3109]: (instancePath, reason) => `Failed to start Seedcord from ${instancePath}: ${reason}.`,
362
+ [3109]: (instancePath, reason) => `Failed to start Seedcord from ${instancePath}: ${reason}`,
324
363
  [3116]: (hint) => `Unable to resolve a tsconfig for builds (${hint}). Provide build.tsconfig or add tsconfig.build.json / tsconfig.json.`,
325
364
  [3117]: (diagnostics) => `TypeScript build failed:\n${diagnostics}`,
326
- [3118]: (targetPath, reason) => `Failed to write bootstrap file at ${targetPath}: ${reason}.`,
365
+ [3118]: (targetPath, reason) => `Failed to write bootstrap file at ${targetPath}: ${reason}`,
327
366
  [3119]: () => "Config `tsconfig` must be a string when provided.",
328
367
  [3120]: () => "Config `hmr` must be an object when provided.",
329
368
  [3121]: () => "Config `hmr.restart` must be an array of strings when provided.",
330
- [3132]: () => "Config `hmr.rollback` must be a boolean when provided.",
369
+ [3131]: () => "Config `hmr.rollback` must be a boolean when provided.",
331
370
  [3122]: (route, firstFile, secondFile) => `Two commands resolve to the same slash route \`${route}\`. Defined in ${firstFile} and ${secondFile}. Rename one.`,
332
- [3123]: (dir, reason) => `Could not read the commands directory ${dir} during codegen. ${reason}.`,
371
+ [3123]: (dir, reason) => `Could not read the commands directory ${dir} during codegen. ${reason}`,
333
372
  [3124]: (kind, name, firstFile, secondFile) => `Two ${kind} context-menu commands share the name \`${name}\`. Defined in ${firstFile} and ${secondFile}. Rename one.`,
334
- [3126]: (reason) => `Could not resolve the application from the bot token. ${reason}.`,
335
- [3127]: () => "No guilds given. Pass --guild <ids...> or --all-guilds. Global commands are never touched.",
336
- [3128]: () => "--purge cannot be combined with --all-guilds. Use --guild <ids> to purge specific guilds.",
337
- [3129]: () => "Cancelled.",
338
- [3130]: (count) => `Refusing to scan ${count} guilds without confirmation. Re-run with --yes, or name specific guilds with --guild <ids>.`,
339
- [3131]: () => "Refusing to delete without confirmation in a non-interactive environment. Re-run with --yes."
373
+ [3125]: (reason) => `Could not resolve the application from the bot token. ${reason}`,
374
+ [3126]: () => "No guilds given. Pass --guild <ids...> or --all-guilds. Global commands are never touched.",
375
+ [3127]: () => "--purge cannot be combined with --all-guilds. Use --guild <ids> to purge specific guilds.",
376
+ [3128]: () => "Cancelled.",
377
+ [3129]: (count) => `Refusing to scan ${count} guilds without confirmation. Re-run with --yes, or name specific guilds with --guild <ids>.`,
378
+ [3130]: () => "Refusing to delete without confirmation in a non-interactive environment. Re-run with --yes."
340
379
  };
341
380
  /** @internal */
342
381
  function formatSeedcordErrorMessage(code, args) {
@@ -470,4 +509,4 @@ Object.defineProperty(exports, 'isSeedcordError', {
470
509
  return isSeedcordError;
471
510
  }
472
511
  });
473
- //# sourceMappingURL=SeedcordError-DRCE9RFI.cjs.map
512
+ //# sourceMappingURL=SeedcordError-Co6sHdk8.cjs.map