@theholocron/holocron-plugin-discord 5.0.0-alpha.245 → 5.0.0-alpha.247

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/dist/index.d.mts CHANGED
@@ -1,11 +1,8 @@
1
1
  import { AuthError, EnsureWebhookResult, EnsuredResource, Notifications, NotificationsAccess, NotificationsApplicationLayout, NotificationsDelivery, NotificationsEveryoneLayout, NotificationsLayout, NotificationsMember, NotificationsOnboardingLayout, NotificationsPinnedLayout, NotificationsServerLayout, NotificationsSignIn, NotificationsWelcomeLayout, ResolveTokenInput, ServerInspection, VerifyTokenFailure, VerifyTokenResult, VerifyTokenResult as VerifyTokenResult$1, VerifyTokenSuccess } from "@theholocron/cli";
2
2
  import { DiscordBotClient, DiscordClient, DiscordClientOptions, DiscordOAuthClient, DiscordWebhookInfo, createDiscordClient, parseWebhookUrl } from "@theholocron/discord-client";
3
- //#region src/auth.d.ts
4
- declare const resolveToken: (input?: ResolveTokenInput) => string;
5
- declare const resolveBotToken: (input?: ResolveTokenInput) => string;
6
- declare const resolveClientSecret: (input?: ResolveTokenInput) => string;
7
- //#endregion
8
- //#region src/capabilities/notifications.d.ts
3
+ export declare const resolveToken: (input?: ResolveTokenInput) => string;
4
+ export declare const resolveBotToken: (input?: ResolveTokenInput) => string;
5
+ export declare const resolveClientSecret: (input?: ResolveTokenInput) => string;
9
6
  interface DiscordNotificationsOptions {
10
7
  /**
11
8
  * Named aliases mapping a logical channel name to its webhook URL.
@@ -25,7 +22,7 @@ interface DiscordNotificationsOptions {
25
22
  baseUrl?: string;
26
23
  unsafeBotBaseUrl?: boolean;
27
24
  }
28
- declare class DiscordNotifications implements Notifications {
25
+ export declare class DiscordNotifications implements Notifications {
29
26
  private readonly client;
30
27
  private readonly opts;
31
28
  /** Memoized thunk — resolves the default webhook URL on the first `send()`. */
@@ -248,16 +245,12 @@ declare class DiscordNotifications implements Notifications {
248
245
  }): Promise<EnsuredResource>;
249
246
  private resolve;
250
247
  }
251
- //#endregion
252
- //#region src/verify-token.d.ts
253
248
  interface VerifyTokenOptions {
254
249
  baseUrl?: string;
255
250
  fetch?: typeof fetch;
256
251
  }
