@seedcord/core 0.1.0-next.7 → 0.1.0-next.8

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.
Files changed (57) hide show
  1. package/dist/{Plugin-3rlH0uxH.d.mts → Plugin-BZit5HUI.d.mts} +52 -117
  2. package/dist/{Plugin-Cgp1a0uQ.cjs → Plugin-BlkhHNRm.cjs} +6 -34
  3. package/dist/Plugin-BlkhHNRm.cjs.map +1 -0
  4. package/dist/{Plugin-j9GYdroS.mjs → Plugin-CDAV7P9l.mjs} +7 -29
  5. package/dist/Plugin-CDAV7P9l.mjs.map +1 -0
  6. package/dist/basic-1hebYVcN.d.mts +22 -0
  7. package/dist/contextMenuLeaves-f2rbyo83.d.mts +19 -0
  8. package/dist/{Silence-DiP95iwD.cjs → cursor-BMkFAwO2.cjs} +293 -16
  9. package/dist/cursor-BMkFAwO2.cjs.map +1 -0
  10. package/dist/{Silence-dbC2slOB.mjs → cursor-BvSH8tgw.mjs} +222 -17
  11. package/dist/cursor-BvSH8tgw.mjs.map +1 -0
  12. package/dist/{AutocompleteOptions-DLp_B8as.d.mts → cursor-D6nBjwaE.d.mts} +150 -8
  13. package/dist/{index-Dueqztyy.d.mts → index-Cr4-VV4u.d.mts} +3 -3
  14. package/dist/index.cjs +361 -40
  15. package/dist/index.cjs.map +1 -1
  16. package/dist/index.d.mts +237 -38
  17. package/dist/index.mjs +321 -7
  18. package/dist/index.mjs.map +1 -1
  19. package/dist/internal.index.cjs +50 -43
  20. package/dist/internal.index.cjs.map +1 -1
  21. package/dist/internal.index.d.mts +46 -41
  22. package/dist/internal.index.mjs +13 -14
  23. package/dist/internal.index.mjs.map +1 -1
  24. package/dist/node-internal.index.cjs +196 -29
  25. package/dist/node-internal.index.cjs.map +1 -1
  26. package/dist/node-internal.index.d.mts +59 -9
  27. package/dist/node-internal.index.mjs +196 -30
  28. package/dist/node-internal.index.mjs.map +1 -1
  29. package/dist/{phases-BfpAG6w3.mjs → phases-BauKJOTT.mjs} +2 -2
  30. package/dist/phases-BauKJOTT.mjs.map +1 -0
  31. package/dist/{phases-C_BGNyVo.cjs → phases-DcuDHoQl.cjs} +2 -2
  32. package/dist/phases-DcuDHoQl.cjs.map +1 -0
  33. package/dist/plugin.index.cjs +1 -1
  34. package/dist/plugin.index.d.mts +2 -2
  35. package/dist/plugin.index.mjs +1 -1
  36. package/dist/{publishDefault-l0NQ-SHo.cjs → publishDefault-CVlwYUS5.cjs} +32 -3
  37. package/dist/publishDefault-CVlwYUS5.cjs.map +1 -0
  38. package/dist/{publishDefault-CCf1azzW.mjs → publishDefault-CldnxcT2.mjs} +27 -4
  39. package/dist/publishDefault-CldnxcT2.mjs.map +1 -0
  40. package/dist/slashRouteLeaves-BANDtPFm.mjs +23 -0
  41. package/dist/slashRouteLeaves-BANDtPFm.mjs.map +1 -0
  42. package/dist/slashRouteLeaves-nfxOAM7Q.cjs +28 -0
  43. package/dist/slashRouteLeaves-nfxOAM7Q.cjs.map +1 -0
  44. package/dist/{subscribers-B1G6_LlK.cjs → subscribers-BSJoyKNN.cjs} +4 -4
  45. package/dist/{subscribers-B1G6_LlK.cjs.map → subscribers-BSJoyKNN.cjs.map} +1 -1
  46. package/dist/{subscribers-DYqFVP1X.mjs → subscribers-DuxdM2cS.mjs} +4 -4
  47. package/dist/{subscribers-DYqFVP1X.mjs.map → subscribers-DuxdM2cS.mjs.map} +1 -1
  48. package/package.json +4 -4
  49. package/dist/Plugin-Cgp1a0uQ.cjs.map +0 -1
  50. package/dist/Plugin-j9GYdroS.mjs.map +0 -1
  51. package/dist/Silence-DiP95iwD.cjs.map +0 -1
  52. package/dist/Silence-dbC2slOB.mjs.map +0 -1
  53. package/dist/basic-D7bDlgSP.d.mts +0 -10
  54. package/dist/phases-BfpAG6w3.mjs.map +0 -1
  55. package/dist/phases-C_BGNyVo.cjs.map +0 -1
  56. package/dist/publishDefault-CCf1azzW.mjs.map +0 -1
  57. package/dist/publishDefault-l0NQ-SHo.cjs.map +0 -1
