@slack/bolt
Advanced tools
Comparing version 3.19.0 to 3.20.0
@@ -20,2 +20,9 @@ import { Logger, LogLevel } from '@slack/logger'; | ||
export declare type AwsCallback = (error?: Error | string | null, result?: any) => void; | ||
export interface ReceiverInvalidRequestSignatureHandlerArgs { | ||
rawBody: string; | ||
signature: string; | ||
ts: number; | ||
awsEvent: AwsEvent; | ||
awsResponse: Promise<AwsResponse>; | ||
} | ||
export interface AwsResponse { | ||
@@ -70,2 +77,3 @@ statusCode: number; | ||
customPropertiesExtractor?: (request: AwsEvent) => StringIndexed; | ||
invalidRequestSignatureHandler?: (args: ReceiverInvalidRequestSignatureHandlerArgs) => void; | ||
} | ||
@@ -78,3 +86,4 @@ export default class AwsLambdaReceiver implements Receiver { | ||
private customPropertiesExtractor; | ||
constructor({ signingSecret, logger, logLevel, signatureVerification, customPropertiesExtractor, }: AwsLambdaReceiverOptions); | ||
private invalidRequestSignatureHandler; | ||
constructor({ signingSecret, logger, logLevel, signatureVerification, customPropertiesExtractor, invalidRequestSignatureHandler, }: AwsLambdaReceiverOptions); | ||
init(app: App): void; | ||
@@ -88,3 +97,4 @@ start(..._args: any[]): Promise<AwsHandler>; | ||
private getHeaderValue; | ||
private defaultInvalidRequestSignatureHandler; | ||
} | ||
//# sourceMappingURL=AwsLambdaReceiver.d.ts.map |
@@ -19,3 +19,3 @@ "use strict"; | ||
class AwsLambdaReceiver { | ||
constructor({ signingSecret, logger = undefined, logLevel = logger_1.LogLevel.INFO, signatureVerification = true, customPropertiesExtractor = (_) => ({}), }) { | ||
constructor({ signingSecret, logger = undefined, logLevel = logger_1.LogLevel.INFO, signatureVerification = true, customPropertiesExtractor = (_) => ({}), invalidRequestSignatureHandler, }) { | ||
// Initialize instance variables, substituting defaults for each value | ||
@@ -30,2 +30,8 @@ this.signingSecret = signingSecret; | ||
this.customPropertiesExtractor = customPropertiesExtractor; | ||
if (invalidRequestSignatureHandler) { | ||
this.invalidRequestSignatureHandler = invalidRequestSignatureHandler; | ||
} | ||
else { | ||
this.invalidRequestSignatureHandler = this.defaultInvalidRequestSignatureHandler; | ||
} | ||
} | ||
@@ -70,4 +76,5 @@ init(app) { | ||
if (!this.isValidRequestSignature(this.signingSecret, rawBody, signature, ts)) { | ||
this.logger.info(`Invalid request signature detected (X-Slack-Signature: ${signature}, X-Slack-Request-Timestamp: ${ts})`); | ||
return Promise.resolve({ statusCode: 401, body: '' }); | ||
const awsResponse = Promise.resolve({ statusCode: 401, body: '' }); | ||
this.invalidRequestSignatureHandler({ rawBody, signature, ts, awsEvent, awsResponse }); | ||
return awsResponse; | ||
} | ||
@@ -195,4 +202,8 @@ } | ||
} | ||
defaultInvalidRequestSignatureHandler(args) { | ||
const { signature, ts } = args; | ||
this.logger.info(`Invalid request signature detected (X-Slack-Signature: ${signature}, X-Slack-Request-Timestamp: ${ts})`); | ||
} | ||
} | ||
exports.default = AwsLambdaReceiver; | ||
//# sourceMappingURL=AwsLambdaReceiver.js.map |
@@ -9,3 +9,3 @@ import { View, MessageAttachment, KnownBlock, Block } from '@slack/types'; | ||
*/ | ||
export declare type SlackEvent = AppRequestedEvent | AppHomeOpenedEvent | AppMentionEvent | AppRateLimitedEvent | AppUninstalledEvent | CallRejectedEvent | ChannelArchiveEvent | ChannelCreatedEvent | ChannelDeletedEvent | ChannelHistoryChangedEvent | ChannelIDChangedEvent | ChannelLeftEvent | ChannelRenameEvent | ChannelSharedEvent | ChannelUnarchiveEvent | ChannelUnsharedEvent | DNDUpdatedEvent | DNDUpdatedUserEvent | EmailDomainChangedEvent | EmojiChangedEvent | FileChangeEvent | FileCommentDeletedEvent | FileCreatedEvent | FileDeletedEvent | FilePublicEvent | FileSharedEvent | FileUnsharedEvent | GridMigrationFinishedEvent | GridMigrationStartedEvent | GroupArchiveEvent | GroupCloseEvent | GroupDeletedEvent | GroupHistoryChangedEvent | GroupLeftEvent | GroupOpenEvent | GroupRenameEvent | GroupUnarchiveEvent | IMCloseEvent | IMCreatedEvent | IMHistoryChangedEvent | IMOpenEvent | InviteRequestedEvent | LinkSharedEvent | MemberJoinedChannelEvent | MemberLeftChannelEvent | MessageEvent | MessageMetadataEvent | PinAddedEvent | PinRemovedEvent | ReactionAddedEvent | ReactionRemovedEvent | SharedChannelInviteReceived | SharedChannelInviteAccepted | SharedChannelInviteApproved | SharedChannelInviteDeclined | StarAddedEvent | StarRemovedEvent | SubteamCreated | SubteamMembersChanged | SubteamSelfAddedEvent | SubteamSelfRemovedEvent | SubteamUpdatedEvent | TeamAccessGrantedEvent | TeamAccessRevokedEvent | TeamDomainChangedEvent | TeamJoinEvent | TeamRenameEvent | TokensRevokedEvent | UserChangeEvent | UserHuddleChangedEvent | UserProfileChangedEvent | UserStatusChangedEvent | WorkflowDeletedEvent | WorkflowPublishedEvent | WorkflowUnpublishedEvent | WorkflowStepDeletedEvent | WorkflowStepExecuteEvent; | ||
export declare type SlackEvent = AppRequestedEvent | AppInstalledEvent | AppDeletedEvent | AppUninstalledTeamEvent | AppHomeOpenedEvent | AppMentionEvent | AppRateLimitedEvent | AppUninstalledEvent | CallRejectedEvent | ChannelArchiveEvent | ChannelCreatedEvent | ChannelDeletedEvent | ChannelHistoryChangedEvent | ChannelIDChangedEvent | ChannelLeftEvent | ChannelRenameEvent | ChannelSharedEvent | ChannelUnarchiveEvent | ChannelUnsharedEvent | DNDUpdatedEvent | DNDUpdatedUserEvent | EmailDomainChangedEvent | EmojiChangedEvent | FileChangeEvent | FileCommentDeletedEvent | FileCreatedEvent | FileDeletedEvent | FilePublicEvent | FileSharedEvent | FileUnsharedEvent | GridMigrationFinishedEvent | GridMigrationStartedEvent | GroupArchiveEvent | GroupCloseEvent | GroupDeletedEvent | GroupHistoryChangedEvent | GroupLeftEvent | GroupOpenEvent | GroupRenameEvent | GroupUnarchiveEvent | IMCloseEvent | IMCreatedEvent | IMHistoryChangedEvent | IMOpenEvent | InviteRequestedEvent | LinkSharedEvent | MemberJoinedChannelEvent | MemberLeftChannelEvent | MessageEvent | MessageMetadataEvent | PinAddedEvent | PinRemovedEvent | ReactionAddedEvent | ReactionRemovedEvent | SharedChannelInviteReceivedEvent | SharedChannelInviteAcceptedEvent | SharedChannelInviteApprovedEvent | SharedChannelInviteDeclinedEvent | SharedChannelInviteRequestedEvent | StarAddedEvent | StarRemovedEvent | SubteamCreatedEvent | SubteamMembersChangedEvent | SubteamSelfAddedEvent | SubteamSelfRemovedEvent | SubteamUpdatedEvent | TeamAccessGrantedEvent | TeamAccessRevokedEvent | TeamDomainChangedEvent | TeamJoinEvent | TeamRenameEvent | TokensRevokedEvent | UserChangeEvent | UserHuddleChangedEvent | UserProfileChangedEvent | UserStatusChangedEvent | WorkflowDeletedEvent | WorkflowPublishedEvent | WorkflowUnpublishedEvent | WorkflowStepDeletedEvent | WorkflowStepExecuteEvent; | ||
export declare type EventTypePattern = string | RegExp; | ||
@@ -100,2 +100,31 @@ /** | ||
} | ||
export interface AppInstalledEvent { | ||
type: 'app_installed'; | ||
app_id: string; | ||
app_name: string; | ||
app_owner_id: string; | ||
user_id: string; | ||
team_id: string; | ||
team_domain: string; | ||
event_ts: string; | ||
} | ||
export interface AppDeletedEvent { | ||
type: 'app_deleted'; | ||
app_id: string; | ||
app_name: string; | ||
app_owner_id: string; | ||
team_id: string; | ||
team_domain: string; | ||
event_ts: string; | ||
} | ||
export interface AppUninstalledTeamEvent { | ||
type: 'app_uninstalled_team'; | ||
app_id: string; | ||
app_name: string; | ||
app_owner_id: string; | ||
team_id: string; | ||
team_domain: string; | ||
user_id: string; | ||
event_ts: string; | ||
} | ||
export interface AppMentionEvent { | ||
@@ -108,2 +137,15 @@ type: 'app_mention'; | ||
team?: string; | ||
user_team?: string; | ||
source_team?: string; | ||
user_profile?: { | ||
name: string; | ||
first_name: string; | ||
real_name: string; | ||
display_name: string; | ||
team: string; | ||
is_restricted?: boolean; | ||
is_ultra_restricted?: boolean; | ||
avatar_hash?: string; | ||
image_72?: string; | ||
}; | ||
user?: string; | ||
@@ -154,2 +196,3 @@ text: string; | ||
type: 'channel_created'; | ||
event_ts: string; | ||
channel: { | ||
@@ -164,2 +207,12 @@ id: string; | ||
is_org_shared: boolean; | ||
context_team_id: string; | ||
is_archived: boolean; | ||
is_frozen: boolean; | ||
is_general: boolean; | ||
is_group: boolean; | ||
is_private: boolean; | ||
is_ext_shared: boolean; | ||
is_im: boolean; | ||
is_mpim: boolean; | ||
is_pending_ext_shared: boolean; | ||
}; | ||
@@ -470,2 +523,3 @@ } | ||
permalink: string; | ||
ts: string; | ||
} | ||
@@ -591,3 +645,3 @@ export interface PinnedFileItem { | ||
} | ||
export interface SharedChannelInviteAccepted { | ||
export interface SharedChannelInviteAcceptedEvent { | ||
type: 'shared_channel_invite_accepted'; | ||
@@ -601,3 +655,7 @@ approval_required: boolean; | ||
} | ||
export interface SharedChannelInviteApproved { | ||
/** | ||
* @deprecated Will be removed in next major version. Use the `SharedChannelInviteAcceptedEvent` interface instead. | ||
*/ | ||
export declare type SharedChannelInviteAccepted = SharedChannelInviteAcceptedEvent; | ||
export interface SharedChannelInviteApprovedEvent { | ||
type: 'shared_channel_invite_approved'; | ||
@@ -611,3 +669,7 @@ invite: SharedChannelInviteItem; | ||
} | ||
export interface SharedChannelInviteDeclined { | ||
/** | ||
* @deprecated Will be removed in next major version. Use the `SharedChannelInviteApprovedEvent` interface instead. | ||
*/ | ||
export declare type SharedChannelInviteApproved = SharedChannelInviteApprovedEvent; | ||
export interface SharedChannelInviteDeclinedEvent { | ||
type: 'shared_channel_invite_declined'; | ||
@@ -621,3 +683,7 @@ invite: SharedChannelInviteItem; | ||
} | ||
export interface SharedChannelInviteReceived { | ||
/** | ||
* @deprecated Will be removed in next major version. Use the `SharedChannelInviteDeclinedEvent` interface instead. | ||
*/ | ||
export declare type SharedChannelInviteDeclined = SharedChannelInviteDeclinedEvent; | ||
export interface SharedChannelInviteReceivedEvent { | ||
type: 'shared_channel_invite_received'; | ||
@@ -628,2 +694,45 @@ invite: SharedChannelInviteItem; | ||
} | ||
/** | ||
* @deprecated Will be removed in next major version. Use the `SharedChannelInviteReceivedEvent` interface instead. | ||
*/ | ||
export declare type SharedChannelInviteReceived = SharedChannelInviteReceivedEvent; | ||
export interface SharedChannelInviteRequestedEvent { | ||
type: 'shared_channel_invite_requested'; | ||
actor: { | ||
id: string; | ||
name: string; | ||
is_bot: boolean; | ||
team_id: string; | ||
timezone: string; | ||
real_name: string; | ||
display_name: string; | ||
}; | ||
channel_id: string; | ||
event_type: 'slack#/events/shared_channel_invite_requested'; | ||
channel_name: string; | ||
channel_type: 'public' | 'private'; | ||
target_users: [{ | ||
email: string; | ||
invite_id: string; | ||
}]; | ||
teams_in_channel: [ | ||
{ | ||
id: string; | ||
icon: { | ||
image_34: string; | ||
image_default: boolean; | ||
}; | ||
name: string; | ||
domain: string; | ||
is_verified: boolean; | ||
date_created: number; | ||
avatar_base_url: string; | ||
requires_sponsorship: boolean; | ||
} | ||
]; | ||
is_external_limited: boolean; | ||
channel_date_created: number; | ||
channel_message_latest_counted_timestamp: number; | ||
event_ts: string; | ||
} | ||
export interface StarAddedEvent { | ||
@@ -665,3 +774,3 @@ type: 'star_added'; | ||
} | ||
export interface SubteamCreated { | ||
export interface SubteamCreatedEvent { | ||
type: 'subteam_created'; | ||
@@ -671,3 +780,7 @@ subteam: Subteam; | ||
} | ||
export interface SubteamMembersChanged { | ||
/** | ||
* @deprecated Will be removed in next major version. Use the `SubteamCreatedEvent` interface instead. | ||
*/ | ||
export declare type SubteamCreated = SubteamCreatedEvent; | ||
export interface SubteamMembersChangedEvent { | ||
type: 'subteam_members_changed'; | ||
@@ -684,2 +797,6 @@ subteam_id: string; | ||
} | ||
/** | ||
* @deprecated Will be removed in next major version. Use the `SubteamMembersChangedEvent` interface instead. | ||
*/ | ||
export declare type SubteamMembersChanged = SubteamMembersChangedEvent; | ||
export interface SubteamSelfAddedEvent { | ||
@@ -686,0 +803,0 @@ type: 'subteam_self_added'; |
{ | ||
"name": "@slack/bolt", | ||
"version": "3.19.0", | ||
"version": "3.20.0", | ||
"description": "A framework for building Slack apps, fast.", | ||
@@ -51,3 +51,3 @@ "author": "Slack Technologies, LLC", | ||
"@types/tsscmp": "^1.0.0", | ||
"axios": "^1.6.0", | ||
"axios": "^1.7.3", | ||
"express": "^4.16.4", | ||
@@ -63,3 +63,3 @@ "path-to-regexp": "^6.2.1", | ||
"@types/mocha": "^10.0.1", | ||
"@types/node": "20.14.2", | ||
"@types/node": "22.2.0", | ||
"@types/sinon": "^7.0.11", | ||
@@ -66,0 +66,0 @@ "@typescript-eslint/eslint-plugin": "^4.4.1", |
@@ -1,2 +0,2 @@ | ||
# Bolt ![Bolt logo](docs/assets/bolt-logo.svg) for JavaScript | ||
# Bolt <img src="https://raw.githubusercontent.com/slackapi/bolt-js/main/docs/static/img/bolt.svg" alt="Bolt logo" width="32"/> for JavaScript | ||
@@ -3,0 +3,0 @@ [![codecov](https://codecov.io/gh/slackapi/bolt-js/branch/main/graph/badge.svg?token=x4oCgiexvp)](https://codecov.io/gh/slackapi/bolt-js) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
535123
7672
Updatedaxios@^1.7.3