Skip to Content

Workflow.then()

.then() メソッドは、ワークフローの各ステップ間に順次的な依存関係を作り、ステップが特定の順序で実行されることを保証します。

使用方法

workflow.step(stepOne).then(stepTwo).then(stepThree);

パラメーター

step:

Step | string
前のステップが完了した後に実行されるステップインスタンスまたはステップID

戻り値

workflow:

LegacyWorkflow
メソッドチェーン用のワークフローインスタンス

バリデーション

then を使用する場合:

  • 前のステップがワークフロー内に存在している必要があります
  • ステップ同士で循環参照を作成してはいけません
  • 各ステップはシーケンシャルチェーン内で一度だけ登場できます

エラー処理

try { workflow .step(stepA) .then(stepB) .then(stepA) // Will throw error - circular dependency .commit(); } catch (error) { if (error instanceof ValidationError) { console.log(error.type); // 'circular_dependency' console.log(error.details); } }

関連