@seedcord/errors 0.15.0-next.0 → 0.15.0-next.3

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.
@@ -0,0 +1,301 @@
1
+ import { t as SeedcordErrorCode } from "./ErrorCodes-BfhJtzPM.mjs";
2
+ import { ColorSupportLevel } from "chalk";
3
+ //#region src/palette.d.ts
4
+ declare function setColorLevel(level: ColorSupportLevel): void;
5
+ declare const paint: {
6
+ readonly sky: import("chalk").ChalkInstance;
7
+ readonly path: (path: string) => string;
8
+ readonly iris: import("chalk").ChalkInstance;
9
+ readonly mint: import("chalk").ChalkInstance;
10
+ readonly amber: import("chalk").ChalkInstance;
11
+ readonly coral: import("chalk").ChalkInstance;
12
+ readonly flesh: import("chalk").ChalkInstance;
13
+ readonly rind: import("chalk").ChalkInstance;
14
+ readonly pith: import("chalk").ChalkInstance;
15
+ readonly mute: import("chalk").ChalkInstance;
16
+ readonly check: "✔︎";
17
+ readonly cross: "✘";
18
+ readonly bold: import("chalk").ChalkInstance;
19
+ readonly italic: import("chalk").ChalkInstance;
20
+ readonly underline: import("chalk").ChalkInstance;
21
+ };
22
+ declare const WORDMARK: string;
23
+ //#endregion
24
+ //#region src/messageParts.d.ts
25
+ interface VitePluginPlace {
26
+ hook?: string | undefined;
27
+ loading?: {
28
+ kind: 'file';
29
+ path: string;
30
+ } | {
31
+ kind: 'virtual';
32
+ id: string;
33
+ } | undefined;
34
+ }
35
+ declare const listedFolderProblems: {
36
+ missing: string;
37
+ file: string;
38
+ outsideProject: string;
39
+ };
40
+ //#endregion
41
+ //#region src/ErrorMessages.d.ts
42
+ /** @internal */
43
+ declare const messages: {
44
+ 1001: (count: number) => string;
45
+ 1002: (key: string) => string;
46
+ 1003: (key: string, name: string, where: string) => string;
47
+ 1004: (key: string, name: string, where: string, reason: string, fix: string) => string;
48
+ 1005: (envKey: string) => string;
49
+ 1006: (name: string) => string;
50
+ 1007: (name: string, expected: string, why?: string) => string;
51
+ 1008: (commands: readonly string[]) => string;
52
+ 1009: (runtime: string, required: string, running: string) => string;
53
+ 1010: (key: string) => string;
54
+ 1011: (port: number, setting: string, configFile?: string) => string;
55
+ 1101: (action: "add" | "remove", startup: "running" | "finished") => string;
56
+ 1102: (phase: unknown) => string;
57
+ 1103: (phase: string, failures: number) => string;
58
+ 1104: (taskName: string, timeout: number) => string;
59
+ 1105: () => string;
60
+ 1106: (setting: string, value: number) => string;
61
+ 1201: () => string;
62
+ 1202: () => string;
63
+ 1203: (key: string) => string;
64
+ 1204: (guildId?: string) => string;
65
+ 1205: (controllerName: string, pathKind: string) => string;
66
+ 1206: (file: string, reason: string) => string;
67
+ 1229: (plugin: string, place: VitePluginPlace, configFile: string, reason: string) => string;
68
+ 1207: (path: string, reason: string) => string;
69
+ 1219: (path: string, root: string) => string;
70
+ 1223: (dir: string) => string;
71
+ 1225: (dir: string, root: string) => string;
72
+ 1230: (dir: string) => string;
73
+ 1231: (dir: string) => string;
74
+ 1232: () => string;
75
+ 1234: (operation: "read" | "write" | "delete" | "list", key: string) => string;
76
+ 1235: (guildId: string) => string;
77
+ 1236: () => string;
78
+ 1233: (plugin: string) => string;
79
+ 1215: (head: string, key: string) => string;
80
+ 1217: (key: string, reason: string) => string;
81
+ 1218: (plugin: string) => string;
82
+ 1220: (plugin: string, axis: string, declared: string, host: string) => string;
83
+ 1216: (key: string) => string;
84
+ 1208: (key: string) => string;
85
+ 1209: () => string;
86
+ 1222: () => string;
87
+ 1221: () => string;
88
+ 1210: (accessor: string, key: string) => string;
89
+ 1211: () => string;
90
+ 1212: (event: string) => string;
91
+ 1213: (commandName: string) => string;
92
+ 1214: (guildId: string, reason: string, status?: number) => string;
93
+ 1224: (reason: string, status?: number) => string;
94
+ 1226: (className: string) => string;
95
+ 1227: (what: string, reason: string, fix?: string) => string;
96
+ 1228: (kind: string, name: string, sources?: readonly string[], note?: string) => string;
97
+ 1301: (commandName: string, existingCall: string, requestedCall: string) => string;
98
+ 1302: (className: string) => string;
99
+ 1303: (className: string) => string;
100
+ 1304: (className: string, priority: string) => string;
101
+ 1305: (className: string) => string;
102
+ 1306: (className: string, key: string) => string;
103
+ 1307: (decorator: string, className: string, key: string, fix: string) => string;
104
+ 1501: (method: string, reason: string, alternative: string, routeId: string) => string;
105
+ 1502: (componentClass: string, index: number, detail: string, routeId: string) => string;
106
+ 1503: (method: string, targetId: string, routeId: string) => string;
107
+ 1504: (method: string, routeId: string) => string;
108
+ 1505: (method: string, routeId: string) => string;
109
+ 1601: (prefix: string) => string;
110
+ 1602: (field: string) => string;
111
+ 1603: (field: string, method: string) => string;
112
+ 1604: (field: string, min: number, max: number) => string;
113
+ 1605: (field: string, expected: string, value: string) => string;
114
+ 1606: (prefix: string, length: number) => string;
115
+ 1607: (className: string) => string;
116
+ 1608: (handler: string, kind: string, value: string) => string;
117
+ 1610: () => string;
118
+ 1611: (customId: string) => string;
119
+ 1612: (customId: string, kind: string, getter?: string) => string;
120
+ 1613: (customId: string) => string;
121
+ 1614: (customId: string, picked: string, allowed: readonly string[]) => string;
122
+ 1615: (prefix: string) => string;
123
+ 1616: (detail: string) => string;
124
+ 1617: (key: string) => string;
125
+ 1701: (input: string) => string;
126
+ 1801: (perPage: number) => string;
127
+ 1802: (count: number, max: number) => string;
128
+ 1803: (key: string) => string;
129
+ 1901: (value: string) => string;
130
+ 1902: (value: number) => string;
131
+ 1951: (option: string, expected: string, value: number) => string;
132
+ 1952: (value: string) => string;
133
+ 1971: (filename: string, logsFolder: string) => string;
134
+ 2001: (pluginName: string, reason: string) => string;
135
+ 2002: (count: number) => string;
136
+ 2003: (decorator: string, className: string) => string;
137
+ 2004: (pluginName: string) => string;
138
+ 2005: (service: string, target?: string) => string;
139
+ 2006: (service: string) => string;
140
+ 2101: (modelName: string, className: string) => string;
141
+ 2102: (className: string) => string;
142
+ 2201: (className: string) => string;
143
+ 2202: (steps: number) => string;
144
+ 2203: (direction: unknown) => string;
145
+ 2204: (filePath: string) => string;
146
+ 2205: (message: string) => string;
147
+ 2206: (databaseName: string) => string;
148
+ 3001: () => string;
149
+ 3101: () => string;
150
+ 3102: (baseDir: string, candidates: readonly string[]) => string;
151
+ 3112: (field: string, expected: string) => string;
152
+ 3103: (path: string, field: string) => string;
153
+ 3104: (instancePath: string) => string;
154
+ 3105: (instancePath: string, reason: string) => string;
155
+ 3106: (configDir: string, configured?: string) => string;
156
+ 3116: (packages: readonly string[], projectDir: string, why: string) => string;
157
+ 3107: (diagnostics: string) => string;
158
+ 3114: (reason: string) => string;
159
+ 3115: (outDir: string, root: string) => string;
160
+ 3117: (outDir: string) => string;
161
+ 3118: (count: number) => string;
162
+ 3130: (lines: readonly string[]) => string;
163
+ 3131: (method: string) => string;
164
+ 3132: (instance: string) => string;
165
+ 3133: () => string;
166
+ 3108: (flags: readonly string[], note?: string) => string;
167
+ 3113: (name: string, file: string, reason: string) => string;
168
+ 3134: (name: string, file: string) => string;
169
+ 3135: () => string;
170
+ 3136: () => string;
171
+ 3137: (cloudflareConfig: string) => string;
172
+ 3138: (cliDir: string, projectInstall: string) => string;
173
+ 3139: (name: string, created: readonly string[]) => string;
174
+ 3140: (folder: string, problem: keyof typeof listedFolderProblems) => string;
175
+ 3141: (configDir: string, pid: number, startedAt: string, lockFile: string) => string;
176
+ 3142: (folder: string) => string;
177
+ 3143: (plugin: string, key: string, reason: string) => string;
178
+ 3144: (plugin: string, key: string) => string;
179
+ 3145: (id: string, key: string, path: string, value: string) => string;
180
+ 3146: (id: string, first: string, second: string, path: string) => string;
181
+ 3147: (minLength: number) => string;
182
+ 3148: (wait: string, guide: string) => string;
183
+ 3149: (reason: string, guide: string) => string;
184
+ 3119: (outputPath: string) => string;
185
+ 3121: (cloudflareConfig: string, tsconfig: string) => string;
186
+ 3122: (tsconfig: string, configDir: string) => string;
187
+ 3123: (tool: string, file: string, output: string) => string;
188
+ 3125: (field: string, file: string, why: string) => string;
189
+ 3126: (cloudflareConfig: string, date: string, firstDate: string) => string;
190
+ 3127: (cloudflareConfig: string) => string;
191
+ 3128: (reason: string) => string;
192
+ 3129: (configFile: string, root: string) => string;
193
+ 3124: (tsc: string, reason: string) => string;
194
+ 3120: (path: string) => string;
195
+ 3109: (seconds: number) => string;
196
+ 3110: (url: string) => string;
197
+ 3111: (url: string, seconds: number) => string;
198
+ 3201: (flag: string) => string;
199
+ 3202: (flag: string, reason: string) => string;
200
+ 3203: (reason: string) => string;
201
+ 3204: (target: string) => string;
202
+ 3205: (command: string, reason: string) => string;
203
+ 3301: (name: string) => string;
204
+ 3302: (template: string, folder: string, count: number) => string;
205
+ 3303: (template: string, value: string, first: "text" | "list" | "object", second: "text" | "list" | "object") => string;
206
+ 3304: (file: string, from: string, reason: string) => string;
207
+ 3305: (template: string, value: string) => string;
208
+ 3306: () => string;
209
+ 3307: (folder: string) => string;
210
+ 3308: (path: string, takenByTemplate?: string) => string;
211
+ 3309: (template: string, partial: string) => string;
212
+ };
213
+ /** @internal */
214
+ type SeedcordErrorArguments<Code extends SeedcordErrorCode> = Parameters<(typeof messages)[Code]>;
215
+ //#endregion
216
+ //#region src/SeedcordError.d.ts
217
+ /**
218
+ * String literal type for Seedcord error identifiers.
219
+ *
220
+ * @internal
221
+ */
222
+ type SeedcordErrorIdentifier = keyof typeof SeedcordErrorCode;
223
+ /**
224
+ * Options for Seedcord errors.
225
+ *
226
+ * @internal
227
+ */
228
+ interface SeedcordErrorOptions extends ErrorOptions {}
229
+ type SeedcordErrorCtorRest<Code extends SeedcordErrorCode> = SeedcordErrorArguments<Code> extends [] ? [options?: SeedcordErrorOptions] : [args: SeedcordErrorArguments<Code>, options?: SeedcordErrorOptions];
230
+ /**
231
+ * The Seedcord error class names as string literals. {@link isSeedcordError} takes one as its `type`
232
+ * argument.
233
+ */
234
+ type SeedcordErrorTypeString = `Seedcord${'Error' | 'TypeError' | 'RangeError' | 'AggregateError'}`;
235
+ declare const kIdentifier: unique symbol;
236
+ interface BaseSeedcordError {
237
+ readonly code: SeedcordErrorCode;
238
+ readonly [kIdentifier]: SeedcordErrorIdentifier;
239
+ readonly type: SeedcordErrorTypeString;
240
+ }
241
+ declare class SeedcordError<Code extends SeedcordErrorCode = SeedcordErrorCode> extends Error implements BaseSeedcordError {
242
+ readonly code: Code;
243
+ readonly [kIdentifier]: SeedcordErrorIdentifier;
244
+ readonly type = "SeedcordError";
245
+ constructor(code: Code, ...rest: SeedcordErrorCtorRest<Code>);
246
+ }
247
+ declare class SeedcordTypeError<Code extends SeedcordErrorCode = SeedcordErrorCode> extends TypeError implements BaseSeedcordError {
248
+ readonly code: Code;
249
+ readonly [kIdentifier]: SeedcordErrorIdentifier;
250
+ readonly type = "SeedcordTypeError";
251
+ constructor(code: Code, ...rest: SeedcordErrorCtorRest<Code>);
252
+ }
253
+ declare class SeedcordRangeError<Code extends SeedcordErrorCode = SeedcordErrorCode> extends RangeError implements BaseSeedcordError {
254
+ readonly code: Code;
255
+ readonly [kIdentifier]: SeedcordErrorIdentifier;
256
+ readonly type = "SeedcordRangeError";
257
+ constructor(code: Code, ...rest: SeedcordErrorCtorRest<Code>);
258
+ }
259
+ declare class SeedcordAggregateError<Code extends SeedcordErrorCode = SeedcordErrorCode> extends AggregateError implements BaseSeedcordError {
260
+ readonly code: Code;
261
+ readonly [kIdentifier]: SeedcordErrorIdentifier;
262
+ readonly type = "SeedcordAggregateError";
263
+ constructor(code: Code, errors: readonly unknown[], ...rest: SeedcordErrorCtorRest<Code>);
264
+ }
265
+ /**
266
+ * Variant type for Seedcord error classes.
267
+ *
268
+ * @internal
269
+ */
270
+ 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>;
271
+ /**
272
+ * Union type of all Seedcord error variants for a specific error code.
273
+ *
274
+ * @internal
275
+ */
276
+ type AnySeedcordErrorForCode<Code extends SeedcordErrorCode> = { [Variant in SeedcordErrorTypeString]: SeedcordErrorVariant<Variant, Code>; }[SeedcordErrorTypeString];
277
+ /**
278
+ * Union type of all Seedcord errors filtered by error class.
279
+ *
280
+ * @internal
281
+ */
282
+ type ErrorTypeFilter<Type extends SeedcordErrorTypeString | undefined> = Type extends SeedcordErrorTypeString ? { [Code in SeedcordErrorCode]: SeedcordErrorVariant<Type, Code>; }[SeedcordErrorCode] : AnySeedcordErrorForCode<SeedcordErrorCode>;
283
+ /**
284
+ * Union type of all Seedcord errors filtered by error class and error code.
285
+ *
286
+ * @internal
287
+ */
288
+ type ErrorCodeFilter<Type extends SeedcordErrorTypeString | undefined, Code extends SeedcordErrorCode | undefined> = Code extends SeedcordErrorCode ? Type extends SeedcordErrorTypeString ? SeedcordErrorVariant<Type, Code> : AnySeedcordErrorForCode<Code> : ErrorTypeFilter<Type>;
289
+ /**
290
+ * Determines whether an unknown value is a Seedcord error, with optional narrowing by class and error code.
291
+ *
292
+ * @param error - The value to inspect.
293
+ * @param type - Optional error class discriminator.
294
+ * @param code - Optional {@link SeedcordErrorCode} discriminator to narrow by code.
295
+ * @typeParam Type - What kind of {@link SeedcordErrorTypeString} to filter by.
296
+ * @typeParam Code - The specific {@link SeedcordErrorCode} to filter by.
297
+ */
298
+ declare function isSeedcordError<Type extends SeedcordErrorTypeString | undefined, Code extends SeedcordErrorCode | undefined>(error: unknown, type?: Type, code?: Code): error is ErrorCodeFilter<Type, Code>;
299
+ //#endregion
300
+ export { SeedcordTypeError as a, VitePluginPlace as c, setColorLevel as d, SeedcordRangeError as i, WORDMARK as l, SeedcordError as n, isSeedcordError as o, SeedcordErrorTypeString as r, SeedcordErrorArguments as s, SeedcordAggregateError as t, paint as u };
301
+ //# sourceMappingURL=SeedcordError-ChZj9C4u.d.mts.map