@seedcord/core 0.1.0-next.5 → 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 (66) hide show
  1. package/dist/{AutocompleteOptions-eB87SZ4a.d.mts → AutocompleteOptions-DLp_B8as.d.mts} +66 -124
  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-Cgp1a0uQ.cjs +123 -0
  8. package/dist/Plugin-Cgp1a0uQ.cjs.map +1 -0
  9. package/dist/Plugin-j9GYdroS.mjs +106 -0
  10. package/dist/Plugin-j9GYdroS.mjs.map +1 -0
  11. package/dist/{permissions-DQL5ViZn.cjs → Silence-DiP95iwD.cjs} +54 -305
  12. package/dist/Silence-DiP95iwD.cjs.map +1 -0
  13. package/dist/{permissions-SokZLJMj.mjs → Silence-dbC2slOB.mjs} +47 -238
  14. package/dist/Silence-dbC2slOB.mjs.map +1 -0
  15. package/dist/basic-D7bDlgSP.d.mts +10 -0
  16. package/dist/devChannel-CQU7hq7Q.mjs +14 -0
  17. package/dist/devChannel-CQU7hq7Q.mjs.map +1 -0
  18. package/dist/devChannel-CoCmAVDx.cjs +26 -0
  19. package/dist/devChannel-CoCmAVDx.cjs.map +1 -0
  20. package/dist/hmr.index.cjs +2 -164
  21. package/dist/hmr.index.mjs +2 -162
  22. package/dist/index-Dueqztyy.d.mts +142 -0
  23. package/dist/index.cjs +53 -72
  24. package/dist/index.cjs.map +1 -1
  25. package/dist/index.d.mts +7 -4
  26. package/dist/index.mjs +9 -35
  27. package/dist/index.mjs.map +1 -1
  28. package/dist/internal.index.cjs +267 -89
  29. package/dist/internal.index.cjs.map +1 -1
  30. package/dist/internal.index.d.mts +68 -3
  31. package/dist/internal.index.mjs +218 -48
  32. package/dist/internal.index.mjs.map +1 -1
  33. package/dist/node-internal.index.cjs +716 -0
  34. package/dist/node-internal.index.cjs.map +1 -0
  35. package/dist/node-internal.index.d.cts +1 -0
  36. package/dist/node-internal.index.d.mts +261 -0
  37. package/dist/node-internal.index.mjs +706 -0
  38. package/dist/node-internal.index.mjs.map +1 -0
  39. package/dist/phases-BfpAG6w3.mjs +31 -0
  40. package/dist/phases-BfpAG6w3.mjs.map +1 -0
  41. package/dist/phases-C_BGNyVo.cjs +43 -0
  42. package/dist/phases-C_BGNyVo.cjs.map +1 -0
  43. package/dist/plugin.index.cjs +4 -0
  44. package/dist/plugin.index.d.cts +1 -0
  45. package/dist/plugin.index.d.mts +3 -0
  46. package/dist/plugin.index.mjs +3 -0
  47. package/dist/publishDefault-CCf1azzW.mjs +264 -0
  48. package/dist/publishDefault-CCf1azzW.mjs.map +1 -0
  49. package/dist/publishDefault-l0NQ-SHo.cjs +353 -0
  50. package/dist/publishDefault-l0NQ-SHo.cjs.map +1 -0
  51. package/dist/subscribers-B1G6_LlK.cjs +517 -0
  52. package/dist/subscribers-B1G6_LlK.cjs.map +1 -0
  53. package/dist/subscribers-DYqFVP1X.mjs +480 -0
  54. package/dist/subscribers-DYqFVP1X.mjs.map +1 -0
  55. package/package.json +25 -13
  56. package/dist/hmr.index.cjs.map +0 -1
  57. package/dist/hmr.index.mjs.map +0 -1
  58. package/dist/is-never-Ddaba1Su.d.mts +0 -58
  59. package/dist/node.index.cjs +0 -521
  60. package/dist/node.index.cjs.map +0 -1
  61. package/dist/node.index.d.cts +0 -1
  62. package/dist/node.index.d.mts +0 -2391
  63. package/dist/node.index.mjs +0 -513
  64. package/dist/node.index.mjs.map +0 -1
  65. package/dist/permissions-DQL5ViZn.cjs.map +0 -1
  66. package/dist/permissions-SokZLJMj.mjs.map +0 -1
