@seedcord/core 0.12.0-next.0 → 0.12.0-next.2
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 +3 -3
- package/dist/{Bus-W1K-uMeO.mjs → Bus-VJw-QpoY.mjs} +110 -54
- package/dist/Bus-VJw-QpoY.mjs.map +1 -0
- package/dist/{CoordinatedShutdown-BVtNNSsF.d.mts → CoordinatedShutdown-fPKLWjc5.d.mts} +2 -2
- package/dist/{CoordinatedStartup-DA3gW8op.mjs → CoordinatedStartup-Zw_Lk7Zk.mjs} +3 -3
- package/dist/{CoordinatedStartup-DA3gW8op.mjs.map → CoordinatedStartup-Zw_Lk7Zk.mjs.map} +1 -1
- package/dist/HmrModuleHandler-Btgu8r96.mjs +165 -0
- package/dist/HmrModuleHandler-Btgu8r96.mjs.map +1 -0
- package/dist/{PluginHost-DWBgBS6Q.d.mts → PluginHost-DFnkIldj.d.mts} +10 -9
- package/dist/{PluginHost-CYe-UVpp.mjs → PluginHost-DTtxWRiL.mjs} +4 -4
- package/dist/PluginHost-DTtxWRiL.mjs.map +1 -0
- package/dist/{PluginLifecycle-DdwRzcDj.mjs → PluginLifecycle-hx5zUc-P.mjs} +4 -4
- package/dist/PluginLifecycle-hx5zUc-P.mjs.map +1 -0
- package/dist/{ServerHost-whpI0h4d.d.mts → ServerHost-B5o3ScCF.d.mts} +3 -3
- package/dist/{ServerHost-DHg-Y2_q.mjs → ServerHost-CDaEDR4C.mjs} +4 -4
- package/dist/{ServerHost-DHg-Y2_q.mjs.map → ServerHost-CDaEDR4C.mjs.map} +1 -1
- package/dist/hmr.index.d.mts +20 -20
- package/dist/hmr.index.mjs +1 -1
- package/dist/{index-Boo33hh3.d.mts → index-DGHng1IN.d.mts} +108 -193
- package/dist/index.d.mts +216 -71
- package/dist/index.mjs +215 -100
- package/dist/index.mjs.map +1 -1
- package/dist/internal.index.d.mts +204 -82
- package/dist/internal.index.mjs +572 -73
- package/dist/internal.index.mjs.map +1 -1
- package/dist/node-internal.index.d.mts +4 -3
- package/dist/node-internal.index.mjs +3 -3
- package/dist/node.index.d.mts +2 -2
- package/dist/node.index.mjs +4 -4
- package/dist/{phases-Dojnr-ng.d.mts → phases-C2QCSqRu.d.mts} +60 -50
- package/dist/plugin.index.d.mts +1 -1
- package/dist/plugin.index.mjs +1 -1
- package/dist/{subscribers-D4_HZcgw.mjs → subscribers-CGuVjbrg.mjs} +139 -253
- package/dist/subscribers-CGuVjbrg.mjs.map +1 -0
- package/package.json +10 -9
- package/dist/Bus-W1K-uMeO.mjs.map +0 -1
- package/dist/HmrModuleHandler-BMD7dg8N.mjs +0 -162
- package/dist/HmrModuleHandler-BMD7dg8N.mjs.map +0 -1
- package/dist/PluginHost-CYe-UVpp.mjs.map +0 -1
- package/dist/PluginLifecycle-DdwRzcDj.mjs.map +0 -1
- package/dist/subscribers-D4_HZcgw.mjs.map +0 -1
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { t as bindEnv } from "./bindViteEnv-BgFewlZ0.mjs";
|
|
2
|
-
import { A as
|
|
3
|
-
import {
|
|
4
|
-
import { a as FixedScope, c as PluginArgs, d as Runtime, f as Transport, i as sealAttachments, l as PluginCtor, o as Initializeable, r as attachmentsOf, t as Attachment } from "./PluginHost-
|
|
5
|
-
import { i as StartupTasks, n as ShutdownTasks, r as CoordinatedStartup } from "./CoordinatedShutdown-
|
|
2
|
+
import { A as RegisteredCount, B as EventMiddlewareMetadataKey, C as AckState, D as AckTrace, E as sendTarget, G as InteractionRouteKeys, H as InteractionKind, I as DispatchContext, J as WebhookUrlMetadataKey, K as MiddlewareKind, L as InteractionDispatch, M as VerifyWebhooks, N as PublishDefault, O as RegisterDefaults, R as CommandMetadataKey, S as reportedWrite, T as checkAckLegality, U as InteractionMetadataKey, V as GatedMetadataKey, W as InteractionMiddlewareMetadataKey, Y as Notice, a as Bus, f as FaultSource, i as CoreBase, j as UnregisterSubscriber, k as RegisterSubscriber, o as StoredSubscriberCtor, p as InteractionFaultSource, q as SubscribeMetadataKey, s as busLoggerOf, u as DefaultSubscriptions, v as SubscriptionData, w as ReplyMethod, x as ReplyTelemetry, z as EventMetadataKey } from "./phases-C2QCSqRu.mjs";
|
|
3
|
+
import { At as SlashOption, B as InteractionMiddlewareMetadata, Ct as BuilderComponent, Dt as CacheFor, F as DispatchResult, G as ComponentDefsBrand, I as EventDispatchResult, It as NamesFor, J as ContextMenuNamesBrand, K as ComponentKindBrand, Mt as SlashRouteEntry, N as SerializedReply, Nt as ContextMenuKind, O as GateContextBase, Ot as OptionKind, P as serializeReply, Pt as MenuCacheFor, R as HandlerResult, U as interactionMiddlewareMetaOf, W as AutocompleteRouteBrand, X as SlashRouteBrand, Y as MiddlewareKindsBrand, _ as ChoiceValueOf, _t as scopeIdsOf, at as CommandRef, b as ResolvedEmoji, bt as CommandMeta, c as CaseReturn, ct as commandRefOf, d as runCase, dt as CommandBuilder, f as PAGE_MAX, ft as DeployResult, gt as globalFirst, h as AutocompletableNames, ht as commandsRoute, it as warnLinks, jt as SlashRegistry, kt as RouteCache, l as MatchResult, lt as indexById, m as pageCursor, mt as ScopeId, ot as LinkedCommands, p as PageCursor, pt as GLOBAL_ID, q as ContextMenuKindBrand, rt as installLinks, st as commandKey, u as OnlyCases, ut as linkCommands, v as EntryFor, vt as skippedNote, x as GateFitsWith, y as FocusedField, yt as resolveDeployTarget, z as AnyMiddlewareCtor } from "./index-DGHng1IN.mjs";
|
|
4
|
+
import { a as FixedScope, c as PluginArgs, d as Runtime, f as Transport, i as sealAttachments, l as PluginCtor, o as Initializeable, r as attachmentsOf, t as Attachment } from "./PluginHost-DFnkIldj.mjs";
|
|
5
|
+
import { i as StartupTasks, n as ShutdownTasks, r as CoordinatedStartup } from "./CoordinatedShutdown-fPKLWjc5.mjs";
|
|
6
6
|
import "reflect-metadata";
|
|
7
7
|
import { AnyCustomId, DecodedParams } from "@seedcord/custom-id";
|
|
8
8
|
import { ContextMenuCommandBuilder, SlashCommandBuilder } from "@discordjs/builders";
|
|
9
|
-
import { APIApplicationCommand, ChannelType, RESTGetCurrentApplicationResult, RESTPostAPIApplicationCommandsJSONBody } from "discord-api-types/v10";
|
|
9
|
+
import { APIApplicationCommand, ApplicationCommandType, ChannelType, ComponentType, RESTGetCurrentApplicationResult, RESTPostAPIApplicationCommandsJSONBody } from "discord-api-types/v10";
|
|
10
10
|
import { SeedcordErrorCode } from "@seedcord/errors";
|
|
11
11
|
import { BotToken, SeedcordError } from "@seedcord/errors/internal";
|
|
12
|
-
import { Logger } from "@seedcord/logger";
|
|
12
|
+
import { Logger, LoggerOptions } from "@seedcord/logger";
|
|
13
13
|
import { REST } from "@discordjs/rest";
|
|
14
14
|
import { DeployedHashes, DevChannel, SeedcordCliEvents, SeedcordFrameworkEvents, WireError } from "@seedcord/types/internal";
|
|
15
|
-
import { BotColor, DeferOpts, EpochMs,
|
|
16
|
-
import { Constructor, IsNever, Promisable } from "type-fest";
|
|
15
|
+
import { BotColor, DeferOpts, EpochMs, EventFrequency, HmrAware, HmrUpdateEvent, ILogger, LogRecord, RenderContext, ReplyResponse, SendOpts, TypedOmit } from "@seedcord/types";
|
|
16
|
+
import { Constructor, IsNever, LiteralUnion, Promisable } from "type-fest";
|
|
17
17
|
//#region src/subscribers/SubscriberLoader.d.ts
|
|
18
18
|
export declare class SubscriberLoader implements Initializeable, HmrAware {
|
|
19
19
|
private readonly bus;
|
|
@@ -78,8 +78,41 @@ export declare class MiddlewareRegistry<Ctor extends AnyMiddlewareCtor, Key exte
|
|
|
78
78
|
//#region src/components/botColorHolder.d.ts
|
|
79
79
|
export declare function bindBotColor(read: () => BotColor | undefined): void;
|
|
80
80
|
//#endregion
|
|
81
|
-
//#region src/notices/
|
|
82
|
-
|
|
81
|
+
//#region src/notices/FaultBoundary.d.ts
|
|
82
|
+
type ApiErrorClass = abstract new (...args: never[]) => {
|
|
83
|
+
readonly code: number | string;
|
|
84
|
+
};
|
|
85
|
+
interface FaultDetails extends Pick<SubscriptionData<'unknownException'>, 'guild' | 'user'> {
|
|
86
|
+
readonly origin: string;
|
|
87
|
+
readonly source: FaultSource | null;
|
|
88
|
+
readonly metadata: unknown;
|
|
89
|
+
}
|
|
90
|
+
interface FaultSender {
|
|
91
|
+
send(response: ReplyResponse, options: {
|
|
92
|
+
ephemeral: boolean;
|
|
93
|
+
}): Promise<unknown>;
|
|
94
|
+
}
|
|
95
|
+
interface ReportedFault {
|
|
96
|
+
readonly error: Error;
|
|
97
|
+
readonly uuid: RenderContext['uuid'];
|
|
98
|
+
}
|
|
99
|
+
export declare class FaultBoundary {
|
|
100
|
+
private readonly core;
|
|
101
|
+
private readonly apiError;
|
|
102
|
+
private readonly dispatch;
|
|
103
|
+
private readonly detailsOf;
|
|
104
|
+
private readonly ignoredCodes;
|
|
105
|
+
constructor(core: CoreBase, ignoredCodes: readonly (number | string)[] | undefined, apiError: ApiErrorClass, dispatch: DispatchContext, detailsOf: () => FaultDetails);
|
|
106
|
+
report(caught: unknown): ReportedFault | null;
|
|
107
|
+
answerWithReply(caught: unknown, sender: FaultSender): Promise<void>;
|
|
108
|
+
answerWithEmptyChoices(caught: unknown, clearChoices: () => Promise<unknown>): Promise<void>;
|
|
109
|
+
private publish;
|
|
110
|
+
private rendered;
|
|
111
|
+
private fallbackReply;
|
|
112
|
+
private render;
|
|
113
|
+
private renderContext;
|
|
114
|
+
private sendGuarded;
|
|
115
|
+
}
|
|
83
116
|
//#endregion
|
|
84
117
|
//#region src/plugin/splitPluginKey.d.ts
|
|
85
118
|
interface PluginKeyParts {
|
|
@@ -113,25 +146,13 @@ export declare class PluginLifecycle {
|
|
|
113
146
|
//#region src/decorators/interactionRoutes.d.ts
|
|
114
147
|
type RoutableConstructor = new (...args: never[]) => unknown;
|
|
115
148
|
export declare function interactionRoutesOf(constructor: RoutableConstructor): [InteractionKind, string[]][];
|
|
116
|
-
export declare function storeInteractionRoute(route: InteractionKind, routes: string | readonly string[], constructor: RoutableConstructor): void;
|
|
149
|
+
export declare function storeInteractionRoute(route: InteractionKind, routes: string | readonly string[], constructor: RoutableConstructor, fix?: string): void;
|
|
117
150
|
export declare function storeComponentRoute(route: InteractionKind, defs: readonly AnyCustomId[], constructor: RoutableConstructor): void;
|
|
118
151
|
export declare function contextMenuRouteOf(kind: ContextMenuKind): InteractionKind;
|
|
119
152
|
//#endregion
|
|
120
153
|
//#region src/gates/runGates.d.ts
|
|
121
154
|
type GateObserver = (gateName: string, elapsedMs: number) => void;
|
|
122
|
-
export declare function
|
|
123
|
-
export declare function runHandlerGates(handlerCtor: object, ctx: GateContextBase, declaredRoute?: string, observe?: GateObserver): Promise<void>;
|
|
124
|
-
//#endregion
|
|
125
|
-
//#region src/gates/slowGate.d.ts
|
|
126
|
-
/**
|
|
127
|
-
* collects each gate check's elapsed time for one dispatch. `report` warns once when the checks sum
|
|
128
|
-
* past the threshold, naming the total, the route, and each gate's share.
|
|
129
|
-
*/
|
|
130
|
-
interface SlowGateMonitor {
|
|
131
|
-
readonly observe: GateObserver;
|
|
132
|
-
report(declaredRoute: string | null): void;
|
|
133
|
-
}
|
|
134
|
-
export declare function slowGateMonitor(): SlowGateMonitor | undefined;
|
|
155
|
+
export declare function runHandlerGates(handlerCtor: object, ctx: GateContextBase, observe?: GateObserver): Promise<void>;
|
|
135
156
|
//#endregion
|
|
136
157
|
//#region src/miscellaneous/guarded.d.ts
|
|
137
158
|
export declare function accessorStore<Value>(): Record<string, Value>;
|
|
@@ -141,6 +162,9 @@ export declare function guardedAccessor<Value>(accessor: string, storage: Record
|
|
|
141
162
|
//#region src/miscellaneous/emojiConfig.d.ts
|
|
142
163
|
export declare function isEmojiTuple(value: unknown): value is readonly [string, string];
|
|
143
164
|
//#endregion
|
|
165
|
+
//#region src/miscellaneous/lazyLogger.d.ts
|
|
166
|
+
export declare function lazyLogger(label: string, options: LoggerOptions): () => Logger;
|
|
167
|
+
//#endregion
|
|
144
168
|
//#region src/miscellaneous/currentApplication.d.ts
|
|
145
169
|
export declare function currentApplication(rest: Pick<REST, 'get'>): Promise<RESTGetCurrentApplicationResult>;
|
|
146
170
|
//#endregion
|
|
@@ -192,6 +216,7 @@ export declare class CommandRegistry implements Initializeable, HmrAware {
|
|
|
192
216
|
private readonly loadedCommands;
|
|
193
217
|
private readonly hmrHandler?;
|
|
194
218
|
private readonly pendingEvents;
|
|
219
|
+
private readonly deploys;
|
|
195
220
|
private readonly injector;
|
|
196
221
|
private readonly lastDeploy;
|
|
197
222
|
private readonly reporter;
|
|
@@ -204,6 +229,8 @@ export declare class CommandRegistry implements Initializeable, HmrAware {
|
|
|
204
229
|
private reportLoad;
|
|
205
230
|
/** @internal */
|
|
206
231
|
refresh(shouldRefresh?: boolean): Promise<void>;
|
|
232
|
+
private afterRunningDeploy;
|
|
233
|
+
private applyEvents;
|
|
207
234
|
/** @internal */
|
|
208
235
|
onHmr(event: HmrUpdateEvent): Promise<void>;
|
|
209
236
|
private loadCommands;
|
|
@@ -275,6 +302,19 @@ export declare function isCommandClass(value: unknown): value is CommandCtor;
|
|
|
275
302
|
*/
|
|
276
303
|
export declare function slashRouteLeaves(commands: Iterable<SlashCommandBuilder | ContextMenuCommandBuilder>): Set<string>;
|
|
277
304
|
//#endregion
|
|
305
|
+
//#region src/decorators/assertUniqueKeys.d.ts
|
|
306
|
+
export declare function assertUniqueKeys(decorator: string, ctor: {
|
|
307
|
+
name: string;
|
|
308
|
+
}, keys: readonly string[], fix?: string): void;
|
|
309
|
+
//#endregion
|
|
310
|
+
//#region src/handlers/MiddlewareRoute.d.ts
|
|
311
|
+
interface RegisteredRoutes {
|
|
312
|
+
[InteractionKind.Slash]: keyof SlashRegistry;
|
|
313
|
+
[InteractionKind.UserContextMenu]: NamesFor<ApplicationCommandType.User>;
|
|
314
|
+
[InteractionKind.MessageContextMenu]: NamesFor<ApplicationCommandType.Message>;
|
|
315
|
+
}
|
|
316
|
+
type MiddlewareRoute<Kind extends MiddlewareKind> = Kind extends keyof RegisteredRoutes ? LiteralUnion<RegisteredRoutes[Kind], string> : string;
|
|
317
|
+
//#endregion
|
|
278
318
|
//#region src/hmr/devChannel.d.ts
|
|
279
319
|
type CliChannel = DevChannel<SeedcordFrameworkEvents, SeedcordCliEvents>;
|
|
280
320
|
/** @internal */
|
|
@@ -310,21 +350,18 @@ export declare function fromDevLogLine(line: string): LogRecord | undefined;
|
|
|
310
350
|
export declare function forwardLogsToCli(): void;
|
|
311
351
|
//#endregion
|
|
312
352
|
//#region src/notices/index.d.ts
|
|
313
|
-
export declare
|
|
314
|
-
|
|
315
|
-
}
|
|
316
|
-
export declare class NotOwner extends GateNotice {
|
|
317
|
-
constructor(message?: string);
|
|
353
|
+
export declare class NotOwner extends Notice {
|
|
354
|
+
constructor();
|
|
318
355
|
}
|
|
319
|
-
export declare class NotInGuild extends
|
|
320
|
-
constructor(
|
|
356
|
+
export declare class NotInGuild extends Notice {
|
|
357
|
+
constructor();
|
|
321
358
|
}
|
|
322
|
-
export declare class NotInDm extends
|
|
323
|
-
constructor(
|
|
359
|
+
export declare class NotInDm extends Notice {
|
|
360
|
+
constructor();
|
|
324
361
|
}
|
|
325
|
-
export declare class OnCooldown extends
|
|
362
|
+
export declare class OnCooldown extends Notice {
|
|
326
363
|
readonly resetAt: EpochMs;
|
|
327
|
-
constructor(resetAt: EpochMs
|
|
364
|
+
constructor(resetAt: EpochMs);
|
|
328
365
|
}
|
|
329
366
|
export declare class NotAllowed extends Notice {
|
|
330
367
|
constructor();
|
|
@@ -335,22 +372,8 @@ export declare class NeedsAny extends Notice {
|
|
|
335
372
|
constructor(summaries: readonly string[]);
|
|
336
373
|
render(): ReplyResponse;
|
|
337
374
|
}
|
|
338
|
-
export declare class MissingRole extends
|
|
339
|
-
constructor(
|
|
340
|
-
}
|
|
341
|
-
export declare class MissingPermissions extends Notice {
|
|
342
|
-
private readonly subject;
|
|
343
|
-
private readonly missingPerms;
|
|
344
|
-
private readonly customLead;
|
|
345
|
-
constructor(message: string | undefined, subject: string | null, missingPerms: readonly string[]);
|
|
346
|
-
render(): ReplyResponse;
|
|
347
|
-
}
|
|
348
|
-
export declare class HasDangerousPermissions extends Notice {
|
|
349
|
-
private readonly subject;
|
|
350
|
-
private readonly dangerousPerms;
|
|
351
|
-
private readonly customLead;
|
|
352
|
-
constructor(message: string | undefined, subject: string, dangerousPerms: readonly string[]);
|
|
353
|
-
render(): ReplyResponse;
|
|
375
|
+
export declare class MissingRole extends Notice {
|
|
376
|
+
constructor(roleId: string);
|
|
354
377
|
}
|
|
355
378
|
//#endregion
|
|
356
379
|
//#region src/stops/NoticeCard.d.ts
|
|
@@ -393,7 +416,7 @@ export declare function decodeComponentRoute(handlerClass: {
|
|
|
393
416
|
/** @internal */
|
|
394
417
|
type SingleParams<Defs extends readonly AnyCustomId[]> = Defs extends readonly [infer One extends AnyCustomId] ? DecodedParams<One['shape']> : never;
|
|
395
418
|
/** @internal */
|
|
396
|
-
type
|
|
419
|
+
type MatchCases<Defs extends readonly AnyCustomId[], Ret> = { [Def in Defs[number] as Def['prefix']]: (params: DecodedParams<Def['shape']>) => CaseReturn<Ret>; };
|
|
397
420
|
//#endregion
|
|
398
421
|
//#region src/inputs/OptionLens.d.ts
|
|
399
422
|
interface OptionLens {
|
|
@@ -448,6 +471,16 @@ type SlashOptions<Route extends keyof SlashRegistry, Lens extends OptionLens> =
|
|
|
448
471
|
export declare function sendFlags(opts?: SendOpts): number;
|
|
449
472
|
export declare function deferFlags(opts?: DeferOpts): number;
|
|
450
473
|
//#endregion
|
|
474
|
+
//#region src/reply/AutocompleteResponder.d.ts
|
|
475
|
+
export declare class AutocompleteResponder<Choice> {
|
|
476
|
+
private readonly telemetry;
|
|
477
|
+
private readonly post;
|
|
478
|
+
private attempt?;
|
|
479
|
+
constructor(telemetry: ReplyTelemetry, post: (choices: readonly Choice[]) => Promise<unknown>);
|
|
480
|
+
respond(choices: readonly Choice[]): Promise<void>;
|
|
481
|
+
clear(): Promise<void>;
|
|
482
|
+
}
|
|
483
|
+
//#endregion
|
|
451
484
|
//#region src/reply/translateSerialization.d.ts
|
|
452
485
|
export declare function translateSerializationError(error: unknown, componentClass: string, index: number, routeId: string): SeedcordError<SeedcordErrorCode.ReplyComponentSerialization>;
|
|
453
486
|
//#endregion
|
|
@@ -463,41 +496,127 @@ export declare class ReportThrottle {
|
|
|
463
496
|
restore(key: string, suppressed: number): void;
|
|
464
497
|
}
|
|
465
498
|
//#endregion
|
|
466
|
-
//#region src/dispatch/
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
interface
|
|
475
|
-
readonly
|
|
476
|
-
|
|
499
|
+
//#region src/dispatch/InteractionRun.d.ts
|
|
500
|
+
interface RunnableHandler {
|
|
501
|
+
execute(): Promisable<void>;
|
|
502
|
+
}
|
|
503
|
+
interface RunnableMiddleware extends RunnableHandler {
|
|
504
|
+
after?(result: DispatchResult): Promisable<void>;
|
|
505
|
+
}
|
|
506
|
+
type PreparedRun = (() => Promise<void>) | null;
|
|
507
|
+
interface RepliableTarget {
|
|
508
|
+
readonly sender: FaultSender;
|
|
509
|
+
gateContext(): GateContextBase;
|
|
510
|
+
}
|
|
511
|
+
interface AutocompleteTarget {
|
|
512
|
+
readonly responder: {
|
|
513
|
+
clear(): Promise<void>;
|
|
514
|
+
};
|
|
515
|
+
}
|
|
516
|
+
interface InteractionRunConfig {
|
|
517
|
+
readonly dispatch: InteractionDispatch;
|
|
518
|
+
readonly core: CoreBase;
|
|
519
|
+
readonly event: unknown;
|
|
520
|
+
readonly customId: string | null;
|
|
521
|
+
readonly HandlerCtor: Constructor<RunnableHandler, never[]>;
|
|
522
|
+
readonly middlewares: {
|
|
523
|
+
chainFor(kind: MiddlewareKind): readonly Constructor<RunnableMiddleware, never[]>[];
|
|
524
|
+
};
|
|
525
|
+
readonly apiError: ApiErrorClass;
|
|
526
|
+
readonly logger: Logger;
|
|
477
527
|
readonly interactionId: string;
|
|
478
|
-
readonly
|
|
479
|
-
readonly outcome: DispatchOutcome;
|
|
480
|
-
/** True when no route matched and the unhandled default ran. */
|
|
481
|
-
readonly fallback: boolean;
|
|
482
|
-
readonly userId: string | null;
|
|
528
|
+
readonly userId: string;
|
|
483
529
|
readonly guildId: string | null;
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
530
|
+
readonly target: RepliableTarget | AutocompleteTarget;
|
|
531
|
+
faultDetails(): FaultDetails;
|
|
532
|
+
}
|
|
533
|
+
export declare class InteractionRun {
|
|
534
|
+
private readonly config;
|
|
535
|
+
private readonly ran;
|
|
536
|
+
private readonly startedAt;
|
|
537
|
+
private readonly queuedMs;
|
|
538
|
+
private readonly boundary;
|
|
539
|
+
constructor(config: InteractionRunConfig);
|
|
540
|
+
prepare(): Promise<PreparedRun>;
|
|
541
|
+
private warnIfUnhandled;
|
|
542
|
+
private prepareAutocomplete;
|
|
543
|
+
private prepareRepliable;
|
|
544
|
+
private builtHandler;
|
|
545
|
+
private refusal;
|
|
546
|
+
private runMiddlewares;
|
|
547
|
+
private start;
|
|
548
|
+
private finish;
|
|
549
|
+
private report;
|
|
550
|
+
}
|
|
551
|
+
//#endregion
|
|
552
|
+
//#region src/dispatch/componentKindOf.d.ts
|
|
553
|
+
export declare function componentKindOf(type: ComponentType): InteractionKind | null;
|
|
554
|
+
//#endregion
|
|
555
|
+
//#region src/dispatch/HandlerLoader.d.ts
|
|
556
|
+
interface LoadedUnit {
|
|
557
|
+
readonly name: string;
|
|
558
|
+
readonly from: string;
|
|
559
|
+
}
|
|
560
|
+
interface HandlerLoaderOptions<Handler, Middleware extends AnyMiddlewareCtor, Key extends string, Artifacts> {
|
|
561
|
+
readonly handlersDir: string;
|
|
562
|
+
readonly middlewaresDir: string | undefined;
|
|
563
|
+
readonly middlewares: MiddlewareRegistry<Middleware, Key>;
|
|
564
|
+
readonly logger: Logger;
|
|
565
|
+
isHandler(value: unknown): value is Handler;
|
|
566
|
+
isMiddleware(value: unknown): value is Middleware;
|
|
567
|
+
storeHandler(handler: Handler, from: string): boolean;
|
|
568
|
+
removeHandler(handler: Handler, artifacts?: Artifacts): void;
|
|
569
|
+
artifactsOf(handler: Handler): Artifacts;
|
|
570
|
+
}
|
|
571
|
+
export declare class HandlerLoader<Handler extends {
|
|
572
|
+
name: string;
|
|
573
|
+
}, Middleware extends AnyMiddlewareCtor, Key extends string, Artifacts> {
|
|
574
|
+
private readonly options;
|
|
575
|
+
readonly loadedHandlers: LoadedUnit[];
|
|
576
|
+
readonly loadedMiddlewares: LoadedUnit[];
|
|
577
|
+
private initialLoad;
|
|
578
|
+
private readonly hmr?;
|
|
579
|
+
constructor(options: HandlerLoaderOptions<Handler, Middleware, Key, Artifacts>);
|
|
580
|
+
load(): Promise<void>;
|
|
581
|
+
onHmr(event: HmrUpdateEvent): Promise<void>;
|
|
582
|
+
private loadHandlers;
|
|
583
|
+
private loadMiddlewares;
|
|
584
|
+
private registerHandler;
|
|
585
|
+
private registerMiddleware;
|
|
586
|
+
}
|
|
587
|
+
//#endregion
|
|
588
|
+
//#region src/dispatch/RouteRegistry.d.ts
|
|
589
|
+
interface RegisteredRoute<Ctor> {
|
|
590
|
+
readonly kind: InteractionKind;
|
|
591
|
+
readonly route: string;
|
|
592
|
+
readonly fallback: boolean;
|
|
593
|
+
readonly ctor: Ctor;
|
|
594
|
+
}
|
|
595
|
+
type KindMaps<Entry> = Readonly<Record<InteractionKind, Map<string, Entry>>>;
|
|
596
|
+
type RouteMaps<Ctor> = KindMaps<RegisteredRoute<Ctor>>;
|
|
597
|
+
export declare function emptyRouteMaps<Entry>(): KindMaps<Entry>;
|
|
598
|
+
export declare function matchRoute<Ctor>(maps: RouteMaps<Ctor>, kind: InteractionKind, route: string, unhandled: {
|
|
599
|
+
readonly repliable: Ctor;
|
|
600
|
+
readonly autocomplete: Ctor;
|
|
601
|
+
}): RegisteredRoute<Ctor>;
|
|
602
|
+
interface LoadedRoute<Ctor> extends RegisteredRoute<Ctor> {
|
|
603
|
+
readonly from: string;
|
|
604
|
+
}
|
|
605
|
+
export declare class RouteRegistry<Ctor extends RoutableConstructor> {
|
|
606
|
+
readonly maps: KindMaps<LoadedRoute<Ctor>>;
|
|
607
|
+
private get allRoutes();
|
|
608
|
+
get size(): number;
|
|
609
|
+
register(ctor: Ctor, from: string): boolean;
|
|
610
|
+
unregister(ctor: Ctor, routes?: readonly RegisteredRoute<Ctor>[]): void;
|
|
611
|
+
routesOf(ctor: Ctor): RegisteredRoute<Ctor>[];
|
|
612
|
+
warnUnhandledRoutes(logger: Logger, leaves: Iterable<string>): void;
|
|
613
|
+
warnUnhandledContextMenuRoutes(logger: Logger, leaves: ContextMenuLeaves): void;
|
|
614
|
+
private warnMissing;
|
|
488
615
|
}
|
|
489
|
-
/**
|
|
490
|
-
* Discord's interaction creation to now, read from the snowflake. Called at dispatch entry, since
|
|
491
|
-
* a later read would count the handler run into the queue time as well.
|
|
492
|
-
*
|
|
493
|
-
* @internal
|
|
494
|
-
*/
|
|
495
|
-
export declare function queuedMsFor(interactionId: string): number;
|
|
496
|
-
export declare function reportDispatch(bus: Bus, report: DispatchReport): void;
|
|
497
616
|
//#endregion
|
|
498
617
|
//#region src/dispatch/runAfter.d.ts
|
|
499
618
|
interface Afterable<Result> {
|
|
500
|
-
after?(result: Result):
|
|
619
|
+
after?(result: Result): Promisable<void>;
|
|
501
620
|
}
|
|
502
621
|
/** @internal */
|
|
503
622
|
export declare function resultFor(caught: unknown): DispatchResult;
|
|
@@ -529,5 +648,8 @@ export declare class OnceTracker {
|
|
|
529
648
|
claim(entry: Registered, key: string): boolean;
|
|
530
649
|
}
|
|
531
650
|
//#endregion
|
|
532
|
-
|
|
651
|
+
//#region src/subscribers/interactionFaultSource.d.ts
|
|
652
|
+
export declare function interactionFaultSource(dispatch: InteractionDispatch, fields: TypedOmit<InteractionFaultSource, 'kind' | 'interactionKind' | 'command'>): InteractionFaultSource | null;
|
|
653
|
+
//#endregion
|
|
654
|
+
export { type AckState, AckTrace, type AutocompletableNames, AutocompleteRouteBrand, type BakedIds, type CacheFor, type CaseReturn, type ChoiceValueOf, type CommandBody, type CommandBuilder, type CommandCtor, type CommandMeta, CommandMetadataKey, type CommandRef, type CommandScopes, ComponentDefsBrand, ComponentKindBrand, ContextMenuKindBrand, type ContextMenuLeaves, ContextMenuNamesBrand, CoordinatedStartup, type DecodedComponentRoute, type DefaultSubscriptions, type DeployResult, DispatchContext, type EntryFor, EventMetadataKey, EventMiddlewareMetadataKey, type FaultDetails, FixedScope, type FocusedField, GLOBAL_ID, type GateFitsWith, GatedMetadataKey, type GuildSummary, type HasComponentDefs, type Initializeable, type InteractionDispatch, InteractionMetadataKey, type InteractionMiddlewareMetadata, InteractionMiddlewareMetadataKey, InteractionRouteKeys, type InteractionRunConfig, type LinkedCommands, type MatchCases, type MatchResult, type MenuCacheFor, MiddlewareKindsBrand, type MiddlewareRegistration, type MiddlewareRegistrationOf, type MiddlewareRoute, type NamesFor, type OnlyCases, type OptionKind, type OptionLens, PAGE_MAX, type PageCursor, type PluginArgs, type PluginCtor, PublishDefault, RegisterDefaults, RegisterSubscriber, RegisteredCount, type RegisteredRoute, type ReplyMethod, type ReplyTelemetry, type RoutableConstructor, type RouteCache, type RouteMaps, type Runtime, type ScopeId, type SerializedReply, type SingleParams, type SlashOption, type SlashOptions, SlashRouteBrand, type SlashRouteEntry, type StartupTasks, type StoredSubscriberCtor, SubscribeMetadataKey, type Transport, UnregisterSubscriber, VerifyWebhooks, WebhookUrlMetadataKey, attachmentsOf, bindEnv, busLoggerOf, checkAckLegality, commandKey, commandRefOf, commandsRoute, globalFirst, indexById, installLinks, interactionMiddlewareMetaOf, linkCommands, pageCursor, reportedWrite, resolveDeployTarget, runCase, scopeIdsOf, sealAttachments, sendTarget, serializeReply, skippedNote, warnLinks };
|
|
533
655
|
//# sourceMappingURL=internal.index.d.mts.map
|