@maroonedsoftware/slack 1.8.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/LICENSE +21 -0
- package/README.md +280 -0
- package/dist/client/slack.client.d.ts +61 -0
- package/dist/client/slack.client.d.ts.map +1 -0
- package/dist/client/slack.logger.adapter.d.ts +21 -0
- package/dist/client/slack.logger.adapter.d.ts.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +363 -0
- package/dist/index.js.map +1 -0
- package/dist/slack.command.handler.d.ts +50 -0
- package/dist/slack.command.handler.d.ts.map +1 -0
- package/dist/slack.config.d.ts +31 -0
- package/dist/slack.config.d.ts.map +1 -0
- package/dist/slack.dispatcher.d.ts +124 -0
- package/dist/slack.dispatcher.d.ts.map +1 -0
- package/dist/slack.error.d.ts +18 -0
- package/dist/slack.error.d.ts.map +1 -0
- package/dist/slack.event.handler.d.ts +51 -0
- package/dist/slack.event.handler.d.ts.map +1 -0
- package/dist/slack.interaction.handler.d.ts +68 -0
- package/dist/slack.interaction.handler.d.ts.map +1 -0
- package/dist/slack.signature.d.ts +65 -0
- package/dist/slack.signature.d.ts.map +1 -0
- package/package.json +50 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
|
|
4
|
+
// src/slack.config.ts
|
|
5
|
+
import { Injectable } from "injectkit";
|
|
6
|
+
function _ts_decorate(decorators, target, key, desc) {
|
|
7
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
9
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
10
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11
|
+
}
|
|
12
|
+
__name(_ts_decorate, "_ts_decorate");
|
|
13
|
+
var SlackConfig = class {
|
|
14
|
+
static {
|
|
15
|
+
__name(this, "SlackConfig");
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
SlackConfig = _ts_decorate([
|
|
19
|
+
Injectable()
|
|
20
|
+
], SlackConfig);
|
|
21
|
+
|
|
22
|
+
// src/slack.error.ts
|
|
23
|
+
import { ServerkitError } from "@maroonedsoftware/errors";
|
|
24
|
+
var SlackError = class extends ServerkitError {
|
|
25
|
+
static {
|
|
26
|
+
__name(this, "SlackError");
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
var IsSlackError = /* @__PURE__ */ __name((error) => error instanceof SlackError, "IsSlackError");
|
|
30
|
+
|
|
31
|
+
// src/slack.signature.ts
|
|
32
|
+
import { createHmac, timingSafeEqual } from "crypto";
|
|
33
|
+
var SLACK_SIGNATURE_DEFAULT_MAX_AGE_SECONDS = 300;
|
|
34
|
+
var verifySlackSignature = /* @__PURE__ */ __name((input) => {
|
|
35
|
+
const { signingSecret, rawBody, timestamp, signature, maxAgeSeconds = SLACK_SIGNATURE_DEFAULT_MAX_AGE_SECONDS, now = Math.floor(Date.now() / 1e3) } = input;
|
|
36
|
+
if (!timestamp) {
|
|
37
|
+
throw new SlackError("Slack request missing X-Slack-Request-Timestamp header").withInternalDetails({
|
|
38
|
+
reason: "missing_timestamp"
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
const ts = Number(timestamp);
|
|
42
|
+
if (!Number.isFinite(ts) || !Number.isInteger(ts)) {
|
|
43
|
+
throw new SlackError("Slack request timestamp is not a valid integer").withInternalDetails({
|
|
44
|
+
reason: "invalid_timestamp",
|
|
45
|
+
timestamp
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
if (Math.abs(now - ts) > maxAgeSeconds) {
|
|
49
|
+
throw new SlackError("Slack request timestamp is outside the allowed window").withInternalDetails({
|
|
50
|
+
reason: "stale_timestamp",
|
|
51
|
+
timestamp: ts,
|
|
52
|
+
now,
|
|
53
|
+
maxAgeSeconds
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
if (!signature) {
|
|
57
|
+
throw new SlackError("Slack request missing X-Slack-Signature header").withInternalDetails({
|
|
58
|
+
reason: "missing_signature"
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
const expected = `v0=${createHmac("sha256", signingSecret).update(`v0:${ts}:${rawBody}`).digest("hex")}`;
|
|
62
|
+
const expectedBuf = Buffer.from(expected, "utf8");
|
|
63
|
+
const providedBuf = Buffer.from(signature, "utf8");
|
|
64
|
+
if (expectedBuf.length !== providedBuf.length || !timingSafeEqual(expectedBuf, providedBuf)) {
|
|
65
|
+
throw new SlackError("Slack request signature does not match").withInternalDetails({
|
|
66
|
+
reason: "invalid_signature"
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
}, "verifySlackSignature");
|
|
70
|
+
|
|
71
|
+
// src/slack.interaction.handler.ts
|
|
72
|
+
var interactionRouteKey = /* @__PURE__ */ __name((payload) => {
|
|
73
|
+
switch (payload.type) {
|
|
74
|
+
case "block_actions": {
|
|
75
|
+
const id = payload.actions?.[0]?.action_id;
|
|
76
|
+
return id ? `block_actions:${id}` : void 0;
|
|
77
|
+
}
|
|
78
|
+
case "view_submission":
|
|
79
|
+
case "view_closed": {
|
|
80
|
+
const id = payload.view?.callback_id;
|
|
81
|
+
return id ? `${payload.type}:${id}` : void 0;
|
|
82
|
+
}
|
|
83
|
+
case "shortcut":
|
|
84
|
+
case "message_action": {
|
|
85
|
+
return payload.callback_id ? `${payload.type}:${payload.callback_id}` : void 0;
|
|
86
|
+
}
|
|
87
|
+
default: {
|
|
88
|
+
return payload.callback_id ? `${payload.type}:${payload.callback_id}` : void 0;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}, "interactionRouteKey");
|
|
92
|
+
|
|
93
|
+
// src/slack.dispatcher.ts
|
|
94
|
+
import { Injectable as Injectable2 } from "injectkit";
|
|
95
|
+
import { Logger } from "@maroonedsoftware/logger";
|
|
96
|
+
function _ts_decorate2(decorators, target, key, desc) {
|
|
97
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
98
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
99
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
100
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
101
|
+
}
|
|
102
|
+
__name(_ts_decorate2, "_ts_decorate");
|
|
103
|
+
function _ts_metadata(k, v) {
|
|
104
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
105
|
+
}
|
|
106
|
+
__name(_ts_metadata, "_ts_metadata");
|
|
107
|
+
var SlackCommandHandlerMap = class extends Map {
|
|
108
|
+
static {
|
|
109
|
+
__name(this, "SlackCommandHandlerMap");
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
SlackCommandHandlerMap = _ts_decorate2([
|
|
113
|
+
Injectable2()
|
|
114
|
+
], SlackCommandHandlerMap);
|
|
115
|
+
var SlackEventHandlerMap = class extends Map {
|
|
116
|
+
static {
|
|
117
|
+
__name(this, "SlackEventHandlerMap");
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
SlackEventHandlerMap = _ts_decorate2([
|
|
121
|
+
Injectable2()
|
|
122
|
+
], SlackEventHandlerMap);
|
|
123
|
+
var SlackInteractionHandlerMap = class extends Map {
|
|
124
|
+
static {
|
|
125
|
+
__name(this, "SlackInteractionHandlerMap");
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
SlackInteractionHandlerMap = _ts_decorate2([
|
|
129
|
+
Injectable2()
|
|
130
|
+
], SlackInteractionHandlerMap);
|
|
131
|
+
var SlackDispatcher = class {
|
|
132
|
+
static {
|
|
133
|
+
__name(this, "SlackDispatcher");
|
|
134
|
+
}
|
|
135
|
+
events;
|
|
136
|
+
commands;
|
|
137
|
+
interactions;
|
|
138
|
+
logger;
|
|
139
|
+
constructor(events, commands, interactions, logger) {
|
|
140
|
+
this.events = events;
|
|
141
|
+
this.commands = commands;
|
|
142
|
+
this.interactions = interactions;
|
|
143
|
+
this.logger = logger;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Dispatch a parsed Events API body.
|
|
147
|
+
*
|
|
148
|
+
* - Returns `{ challenge }` for `url_verification` — the caller serializes
|
|
149
|
+
* it as the response body.
|
|
150
|
+
* - For `event_callback`, looks up a handler in {@link SlackEventHandlerMap}
|
|
151
|
+
* keyed by `event.type` and invokes it. Returns `undefined`. Slack retries
|
|
152
|
+
* any non-2xx so unknown event types are logged at debug and acked.
|
|
153
|
+
* - For any other top-level type, logs and returns `undefined`.
|
|
154
|
+
*/
|
|
155
|
+
async dispatchEvent(body) {
|
|
156
|
+
if (body.type === "url_verification") {
|
|
157
|
+
return {
|
|
158
|
+
challenge: body.challenge
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
if (body.type === "event_callback") {
|
|
162
|
+
const envelope = body;
|
|
163
|
+
const handler = this.events.get(envelope.event.type);
|
|
164
|
+
if (handler) {
|
|
165
|
+
await handler.handle(envelope.event, {
|
|
166
|
+
teamId: envelope.team_id,
|
|
167
|
+
eventId: envelope.event_id,
|
|
168
|
+
eventTime: envelope.event_time,
|
|
169
|
+
envelope
|
|
170
|
+
});
|
|
171
|
+
} else {
|
|
172
|
+
this.logger.debug("No Slack event handler registered for event type", {
|
|
173
|
+
type: envelope.event.type
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
return void 0;
|
|
177
|
+
}
|
|
178
|
+
this.logger.debug("Unhandled Slack events payload type", {
|
|
179
|
+
type: body.type
|
|
180
|
+
});
|
|
181
|
+
return void 0;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Dispatch a parsed slash-command payload.
|
|
185
|
+
*
|
|
186
|
+
* Looks up a handler in {@link SlackCommandHandlerMap} keyed by
|
|
187
|
+
* `payload.command` (e.g. `/deploy`). If the handler returns a response,
|
|
188
|
+
* the caller serializes it as JSON; otherwise the caller acks with `200 ''`
|
|
189
|
+
* and the handler is expected to follow up via `payload.response_url`.
|
|
190
|
+
*/
|
|
191
|
+
async dispatchCommand(payload) {
|
|
192
|
+
const handler = this.commands.get(payload.command);
|
|
193
|
+
if (!handler) {
|
|
194
|
+
this.logger.debug("No Slack command handler registered", {
|
|
195
|
+
command: payload.command
|
|
196
|
+
});
|
|
197
|
+
return void 0;
|
|
198
|
+
}
|
|
199
|
+
return await handler.handle(payload);
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Dispatch a parsed interactive payload (block actions, view submission,
|
|
203
|
+
* shortcut, etc.). Computes a routing key via {@link interactionRouteKey}
|
|
204
|
+
* and looks it up in {@link SlackInteractionHandlerMap}.
|
|
205
|
+
*/
|
|
206
|
+
async dispatchInteraction(payload) {
|
|
207
|
+
const key = interactionRouteKey(payload);
|
|
208
|
+
if (!key) {
|
|
209
|
+
this.logger.debug("Slack interaction payload missing routable identifier", {
|
|
210
|
+
type: payload.type
|
|
211
|
+
});
|
|
212
|
+
return void 0;
|
|
213
|
+
}
|
|
214
|
+
const handler = this.interactions.get(key);
|
|
215
|
+
if (!handler) {
|
|
216
|
+
this.logger.debug("No Slack interaction handler registered", {
|
|
217
|
+
key
|
|
218
|
+
});
|
|
219
|
+
return void 0;
|
|
220
|
+
}
|
|
221
|
+
return await handler.handle(payload);
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
SlackDispatcher = _ts_decorate2([
|
|
225
|
+
Injectable2(),
|
|
226
|
+
_ts_metadata("design:type", Function),
|
|
227
|
+
_ts_metadata("design:paramtypes", [
|
|
228
|
+
typeof SlackEventHandlerMap === "undefined" ? Object : SlackEventHandlerMap,
|
|
229
|
+
typeof SlackCommandHandlerMap === "undefined" ? Object : SlackCommandHandlerMap,
|
|
230
|
+
typeof SlackInteractionHandlerMap === "undefined" ? Object : SlackInteractionHandlerMap,
|
|
231
|
+
typeof Logger === "undefined" ? Object : Logger
|
|
232
|
+
])
|
|
233
|
+
], SlackDispatcher);
|
|
234
|
+
|
|
235
|
+
// src/client/slack.client.ts
|
|
236
|
+
import { Injectable as Injectable3 } from "injectkit";
|
|
237
|
+
import { WebClient } from "@slack/web-api";
|
|
238
|
+
import { Logger as Logger2 } from "@maroonedsoftware/logger";
|
|
239
|
+
|
|
240
|
+
// src/client/slack.logger.adapter.ts
|
|
241
|
+
var adaptLogger = /* @__PURE__ */ __name((logger, name = "slack-web-api") => {
|
|
242
|
+
const state = {
|
|
243
|
+
name,
|
|
244
|
+
level: "info"
|
|
245
|
+
};
|
|
246
|
+
const forward = /* @__PURE__ */ __name((fn) => (...msg) => {
|
|
247
|
+
const [first, ...rest] = msg;
|
|
248
|
+
fn(first ?? "", ...rest);
|
|
249
|
+
}, "forward");
|
|
250
|
+
return {
|
|
251
|
+
debug: forward(logger.debug.bind(logger)),
|
|
252
|
+
info: forward(logger.info.bind(logger)),
|
|
253
|
+
warn: forward(logger.warn.bind(logger)),
|
|
254
|
+
error: forward(logger.error.bind(logger)),
|
|
255
|
+
setLevel: /* @__PURE__ */ __name((level) => {
|
|
256
|
+
state.level = level;
|
|
257
|
+
}, "setLevel"),
|
|
258
|
+
getLevel: /* @__PURE__ */ __name(() => state.level, "getLevel"),
|
|
259
|
+
setName: /* @__PURE__ */ __name((n) => {
|
|
260
|
+
state.name = n;
|
|
261
|
+
}, "setName")
|
|
262
|
+
};
|
|
263
|
+
}, "adaptLogger");
|
|
264
|
+
|
|
265
|
+
// src/client/slack.client.ts
|
|
266
|
+
function _ts_decorate3(decorators, target, key, desc) {
|
|
267
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
268
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
269
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
270
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
271
|
+
}
|
|
272
|
+
__name(_ts_decorate3, "_ts_decorate");
|
|
273
|
+
function _ts_metadata2(k, v) {
|
|
274
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
275
|
+
}
|
|
276
|
+
__name(_ts_metadata2, "_ts_metadata");
|
|
277
|
+
var SlackClient = class {
|
|
278
|
+
static {
|
|
279
|
+
__name(this, "SlackClient");
|
|
280
|
+
}
|
|
281
|
+
config;
|
|
282
|
+
logger;
|
|
283
|
+
/** Underlying `@slack/web-api` client. */
|
|
284
|
+
web;
|
|
285
|
+
constructor(config, logger) {
|
|
286
|
+
this.config = config;
|
|
287
|
+
this.logger = logger;
|
|
288
|
+
this.web = new WebClient(config.botToken, {
|
|
289
|
+
logger: adaptLogger(logger)
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
/** Posts a message via `chat.postMessage`. */
|
|
293
|
+
postMessage(args) {
|
|
294
|
+
return this.web.chat.postMessage(args);
|
|
295
|
+
}
|
|
296
|
+
/** Updates a message via `chat.update`. */
|
|
297
|
+
updateMessage(args) {
|
|
298
|
+
return this.web.chat.update(args);
|
|
299
|
+
}
|
|
300
|
+
/** Deletes a message via `chat.delete`. */
|
|
301
|
+
deleteMessage(args) {
|
|
302
|
+
return this.web.chat.delete(args);
|
|
303
|
+
}
|
|
304
|
+
/** Opens a modal view via `views.open`. */
|
|
305
|
+
openView(args) {
|
|
306
|
+
return this.web.views.open(args);
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* POSTs a payload to a Slack incoming-webhook-style URL — either the
|
|
310
|
+
* configured `incomingWebhookUrl` or an explicit URL (e.g. the
|
|
311
|
+
* `response_url` from a slash command or interactive payload).
|
|
312
|
+
*
|
|
313
|
+
* @throws {@link SlackError} if no URL is available or the response is non-2xx.
|
|
314
|
+
*/
|
|
315
|
+
async postWebhook(payload, url) {
|
|
316
|
+
const target = url ?? this.config.incomingWebhookUrl;
|
|
317
|
+
if (!target) {
|
|
318
|
+
throw new SlackError("SlackClient.postWebhook called but no incomingWebhookUrl is configured and no url was provided");
|
|
319
|
+
}
|
|
320
|
+
const response = await fetch(target, {
|
|
321
|
+
method: "POST",
|
|
322
|
+
headers: {
|
|
323
|
+
"content-type": "application/json"
|
|
324
|
+
},
|
|
325
|
+
body: JSON.stringify(payload)
|
|
326
|
+
});
|
|
327
|
+
if (!response.ok) {
|
|
328
|
+
const body = await response.text().catch(() => "");
|
|
329
|
+
this.logger.warn("Slack webhook POST returned non-OK status", {
|
|
330
|
+
status: response.status,
|
|
331
|
+
body
|
|
332
|
+
});
|
|
333
|
+
throw new SlackError(`Slack webhook POST returned ${response.status}`).withInternalDetails({
|
|
334
|
+
status: response.status,
|
|
335
|
+
body,
|
|
336
|
+
url: target
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
};
|
|
341
|
+
SlackClient = _ts_decorate3([
|
|
342
|
+
Injectable3(),
|
|
343
|
+
_ts_metadata2("design:type", Function),
|
|
344
|
+
_ts_metadata2("design:paramtypes", [
|
|
345
|
+
typeof SlackConfig === "undefined" ? Object : SlackConfig,
|
|
346
|
+
typeof Logger2 === "undefined" ? Object : Logger2
|
|
347
|
+
])
|
|
348
|
+
], SlackClient);
|
|
349
|
+
export {
|
|
350
|
+
IsSlackError,
|
|
351
|
+
SLACK_SIGNATURE_DEFAULT_MAX_AGE_SECONDS,
|
|
352
|
+
SlackClient,
|
|
353
|
+
SlackCommandHandlerMap,
|
|
354
|
+
SlackConfig,
|
|
355
|
+
SlackDispatcher,
|
|
356
|
+
SlackError,
|
|
357
|
+
SlackEventHandlerMap,
|
|
358
|
+
SlackInteractionHandlerMap,
|
|
359
|
+
adaptLogger,
|
|
360
|
+
interactionRouteKey,
|
|
361
|
+
verifySlackSignature
|
|
362
|
+
};
|
|
363
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/slack.config.ts","../src/slack.error.ts","../src/slack.signature.ts","../src/slack.interaction.handler.ts","../src/slack.dispatcher.ts","../src/client/slack.client.ts","../src/client/slack.logger.adapter.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */\nimport { Injectable } from 'injectkit';\n\n/**\n * Configuration for the Slack package. Declared as an abstract `@Injectable()`\n * class so it doubles as a DI token (mirrors the `Logger` pattern in\n * `@maroonedsoftware/logger`).\n *\n * Consumers register a concrete value at bootstrap, typically resolved from\n * `AppConfig`:\n *\n * ```ts\n * const slackConfig = appConfig.getAs<SlackConfig>('slack');\n * container.register(SlackConfig, { useValue: slackConfig });\n * ```\n *\n * Services in this package take `SlackConfig` directly in their constructor.\n */\nexport interface SlackConfig {\n /** Bot user OAuth token (`xoxb-...`). Required for Web API calls. */\n botToken: string;\n /** App-level signing secret used to verify request signatures. */\n signingSecret: string;\n /** Optional incoming webhook URL used as the default target for `SlackClient.postWebhook`. */\n incomingWebhookUrl?: string;\n /**\n * Maximum age (in seconds) for request timestamps before signature\n * verification rejects them as replays. Defaults to `300` (5 minutes).\n */\n signatureMaxAgeSeconds?: number;\n}\n\n@Injectable()\nexport abstract class SlackConfig implements SlackConfig {}\n","import { ServerkitError } from '@maroonedsoftware/errors';\n\n/**\n * Domain error raised by the Slack package for non-HTTP failures (e.g.\n * incoming-webhook POST failed, unknown handler dispatch).\n *\n * Extends {@link ServerkitError} so `errorMiddleware` renders a 500 with\n * `{ message, details }` if one of these escapes a route handler. Inside\n * route handlers, throw `httpError(...)` directly for status-coded responses.\n */\nexport class SlackError extends ServerkitError {}\n\n/**\n * Type guard for {@link SlackError}. Narrows `unknown` to `SlackError` so\n * `details`, `internalDetails`, and the chainable setters are accessible\n * without further checks. Returns `true` for any subclass.\n */\nexport const IsSlackError = (error: unknown): error is SlackError => error instanceof SlackError;\n","import { createHmac, timingSafeEqual } from 'node:crypto';\nimport { SlackError } from './slack.error.js';\n\n/** Default replay-protection window in seconds (5 minutes — matches Slack's recommendation). */\nexport const SLACK_SIGNATURE_DEFAULT_MAX_AGE_SECONDS = 300;\n\n/**\n * Reason codes attached to {@link SlackError.internalDetails} when verification\n * fails. Useful for callers that want to log structured reasons without\n * pattern-matching on error messages.\n */\nexport type SlackSignatureFailureReason =\n | 'missing_timestamp'\n | 'invalid_timestamp'\n | 'stale_timestamp'\n | 'missing_signature'\n | 'invalid_signature';\n\n/**\n * Inputs to {@link verifySlackSignature}. All values are taken verbatim from\n * the request — the helper does no header lookups or body reads of its own.\n */\nexport type VerifySlackSignatureInput = {\n /** App signing secret (`SlackConfig.signingSecret`). */\n signingSecret: string;\n /** Raw, unparsed request body — exactly as Slack sent it. */\n rawBody: string;\n /** Value of the `X-Slack-Request-Timestamp` header. */\n timestamp: string | undefined;\n /** Value of the `X-Slack-Signature` header (e.g. `\"v0=abc123…\"`). */\n signature: string | undefined;\n /**\n * Maximum age in seconds before the request is rejected as a replay.\n * Defaults to {@link SLACK_SIGNATURE_DEFAULT_MAX_AGE_SECONDS}.\n */\n maxAgeSeconds?: number;\n /**\n * Override for the current Unix time in seconds. Mostly useful for tests;\n * defaults to `Math.floor(Date.now() / 1000)`.\n */\n now?: number;\n};\n\n/**\n * Verifies a Slack request signature against the app signing secret.\n *\n * Implements Slack's v0 scheme:\n * 1. Reject the request if `X-Slack-Request-Timestamp` is missing, non-numeric,\n * or older than `maxAgeSeconds` (replay protection).\n * 2. Compute `v0=` + `HMAC-SHA256(signingSecret, \"v0:{timestamp}:{rawBody}\")`\n * as hex.\n * 3. Compare against the provided `X-Slack-Signature` value using a\n * constant-time compare.\n *\n * Pure: no request/context coupling. The caller extracts the headers and raw\n * body from whatever transport it's using and passes them in.\n *\n * @throws {@link SlackError} on any failure. The error's `internalDetails.reason`\n * is one of {@link SlackSignatureFailureReason}; map to HTTP 401 at the route boundary.\n *\n * @example\n * ```ts\n * try {\n * verifySlackSignature({\n * signingSecret: config.signingSecret,\n * rawBody,\n * timestamp: req.headers['x-slack-request-timestamp'],\n * signature: req.headers['x-slack-signature'],\n * });\n * } catch (err) {\n * throw httpError(401).withCause(err);\n * }\n * ```\n */\nexport const verifySlackSignature = (input: VerifySlackSignatureInput): void => {\n const {\n signingSecret,\n rawBody,\n timestamp,\n signature,\n maxAgeSeconds = SLACK_SIGNATURE_DEFAULT_MAX_AGE_SECONDS,\n now = Math.floor(Date.now() / 1000),\n } = input;\n\n if (!timestamp) {\n throw new SlackError('Slack request missing X-Slack-Request-Timestamp header').withInternalDetails({\n reason: 'missing_timestamp' satisfies SlackSignatureFailureReason,\n });\n }\n\n const ts = Number(timestamp);\n if (!Number.isFinite(ts) || !Number.isInteger(ts)) {\n throw new SlackError('Slack request timestamp is not a valid integer').withInternalDetails({\n reason: 'invalid_timestamp' satisfies SlackSignatureFailureReason,\n timestamp,\n });\n }\n\n if (Math.abs(now - ts) > maxAgeSeconds) {\n throw new SlackError('Slack request timestamp is outside the allowed window').withInternalDetails({\n reason: 'stale_timestamp' satisfies SlackSignatureFailureReason,\n timestamp: ts,\n now,\n maxAgeSeconds,\n });\n }\n\n if (!signature) {\n throw new SlackError('Slack request missing X-Slack-Signature header').withInternalDetails({\n reason: 'missing_signature' satisfies SlackSignatureFailureReason,\n });\n }\n\n const expected = `v0=${createHmac('sha256', signingSecret).update(`v0:${ts}:${rawBody}`).digest('hex')}`;\n const expectedBuf = Buffer.from(expected, 'utf8');\n const providedBuf = Buffer.from(signature, 'utf8');\n\n // timingSafeEqual throws on length mismatch — short-circuit so the caller\n // gets a uniform \"invalid_signature\" error instead of a crypto exception.\n if (expectedBuf.length !== providedBuf.length || !timingSafeEqual(expectedBuf, providedBuf)) {\n throw new SlackError('Slack request signature does not match').withInternalDetails({\n reason: 'invalid_signature' satisfies SlackSignatureFailureReason,\n });\n }\n};\n","/**\n * The supported interactive payload types Slack POSTs to the interactivity\n * endpoint. Each maps to a different identifier shape (see\n * {@link interactionRouteKey}).\n */\nexport type SlackInteractionType = 'block_actions' | 'view_submission' | 'view_closed' | 'shortcut' | 'message_action' | string;\n\n/**\n * Loose typing for the interactive payload; consumers narrow per handler.\n * Slack's payloads vary by type, but every variant has a `type` field plus\n * one of: `actions[].action_id`, `view.callback_id`, or top-level `callback_id`.\n */\nexport type SlackInteractionPayload = {\n type: SlackInteractionType;\n team?: { id: string; domain?: string };\n user?: { id: string; name?: string };\n trigger_id?: string;\n response_url?: string;\n actions?: Array<{ action_id: string; block_id?: string; value?: string; [key: string]: unknown }>;\n view?: { id: string; callback_id: string; [key: string]: unknown };\n callback_id?: string;\n [key: string]: unknown;\n};\n\n/**\n * Optional response Slack accepts for `view_submission` / `view_closed`\n * payloads (e.g. to display validation errors or update a modal).\n */\nexport type SlackInteractionResponse = {\n response_action?: 'errors' | 'update' | 'push' | 'clear';\n errors?: Record<string, string>;\n view?: unknown;\n [key: string]: unknown;\n};\n\n/**\n * Handler for one interactive payload, keyed in {@link SlackInteractionHandlerMap}\n * by `${type}:${identifier}` — see {@link interactionRouteKey}.\n */\nexport interface SlackInteractionHandler {\n handle(payload: SlackInteractionPayload): Promise<SlackInteractionResponse | void>;\n}\n\n/**\n * Computes the routing key used by {@link SlackDispatcher.dispatchInteraction}\n * to look a handler up in {@link SlackInteractionHandlerMap}.\n *\n * - `block_actions` → `block_actions:<first action.action_id>`\n * - `view_submission` / `view_closed` → `<type>:<view.callback_id>`\n * - `shortcut` / `message_action` → `<type>:<callback_id>`\n * - any other type with a `callback_id` → `<type>:<callback_id>`\n *\n * @returns The routing key, or `undefined` if the payload doesn't carry an\n * identifier we can route on (e.g. a `block_actions` payload with no actions).\n */\nexport const interactionRouteKey = (payload: SlackInteractionPayload): string | undefined => {\n switch (payload.type) {\n case 'block_actions': {\n const id = payload.actions?.[0]?.action_id;\n return id ? `block_actions:${id}` : undefined;\n }\n case 'view_submission':\n case 'view_closed': {\n const id = payload.view?.callback_id;\n return id ? `${payload.type}:${id}` : undefined;\n }\n case 'shortcut':\n case 'message_action': {\n return payload.callback_id ? `${payload.type}:${payload.callback_id}` : undefined;\n }\n default: {\n return payload.callback_id ? `${payload.type}:${payload.callback_id}` : undefined;\n }\n }\n};\n","import { Injectable } from 'injectkit';\nimport { Logger } from '@maroonedsoftware/logger';\nimport type { SlackEventCallback, SlackEventHandler } from './slack.event.handler.js';\nimport type { SlackCommandHandler, SlackCommandPayload, SlackCommandResponse } from './slack.command.handler.js';\nimport {\n interactionRouteKey,\n SlackInteractionHandler,\n type SlackInteractionPayload,\n type SlackInteractionResponse,\n} from './slack.interaction.handler.js';\n\n/**\n * Body shape Slack POSTs to the Events API endpoint. The handshake variant\n * (`url_verification`) is sent once during app configuration; the rest of the\n * traffic is `event_callback` envelopes (or other future top-level types).\n */\nexport type SlackEventsRequest =\n | { type: 'url_verification'; challenge: string; token?: string }\n | SlackEventCallback\n | { type: string; [key: string]: unknown };\n\n/**\n * Response Slack expects for the `url_verification` handshake. For\n * `event_callback` and unknown event types, the dispatcher returns\n * `undefined` and the caller should ack with HTTP 200.\n */\nexport type SlackEventsResponse = { challenge: string } | undefined;\n\n/**\n * Injectable map of command keyword (e.g. `/deploy`) → {@link SlackCommandHandler}.\n *\n * @example\n * ```ts\n * const commands = new SlackCommandHandlerMap();\n * commands.set('/deploy', container.get(DeployCommandHandler));\n * container.register(SlackCommandHandlerMap, { useValue: commands });\n * ```\n */\n@Injectable()\nexport class SlackCommandHandlerMap extends Map<string, SlackCommandHandler> {}\n\n/**\n * Injectable map of Slack event type → {@link SlackEventHandler}. Consumers\n * register handlers at bootstrap and place an instance of this map in their\n * DI container; {@link SlackDispatcher.dispatchEvent} resolves it per request.\n *\n * @example\n * ```ts\n * const handlers = new SlackEventHandlerMap();\n * handlers.set('app_mention', container.get(MyAppMentionHandler));\n * container.register(SlackEventHandlerMap, { useValue: handlers });\n * ```\n */\n@Injectable()\nexport class SlackEventHandlerMap extends Map<string, SlackEventHandler> {}\n\n/**\n * Injectable map of interaction routing keys → {@link SlackInteractionHandler}.\n *\n * Keys are produced by `interactionRouteKey(payload)`, which combines the\n * payload `type` with the relevant identifier (`action_id`, `callback_id`,\n * etc.). Register handlers under the same key shape:\n *\n * @example\n * ```ts\n * const interactions = new SlackInteractionHandlerMap();\n * interactions.set('block_actions:approve_button', container.get(ApproveHandler));\n * interactions.set('view_submission:create_ticket_modal', container.get(CreateTicketHandler));\n * container.register(SlackInteractionHandlerMap, { useValue: interactions });\n * ```\n */\n@Injectable()\nexport class SlackInteractionHandlerMap extends Map<string, SlackInteractionHandler> {}\n\n/**\n * Single entry point for dispatching parsed Slack payloads to registered\n * handlers. Transport-agnostic: the consumer is responsible for receiving\n * the HTTP request, verifying the signature, parsing the body, calling the\n * appropriate `dispatch*` method, and serializing the response.\n *\n * @example Koa route\n * ```ts\n * router.post('/slack/events', async (ctx) => {\n * const raw = await rawBody(ctx.req, { encoding: 'utf8' });\n * verifySlackSignature({\n * signingSecret: ctx.container.get(SlackConfig).signingSecret,\n * rawBody: raw,\n * timestamp: ctx.get('x-slack-request-timestamp'),\n * signature: ctx.get('x-slack-signature'),\n * });\n * const result = await ctx.container.get(SlackDispatcher).dispatchEvent(JSON.parse(raw));\n * if (result) ctx.body = result;\n * else { ctx.status = 200; ctx.body = ''; }\n * });\n * ```\n */\n@Injectable()\nexport class SlackDispatcher {\n constructor(\n private readonly events: SlackEventHandlerMap,\n private readonly commands: SlackCommandHandlerMap,\n private readonly interactions: SlackInteractionHandlerMap,\n private readonly logger: Logger,\n ) {}\n\n /**\n * Dispatch a parsed Events API body.\n *\n * - Returns `{ challenge }` for `url_verification` — the caller serializes\n * it as the response body.\n * - For `event_callback`, looks up a handler in {@link SlackEventHandlerMap}\n * keyed by `event.type` and invokes it. Returns `undefined`. Slack retries\n * any non-2xx so unknown event types are logged at debug and acked.\n * - For any other top-level type, logs and returns `undefined`.\n */\n async dispatchEvent(body: SlackEventsRequest): Promise<SlackEventsResponse> {\n if (body.type === 'url_verification') {\n return { challenge: (body as { challenge: string }).challenge };\n }\n\n if (body.type === 'event_callback') {\n const envelope = body as SlackEventCallback;\n const handler = this.events.get(envelope.event.type);\n if (handler) {\n await handler.handle(envelope.event, {\n teamId: envelope.team_id,\n eventId: envelope.event_id,\n eventTime: envelope.event_time,\n envelope,\n });\n } else {\n this.logger.debug('No Slack event handler registered for event type', { type: envelope.event.type });\n }\n return undefined;\n }\n\n this.logger.debug('Unhandled Slack events payload type', { type: body.type });\n return undefined;\n }\n\n /**\n * Dispatch a parsed slash-command payload.\n *\n * Looks up a handler in {@link SlackCommandHandlerMap} keyed by\n * `payload.command` (e.g. `/deploy`). If the handler returns a response,\n * the caller serializes it as JSON; otherwise the caller acks with `200 ''`\n * and the handler is expected to follow up via `payload.response_url`.\n */\n async dispatchCommand(payload: SlackCommandPayload): Promise<SlackCommandResponse | void> {\n const handler = this.commands.get(payload.command);\n if (!handler) {\n this.logger.debug('No Slack command handler registered', { command: payload.command });\n return undefined;\n }\n return await handler.handle(payload);\n }\n\n /**\n * Dispatch a parsed interactive payload (block actions, view submission,\n * shortcut, etc.). Computes a routing key via {@link interactionRouteKey}\n * and looks it up in {@link SlackInteractionHandlerMap}.\n */\n async dispatchInteraction(payload: SlackInteractionPayload): Promise<SlackInteractionResponse | void> {\n const key = interactionRouteKey(payload);\n if (!key) {\n this.logger.debug('Slack interaction payload missing routable identifier', { type: payload.type });\n return undefined;\n }\n const handler = this.interactions.get(key);\n if (!handler) {\n this.logger.debug('No Slack interaction handler registered', { key });\n return undefined;\n }\n return await handler.handle(payload);\n }\n}\n","import { Injectable } from 'injectkit';\nimport { WebClient } from '@slack/web-api';\nimport type { ChatPostMessageArguments, ChatPostMessageResponse, ChatUpdateArguments, ChatUpdateResponse, ChatDeleteArguments, ChatDeleteResponse, ViewsOpenArguments, ViewsOpenResponse } from '@slack/web-api';\nimport { Logger } from '@maroonedsoftware/logger';\nimport { SlackConfig } from '../slack.config.js';\nimport { SlackError } from '../slack.error.js';\nimport { adaptLogger } from './slack.logger.adapter.js';\n\n/**\n * Payload for an incoming-webhook POST. Mirrors the subset of fields Slack's\n * incoming webhooks accept (text, blocks, attachments, response shaping).\n * The body is JSON-stringified verbatim, so any extra fields are preserved.\n */\nexport type IncomingWebhookPayload = {\n text?: string;\n blocks?: unknown[];\n attachments?: unknown[];\n thread_ts?: string;\n response_type?: 'in_channel' | 'ephemeral';\n replace_original?: boolean;\n delete_original?: boolean;\n unfurl_links?: boolean;\n unfurl_media?: boolean;\n [key: string]: unknown;\n};\n\n/**\n * Thin DI-friendly wrapper around `@slack/web-api`'s `WebClient`. Constructed\n * once per request scope (or as a singleton, depending on how the consumer\n * registers it) and exposes typed passthroughs for the most common Web API\n * methods plus a `postWebhook` helper for incoming-webhook URLs and the\n * `response_url` returned by slash commands and interactive payloads.\n *\n * Reach for {@link SlackClient.web} directly for anything else the underlying\n * client supports.\n *\n * @example\n * ```ts\n * await container.get(SlackClient).postMessage({ channel: '#ops', text: 'hello' });\n * await container.get(SlackClient).postWebhook({ text: 'follow-up' }, payload.response_url);\n * ```\n */\n@Injectable()\nexport class SlackClient {\n /** Underlying `@slack/web-api` client. */\n readonly web: WebClient;\n\n constructor(\n private readonly config: SlackConfig,\n private readonly logger: Logger,\n ) {\n this.web = new WebClient(config.botToken, { logger: adaptLogger(logger) });\n }\n\n /** Posts a message via `chat.postMessage`. */\n postMessage(args: ChatPostMessageArguments): Promise<ChatPostMessageResponse> {\n return this.web.chat.postMessage(args);\n }\n\n /** Updates a message via `chat.update`. */\n updateMessage(args: ChatUpdateArguments): Promise<ChatUpdateResponse> {\n return this.web.chat.update(args);\n }\n\n /** Deletes a message via `chat.delete`. */\n deleteMessage(args: ChatDeleteArguments): Promise<ChatDeleteResponse> {\n return this.web.chat.delete(args);\n }\n\n /** Opens a modal view via `views.open`. */\n openView(args: ViewsOpenArguments): Promise<ViewsOpenResponse> {\n return this.web.views.open(args);\n }\n\n /**\n * POSTs a payload to a Slack incoming-webhook-style URL — either the\n * configured `incomingWebhookUrl` or an explicit URL (e.g. the\n * `response_url` from a slash command or interactive payload).\n *\n * @throws {@link SlackError} if no URL is available or the response is non-2xx.\n */\n async postWebhook(payload: IncomingWebhookPayload, url?: string): Promise<void> {\n const target = url ?? this.config.incomingWebhookUrl;\n if (!target) {\n throw new SlackError('SlackClient.postWebhook called but no incomingWebhookUrl is configured and no url was provided');\n }\n const response = await fetch(target, {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify(payload),\n });\n if (!response.ok) {\n const body = await response.text().catch(() => '');\n this.logger.warn('Slack webhook POST returned non-OK status', { status: response.status, body });\n throw new SlackError(`Slack webhook POST returned ${response.status}`).withInternalDetails({ status: response.status, body, url: target });\n }\n }\n}\n","import type { Logger as SlackLogger, LogLevel } from '@slack/web-api';\nimport { Logger } from '@maroonedsoftware/logger';\n\n/**\n * Adapts a ServerKit {@link Logger} to the `@slack/web-api` {@link SlackLogger}\n * interface so the WebClient can route its diagnostics through the host\n * application's logger.\n *\n * The Slack SDK's logger calls `logger.info(...args)` with a variable number\n * of arguments and no separate \"primary message\"; the adapter forwards them\n * to ServerKit's `(message, ...optionalParams)` shape, with an empty-string\n * primary when no args are passed.\n *\n * `setLevel`, `setName`, and `getLevel` are stored locally — ServerKit\n * loggers do not expose these knobs but the SDK expects them on its logger.\n *\n * @param logger - The ServerKit logger to forward calls to.\n * @param name - Initial value for the SDK logger's name. Defaults to `'slack-web-api'`.\n * @returns A `@slack/web-api`-compatible logger object.\n */\nexport const adaptLogger = (logger: Logger, name = 'slack-web-api'): SlackLogger => {\n const state = { name, level: 'info' as LogLevel };\n const forward = (fn: (message: unknown, ...optionalParams: unknown[]) => void) => (...msg: unknown[]) => {\n const [first, ...rest] = msg;\n fn(first ?? '', ...rest);\n };\n return {\n debug: forward(logger.debug.bind(logger)),\n info: forward(logger.info.bind(logger)),\n warn: forward(logger.warn.bind(logger)),\n error: forward(logger.error.bind(logger)),\n setLevel: (level: LogLevel) => {\n state.level = level;\n },\n getLevel: () => state.level,\n setName: (n: string) => {\n state.name = n;\n },\n };\n};\n"],"mappings":";;;;AACA,SAASA,kBAAkB;;;;;;;;AAgCpB,IAAeC,cAAf,MAAeA;SAAAA;;;AAAoC;;;;;;ACjC1D,SAASC,sBAAsB;AAUxB,IAAMC,aAAN,cAAyBC,eAAAA;EAVhC,OAUgCA;;;AAAgB;AAOzC,IAAMC,eAAe,wBAACC,UAAwCA,iBAAiBH,YAA1D;;;ACjB5B,SAASI,YAAYC,uBAAuB;AAIrC,IAAMC,0CAA0C;AAsEhD,IAAMC,uBAAuB,wBAACC,UAAAA;AACnC,QAAM,EACJC,eACAC,SACAC,WACAC,WACAC,gBAAgBP,yCAChBQ,MAAMC,KAAKC,MAAMC,KAAKH,IAAG,IAAK,GAAA,EAAK,IACjCN;AAEJ,MAAI,CAACG,WAAW;AACd,UAAM,IAAIO,WAAW,wDAAA,EAA0DC,oBAAoB;MACjGC,QAAQ;IACV,CAAA;EACF;AAEA,QAAMC,KAAKC,OAAOX,SAAAA;AAClB,MAAI,CAACW,OAAOC,SAASF,EAAAA,KAAO,CAACC,OAAOE,UAAUH,EAAAA,GAAK;AACjD,UAAM,IAAIH,WAAW,gDAAA,EAAkDC,oBAAoB;MACzFC,QAAQ;MACRT;IACF,CAAA;EACF;AAEA,MAAII,KAAKU,IAAIX,MAAMO,EAAAA,IAAMR,eAAe;AACtC,UAAM,IAAIK,WAAW,uDAAA,EAAyDC,oBAAoB;MAChGC,QAAQ;MACRT,WAAWU;MACXP;MACAD;IACF,CAAA;EACF;AAEA,MAAI,CAACD,WAAW;AACd,UAAM,IAAIM,WAAW,gDAAA,EA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;EAGAI,cAAcJ,MAAwD;AACpE,WAAO,KAAKP,IAAIQ,KAAKI,OAAOL,IAAAA;EAC9B;;EAGAM,SAASN,MAAsD;AAC7D,WAAO,KAAKP,IAAIc,MAAMC,KAAKR,IAAAA;EAC7B;;;;;;;;EASA,MAAMS,YAAYC,SAAiCC,KAA6B;AAC9E,UAAMC,SAASD,OAAO,KAAKjB,OAAOmB;AAClC,QAAI,CAACD,QAAQ;AACX,YAAM,IAAIE,WAAW,gGAAA;IACvB;AACA,UAAMC,WAAW,MAAMC,MAAMJ,QAAQ;MACnCK,QAAQ;MACRC,SAAS;QAAE,gBAAgB;MAAmB;MAC9CC,MAAMC,KAAKC,UAAUX,OAAAA;IACvB,CAAA;AACA,QAAI,CAACK,SAASO,IAAI;AAChB,YAAMH,OAAO,MAAMJ,SAASQ,KAAI,EAAGC,MAAM,MAAM,EAAA;AAC/C,WAAK7B,OAAO8B,KAAK,6CAA6C;QAAEC,QAAQX,SAASW;QAAQP;MAAK,CAAA;AAC9F,YAAM,IAAIL,WAAW,+BAA+BC,SAASW,MAAM,EAAE,EAAEC,oBAAoB;QAAED,QAAQX,SAASW;QAAQP;QAAMR,KAAKC;MAAO,CAAA;IAC1I;EACF;AACF;;;;;;;;;","names":["Injectable","SlackConfig","ServerkitError","SlackError","ServerkitError","IsSlackError","error","createHmac","timingSafeEqual","SLACK_SIGNATURE_DEFAULT_MAX_AGE_SECONDS","verifySlackSignature","input","signingSecret","rawBody","timestamp","signature","maxAgeSeconds","now","Math","floor","Date","SlackError","withInternalDetails","reason","ts","Number","isFinite","isInteger","abs","expected","createHmac","update","digest","expectedBuf","Buffer","from","providedBuf","length","timingSafeEqual","interactionRouteKey","payload","type","id","actions","action_id","undefined","view","callback_id","Injectable","Logger","SlackCommandHandlerMap","Map","SlackEventHandlerMap","SlackInteractionHandlerMap","SlackDispatcher","events","commands","interactions","logger","dispatchEvent","body","type","challenge","envelope","handler","get","event","handle","teamId","team_id","eventId","event_id","eventTime","event_time","debug","undefined","dispatchCommand","payload","command","dispatchInteraction","key","interactionRouteKey","Injectable","WebClient","Logger","adaptLogger","logger","name","state","level","forward","fn","msg","first","rest","debug","bind","info","warn","error","setLevel","getLevel","setName","n","SlackClient","web","config","logger","WebClient","botToken","adaptLogger","postMessage","args","chat","updateMessage","update","deleteMessage","delete","openView","views","open","postWebhook","payload","url","target","incomingWebhookUrl","SlackError","response","fetch","method","headers","body","JSON","stringify","ok","text","catch","warn","status","withInternalDetails"]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decoded slash-command payload Slack delivers as `application/x-www-form-urlencoded`.
|
|
3
|
+
* Field documentation: https://api.slack.com/interactivity/slash-commands#app_command_handling.
|
|
4
|
+
*/
|
|
5
|
+
export type SlackCommandPayload = {
|
|
6
|
+
/** Verification token (deprecated by Slack — prefer signature verification). */
|
|
7
|
+
token: string;
|
|
8
|
+
team_id: string;
|
|
9
|
+
team_domain: string;
|
|
10
|
+
enterprise_id?: string;
|
|
11
|
+
enterprise_name?: string;
|
|
12
|
+
channel_id: string;
|
|
13
|
+
channel_name: string;
|
|
14
|
+
user_id: string;
|
|
15
|
+
user_name: string;
|
|
16
|
+
/** The command keyword, including the leading slash (e.g. `/deploy`). */
|
|
17
|
+
command: string;
|
|
18
|
+
/** Everything the user typed after the command. */
|
|
19
|
+
text: string;
|
|
20
|
+
/** URL the handler can POST to within 30 minutes for follow-up responses. */
|
|
21
|
+
response_url: string;
|
|
22
|
+
/** Short-lived token usable with `views.open`. */
|
|
23
|
+
trigger_id: string;
|
|
24
|
+
api_app_id?: string;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Response body for a slash command. Slack accepts plain text or a Block Kit
|
|
28
|
+
* payload; the optional `response_type` controls visibility.
|
|
29
|
+
*/
|
|
30
|
+
export type SlackCommandResponse = {
|
|
31
|
+
/** Plain text shown to the user when no `blocks` are provided. */
|
|
32
|
+
text?: string;
|
|
33
|
+
/** Block Kit blocks. */
|
|
34
|
+
blocks?: unknown[];
|
|
35
|
+
/** `'ephemeral'` (only the invoker sees it, default) or `'in_channel'`. */
|
|
36
|
+
response_type?: 'ephemeral' | 'in_channel';
|
|
37
|
+
[key: string]: unknown;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Handler for one slash command keyed by its full command string (with slash,
|
|
41
|
+
* e.g. `/deploy`). Registered in {@link SlackCommandHandlerMap}.
|
|
42
|
+
*
|
|
43
|
+
* Returning a {@link SlackCommandResponse} makes Slack render it immediately;
|
|
44
|
+
* returning `void` acks with an empty 200 (the handler is responsible for any
|
|
45
|
+
* follow-up via `response_url`).
|
|
46
|
+
*/
|
|
47
|
+
export interface SlackCommandHandler {
|
|
48
|
+
handle(payload: SlackCommandPayload): Promise<SlackCommandResponse | void>;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=slack.command.handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slack.command.handler.d.ts","sourceRoot":"","sources":["../src/slack.command.handler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,gFAAgF;IAChF,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,yEAAyE;IACzE,OAAO,EAAE,MAAM,CAAC;IAChB,mDAAmD;IACnD,IAAI,EAAE,MAAM,CAAC;IACb,6EAA6E;IAC7E,YAAY,EAAE,MAAM,CAAC;IACrB,kDAAkD;IAClD,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,kEAAkE;IAClE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,wBAAwB;IACxB,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC;IACnB,2EAA2E;IAC3E,aAAa,CAAC,EAAE,WAAW,GAAG,YAAY,CAAC;IAC3C,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,WAAW,mBAAmB;IAClC,MAAM,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAAC;CAC5E"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration for the Slack package. Declared as an abstract `@Injectable()`
|
|
3
|
+
* class so it doubles as a DI token (mirrors the `Logger` pattern in
|
|
4
|
+
* `@maroonedsoftware/logger`).
|
|
5
|
+
*
|
|
6
|
+
* Consumers register a concrete value at bootstrap, typically resolved from
|
|
7
|
+
* `AppConfig`:
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* const slackConfig = appConfig.getAs<SlackConfig>('slack');
|
|
11
|
+
* container.register(SlackConfig, { useValue: slackConfig });
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* Services in this package take `SlackConfig` directly in their constructor.
|
|
15
|
+
*/
|
|
16
|
+
export interface SlackConfig {
|
|
17
|
+
/** Bot user OAuth token (`xoxb-...`). Required for Web API calls. */
|
|
18
|
+
botToken: string;
|
|
19
|
+
/** App-level signing secret used to verify request signatures. */
|
|
20
|
+
signingSecret: string;
|
|
21
|
+
/** Optional incoming webhook URL used as the default target for `SlackClient.postWebhook`. */
|
|
22
|
+
incomingWebhookUrl?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Maximum age (in seconds) for request timestamps before signature
|
|
25
|
+
* verification rejects them as replays. Defaults to `300` (5 minutes).
|
|
26
|
+
*/
|
|
27
|
+
signatureMaxAgeSeconds?: number;
|
|
28
|
+
}
|
|
29
|
+
export declare abstract class SlackConfig implements SlackConfig {
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=slack.config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slack.config.d.ts","sourceRoot":"","sources":["../src/slack.config.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,WAAW;IAC1B,qEAAqE;IACrE,QAAQ,EAAE,MAAM,CAAC;IACjB,kEAAkE;IAClE,aAAa,EAAE,MAAM,CAAC;IACtB,8FAA8F;IAC9F,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;OAGG;IACH,sBAAsB,CAAC,EAAE,MAAM,CAAC;CACjC;AAED,8BACsB,WAAY,YAAW,WAAW;CAAG"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { Logger } from '@maroonedsoftware/logger';
|
|
2
|
+
import type { SlackEventCallback, SlackEventHandler } from './slack.event.handler.js';
|
|
3
|
+
import type { SlackCommandHandler, SlackCommandPayload, SlackCommandResponse } from './slack.command.handler.js';
|
|
4
|
+
import { SlackInteractionHandler, type SlackInteractionPayload, type SlackInteractionResponse } from './slack.interaction.handler.js';
|
|
5
|
+
/**
|
|
6
|
+
* Body shape Slack POSTs to the Events API endpoint. The handshake variant
|
|
7
|
+
* (`url_verification`) is sent once during app configuration; the rest of the
|
|
8
|
+
* traffic is `event_callback` envelopes (or other future top-level types).
|
|
9
|
+
*/
|
|
10
|
+
export type SlackEventsRequest = {
|
|
11
|
+
type: 'url_verification';
|
|
12
|
+
challenge: string;
|
|
13
|
+
token?: string;
|
|
14
|
+
} | SlackEventCallback | {
|
|
15
|
+
type: string;
|
|
16
|
+
[key: string]: unknown;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Response Slack expects for the `url_verification` handshake. For
|
|
20
|
+
* `event_callback` and unknown event types, the dispatcher returns
|
|
21
|
+
* `undefined` and the caller should ack with HTTP 200.
|
|
22
|
+
*/
|
|
23
|
+
export type SlackEventsResponse = {
|
|
24
|
+
challenge: string;
|
|
25
|
+
} | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Injectable map of command keyword (e.g. `/deploy`) → {@link SlackCommandHandler}.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* const commands = new SlackCommandHandlerMap();
|
|
32
|
+
* commands.set('/deploy', container.get(DeployCommandHandler));
|
|
33
|
+
* container.register(SlackCommandHandlerMap, { useValue: commands });
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare class SlackCommandHandlerMap extends Map<string, SlackCommandHandler> {
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Injectable map of Slack event type → {@link SlackEventHandler}. Consumers
|
|
40
|
+
* register handlers at bootstrap and place an instance of this map in their
|
|
41
|
+
* DI container; {@link SlackDispatcher.dispatchEvent} resolves it per request.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```ts
|
|
45
|
+
* const handlers = new SlackEventHandlerMap();
|
|
46
|
+
* handlers.set('app_mention', container.get(MyAppMentionHandler));
|
|
47
|
+
* container.register(SlackEventHandlerMap, { useValue: handlers });
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
export declare class SlackEventHandlerMap extends Map<string, SlackEventHandler> {
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Injectable map of interaction routing keys → {@link SlackInteractionHandler}.
|
|
54
|
+
*
|
|
55
|
+
* Keys are produced by `interactionRouteKey(payload)`, which combines the
|
|
56
|
+
* payload `type` with the relevant identifier (`action_id`, `callback_id`,
|
|
57
|
+
* etc.). Register handlers under the same key shape:
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```ts
|
|
61
|
+
* const interactions = new SlackInteractionHandlerMap();
|
|
62
|
+
* interactions.set('block_actions:approve_button', container.get(ApproveHandler));
|
|
63
|
+
* interactions.set('view_submission:create_ticket_modal', container.get(CreateTicketHandler));
|
|
64
|
+
* container.register(SlackInteractionHandlerMap, { useValue: interactions });
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
export declare class SlackInteractionHandlerMap extends Map<string, SlackInteractionHandler> {
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Single entry point for dispatching parsed Slack payloads to registered
|
|
71
|
+
* handlers. Transport-agnostic: the consumer is responsible for receiving
|
|
72
|
+
* the HTTP request, verifying the signature, parsing the body, calling the
|
|
73
|
+
* appropriate `dispatch*` method, and serializing the response.
|
|
74
|
+
*
|
|
75
|
+
* @example Koa route
|
|
76
|
+
* ```ts
|
|
77
|
+
* router.post('/slack/events', async (ctx) => {
|
|
78
|
+
* const raw = await rawBody(ctx.req, { encoding: 'utf8' });
|
|
79
|
+
* verifySlackSignature({
|
|
80
|
+
* signingSecret: ctx.container.get(SlackConfig).signingSecret,
|
|
81
|
+
* rawBody: raw,
|
|
82
|
+
* timestamp: ctx.get('x-slack-request-timestamp'),
|
|
83
|
+
* signature: ctx.get('x-slack-signature'),
|
|
84
|
+
* });
|
|
85
|
+
* const result = await ctx.container.get(SlackDispatcher).dispatchEvent(JSON.parse(raw));
|
|
86
|
+
* if (result) ctx.body = result;
|
|
87
|
+
* else { ctx.status = 200; ctx.body = ''; }
|
|
88
|
+
* });
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
export declare class SlackDispatcher {
|
|
92
|
+
private readonly events;
|
|
93
|
+
private readonly commands;
|
|
94
|
+
private readonly interactions;
|
|
95
|
+
private readonly logger;
|
|
96
|
+
constructor(events: SlackEventHandlerMap, commands: SlackCommandHandlerMap, interactions: SlackInteractionHandlerMap, logger: Logger);
|
|
97
|
+
/**
|
|
98
|
+
* Dispatch a parsed Events API body.
|
|
99
|
+
*
|
|
100
|
+
* - Returns `{ challenge }` for `url_verification` — the caller serializes
|
|
101
|
+
* it as the response body.
|
|
102
|
+
* - For `event_callback`, looks up a handler in {@link SlackEventHandlerMap}
|
|
103
|
+
* keyed by `event.type` and invokes it. Returns `undefined`. Slack retries
|
|
104
|
+
* any non-2xx so unknown event types are logged at debug and acked.
|
|
105
|
+
* - For any other top-level type, logs and returns `undefined`.
|
|
106
|
+
*/
|
|
107
|
+
dispatchEvent(body: SlackEventsRequest): Promise<SlackEventsResponse>;
|
|
108
|
+
/**
|
|
109
|
+
* Dispatch a parsed slash-command payload.
|
|
110
|
+
*
|
|
111
|
+
* Looks up a handler in {@link SlackCommandHandlerMap} keyed by
|
|
112
|
+
* `payload.command` (e.g. `/deploy`). If the handler returns a response,
|
|
113
|
+
* the caller serializes it as JSON; otherwise the caller acks with `200 ''`
|
|
114
|
+
* and the handler is expected to follow up via `payload.response_url`.
|
|
115
|
+
*/
|
|
116
|
+
dispatchCommand(payload: SlackCommandPayload): Promise<SlackCommandResponse | void>;
|
|
117
|
+
/**
|
|
118
|
+
* Dispatch a parsed interactive payload (block actions, view submission,
|
|
119
|
+
* shortcut, etc.). Computes a routing key via {@link interactionRouteKey}
|
|
120
|
+
* and looks it up in {@link SlackInteractionHandlerMap}.
|
|
121
|
+
*/
|
|
122
|
+
dispatchInteraction(payload: SlackInteractionPayload): Promise<SlackInteractionResponse | void>;
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=slack.dispatcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slack.dispatcher.d.ts","sourceRoot":"","sources":["../src/slack.dispatcher.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AACtF,OAAO,KAAK,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AACjH,OAAO,EAEL,uBAAuB,EACvB,KAAK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