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

Export types for Workflows #1931

Open
culli opened this issue Aug 22, 2023 · 3 comments
Open

Export types for Workflows #1931

culli opened this issue Aug 22, 2023 · 3 comments
Labels
enhancement M-T: A feature request for new functionality TypeScript-specific
Milestone

Comments

@culli
Copy link

culli commented Aug 22, 2023

To make it a little more convenient to work with workflows, expose WorkflowStepEditMiddlewareArgs, WorkflowStepSaveMiddlewareArgs, and WorkflowStepExecuteMiddlewareArgs types. This would be much like SlackCommandMiddlewareArgs and SlackActionMiddlewareArgs are exposed.

I'm just looking to make code a little cleaner when handling workflow step events. Sure I can alias and introduce types to hide away some of this, but I just wanted it to work the way I can use SlackCommandMiddlewareArgs.

My use case looks like:

export const createWorkflowStep = () => {
  return new WorkflowStep(`my_step_name`, {
    edit: async ({ ack, configure }) => {},
    save: async ({ ack, view, update }) => {},
    execute: async (args) => {
      handleExec(args);  //I can't actually do this and keep type information about args
    }
...

How I'd like to use it:

handleExec(args: WorkflowStepSaveMiddlewareArgs) {
  ...
}

Workaround:

...
    execute: async (args) => {
      const { step, body, complete, fail, context, client } = args;
      handleExec({
          workflowId: step.workflow_id,
          incomingUserId: step.inputs.userId.value,
          incomingChannelId: step.inputs.slackChannelId.value,
          teamId: body.team_id,
          context,
          client,
    }
...

handleExec(args: {
    workflowId: string;
    incomingUserId: string;
    incomingChannelId: string;
    teamId: string;
    context: Context & StringIndexed;
    client: WebClient;
  }) {
...
}

Thanks!

@seratch seratch added enhancement M-T: A feature request for new functionality TypeScript-specific and removed untriaged labels Aug 22, 2023
@seratch
Copy link
Member

seratch commented Aug 22, 2023

Hi @culli, thanks for writing! We are always happy to enhance the type exports for better TS dev experience.

However, I have to mention that our platform just announced the deprecation of Steps from Apps: https://api.slack.com/changelog/2023-08-workflow-steps-from-apps-step-back

I understand this could be a disappointing news for the developers leveraging the feature (like you), but we hope the new automation platform works better for you.

@culli
Copy link
Author

culli commented Aug 23, 2023

I was actually aware of the deprecation, and asked support for clarification on timelines and whatnot. The gist of what they said on Aug 15 is the (deno-based) new platform is not feature complete and Bolt will be supported for some time to come, with no specific sunset date for any part of it.

I guess news takes a while to travel through a big company or the decision was reached since then!

I'll limp this along until I get time to convert to the new shiny deno stuff.

@filmaj
Copy link
Contributor

filmaj commented Aug 23, 2023

Just wanted to jump in and clarify one thing: there are NO plans to deprecate the Bolt framework or any other legacy platform features other than Steps From Apps. The deprecation @seratch mentioned is solely scoped to the Steps From Apps feature of the legacy platform.

@seratch seratch added this to the 3.x milestone Aug 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement M-T: A feature request for new functionality TypeScript-specific
Projects
None yet
Development

No branches or pull requests

3 participants