257
- declare function verifyToken(webhookUrl: string, opts?: VerifyTokenOptions): Promise<VerifyTokenResult$1>;
258
- //#endregion
259
- //#region src/index.d.ts
260
- interface DiscordPluginOptions extends ResolveTokenInput, DiscordNotificationsOptions {
252
+ export declare function verifyToken(webhookUrl: string, opts?: VerifyTokenOptions): Promise<VerifyTokenResult$1>;
253
+ export interface DiscordPluginOptions extends ResolveTokenInput, DiscordNotificationsOptions {
261
254
  /** Override base URL for tests. Default: https://discord.com/api/v10 */
262
255
  baseUrl?: string;
263
256
  fetch?: typeof fetch;
@@ -268,7 +261,7 @@ interface DiscordPluginOptions extends ResolveTokenInput, DiscordNotificationsOp
268
261
  */
269
262
  unsafeBotBaseUrl?: boolean;
270
263
  }
271
- interface PluginContext {
264
+ export interface PluginContext {
272
265
  options: DiscordPluginOptions;
273
266
  client: DiscordClient;
274
267
  /**
@@ -281,9 +274,9 @@ interface PluginContext {
281
274
  /** Builds the OAuth client for one redirect URI; resolves the application id and the client secret on first use. */
282
275
  oauth: (redirectUri: string) => Promise<DiscordOAuthClient>;
283
276
  }
284
- declare function createContext(options?: DiscordPluginOptions): PluginContext;
285
- declare function notifications(ctx: PluginContext): Notifications;
286
- declare function createPlugin(options?: DiscordPluginOptions): {
277
+ export declare function createContext(options?: DiscordPluginOptions): PluginContext;
278
+ export declare function notifications(ctx: PluginContext): Notifications;
279
+ export declare function createPlugin(options?: DiscordPluginOptions): {
287
280
  name: string;
288
281
  probes: {
289
282
  connection: import("@theholocron/cli").Probe;
@@ -292,6 +285,5 @@ declare function createPlugin(options?: DiscordPluginOptions): {
292
285
  notifications: () => Notifications;
293
286
  };
294
287
  };
295
- declare const AUTH_HINT: string;
296
- //#endregion
297
- export { AUTH_HINT, AuthError, type DiscordClient, type DiscordClientOptions, DiscordNotifications, type DiscordNotificationsOptions, DiscordPluginOptions, type DiscordWebhookInfo, PluginContext, type ResolveTokenInput, type VerifyTokenFailure, type VerifyTokenResult, type VerifyTokenSuccess, createContext, createDiscordClient, createPlugin, notifications, parseWebhookUrl, resolveBotToken, resolveClientSecret, resolveToken, verifyToken };
288
+ export declare const AUTH_HINT: string;
289
+ export { AuthError, type DiscordClient, type DiscordClientOptions, type DiscordNotificationsOptions, type DiscordWebhookInfo, type ResolveTokenInput, type VerifyTokenFailure, type VerifyTokenResult, type VerifyTokenSuccess, createDiscordClient, parseWebhookUrl };
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { AuthError, ElevationRequiredError, ProviderApiError, connectionProbe, createResolveToken } from "@theholocron/cli";
2
2
  import { errorMessage } from "@theholocron/misc-utils";
3
3
  import { ApplicationFlag, ChannelType, createDiscordBotClient, createDiscordClient, createDiscordOAuthClient, findVerifiedConnection, parseWebhookUrl, permissionNames, permissions } from "@theholocron/discord-client";
4
- //#region src/auth.ts
4
+ // src/auth.ts
5
5
  const resolveToken = createResolveToken({
6
6
  envName: "HOLOCRON_DISCORD_WEBHOOK",
7
7
  vendorEnvName: "DISCORD_WEBHOOK_URL",
@@ -20,8 +20,7 @@ const resolveClientSecret = createResolveToken({
20
20
  keyringService: "discord.holonet.oauth",
21
21
  errorMessage: "no Discord client secret found. Set HOLOCRON_DISCORD_CLIENT_SECRET (or DISCORD_CLIENT_SECRET), or run: holocron auth set discord.holonet.oauth <secret> — it is the client secret from the developer portal (OAuth2 → Reset Secret), which the API cannot create or read."
22
22
  });
23
- //#endregion
24
- //#region src/capabilities/notifications.ts
23
+ // src/capabilities/notifications.ts
25
24
  /** Discord's numeric settings, by the names the layout uses. */
26
25
  const VERIFICATION = {
27
26
  none: 0,
@@ -1546,8 +1545,7 @@ var DiscordNotifications = class DiscordNotifications {
1546
1545
  return this.defaultWebhookUrl();
1547
1546
  }
1548
1547
  };
1549
- //#endregion
1550
- //#region src/verify-token.ts
1548
+ // src/verify-token.ts
1551
1549
  async function verifyToken(webhookUrl, opts = {}) {
1552
1550
  try {
1553
1551
  const { id, token } = parseWebhookUrl(webhookUrl);
@@ -1566,8 +1564,7 @@ async function verifyToken(webhookUrl, opts = {}) {
1566
1564
  };
1567
1565
  }
1568
1566
  }
1569
- //#endregion
1570
- //#region src/index.ts
1567
+ // src/index.ts
1571
1568
  function createContext(options = {}) {
1572
1569
  let url;
1573
1570
  let bot;
@@ -1629,5 +1626,4 @@ function createPlugin(options = {}) {
1629
1626
  };
1630
1627
  }
1631
1628
  const AUTH_HINT = "create a webhook in Discord: open your server → channel settings → Integrations → Webhooks → New Webhook, copy the webhook URL, then run: holocron auth set discord <https://discord.com/api/webhooks/...>";
1632
- //#endregion
1633
1629
  export { AUTH_HINT, AuthError, DiscordNotifications, createContext, createDiscordClient, createPlugin, notifications, parseWebhookUrl, resolveBotToken, resolveClientSecret, resolveToken, verifyToken };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/holocron-plugin-discord",
3
- "version": "5.0.0-alpha.245",
3
+ "version": "5.0.0-alpha.247",
4
4
  "description": "Holocron plugin for Discord. Implements the notifications capability via Discord incoming webhooks.",
5
5
  "keywords": [
6
6
  "discord",
@@ -38,22 +38,22 @@
38
38
  "@theholocron/tsdown-config": "^8.8.2",
39
39
  "@theholocron/vitest-config": "^8.8.2",
40
40
  "@types/node": "^26",
41
- "@vitest/coverage-v8": "^4.1.11",
41
+ "@vitest/coverage-v8": "^5.0.5",
42
42
  "@vitest/eslint-plugin": "^1.6.27",
43
43
  "chalk": "^6.0.0",
44
44
  "eslint": "^10.8.1",
45
45
  "eslint-plugin-n": "^18.3.0",
46
46
  "globals": "^17.11.0",
47
- "tsdown": "^0.22.14",
47
+ "tsdown": "^0.23.3",
48
48
  "tsx": "4.23.15",
49
49
  "typescript": "^5.9.3",
50
- "vitest": "^4.1.11",
51
- "@theholocron/cli": "5.0.0-alpha.245"
50
+ "vitest": "^5.0.5",
51
+ "@theholocron/cli": "5.0.0-alpha.247"
52
52
  },
53
53
  "peerDependencies": {
54
54
  "@theholocron/discord-client": "^1.50.0",
55
55
  "@theholocron/misc-utils": "^1.16.0",
56
- "@theholocron/cli": "5.0.0-alpha.245"
56
+ "@theholocron/cli": "5.0.0-alpha.247"
57
57
  },
58
58
  "engines": {
59
59
  "node": ">=22"