@@ -1,9 +1,41 @@
1
- import { t as Constructor } from "./basic-D7bDlgSP.mjs";
2
- import { A as Notice, N as AckState, W as InteractionRoutes, j as ReplyTelemetry, y as CoreBase } from "./Plugin-3rlH0uxH.mjs";
3
- import { APIMessageTopLevelComponent, APIModalInteractionResponseCallbackData, ApplicationCommandType, ChannelType, Snowflake } from "discord-api-types/v10";
1
+ import { n as CommandBuilder, r as DeployResult, t as Constructor } from "./basic-1hebYVcN.mjs";
2
+ import { A as AckState, D as Notice, O as ReplyTelemetry, V as InteractionRoutes, g as CoreBase } from "./Plugin-BZit5HUI.mjs";
4
3
  import { ActionRowBuilder, ButtonBuilder, ChannelSelectMenuBuilder, CheckboxBuilder, CheckboxGroupBuilder, CheckboxGroupOptionBuilder, ContainerBuilder, ContextMenuCommandBuilder, EmbedBuilder, FileBuilder, FileUploadBuilder, LabelBuilder, MediaGalleryBuilder, MentionableSelectMenuBuilder, ModalBuilder, RadioGroupBuilder, RadioGroupOptionBuilder, RoleSelectMenuBuilder, SectionBuilder, SeparatorBuilder, SlashCommandBuilder, SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder, StringSelectMenuBuilder, StringSelectMenuOptionBuilder, TextDisplayBuilder, TextInputBuilder, UserSelectMenuBuilder } from "@discordjs/builders";
4
+ import { APIMessageTopLevelComponent, APIModalInteractionResponseCallbackData, ApplicationCommandType, ChannelType, Snowflake } from "discord-api-types/v10";
5
5
  import { DeferOpts, ReplyResponse, SendOpts } from "@seedcord/types";
6
6
 
7
+ //#region src/registries/ContextMenuRegistry.d.ts
8
+ /** The two context-menu command kinds Discord defines. */
9
+ type ContextMenuKind = ApplicationCommandType.User | ApplicationCommandType.Message;
10
+ /**
11
+ * Maps each user context-menu command name to a presence marker. Populated by `seedcord codegen`, which
12
+ * reads every command's `toJSON()` and emits a `declare module '@seedcord/gateway'` augmentation, so
13
+ * `keyof UserContextMenuRegistry` is the compile-time union of every registered user context-menu name.
14
+ * Do not augment it by hand, run `seedcord codegen`.
15
+ *
16
+ * Kept separate from {@link MessageContextMenuRegistry} because Discord allows a user command and a message
17
+ * command to share a name, so a single name-keyed registry would collapse a legal pair.
18
+ *
19
+ * @example
20
+ * ```ts
21
+ * // seedcord-gen.d.ts (emitted, committed)
22
+ * declare module '@seedcord/gateway' {
23
+ * interface UserContextMenuRegistry {
24
+ * 'View Profile': true;
25
+ * }
26
+ * }
27
+ * ```
28
+ */
29
+ interface UserContextMenuRegistry {}
30
+ /**
31
+ * Maps each message context-menu command name to a presence marker. Populated by `seedcord codegen`, so
32
+ * `keyof MessageContextMenuRegistry` is the compile-time union of every registered message context-menu
33
+ * name. Do not augment it by hand, run `seedcord codegen`.
34
+ *
35
+ * Kept separate from {@link UserContextMenuRegistry}, see that interface for why.
36
+ */
37
+ interface MessageContextMenuRegistry {}
38
+ //#endregion
7
39
  //#region src/registries/SlashOptionRegistry.d.ts
