Skip to content
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

Merged
merged 2 commits into from
Apr 16, 2024

Conversation

filmaj
Copy link
Contributor

@filmaj filmaj commented Apr 12, 2024

Fixes slackapi/deno-slack-sdk#222 and slackapi/deno-slack-sdk#298

Allows for use of all_resources: boolean in a channel event trigger's event object. Previously, channel event types required a hard-coded list of channel_ids (so were scoped to specific channels by default).

@filmaj filmaj added enhancement New feature or request semver:patch requires a patch version number bump labels Apr 12, 2024
@filmaj filmaj self-assigned this Apr 12, 2024
@filmaj filmaj requested a review from a team as a code owner April 12, 2024 14:28
@filmaj filmaj added semver:minor requires a minor version number bump and removed semver:patch requires a patch version number bump labels Apr 12, 2024
/** @description The channel id's that this event listens on */
channel_ids: PopulatedArray<string>;
// deno-lint-ignore no-explicit-any
[otherOptions: string]: any;
Copy link
Contributor Author

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>;
Copy link
Contributor Author

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 & {
Copy link
Contributor Author

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`
Copy link
Contributor Author

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.

Copy link
Contributor

@WilliamBergamin WilliamBergamin left a 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>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this 💯

@filmaj filmaj merged commit 199ef46 into main Apr 16, 2024
9 checks passed
@filmaj filmaj deleted the all_resources branch April 16, 2024 17:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request semver:minor requires a minor version number bump
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[QUERY] How to listen on all channels or joined channels when create a event trigger like app_mentioned
2 participants