From 50c9fd0b32bd322697dd210f285f00eb5c708c2d Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Fri, 27 Sep 2024 13:00:00 -0400 Subject: [PATCH] adding deprecation notices to Steps from Apps stuff, and dropping reminder removal todos for eventual removal --- src/App.ts | 3 ++ src/WorkflowStep.ts | 72 +++++++++++++++++++++++-- src/errors.ts | 6 ++- src/helpers.ts | 1 + src/types/actions/index.ts | 3 ++ src/types/actions/workflow-step-edit.ts | 2 + src/types/view/index.ts | 8 ++- 7 files changed, 88 insertions(+), 7 deletions(-) diff --git a/src/App.ts b/src/App.ts index fb16d14ba..f254cbfae 100644 --- a/src/App.ts +++ b/src/App.ts @@ -522,6 +522,8 @@ export default class App * Register WorkflowStep middleware * * @param workflowStep global workflow step middleware function + * @deprecated Steps from Apps are no longer supported and support for them will be removed in the next major bolt-js + * version. */ public step(workflowStep: WorkflowStep): this { const m = workflowStep.getMiddleware(); @@ -997,6 +999,7 @@ export default class App // Set body and payload // TODO: this value should eventually conform to AnyMiddlewareArgs + // TODO: remove workflow step stuff in bolt v5 let payload: DialogSubmitAction | WorkflowStepEdit | SlackShortcut | KnownEventFromType | SlashCommand | KnownOptionsPayloadFromType | BlockElementAction | ViewOutput | InteractiveAction; // TODO: can we instead use type predicates in these switch cases to allow for narrowing of the body simultaneously? we have isEvent, isView, isShortcut, isAction already in types/utilities / helpers diff --git a/src/WorkflowStep.ts b/src/WorkflowStep.ts index fe08a79fe..05038ece4 100644 --- a/src/WorkflowStep.ts +++ b/src/WorkflowStep.ts @@ -24,6 +24,9 @@ import { WorkflowStepInitializationError } from './errors'; /** Interfaces */ +/** @deprecated Steps from Apps are no longer supported and support for them will be removed in the next major bolt-js + * version. + */ export interface StepConfigureArguments { blocks: (KnownBlock | Block)[]; private_metadata?: string; @@ -31,6 +34,9 @@ export interface StepConfigureArguments { external_id?: string; } +/** @deprecated Steps from Apps are no longer supported and support for them will be removed in the next major bolt-js + * version. + */ export interface StepUpdateArguments { inputs?: { [key: string]: { @@ -50,50 +56,80 @@ export interface StepUpdateArguments { step_image_url?: string; } +/** @deprecated Steps from Apps are no longer supported and support for them will be removed in the next major bolt-js + * version. + */ export interface StepCompleteArguments { outputs?: { [key: string]: any; }; } +/** @deprecated Steps from Apps are no longer supported and support for them will be removed in the next major bolt-js + * version. + */ export interface StepFailArguments { error: { message: string; }; } +/** @deprecated Steps from Apps are no longer supported and support for them will be removed in the next major bolt-js + * version. + */ export interface StepConfigureFn { (params: StepConfigureArguments): Promise; } +/** @deprecated Steps from Apps are no longer supported and support for them will be removed in the next major bolt-js + * version. + */ export interface StepUpdateFn { (params?: StepUpdateArguments): Promise; } +/** @deprecated Steps from Apps are no longer supported and support for them will be removed in the next major bolt-js + * version. + */ export interface StepCompleteFn { (params?: StepCompleteArguments): Promise; } +/** @deprecated Steps from Apps are no longer supported and support for them will be removed in the next major bolt-js + * version. + */ export interface StepFailFn { (params: StepFailArguments): Promise; } +/** @deprecated Steps from Apps are no longer supported and support for them will be removed in the next major bolt-js + * version. + */ export interface WorkflowStepConfig { edit: WorkflowStepEditMiddleware | WorkflowStepEditMiddleware[]; save: WorkflowStepSaveMiddleware | WorkflowStepSaveMiddleware[]; execute: WorkflowStepExecuteMiddleware | WorkflowStepExecuteMiddleware[]; } +/** @deprecated Steps from Apps are no longer supported and support for them will be removed in the next major bolt-js + * version. + */ export interface WorkflowStepEditMiddlewareArgs extends SlackActionMiddlewareArgs { step: WorkflowStepEdit['workflow_step']; configure: StepConfigureFn; } +/** @deprecated Steps from Apps are no longer supported and support for them will be removed in the next major bolt-js + * version. + */ export interface WorkflowStepSaveMiddlewareArgs extends SlackViewMiddlewareArgs { step: ViewWorkflowStepSubmitAction['workflow_step']; update: StepUpdateFn; } +/** @deprecated Steps from Apps are no longer supported and support for them will be removed in the next major bolt-js + * version. + */ export interface WorkflowStepExecuteMiddlewareArgs extends SlackEventMiddlewareArgs<'workflow_step_execute'> { step: WorkflowStepExecuteEvent['workflow_step']; complete: StepCompleteFn; @@ -102,20 +138,38 @@ export interface WorkflowStepExecuteMiddlewareArgs extends SlackEventMiddlewareA /** Types */ +/** @deprecated Steps from Apps are no longer supported and support for them will be removed in the next major bolt-js + * version. + */ export type SlackWorkflowStepMiddlewareArgs = | WorkflowStepEditMiddlewareArgs | WorkflowStepSaveMiddlewareArgs | WorkflowStepExecuteMiddlewareArgs; +/** @deprecated Steps from Apps are no longer supported and support for them will be removed in the next major bolt-js + * version. + */ export type WorkflowStepEditMiddleware = Middleware; +/** @deprecated Steps from Apps are no longer supported and support for them will be removed in the next major bolt-js + * version. + */ export type WorkflowStepSaveMiddleware = Middleware; +/** @deprecated Steps from Apps are no longer supported and support for them will be removed in the next major bolt-js + * version. + */ export type WorkflowStepExecuteMiddleware = Middleware; +/** @deprecated Steps from Apps are no longer supported and support for them will be removed in the next major bolt-js + * version. + */ export type WorkflowStepMiddleware = | WorkflowStepEditMiddleware[] | WorkflowStepSaveMiddleware[] | WorkflowStepExecuteMiddleware[]; +/** @deprecated Steps from Apps are no longer supported and support for them will be removed in the next major bolt-js + * version. + */ export type AllWorkflowStepMiddlewareArgs = T & AllMiddlewareArgs; @@ -123,8 +177,9 @@ export type AllWorkflowStepMiddlewareArgs['body']; return { diff --git a/src/types/actions/index.ts b/src/types/actions/index.ts index 239cf7f0a..0bbb718a9 100644 --- a/src/types/actions/index.ts +++ b/src/types/actions/index.ts @@ -9,6 +9,7 @@ import { FunctionInputs } from '../events'; export * from './block-action'; export * from './interactive-message'; export * from './dialog-action'; +// TODO: remove workflow step stuff in bolt v5 export * from './workflow-step-edit'; /** @@ -25,6 +26,7 @@ export * from './workflow-step-edit'; * offered when no generic parameter is bound would be limited to BasicElementAction rather than the union of known * actions - ElementAction. */ +// TODO: remove workflow step stuff in bolt v5 export type SlackAction = BlockAction | InteractiveMessage | DialogSubmitAction | WorkflowStepEdit; /** @@ -54,6 +56,7 @@ export type SlackActionMiddlewareArgs complete?: FunctionCompleteFn; fail?: FunctionFailFn; inputs?: FunctionInputs; +// TODO: remove workflow step stuff in bolt v5 } & (Action extends Exclude // all action types except dialog submission and steps from apps have a channel context ? { say: SayFn } diff --git a/src/types/actions/workflow-step-edit.ts b/src/types/actions/workflow-step-edit.ts index 85b7033fb..f344c54ef 100644 --- a/src/types/actions/workflow-step-edit.ts +++ b/src/types/actions/workflow-step-edit.ts @@ -2,6 +2,8 @@ * A Slack step from app action wrapped in the standard metadata. * * This describes the entire JSON-encoded body of a request from Slack step from app actions. + * @deprecated Steps from Apps are no longer supported and support for them will be removed in the next major bolt-js + * version. */ export interface WorkflowStepEdit { type: 'workflow_step_edit'; diff --git a/src/types/view/index.ts b/src/types/view/index.ts index d38a8b0f3..20b66597a 100644 --- a/src/types/view/index.ts +++ b/src/types/view/index.ts @@ -7,7 +7,7 @@ import { AckFn, RespondFn } from '../utilities'; export type SlackViewAction = | ViewSubmitAction | ViewClosedAction - | ViewWorkflowStepSubmitAction + | ViewWorkflowStepSubmitAction // TODO: remove workflow step stuff in bolt v5 | ViewWorkflowStepClosedAction; // /** @@ -101,8 +101,9 @@ export interface ViewClosedAction { * A Slack view_submission step from app event * * This describes the additional JSON-encoded body details for a step's view_submission event + * @deprecated Steps from Apps are no longer supported and support for them will be removed in the next major bolt-js + * version. */ - export interface ViewWorkflowStepSubmitAction extends ViewSubmitAction { trigger_id: string; response_urls?: ViewResponseUrl[]; @@ -117,6 +118,8 @@ export interface ViewWorkflowStepSubmitAction extends ViewSubmitAction { * A Slack view_closed step from app event * * This describes the additional JSON-encoded body details for a step's view_closed event + * @deprecated Steps from Apps are no longer supported and support for them will be removed in the next major bolt-js + * version. */ export interface ViewWorkflowStepClosedAction extends ViewClosedAction { workflow_step: { @@ -131,6 +134,7 @@ export interface ViewStateSelectedOption { value: string; } +// TODO: this should probably exist in @slack/types export interface UploadedFile { id: string; created: number;