-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for wildcard/unscoped channel/workspace event trigger definitions #98
Conversation
/** @description The channel id's that this event listens on */ | ||
channel_ids: PopulatedArray<string>; | ||
// deno-lint-ignore no-explicit-any | ||
[otherOptions: string]: any; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was moved down to BaseEvent
& BaseEvent | ||
& { | ||
/** @description The type of event */ | ||
event_type: Extract<ChannelTypes, MessageMetadataTypes>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed this line by extending from ChannelEvent
instead of BaseEvent
[otherOptions: string]: any; | ||
}; | ||
|
||
type BaseWorkspaceEvent = BaseEvent & { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merged BaseWorkspaceEvent
into WorkspaceEvents
, since they are only used here.
name: "test", | ||
workflow: "#/workflows/example", | ||
inputs: {}, | ||
// @ts-expect-error requires one of `all_resources:true` or `channel_ids` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using @ts-expect-error
, we can test for the error path, which I think is very helpful for maintaining types. If we have a large enough set of these type tests, we will be able to more easily refactor the types with less worry about forgetting something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 👍
}; | ||
} | ||
// deno-lint-ignore no-explicit-any | ||
& Record<string, any>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this 💯
Fixes slackapi/deno-slack-sdk#222 and slackapi/deno-slack-sdk#298
Allows for use of
all_resources: boolean
in a channel event trigger'sevent
object. Previously, channel event types required a hard-coded list ofchannel_ids
(so were scoped to specific channels by default).