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

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 (53) hide show
  1. package/dist/{AutocompleteOptions-eKhIe6Qt.d.mts → AutocompleteOptions-DLp_B8as.d.mts} +61 -112
  2. package/dist/HmrModuleHandler-3sNgKHdf.mjs +163 -0
  3. package/dist/HmrModuleHandler-3sNgKHdf.mjs.map +1 -0
  4. package/dist/HmrModuleHandler-CTBng7wV.cjs +170 -0
  5. package/dist/HmrModuleHandler-CTBng7wV.cjs.map +1 -0
  6. package/dist/Plugin-3rlH0uxH.d.mts +620 -0
  7. package/dist/{Plugin-C2-VHrsX.cjs → Plugin-Cgp1a0uQ.cjs} +13 -4
  8. package/dist/Plugin-Cgp1a0uQ.cjs.map +1 -0
  9. package/dist/{Plugin-PcdPjAzc.mjs → Plugin-j9GYdroS.mjs} +13 -4
  10. package/dist/Plugin-j9GYdroS.mjs.map +1 -0
  11. package/dist/{permissions-DSW_EZfN.cjs → Silence-DiP95iwD.cjs} +38 -307
  12. package/dist/Silence-DiP95iwD.cjs.map +1 -0
  13. package/dist/{permissions-RVCBhL2n.mjs → Silence-dbC2slOB.mjs} +35 -238
  14. package/dist/Silence-dbC2slOB.mjs.map +1 -0
  15. package/dist/basic-D7bDlgSP.d.mts +10 -0
  16. package/dist/hmr.index.cjs +2 -164
  17. package/dist/hmr.index.mjs +2 -162
  18. package/dist/index-Dueqztyy.d.mts +142 -0
  19. package/dist/index.cjs +50 -72
  20. package/dist/index.cjs.map +1 -1
  21. package/dist/index.d.mts +7 -5
  22. package/dist/index.mjs +8 -35
  23. package/dist/index.mjs.map +1 -1
  24. package/dist/internal.index.cjs +262 -74
  25. package/dist/internal.index.cjs.map +1 -1
  26. package/dist/internal.index.d.mts +68 -4
  27. package/dist/internal.index.mjs +216 -35
  28. package/dist/internal.index.mjs.map +1 -1
  29. package/dist/node-internal.index.cjs +123 -52
  30. package/dist/node-internal.index.cjs.map +1 -1
  31. package/dist/node-internal.index.d.mts +67 -2158
  32. package/dist/node-internal.index.mjs +124 -54
  33. package/dist/node-internal.index.mjs.map +1 -1
  34. package/dist/plugin.index.cjs +1 -1
  35. package/dist/plugin.index.d.mts +1 -1
  36. package/dist/plugin.index.mjs +1 -1
  37. package/dist/publishDefault-CCf1azzW.mjs +264 -0
  38. package/dist/publishDefault-CCf1azzW.mjs.map +1 -0
  39. package/dist/publishDefault-l0NQ-SHo.cjs +353 -0
  40. package/dist/publishDefault-l0NQ-SHo.cjs.map +1 -0
  41. package/dist/subscribers-B1G6_LlK.cjs +517 -0
  42. package/dist/subscribers-B1G6_LlK.cjs.map +1 -0
  43. package/dist/subscribers-DYqFVP1X.mjs +480 -0
  44. package/dist/subscribers-DYqFVP1X.mjs.map +1 -0
  45. package/package.json +7 -6
  46. package/dist/Plugin-C2-VHrsX.cjs.map +0 -1
  47. package/dist/Plugin-CNyRKDHT.d.mts +0 -226
  48. package/dist/Plugin-PcdPjAzc.mjs.map +0 -1
  49. package/dist/hmr.index.cjs.map +0 -1
  50. package/dist/hmr.index.mjs.map +0 -1
  51. package/dist/is-never-Ddaba1Su.d.mts +0 -58
  52. package/dist/permissions-DSW_EZfN.cjs.map +0 -1
  53. package/dist/permissions-RVCBhL2n.mjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Plugin-Cgp1a0uQ.cjs","names":["SeedcordError","SeedcordErrorCode","SeedcordError","SeedcordErrorCode","Logger","SeedcordError","SeedcordErrorCode"],"sources":["../src/plugin/context.ts","../src/plugin/lifecycle.ts","../src/plugin/Plugin.ts"],"sourcesContent":["import { SeedcordErrorCode } from '@seedcord/errors';\nimport { SeedcordError } from '@seedcord/errors/internal';\n\nimport type { PluginNeed } from './options';\nimport type { Config, Store } from '@seedcord/types';\n\n/**\n * The type each `ctx` capability resolves to. Empty in core, each transport augments it through\n * declaration merging.\n *\n * @example\n * ```typescript\n * declare module '@seedcord/core' {\n * interface PluginCapabilityTypes {\n * client: Client;\n * rest: REST;\n * }\n * }\n * ```\n */\nexport interface PluginCapabilityTypes {}\n\ntype CapabilityType<Key extends PluginNeed, Fallback> = Key extends keyof PluginCapabilityTypes\n ? PluginCapabilityTypes[Key]\n : Fallback;\n\ntype CapabilityValue<TNeeds extends PluginNeed, Key extends PluginNeed, Value> = Key extends TNeeds ? Value : never;\n\n/**\n * The framework surface a plugin reads through `this.ctx`, typed by its declared `needs`.\n *\n * Always available: `config` and `store`. Each capability resolves to its value only when\n * the plugin declared that key, otherwise `never`. The logger comes from `this.logger`.\n *\n * @typeParam TNeeds - The plugin's declared `needs` union.\n */\nexport interface PluginContext<TNeeds extends PluginNeed = never> {\n readonly config: Config;\n readonly store: Store<'charge'>;\n readonly client: CapabilityValue<TNeeds, 'client', CapabilityType<'client', unknown>>;\n readonly token: CapabilityValue<TNeeds, 'token', string>;\n /**\n * The REST client. On http, the client has no token until the Ready phase, so a call from\n * `init()` sends without a token and returns a 401.\n */\n readonly rest: CapabilityValue<TNeeds, 'rest', CapabilityType<'rest', unknown>>;\n}\n\n// the conditional capability types make PluginContext<A> and PluginContext<B> mutually unassignable\n/** @internal */\nexport type StoredPluginContext = Pick<PluginContext, 'config' | 'store'> & {\n client?: unknown;\n token?: string | undefined;\n rest?: unknown;\n};\n\n/**\n * The capability arms a transport supplies from its own Bot/client. `attach` merges them into each\n * plugin's ctx.\n *\n * @internal\n */\nexport interface PluginCapabilities {\n readonly client?: unknown;\n readonly token?: string | undefined;\n readonly rest?: unknown;\n}\n\n/** @internal unset until attach installs the built ctx */\nexport const pluginContextSlot = Symbol('seedcord.plugin.ctx');\n\ninterface ContextHolder {\n [pluginContextSlot]?: StoredPluginContext;\n}\n\n/** @internal */\nexport function readPluginContext<TNeeds extends PluginNeed>(holder: ContextHolder): PluginContext<TNeeds> {\n const ctx = holder[pluginContextSlot];\n if (!ctx) throw new SeedcordError(SeedcordErrorCode.PluginContextBeforeInit, [holder.constructor.name]);\n // safe, finalizePluginContext set the ctx typed for this plugin's declared needs\n return ctx as PluginContext<TNeeds>;\n}\n\n/** @internal */\nexport function finalizePluginContext<TNeeds extends PluginNeed>(\n holder: ContextHolder,\n ctx: PluginContext<TNeeds>\n): void {\n holder[pluginContextSlot] = ctx;\n}\n","import { SeedcordErrorCode } from '@seedcord/errors';\nimport { SeedcordError } from '@seedcord/errors/internal';\n\nimport { ShutdownPhase, StartupPhase } from '@src/lifecycle/phases';\n\n/**\n * The lifecycle a plugin declares through `super(host, spec)`. Unset fields resolve to the base\n * defaults. `ready` runs at a fixed `StartupPhase.Ready`, so it takes only a timeout.\n */\nexport interface PluginLifecycleSpec {\n init?: { phase?: StartupPhase; timeout?: number };\n ready?: { timeout?: number };\n dispose?: { phase?: ShutdownPhase; timeout?: number };\n}\n\n/** @internal */\nexport interface ResolvedPluginLifecycleSpec {\n readonly init: { readonly phase: StartupPhase; readonly timeout: number };\n readonly ready: { readonly timeout: number };\n readonly dispose: { readonly phase: ShutdownPhase; readonly timeout: number };\n}\n\nconst DEFAULT_INIT_TIMEOUT_MS = 15_000;\nconst DEFAULT_READY_TIMEOUT_MS = 15_000;\nconst DEFAULT_DISPOSE_TIMEOUT_MS = 10_000;\n\nfunction timeoutOf(\n field: 'init' | 'ready' | 'dispose',\n declared: number | undefined,\n fallback: number,\n pluginName: string\n): number {\n if (declared === undefined) return fallback;\n if (!Number.isFinite(declared) || declared <= 0) {\n throw new SeedcordError(SeedcordErrorCode.PluginOptionsRejected, [\n pluginName,\n `lifecycle ${field}.timeout must be a positive number of milliseconds`\n ]);\n }\n return declared;\n}\n\n/** @internal */\nexport function resolveLifecycleSpec(\n spec: PluginLifecycleSpec | undefined,\n pluginName: string\n): ResolvedPluginLifecycleSpec {\n return {\n init: {\n phase: spec?.init?.phase ?? StartupPhase.Configuration,\n timeout: timeoutOf('init', spec?.init?.timeout, DEFAULT_INIT_TIMEOUT_MS, pluginName)\n },\n ready: {\n timeout: timeoutOf('ready', spec?.ready?.timeout, DEFAULT_READY_TIMEOUT_MS, pluginName)\n },\n dispose: {\n phase: spec?.dispose?.phase ?? ShutdownPhase.Disconnect,\n timeout: timeoutOf('dispose', spec?.dispose?.timeout, DEFAULT_DISPOSE_TIMEOUT_MS, pluginName)\n }\n };\n}\n","import { SeedcordErrorCode } from '@seedcord/errors';\nimport { SeedcordError } from '@seedcord/errors/internal';\nimport { Logger } from '@seedcord/logger';\n\nimport { getDevChannel } from '@hmr/devChannel';\n\nimport { pluginContextSlot, readPluginContext } from './context';\nimport { resolveLifecycleSpec } from './lifecycle';\n\nimport type { PluginContext, StoredPluginContext } from './context';\nimport type { ResolvedPluginLifecycleSpec, PluginLifecycleSpec } from './lifecycle';\nimport type { TransportOf, NeedsOf, PluginOptions, RuntimeOf } from './options';\nimport type { CoreBase } from '@interfaces/CoreBase';\nimport type { Tail, HmrAware, HmrUpdateEvent } from '@seedcord/types';\n\nexport interface Initializeable {\n init(): Promise<void>;\n}\n\n/** @internal */\nconst resolvedSpecSlot = Symbol('seedcord.plugin.spec');\n\n/**\n * Base class for Seedcord plugins. A subclass declares its options as the `Opts` type argument,\n * implements `init()`, and reads the framework surface through `this.ctx`.\n *\n * @typeParam Opts - The plugin's declared {@link PluginOptions}.\n * @typeParam TCore - The host type `this.core` resolves to. Each transport binds it to its own `Core`.\n */\nexport abstract class Plugin<Opts extends PluginOptions = {}, TCore extends CoreBase = CoreBase>\n implements Initializeable, HmrAware\n{\n /** @internal phantom, never set at runtime */\n declare readonly __transport?: TransportOf<Opts>;\n /** @internal phantom, never set at runtime */\n declare readonly __runtime?: RuntimeOf<Opts>;\n\n /** @internal */\n readonly [resolvedSpecSlot]: ResolvedPluginLifecycleSpec;\n /** @internal */\n [pluginContextSlot]?: StoredPluginContext;\n\n /** Logs under the plugin's class name, on the channel its attach key names. */\n public readonly logger: Logger;\n\n // CoreBase here keeps the augmented Core out of ConstructorParameters, which attach reads\n constructor(\n private readonly host: CoreBase,\n spec?: PluginLifecycleSpec\n ) {\n this.logger = new Logger(this.constructor.name);\n this[resolvedSpecSlot] = resolveLifecycleSpec(spec, this.constructor.name);\n }\n\n /** The host, typed to the transport whose `Plugin` base this class extends. */\n protected get core(): TCore {\n // justified: each transport binds TCore to the Core its own host satisfies\n return this.host as TCore;\n }\n\n /** The framework surface, available from `init()` onward. Throws if read before `attach` finalizes it. */\n protected get ctx(): PluginContext<NeedsOf<Opts>> {\n return readPluginContext<NeedsOf<Opts>>(this);\n }\n\n abstract init(): Promise<void>;\n\n /**\n * Runs in the startup Ready phase, after `init()`. The gateway client is logged in by this phase,\n * and the http host runs its server-bind and health tasks in the same phase.\n */\n ready?(): Promise<void>;\n\n /** Runs during teardown, only when `init()` resolved. */\n dispose?(): Promise<void>;\n\n /**\n * Rejects the plugin's constructor options with a reason. Throws a `SeedcordError` naming the\n * plugin class and the reason.\n *\n * @param reason - Why the options are invalid.\n */\n protected rejectOptions(reason: string): never {\n throw new SeedcordError(SeedcordErrorCode.PluginOptionsRejected, [this.constructor.name, reason]);\n }\n\n /** Override to reload plugin state on an HMR update. */\n public onHmr(_event: HmrUpdateEvent): Promise<void> {\n return Promise.resolve();\n }\n\n /**\n * Registers critical file patterns that should trigger a full restart when changed in Dev HMR.\n * @param patterns - Glob patterns relative to the project root\n */\n protected registerCriticalFiles(patterns: string[]): void {\n getDevChannel()?.send('seedcord:register-critical-files', { patterns });\n }\n}\n\n/** @internal */\nexport function resolvedLifecycleSpecOf(plugin: PluginLike): ResolvedPluginLifecycleSpec {\n return plugin[resolvedSpecSlot];\n}\n\nexport type { PluginContext, PluginCapabilityTypes } from './context';\nexport type { PluginLifecycleSpec } from './lifecycle';\nexport type { PluginOptions } from './options';\n\n// a bound of Plugin<{}> rejects every plugin that declares an option, since Plugin<A> and Plugin<B>\n// are mutually unassignable. every member here must stay Opts-independent.\n/** @internal */\nexport type PluginLike = Pick<\n Plugin,\n 'init' | 'ready' | 'dispose' | 'logger' | 'onHmr' | typeof resolvedSpecSlot | typeof pluginContextSlot\n>;\n\n// a `CoreBase` first parameter rejects a narrowing ctor on its own, and it also collapses\n// `InstanceType<Ctor>` to `PluginLike` at every attach call. CoreParamAssert checks it instead.\n/** @internal */\nexport type PluginCtor<TPlugin extends PluginLike = PluginLike> = new (...args: any[]) => TPlugin;\n\n/** @internal */\nexport type PluginArgs<Ctor extends PluginCtor> = Tail<ConstructorParameters<Ctor>>;\n\ntype CoreParamTooNarrow = Record<\n 'this plugin constructor must take CoreBase as its first parameter and read the transport Core off this.core',\n never\n>;\n\n// a narrowed first parameter fails `CoreBase extends Param`\n/** @internal */\nexport type CoreParamAssert<Ctor extends PluginCtor> = CoreBase extends ConstructorParameters<Ctor>[0]\n ? unknown\n : CoreParamTooNarrow;\n\nexport { finalizePluginContext } from './context';\n"],"mappings":";;;;;;;;AAqEA,MAAa,oBAAoB,OAAO,qBAAqB;;AAO7D,SAAgB,kBAA6C,QAA8C;CACvG,MAAM,MAAM,OAAO;CACnB,IAAI,CAAC,KAAK,MAAM,IAAIA,wCAAcC,mCAAkB,yBAAyB,CAAC,OAAO,YAAY,IAAI,CAAC;CAEtG,OAAO;AACX;;AAGA,SAAgB,sBACZ,QACA,KACI;CACJ,OAAO,qBAAqB;AAChC;;;;ACnEA,MAAM,0BAA0B;AAChC,MAAM,2BAA2B;AACjC,MAAM,6BAA6B;AAEnC,SAAS,UACL,OACA,UACA,UACA,YACM;CACN,IAAI,aAAa,QAAW,OAAO;CACnC,IAAI,CAAC,OAAO,SAAS,QAAQ,KAAK,YAAY,GAC1C,MAAM,IAAIC,wCAAcC,mCAAkB,uBAAuB,CAC7D,YACA,aAAa,MAAM,mDACvB,CAAC;CAEL,OAAO;AACX;;AAGA,SAAgB,qBACZ,MACA,YAC2B;CAC3B,OAAO;EACH,MAAM;GACF,OAAO,MAAM,MAAM;GACnB,SAAS,UAAU,QAAQ,MAAM,MAAM,SAAS,yBAAyB,UAAU;EACvF;EACA,OAAO,EACH,SAAS,UAAU,SAAS,MAAM,OAAO,SAAS,0BAA0B,UAAU,EAC1F;EACA,SAAS;GACL,OAAO,MAAM,SAAS;GACtB,SAAS,UAAU,WAAW,MAAM,SAAS,SAAS,4BAA4B,UAAU;EAChG;CACJ;AACJ;;;;;ACxCA,MAAM,mBAAmB,OAAO,sBAAsB;;;;;;;;AAStD,IAAsB,SAAtB,MAEA;CAgByB;;CATrB,CAAU;;CAEV,CAAC;;CAGD,AAAgB;CAGhB,YACI,AAAiB,MACjB,MACF;EAFmB;EAGjB,KAAK,SAAS,IAAIC,wBAAO,KAAK,YAAY,IAAI;EAC9C,KAAK,oBAAoB,qBAAqB,MAAM,KAAK,YAAY,IAAI;CAC7E;;CAGA,IAAc,OAAc;EAExB,OAAO,KAAK;CAChB;;CAGA,IAAc,MAAoC;EAC9C,OAAO,kBAAiC,IAAI;CAChD;;;;;;;CAmBA,AAAU,cAAc,QAAuB;EAC3C,MAAM,IAAIC,wCAAcC,mCAAkB,uBAAuB,CAAC,KAAK,YAAY,MAAM,MAAM,CAAC;CACpG;;CAGA,AAAO,MAAM,QAAuC;EAChD,OAAO,QAAQ,QAAQ;CAC3B;;;;;CAMA,AAAU,sBAAsB,UAA0B;EACtD,iCAAc,CAAC,EAAE,KAAK,oCAAoC,EAAE,SAAS,CAAC;CAC1E;AACJ;;AAGA,SAAgB,wBAAwB,QAAiD;CACrF,OAAO,OAAO;AAClB"}