@@ -1,166 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_rolldown_runtime = require('./rolldown-runtime-C_NdSu1c.cjs');
3
- let _seedcord_utils = require("@seedcord/utils");
4
- let chalk = require("chalk");
5
- chalk = require_rolldown_runtime.__toESM(chalk, 1);
6
- let node_fs = require("node:fs");
7
- let node_path = require("node:path");
8
- let node_url = require("node:url");
2
+ const require_HmrModuleHandler = require('./HmrModuleHandler-CTBng7wV.cjs');
9
3
 
10
- //#region src/hmr/HmrModuleHandler.ts
11
- const displayName = (unit, fallback) => unit.name ?? fallback;
12
- /**
13
- * Reloads THandler and optional TMiddleware modules on HMR updates.
14
- *
15
- * Call `handle()` from your `HmrAware.onHmr()` for standard reload behavior, or write a fully custom `onHmr()` and skip this class.
16
- *
17
- * This is only useful during development.
18
- */
19
- var HmrModuleHandler = class {
20
- store;
21
- options;
22
- constructor(options) {
23
- this.options = {
24
- ...options,
25
- logger: options.logger.inChannel("hmr")
26
- };
27
- this.store = {
28
- fileToHandlers: /* @__PURE__ */ new Map(),
29
- fileToMiddlewares: /* @__PURE__ */ new Map(),
30
- handlerArtifacts: /* @__PURE__ */ new Map()
31
- };
32
- }
33
- /** Unloads or reloads the modules affected by an {@link HmrUpdateEvent}, scoped to the handler and middleware directories. */
34
- async handle(event) {
35
- const { file, affectedModules, type } = event;
36
- const { logger, handlersDir, middlewaresDir } = this.options;
37
- if (type === "delete" || type === "deleteDir") {
38
- this.unload(file);
39
- return;
40
- }
41
- if (type === "createDir") return;
42
- if (type === "update" && !(0, node_fs.existsSync)(file)) {
43
- if (this.isTracked(file)) {
44
- logger.info(`Received update for non-existent file: ${(0, _seedcord_utils.formatFilePath)(file)}, treating as delete`);
45
- this.unload(file);
46
- }
47
- return;
48
- }
49
- const rollbackEnabled = event.rollback ?? true;
50
- const filesToReload = affectedModules && affectedModules.length > 0 ? affectedModules : [file];
51
- const absHandlersDir = (0, node_path.resolve)(process.cwd(), handlersDir);
52
- const absMiddlewaresDir = middlewaresDir ? (0, node_path.resolve)(process.cwd(), middlewaresDir) : null;
53
- for (const fileToReload of filesToReload) {
54
- const isHandler = fileToReload.startsWith(absHandlersDir + node_path.sep);
55
- const isMiddleware = absMiddlewaresDir ? fileToReload.startsWith(absMiddlewaresDir + node_path.sep) : false;
56
- if (!isHandler && !isMiddleware) continue;
57
- await this.reloadWithRollback(fileToReload, rollbackEnabled);
58
- }
59
- }
60
- async reloadWithRollback(file, rollbackEnabled) {
61
- const { logger } = this.options;
62
- const snapshot = this.snapshotUnits(file);
63
- this.unload(file);
64
- if (await this.reloadFile(file)) return;
65
- this.unload(file);
66
- if (!rollbackEnabled) return;
67
- if (snapshot.handlers.length === 0 && snapshot.middlewares.length === 0) return;
68
- this.restoreUnits(file, snapshot);
69
- logger.warn(`${chalk.default.yellow.bold("Rolled back")} ${chalk.default.gray((0, _seedcord_utils.formatFilePath)(file))} to the last-good version`);
70
- }
71
- /** Links the handler to its source file so a later update can unload it. */
72
- trackHandler(file, handler) {
73
- let set = this.store.fileToHandlers.get(file);
74
- if (!set) {
75
- set = /* @__PURE__ */ new Set();
76
- this.store.fileToHandlers.set(file, set);
77
- }
78
- set.add(handler);
79
- if (this.options.getArtifacts) {
80
- const artifacts = this.options.getArtifacts(handler);
81
- this.store.handlerArtifacts.set(handler, artifacts);
82
- }
83
- }
84
- /** Links the middleware to its source file so a later update can unload it. */
85
- trackMiddleware(file, middleware) {
86
- let set = this.store.fileToMiddlewares.get(file);
87
- if (!set) {
88
- set = /* @__PURE__ */ new Set();
89
- this.store.fileToMiddlewares.set(file, set);
90
- }
91
- set.add(middleware);
92
- }
93
- isTracked(file) {
94
- return this.store.fileToHandlers.has(file) || this.store.fileToMiddlewares.has(file);
95
- }
96
- unload(file) {
97
- const { logger } = this.options;
98
- const handlers = this.store.fileToHandlers.get(file);
99
- if (handlers) {
100
- for (const handler of handlers) {
101
- const artifacts = this.store.handlerArtifacts.get(handler);
102
- this.options.unregisterHandler(handler, artifacts);
103
- this.store.handlerArtifacts.delete(handler);
104
- const name = displayName(handler, "Handler");
105
- logger.info(`${chalk.default.red.bold("Unloaded")} ${chalk.default.cyan.bold(name)} from ${chalk.default.gray((0, _seedcord_utils.formatFilePath)(file))}`);
106
- }
107
- this.store.fileToHandlers.delete(file);
108
- }
109
- const middlewares = this.store.fileToMiddlewares.get(file);
110
- if (middlewares) {
111
- for (const middleware of middlewares) {
112
- this.options.unregisterMiddleware?.(middleware);
113
- const name = displayName(middleware, "Middleware");
114
- logger.info(`${chalk.default.red.bold("Unloaded")} ${chalk.default.cyan.bold(name)} from ${chalk.default.gray((0, _seedcord_utils.formatFilePath)(file))}`);
115
- }
116
- this.store.fileToMiddlewares.delete(file);
117
- }
118
- }
119
- async reloadFile(file) {
120
- const { logger, isHandler, isMiddleware, registerHandler, registerMiddleware } = this.options;
121
- if (!(0, node_fs.existsSync)(file)) {
122
- logger.info(`File does not exist, skipping reload: ${(0, _seedcord_utils.formatFilePath)(file)}`);
123
- return false;
124
- }
125
- try {
126
- let fileUrl = (0, node_url.pathToFileURL)(file).href;
127
- if (process.env.VITEST === "true") fileUrl += `?update=${Date.now()}`;
128
- const imported = await import(fileUrl);
129
- for (const val of Object.values(imported)) if (isHandler(val)) {
130
- registerHandler(val, file);
131
- this.trackHandler(file, val);
132
- const name = displayName(val, "Handler");
133
- logger.info(`${chalk.default.blue.bold("Reloaded")} ${chalk.default.cyan.bold(name)} from ${chalk.default.gray((0, _seedcord_utils.formatFilePath)(file))}`);
134
- } else if (isMiddleware && registerMiddleware && isMiddleware(val)) {
135
- registerMiddleware(val, file);
136
- this.trackMiddleware(file, val);
137
- const name = displayName(val, "Middleware");
138
- logger.info(`${chalk.default.blue.bold("Reloaded")} ${chalk.default.cyan.bold(name)} from ${chalk.default.gray((0, _seedcord_utils.formatFilePath)(file))}`);
139
- }
140
- return true;
141
- } catch (error) {
142
- logger.error(`Failed to reload file: ${file}`, error);
143
- return false;
144
- }
145
- }
146
- snapshotUnits(file) {
147
- return {
148
- handlers: [...this.store.fileToHandlers.get(file) ?? []],
149
- middlewares: [...this.store.fileToMiddlewares.get(file) ?? []]
150
- };
151
- }
152
- restoreUnits(file, snapshot) {
153
- for (const handler of snapshot.handlers) {
154
- this.options.registerHandler(handler, file);
155
- this.trackHandler(file, handler);
156
- }
157
- if (this.options.registerMiddleware) for (const middleware of snapshot.middlewares) {
158
- this.options.registerMiddleware(middleware, file);
159
- this.trackMiddleware(file, middleware);
160
- }
161
- }
162
- };
163
-
164
- //#endregion
165
- exports.HmrModuleHandler = HmrModuleHandler;
166
- //# sourceMappingURL=hmr.index.cjs.map
4
+ exports.HmrModuleHandler = require_HmrModuleHandler.HmrModuleHandler;
@@ -1,163 +1,3 @@
1
- import { formatFilePath } from "@seedcord/utils";
2
- import chalk from "chalk";
3
- import { existsSync } from "node:fs";
4
- import { resolve, sep } from "node:path";
5
- import { pathToFileURL } from "node:url";
1
+ import { t as HmrModuleHandler } from "./HmrModuleHandler-3sNgKHdf.mjs";
6
2
 
