@slack/bolt 4.0.0-rc.1 → 4.0.0-rc.2
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/README.md +22 -16
- package/dist/App.d.ts +32 -48
- package/dist/App.d.ts.map +1 -1
- package/dist/App.js +174 -86
- package/dist/App.js.map +1 -1
- package/dist/CustomFunction.d.ts +58 -0
- package/dist/CustomFunction.d.ts.map +1 -0
- package/dist/CustomFunction.js +144 -0
- package/dist/CustomFunction.js.map +1 -0
- package/dist/WorkflowStep.d.ts +89 -36
- package/dist/WorkflowStep.d.ts.map +1 -1
- package/dist/WorkflowStep.js +29 -8
- package/dist/WorkflowStep.js.map +1 -1
- package/dist/conversation-store.d.ts +1 -1
- package/dist/conversation-store.d.ts.map +1 -1
- package/dist/conversation-store.js +3 -3
- package/dist/conversation-store.js.map +1 -1
- package/dist/errors.d.ts +19 -2
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +45 -32
- package/dist/errors.js.map +1 -1
- package/dist/helpers.d.ts +2 -2
- package/dist/helpers.d.ts.map +1 -1
- package/dist/helpers.js +5 -4
- package/dist/helpers.js.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -9
- package/dist/index.js.map +1 -1
- package/dist/middleware/builtin.d.ts +19 -22
- package/dist/middleware/builtin.d.ts.map +1 -1
- package/dist/middleware/builtin.js +93 -111
- package/dist/middleware/builtin.js.map +1 -1
- package/dist/middleware/process.d.ts +3 -3
- package/dist/middleware/process.d.ts.map +1 -1
- package/dist/middleware/process.js +1 -1
- package/dist/middleware/process.js.map +1 -1
- package/dist/receivers/AwsLambdaReceiver.d.ts +77 -16
- package/dist/receivers/AwsLambdaReceiver.d.ts.map +1 -1
- package/dist/receivers/AwsLambdaReceiver.js +53 -25
- package/dist/receivers/AwsLambdaReceiver.js.map +1 -1
- package/dist/receivers/BufferedIncomingMessage.d.ts +2 -1
- package/dist/receivers/BufferedIncomingMessage.d.ts.map +1 -1
- package/dist/receivers/ExpressReceiver.d.ts +13 -13
- package/dist/receivers/ExpressReceiver.d.ts.map +1 -1
- package/dist/receivers/ExpressReceiver.js +70 -70
- package/dist/receivers/ExpressReceiver.js.map +1 -1
- package/dist/receivers/HTTPModuleFunctions.d.ts +18 -20
- package/dist/receivers/HTTPModuleFunctions.d.ts.map +1 -1
- package/dist/receivers/HTTPModuleFunctions.js +187 -181
- package/dist/receivers/HTTPModuleFunctions.js.map +1 -1
- package/dist/receivers/HTTPReceiver.d.ts +14 -14
- package/dist/receivers/HTTPReceiver.d.ts.map +1 -1
- package/dist/receivers/HTTPReceiver.js +92 -44
- package/dist/receivers/HTTPReceiver.js.map +1 -1
- package/dist/receivers/HTTPResponseAck.d.ts +7 -7
- package/dist/receivers/HTTPResponseAck.d.ts.map +1 -1
- package/dist/receivers/HTTPResponseAck.js +37 -5
- package/dist/receivers/HTTPResponseAck.js.map +1 -1
- package/dist/receivers/ParamsIncomingMessage.d.ts +2 -2
- package/dist/receivers/ParamsIncomingMessage.d.ts.map +1 -1
- package/dist/receivers/SocketModeFunctions.d.ts +3 -5
- package/dist/receivers/SocketModeFunctions.d.ts.map +1 -1
- package/dist/receivers/SocketModeFunctions.js +14 -23
- package/dist/receivers/SocketModeFunctions.js.map +1 -1
- package/dist/receivers/SocketModeReceiver.d.ts +9 -9
- package/dist/receivers/SocketModeReceiver.d.ts.map +1 -1
- package/dist/receivers/SocketModeReceiver.js +29 -21
- package/dist/receivers/SocketModeReceiver.js.map +1 -1
- package/dist/receivers/custom-routes.d.ts +2 -2
- package/dist/receivers/custom-routes.d.ts.map +1 -1
- package/dist/receivers/custom-routes.js +10 -9
- package/dist/receivers/custom-routes.js.map +1 -1
- package/dist/receivers/verify-redirect-opts.d.ts +1 -1
- package/dist/receivers/verify-redirect-opts.d.ts.map +1 -1
- package/dist/receivers/verify-redirect-opts.js +3 -3
- package/dist/receivers/verify-redirect-opts.js.map +1 -1
- package/dist/receivers/verify-request.d.ts +1 -12
- package/dist/receivers/verify-request.d.ts.map +1 -1
- package/dist/receivers/verify-request.js +4 -18
- package/dist/receivers/verify-request.js.map +1 -1
- package/dist/types/actions/block-action.d.ts +17 -17
- package/dist/types/actions/block-action.d.ts.map +1 -1
- package/dist/types/actions/index.d.ts +25 -11
- package/dist/types/actions/index.d.ts.map +1 -1
- package/dist/types/actions/index.js +1 -0
- package/dist/types/actions/index.js.map +1 -1
- package/dist/types/actions/interactive-message.d.ts +3 -3
- package/dist/types/actions/interactive-message.d.ts.map +1 -1
- package/dist/types/actions/workflow-step-edit.d.ts +7 -7
- package/dist/types/actions/workflow-step-edit.d.ts.map +1 -1
- package/dist/types/command/index.d.ts +1 -2
- package/dist/types/command/index.d.ts.map +1 -1
- package/dist/types/events/index.d.ts +26 -24
- package/dist/types/events/index.d.ts.map +1 -1
- package/dist/types/events/index.js +4 -15
- package/dist/types/events/index.js.map +1 -1
- package/dist/types/middleware.d.ts +26 -14
- package/dist/types/middleware.d.ts.map +1 -1
- package/dist/types/middleware.js +3 -0
- package/dist/types/middleware.js.map +1 -1
- package/dist/types/options/index.d.ts +16 -51
- package/dist/types/options/index.d.ts.map +1 -1
- package/dist/types/receiver.d.ts +3 -3
- package/dist/types/receiver.d.ts.map +1 -1
- package/dist/types/shortcuts/global-shortcut.d.ts.map +1 -1
- package/dist/types/shortcuts/index.d.ts +14 -9
- package/dist/types/shortcuts/index.d.ts.map +1 -1
- package/dist/types/shortcuts/message-shortcut.d.ts.map +1 -1
- package/dist/types/utilities.d.ts +27 -18
- package/dist/types/utilities.d.ts.map +1 -1
- package/dist/types/utilities.js +7 -0
- package/dist/types/utilities.js.map +1 -1
- package/dist/types/view/index.d.ts +15 -7
- package/dist/types/view/index.d.ts.map +1 -1
- package/package.json +27 -41
- package/dist/WorkflowFunction.d.ts +0 -63
- package/dist/WorkflowFunction.d.ts.map +0 -1
- package/dist/WorkflowFunction.js +0 -130
- package/dist/WorkflowFunction.js.map +0 -1
- package/dist/receivers/http-utils.d.ts +0 -5
- package/dist/receivers/http-utils.d.ts.map +0 -1
- package/dist/receivers/http-utils.js +0 -19
- package/dist/receivers/http-utils.js.map +0 -1
- package/dist/receivers/render-html-for-install-path.d.ts +0 -3
- package/dist/receivers/render-html-for-install-path.d.ts.map +0 -1
- package/dist/receivers/render-html-for-install-path.js +0 -32
- package/dist/receivers/render-html-for-install-path.js.map +0 -1
- package/dist/types/events/base-events.d.ts +0 -1187
- package/dist/types/events/base-events.d.ts.map +0 -1
- package/dist/types/events/base-events.js +0 -5
- package/dist/types/events/base-events.js.map +0 -1
- package/dist/types/events/message-events.d.ts +0 -348
- package/dist/types/events/message-events.d.ts.map +0 -1
- package/dist/types/events/message-events.js +0 -3
- package/dist/types/events/message-events.js.map +0 -1
- package/dist/types/helpers.d.ts +0 -17
- package/dist/types/helpers.d.ts.map +0 -1
- package/dist/types/helpers.js +0 -3
- package/dist/types/helpers.js.map +0 -1
|
@@ -1,32 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const http_1 = require("http");
|
|
6
|
-
const socket_mode_1 = require("@slack/socket-mode");
|
|
3
|
+
const node_http_1 = require("node:http");
|
|
4
|
+
const node_url_1 = require("node:url");
|
|
7
5
|
const logger_1 = require("@slack/logger");
|
|
8
6
|
const oauth_1 = require("@slack/oauth");
|
|
7
|
+
const socket_mode_1 = require("@slack/socket-mode");
|
|
9
8
|
const path_to_regexp_1 = require("path-to-regexp");
|
|
9
|
+
const SocketModeFunctions_1 = require("./SocketModeFunctions");
|
|
10
10
|
const custom_routes_1 = require("./custom-routes");
|
|
11
11
|
const verify_redirect_opts_1 = require("./verify-redirect-opts");
|
|
12
|
-
const SocketModeFunctions_1 = require("./SocketModeFunctions");
|
|
13
12
|
/**
|
|
14
13
|
* Receives Events, Slash Commands, and Actions of a web socket connection
|
|
15
14
|
*/
|
|
16
15
|
class SocketModeReceiver {
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
/* Express app */
|
|
17
|
+
client;
|
|
18
|
+
app;
|
|
19
|
+
logger;
|
|
20
|
+
installer = undefined;
|
|
21
|
+
httpServer;
|
|
22
|
+
httpServerPort;
|
|
23
|
+
routes;
|
|
24
|
+
processEventErrorHandler;
|
|
25
|
+
constructor({ appToken, logger = undefined, logLevel = logger_1.LogLevel.INFO, clientId = undefined, clientSecret = undefined, stateSecret = undefined, redirectUri = undefined, installationStore = undefined, scopes = undefined, installerOptions = {}, customRoutes = [], customPropertiesExtractor = (_args) => ({}), processEventErrorHandler = SocketModeFunctions_1.defaultProcessEventErrorHandler, }) {
|
|
19
26
|
this.client = new socket_mode_1.SocketModeClient({
|
|
20
27
|
appToken,
|
|
21
28
|
logLevel,
|
|
22
29
|
logger,
|
|
23
30
|
clientOptions: installerOptions.clientOptions,
|
|
24
31
|
});
|
|
25
|
-
this.logger =
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
32
|
+
this.logger =
|
|
33
|
+
logger ??
|
|
34
|
+
(() => {
|
|
35
|
+
const defaultLogger = new logger_1.ConsoleLogger();
|
|
36
|
+
defaultLogger.setLevel(logLevel);
|
|
37
|
+
return defaultLogger;
|
|
38
|
+
})();
|
|
30
39
|
this.routes = (0, custom_routes_1.buildReceiverRoutes)(customRoutes);
|
|
31
40
|
this.processEventErrorHandler = processEventErrorHandler;
|
|
32
41
|
// Verify redirect options if supplied, throws coded error if invalid
|
|
@@ -43,7 +52,7 @@ class SocketModeReceiver {
|
|
|
43
52
|
stateSecret,
|
|
44
53
|
installationStore,
|
|
45
54
|
logLevel,
|
|
46
|
-
logger,
|
|
55
|
+
logger, // pass logger that was passed in constructor, not one created locally
|
|
47
56
|
directInstall: installerOptions.directInstall,
|
|
48
57
|
stateStore: installerOptions.stateStore,
|
|
49
58
|
stateVerification: installerOptions.stateVerification,
|
|
@@ -60,21 +69,21 @@ class SocketModeReceiver {
|
|
|
60
69
|
if (this.installer !== undefined || customRoutes.length) {
|
|
61
70
|
const installPath = installerOptions.installPath === undefined ? '/slack/install' : installerOptions.installPath;
|
|
62
71
|
this.httpServerPort = installerOptions.port === undefined ? 3000 : installerOptions.port;
|
|
63
|
-
this.httpServer = (0,
|
|
64
|
-
//
|
|
72
|
+
this.httpServer = (0, node_http_1.createServer)(async (req, res) => {
|
|
73
|
+
// biome-ignore lint/style/noNonNullAssertion: method should always be defined for an HTTP request right?
|
|
65
74
|
const method = req.method.toUpperCase();
|
|
66
75
|
// Handle OAuth-related requests
|
|
67
76
|
if (this.installer) {
|
|
68
77
|
// create install url options
|
|
69
78
|
const installUrlOptions = {
|
|
70
79
|
metadata: installerOptions.metadata,
|
|
71
|
-
scopes: scopes
|
|
80
|
+
scopes: scopes ?? [],
|
|
72
81
|
userScopes: installerOptions.userScopes,
|
|
73
82
|
redirectUri,
|
|
74
83
|
};
|
|
75
84
|
// Installation has been initiated
|
|
76
85
|
const redirectUriPath = installerOptions.redirectUriPath === undefined ? '/slack/oauth_redirect' : installerOptions.redirectUriPath;
|
|
77
|
-
if (req.url
|
|
86
|
+
if (req.url?.startsWith(redirectUriPath)) {
|
|
78
87
|
const { stateVerification, callbackOptions } = installerOptions;
|
|
79
88
|
if (stateVerification === false) {
|
|
80
89
|
// if stateVerification is disabled make install options available to handler
|
|
@@ -87,7 +96,7 @@ class SocketModeReceiver {
|
|
|
87
96
|
return;
|
|
88
97
|
}
|
|
89
98
|
// Visiting the installation endpoint
|
|
90
|
-
if (req.url
|
|
99
|
+
if (req.url?.startsWith(installPath)) {
|
|
91
100
|
const { installPathOptions } = installerOptions;
|
|
92
101
|
await this.installer.handleInstallPath(req, res, installPathOptions, installUrlOptions);
|
|
93
102
|
return;
|
|
@@ -97,7 +106,7 @@ class SocketModeReceiver {
|
|
|
97
106
|
if (customRoutes.length && req.url) {
|
|
98
107
|
// NOTE: the domain and scheme are irrelevant here.
|
|
99
108
|
// The URL object is only used to safely obtain the path to match
|
|
100
|
-
const { pathname: path } = new
|
|
109
|
+
const { pathname: path } = new node_url_1.URL(req.url, 'http://localhost');
|
|
101
110
|
const routes = Object.keys(this.routes);
|
|
102
111
|
for (let i = 0; i < routes.length; i += 1) {
|
|
103
112
|
const route = routes[i];
|
|
@@ -121,7 +130,6 @@ class SocketModeReceiver {
|
|
|
121
130
|
}
|
|
122
131
|
}
|
|
123
132
|
this.client.on('slack_event', async (args) => {
|
|
124
|
-
var _a;
|
|
125
133
|
const { ack, body, retry_num, retry_reason } = args;
|
|
126
134
|
const event = {
|
|
127
135
|
body,
|
|
@@ -131,7 +139,7 @@ class SocketModeReceiver {
|
|
|
131
139
|
customProperties: customPropertiesExtractor(args),
|
|
132
140
|
};
|
|
133
141
|
try {
|
|
134
|
-
await
|
|
142
|
+
await this.app?.processEvent(event);
|
|
135
143
|
}
|
|
136
144
|
catch (error) {
|
|
137
145
|
const shouldBeAcked = await this.processEventErrorHandler({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SocketModeReceiver.js","sourceRoot":"","sources":["../../src/receivers/SocketModeReceiver.ts"],"names":[],"mappings":";;AAAA,
|
|
1
|
+
{"version":3,"file":"SocketModeReceiver.js","sourceRoot":"","sources":["../../src/receivers/SocketModeReceiver.ts"],"names":[],"mappings":";;AAAA,yCAA2E;AAC3E,uCAA+B;AAC/B,0CAAqE;AACrE,wCAMsB;AACtB,oDAAsD;AAGtD,mDAAuC;AAMvC,+DAG+B;AAC/B,mDAA2E;AAC3E,iEAA4D;AAgD5D;;GAEG;AACH,MAAqB,kBAAkB;IACrC,iBAAiB;IACV,MAAM,CAAmB;IAExB,GAAG,CAAkB;IAErB,MAAM,CAAS;IAEhB,SAAS,GAAgC,SAAS,CAAC;IAElD,UAAU,CAAU;IAEpB,cAAc,CAAU;IAExB,MAAM,CAAiB;IAEvB,wBAAwB,CAA6E;IAE7G,YAAmB,EACjB,QAAQ,EACR,MAAM,GAAG,SAAS,EAClB,QAAQ,G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IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,sDAAsD,KAAK,EAAE,CAAC,CAAC;YAC9F,CAAC,CAAC,CAAC;QACL,CAAC;QACD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,IAAI,CAAC;gBACH,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;gBACzB,OAAO,EAAE,CAAC;YACZ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,CAAC,KAAK,CAAC,CAAC;YAChB,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AA3MD,qCA2MC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { ServerResponse } from 'http';
|
|
3
|
-
import { ParamsIncomingMessage } from './ParamsIncomingMessage';
|
|
2
|
+
import type { ServerResponse } from 'node:http';
|
|
3
|
+
import type { ParamsIncomingMessage } from './ParamsIncomingMessage';
|
|
4
4
|
export interface CustomRoute {
|
|
5
5
|
path: string;
|
|
6
6
|
method: string | string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom-routes.d.ts","sourceRoot":"","sources":["../../src/receivers/custom-routes.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"custom-routes.d.ts","sourceRoot":"","sources":["../../src/receivers/custom-routes.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEhD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAErE,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC1B,OAAO,EAAE,CAAC,GAAG,EAAE,qBAAqB,EAAE,GAAG,EAAE,cAAc,KAAK,IAAI,CAAC;CACpE;AAED,MAAM,WAAW,cAAc;IAC7B,CAAC,GAAG,EAAE,MAAM,GAAG;QACb,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,GAAG,EAAE,qBAAqB,EAAE,GAAG,EAAE,cAAc,KAAK,IAAI,CAAC;KAC7E,CAAC;CACH;AAED,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,WAAW,EAAE,GAAG,cAAc,CAc/E"}
|
|
@@ -5,12 +5,13 @@ const errors_1 = require("../errors");
|
|
|
5
5
|
function buildReceiverRoutes(customRoutes) {
|
|
6
6
|
const routes = {};
|
|
7
7
|
validateCustomRoutes(customRoutes);
|
|
8
|
-
|
|
9
|
-
const methodObj = Array.isArray(r.method)
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
for (const r of customRoutes) {
|
|
9
|
+
const methodObj = Array.isArray(r.method)
|
|
10
|
+
? // biome-ignore lint/performance/noAccumulatingSpread: TODO: apparently this is a perf hit?
|
|
11
|
+
r.method.reduce((o, key) => ({ ...o, [key.toUpperCase()]: r.handler }), {})
|
|
12
|
+
: { [r.method.toUpperCase()]: r.handler };
|
|
12
13
|
routes[r.path] = routes[r.path] ? { ...routes[r.path], ...methodObj } : methodObj;
|
|
13
|
-
}
|
|
14
|
+
}
|
|
14
15
|
return routes;
|
|
15
16
|
}
|
|
16
17
|
exports.buildReceiverRoutes = buildReceiverRoutes;
|
|
@@ -18,13 +19,13 @@ function validateCustomRoutes(customRoutes) {
|
|
|
18
19
|
const requiredKeys = ['path', 'method', 'handler'];
|
|
19
20
|
const missingKeys = [];
|
|
20
21
|
// Check for missing required keys
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
for (const route of customRoutes) {
|
|
23
|
+
for (const key of requiredKeys) {
|
|
23
24
|
if (route[key] === undefined && !missingKeys.includes(key)) {
|
|
24
25
|
missingKeys.push(key);
|
|
25
26
|
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
28
29
|
if (missingKeys.length > 0) {
|
|
29
30
|
const errorMsg = `One or more routes in customRoutes are missing required keys: ${missingKeys.join(', ')}`;
|
|
30
31
|
throw new errors_1.CustomRouteInitializationError(errorMsg);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom-routes.js","sourceRoot":"","sources":["../../src/receivers/custom-routes.ts"],"names":[],"mappings":";;;AACA,sCAA2D;AAe3D,SAAgB,mBAAmB,CAAC,YAA2B;IAC7D,MAAM,MAAM,GAAmB,EAAE,CAAC;IAElC,oBAAoB,CAAC,YAAY,CAAC,CAAC;IAEnC,
|
|
1
|
+
{"version":3,"file":"custom-routes.js","sourceRoot":"","sources":["../../src/receivers/custom-routes.ts"],"names":[],"mappings":";;;AACA,sCAA2D;AAe3D,SAAgB,mBAAmB,CAAC,YAA2B;IAC7D,MAAM,MAAM,GAAmB,EAAE,CAAC;IAElC,oBAAoB,CAAC,YAAY,CAAC,CAAC;IAEnC,KAAK,MAAM,CAAC,IAAI,YAAY,EAAE,CAAC;QAC7B,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC;YACvC,CAAC,CAAC,2FAA2F;gBAC3F,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,EAAE,EAAE,CAAC;YAC7E,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;QAC5C,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,GAAG,SAAS,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IACpF,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAdD,kDAcC;AAED,SAAS,oBAAoB,CAAC,YAA2B;IACvD,MAAM,YAAY,GAA0B,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;IAC1E,MAAM,WAAW,GAA0B,EAAE,CAAC;IAE9C,kCAAkC;IAClC,KAAK,MAAM,KAAK,IAAI,YAAY,EAAE,CAAC;QACjC,KAAK,MAAM,GAAG,IAAI,YAAY,EAAE,CAAC;YAC/B,IAAI,KAAK,CAAC,GAAG,CAAC,KAAK,SAAS,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC3D,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACxB,CAAC;QACH,CAAC;IACH,CAAC;IAED,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC3B,MAAM,QAAQ,GAAG,iEAAiE,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAC3G,MAAM,IAAI,uCAA8B,CAAC,QAAQ,CAAC,CAAC;IACrD,CAAC;AACH,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { HTTPReceiverInstallerOptions, HTTPReceiverOptions } from './HTTPReceiver';
|
|
2
2
|
export interface RedirectOptions {
|
|
3
3
|
redirectUri?: HTTPReceiverOptions['redirectUri'];
|
|
4
4
|
redirectUriPath?: HTTPReceiverInstallerOptions['redirectUriPath'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify-redirect-opts.d.ts","sourceRoot":"","sources":["../../src/receivers/verify-redirect-opts.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"verify-redirect-opts.d.ts","sourceRoot":"","sources":["../../src/receivers/verify-redirect-opts.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,4BAA4B,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAExF,MAAM,WAAW,eAAe;IAC9B,WAAW,CAAC,EAAE,mBAAmB,CAAC,aAAa,CAAC,CAAC;IACjD,eAAe,CAAC,EAAE,4BAA4B,CAAC,iBAAiB,CAAC,CAAC;CACnE;AAED,wBAAgB,kBAAkB,CAAC,EAAE,WAAW,EAAE,eAAe,EAAE,EAAE,eAAe,GAAG,IAAI,CAgB1F"}
|
|
@@ -4,17 +4,17 @@ exports.verifyRedirectOpts = void 0;
|
|
|
4
4
|
/**
|
|
5
5
|
* Helper to verify redirect uri and redirect uri path exist and are consistent
|
|
6
6
|
* when supplied.
|
|
7
|
-
*/
|
|
7
|
+
*/
|
|
8
8
|
const errors_1 = require("../errors");
|
|
9
9
|
function verifyRedirectOpts({ redirectUri, redirectUriPath }) {
|
|
10
10
|
// if redirectUri is supplied, redirectUriPath is required
|
|
11
|
-
if (
|
|
11
|
+
if (redirectUri && !redirectUriPath) {
|
|
12
12
|
throw new errors_1.AppInitializationError(' You have set a redirectUri but not a matching redirectUriPath.' +
|
|
13
13
|
' Please provide this via installerOptions.redirectUriPath' +
|
|
14
14
|
' Note: These should be consistent, e.g. https://example.com/redirect and /redirect');
|
|
15
15
|
}
|
|
16
16
|
// if both redirectUri and redirectUri are supplied, they must be consistent
|
|
17
|
-
if (redirectUri && redirectUriPath && !
|
|
17
|
+
if (redirectUri && redirectUriPath && !redirectUri?.endsWith(redirectUriPath)) {
|
|
18
18
|
throw new errors_1.AppInitializationError('redirectUri and installerOptions.redirectUriPath should be consistent' +
|
|
19
19
|
' e.g. https://example.com/redirect and /redirect');
|
|
20
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify-redirect-opts.js","sourceRoot":"","sources":["../../src/receivers/verify-redirect-opts.ts"],"names":[],"mappings":";;;AAAA;;;
|
|
1
|
+
{"version":3,"file":"verify-redirect-opts.js","sourceRoot":"","sources":["../../src/receivers/verify-redirect-opts.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,sCAAmD;AAQnD,SAAgB,kBAAkB,CAAC,EAAE,WAAW,EAAE,eAAe,EAAmB;IAClF,0DAA0D;IAC1D,IAAI,WAAW,IAAI,CAAC,eAAe,EAAE,CAAC;QACpC,MAAM,IAAI,+BAAsB,CAC9B,iEAAiE;YAC/D,2DAA2D;YAC3D,oFAAoF,CACvF,CAAC;IACJ,CAAC;IACD,4EAA4E;IAC5E,IAAI,WAAW,IAAI,eAAe,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC;QAC9E,MAAM,IAAI,+BAAsB,CAC9B,uEAAuE;YACrE,kDAAkD,CACrD,CAAC;IACJ,CAAC;AACH,CAAC;AAhBD,gDAgBC"}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import type { IncomingMessage, ServerResponse } from 'http';
|
|
3
|
-
import { Logger } from '@slack/logger';
|
|
4
|
-
import { BufferedIncomingMessage } from './BufferedIncomingMessage';
|
|
5
|
-
import { RequestVerificationOptions } from './HTTPModuleFunctions';
|
|
1
|
+
import type { Logger } from '@slack/logger';
|
|
6
2
|
export interface SlackRequestVerificationOptions {
|
|
7
3
|
signingSecret: string;
|
|
8
4
|
body: string;
|
|
@@ -23,11 +19,4 @@ export declare function verifySlackRequest(options: SlackRequestVerificationOpti
|
|
|
23
19
|
* If the request is invalid, this method returns false.
|
|
24
20
|
*/
|
|
25
21
|
export declare function isValidSlackRequest(options: SlackRequestVerificationOptions): boolean;
|
|
26
|
-
export interface VerifyOptions extends RequestVerificationOptions {
|
|
27
|
-
enabled?: boolean;
|
|
28
|
-
signingSecret: string;
|
|
29
|
-
nowMs?: () => number;
|
|
30
|
-
logger?: Logger;
|
|
31
|
-
}
|
|
32
|
-
export declare function verify(options: VerifyOptions, req: IncomingMessage, res?: ServerResponse): Promise<BufferedIncomingMessage>;
|
|
33
22
|
//# sourceMappingURL=verify-request.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify-request.d.ts","sourceRoot":"","sources":["../../src/receivers/verify-request.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"verify-request.d.ts","sourceRoot":"","sources":["../../src/receivers/verify-request.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAS5C,MAAM,WAAW,+BAA+B;IAC9C,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE;QACP,mBAAmB,EAAE,MAAM,CAAC;QAC5B,2BAA2B,EAAE,MAAM,CAAC;KACrC,CAAC;IACF,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,+BAA+B,GAAG,IAAI,CAuCjF;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,+BAA+B,GAAG,OAAO,CAUrF"}
|
|
@@ -3,12 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
7
|
-
|
|
8
|
-
const crypto_1 = require("crypto");
|
|
9
|
-
const logger_1 = require("@slack/logger");
|
|
6
|
+
exports.isValidSlackRequest = exports.verifySlackRequest = void 0;
|
|
7
|
+
const node_crypto_1 = require("node:crypto");
|
|
10
8
|
const tsscmp_1 = __importDefault(require("tsscmp"));
|
|
11
|
-
const HTTPModuleFunctions_1 = require("./HTTPModuleFunctions");
|
|
12
9
|
// ------------------------------
|
|
13
10
|
// HTTP module independent methods
|
|
14
11
|
// ------------------------------
|
|
@@ -18,14 +15,13 @@ const verifyErrorPrefix = 'Failed to verify authenticity';
|
|
|
18
15
|
* If the request is invalid, this method throws an exception with the error details.
|
|
19
16
|
*/
|
|
20
17
|
function verifySlackRequest(options) {
|
|
21
|
-
var _a;
|
|
22
18
|
const requestTimestampSec = options.headers['x-slack-request-timestamp'];
|
|
23
19
|
const signature = options.headers['x-slack-signature'];
|
|
24
20
|
if (Number.isNaN(requestTimestampSec)) {
|
|
25
21
|
throw new Error(`${verifyErrorPrefix}: header x-slack-request-timestamp did not have the expected type (${requestTimestampSec})`);
|
|
26
22
|
}
|
|
27
23
|
// Calculate time-dependent values
|
|
28
|
-
const nowMs =
|
|
24
|
+
const nowMs = options.nowMilliseconds ?? Date.now();
|
|
29
25
|
const requestTimestampMaxDeltaMin = 5;
|
|
30
26
|
const fiveMinutesAgoSec = Math.floor(nowMs / 1000) - 60 * requestTimestampMaxDeltaMin;
|
|
31
27
|
// Enforce verification rules
|
|
@@ -41,7 +37,7 @@ function verifySlackRequest(options) {
|
|
|
41
37
|
throw new Error(`${verifyErrorPrefix}: unknown signature version`);
|
|
42
38
|
}
|
|
43
39
|
// Compute our own signature hash
|
|
44
|
-
const hmac = (0,
|
|
40
|
+
const hmac = (0, node_crypto_1.createHmac)('sha256', options.signingSecret);
|
|
45
41
|
hmac.update(`${signatureVersion}:${requestTimestampSec}:${options.body}`);
|
|
46
42
|
const ourSignatureHash = hmac.digest('hex');
|
|
47
43
|
if (!signatureHash || !(0, tsscmp_1.default)(signatureHash, ourSignatureHash)) {
|
|
@@ -66,14 +62,4 @@ function isValidSlackRequest(options) {
|
|
|
66
62
|
return false;
|
|
67
63
|
}
|
|
68
64
|
exports.isValidSlackRequest = isValidSlackRequest;
|
|
69
|
-
// ------------------------------
|
|
70
|
-
// legacy methods (deprecated)
|
|
71
|
-
// ------------------------------
|
|
72
|
-
const consoleLogger = new logger_1.ConsoleLogger();
|
|
73
|
-
// Deprecated: this function will be removed in the near future. Use HTTPModuleFunctions instead.
|
|
74
|
-
async function verify(options, req, res) {
|
|
75
|
-
consoleLogger.warn('This method is deprecated. Use HTTPModuleFunctions.parseAndVerifyHTTPRequest(options, req, res) instead.');
|
|
76
|
-
return HTTPModuleFunctions_1.HTTPModuleFunctions.parseAndVerifyHTTPRequest(options, req, res);
|
|
77
|
-
}
|
|
78
|
-
exports.verify = verify;
|
|
79
65
|
//# sourceMappingURL=verify-request.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify-request.js","sourceRoot":"","sources":["../../src/receivers/verify-request.ts"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"verify-request.js","sourceRoot":"","sources":["../../src/receivers/verify-request.ts"],"names":[],"mappings":";;;;;;AAAA,6CAAyC;AAEzC,oDAA4B;AAE5B,iCAAiC;AACjC,kCAAkC;AAClC,iCAAiC;AAEjC,MAAM,iBAAiB,GAAG,+BAA+B,CAAC;AAa1D;;;GAGG;AACH,SAAgB,kBAAkB,CAAC,OAAwC;IACzE,MAAM,mBAAmB,GAAG,OAAO,CAAC,OAAO,CAAC,2BAA2B,CAAC,CAAC;IACzE,MAAM,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;IACvD,IAAI,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,EAAE,CAAC;QACtC,MAAM,IAAI,KAAK,CACb,GAAG,iBAAiB,sEAAsE,mBAAmB,GAAG,CACjH,CAAC;IACJ,CAAC;IAED,kCAAkC;IAClC,MAAM,KAAK,GAAG,OAAO,CAAC,eAAe,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;IACpD,MAAM,2BAA2B,GAAG,CAAC,CAAC;IACtC,MAAM,iBAAiB,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,2BAA2B,CAAC;IAEtF,6BAA6B;IAE7B,0BAA0B;IAC1B,IAAI,mBAAmB,GAAG,iBAAiB,EAAE,CAAC;QAC5C,MAAM,IAAI,KAAK,CACb,GAAG,iBAAiB,4EAClB,2BACF,8BAA8B,CA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|
+
import type { Confirmation, Option, PlainTextElement, RichTextBlock } from '@slack/types';
|
|
2
|
+
import type { StringIndexed } from '../utilities';
|
|
3
|
+
import type { ViewOutput, ViewStateValue } from '../view';
|
|
4
4
|
/**
|
|
5
5
|
* All known actions from in Slack's interactive elements
|
|
6
6
|
*
|
|
7
7
|
* This is a discriminated union. The discriminant is the `type` property.
|
|
8
8
|
*/
|
|
9
|
-
export
|
|
9
|
+
export type BlockElementAction = ButtonAction | UsersSelectAction | MultiUsersSelectAction | StaticSelectAction | MultiStaticSelectAction | ConversationsSelectAction | MultiConversationsSelectAction | ChannelsSelectAction | MultiChannelsSelectAction | ExternalSelectAction | MultiExternalSelectAction | OverflowAction | DatepickerAction | TimepickerAction | RadioButtonsAction | CheckboxesAction | PlainTextInputAction | RichTextInputAction;
|
|
10
10
|
/**
|
|
11
11
|
* Any action from Slack's interactive elements
|
|
12
12
|
*
|
|
@@ -23,7 +23,7 @@ export interface BasicElementAction<T extends string = string> {
|
|
|
23
23
|
* An action from a button element
|
|
24
24
|
*/
|
|
25
25
|
export interface ButtonAction extends BasicElementAction<'button'> {
|
|
26
|
-
value
|
|
26
|
+
value?: string;
|
|
27
27
|
text: PlainTextElement;
|
|
28
28
|
url?: string;
|
|
29
29
|
confirm?: Confirmation;
|
|
@@ -236,16 +236,16 @@ export interface BlockAction<ElementAction extends BasicElementAction = BlockEle
|
|
|
236
236
|
name: string;
|
|
237
237
|
};
|
|
238
238
|
}
|
|
239
|
-
export
|
|
240
|
-
export
|
|
241
|
-
export
|
|
242
|
-
export
|
|
243
|
-
export
|
|
244
|
-
export
|
|
245
|
-
export
|
|
246
|
-
export
|
|
247
|
-
export
|
|
248
|
-
export
|
|
249
|
-
export
|
|
250
|
-
export
|
|
239
|
+
export type BlockButtonAction = BlockAction<ButtonAction>;
|
|
240
|
+
export type BlockStaticSelectAction = BlockAction<StaticSelectAction>;
|
|
241
|
+
export type BlockUsersSelectAction = BlockAction<UsersSelectAction>;
|
|
242
|
+
export type BlockConversationsSelectAction = BlockAction<ConversationsSelectAction>;
|
|
243
|
+
export type BlockChannelsSelectAction = BlockAction<ChannelsSelectAction>;
|
|
244
|
+
export type BlockExternalSelectAction = BlockAction<ExternalSelectAction>;
|
|
245
|
+
export type BlockOverflowAction = BlockAction<OverflowAction>;
|
|
246
|
+
export type BlockDatepickerAction = BlockAction<DatepickerAction>;
|
|
247
|
+
export type BlockTimepickerAction = BlockAction<TimepickerAction>;
|
|
248
|
+
export type BlockRadioButtonsAction = BlockAction<RadioButtonsAction>;
|
|
249
|
+
export type BlockCheckboxesAction = BlockAction<CheckboxesAction>;
|
|
250
|
+
export type BlockPlainTextInputAction = BlockAction<PlainTextInputAction>;
|
|
251
251
|
//# sourceMappingURL=block-action.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block-action.d.ts","sourceRoot":"","sources":["../../../src/types/actions/block-action.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"block-action.d.ts","sourceRoot":"","sources":["../../../src/types/actions/block-action.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC1F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE1D;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAC1B,YAAY,GACZ,iBAAiB,GACjB,sBAAsB,GACtB,kBAAkB,GAClB,uBAAuB,GACvB,yBAAyB,GACzB,8BAA8B,GAC9B,oBAAoB,GACpB,yBAAyB,GACzB,oBAAoB,GACpB,yBAAyB,GACzB,cAAc,GACd,gBAAgB,GAChB,gBAAgB,GAChB,kBAAkB,GAClB,gBAAgB,GAChB,oBAAoB,GACpB,mBAAmB,CAAC;AAExB;;;;;GAKG;AACH,MAAM,WAAW,kB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,GAAG,WAAW,CAAC,gBAAgB,CAAC,CAAC;AAClE,MAAM,MAAM,yBAAyB,GAAG,WAAW,CAAC,oBAAoB,CAAC,CAAC"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import type { FunctionCompleteFn, FunctionFailFn } from '../../CustomFunction';
|
|
2
|
+
import type { FunctionInputs } from '../events';
|
|
3
|
+
import type { AckFn, RespondFn, SayArguments, SayFn } from '../utilities';
|
|
4
|
+
import type { BlockAction } from './block-action';
|
|
5
|
+
import type { DialogSubmitAction, DialogValidation } from './dialog-action';
|
|
6
|
+
import type { InteractiveMessage } from './interactive-message';
|
|
7
|
+
import type { WorkflowStepEdit } from './workflow-step-edit';
|
|
6
8
|
export * from './block-action';
|
|
7
9
|
export * from './interactive-message';
|
|
8
10
|
export * from './dialog-action';
|
|
@@ -21,7 +23,15 @@ export * from './workflow-step-edit';
|
|
|
21
23
|
* offered when no generic parameter is bound would be limited to BasicElementAction rather than the union of known
|
|
22
24
|
* actions - ElementAction.
|
|
23
25
|
*/
|
|
24
|
-
export
|
|
26
|
+
export type SlackAction = BlockAction | InteractiveMessage | DialogSubmitAction | WorkflowStepEdit;
|
|
27
|
+
export interface ActionConstraints<A extends SlackAction = SlackAction> {
|
|
28
|
+
type?: A['type'];
|
|
29
|
+
block_id?: A extends BlockAction ? string | RegExp : never;
|
|
30
|
+
action_id?: A extends BlockAction ? string | RegExp : never;
|
|
31
|
+
callback_id?: Extract<A, {
|
|
32
|
+
callback_id?: string;
|
|
33
|
+
}> extends any ? string | RegExp : never;
|
|
34
|
+
}
|
|
25
35
|
/**
|
|
26
36
|
* Arguments which listeners and middleware receive to process an action from Slack's Block Kit interactive components,
|
|
27
37
|
* message actions, dialogs, or legacy interactive messages.
|
|
@@ -30,17 +40,21 @@ export declare type SlackAction = BlockAction | InteractiveMessage | DialogSubmi
|
|
|
30
40
|
* `BlockAction<ElementAction>` can be used to create a type for this parameter based on an element's action type. In
|
|
31
41
|
* this case `ElementAction` must extend `BasicElementAction`.
|
|
32
42
|
*/
|
|
33
|
-
export
|
|
43
|
+
export type SlackActionMiddlewareArgs<Action extends SlackAction = SlackAction> = {
|
|
34
44
|
payload: Action extends BlockAction<infer ElementAction> ? ElementAction : Action extends InteractiveMessage<infer InteractiveAction> ? InteractiveAction : Action;
|
|
35
|
-
action:
|
|
45
|
+
action: Action extends BlockAction<infer ElementAction> ? ElementAction : Action extends InteractiveMessage<infer InteractiveAction> ? InteractiveAction : Action;
|
|
36
46
|
body: Action;
|
|
37
|
-
say: Action extends Exclude<SlackAction, DialogSubmitAction | WorkflowStepEdit> ? SayFn : never;
|
|
38
47
|
respond: RespondFn;
|
|
39
48
|
ack: ActionAckFn<Action>;
|
|
40
|
-
|
|
49
|
+
complete?: FunctionCompleteFn;
|
|
50
|
+
fail?: FunctionFailFn;
|
|
51
|
+
inputs?: FunctionInputs;
|
|
52
|
+
} & (Action extends Exclude<SlackAction, DialogSubmitAction | WorkflowStepEdit> ? {
|
|
53
|
+
say: SayFn;
|
|
54
|
+
} : unknown);
|
|
41
55
|
/**
|
|
42
56
|
* Type function which given an action `A` returns a corresponding type for the `ack()` function. The function is used
|
|
43
57
|
* to acknowledge the receipt (and possibly signal failure) of an action from a listener or middleware.
|
|
44
58
|
*/
|
|
45
|
-
|
|
59
|
+
type ActionAckFn<A extends SlackAction> = A extends InteractiveMessage ? AckFn<string | SayArguments> : A extends DialogSubmitAction ? AckFn<DialogValidation> : AckFn<void>;
|
|
46
60
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/actions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/actions/index.ts"],"names":[],"mappings":"AAAA,OAAO,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M,SAAS,WAAW,CAAC,MAAM,aAAa,CAAC,GACpD,aAAa,GACb,MAAM,SAAS,kBAAkB,CAAC,MAAM,iBAAiB,CAAC,GACxD,iBAAiB,GACjB,MAAM,CAAC;IAEb,MAAM,EAAE,MAAM,SAAS,WAAW,CAAC,MAAM,aAAa,CAAC,GACnD,aAAa,GACb,MAAM,SAAS,kBAAkB,CAAC,MAAM,iBAAiB,CAAC,GACxD,iBAAiB,GACjB,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,SAAS,CAAC;IACnB,GAAG,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAEzB,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAC9B,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,MAAM,CAAC,EAAE,cAAc,CAAC;CAEzB,GAAG,CAAC,MAAM,SAAS,OAAO,CAAC,WAAW,EAAE,kBAAkB,GAAG,gBAAgB,CAAC,GAG3E;IAAE,GAAG,EAAE,KAAK,CAAA;CAAE,GACd,OAAO,CAAC,CAAC;AAEb;;;GAGG;AACH,KAAK,WAAW,CAAC,CAAC,SAAS,WAAW,IAAI,CAAC,SAAS,kBAAkB,GAClE,KAAK,CAAC,MAAM,GAAG,YAAY,CAAC,GAC5B,CAAC,SAAS,kBAAkB,GAC1B,KAAK,CAAC,gBAAgB,CAAC,GACvB,KAAK,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -17,5 +17,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./block-action"), exports);
|
|
18
18
|
__exportStar(require("./interactive-message"), exports);
|
|
19
19
|
__exportStar(require("./dialog-action"), exports);
|
|
20
|
+
// TODO: remove workflow step stuff in bolt v5
|
|
20
21
|
__exportStar(require("./workflow-step-edit"), exports);
|
|
21
22
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/actions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/actions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAQA,iDAA+B;AAC/B,wDAAsC;AACtC,kDAAgC;AAChC,8CAA8C;AAC9C,uDAAqC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* All actions which Slack delivers from legacy interactive messages. The full body of these actions are represented
|
|
3
3
|
* as [[InteractiveMessage]].
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
5
|
+
export type InteractiveAction = ButtonClick | MenuSelect;
|
|
6
6
|
/**
|
|
7
7
|
* A button click action from a legacy interactive message.
|
|
8
8
|
*/
|
|
@@ -61,6 +61,6 @@ export interface InteractiveMessage<Action extends InteractiveAction = Interacti
|
|
|
61
61
|
name: string;
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
|
-
export
|
|
65
|
-
export
|
|
64
|
+
export type InteractiveButtonClick = InteractiveMessage<ButtonClick>;
|
|
65
|
+
export type InteractiveMenuSelect = InteractiveMessage<MenuSelect>;
|
|
66
66
|
//# sourceMappingURL=interactive-message.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactive-message.d.ts","sourceRoot":"","sources":["../../../src/types/actions/interactive-message.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,
|
|
1
|
+
{"version":3,"file":"interactive-message.d.ts","sourceRoot":"","sources":["../../../src/types/actions/interactive-message.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,WAAW,GAAG,UAAU,CAAC;AAEzD;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,QAAQ,CAAC;IACf,IA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AAC"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* A Slack
|
|
2
|
+
* A Slack step from app action wrapped in the standard metadata.
|
|
3
3
|
*
|
|
4
|
-
* This describes the entire JSON-encoded body of a request from Slack
|
|
4
|
+
* This describes the entire JSON-encoded body of a request from Slack step from app actions.
|
|
5
|
+
* @deprecated Steps from Apps are no longer supported and support for them will be removed in the next major bolt-js
|
|
6
|
+
* version.
|
|
5
7
|
*/
|
|
6
8
|
export interface WorkflowStepEdit {
|
|
7
9
|
type: 'workflow_step_edit';
|
|
@@ -27,11 +29,9 @@ export interface WorkflowStepEdit {
|
|
|
27
29
|
workflow_step: {
|
|
28
30
|
workflow_id: string;
|
|
29
31
|
step_id: string;
|
|
30
|
-
inputs: {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
};
|
|
34
|
-
};
|
|
32
|
+
inputs: Record<string, {
|
|
33
|
+
value: any;
|
|
34
|
+
}>;
|
|
35
35
|
outputs: {
|
|
36
36
|
name: string;
|
|
37
37
|
type: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-step-edit.d.ts","sourceRoot":"","sources":["../../../src/types/actions/workflow-step-edit.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"workflow-step-edit.d.ts","sourceRoot":"","sources":["../../../src/types/actions/workflow-step-edit.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,oBAAoB,CAAC;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE;QACJ,EAAE,EAAE,MAAM,CAAC;QACX,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,IAAI,EAAE;QACJ,EAAE,EAAE,MAAM,CAAC;QACX,MAAM,EAAE,MAAM,CAAC;QACf,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,eAAe,CAAC,EAAE,MAAM,CAAC;KAC1B,CAAC;IACF,OAAO,CAAC,EAAE;QACR,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;IACF,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CACZ,MAAM,EACN;YAEE,KAAK,EAAE,GAAG,CAAC;SACZ,CACF,CAAC;QACF,OAAO,EAAE;YACP,IAAI,EAAE,MAAM,CAAC;YACb,IAAI,EAAE,MAAM,CAAC;YACb,KAAK,EAAE,MAAM,CAAC;SACf,EAAE,CAAC;QACJ,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,cAAc,CAAC,EAAE,MAAM,CAAC;KACzB,CAAC;IAGF,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,UAAU,CAAC,EAAE;QACX,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;CACH"}
|