@theholocron/holocron-plugin-slack 3.63.0 → 3.65.0
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 +6 -2
- package/dist/index.mjs +3 -2
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -29,11 +29,14 @@ interface SlackNotificationsOptions {
|
|
|
29
29
|
defaultChannel?: string;
|
|
30
30
|
}
|
|
31
31
|
declare class SlackNotifications implements Notifications {
|
|
32
|
+
/** Memoized client thunk — resolves the token on first authenticated call. */
|
|
32
33
|
private readonly client;
|
|
33
34
|
private readonly opts;
|
|
34
35
|
readonly key: "notifications";
|
|
35
36
|
readonly providerName = "slack";
|
|
36
|
-
constructor(
|
|
37
|
+
constructor(
|
|
38
|
+
/** Memoized client thunk — resolves the token on first authenticated call. */
|
|
39
|
+
client: () => SlackClient, opts: SlackNotificationsOptions);
|
|
37
40
|
send(channel: string, message: string): Promise<void>;
|
|
38
41
|
}
|
|
39
42
|
//#endregion
|
|
@@ -61,7 +64,8 @@ interface SlackPluginOptions extends ResolveTokenInput, SlackNotificationsOption
|
|
|
61
64
|
}
|
|
62
65
|
interface PluginContext {
|
|
63
66
|
options: SlackPluginOptions;
|
|
64
|
-
client
|
|
67
|
+
/** Memoized client — the token is resolved on first use, not at plugin load. */
|
|
68
|
+
client: () => SlackClient;
|
|
65
69
|
}
|
|
66
70
|
declare function createContext(options?: SlackPluginOptions): PluginContext;
|
|
67
71
|
declare function notifications(ctx: PluginContext): Notifications;
|
package/dist/index.mjs
CHANGED
|
@@ -20,7 +20,7 @@ var SlackNotifications = class {
|
|
|
20
20
|
async send(channel, message) {
|
|
21
21
|
const ch = channel || this.opts.defaultChannel;
|
|
22
22
|
if (!ch) throw new Error("SlackNotifications.send: channel required (pass a channel id or set defaultChannel)");
|
|
23
|
-
await this.client.chat.postMessage(ch, message);
|
|
23
|
+
await this.client().chat.postMessage(ch, message);
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
26
|
//#endregion
|
|
@@ -75,9 +75,10 @@ async function verifyToken(token, opts = {}) {
|
|
|
75
75
|
//#endregion
|
|
76
76
|
//#region src/index.ts
|
|
77
77
|
function createContext(options = {}) {
|
|
78
|
+
let client;
|
|
78
79
|
return {
|
|
79
80
|
options,
|
|
80
|
-
client: createSlackClient({
|
|
81
|
+
client: () => client ??= createSlackClient({
|
|
81
82
|
token: resolveToken(options),
|
|
82
83
|
baseUrl: options.baseUrl,
|
|
83
84
|
fetch: options.fetch
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theholocron/holocron-plugin-slack",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.65.0",
|
|
4
4
|
"description": "Holocron plugin for Slack. Implements the notifications capability via Slack's bot API.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"holocron",
|
|
@@ -45,10 +45,10 @@
|
|
|
45
45
|
"tsx": "4.23.12",
|
|
46
46
|
"typescript": "^5.9.3",
|
|
47
47
|
"vitest": "^4.1.11",
|
|
48
|
-
"@theholocron/cli": "3.
|
|
48
|
+
"@theholocron/cli": "3.65.0"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"@theholocron/cli": "3.
|
|
51
|
+
"@theholocron/cli": "3.65.0"
|
|
52
52
|
},
|
|
53
53
|
"engines": {
|
|
54
54
|
"node": ">=22"
|