8
40
  /** A slash option kind as a plain string union (`string`, `channel`, ...), keyed to the registry. */
9
41
  type OptionKind = 'string' | 'integer' | 'number' | 'boolean' | 'user' | 'channel' | 'role' | 'mentionable' | 'attachment';
@@ -33,6 +65,77 @@ interface SlashOption {
33
65
  */
34
66
  interface SlashOptionRegistry {}
35
67
  //#endregion
68
+ //#region src/commands/CommandInjector.d.ts
69
+ /** What {@link Commands} resolves to for one slash route. */
70
+ interface CommandInfo {
71
+ /** The clickable `</config set:id>` mention. A route whose id did not resolve falls back to `/config set`. */
72
+ readonly mention: string;
73
+ /** The deployed command id. Absent when the command deployed to two or more guilds. */
74
+ readonly id?: string;
75
+ /** The full route, e.g. `config/set`. */
76
+ readonly route: string;
77
+ /** The route's own description, taken from the subcommand for a nested route. */
78
+ readonly description: string;
79
+ }
80
+ /** Each registered slash route mapped to its deployed command. */
81
+ type InjectedCommandMap = { [K in keyof SlashOptionRegistry]: CommandInfo };
82
+ /**
83
+ * The bot's deployed slash commands, keyed by {@link SlashOptionRegistry}. Filled by
84
+ * {@link CommandInjector} after each deploy, and a read before that throws.
85
+ *
86
+ * @example
87
+ * ```ts
88
+ * import { Commands } from '@seedcord/gateway';
89
+ *
90
+ * await this.reply(`Try ${Commands['config/set'].mention}`);
91
+ *
92
+ * // a help listing
93
+ * const lines = Object.values(Commands).map((c) => `${c.mention} ${c.description}`);
94
+ * ```
95
+ */
96
+ declare const Commands: InjectedCommandMap;
97
+ /** What {@link ContextMenus} resolves to for one context-menu command. */
98
+ interface ContextMenuInfo {
99
+ /** The deployed command id. Absent when the command deployed to two or more guilds. */
100
+ readonly id?: string;
101
+ /** The name shown in Discord's right-click menu. */
102
+ readonly name: string;
103
+ readonly kind: ContextMenuKind;
104
+ }
105
+ /** Deployed context-menu commands, split by kind because Discord scopes name uniqueness per command type. */
106
+ interface InjectedContextMenuMap {
107
+ readonly user: { [K in keyof UserContextMenuRegistry]: ContextMenuInfo };
108
+ readonly message: { [K in keyof MessageContextMenuRegistry]: ContextMenuInfo };
109
+ }
110
+ /**
111
+ * The bot's deployed context-menu commands. Filled by {@link CommandInjector} after each deploy, and a read
112
+ * before that throws.
113
+ *
114
+ * @example
115
+ * ```ts
116
+ * import { ContextMenus } from '@seedcord/gateway';
117
+ *
118
+ * const id = ContextMenus.user['View Profile'].id;
119
+ * ```
120
+ */
121
+ declare const ContextMenus: InjectedContextMenuMap;
122
+ /**
123
+ * Records each deployed command on {@link Commands} and {@link ContextMenus}.
124
+ *
125
+ * @internal
126
+ */
127
+ declare class CommandInjector {
128
+ private readonly logger;
129
+ inject(deploy: DeployResult, all: readonly CommandBuilder[]): void;
130
+ private injectMenus;
131
+ private indexByKey;
132
+ private indexGuilds;
133
+ private resolveId;
134
+ private toMention;
135
+ private toPlain;
136
+ private clear;
137
+ }
138
+ //#endregion
36
139
  //#region src/components/builderTypes.d.ts
37
140
  /**
38
141
  * Available Discord.js builder classes for use with BuilderComponent for commands, embeds, modals, etc.
@@ -232,6 +335,33 @@ sum();
232
335
  */
233
336
  type NonEmptyTuple<T = unknown> = readonly [T, ...T[]];
234
337
  //#endregion
338
+ //#region ../../node_modules/.pnpm/type-fest@5.7.0/node_modules/type-fest/source/promisable.d.ts
339
+ /**
340
+ Create a type that represents either the value or the value wrapped in `PromiseLike`.
341
+
342
+ Use-cases:
343
+ - A function accepts a callback that may either return a value synchronously or may return a promised value.
344
+ - This type could be the return type of `Promise#then()`, `Promise#catch()`, and `Promise#finally()` callbacks.
345
+
346
+ Please upvote [this issue](https://github.com/microsoft/TypeScript/issues/31394) if you want to have this type as a built-in in TypeScript.
347
+
348
+ @example
349
+ ```
350
+ import type {Promisable} from 'type-fest';
351
+
352
+ async function logger(getLogEntry: () => Promisable<string>): Promise<void> {
353
+ const entry = await getLogEntry();
354
+ console.log(entry);
355
+ }
356
+
357
+ await logger(() => 'foo');
358
+ await logger(() => Promise.resolve('bar'));
359
+ ```
360
+
361
+ @category Async
362
+ */
363
+ type Promisable<T> = T | PromiseLike<T>;
364
+ //#endregion
235
365
  //#region src/decorators/Command.d.ts
236
366
  type CommandCtor = Constructor<BuilderComponent<'command' | 'context_menu'>>;
237
367
  interface GlobalMeta {
@@ -456,7 +586,7 @@ declare function interactionRoutesOf(constructor: RoutableConstructor): [Interac
456
586
  declare function storeInteractionRoute(route: InteractionRoutes, routes: string | readonly string[], constructor: RoutableConstructor): void;
457
587
  declare function storeComponentRoute(route: InteractionRoutes, defs: readonly AnyCustomId[], constructor: RoutableConstructor): void;
458
588
  declare function selectMenuRouteOf(kind: SelectMenuKind): InteractionRoutes;
459
- declare function contextMenuRouteOf(kind: ApplicationCommandType.User | ApplicationCommandType.Message): InteractionRoutes;
589
+ declare function contextMenuRouteOf(kind: ContextMenuKind): InteractionRoutes;
460
590
  //#endregion
461
591
  //#region src/reply/serializeReply.d.ts
462
592
  /** Serialized message data the transport wire writers consume. */
@@ -771,14 +901,16 @@ interface GateNoticeOptions {
771
901
  }
772
902
  declare function pickNotice(options: GateNoticeOptions | undefined, makeDefault: (message?: string) => Notice): Notice;
773
903
  //#endregion
774
- //#region src/gates/catalog/permissions.d.ts
904
+ //#region src/permissions/bits.d.ts
775
905
  /**
776
906
  * The permission flag bits a caller or the bot must hold. Pass the `PermissionFlagsBits` values from
777
907
  * `discord-api-types/v10` (or `discord.js`).
778
908
  */
779
909
  type PermissionScope = readonly bigint[];
780
- /** Permission bit to its prettified human-readable name, for the missing-permission refusal. */
910
+ /** Permission bit to its prettified human-readable name. */
781
911
  declare const PermissionNames: Map<bigint, string>;
912
+ //#endregion
913
+ //#region src/gates/catalog/permissions.d.ts
782
914
  /**
783
915
  * Options for {@link RequirePermissions} and {@link RequireBotPermissions}.
784
916
  */
@@ -938,5 +1070,15 @@ type Getter<Route extends keyof SlashOptionRegistry, Kind extends OptionKind, Me
938
1070
  */
939
1071
  type AutocompleteOptions<Route extends keyof SlashOptionRegistry> = Getter<Route, 'string', 'getString'> & Getter<Route, 'integer', 'getInteger'> & Getter<Route, 'number', 'getNumber'> & Getter<Route, 'boolean', 'getBoolean'>;
940
1072
  //#endregion
941
- export { SlashOptionRegistry as $, RoutableConstructor as A, decodeFor as B, RequiredOf as C, ModalLike as D, BaseReplySender as E, selectMenuRouteOf as F, RegisterCommand as G, CustomIdField as H, storeComponentRoute as I, RowComponent as J, IsNever as K, storeInteractionRoute as L, areRoutes as M, contextMenuRouteOf as N, SerializedReply as O, interactionRoutesOf as P, SlashOption as Q, AnyCustomId as R, GuildPermissionsContext as S, defineGate as T, DecodedParams as U, prefixOf as V, CommandMeta as W, RowType as X, BuilderType as Y, OptionKind as Z, JoinNames as _, FocusedField as a, Gate as b, RequireBotPermissions as c, RequireRole as d, RequireRoleOptions as f, IntersectRequired as g, GateFitsWith as h, EntryFor as i, SelectMenuKind as j, serializeReply as k, RequirePermissions as l, pickNotice as m, AutocompleteOptions as n, PermissionNames as o, GateNoticeOptions as p, BuilderComponent as q, ChoiceValueOf as r, PermissionScope as s, AutocompletableNames as t, RequirePermissionsOptions as u, TwoOrMore as v, defineEffectGate as w, GateContextBase as x, EffectGate as y, CustomId as z };
942
- //# sourceMappingURL=AutocompleteOptions-DLp_B8as.d.mts.map
1073
+ //#region src/pagination/cursor.d.ts
1074
+ declare const PAGE_MAX = 1000000;
1075
+ /** Page cursor for a paginator. */
1076
+ type PageCursor<Prefix extends string> = CustomId<Prefix, {
1077
+ page: CustomIdField<number>;
1078
+ slot: CustomIdField<number>;
1079
+ }>;
1080
+ /** Build the page cursor for a paginator. */
1081
+ declare function pageCursor<Prefix extends string>(prefix: Prefix): PageCursor<Prefix>;
1082
+ //#endregion
1083
+ export { RowType as $, ModalLike as A, storeInteractionRoute as B, Gate as C, defineEffectGate as D, RequiredOf as E, areRoutes as F, DecodedParams as G, CustomId as H, contextMenuRouteOf as I, Promisable as J, CommandMeta as K, interactionRoutesOf as L, serializeReply as M, RoutableConstructor as N, defineGate as O, SelectMenuKind as P, BuilderType as Q, selectMenuRouteOf as R, EffectGate as S, GuildPermissionsContext as T, decodeFor as U, AnyCustomId as V, prefixOf as W, BuilderComponent as X, IsNever as Y, RowComponent as Z, pickNotice as _, AutocompleteOptions as a, InjectedCommandMap as at, JoinNames as b, FocusedField as c, SlashOption as ct, RequirePermissionsOptions as d, MessageContextMenuRegistry as dt, CommandInfo as et, RequireRole as f, UserContextMenuRegistry as ft, GateNoticeOptions as g, PermissionScope as h, AutocompletableNames as i, ContextMenus as it, SerializedReply as j, BaseReplySender as k, RequireBotPermissions as l, SlashOptionRegistry as lt, PermissionNames as m, PageCursor as n, Commands as nt, ChoiceValueOf as o, InjectedContextMenuMap as ot, RequireRoleOptions as p, RegisterCommand as q, pageCursor as r, ContextMenuInfo as rt, EntryFor as s, OptionKind as st, PAGE_MAX as t, CommandInjector as tt, RequirePermissions as u, ContextMenuKind as ut, GateFitsWith as v, GateContextBase as w, TwoOrMore as x, IntersectRequired as y, storeComponentRoute as z };
1084
+ //# sourceMappingURL=cursor-D6nBjwaE.d.mts.map
@@ -1,5 +1,5 @@
1
- import { t as Constructor } from "./basic-D7bDlgSP.mjs";
2
- import { C as Subscriber, O as SubscriptionKey, y as CoreBase } from "./Plugin-3rlH0uxH.mjs";
1
+ import { t as Constructor } from "./basic-1hebYVcN.mjs";
2
+ import { T as SubscriptionKey, b as Subscriber, g as CoreBase } from "./Plugin-BZit5HUI.mjs";
3
3
  import { APIMessageTopLevelComponent } from "discord-api-types/v10";
4
4
  import { EventFrequency } from "@seedcord/types";
5
5
 
@@ -139,4 +139,4 @@ declare abstract class WebhookLog<KeyOfSubscribers extends SubscriptionKey, TCor
139
139
  declare function WebhookUrl(envKey: string): <HandlerCtor extends Constructor<WebhookLog<SubscriptionKey, CoreBase>>>(constructor: HandlerCtor) => void;
140
140
  //#endregion
141
141
  export { Subscribe as a, WebhookFile as i, WebhookLog as n, SubscribeOptions as o, WebhookReport as r, WebhookUrl as t };
142
- //# sourceMappingURL=index-Dueqztyy.d.mts.map
142
+ //# sourceMappingURL=index-Cr4-VV4u.d.mts.map