@@ -2,6 +2,7 @@ import { n as StartupPhase, t as ShutdownPhase } from "./phases-BfpAG6w3.mjs";
2
2
  import { t as getDevChannel } from "./devChannel-CQU7hq7Q.mjs";
3
3
  import { SeedcordErrorCode } from "@seedcord/errors";
4
4
  import { SeedcordError } from "@seedcord/errors/internal";
5
+ import { Logger } from "@seedcord/logger";
5
6
 
6
7
  //#region src/plugin/context.ts
7
8
  /** @internal unset until attach installs the built ctx */
@@ -51,17 +52,25 @@ const resolvedSpecSlot = Symbol("seedcord.plugin.spec");
51
52
  * implements `init()`, and reads the framework surface through `this.ctx`.
52
53
  *
53
54
  * @typeParam Opts - The plugin's declared {@link PluginOptions}.
55
+ * @typeParam TCore - The host type `this.core` resolves to. Each transport binds it to its own `Core`.
54
56
  */
55
57
  var Plugin = class {
56
- pluggable;
58
+ host;
57
59
  /** @internal */
58
60
  [resolvedSpecSlot];
59
61
  /** @internal */
60
62
  [pluginContextSlot];
61
- constructor(pluggable, spec) {
62
- this.pluggable = pluggable;
63
+ /** Logs under the plugin's class name, on the channel its attach key names. */
64
+ logger;
65
+ constructor(host, spec) {
66
+ this.host = host;
67
+ this.logger = new Logger(this.constructor.name);
63
68
  this[resolvedSpecSlot] = resolveLifecycleSpec(spec, this.constructor.name);
64
69
  }
70
+ /** The host, typed to the transport whose `Plugin` base this class extends. */
71
+ get core() {
72
+ return this.host;
73
+ }
65
74
  /** The framework surface, available from `init()` onward. Throws if read before `attach` finalizes it. */
66
75
  get ctx() {
67
76
  return readPluginContext(this);
@@ -94,4 +103,4 @@ function resolvedLifecycleSpecOf(plugin) {
94
103
 
95
104
  //#endregion
96
105
  export { resolvedLifecycleSpecOf as n, finalizePluginContext as r, Plugin as t };
97
- //# sourceMappingURL=Plugin-PcdPjAzc.mjs.map
106
+ //# sourceMappingURL=Plugin-j9GYdroS.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Plugin-j9GYdroS.mjs","names":[],"sources":["../src/plugin/context.ts","../src/plugin/lifecycle.ts","../src/plugin/Plugin.ts"],"sourcesContent":["import { SeedcordErrorCode } from '@seedcord/errors';\nimport { SeedcordError } from '@seedcord/errors/internal';\n\nimport type { PluginNeed } from './options';\nimport type { Config, Store } from '@seedcord/types';\n\n/**\n * The type each `ctx` capability resolves to. Empty in core, each transport augments it through\n * declaration merging.\n *\n * @example\n * ```typescript\n * declare module '@seedcord/core' {\n * interface PluginCapabilityTypes {\n * client: Client;\n * rest: REST;\n * }\n * }\n * ```\n */\nexport interface PluginCapabilityTypes {}\n\ntype CapabilityType<Key extends PluginNeed, Fallback> = Key extends keyof PluginCapabilityTypes\n ? PluginCapabilityTypes[Key]\n : Fallback;\n\ntype CapabilityValue<TNeeds extends PluginNeed, Key extends PluginNeed, Value> = Key extends TNeeds ? Value : never;\n\n/**\n * The framework surface a plugin reads through `this.ctx`, typed by its declared `needs`.\n *\n * Always available: `config` and `store`. Each capability resolves to its value only when\n * the plugin declared that key, otherwise `never`. The logger comes from `this.logger`.\n *\n * @typeParam TNeeds - The plugin's declared `needs` union.\n */\nexport interface PluginContext<TNeeds extends PluginNeed = never> {\n readonly config: Config;\n readonly store: Store<'charge'>;\n readonly client: CapabilityValue<TNeeds, 'client', CapabilityType<'client', unknown>>;\n readonly token: CapabilityValue<TNeeds, 'token', string>;\n /**\n * The REST client. On http, the client has no token until the Ready phase, so a call from\n * `init()` sends without a token and returns a 401.\n */\n readonly rest: CapabilityValue<TNeeds, 'rest', CapabilityType<'rest', unknown>>;\n}\n\n// the conditional capability types make PluginContext<A> and PluginContext<B> mutually unassignable\n/** @internal */\nexport type StoredPluginContext = Pick<PluginContext, 'config' | 'store'> & {\n client?: unknown;\n token?: string | undefined;\n rest?: unknown;\n};\n\n/**\n * The capability arms a transport supplies from its own Bot/client. `attach` merges them into each\n * plugin's ctx.\n *\n * @internal\n */\nexport interface PluginCapabilities {\n readonly client?: unknown;\n readonly token?: string | undefined;\n readonly rest?: unknown;\n}\n\n/** @internal unset until attach installs the built ctx */\nexport const pluginContextSlot = Symbol('seedcord.plugin.ctx');\n\ninterface ContextHolder {\n [pluginContextSlot]?: StoredPluginContext;\n}\n\n/** @internal */\nexport function readPluginContext<TNeeds extends PluginNeed>(holder: ContextHolder): PluginContext<TNeeds> {\n const ctx = holder[pluginContextSlot];\n if (!ctx) throw new SeedcordError(SeedcordErrorCode.PluginContextBeforeInit, [holder.constructor.name]);\n // safe, finalizePluginContext set the ctx typed for this plugin's declared needs\n return ctx as PluginContext<TNeeds>;\n}\n\n/** @internal */\nexport function finalizePluginContext<TNeeds extends PluginNeed>(\n holder: ContextHolder,\n ctx: PluginContext<TNeeds>\n): void {\n holder[pluginContextSlot] = ctx;\n}\n","import { SeedcordErrorCode } from '@seedcord/errors';\nimport { SeedcordError } from '@seedcord/errors/internal';\n\nimport { ShutdownPhase, StartupPhase } from '@src/lifecycle/phases';\n\n/**\n * The lifecycle a plugin declares through `super(host, spec)`. Unset fields resolve to the base\n * defaults. `ready` runs at a fixed `StartupPhase.Ready`, so it takes only a timeout.\n */\nexport interface PluginLifecycleSpec {\n init?: { phase?: StartupPhase; timeout?: number };\n ready?: { timeout?: number };\n dispose?: { phase?: ShutdownPhase; timeout?: number };\n}\n\n/** @internal */\nexport interface ResolvedPluginLifecycleSpec {\n readonly init: { readonly phase: StartupPhase; readonly timeout: number };\n readonly ready: { readonly timeout: number };\n readonly dispose: { readonly phase: ShutdownPhase; readonly timeout: number };\n}\n\nconst DEFAULT_INIT_TIMEOUT_MS = 15_000;\nconst DEFAULT_READY_TIMEOUT_MS = 15_000;\nconst DEFAULT_DISPOSE_TIMEOUT_MS = 10_000;\n\nfunction timeoutOf(\n field: 'init' | 'ready' | 'dispose',\n declared: number | undefined,\n fallback: number,\n pluginName: string\n): number {\n if (declared === undefined) return fallback;\n if (!Number.isFinite(declared) || declared <= 0) {\n throw new SeedcordError(SeedcordErrorCode.PluginOptionsRejected, [\n pluginName,\n `lifecycle ${field}.timeout must be a positive number of milliseconds`\n ]);\n }\n return declared;\n}\n\n/** @internal */\nexport function resolveLifecycleSpec(\n spec: PluginLifecycleSpec | undefined,\n pluginName: string\n): ResolvedPluginLifecycleSpec {\n return {\n init: {\n phase: spec?.init?.phase ?? StartupPhase.Configuration,\n timeout: timeoutOf('init', spec?.init?.timeout, DEFAULT_INIT_TIMEOUT_MS, pluginName)\n },\n ready: {\n timeout: timeoutOf('ready', spec?.ready?.timeout, DEFAULT_READY_TIMEOUT_MS, pluginName)\n },\n dispose: {\n phase: spec?.dispose?.phase ?? ShutdownPhase.Disconnect,\n timeout: timeoutOf('dispose', spec?.dispose?.timeout, DEFAULT_DISPOSE_TIMEOUT_MS, pluginName)\n }\n };\n}\n","import { SeedcordErrorCode } from '@seedcord/errors';\nimport { SeedcordError } from '@seedcord/errors/internal';\nimport { Logger } from '@seedcord/logger';\n\nimport { getDevChannel } from '@hmr/devChannel';\n\nimport { pluginContextSlot, readPluginContext } from './context';\nimport { resolveLifecycleSpec } from './lifecycle';\n\nimport type { PluginContext, StoredPluginContext } from './context';\nimport type { ResolvedPluginLifecycleSpec, PluginLifecycleSpec } from './lifecycle';\nimport type { TransportOf, NeedsOf, PluginOptions, RuntimeOf } from './options';\nimport type { CoreBase } from '@interfaces/CoreBase';\nimport type { Tail, HmrAware, HmrUpdateEvent } from '@seedcord/types';\n\nexport interface Initializeable {\n init(): Promise<void>;\n}\n\n/** @internal */\nconst resolvedSpecSlot = Symbol('seedcord.plugin.spec');\n\n/**\n * Base class for Seedcord plugins. A subclass declares its options as the `Opts` type argument,\n * implements `init()`, and reads the framework surface through `this.ctx`.\n *\n * @typeParam Opts - The plugin's declared {@link PluginOptions}.\n * @typeParam TCore - The host type `this.core` resolves to. Each transport binds it to its own `Core`.\n */\nexport abstract class Plugin<Opts extends PluginOptions = {}, TCore extends CoreBase = CoreBase>\n implements Initializeable, HmrAware\n{\n /** @internal phantom, never set at runtime */\n declare readonly __transport?: TransportOf<Opts>;\n /** @internal phantom, never set at runtime */\n declare readonly __runtime?: RuntimeOf<Opts>;\n\n /** @internal */\n readonly [resolvedSpecSlot]: ResolvedPluginLifecycleSpec;\n /** @internal */\n [pluginContextSlot]?: StoredPluginContext;\n\n /** Logs under the plugin's class name, on the channel its attach key names. */\n public readonly logger: Logger;\n\n // CoreBase here keeps the augmented Core out of ConstructorParameters, which attach reads\n constructor(\n private readonly host: CoreBase,\n spec?: PluginLifecycleSpec\n ) {\n this.logger = new Logger(this.constructor.name);\n this[resolvedSpecSlot] = resolveLifecycleSpec(spec, this.constructor.name);\n }\n\n /** The host, typed to the transport whose `Plugin` base this class extends. */\n protected get core(): TCore {\n // justified: each transport binds TCore to the Core its own host satisfies\n return this.host as TCore;\n }\n\n /** The framework surface, available from `init()` onward. Throws if read before `attach` finalizes it. */\n protected get ctx(): PluginContext<NeedsOf<Opts>> {\n return readPluginContext<NeedsOf<Opts>>(this);\n }\n\n abstract init(): Promise<void>;\n\n /**\n * Runs in the startup Ready phase, after `init()`. The gateway client is logged in by this phase,\n * and the http host runs its server-bind and health tasks in the same phase.\n */\n ready?(): Promise<void>;\n\n /** Runs during teardown, only when `init()` resolved. */\n dispose?(): Promise<void>;\n\n /**\n * Rejects the plugin's constructor options with a reason. Throws a `SeedcordError` naming the\n * plugin class and the reason.\n *\n * @param reason - Why the options are invalid.\n */\n protected rejectOptions(reason: string): never {\n throw new SeedcordError(SeedcordErrorCode.PluginOptionsRejected, [this.constructor.name, reason]);\n }\n\n /** Override to reload plugin state on an HMR update. */\n public onHmr(_event: HmrUpdateEvent): Promise<void> {\n return Promise.resolve();\n }\n\n /**\n * Registers critical file patterns that should trigger a full restart when changed in Dev HMR.\n * @param patterns - Glob patterns relative to the project root\n */\n protected registerCriticalFiles(patterns: string[]): void {\n getDevChannel()?.send('seedcord:register-critical-files', { patterns });\n }\n}\n\n/** @internal */\nexport function resolvedLifecycleSpecOf(plugin: PluginLike): ResolvedPluginLifecycleSpec {\n return plugin[resolvedSpecSlot];\n}\n\nexport type { PluginContext, PluginCapabilityTypes } from './context';\nexport type { PluginLifecycleSpec } from './lifecycle';\nexport type { PluginOptions } from './options';\n\n// a bound of Plugin<{}> rejects every plugin that declares an option, since Plugin<A> and Plugin<B>\n// are mutually unassignable. every member here must stay Opts-independent.\n/** @internal */\nexport type PluginLike = Pick<\n Plugin,\n 'init' | 'ready' | 'dispose' | 'logger' | 'onHmr' | typeof resolvedSpecSlot | typeof pluginContextSlot\n>;\n\n// a `CoreBase` first parameter rejects a narrowing ctor on its own, and it also collapses\n// `InstanceType<Ctor>` to `PluginLike` at every attach call. CoreParamAssert checks it instead.\n/** @internal */\nexport type PluginCtor<TPlugin extends PluginLike = PluginLike> = new (...args: any[]) => TPlugin;\n\n/** @internal */\nexport type PluginArgs<Ctor extends PluginCtor> = Tail<ConstructorParameters<Ctor>>;\n\ntype CoreParamTooNarrow = Record<\n 'this plugin constructor must take CoreBase as its first parameter and read the transport Core off this.core',\n never\n>;\n\n// a narrowed first parameter fails `CoreBase extends Param`\n/** @internal */\nexport type CoreParamAssert<Ctor extends PluginCtor> = CoreBase extends ConstructorParameters<Ctor>[0]\n ? unknown\n : CoreParamTooNarrow;\n\nexport { finalizePluginContext } from './context';\n"],"mappings":";;;;;;;;AAqEA,MAAa,oBAAoB,OAAO,qBAAqB;;AAO7D,SAAgB,kBAA6C,QAA8C;CACvG,MAAM,MAAM,OAAO;CACnB,IAAI,CAAC,KAAK,MAAM,IAAI,cAAc,kBAAkB,yBAAyB,CAAC,OAAO,YAAY,IAAI,CAAC;CAEtG,OAAO;AACX;;AAGA,SAAgB,sBACZ,QACA,KACI;CACJ,OAAO,qBAAqB;AAChC;;;;ACnEA,MAAM,0BAA0B;AAChC,MAAM,2BAA2B;AACjC,MAAM,6BAA6B;AAEnC,SAAS,UACL,OACA,UACA,UACA,YACM;CACN,IAAI,aAAa,QAAW,OAAO;CACnC,IAAI,CAAC,OAAO,SAAS,QAAQ,KAAK,YAAY,GAC1C,MAAM,IAAI,cAAc,kBAAkB,uBAAuB,CAC7D,YACA,aAAa,MAAM,mDACvB,CAAC;CAEL,OAAO;AACX;;AAGA,SAAgB,qBACZ,MACA,YAC2B;CAC3B,OAAO;EACH,MAAM;GACF,OAAO,MAAM,MAAM;GACnB,SAAS,UAAU,QAAQ,MAAM,MAAM,SAAS,yBAAyB,UAAU;EACvF;EACA,OAAO,EACH,SAAS,UAAU,SAAS,MAAM,OAAO,SAAS,0BAA0B,UAAU,EAC1F;EACA,SAAS;GACL,OAAO,MAAM,SAAS;GACtB,SAAS,UAAU,WAAW,MAAM,SAAS,SAAS,4BAA4B,UAAU;EAChG;CACJ;AACJ;;;;;ACxCA,MAAM,mBAAmB,OAAO,sBAAsB;;;;;;;;AAStD,IAAsB,SAAtB,MAEA;CAgByB;;CATrB,CAAU;;CAEV,CAAC;;CAGD,AAAgB;CAGhB,YACI,AAAiB,MACjB,MACF;EAFmB;EAGjB,KAAK,SAAS,IAAI,OAAO,KAAK,YAAY,IAAI;EAC9C,KAAK,oBAAoB,qBAAqB,MAAM,KAAK,YAAY,IAAI;CAC7E;;CAGA,IAAc,OAAc;EAExB,OAAO,KAAK;CAChB;;CAGA,IAAc,MAAoC;EAC9C,OAAO,kBAAiC,IAAI;CAChD;;;;;;;CAmBA,AAAU,cAAc,QAAuB;EAC3C,MAAM,IAAI,cAAc,kBAAkB,uBAAuB,CAAC,KAAK,YAAY,MAAM,MAAM,CAAC;CACpG;;CAGA,AAAO,MAAM,QAAuC;EAChD,OAAO,QAAQ,QAAQ;CAC3B;;;;;CAMA,AAAU,sBAAsB,UAA0B;EACtD,cAAc,CAAC,EAAE,KAAK,oCAAoC,EAAE,SAAS,CAAC;CAC1E;AACJ;;AAGA,SAAgB,wBAAwB,QAAiD;CACrF,OAAO,OAAO;AAClB"}
@@ -1,3 +1,4 @@
1
+ const require_publishDefault = require('./publishDefault-l0NQ-SHo.cjs');
1
2
  require("reflect-metadata");
2
3
  let _seedcord_errors = require("@seedcord/errors");
3
4
  let _seedcord_errors_internal = require("@seedcord/errors/internal");
@@ -5,43 +6,6 @@ let discord_api_types_v10 = require("discord-api-types/v10");
5
6
  let _discordjs_builders = require("@discordjs/builders");
6
7
  let _seedcord_utils = require("@seedcord/utils");
7
8
 
8
- //#region src/metadataKeys.ts
9
- let InteractionRoutes = /* @__PURE__ */ function(InteractionRoutes) {
10
- InteractionRoutes["Slash"] = "slash";
11
- InteractionRoutes["Button"] = "button";
12
- InteractionRoutes["Modal"] = "modal";
13
- InteractionRoutes["StringMenu"] = "stringMenu";
14
- InteractionRoutes["UserMenu"] = "userMenu";
15
- InteractionRoutes["RoleMenu"] = "roleMenu";
16
- InteractionRoutes["ChannelMenu"] = "channelMenu";
17
- InteractionRoutes["MentionableMenu"] = "mentionableMenu";
18
- InteractionRoutes["MessageContextMenu"] = "messageContextMenu";
19
- InteractionRoutes["UserContextMenu"] = "userContextMenu";
20
- InteractionRoutes["Autocomplete"] = "autocomplete";
21
- return InteractionRoutes;
22
- }({});
23
- const InteractionMetadataKey = Symbol("seedcord:interaction:metadata");
24
- const InteractionRouteKeys = {
25
- ["slash"]: Symbol("seedcord:interaction:slash"),
26
- ["button"]: Symbol("seedcord:interaction:button"),
27
- ["modal"]: Symbol("seedcord:interaction:modal"),
28
- ["stringMenu"]: Symbol("seedcord:interaction:stringMenu"),
29
- ["userMenu"]: Symbol("seedcord:interaction:userMenu"),
30
- ["roleMenu"]: Symbol("seedcord:interaction:roleMenu"),
31
- ["channelMenu"]: Symbol("seedcord:interaction:channelMenu"),
32
- ["mentionableMenu"]: Symbol("seedcord:interaction:mentionableMenu"),
33
- ["messageContextMenu"]: Symbol("seedcord:interaction:messageContextMenu"),
34
- ["userContextMenu"]: Symbol("seedcord:interaction:userContextMenu"),
35
- ["autocomplete"]: Symbol("seedcord:interaction:autocomplete")
36
- };
37
- const MiddlewareMetadataKey = Symbol("seedcord:middleware:metadata");
38
- const EventMetadataKey = Symbol("seedcord:event:metadata");
39
- const CommandMetadataKey = Symbol("seedcord:command:metadata");
40
- const GatedMetadataKey = Symbol("seedcord:gated:metadata");
41
- const SubscribeMetadataKey = Symbol("seedcord:subscribe:metadata");
42
- const WebhookUrlMetadataKey = Symbol("seedcord:webhookUrl:metadata");
43
-
44
- //#endregion
45
9
  //#region src/stops/Notice.ts
46
10
  /**
47
11
  * Base class for a user-facing refusal or a reported fault.
@@ -107,209 +71,13 @@ var Notice = class extends Error {
107
71
  }
108
72
  };
109
73
 
110
- //#endregion
111
- //#region src/components/botColorHolder.ts
112
- const DEFAULT_COLOR = "Default";
113
- let current = DEFAULT_COLOR;
114
- function setBotColor(color) {
115
- current = color ?? DEFAULT_COLOR;
116
- }
117
- function getBotColor() {
118
- return current;
119
- }
120
-
121
- //#endregion
122
- //#region src/components/builderTypes.ts
123
- /**
124
- * Available Discord.js builder classes for use with BuilderComponent for commands, embeds, modals, etc.
125
- *
126
- * @internal
127
- */
128
- const BuilderTypes = {
129
- command: _discordjs_builders.SlashCommandBuilder,
130
- context_menu: _discordjs_builders.ContextMenuCommandBuilder,
131
- subcommand: _discordjs_builders.SlashCommandSubcommandBuilder,
132
- group: _discordjs_builders.SlashCommandSubcommandGroupBuilder,
133
- embed: _discordjs_builders.EmbedBuilder,
134
- modal: _discordjs_builders.ModalBuilder,
135
- label: _discordjs_builders.LabelBuilder,
136
- text_input: _discordjs_builders.TextInputBuilder,
137
- file_upload: _discordjs_builders.FileUploadBuilder,
138
- checkbox: _discordjs_builders.CheckboxBuilder,
139
- checkbox_group: _discordjs_builders.CheckboxGroupBuilder,
140
- checkbox_group_option: _discordjs_builders.CheckboxGroupOptionBuilder,
141
- radio_group: _discordjs_builders.RadioGroupBuilder,
142
- radio_group_option: _discordjs_builders.RadioGroupOptionBuilder,
143
- button: _discordjs_builders.ButtonBuilder,
144
- menu_string: _discordjs_builders.StringSelectMenuBuilder,
145
- menu_option_string: _discordjs_builders.StringSelectMenuOptionBuilder,
146
- menu_user: _discordjs_builders.UserSelectMenuBuilder,
147
- menu_channel: _discordjs_builders.ChannelSelectMenuBuilder,
148
- menu_mentionable: _discordjs_builders.MentionableSelectMenuBuilder,
149
- menu_role: _discordjs_builders.RoleSelectMenuBuilder,
150
- container: _discordjs_builders.ContainerBuilder,
151
- text_display: _discordjs_builders.TextDisplayBuilder,
152
- file: _discordjs_builders.FileBuilder,
153
- media: _discordjs_builders.MediaGalleryBuilder,
154
- section: _discordjs_builders.SectionBuilder,
155
- separator: _discordjs_builders.SeparatorBuilder
156
- };
157
- /**
158
- * Available Discord.js action row classes for use with RowComponent for Select Menus and Buttons
159
- *
160
- * @internal
161
- */
162
- const RowTypes = {
163
- button: _discordjs_builders.ActionRowBuilder,
164
- menu_string: _discordjs_builders.ActionRowBuilder,
165
- menu_user: _discordjs_builders.ActionRowBuilder,
166
- menu_channel: _discordjs_builders.ActionRowBuilder,
167
- menu_mentionable: _discordjs_builders.ActionRowBuilder,
168
- menu_role: _discordjs_builders.ActionRowBuilder
169
- };
170
-
171
- //#endregion
172
- //#region src/components/colors.ts
173
- const Colors = {
174
- Aqua: 1752220,
175
- Blue: 3447003,
176
- Blurple: 5793266,
177
- DarkAqua: 1146986,
178
- DarkBlue: 2123412,
179
- DarkButNotBlack: 2895667,
180
- DarkerGrey: 8359053,
181
- DarkGold: 12745742,
182
- DarkGreen: 2067276,
183
- DarkGrey: 9936031,
184
- DarkNavy: 2899536,
185
- DarkOrange: 11027200,
186
- DarkPurple: 7419530,
187
- DarkRed: 10038562,
188
- DarkVividPink: 11342935,
189
- Default: 0,
190
- Fuchsia: 15418782,
191
- Gold: 15844367,
192
- Green: 5763719,
193
- Grey: 9807270,
194
- Greyple: 10070709,
195
- LightGrey: 12370112,
196
- LuminousVividPink: 15277667,
197
- Navy: 3426654,
198
- NotQuiteBlack: 2303786,
199
- Orange: 15105570,
200
- Purple: 10181046,
201
- Red: 15548997,
202
- White: 16777215,
203
- Yellow: 16705372
204
- };
205
-
206
- //#endregion
207
- //#region src/components/resolveColor.ts
208
- const MAX_COLOR = 16777215;
209
- const RED_SHIFT = 16;
210
- const GREEN_SHIFT = 8;
211
- const palette = Colors;
212
- /**
213
- * Resolves a {@link BotColor} to the integer Discord expects.
214
- *
215
- * Ported from discord.js (Apache-2.0), `resolveColor` in src/util/Util.js.
216
- */
217
- function resolveColor(color) {
218
- let resolved;
219
- if (typeof color === "string") {
220
- if (color === "Random") return Math.floor(Math.random() * 16777216);
221
- if (color === "Default") return 0;
222
- if (/^#?[\da-f]{6}$/i.test(color)) return Number.parseInt(color.replace("#", ""), 16);
223
- resolved = palette[color];
224
- } else if (typeof color === "number") resolved = color;
225
- else resolved = (color[0] << RED_SHIFT) + (color[1] << GREEN_SHIFT) + color[2];
226
- if (resolved === void 0 || !Number.isSafeInteger(resolved)) throw new _seedcord_errors_internal.SeedcordTypeError(_seedcord_errors.SeedcordErrorCode.ColorUnresolvable, [JSON.stringify(color)]);
227
- if (resolved < 0 || resolved > MAX_COLOR) throw new _seedcord_errors_internal.SeedcordRangeError(_seedcord_errors.SeedcordErrorCode.ColorOutOfRange);
228
- return resolved;
229
- }
230
-
231
- //#endregion
232
- //#region src/components/Component.ts
233
- /**
234
- * Base class for Discord component wrappers.
235
- *
236
- * @typeParam TComponent - The Discord.js component type being wrapped
237
- *
238
- * @internal
239
- */
240
- var BaseComponent = class {
241
- _component;
242
- constructor(ComponentClass) {
243
- this._component = new ComponentClass();
244
- }
245
- /**
246
- * The wrapped builder, for calling Discord.js methods like setTitle() and setDescription() inside a subclass.
247
- *
248
- * @example this.instance.setTitle('My Modal')
249
- */
250
- get instance() {
251
- return this._component;
252
- }
253
- };
254
- /**
255
- * Base class for Discord.js builder components
256
- *
257
- * Wraps Discord.js builders (SlashCommandBuilder, EmbedBuilder, etc.) with
258
- * Seedcord-specific defaults and helper methods.
259
- *
260
- * @typeParam BuilderKey - The type of Discord.js builder being wrapped
261
- */
262
- var BuilderComponent = class extends BaseComponent {
263
- type;
264
- colorApplied = false;
265
- constructor(type) {
266
- const ComponentClass = BuilderTypes[type];
267
- super(ComponentClass);
268
- this.type = type;
269
- if (this.instance instanceof _discordjs_builders.SlashCommandBuilder || this.instance instanceof _discordjs_builders.ContextMenuCommandBuilder) this.instance.setContexts(discord_api_types_v10.InteractionContextType.Guild);
270
- }
271
- get component() {
272
- this.applyBotColor();
273
- return this.instance;
274
- }
275
- applyBotColor() {
276
- if (this.colorApplied) return;
277
- this.colorApplied = true;
278
- const color = getBotColor();
279
- if (this.instance instanceof _discordjs_builders.EmbedBuilder) {
280
- if (this.instance.data.color === void 0) this.instance.setColor(resolveColor(color));
281
- } else if (this.instance instanceof _discordjs_builders.ContainerBuilder) {
282
- const accent = this.instance.data.accent_color;
283
- if (accent === null || accent === void 0) this.instance.setAccentColor(color === "Default" ? void 0 : resolveColor(color));
284
- }
285
- }
286
- };
287
- /**
288
- * Base class for Discord action row components
289
- *
290
- * Wraps Discord.js action row builder with Seedcord-specific defaults and helper methods.
291
- *
292
- * @typeParam RowKey - The Discord.js action row type being wrapped
293
- */
294
- var RowComponent = class extends BaseComponent {
295
- type;
296
- constructor(type) {
297
- const ComponentClass = RowTypes[type];
298
- super(ComponentClass);
299
- this.type = type;
300
- }
301
- get component() {
302
- return this.instance;
303
- }
304
- };
305
-
306
74
  //#endregion
307
75
  //#region src/stops/NoticeCard.ts
308
76
  /**
309
77
  * Built fresh inside a {@link Notice}'s `render` to back its ComponentsV2 reply. The title renders as
310
78
  * an h3 line with the description on the next line.
311
79
  */
312
- var NoticeCard = class extends BuilderComponent {
80
+ var NoticeCard = class extends require_publishDefault.BuilderComponent {
313
81
  constructor(description, title = "Cannot Proceed") {
314
82
  super("container");
315
83
  this.instance.addTextDisplayComponents(new _discordjs_builders.TextDisplayBuilder().setContent(`### ${title}\n${description}`));
@@ -772,19 +540,19 @@ function areRoutes(routes) {
772
540
  */
773
541
  function interactionRoutesOf(constructor) {
774
542
  const pairs = [];
775
- for (const route of Object.values(InteractionRoutes)) {
776
- const meta = Reflect.getMetadata(InteractionRouteKeys[route], constructor);
543
+ for (const route of Object.values(require_publishDefault.InteractionRoutes)) {
544
+ const meta = Reflect.getMetadata(require_publishDefault.InteractionRouteKeys[route], constructor);
777
545
  if (areRoutes(meta)) pairs.push([route, meta]);
778
546
  }
779
547
  return pairs;
780
548
  }
781
549
  function storeInteractionRoute(route, routes, constructor) {
782
- const key = InteractionRouteKeys[route];
550
+ const key = require_publishDefault.InteractionRouteKeys[route];
783
551
  const saved = Reflect.getMetadata(key, constructor);
784
552
  const existing = areRoutes(saved) ? saved : [];
785
553
  const toStore = typeof routes === "string" ? [routes] : routes;
786
554
  Reflect.defineMetadata(key, [...existing, ...toStore], constructor);
787
- Reflect.defineMetadata(InteractionMetadataKey, true, constructor);
555
+ Reflect.defineMetadata(require_publishDefault.InteractionMetadataKey, true, constructor);
788
556
  }
789
557
  function storeComponentRoute(route, defs, constructor) {
790
558
  storeInteractionRoute(route, defs.map((def) => def.prefix), constructor);
@@ -1067,18 +835,35 @@ function RequireRole(roleId, options) {
1067
835
  }
1068
836
 
1069
837
  //#endregion
1070
- Object.defineProperty(exports, 'BuilderComponent', {
1071
- enumerable: true,
1072
- get: function () {
1073
- return BuilderComponent;
1074
- }
1075
- });
1076
- Object.defineProperty(exports, 'CommandMetadataKey', {
1077
- enumerable: true,
1078
- get: function () {
1079
- return CommandMetadataKey;
1080
- }
1081
- });
838
+ //#region src/stops/Silence.ts
839
+ /**
840
+ * Throw to stop a handler with no reply and no report.
841
+ *
842
+ * The framework boundary catches `Silence` before {@link Notice}, makes zero Discord calls, and stops.
843
+ * Ideally you'd only throw this in `EventHandlers` (or `Gates` for those), because it doesn't make sense to
844
+ * leave the user with no reply for an interaction.
845
+ *
846
+ * @example
847
+ * ```ts
848
+ * import { Silence } from '@seedcord/gateway';
849
+ *
850
+ * // before any reply or defer, drop the interaction with no reply and no report
851
+ * if (await isBlacklisted(interaction.user.id)) throw new Silence('blacklisted user');
852
+ * ```
853
+ */
854
+ var Silence = class extends Error {
855
+ reason;
856
+ /**
857
+ * @param reason - Optional note written only to a debug log, never shown to the user or reported.
858
+ */
859
+ constructor(reason) {
860
+ super(reason ?? "Silence");
861
+ this.reason = reason;
862
+ Error.captureStackTrace(this, this.constructor);
863
+ }
864
+ };
865
+
866
+ //#endregion
1082
867
  Object.defineProperty(exports, 'ComponentDefsKey', {
1083
868
  enumerable: true,
1084
869
  get: function () {
@@ -1091,48 +876,12 @@ Object.defineProperty(exports, 'CustomId', {
1091
876
  return CustomId;
1092
877
  }
1093
878
  });
1094
- Object.defineProperty(exports, 'EventMetadataKey', {
1095
- enumerable: true,
1096
- get: function () {
1097
- return EventMetadataKey;
1098
- }
1099
- });
1100
879
  Object.defineProperty(exports, 'GateNotice', {
1101
880
  enumerable: true,
1102
881
  get: function () {
1103
882
  return GateNotice;
1104
883
  }
1105
884
  });
1106
- Object.defineProperty(exports, 'GatedMetadataKey', {
1107
- enumerable: true,
1108
- get: function () {
1109
- return GatedMetadataKey;
1110
- }
1111
- });
1112
- Object.defineProperty(exports, 'InteractionMetadataKey', {
1113
- enumerable: true,
1114
- get: function () {
1115
- return InteractionMetadataKey;
1116
- }
1117
- });
1118
- Object.defineProperty(exports, 'InteractionRouteKeys', {
1119
- enumerable: true,
1120
- get: function () {
1121
- return InteractionRouteKeys;
1122
- }
1123
- });
1124
- Object.defineProperty(exports, 'InteractionRoutes', {
1125
- enumerable: true,
1126
- get: function () {
1127
- return InteractionRoutes;
1128
- }
1129
- });
1130
- Object.defineProperty(exports, 'MiddlewareMetadataKey', {
1131
- enumerable: true,
1132
- get: function () {
1133
- return MiddlewareMetadataKey;
1134
- }
1135
- });
1136
885
  Object.defineProperty(exports, 'MissingPermissions', {
1137
886
  enumerable: true,
1138
887
  get: function () {
@@ -1217,28 +966,16 @@ Object.defineProperty(exports, 'RequireRole', {
1217
966
  return RequireRole;
1218
967
  }
1219
968
  });
1220
- Object.defineProperty(exports, 'RowComponent', {
1221
- enumerable: true,
1222
- get: function () {
1223
- return RowComponent;
1224
- }
1225
- });
1226
969
  Object.defineProperty(exports, 'SelectMenuKind', {
1227
970
  enumerable: true,
1228
971
  get: function () {
1229
972
  return SelectMenuKind;
1230
973
  }
1231
974
  });
1232
- Object.defineProperty(exports, 'SubscribeMetadataKey', {
1233
- enumerable: true,
1234
- get: function () {
1235
- return SubscribeMetadataKey;
1236
- }
1237
- });
1238
- Object.defineProperty(exports, 'WebhookUrlMetadataKey', {
975
+ Object.defineProperty(exports, 'Silence', {
1239
976
  enumerable: true,
1240
977
  get: function () {
1241
- return WebhookUrlMetadataKey;
978
+ return Silence;
1242
979
  }
1243
980
  });
1244
981
  Object.defineProperty(exports, 'areRoutes', {
@@ -1331,12 +1068,6 @@ Object.defineProperty(exports, 'selectMenuRouteOf', {
1331
1068
  return selectMenuRouteOf;
1332
1069
  }
1333
1070
  });
1334
- Object.defineProperty(exports, 'setBotColor', {
1335
- enumerable: true,
1336
- get: function () {
1337
- return setBotColor;
1338
- }
1339
- });
1340
1071
  Object.defineProperty(exports, 'storeComponentRoute', {
1341
1072
  enumerable: true,
1342
1073
  get: function () {
@@ -1349,4 +1080,4 @@ Object.defineProperty(exports, 'storeInteractionRoute', {
1349
1080
  return storeInteractionRoute;
1350
1081
  }
1351
1082
  });
1352
- //# sourceMappingURL=permissions-DSW_EZfN.cjs.map
1083
+ //# sourceMappingURL=Silence-DiP95iwD.cjs.map