Skip to content

Commit

Permalink
added helper to README and cleaned up the code
Browse files Browse the repository at this point in the history
  • Loading branch information
AksharaAK committed Jan 26, 2022
1 parent 21ac845 commit 9873596
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,22 @@ An interface to the deployed EventBridge, allowing events to be injected and int
eventBridge.destroy() - remove infastructure used to track events
```

### Step Functions

An interface to a deployed Step Function, with a function to execute a Step Function until its completion.

#### Static

```
StepFunctions.build() // create a Step Functions Client for executing existing state machines
```

#### Instance

```
stepFunctions.runExecution(stateMachineName, input) // executes state machine until completion
```

## Running with `jest`

### Arguments
Expand Down
5 changes: 1 addition & 4 deletions src/helpers/stepFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ export default class StepFunctions {
}

async runExecution(stateMachineName: string, input: any): Promise<any> {
// this.stepFunctions = new AWSStepFunctions();
// this.allStateMachines = await this.stepFunctions
// .listStateMachines()
// .promise();
if (this.allStateMachines === undefined) {
throw new Error(
"The list of state machines is undefined. You might have forgotten to run build()."
Expand Down Expand Up @@ -50,6 +46,7 @@ export default class StepFunctions {
const executionList = await this.stepFunctions
.listExecutions(listExecParams)
.promise();
// Poll until the given execution is no longer running
while (
executionList.executions.filter(
(exec: any) =>
Expand Down

0 comments on commit 9873596

Please sign in to comment.