@seedcord/services 0.7.1-next.0 → 0.8.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.
@@ -1,339 +0,0 @@
1
- //#region src/Errors/ErrorCodes.d.ts
2
- /**
3
- * All Seedcord error codes.
4
- */
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 = 1004,
10
- /** UNKNOWN_EXCEPTION_WEBHOOK_URL is missing when configuring the reporter. */
11
- ConfigUnknownExceptionWebhookMissing = 1002,
12
- /** UNKNOWN_EXCEPTION_WEBHOOK_URL is present but fails URL validation. */
13
- ConfigUnknownExceptionWebhookInvalid = 1003,
14
- /** Attempted to add lifecycle tasks after startup already completed. */
15
- LifecycleAddAfterCompletion = 1101,
16
- /** Attempted to add lifecycle tasks while startup is still running. */
17
- LifecycleAddDuringRun = 1102,
18
- /** Attempted to remove lifecycle tasks while startup is still running. */
19
- LifecycleRemoveDuringRun = 1103,
20
- /** Provided lifecycle phase identifier is not recognized. */
21
- LifecycleUnknownPhase = 1104,
22
- /** Startup phase completed with one or more task failures. */
23
- LifecyclePhaseFailures = 1105,
24
- /** A lifecycle task exceeded its configured timeout. */
25
- LifecycleTaskTimeout = 1106,
26
- /** Multiple Seedcord instances were created simultaneously. */
27
- CoreSingletonViolation = 1201,
28
- /** Plugins cannot be mutated after the core has finished initializing. */
29
- CorePluginAfterInit = 1202,
30
- /** A plugin tried to register with a key that already exists. */
31
- CorePluginKeyExists = 1203,
32
- /** Bot role lookup failed within the provided guild. */
33
- CoreBotRoleMissing = 1204,
34
- /** A bot controller was constructed without its required handlers directory. */
35
- CoreControllerPathMissing = 1205,
36
- /** Interaction middleware decorated with disallowed event filters. */
37
- DecoratorInteractionEventFilter = 1301,
38
- /** A decorator could not find the original method being decorated. */
39
- DecoratorMethodNotFound = 1302,
40
- /** A command decorator attempted to re-register an existing command scope. */
41
- DecoratorCommandAlreadyRegistered = 1303,
42
- /** A global command decorator specified guild IDs, which is not allowed. */
43
- DecoratorCommandGlobalWithGuilds = 1304,
44
- /** A guild command decorator omitted the required guild ID list. */
45
- DecoratorCommandGuildWithoutGuilds = 1305,
46
- /** Middleware priority provided by the decorator was not a finite number. */
47
- DecoratorInvalidMiddlewarePriority = 1306,
48
- /** StrictEventEmitter.waitFor was aborted via its AbortSignal. */
49
- EventEmitterWaitForAborted = 1501,
50
- /** StrictEventEmitter.waitFor exceeded its configured timeout. */
51
- EventEmitterWaitForTimeout = 1502,
52
- /** A customId definition prefix contains a reserved character (a colon or a control char). */
53
- CustomIdInvalidPrefix = 1601,
54
- /** A customId field name is integer-like, which JS would silently reorder. */
55
- CustomIdReservedFieldName = 1602,
56
- /** A oneOf() field was declared with no choices. */
57
- CustomIdEmptyChoices = 1603,
58
- /** An int() field was declared with min greater than max. */
59
- CustomIdInvalidBounds = 1604,
60
- /** A value passed to encode() is outside its field's allowed range. */
61
- CustomIdValueOutOfRange = 1605,
62
- /** An encoded customId exceeds Discord's 100-character limit. */
63
- CustomIdWireTooLong = 1606,
64
- /** A field name is declared more than once in the same customId chain. */
65
- CustomIdDuplicateFieldName = 1607,
66
- /** A component handler is missing its route decorator (\@ButtonRoute / \@ModalRoute / \@SelectMenuRoute). */
67
- CustomIdHandlerRouteMissing = 1608,
68
- /** match() received a decoded route with no matching arm. */
69
- CustomIdMatchArmMissing = 1609,
70
- /** A slash handler's match() has no arm for the command route that fired. */
71
- SlashMatchArmMissing = 1610,
72
- /** An autocomplete handler's match() has no arm for the focused field that fired. */
73
- AutocompleteMatchArmMissing = 1611,
74
- /** An event handler's match() has no arm for the event name that fired. */
75
- EventMatchArmMissing = 1612,
76
- /** Event middleware read `this.eventName` but was constructed without a fired event name. */
77
- EventMiddlewareNameUnavailable = 1613,
78
- /** Mongo service class is missing the `@RegisterMongoService` decorator. */
79
- PluginMongoServiceDecoratorMissing = 2101,
80
- /** Mongo model class is missing the `@RegisterMongoModel` decorator. */
81
- PluginMongoModelDecoratorMissing = 2102,
82
- /** Mongo client failed to establish a connection. */
83
- PluginMongoConnectionFailed = 2103,
84
- /** Mongo client failed to disconnect cleanly during shutdown. */
85
- PluginMongoDisconnectFailed = 2104,
86
- /** Mongo `services` was accessed before the plugin finished initializing. */
87
- PluginMongoServicesNotReady = 2105,
88
- /** KPG service class is missing the `@RegisterKpgService` decorator. */
89
- PluginKpgServiceDecoratorMissing = 2201,
90
- /** KPG service class is missing its table metadata. */
91
- PluginKpgServiceTableMissing = 2202,
92
- /** Migration manager received an invalid step count. */
93
- PluginKpgInvalidStepCount = 2203,
94
- /** Migration direction was not recognized. */
95
- PluginKpgUnknownDirection = 2204,
96
- /** Provided migrations path could not be resolved. */
97
- PluginKpgUnresolvedMigrationsPath = 2205,
98
- /** No migration files were found for execution. */
99
- PluginKpgNoMigrationFiles = 2206,
100
- /** A migration module failed to export the expected functions. */
101
- PluginKpgInvalidMigrationModule = 2207,
102
- /** An arbitrary (non-Error) failure was reported by a migration. */
103
- PluginKpgNonErrorFailure = 2208,
104
- /** Postgres pool failed to close cleanly during shutdown. */
105
- PluginKpgDisconnectFailed = 2209,
106
- /** KPG `services` was accessed before the plugin finished initializing. */
107
- PluginKpgServicesNotReady = 2210,
108
- /** Config file default export was not an object. */
109
- CliConfigInvalidExport = 3101,
110
- /** Config is missing the required instance string. */
111
- CliConfigMissingInstance = 3102,
112
- /** Config root was provided but not a string. */
113
- CliConfigInvalidRoot = 3103,
114
- /** Unable to locate a Seedcord config file. */
115
- CliConfigNotFound = 3104,
116
- /** CLI entry file does not exist. */
117
- CliEntryNotFound = 3105,
118
- /** tsx failed to import the provided entry file. */
119
- CliTsxImportFailed = 3106,
120
- /** Native import and jiti fallback both failed. */
121
- CliImportFailed = 3107,
122
- /** Seedcord instance export is missing a start() method. */
123
- CliInstanceInvalid = 3108,
124
- /** Seedcord instance threw during startup. */
125
- CliStartFailed = 3109,
126
- /** Config is missing the required entry string. */
127
- CliConfigMissingEntry = 3110,
128
- /** Config build options must be an object when provided. */
129
- CliConfigInvalidBuild = 3111,
130
- /** Config build outDir must be a string when provided. */
131
- CliConfigInvalidBuildOutDir = 3112,
132
- /** Config build tsconfig must be a string when provided. */
133
- CliConfigInvalidBuildTsconfig = 3113,
134
- /** Config build bootstrap must be a string when provided. */
135
- CliConfigInvalidBuildBootstrap = 3114,
136
- /** Entry file must be inside the configured root directory. */
137
- CliConfigEntryOutsideRoot = 3115,
138
- /** Unable to locate a TypeScript config file for builds. */
139
- CliBuildTsconfigNotFound = 3116,
140
- /** TypeScript reported diagnostics during emit. */
141
- CliBuildFailed = 3117,
142
- /** Unable to write the generated bootstrap file. */
143
- CliBootstrapWriteFailed = 3118,
144
- /** Config tsconfig must be a string when provided. */
145
- CliConfigInvalidTsconfig = 3119,
146
- /** Config hmr options must be an object when provided. */
147
- CliConfigInvalidHmr = 3120,
148
- /** Config hmr restart patterns must be an array of strings when provided. */
149
- CliConfigInvalidHmrRestart = 3121,
150
- /** Two commands resolve to the same slash route during codegen. */
151
- CliCodegenDuplicateRoute = 3122,
152
- /** The commands directory could not be read during codegen. */
153
- CliCodegenCommandsDirUnreadable = 3123,
154
- /** Two context-menu commands of the same kind share a name during codegen. */
155
- CliCodegenDuplicateContextMenu = 3124
156
- }
157
- //#endregion
158
- //#region src/Errors/ErrorMessages.d.ts
159
- /** @internal */
160
- declare const messages: {
161
- 1001: () => string;
162
- 1004: () => string;
163
- 1002: () => string;
164
- 1003: () => string;
165
- 1101: () => string;
166
- 1102: () => string;
167
- 1103: () => string;
168
- 1104: (phase: unknown) => string;
169
- 1105: (phase: string, failures: number) => string;
170
- 1106: (taskName: string, timeout: number) => string;
171
- 1201: () => string;
172
- 1202: () => string;
173
- 1203: (key: string) => string;
174
- 1204: (guildId?: string) => string;
175
- 1205: (controllerName: string, pathKind: string) => string;
176
- 1301: () => string;
177
- 1302: () => string;
178
- 1303: (commandName: string, existingScope: string, requestedScope: string) => string;
179
- 1304: () => string;
180
- 1305: () => string;
181
- 1306: () => string;
182
- 1501: () => string;
183
- 1502: (timeout: number) => string;
184
- 1601: (prefix: string) => string;
185
- 1602: (field: string) => string;
186
- 1603: (field: string) => string;
187
- 1604: (field: string, min: number, max: number) => string;
188
- 1605: (field: string, value: string) => string;
189
- 1606: (length: number) => string;
190
- 1607: (field: string) => string;
191
- 1608: (className: string) => string;
192
- 1609: (prefix: string) => string;
193
- 1610: (route: string) => string;
194
- 1611: (field: string) => string;
195
- 1612: (event: string) => string;
196
- 1613: () => string;
197
- 2101: (className: string) => string;
198
- 2102: (className: string) => string;
199
- 2103: (databaseName?: string) => string;
200
- 2104: () => string;
201
- 2105: () => string;
202
- 2201: (className: string) => string;
203
- 2202: (className: string) => string;
204
- 2203: () => string;
205
- 2204: (direction: unknown) => string;
206
- 2205: (label: string) => string;
207
- 2206: () => string;
208
- 2207: (filePath: string) => string;
209
- 2208: (message: string) => string;
210
- 2209: () => string;
211
- 2210: () => string;
212
- 3101: () => string;
213
- 3102: () => string;
214
- 3103: () => string;
215
- 3104: (baseDir: string, candidates: readonly string[]) => string;
216
- 3110: () => string;
217
- 3111: () => string;
218
- 3112: () => string;
219
- 3113: () => string;
220
- 3114: () => string;
221
- 3115: (entryPath: string, root: string) => string;
222
- 3105: (entryPath: string) => string;
223
- 3106: (entryPath: string, reason: string) => string;
224
- 3107: (entryPath: string, nativeReason: string, fallbackReason: string) => string;
225
- 3108: () => string;
226
- 3109: (instancePath: string, reason: string) => string;
227
- 3116: (hint: string) => string;
228
- 3117: (diagnostics: string) => string;
229
- 3118: (targetPath: string, reason: string) => string;
230
- 3119: () => string;
231
- 3120: () => string;
232
- 3121: () => string;
233
- 3122: (route: string, firstFile: string, secondFile: string) => string;
234
- 3123: (dir: string, reason: string) => string;
235
- 3124: (kind: string, name: string, firstFile: string, secondFile: string) => string;
236
- };
237
- /** @internal */
238
- type SeedcordErrorArguments<Code extends SeedcordErrorCode> = Parameters<(typeof messages)[Code]>;
239
- //#endregion
240
- //#region src/Errors/SeedcordError.d.ts
241
- /**
242
- * String literal type for Seedcord error identifiers.
243
- *
244
- * @internal
245
- */
246
- type SeedcordErrorIdentifier = keyof typeof SeedcordErrorCode;
247
- /**
248
- * Options for Seedcord errors.
249
- *
250
- * @internal
251
- */
252
- interface SeedcordErrorOptions extends ErrorOptions {}
253
- type SeedcordErrorCtorRest<Code extends SeedcordErrorCode> = SeedcordErrorArguments<Code> extends [] ? [options?: SeedcordErrorOptions] : [args: SeedcordErrorArguments<Code>, options?: SeedcordErrorOptions];
254
- /**
255
- * String literal type for Seedcord error class names.
256
- *
257
- * @internal
258
- */
259
- type SeedcordErrorTypeString = `Seedcord${'Error' | 'TypeError' | 'RangeError'}`;
260
- /**
261
- * Base interface for Seedcord error instances.
262
- *
263
- * @internal
264
- */
265
- interface BaseSeedcordError {
266
- readonly code: SeedcordErrorCode;
267
- readonly identifier: SeedcordErrorIdentifier;
268
- readonly type: SeedcordErrorTypeString;
269
- }
270
- /**
271
- * Base class for Seedcord errors.
272
- *
273
- * @internal
274
- */
275
- declare class SeedcordError<Code extends SeedcordErrorCode = SeedcordErrorCode> extends Error implements BaseSeedcordError {
276
- readonly code: Code;
277
- readonly identifier: SeedcordErrorIdentifier;
278
- readonly type = "SeedcordError";
279
- constructor(code: Code, ...rest: SeedcordErrorCtorRest<Code>);
280
- }
281
- /**
282
- * TypeError class for Seedcord errors.
283
- *
284
- * @internal
285
- */
286
- declare class SeedcordTypeError<Code extends SeedcordErrorCode = SeedcordErrorCode> extends TypeError implements BaseSeedcordError {
287
- readonly code: Code;
288
- readonly identifier: SeedcordErrorIdentifier;
289
- readonly type = "SeedcordTypeError";
290
- constructor(code: Code, ...rest: SeedcordErrorCtorRest<Code>);
291
- }
292
- /**
293
- * RangeError class for Seedcord errors.
294
- *
295
- * @internal
296
- */
297
- declare class SeedcordRangeError<Code extends SeedcordErrorCode = SeedcordErrorCode> extends RangeError implements BaseSeedcordError {
298
- readonly code: Code;
299
- readonly identifier: SeedcordErrorIdentifier;
300
- readonly type = "SeedcordRangeError";
301
- constructor(code: Code, ...rest: SeedcordErrorCtorRest<Code>);
302
- }
303
- /**
304
- * Variant type for Seedcord error classes.
305
- *
306
- * @internal
307
- */
308
- type SeedcordErrorVariant<Type extends SeedcordErrorTypeString, Code extends SeedcordErrorCode> = Type extends 'SeedcordError' ? SeedcordError<Code> : Type extends 'SeedcordTypeError' ? SeedcordTypeError<Code> : SeedcordRangeError<Code>;
309
- /**
310
- * Union type of all Seedcord error variants for a specific error code.
311
- *
312
- * @internal
313
- */
314
- type AnySeedcordErrorForCode<Code extends SeedcordErrorCode> = { [Variant in SeedcordErrorTypeString]: SeedcordErrorVariant<Variant, Code> }[SeedcordErrorTypeString];
315
- /**
316
- * Union type of all Seedcord errors filtered by error class.
317
- *
318
- * @internal
319
- */
320
- type ErrorTypeFilter<Type extends SeedcordErrorTypeString | undefined> = Type extends SeedcordErrorTypeString ? { [Code in SeedcordErrorCode]: SeedcordErrorVariant<Type, Code> }[SeedcordErrorCode] : AnySeedcordErrorForCode<SeedcordErrorCode>;
321
- /**
322
- * Union type of all Seedcord errors filtered by error class and error code.
323
- *
324
- * @internal
325
- */
326
- type ErrorCodeFilter<Type extends SeedcordErrorTypeString | undefined, Code extends SeedcordErrorCode | undefined> = Code extends SeedcordErrorCode ? Type extends SeedcordErrorTypeString ? SeedcordErrorVariant<Type, Code> : AnySeedcordErrorForCode<Code> : ErrorTypeFilter<Type>;
327
- /**
328
- * Determines whether an unknown value is a Seedcord error, with optional narrowing by class and error code.
329
- *
330
- * @param error - The value to inspect.
331
- * @param type - Optional error class discriminator (Error, TypeError, or RangeError).
332
- * @param code - Optional {@link SeedcordErrorCode} discriminator to narrow by code.
333
- * @typeParam Type - What kind of {@link SeedcordErrorTypeString} to filter by.
334
- * @typeParam Code - The specific {@link SeedcordErrorCode} to filter by.
335
- */
336
- declare function isSeedcordError<Type extends SeedcordErrorTypeString | undefined, Code extends SeedcordErrorCode | undefined>(error: unknown, type?: Type, code?: Code): error is ErrorCodeFilter<Type, Code>;
337
- //#endregion
338
- export { SeedcordTypeError as a, SeedcordRangeError as i, SeedcordError as n, isSeedcordError as o, SeedcordErrorTypeString as r, SeedcordErrorCode as s, BaseSeedcordError as t };
339
- //# sourceMappingURL=SeedcordError-D6uPv6qc.d.mts.map