@vercel/slack-bolt 1.4.0 → 1.4.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/cli.d.mts +1 -1
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +357 -508
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +385 -498
- package/dist/cli.mjs.map +1 -1
- package/dist/index.d.mts +171 -155
- package/dist/index.d.ts +171 -155
- package/dist/index.js +487 -526
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +485 -524
- package/dist/index.mjs.map +1 -1
- package/dist/preview-DAWKwXt1.mjs +689 -0
- package/dist/preview-DAWKwXt1.mjs.map +1 -0
- package/dist/preview-DeqpNNn_.js +794 -0
- package/dist/preview-DeqpNNn_.js.map +1 -0
- package/dist/preview.d.mts +47 -44
- package/dist/preview.d.ts +47 -44
- package/dist/preview.js +3 -13
- package/dist/preview.mjs +2 -6
- package/package.json +8 -8
- package/dist/chunk-B5E7QPZP.mjs +0 -11
- package/dist/chunk-B5E7QPZP.mjs.map +0 -1
- package/dist/chunk-DYB6RJG4.js +0 -1003
- package/dist/chunk-DYB6RJG4.js.map +0 -1
- package/dist/chunk-LARZABX3.mjs +0 -980
- package/dist/chunk-LARZABX3.mjs.map +0 -1
- package/dist/chunk-QHMZVK6J.js +0 -14
- package/dist/chunk-QHMZVK6J.js.map +0 -1
- package/dist/preview.js.map +0 -1
- package/dist/preview.mjs.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { Receiver, StringIndexed
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { App, Receiver, StringIndexed } from "@slack/bolt";
|
|
2
|
+
import { LogLevel, Logger } from "@slack/logger";
|
|
3
|
+
import { CallbackOptions, InstallPathOptions, InstallProvider, InstallProviderOptions, StateStore } from "@slack/oauth";
|
|
4
4
|
|
|
5
|
+
//#region src/index.d.ts
|
|
5
6
|
/**
|
|
6
7
|
* A function to handle the request from the Slack app.
|
|
7
8
|
* @param req - The request from the Slack app.
|
|
@@ -22,91 +23,91 @@ type VercelHandler = (req: Request) => Promise<Response>;
|
|
|
22
23
|
* excluding path-related options (serverless uses file-based routing).
|
|
23
24
|
*/
|
|
24
25
|
interface VercelInstallerOptions {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
26
|
+
directInstall?: boolean;
|
|
27
|
+
renderHtmlForInstallPath?: (url: string) => string;
|
|
28
|
+
stateStore?: StateStore;
|
|
29
|
+
stateVerification?: boolean;
|
|
30
|
+
legacyStateVerification?: boolean;
|
|
31
|
+
stateCookieName?: string;
|
|
32
|
+
stateCookieExpirationSeconds?: number;
|
|
33
|
+
authVersion?: "v1" | "v2";
|
|
34
|
+
clientOptions?: InstallProviderOptions["clientOptions"];
|
|
35
|
+
authorizationUrl?: string;
|
|
36
|
+
metadata?: string;
|
|
37
|
+
userScopes?: string[];
|
|
38
|
+
installPathOptions?: InstallPathOptions;
|
|
39
|
+
callbackOptions?: CallbackOptions;
|
|
39
40
|
}
|
|
40
41
|
/**
|
|
41
42
|
* Configuration options for the VercelReceiver.
|
|
42
43
|
*/
|
|
43
44
|
interface VercelReceiverOptions {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
45
|
+
/**
|
|
46
|
+
* The signing secret for the Slack app.
|
|
47
|
+
* @default process.env.SLACK_SIGNING_SECRET
|
|
48
|
+
*/
|
|
49
|
+
signingSecret?: string;
|
|
50
|
+
/**
|
|
51
|
+
* If true, verifies the Slack request signature.
|
|
52
|
+
* @default true
|
|
53
|
+
*/
|
|
54
|
+
signatureVerification?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* The logger to use for the VercelReceiver.
|
|
57
|
+
* @default new ConsoleLogger()
|
|
58
|
+
*/
|
|
59
|
+
logger?: Logger;
|
|
60
|
+
/**
|
|
61
|
+
* The log level to use for the VercelReceiver.
|
|
62
|
+
* @default LogLevel.INFO
|
|
63
|
+
*/
|
|
64
|
+
logLevel?: LogLevel;
|
|
65
|
+
/**
|
|
66
|
+
* A function to extract custom properties from incoming events.
|
|
67
|
+
* @default undefined
|
|
68
|
+
* @returns An object with custom properties.
|
|
69
|
+
*/
|
|
70
|
+
customPropertiesExtractor?: (req: Request) => StringIndexed;
|
|
71
|
+
/**
|
|
72
|
+
* The timeout in milliseconds for event acknowledgment.
|
|
73
|
+
* @default 3001
|
|
74
|
+
*/
|
|
75
|
+
ackTimeoutMs?: number;
|
|
76
|
+
/**
|
|
77
|
+
* Your app's client ID, found under Basic Information on api.slack.com.
|
|
78
|
+
* Required for OAuth.
|
|
79
|
+
* @default process.env.SLACK_CLIENT_ID
|
|
80
|
+
*/
|
|
81
|
+
clientId?: string;
|
|
82
|
+
/**
|
|
83
|
+
* Your app's client secret, found under Basic Information on api.slack.com.
|
|
84
|
+
* Required for OAuth.
|
|
85
|
+
* @default process.env.SLACK_CLIENT_SECRET
|
|
86
|
+
*/
|
|
87
|
+
clientSecret?: string;
|
|
88
|
+
/**
|
|
89
|
+
* Secret used to generate and verify the state parameter for OAuth CSRF protection.
|
|
90
|
+
* Required unless a custom stateStore or stateVerification: false is provided.
|
|
91
|
+
* @default process.env.SLACK_STATE_SECRET
|
|
92
|
+
*/
|
|
93
|
+
stateSecret?: string;
|
|
94
|
+
/**
|
|
95
|
+
* The bot scopes to request during the OAuth flow.
|
|
96
|
+
*/
|
|
97
|
+
scopes?: string[];
|
|
98
|
+
/**
|
|
99
|
+
* The redirect URI registered with your Slack app for OAuth callbacks.
|
|
100
|
+
*/
|
|
101
|
+
redirectUri?: string;
|
|
102
|
+
/**
|
|
103
|
+
* Storage backend for OAuth installations (tokens, team info, etc.).
|
|
104
|
+
* Required for OAuth in serverless -- the default in-memory store does not persist.
|
|
105
|
+
*/
|
|
106
|
+
installationStore?: InstallProviderOptions["installationStore"];
|
|
107
|
+
/**
|
|
108
|
+
* Advanced options for the OAuth installer.
|
|
109
|
+
*/
|
|
110
|
+
installerOptions?: VercelInstallerOptions;
|
|
110
111
|
}
|
|
111
112
|
/**
|
|
112
113
|
* A Slack Bolt receiver implementation designed for Vercel's serverless environment.
|
|
@@ -129,76 +130,90 @@ interface VercelReceiverOptions {
|
|
|
129
130
|
*
|
|
130
131
|
*/
|
|
131
132
|
declare class VercelReceiver implements Receiver {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
133
|
+
private readonly signingSecret;
|
|
134
|
+
private readonly signatureVerification;
|
|
135
|
+
private readonly logger;
|
|
136
|
+
private readonly customPropertiesExtractor?;
|
|
137
|
+
private readonly ackTimeoutMs;
|
|
138
|
+
private app?;
|
|
139
|
+
installer?: InstallProvider;
|
|
140
|
+
private installUrlOptions?;
|
|
141
|
+
private installCallbackOptions?;
|
|
142
|
+
private installPathOptions?;
|
|
143
|
+
private stateVerification?;
|
|
144
|
+
/**
|
|
145
|
+
* Gets the logger instance used by this receiver.
|
|
146
|
+
* @returns The logger instance
|
|
147
|
+
*/
|
|
148
|
+
getLogger(): Logger;
|
|
149
|
+
/**
|
|
150
|
+
* Creates a new VercelReceiver instance.
|
|
151
|
+
*
|
|
152
|
+
* @param options - Configuration options for the receiver
|
|
153
|
+
* @throws {VercelReceiverError} When signing secret is not provided
|
|
154
|
+
*
|
|
155
|
+
* @example
|
|
156
|
+
* ```typescript
|
|
157
|
+
* const receiver = new VercelReceiver();
|
|
158
|
+
* ```
|
|
159
|
+
*/
|
|
160
|
+
constructor({
|
|
161
|
+
signingSecret,
|
|
162
|
+
signatureVerification,
|
|
163
|
+
logger,
|
|
164
|
+
logLevel,
|
|
165
|
+
customPropertiesExtractor,
|
|
166
|
+
ackTimeoutMs,
|
|
167
|
+
clientId,
|
|
168
|
+
clientSecret,
|
|
169
|
+
stateSecret,
|
|
170
|
+
scopes,
|
|
171
|
+
redirectUri,
|
|
172
|
+
installationStore,
|
|
173
|
+
installerOptions
|
|
174
|
+
}?: VercelReceiverOptions);
|
|
175
|
+
/**
|
|
176
|
+
* Initializes the receiver with a Slack Bolt app instance.
|
|
177
|
+
* This method is called automatically by the Bolt framework.
|
|
178
|
+
*
|
|
179
|
+
* @param app - The Slack Bolt app instance
|
|
180
|
+
*/
|
|
181
|
+
init(app: App): void;
|
|
182
|
+
/**
|
|
183
|
+
* Starts the receiver and returns a handler function for processing requests.
|
|
184
|
+
* This method is called automatically by the Bolt framework.
|
|
185
|
+
*
|
|
186
|
+
* @returns A handler function that processes incoming Slack requests
|
|
187
|
+
*/
|
|
188
|
+
start(): Promise<VercelHandler>;
|
|
189
|
+
/**
|
|
190
|
+
* Stops the receiver. This method is called automatically by the Bolt framework.
|
|
191
|
+
*/
|
|
192
|
+
stop(): Promise<void>;
|
|
193
|
+
/**
|
|
194
|
+
* Handles requests to the OAuth install path.
|
|
195
|
+
* Renders an "Add to Slack" page or redirects directly to Slack's authorize URL.
|
|
196
|
+
*/
|
|
197
|
+
handleInstall: (req: Request) => Promise<Response>;
|
|
198
|
+
/**
|
|
199
|
+
* Handles the OAuth redirect callback from Slack.
|
|
200
|
+
* Exchanges the authorization code for tokens and stores the installation.
|
|
201
|
+
*/
|
|
202
|
+
handleCallback: (req: Request) => Promise<Response>;
|
|
203
|
+
/**
|
|
204
|
+
* Creates a handler function that processes incoming Slack requests.
|
|
205
|
+
* This is the main entry point for handling Slack events in Vercel.
|
|
206
|
+
* It is called automatically by the Bolt framework in the start() method.
|
|
207
|
+
*
|
|
208
|
+
* @returns A handler function compatible with Vercel's function signature
|
|
209
|
+
*/
|
|
210
|
+
toHandler(): VercelHandler;
|
|
211
|
+
private parseRequestBody;
|
|
212
|
+
private handleSlackEvent;
|
|
213
|
+
private verifyRequest;
|
|
214
|
+
private createSlackReceiverEvent;
|
|
215
|
+
handleError(error: unknown): Response;
|
|
216
|
+
private createScopedLogger;
|
|
202
217
|
}
|
|
203
218
|
/**
|
|
204
219
|
* Creates a Vercel-compatible handler function for a Slack Bolt app.
|
|
@@ -225,5 +240,6 @@ declare class VercelReceiver implements Receiver {
|
|
|
225
240
|
* @throws {VercelReceiverError} If request processing fails.
|
|
226
241
|
*/
|
|
227
242
|
declare function createHandler(app: App, receiver: VercelReceiver): VercelHandler;
|
|
228
|
-
|
|
229
|
-
export {
|
|
243
|
+
//#endregion
|
|
244
|
+
export { VercelHandler, VercelInstallerOptions, VercelReceiver, VercelReceiverOptions, createHandler };
|
|
245
|
+
//# sourceMappingURL=index.d.ts.map
|