7
- //#region src/hmr/HmrModuleHandler.ts
8
- const displayName = (unit, fallback) => unit.name ?? fallback;
9
- /**
10
- * Reloads THandler and optional TMiddleware modules on HMR updates.
11
- *
12
- * Call `handle()` from your `HmrAware.onHmr()` for standard reload behavior, or write a fully custom `onHmr()` and skip this class.
13
- *
14
- * This is only useful during development.
15
- */
16
- var HmrModuleHandler = class {
17
- store;
18
- options;
19
- constructor(options) {
20
- this.options = {
21
- ...options,
22
- logger: options.logger.inChannel("hmr")
23
- };
24
- this.store = {
25
- fileToHandlers: /* @__PURE__ */ new Map(),
26
- fileToMiddlewares: /* @__PURE__ */ new Map(),
27
- handlerArtifacts: /* @__PURE__ */ new Map()
28
- };
29
- }
30
- /** Unloads or reloads the modules affected by an {@link HmrUpdateEvent}, scoped to the handler and middleware directories. */
31
- async handle(event) {
32
- const { file, affectedModules, type } = event;
33
- const { logger, handlersDir, middlewaresDir } = this.options;
34
- if (type === "delete" || type === "deleteDir") {
35
- this.unload(file);
36
- return;
37
- }
38
- if (type === "createDir") return;
39
- if (type === "update" && !existsSync(file)) {
40
- if (this.isTracked(file)) {
41
- logger.info(`Received update for non-existent file: ${formatFilePath(file)}, treating as delete`);
42
- this.unload(file);
43
- }
44
- return;
45
- }
46
- const rollbackEnabled = event.rollback ?? true;
47
- const filesToReload = affectedModules && affectedModules.length > 0 ? affectedModules : [file];
48
- const absHandlersDir = resolve(process.cwd(), handlersDir);
49
- const absMiddlewaresDir = middlewaresDir ? resolve(process.cwd(), middlewaresDir) : null;
50
- for (const fileToReload of filesToReload) {
51
- const isHandler = fileToReload.startsWith(absHandlersDir + sep);
52
- const isMiddleware = absMiddlewaresDir ? fileToReload.startsWith(absMiddlewaresDir + sep) : false;
53
- if (!isHandler && !isMiddleware) continue;
54
- await this.reloadWithRollback(fileToReload, rollbackEnabled);
55
- }
56
- }
57
- async reloadWithRollback(file, rollbackEnabled) {
58
- const { logger } = this.options;
59
- const snapshot = this.snapshotUnits(file);
60
- this.unload(file);
61
- if (await this.reloadFile(file)) return;
62
- this.unload(file);
63
- if (!rollbackEnabled) return;
64
- if (snapshot.handlers.length === 0 && snapshot.middlewares.length === 0) return;
65
- this.restoreUnits(file, snapshot);
66
- logger.warn(`${chalk.yellow.bold("Rolled back")} ${chalk.gray(formatFilePath(file))} to the last-good version`);
67
- }
68
- /** Links the handler to its source file so a later update can unload it. */
69
- trackHandler(file, handler) {
70
- let set = this.store.fileToHandlers.get(file);
71
- if (!set) {
72
- set = /* @__PURE__ */ new Set();
73
- this.store.fileToHandlers.set(file, set);
74
- }
75
- set.add(handler);
76
- if (this.options.getArtifacts) {
77
- const artifacts = this.options.getArtifacts(handler);
78
- this.store.handlerArtifacts.set(handler, artifacts);
79
- }
80
- }
81
- /** Links the middleware to its source file so a later update can unload it. */
82
- trackMiddleware(file, middleware) {
83
- let set = this.store.fileToMiddlewares.get(file);
84
- if (!set) {
85
- set = /* @__PURE__ */ new Set();
86
- this.store.fileToMiddlewares.set(file, set);
87
- }
88
- set.add(middleware);
89
- }
90
- isTracked(file) {
91
- return this.store.fileToHandlers.has(file) || this.store.fileToMiddlewares.has(file);
92
- }
93
- unload(file) {
94
- const { logger } = this.options;
95
- const handlers = this.store.fileToHandlers.get(file);
96
- if (handlers) {
97
- for (const handler of handlers) {
98
- const artifacts = this.store.handlerArtifacts.get(handler);
99
- this.options.unregisterHandler(handler, artifacts);
100
- this.store.handlerArtifacts.delete(handler);
101
- const name = displayName(handler, "Handler");
102
- logger.info(`${chalk.red.bold("Unloaded")} ${chalk.cyan.bold(name)} from ${chalk.gray(formatFilePath(file))}`);
103
- }
104
- this.store.fileToHandlers.delete(file);
105
- }
106
- const middlewares = this.store.fileToMiddlewares.get(file);
107
- if (middlewares) {
108
- for (const middleware of middlewares) {
109
- this.options.unregisterMiddleware?.(middleware);
110
- const name = displayName(middleware, "Middleware");
111
- logger.info(`${chalk.red.bold("Unloaded")} ${chalk.cyan.bold(name)} from ${chalk.gray(formatFilePath(file))}`);
112
- }
113
- this.store.fileToMiddlewares.delete(file);
114
- }
115
- }
116
- async reloadFile(file) {
117
- const { logger, isHandler, isMiddleware, registerHandler, registerMiddleware } = this.options;
118
- if (!existsSync(file)) {
119
- logger.info(`File does not exist, skipping reload: ${formatFilePath(file)}`);
120
- return false;
121
- }
122
- try {
123
- let fileUrl = pathToFileURL(file).href;
124
- if (process.env.VITEST === "true") fileUrl += `?update=${Date.now()}`;
125
- const imported = await import(fileUrl);
126
- for (const val of Object.values(imported)) if (isHandler(val)) {
127
- registerHandler(val, file);
128
- this.trackHandler(file, val);
129
- const name = displayName(val, "Handler");
130
- logger.info(`${chalk.blue.bold("Reloaded")} ${chalk.cyan.bold(name)} from ${chalk.gray(formatFilePath(file))}`);
131
- } else if (isMiddleware && registerMiddleware && isMiddleware(val)) {
132
- registerMiddleware(val, file);
133
- this.trackMiddleware(file, val);
134
- const name = displayName(val, "Middleware");
135
- logger.info(`${chalk.blue.bold("Reloaded")} ${chalk.cyan.bold(name)} from ${chalk.gray(formatFilePath(file))}`);
136
- }
137
- return true;
138
- } catch (error) {
139
- logger.error(`Failed to reload file: ${file}`, error);
140
- return false;
141
- }
142
- }
143
- snapshotUnits(file) {
144
- return {
145
- handlers: [...this.store.fileToHandlers.get(file) ?? []],
146
- middlewares: [...this.store.fileToMiddlewares.get(file) ?? []]
147
- };
148
- }
149
- restoreUnits(file, snapshot) {
150
- for (const handler of snapshot.handlers) {
151
- this.options.registerHandler(handler, file);
152
- this.trackHandler(file, handler);
153
- }
154
- if (this.options.registerMiddleware) for (const middleware of snapshot.middlewares) {
155
- this.options.registerMiddleware(middleware, file);
156
- this.trackMiddleware(file, middleware);
157
- }
158
- }
159
- };
160
-
161
- //#endregion
162
- export { HmrModuleHandler };
163
- //# sourceMappingURL=hmr.index.mjs.map
3
+ export { HmrModuleHandler };
@@ -0,0 +1,142 @@
1
+ import { t as Constructor } from "./basic-D7bDlgSP.mjs";
2
+ import { C as Subscriber, O as SubscriptionKey, y as CoreBase } from "./Plugin-3rlH0uxH.mjs";
3
+ import { APIMessageTopLevelComponent } from "discord-api-types/v10";
4
+ import { EventFrequency } from "@seedcord/types";
5
+
6
+ //#region src/subscribers/decorators/Subscribe.d.ts
7
+ /**
8
+ * Options accepted by the `@Subscribe` decorator.
9
+ */
10
+ interface SubscribeOptions {
11
+ /**
12
+ * Frequency: `'once'` or `'on'`.
13
+ *
14
+ * @defaultValue `'on'`
15
+ */
16
+ readonly frequency?: EventFrequency | undefined;
17
+ }
18
+ /**
19
+ * Registers a subscriber handler class with a specific subscriber event.
20
+ *
21
+ * Associates the decorated class with a subscriber event type for automatic
22
+ * registration and execution when the subscriber is emitted.
23
+ *
24
+ * @typeParam TSubscriber - The subscriber event name to register for
25
+ * @param subscriber - The subscriber event name to register for
26
+ * @param options - Options to configure the subscriber handler registration.
27
+ * @decorator
28
+ * @example
29
+ * ```typescript
30
+ * \@Subscribe('userJoin')
31
+ * class WelcomeHandler extends Subscriber<'userJoin'> {
32
+ * async execute() {
33
+ * // Handle user join event
34
+ * }
35
+ * }
36
+ * ```
37
+ * @example
38
+ * ```ts
39
+ * \@Subscribe('userJoin', { frequency: 'once' })
40
+ * // or
41
+ * \@Subscribe('userJoin')
42
+ * ```
43
+ */
44
+ declare function Subscribe<TSubscriber extends SubscriptionKey>(subscriber: TSubscriber, options?: SubscribeOptions): <HandlerCtor extends Constructor<Subscriber<TSubscriber, CoreBase>>>(constructor: HandlerCtor) => void;
45
+ //#endregion
46
+ //#region src/subscribers/bases/WebhookSender.d.ts
47
+ /**
48
+ * A file attached to a webhook report.
49
+ */
50
+ interface WebhookFile {
51
+ name: string;
52
+ description: string;
53
+ /** A `Buffer` still satisfies this, it extends `Uint8Array`. */
54
+ data: Uint8Array | string;
55
+ }
56
+ /**
57
+ * The payload {@link WebhookSender.send} posts.
58
+ */
59
+ interface WebhookSendOptions {
60
+ flags: number;
61
+ username: string;
62
+ components: readonly {
63
+ toJSON(): APIMessageTopLevelComponent;
64
+ }[];
65
+ files?: readonly WebhookFile[] | undefined;
66
+ }
67
+ /**
68
+ * Sends component messages to a Discord webhook through `@discordjs/rest`.
69
+ *
70
+ * @throws A `SeedcordError` when the url does not carry a webhook id and token.
71
+ */
72
+ declare class WebhookSender {
73
+ private readonly rest;
74
+ private readonly route;
75
+ constructor(url: string);
76
+ /**
77
+ * Fetches the webhook object, sending no message. Returns `missing` on a 404 or 401 from
78
+ * Discord and `unreachable` on any other failure.
79
+ */
80
+ verify(): Promise<'ok' | 'missing' | 'unreachable'>;
81
+ send(options: WebhookSendOptions): Promise<void>;
82
+ }
83
+ //#endregion
84
+ //#region src/subscribers/bases/WebhookLog.d.ts
85
+ /**
86
+ * The content a reporter returns from {@link WebhookLog.report}.
87
+ */
88
+ interface WebhookReport {
89
+ /** Shown as the webhook message author. Defaults to the reporter's class name. */
90
+ username?: string;
91
+ components: readonly {
92
+ toJSON(): APIMessageTopLevelComponent;
93
+ }[];
94
+ files?: readonly WebhookFile[] | undefined;
95
+ }
96
+ /**
97
+ * Base class for subscribers that deliver their event to a Discord webhook.
98
+ *
99
+ * Declare the url's environment variable with `@WebhookUrl` and implement {@link report}. Url
100
+ * resolution, validation, sender reuse, and sending run in the base. When the variable is unset
101
+ * the reporter is skipped at registration with a boot warning.
102
+ *
103
+ * @typeParam KeyOfSubscribers - The subscription key this reporter receives
104
+ * @typeParam TCore - The transport's Core
105
+ */
106
+ declare abstract class WebhookLog<KeyOfSubscribers extends SubscriptionKey, TCore extends CoreBase> extends Subscriber<KeyOfSubscribers, TCore> {
107
+ private static readonly senders;
108
+ /** Builds the message for one published event. */
109
+ abstract report(): WebhookReport | Promise<WebhookReport>;
110
+ execute(): Promise<void>;
111
+ /** @internal */
112
+ static senderFor(url: string): WebhookSender;
113
+ /** @internal */
114
+ static envKeyOf(ctor: NewableFunction): string;
115
+ /** @internal Returns null when the env var is unset, throws when set but malformed. */
116
+ static urlOf(envKey: string): string | null;
117
+ }
118
+ //#endregion
119
+ //#region src/subscribers/decorators/WebhookUrl.d.ts
120
+ /**
121
+ * Declares the environment variable a {@link WebhookLog} reporter reads its webhook url from.
122
+ *
123
+ * An unset variable disables the reporter with a boot warning. A set but malformed value throws
124
+ * at boot.
125
+ *
126
+ * @param envKey - The environment variable name holding the webhook url
127
+ * @decorator
128
+ * @example
129
+ * ```ts
130
+ * \@Subscribe('memberBanned')
131
+ * \@WebhookUrl('BAN_LOG_WEBHOOK_URL')
132
+ * class BanLog extends WebhookLog<'memberBanned'> {
133
+ * report() {
134
+ * return { components: [new BanCard(this.data).component] };
135
+ * }
136
+ * }
137
+ * ```
138
+ */
139
+ declare function WebhookUrl(envKey: string): <HandlerCtor extends Constructor<WebhookLog<SubscriptionKey, CoreBase>>>(constructor: HandlerCtor) => void;
140
+ //#endregion
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