Skip to content

Commit 50c9fd0

Browse files
author
Filip Maj
committed
adding deprecation notices to Steps from Apps stuff, and dropping reminder removal todos for eventual removal
1 parent b433f29 commit 50c9fd0

File tree

7 files changed

+88
-7
lines changed

7 files changed

+88
-7
lines changed

src/App.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,8 @@ export default class App<AppCustomContext extends StringIndexed = StringIndexed>
522522
* Register WorkflowStep middleware
523523
*
524524
* @param workflowStep global workflow step middleware function
525+
* @deprecated Steps from Apps are no longer supported and support for them will be removed in the next major bolt-js
526+
* version.
525527
*/
526528
public step(workflowStep: WorkflowStep): this {
527529
const m = workflowStep.getMiddleware();
@@ -997,6 +999,7 @@ export default class App<AppCustomContext extends StringIndexed = StringIndexed>
997999

9981000
// Set body and payload
9991001
// TODO: this value should eventually conform to AnyMiddlewareArgs
1002+
// TODO: remove workflow step stuff in bolt v5
10001003
let payload: DialogSubmitAction | WorkflowStepEdit | SlackShortcut | KnownEventFromType<string> | SlashCommand
10011004
| KnownOptionsPayloadFromType<string> | BlockElementAction | ViewOutput | InteractiveAction;
10021005
// 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

src/WorkflowStep.ts

Lines changed: 68 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,19 @@ import { WorkflowStepInitializationError } from './errors';
2424

2525
/** Interfaces */
2626

27+
/** @deprecated Steps from Apps are no longer supported and support for them will be removed in the next major bolt-js
28+
* version.
29+
*/
2730
export interface StepConfigureArguments {
2831
blocks: (KnownBlock | Block)[];
2932
private_metadata?: string;
3033
submit_disabled?: boolean;
3134
external_id?: string;
3235
}
3336

37+
/** @deprecated Steps from Apps are no longer supported and support for them will be removed in the next major bolt-js
38+
* version.
39+
*/
3440
export interface StepUpdateArguments {
3541
inputs?: {
3642
[key: string]: {
@@ -50,50 +56,80 @@ export interface StepUpdateArguments {
5056
step_image_url?: string;
5157
}
5258

59+
/** @deprecated Steps from Apps are no longer supported and support for them will be removed in the next major bolt-js
60+
* version.
61+
*/
5362
export interface StepCompleteArguments {
5463
outputs?: {
5564
[key: string]: any;
5665
};
5766
}
5867

68+
/** @deprecated Steps from Apps are no longer supported and support for them will be removed in the next major bolt-js
69+
* version.
70+
*/
5971
export interface StepFailArguments {
6072
error: {
6173
message: string;
6274
};
6375
}
6476

77+
/** @deprecated Steps from Apps are no longer supported and support for them will be removed in the next major bolt-js
78+
* version.
79+
*/
6580
export interface StepConfigureFn {
6681
(params: StepConfigureArguments): Promise<ViewsOpenResponse>;
6782
}
6883

84+
/** @deprecated Steps from Apps are no longer supported and support for them will be removed in the next major bolt-js
85+
* version.
86+
*/
6987
export interface StepUpdateFn {
7088
(params?: StepUpdateArguments): Promise<WorkflowsUpdateStepResponse>;
7189
}
7290

91+
/** @deprecated Steps from Apps are no longer supported and support for them will be removed in the next major bolt-js
92+
* version.
93+
*/
7394
export interface StepCompleteFn {
7495
(params?: StepCompleteArguments): Promise<WorkflowsStepCompletedResponse>;
7596
}
7697

98+
/** @deprecated Steps from Apps are no longer supported and support for them will be removed in the next major bolt-js
99+
* version.
100+
*/
77101
export interface StepFailFn {
78102
(params: StepFailArguments): Promise<WorkflowsStepFailedResponse>;
79103
}
80104

105+
/** @deprecated Steps from Apps are no longer supported and support for them will be removed in the next major bolt-js
106+
* version.
107+
*/
81108
export interface WorkflowStepConfig {
82109
edit: WorkflowStepEditMiddleware | WorkflowStepEditMiddleware[];
83110
save: WorkflowStepSaveMiddleware | WorkflowStepSaveMiddleware[];
84111
execute: WorkflowStepExecuteMiddleware | WorkflowStepExecuteMiddleware[];
85112
}
86113

114+
/** @deprecated Steps from Apps are no longer supported and support for them will be removed in the next major bolt-js
115+
* version.
116+
*/
87117
export interface WorkflowStepEditMiddlewareArgs extends SlackActionMiddlewareArgs<WorkflowStepEdit> {
88118
step: WorkflowStepEdit['workflow_step'];
89119
configure: StepConfigureFn;
90120
}
91121

122+
/** @deprecated Steps from Apps are no longer supported and support for them will be removed in the next major bolt-js
123+
* version.
124+
*/
92125
export interface WorkflowStepSaveMiddlewareArgs extends SlackViewMiddlewareArgs<ViewWorkflowStepSubmitAction> {
93126
step: ViewWorkflowStepSubmitAction['workflow_step'];
94127
update: StepUpdateFn;
95128
}
96129

130+
/** @deprecated Steps from Apps are no longer supported and support for them will be removed in the next major bolt-js
131+
* version.
132+
*/
97133
export interface WorkflowStepExecuteMiddlewareArgs extends SlackEventMiddlewareArgs<'workflow_step_execute'> {
98134
step: WorkflowStepExecuteEvent['workflow_step'];
99135
complete: StepCompleteFn;
@@ -102,29 +138,48 @@ export interface WorkflowStepExecuteMiddlewareArgs extends SlackEventMiddlewareA
102138

103139
/** Types */
104140

141+
/** @deprecated Steps from Apps are no longer supported and support for them will be removed in the next major bolt-js
142+
* version.
143+
*/
105144
export type SlackWorkflowStepMiddlewareArgs =
106145
| WorkflowStepEditMiddlewareArgs
107146
| WorkflowStepSaveMiddlewareArgs
108147
| WorkflowStepExecuteMiddlewareArgs;
109148

149+
/** @deprecated Steps from Apps are no longer supported and support for them will be removed in the next major bolt-js
150+
* version.
151+
*/
110152
export type WorkflowStepEditMiddleware = Middleware<WorkflowStepEditMiddlewareArgs>;
153+
/** @deprecated Steps from Apps are no longer supported and support for them will be removed in the next major bolt-js
154+
* version.
155+
*/
111156
export type WorkflowStepSaveMiddleware = Middleware<WorkflowStepSaveMiddlewareArgs>;
157+
/** @deprecated Steps from Apps are no longer supported and support for them will be removed in the next major bolt-js
158+
* version.
159+
*/
112160
export type WorkflowStepExecuteMiddleware = Middleware<WorkflowStepExecuteMiddlewareArgs>;
113161

162+
/** @deprecated Steps from Apps are no longer supported and support for them will be removed in the next major bolt-js
163+
* version.
164+
*/
114165
export type WorkflowStepMiddleware =
115166
| WorkflowStepEditMiddleware[]
116167
| WorkflowStepSaveMiddleware[]
117168
| WorkflowStepExecuteMiddleware[];
118169

170+
/** @deprecated Steps from Apps are no longer supported and support for them will be removed in the next major bolt-js
171+
* version.
172+
*/
119173
export type AllWorkflowStepMiddlewareArgs<T extends SlackWorkflowStepMiddlewareArgs = SlackWorkflowStepMiddlewareArgs> =
120174
T & AllMiddlewareArgs;
121175

122176
/** Constants */
123177

124178
const VALID_PAYLOAD_TYPES = new Set(['workflow_step_edit', 'workflow_step', 'workflow_step_execute']);
125179

126-
/** Class */
127-
180+
/** @deprecated Steps from Apps are no longer supported and support for them will be removed in the next major bolt-js
181+
* version.
182+
*/
128183
export class WorkflowStep {
129184
/** Step callback_id */
130185
private callbackId: string;
@@ -185,6 +240,9 @@ export class WorkflowStep {
185240

186241
/** Helper Functions */
187242

243+
/** @deprecated Steps from Apps are no longer supported and support for them will be removed in the next major bolt-js
244+
* version.
245+
*/
188246
export function validate(callbackId: string, config: WorkflowStepConfig): void {
189247
// Ensure callbackId is valid
190248
if (typeof callbackId !== 'string') {
@@ -224,6 +282,8 @@ export function validate(callbackId: string, config: WorkflowStepConfig): void {
224282

225283
/**
226284
* `processStepMiddleware()` invokes each callback for lifecycle event
285+
* @deprecated Steps from Apps are no longer supported and support for them will be removed in the next major bolt-js
286+
* version.
227287
* @param args workflow_step_edit action
228288
*/
229289
export async function processStepMiddleware(
@@ -243,6 +303,9 @@ export async function processStepMiddleware(
243303
}
244304
}
245305

306+
/** @deprecated Steps from Apps are no longer supported and support for them will be removed in the next major bolt-js
307+
* version.
308+
*/
246309
export function isStepEvent(args: AnyMiddlewareArgs): args is AllWorkflowStepMiddlewareArgs {
247310
return VALID_PAYLOAD_TYPES.has(args.payload.type);
248311
}
@@ -345,8 +408,9 @@ function createStepFail(args: AllWorkflowStepMiddlewareArgs<WorkflowStepExecuteM
345408
* 1. removes the next() passed in from App-level middleware processing
346409
* - events will *not* continue down global middleware chain to subsequent listeners
347410
* 2. augments args with step lifecycle-specific properties/utilities
348-
* */
349-
// TODO :: refactor to incorporate a generic parameter
411+
* @deprecated Steps from Apps are no longer supported and support for them will be removed in the next major bolt-js
412+
* version.
413+
*/
350414
export function prepareStepArgs(args: any): AllWorkflowStepMiddlewareArgs {
351415
const { next: _next, ...stepArgs } = args;
352416
const preparedArgs: any = { ...stepArgs };

src/errors.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export enum ErrorCode {
3838
*/
3939
UnknownError = 'slack_bolt_unknown_error',
4040

41+
// TODO: remove workflow step stuff in bolt v5
4142
WorkflowStepInitializationError = 'slack_bolt_workflow_step_initialization_error',
4243

4344
CustomFunctionInitializationError = 'slack_bolt_custom_function_initialization_error',
@@ -143,7 +144,10 @@ export class MultipleListenerError extends Error implements CodedError {
143144
this.originals = originals;
144145
}
145146
}
146-
147+
/**
148+
* @deprecated Steps from Apps are no longer supported and support for them will be removed in the next major bolt-js
149+
* version.
150+
*/
147151
export class WorkflowStepInitializationError extends Error implements CodedError {
148152
public code = ErrorCode.WorkflowStepInitializationError;
149153
}

src/helpers.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ export function getTypeAndConversation(body: any): { type?: IncomingEventType; c
8181
conversationId: optionsBody.channel !== undefined ? optionsBody.channel.id : undefined,
8282
};
8383
}
84+
// TODO: remove workflow_step stuff in v5
8485
if (body.actions !== undefined || body.type === 'dialog_submission' || body.type === 'workflow_step_edit') {
8586
const actionBody = body as SlackActionMiddlewareArgs<SlackAction>['body'];
8687
return {

src/types/actions/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { FunctionInputs } from '../events';
99
export * from './block-action';
1010
export * from './interactive-message';
1111
export * from './dialog-action';
12+
// TODO: remove workflow step stuff in bolt v5
1213
export * from './workflow-step-edit';
1314

1415
/**
@@ -25,6 +26,7 @@ export * from './workflow-step-edit';
2526
* offered when no generic parameter is bound would be limited to BasicElementAction rather than the union of known
2627
* actions - ElementAction.
2728
*/
29+
// TODO: remove workflow step stuff in bolt v5
2830
export type SlackAction = BlockAction | InteractiveMessage | DialogSubmitAction | WorkflowStepEdit;
2931

3032
/**
@@ -54,6 +56,7 @@ export type SlackActionMiddlewareArgs<Action extends SlackAction = SlackAction>
5456
complete?: FunctionCompleteFn;
5557
fail?: FunctionFailFn;
5658
inputs?: FunctionInputs;
59+
// TODO: remove workflow step stuff in bolt v5
5760
} & (Action extends Exclude<SlackAction, DialogSubmitAction | WorkflowStepEdit>
5861
// all action types except dialog submission and steps from apps have a channel context
5962
? { say: SayFn }

src/types/actions/workflow-step-edit.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
* A Slack step from app action wrapped in the standard metadata.
33
*
44
* This describes the entire JSON-encoded body of a request from Slack step from app actions.
5+
* @deprecated Steps from Apps are no longer supported and support for them will be removed in the next major bolt-js
6+
* version.
57
*/
68
export interface WorkflowStepEdit {
79
type: 'workflow_step_edit';

src/types/view/index.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { AckFn, RespondFn } from '../utilities';
77
export type SlackViewAction =
88
| ViewSubmitAction
99
| ViewClosedAction
10-
| ViewWorkflowStepSubmitAction
10+
| ViewWorkflowStepSubmitAction // TODO: remove workflow step stuff in bolt v5
1111
| ViewWorkflowStepClosedAction;
1212
// <ViewAction extends SlackViewAction = ViewSubmitAction>
1313
/**
@@ -101,8 +101,9 @@ export interface ViewClosedAction {
101101
* A Slack view_submission step from app event
102102
*
103103
* This describes the additional JSON-encoded body details for a step's view_submission event
104+
* @deprecated Steps from Apps are no longer supported and support for them will be removed in the next major bolt-js
105+
* version.
104106
*/
105-
106107
export interface ViewWorkflowStepSubmitAction extends ViewSubmitAction {
107108
trigger_id: string;
108109
response_urls?: ViewResponseUrl[];
@@ -117,6 +118,8 @@ export interface ViewWorkflowStepSubmitAction extends ViewSubmitAction {
117118
* A Slack view_closed step from app event
118119
*
119120
* This describes the additional JSON-encoded body details for a step's view_closed event
121+
* @deprecated Steps from Apps are no longer supported and support for them will be removed in the next major bolt-js
122+
* version.
120123
*/
121124
export interface ViewWorkflowStepClosedAction extends ViewClosedAction {
122125
workflow_step: {
@@ -131,6 +134,7 @@ export interface ViewStateSelectedOption {
131134
value: string;
132135
}
133136

137+
// TODO: this should probably exist in @slack/types
134138
export interface UploadedFile {
135139
id: string;
136140
created: number;

0 commit comments

Comments
 (0)