@slack/bolt 3.8.0 → 3.8.1
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/App.d.ts +212 -0
- package/dist/App.d.ts.map +1 -0
- package/dist/App.js +796 -0
- package/dist/App.js.map +1 -0
- package/dist/WorkflowStep.d.ts +106 -0
- package/dist/WorkflowStep.d.ts.map +1 -0
- package/dist/WorkflowStep.js +196 -0
- package/dist/WorkflowStep.js.map +1 -0
- package/dist/conversation-store.d.ts +31 -0
- package/dist/conversation-store.d.ts.map +1 -0
- package/dist/conversation-store.js +72 -0
- package/dist/conversation-store.js.map +1 -0
- package/dist/errors.d.ts +79 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +120 -0
- package/dist/errors.js.map +1 -0
- package/dist/helpers.d.ts +24 -0
- package/dist/helpers.d.ts.map +1 -0
- package/dist/helpers.js +100 -0
- package/dist/helpers.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +43 -0
- package/dist/index.js.map +1 -0
- package/dist/middleware/builtin.d.ts +52 -0
- package/dist/middleware/builtin.d.ts.map +1 -0
- package/dist/middleware/builtin.js +311 -0
- package/dist/middleware/builtin.js.map +1 -0
- package/dist/middleware/process.d.ts +5 -0
- package/dist/middleware/process.d.ts.map +1 -0
- package/dist/middleware/process.js +25 -0
- package/dist/middleware/process.js.map +1 -0
- package/dist/receivers/AwsLambdaReceiver.d.ts +53 -0
- package/dist/receivers/AwsLambdaReceiver.d.ts.map +1 -0
- package/dist/receivers/AwsLambdaReceiver.js +188 -0
- package/dist/receivers/AwsLambdaReceiver.js.map +1 -0
- package/dist/receivers/ExpressReceiver.d.ts +77 -0
- package/dist/receivers/ExpressReceiver.d.ts.map +1 -0
- package/dist/receivers/ExpressReceiver.js +445 -0
- package/dist/receivers/ExpressReceiver.js.map +1 -0
- package/dist/receivers/HTTPReceiver.d.ts +109 -0
- package/dist/receivers/HTTPReceiver.d.ts.map +1 -0
- package/dist/receivers/HTTPReceiver.js +501 -0
- package/dist/receivers/HTTPReceiver.js.map +1 -0
- package/dist/receivers/SocketModeReceiver.d.ts +61 -0
- package/dist/receivers/SocketModeReceiver.d.ts.map +1 -0
- package/dist/receivers/SocketModeReceiver.js +175 -0
- package/dist/receivers/SocketModeReceiver.js.map +1 -0
- package/dist/receivers/custom-routes.d.ts +14 -0
- package/dist/receivers/custom-routes.d.ts.map +1 -0
- package/dist/receivers/custom-routes.js +33 -0
- package/dist/receivers/custom-routes.js.map +1 -0
- package/dist/receivers/http-utils.d.ts +5 -0
- package/dist/receivers/http-utils.d.ts.map +1 -0
- package/dist/receivers/http-utils.js +35 -0
- package/dist/receivers/http-utils.js.map +1 -0
- package/dist/receivers/render-html-for-install-path.d.ts +3 -0
- package/dist/receivers/render-html-for-install-path.d.ts.map +1 -0
- package/dist/receivers/render-html-for-install-path.js +25 -0
- package/dist/receivers/render-html-for-install-path.js.map +1 -0
- package/dist/receivers/verify-redirect-opts.d.ts +7 -0
- package/dist/receivers/verify-redirect-opts.d.ts.map +1 -0
- package/dist/receivers/verify-redirect-opts.js +23 -0
- package/dist/receivers/verify-redirect-opts.js.map +1 -0
- package/dist/receivers/verify-request.d.ts +41 -0
- package/dist/receivers/verify-request.d.ts.map +1 -0
- package/dist/receivers/verify-request.js +98 -0
- package/dist/receivers/verify-request.js.map +1 -0
- package/dist/types/actions/block-action.d.ts +231 -0
- package/dist/types/actions/block-action.d.ts.map +1 -0
- package/dist/types/actions/block-action.js +3 -0
- package/dist/types/actions/block-action.js.map +1 -0
- package/dist/types/actions/dialog-action.d.ts +47 -0
- package/dist/types/actions/dialog-action.d.ts.map +1 -0
- package/dist/types/actions/dialog-action.js +3 -0
- package/dist/types/actions/dialog-action.js.map +1 -0
- package/dist/types/actions/index.d.ts +46 -0
- package/dist/types/actions/index.d.ts.map +1 -0
- package/dist/types/actions/index.js +17 -0
- package/dist/types/actions/index.js.map +1 -0
- package/dist/types/actions/interactive-message.d.ts +66 -0
- package/dist/types/actions/interactive-message.d.ts.map +1 -0
- package/dist/types/actions/interactive-message.js +3 -0
- package/dist/types/actions/interactive-message.js.map +1 -0
- package/dist/types/actions/workflow-step-edit.d.ts +49 -0
- package/dist/types/actions/workflow-step-edit.d.ts.map +1 -0
- package/dist/types/actions/workflow-step-edit.js +3 -0
- package/dist/types/actions/workflow-step-edit.js.map +1 -0
- package/dist/types/command/index.d.ts +36 -0
- package/dist/types/command/index.d.ts.map +1 -0
- package/dist/types/command/index.js +3 -0
- package/dist/types/command/index.js.map +1 -0
- package/dist/types/events/base-events.d.ts +699 -0
- package/dist/types/events/base-events.d.ts.map +1 -0
- package/dist/types/events/base-events.js +5 -0
- package/dist/types/events/base-events.js.map +1 -0
- package/dist/types/events/index.d.ts +63 -0
- package/dist/types/events/index.d.ts.map +1 -0
- package/dist/types/events/index.js +14 -0
- package/dist/types/events/index.js.map +1 -0
- package/dist/types/events/message-events.d.ts +312 -0
- package/dist/types/events/message-events.d.ts.map +1 -0
- package/dist/types/events/message-events.js +3 -0
- package/dist/types/events/message-events.js.map +1 -0
- package/dist/types/helpers.d.ts +17 -0
- package/dist/types/helpers.d.ts.map +1 -0
- package/dist/types/helpers.js +3 -0
- package/dist/types/helpers.js.map +1 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +22 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/middleware.d.ts +65 -0
- package/dist/types/middleware.d.ts.map +1 -0
- package/dist/types/middleware.js +14 -0
- package/dist/types/middleware.js.map +1 -0
- package/dist/types/options/index.d.ts +192 -0
- package/dist/types/options/index.d.ts.map +1 -0
- package/dist/types/options/index.js +3 -0
- package/dist/types/options/index.js.map +1 -0
- package/dist/types/receiver.d.ts +16 -0
- package/dist/types/receiver.d.ts.map +1 -0
- package/dist/types/receiver.js +3 -0
- package/dist/types/receiver.js.map +1 -0
- package/dist/types/shortcuts/global-shortcut.d.ts +29 -0
- package/dist/types/shortcuts/global-shortcut.d.ts.map +1 -0
- package/dist/types/shortcuts/global-shortcut.js +3 -0
- package/dist/types/shortcuts/global-shortcut.js.map +1 -0
- package/dist/types/shortcuts/index.d.ts +23 -0
- package/dist/types/shortcuts/index.d.ts.map +1 -0
- package/dist/types/shortcuts/index.js +16 -0
- package/dist/types/shortcuts/index.js.map +1 -0
- package/dist/types/shortcuts/message-shortcut.d.ts +43 -0
- package/dist/types/shortcuts/message-shortcut.d.ts.map +1 -0
- package/dist/types/shortcuts/message-shortcut.js +3 -0
- package/dist/types/shortcuts/message-shortcut.js.map +1 -0
- package/dist/types/utilities.d.ts +23 -0
- package/dist/types/utilities.d.ts.map +1 -0
- package/dist/types/utilities.js +3 -0
- package/dist/types/utilities.js.map +1 -0
- package/dist/types/view/index.d.ts +175 -0
- package/dist/types/view/index.d.ts.map +1 -0
- package/dist/types/view/index.js +3 -0
- package/dist/types/view/index.js.map +1 -0
- package/package.json +1 -1
- package/dist/package.json +0 -88
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable @typescript-eslint/dot-notation */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.directMention = exports.subtype = exports.ignoreSelf = exports.matchEventType = exports.matchCommandName = exports.matchMessage = exports.matchConstraints = exports.onlyViewActions = exports.onlyEvents = exports.onlyOptions = exports.onlyCommands = exports.onlyShortcuts = exports.onlyActions = void 0;
|
|
5
|
+
const errors_1 = require("../errors");
|
|
6
|
+
/**
|
|
7
|
+
* Middleware that filters out any event that isn't an action
|
|
8
|
+
*/
|
|
9
|
+
const onlyActions = async ({ action, next }) => {
|
|
10
|
+
// Filter out any non-actions
|
|
11
|
+
if (action === undefined) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
// It matches so we should continue down this middleware listener chain
|
|
15
|
+
await next();
|
|
16
|
+
};
|
|
17
|
+
exports.onlyActions = onlyActions;
|
|
18
|
+
/**
|
|
19
|
+
* Middleware that filters out any event that isn't a shortcut
|
|
20
|
+
*/
|
|
21
|
+
const onlyShortcuts = async ({ shortcut, next, }) => {
|
|
22
|
+
// Filter out any non-shortcuts
|
|
23
|
+
if (shortcut === undefined) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
// It matches so we should continue down this middleware listener chain
|
|
27
|
+
await next();
|
|
28
|
+
};
|
|
29
|
+
exports.onlyShortcuts = onlyShortcuts;
|
|
30
|
+
/**
|
|
31
|
+
* Middleware that filters out any event that isn't a command
|
|
32
|
+
*/
|
|
33
|
+
const onlyCommands = async ({ command, next }) => {
|
|
34
|
+
// Filter out any non-commands
|
|
35
|
+
if (command === undefined) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
// It matches so we should continue down this middleware listener chain
|
|
39
|
+
await next();
|
|
40
|
+
};
|
|
41
|
+
exports.onlyCommands = onlyCommands;
|
|
42
|
+
/**
|
|
43
|
+
* Middleware that filters out any event that isn't an options
|
|
44
|
+
*/
|
|
45
|
+
const onlyOptions = async ({ options, next }) => {
|
|
46
|
+
// Filter out any non-options requests
|
|
47
|
+
if (options === undefined) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
// It matches so we should continue down this middleware listener chain
|
|
51
|
+
await next();
|
|
52
|
+
};
|
|
53
|
+
exports.onlyOptions = onlyOptions;
|
|
54
|
+
/**
|
|
55
|
+
* Middleware that filters out any event that isn't an event
|
|
56
|
+
*/
|
|
57
|
+
const onlyEvents = async ({ event, next }) => {
|
|
58
|
+
// Filter out any non-events
|
|
59
|
+
if (event === undefined) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
// It matches so we should continue down this middleware listener chain
|
|
63
|
+
await next();
|
|
64
|
+
};
|
|
65
|
+
exports.onlyEvents = onlyEvents;
|
|
66
|
+
/**
|
|
67
|
+
* Middleware that filters out any event that isn't a view_submission or view_closed event
|
|
68
|
+
*/
|
|
69
|
+
const onlyViewActions = async ({ view, next }) => {
|
|
70
|
+
// Filter out anything that doesn't have a view
|
|
71
|
+
if (view === undefined) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
// It matches so we should continue down this middleware listener chain
|
|
75
|
+
await next();
|
|
76
|
+
};
|
|
77
|
+
exports.onlyViewActions = onlyViewActions;
|
|
78
|
+
/**
|
|
79
|
+
* Middleware that checks for matches given constraints
|
|
80
|
+
*/
|
|
81
|
+
function matchConstraints(constraints) {
|
|
82
|
+
return async ({ payload, body, next, context }) => {
|
|
83
|
+
// TODO: is putting matches in an array actually helpful? there's no way to know which of the regexps contributed
|
|
84
|
+
// which matches (and in which order)
|
|
85
|
+
let tempMatches;
|
|
86
|
+
// Narrow type for ActionConstraints
|
|
87
|
+
if ('block_id' in constraints || 'action_id' in constraints) {
|
|
88
|
+
if (!isBlockPayload(payload)) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
// Check block_id
|
|
92
|
+
if (constraints.block_id !== undefined) {
|
|
93
|
+
if (typeof constraints.block_id === 'string') {
|
|
94
|
+
if (payload.block_id !== constraints.block_id) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
tempMatches = payload.block_id.match(constraints.block_id);
|
|
100
|
+
if (tempMatches !== null) {
|
|
101
|
+
context['blockIdMatches'] = tempMatches;
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
// Check action_id
|
|
109
|
+
if (constraints.action_id !== undefined) {
|
|
110
|
+
if (typeof constraints.action_id === 'string') {
|
|
111
|
+
if (payload.action_id !== constraints.action_id) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
tempMatches = payload.action_id.match(constraints.action_id);
|
|
117
|
+
if (tempMatches !== null) {
|
|
118
|
+
context['actionIdMatches'] = tempMatches;
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
// Check callback_id
|
|
127
|
+
if ('callback_id' in constraints && constraints.callback_id !== undefined) {
|
|
128
|
+
let callbackId = '';
|
|
129
|
+
if (isViewBody(body)) {
|
|
130
|
+
callbackId = body['view']['callback_id'];
|
|
131
|
+
}
|
|
132
|
+
else if (isCallbackIdentifiedBody(body)) {
|
|
133
|
+
callbackId = body['callback_id'];
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
if (typeof constraints.callback_id === 'string') {
|
|
139
|
+
if (callbackId !== constraints.callback_id) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
tempMatches = callbackId.match(constraints.callback_id);
|
|
145
|
+
if (tempMatches !== null) {
|
|
146
|
+
context['callbackIdMatches'] = tempMatches;
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
// Check type
|
|
154
|
+
if ('type' in constraints) {
|
|
155
|
+
if (body.type !== constraints.type)
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
await next();
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
exports.matchConstraints = matchConstraints;
|
|
162
|
+
/*
|
|
163
|
+
* Middleware that filters out messages that don't match pattern
|
|
164
|
+
*/
|
|
165
|
+
function matchMessage(pattern) {
|
|
166
|
+
return async ({ event, context, next }) => {
|
|
167
|
+
let tempMatches;
|
|
168
|
+
if (!('text' in event) || event.text === undefined) {
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
// Filter out messages or app mentions that don't contain the pattern
|
|
172
|
+
if (typeof pattern === 'string') {
|
|
173
|
+
if (!event.text.includes(pattern)) {
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
tempMatches = event.text.match(pattern);
|
|
179
|
+
if (tempMatches !== null) {
|
|
180
|
+
context['matches'] = tempMatches;
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
await next();
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
exports.matchMessage = matchMessage;
|
|
190
|
+
/**
|
|
191
|
+
* Middleware that filters out any command that doesn't match the pattern
|
|
192
|
+
*/
|
|
193
|
+
function matchCommandName(pattern) {
|
|
194
|
+
return async ({ command, next }) => {
|
|
195
|
+
// Filter out any commands that do not match the correct command name or pattern
|
|
196
|
+
if (!matchesPattern(pattern, command.command)) {
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
await next();
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
exports.matchCommandName = matchCommandName;
|
|
203
|
+
function matchesPattern(pattern, candidate) {
|
|
204
|
+
if (typeof pattern === 'string') {
|
|
205
|
+
return pattern === candidate;
|
|
206
|
+
}
|
|
207
|
+
return pattern.test(candidate);
|
|
208
|
+
}
|
|
209
|
+
/*
|
|
210
|
+
* Middleware that filters out events that don't match pattern
|
|
211
|
+
*/
|
|
212
|
+
function matchEventType(pattern) {
|
|
213
|
+
return async ({ event, context, next }) => {
|
|
214
|
+
let tempMatches;
|
|
215
|
+
if (!('type' in event) || event.type === undefined) {
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
// Filter out events that don't contain the pattern
|
|
219
|
+
if (typeof pattern === 'string') {
|
|
220
|
+
if (event.type !== pattern) {
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
tempMatches = event.type.match(pattern);
|
|
226
|
+
if (tempMatches !== null) {
|
|
227
|
+
context['matches'] = tempMatches;
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
await next();
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
exports.matchEventType = matchEventType;
|
|
237
|
+
function ignoreSelf() {
|
|
238
|
+
return async (args) => {
|
|
239
|
+
const botId = args.context.botId;
|
|
240
|
+
const botUserId = args.context.botUserId !== undefined ? args.context.botUserId : undefined;
|
|
241
|
+
if (isEventArgs(args)) {
|
|
242
|
+
// Once we've narrowed the type down to SlackEventMiddlewareArgs, there's no way to further narrow it down to
|
|
243
|
+
// SlackEventMiddlewareArgs<'message'> without a cast, so the following couple lines do that.
|
|
244
|
+
if (args.message !== undefined) {
|
|
245
|
+
const message = args.message;
|
|
246
|
+
// TODO: revisit this once we have all the message subtypes defined to see if we can do this better with
|
|
247
|
+
// type narrowing
|
|
248
|
+
// Look for an event that is identified as a bot message from the same bot ID as this app, and return to skip
|
|
249
|
+
if (message.subtype === 'bot_message' && message.bot_id === botId) {
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
// Its an Events API event that isn't of type message, but the user ID might match our own app. Filter these out.
|
|
254
|
+
// However, some events still must be fired, because they can make sense.
|
|
255
|
+
const eventsWhichShouldBeKept = ['member_joined_channel', 'member_left_channel'];
|
|
256
|
+
const isEventShouldBeKept = eventsWhichShouldBeKept.includes(args.event.type);
|
|
257
|
+
if (botUserId !== undefined && 'user' in args.event && args.event.user === botUserId && !isEventShouldBeKept) {
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
// If all the previous checks didn't skip this message, then its okay to resume to next
|
|
262
|
+
await args.next();
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
exports.ignoreSelf = ignoreSelf;
|
|
266
|
+
function subtype(subtype1) {
|
|
267
|
+
return async ({ message, next }) => {
|
|
268
|
+
if (message.subtype === subtype1) {
|
|
269
|
+
await next();
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
exports.subtype = subtype;
|
|
274
|
+
const slackLink = /<(?<type>[@#!])?(?<link>[^>|]+)(?:\|(?<label>[^>]+))?>/;
|
|
275
|
+
function directMention() {
|
|
276
|
+
return async ({ message, context, next }) => {
|
|
277
|
+
// When context does not have a botUserId in it, then this middleware cannot perform its job. Bail immediately.
|
|
278
|
+
if (context.botUserId === undefined) {
|
|
279
|
+
throw new errors_1.ContextMissingPropertyError('botUserId', 'Cannot match direct mentions of the app without a bot user ID. Ensure authorize callback returns a botUserId.');
|
|
280
|
+
}
|
|
281
|
+
if (!('text' in message) || message.text === undefined) {
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
// Match the message text with a user mention format
|
|
285
|
+
const text = message.text.trim();
|
|
286
|
+
const matches = slackLink.exec(text);
|
|
287
|
+
if (matches === null || // stop when no matches are found
|
|
288
|
+
matches.index !== 0 || // stop if match isn't at the beginning
|
|
289
|
+
// stop if match isn't a user mention with the right user ID
|
|
290
|
+
matches.groups === undefined ||
|
|
291
|
+
matches.groups.type !== '@' ||
|
|
292
|
+
matches.groups.link !== context.botUserId) {
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
await next();
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
exports.directMention = directMention;
|
|
299
|
+
function isBlockPayload(payload) {
|
|
300
|
+
return payload.action_id !== undefined;
|
|
301
|
+
}
|
|
302
|
+
function isCallbackIdentifiedBody(body) {
|
|
303
|
+
return body.callback_id !== undefined;
|
|
304
|
+
}
|
|
305
|
+
function isViewBody(body) {
|
|
306
|
+
return body.view !== undefined;
|
|
307
|
+
}
|
|
308
|
+
function isEventArgs(args) {
|
|
309
|
+
return args.event !== undefined;
|
|
310
|
+
}
|
|
311
|
+
//# sourceMappingURL=builtin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builtin.js","sourceRoot":"","sources":["../../src/middleware/builtin.ts"],"names":[],"mappings":";AAAA,oDAAoD;;;AA6BpD,s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C,IAAI,KAAK,GAAG;YAC3B,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,OAAO,CAAC,SAAS,EACzC;YACA,OAAO;SACR;QAED,MAAM,IAAI,EAAE,CAAC;IACf,CAAC,CAAC;AACJ,CAAC;AA/BD,sCA+BC;AAED,SAAS,cAAc,CACrB,OAGoC;IAEpC,OAAQ,OAAgD,CAAC,SAAS,KAAK,SAAS,CAAC;AACnF,CAAC;AAUD,SAAS,wBAAwB,CAC/B,IAAkH;IAElH,OAAQ,IAA+B,CAAC,WAAW,KAAK,SAAS,CAAC;AACpE,CAAC;AAED,SAAS,UAAU,CACjB,IAA8G;IAE9G,OAAQ,IAAwB,CAAC,IAAI,KAAK,SAAS,CAAC;AACtD,CAAC;AAED,SAAS,WAAW,CAAC,IAAuB;IAC1C,OAAQ,IAAiC,CAAC,KAAK,KAAK,SAAS,CAAC;AAChE,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { WebClient } from '@slack/web-api';
|
|
2
|
+
import { Logger } from '@slack/logger';
|
|
3
|
+
import { Middleware, AnyMiddlewareArgs, Context } from '../types';
|
|
4
|
+
export default function processMiddleware(middleware: Middleware<AnyMiddlewareArgs>[], initialArgs: AnyMiddlewareArgs, context: Context, client: WebClient, logger: Logger, last: () => Promise<void>): Promise<void>;
|
|
5
|
+
//# sourceMappingURL=process.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process.d.ts","sourceRoot":"","sources":["../../src/middleware/process.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAElE,wBAA8B,iBAAiB,CAC7C,UAAU,EAAE,UAAU,CAAC,iBAAiB,CAAC,EAAE,EAC3C,WAAW,EAAE,iBAAiB,EAC9B,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GACxB,OAAO,CAAC,IAAI,CAAC,CAwBf"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
async function processMiddleware(middleware, initialArgs, context, client, logger, last) {
|
|
4
|
+
let lastCalledMiddlewareIndex = -1;
|
|
5
|
+
async function invokeMiddleware(toCallMiddlewareIndex) {
|
|
6
|
+
if (lastCalledMiddlewareIndex >= toCallMiddlewareIndex) {
|
|
7
|
+
// TODO: use a coded error
|
|
8
|
+
throw Error('next() called multiple times');
|
|
9
|
+
}
|
|
10
|
+
if (toCallMiddlewareIndex < middleware.length) {
|
|
11
|
+
lastCalledMiddlewareIndex = toCallMiddlewareIndex;
|
|
12
|
+
return middleware[toCallMiddlewareIndex]({
|
|
13
|
+
next: () => invokeMiddleware(toCallMiddlewareIndex + 1),
|
|
14
|
+
...initialArgs,
|
|
15
|
+
context,
|
|
16
|
+
client,
|
|
17
|
+
logger,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return last();
|
|
21
|
+
}
|
|
22
|
+
return invokeMiddleware(0);
|
|
23
|
+
}
|
|
24
|
+
exports.default = processMiddleware;
|
|
25
|
+
//# sourceMappingURL=process.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process.js","sourceRoot":"","sources":["../../src/middleware/process.ts"],"names":[],"mappings":";;AAIe,KAAK,UAAU,iBAAiB,CAC7C,UAA2C,EAC3C,WAA8B,EAC9B,OAAgB,EAChB,MAAiB,EACjB,MAAc,EACd,IAAyB;IAEzB,IAAI,yBAAyB,GAAG,CAAC,CAAC,CAAC;IAEnC,KAAK,UAAU,gBAAgB,CAAC,qBAA6B;QAC3D,IAAI,yBAAyB,IAAI,qBAAqB,EAAE;YACtD,0BAA0B;YAC1B,MAAM,KAAK,CAAC,8BAA8B,CAAC,CAAC;SAC7C;QAED,IAAI,qBAAqB,GAAG,UAAU,CAAC,MAAM,EAAE;YAC7C,yBAAyB,GAAG,qBAAqB,CAAC;YAClD,OAAO,UAAU,CAAC,qBAAqB,CAAC,CAAC;gBACvC,IAAI,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,qBAAqB,GAAG,CAAC,CAAC;gBACvD,GAAG,WAAW;gBACd,OAAO;gBACP,MAAM;gBACN,MAAM;aACP,CAAC,CAAC;SACJ;QAED,OAAO,IAAI,EAAE,CAAC;IAChB,CAAC;IAED,OAAO,gBAAgB,CAAC,CAAC,CAAC,CAAC;AAC7B,CAAC;AA/BD,oCA+BC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Logger, LogLevel } from '@slack/logger';
|
|
2
|
+
import App from '../App';
|
|
3
|
+
import { Receiver } from '../types/receiver';
|
|
4
|
+
import { StringIndexed } from '../types/helpers';
|
|
5
|
+
export interface AwsEvent {
|
|
6
|
+
body: string | null;
|
|
7
|
+
headers: any;
|
|
8
|
+
multiValueHeaders: any;
|
|
9
|
+
httpMethod: string;
|
|
10
|
+
isBase64Encoded: boolean;
|
|
11
|
+
path: string;
|
|
12
|
+
pathParameters: any | null;
|
|
13
|
+
queryStringParameters: any | null;
|
|
14
|
+
multiValueQueryStringParameters: any | null;
|
|
15
|
+
stageVariables: any | null;
|
|
16
|
+
requestContext: any;
|
|
17
|
+
resource: string;
|
|
18
|
+
}
|
|
19
|
+
export declare type AwsCallback = (error?: Error | string | null, result?: any) => void;
|
|
20
|
+
export interface AwsResponse {
|
|
21
|
+
statusCode: number;
|
|
22
|
+
headers?: {
|
|
23
|
+
[header: string]: boolean | number | string;
|
|
24
|
+
};
|
|
25
|
+
multiValueHeaders?: {
|
|
26
|
+
[header: string]: Array<boolean | number | string>;
|
|
27
|
+
};
|
|
28
|
+
body: string;
|
|
29
|
+
isBase64Encoded?: boolean;
|
|
30
|
+
}
|
|
31
|
+
export declare type AwsHandler = (event: AwsEvent, context: any, callback: AwsCallback) => Promise<AwsResponse>;
|
|
32
|
+
export interface AwsLambdaReceiverOptions {
|
|
33
|
+
signingSecret: string;
|
|
34
|
+
logger?: Logger;
|
|
35
|
+
logLevel?: LogLevel;
|
|
36
|
+
customPropertiesExtractor?: (request: AwsEvent) => StringIndexed;
|
|
37
|
+
}
|
|
38
|
+
export default class AwsLambdaReceiver implements Receiver {
|
|
39
|
+
private signingSecret;
|
|
40
|
+
private app?;
|
|
41
|
+
private logger;
|
|
42
|
+
private customPropertiesExtractor;
|
|
43
|
+
constructor({ signingSecret, logger, logLevel, customPropertiesExtractor, }: AwsLambdaReceiverOptions);
|
|
44
|
+
init(app: App): void;
|
|
45
|
+
start(..._args: any[]): Promise<AwsHandler>;
|
|
46
|
+
stop(..._args: any[]): Promise<void>;
|
|
47
|
+
toHandler(): AwsHandler;
|
|
48
|
+
private getRawBody;
|
|
49
|
+
private parseRequestBody;
|
|
50
|
+
private isValidRequestSignature;
|
|
51
|
+
private getHeaderValue;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=AwsLambdaReceiver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AwsLambdaReceiver.d.ts","sourceRoot":"","sources":["../../src/receivers/AwsLambdaReceiver.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAiB,QAAQ,EAAE,MAAM,eAAe,CAAC;AAIhE,OAAO,GAAG,MAAM,QAAQ,CAAC;AACzB,OAAO,EAAE,QAAQ,EAAiB,MAAM,mBAAmB,CAAC;AAE5D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,OAAO,EAAE,GAAG,CAAC;IACb,iBAAiB,EAAE,GAAG,CAAC;IACvB,UAAU,EAAE,MAAM,CAA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CAAC,GAAG,CAAC,CAAM;IAElB,OAAO,CAAC,MAAM,CAAS;IAEvB,OAAO,CAAC,yBAAyB,CAAuC;gBAErD,EACjB,aAAa,EACb,MAAkB,EAClB,QAAwB,EACxB,yBAAuC,GACxC,EAAE,wBAAwB;IAYpB,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI;IAIpB,KAAK,CACV,GAAG,KAAK,EAAE,GAAG,EAAE,GACd,OAAO,CAAC,UAAU,CAAC;IAYf,IAAI,CACT,GAAG,KAAK,EAAE,GAAG,EAAE,GACd,OAAO,CAAC,IAAI,CAAC;IAMT,SAAS,IAAI,UAAU;IAsG9B,OAAO,CAAC,UAAU;IAWlB,OAAO,CAAC,gBAAgB;IAuBxB,OAAO,CAAC,uBAAuB;IA4B/B,OAAO,CAAC,cAAc;CAIvB"}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
7
|
+
const logger_1 = require("@slack/logger");
|
|
8
|
+
const querystring_1 = __importDefault(require("querystring"));
|
|
9
|
+
const crypto_1 = __importDefault(require("crypto"));
|
|
10
|
+
const tsscmp_1 = __importDefault(require("tsscmp"));
|
|
11
|
+
const errors_1 = require("../errors");
|
|
12
|
+
/*
|
|
13
|
+
* Receiver implementation for AWS API Gateway + Lambda apps
|
|
14
|
+
*
|
|
15
|
+
* Note that this receiver does not support Slack OAuth flow.
|
|
16
|
+
* For OAuth flow endpoints, deploy another Lambda function built with ExpressReceiver.
|
|
17
|
+
*/
|
|
18
|
+
class AwsLambdaReceiver {
|
|
19
|
+
constructor({ signingSecret, logger = undefined, logLevel = logger_1.LogLevel.INFO, customPropertiesExtractor = (_) => ({}), }) {
|
|
20
|
+
// Initialize instance variables, substituting defaults for each value
|
|
21
|
+
this.signingSecret = signingSecret;
|
|
22
|
+
this.logger = logger !== null && logger !== void 0 ? logger : (() => {
|
|
23
|
+
const defaultLogger = new logger_1.ConsoleLogger();
|
|
24
|
+
defaultLogger.setLevel(logLevel);
|
|
25
|
+
return defaultLogger;
|
|
26
|
+
})();
|
|
27
|
+
this.customPropertiesExtractor = customPropertiesExtractor;
|
|
28
|
+
}
|
|
29
|
+
init(app) {
|
|
30
|
+
this.app = app;
|
|
31
|
+
}
|
|
32
|
+
start(..._args) {
|
|
33
|
+
return new Promise((resolve, reject) => {
|
|
34
|
+
try {
|
|
35
|
+
const handler = this.toHandler();
|
|
36
|
+
resolve(handler);
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
reject(error);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
// eslint-disable-next-line class-methods-use-this
|
|
44
|
+
stop(..._args) {
|
|
45
|
+
return new Promise((resolve, _reject) => {
|
|
46
|
+
resolve();
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
toHandler() {
|
|
50
|
+
return async (awsEvent, _awsContext, _awsCallback) => {
|
|
51
|
+
var _a;
|
|
52
|
+
this.logger.debug(`AWS event: ${JSON.stringify(awsEvent, null, 2)}`);
|
|
53
|
+
const rawBody = this.getRawBody(awsEvent);
|
|
54
|
+
const body = this.parseRequestBody(rawBody, this.getHeaderValue(awsEvent.headers, 'Content-Type'), this.logger);
|
|
55
|
+
// ssl_check (for Slash Commands)
|
|
56
|
+
if (typeof body !== 'undefined' &&
|
|
57
|
+
body != null &&
|
|
58
|
+
typeof body.ssl_check !== 'undefined' &&
|
|
59
|
+
body.ssl_check != null) {
|
|
60
|
+
return Promise.resolve({ statusCode: 200, body: '' });
|
|
61
|
+
}
|
|
62
|
+
// request signature verification
|
|
63
|
+
const signature = this.getHeaderValue(awsEvent.headers, 'X-Slack-Signature');
|
|
64
|
+
const ts = Number(this.getHeaderValue(awsEvent.headers, 'X-Slack-Request-Timestamp'));
|
|
65
|
+
if (!this.isValidRequestSignature(this.signingSecret, rawBody, signature, ts)) {
|
|
66
|
+
return Promise.resolve({ statusCode: 401, body: '' });
|
|
67
|
+
}
|
|
68
|
+
// url_verification (Events API)
|
|
69
|
+
if (typeof body !== 'undefined' &&
|
|
70
|
+
body != null &&
|
|
71
|
+
typeof body.type !== 'undefined' &&
|
|
72
|
+
body.type != null &&
|
|
73
|
+
body.type === 'url_verification') {
|
|
74
|
+
return Promise.resolve({
|
|
75
|
+
statusCode: 200,
|
|
76
|
+
headers: { 'Content-Type': 'application/json' },
|
|
77
|
+
body: JSON.stringify({ challenge: body.challenge }),
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
// Setup ack timeout warning
|
|
81
|
+
let isAcknowledged = false;
|
|
82
|
+
setTimeout(() => {
|
|
83
|
+
if (!isAcknowledged) {
|
|
84
|
+
this.logger.error('An incoming event was not acknowledged within 3 seconds. ' +
|
|
85
|
+
'Ensure that the ack() argument is called in a listener.');
|
|
86
|
+
}
|
|
87
|
+
}, 3001);
|
|
88
|
+
// Structure the ReceiverEvent
|
|
89
|
+
let storedResponse;
|
|
90
|
+
const event = {
|
|
91
|
+
body,
|
|
92
|
+
ack: async (response) => {
|
|
93
|
+
if (isAcknowledged) {
|
|
94
|
+
throw new errors_1.ReceiverMultipleAckError();
|
|
95
|
+
}
|
|
96
|
+
isAcknowledged = true;
|
|
97
|
+
if (typeof response === 'undefined' || response == null) {
|
|
98
|
+
storedResponse = '';
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
storedResponse = response;
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
retryNum: this.getHeaderValue(awsEvent.headers, 'X-Slack-Retry-Num'),
|
|
105
|
+
retryReason: this.getHeaderValue(awsEvent.headers, 'X-Slack-Retry-Reason'),
|
|
106
|
+
customProperties: this.customPropertiesExtractor(awsEvent),
|
|
107
|
+
};
|
|
108
|
+
// Send the event to the app for processing
|
|
109
|
+
try {
|
|
110
|
+
await ((_a = this.app) === null || _a === void 0 ? void 0 : _a.processEvent(event));
|
|
111
|
+
if (storedResponse !== undefined) {
|
|
112
|
+
if (typeof storedResponse === 'string') {
|
|
113
|
+
return { statusCode: 200, body: storedResponse };
|
|
114
|
+
}
|
|
115
|
+
return {
|
|
116
|
+
statusCode: 200,
|
|
117
|
+
headers: { 'Content-Type': 'application/json' },
|
|
118
|
+
body: JSON.stringify(storedResponse),
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
catch (err) {
|
|
123
|
+
this.logger.error('An unhandled error occurred while Bolt processed an event');
|
|
124
|
+
this.logger.debug(`Error details: ${err}, storedResponse: ${storedResponse}`);
|
|
125
|
+
return { statusCode: 500, body: 'Internal server error' };
|
|
126
|
+
}
|
|
127
|
+
return { statusCode: 404, body: '' };
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
// eslint-disable-next-line class-methods-use-this
|
|
131
|
+
getRawBody(awsEvent) {
|
|
132
|
+
if (typeof awsEvent.body === 'undefined' || awsEvent.body == null) {
|
|
133
|
+
return '';
|
|
134
|
+
}
|
|
135
|
+
if (awsEvent.isBase64Encoded) {
|
|
136
|
+
return Buffer.from(awsEvent.body, 'base64').toString('ascii');
|
|
137
|
+
}
|
|
138
|
+
return awsEvent.body;
|
|
139
|
+
}
|
|
140
|
+
// eslint-disable-next-line class-methods-use-this
|
|
141
|
+
parseRequestBody(stringBody, contentType, logger) {
|
|
142
|
+
if (contentType === 'application/x-www-form-urlencoded') {
|
|
143
|
+
const parsedBody = querystring_1.default.parse(stringBody);
|
|
144
|
+
if (typeof parsedBody.payload === 'string') {
|
|
145
|
+
return JSON.parse(parsedBody.payload);
|
|
146
|
+
}
|
|
147
|
+
return parsedBody;
|
|
148
|
+
}
|
|
149
|
+
if (contentType === 'application/json') {
|
|
150
|
+
return JSON.parse(stringBody);
|
|
151
|
+
}
|
|
152
|
+
logger.warn(`Unexpected content-type detected: ${contentType}`);
|
|
153
|
+
try {
|
|
154
|
+
// Parse this body anyway
|
|
155
|
+
return JSON.parse(stringBody);
|
|
156
|
+
}
|
|
157
|
+
catch (e) {
|
|
158
|
+
logger.error(`Failed to parse body as JSON data for content-type: ${contentType}`);
|
|
159
|
+
throw e;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
// eslint-disable-next-line class-methods-use-this
|
|
163
|
+
isValidRequestSignature(signingSecret, body, signature, requestTimestamp) {
|
|
164
|
+
if (!signature || !requestTimestamp) {
|
|
165
|
+
return false;
|
|
166
|
+
}
|
|
167
|
+
// Divide current date to match Slack ts format
|
|
168
|
+
// Subtract 5 minutes from current time
|
|
169
|
+
const fiveMinutesAgo = Math.floor(Date.now() / 1000) - 60 * 5;
|
|
170
|
+
if (requestTimestamp < fiveMinutesAgo) {
|
|
171
|
+
return false;
|
|
172
|
+
}
|
|
173
|
+
const hmac = crypto_1.default.createHmac('sha256', signingSecret);
|
|
174
|
+
const [version, hash] = signature.split('=');
|
|
175
|
+
hmac.update(`${version}:${requestTimestamp}:${body}`);
|
|
176
|
+
if (!(0, tsscmp_1.default)(hash, hmac.digest('hex'))) {
|
|
177
|
+
return false;
|
|
178
|
+
}
|
|
179
|
+
return true;
|
|
180
|
+
}
|
|
181
|
+
// eslint-disable-next-line class-methods-use-this
|
|
182
|
+
getHeaderValue(headers, key) {
|
|
183
|
+
const caseInsensitiveKey = Object.keys(headers).find((it) => key.toLowerCase() === it.toLowerCase());
|
|
184
|
+
return caseInsensitiveKey !== undefined ? headers[caseInsensitiveKey] : undefined;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
exports.default = AwsLambdaReceiver;
|
|
188
|
+
//# sourceMappingURL=AwsLambdaReceiver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AwsLambdaReceiver.js","sourceRoot":"","sources":["../../src/receivers/AwsLambdaReceiver.ts"],"names":[],"mappings":";;;;;A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