new Fragment(name, domain, tasklist)
Represents a single, named workflow, where all activities and decisions are defined.
Parameters:
| Name | Type | Argument | Default | Description |
|---|---|---|---|---|
name |
string | The name of the workflow. | ||
domain |
string | The AWS SWF domain name to execute this workflow in. | ||
tasklist |
string |
<optional> |
<name>-tasklist | The name of the tasklist to listen for tasks on. |
- Source:
Methods
-
accumulator(name, deps, fragment, doneFn, options) → {Fragment}
-
Add a accumulator execution to the workflow The accumulator executes a fragment until the `doneFn` returns a truthy value, taking the results of each iteration and making them available to any dependents
Parameters:
Name Type Argument Description namestring The unique name of the accumulator fragment. depsArray <optional>
The names of the dependencies that must be met before this activity can execute. fragmentFragment The workflow fragment to iterate over. Generated by `usher.fragment()` doneFnfunction Indicates when the accumulator is complete by returning a truthy value. optionsObject <optional>
Custom options for this activity. - Source:
Returns:
This workflow so you can chain commands.- Type
- Fragment
-
activity(name, deps, options) → {Fragment}
-
Add an activity to the workflow
Parameters:
Name Type Argument Description namestring The unique name of the activity. depsArray <optional>
The names of the dependencies that must be met before this activity can execute. optionsObject <optional>
Custom options for this activity. - Source:
Returns:
This workflow so you can chain commands.- Type
- Fragment
-
activityDefaults(options) → {Fragment}
-
Set global activity options for the entire workflow
Parameters:
Name Type Description optionsObject Custom options to use for all defined activities. - Source:
Returns:
This workflow so you can chain commands.- Type
- Fragment
-
child(name, deps, workflowName, workflowVersion, options) → {Fragment}
-
Add an child workflow execution to the workflow
Parameters:
Name Type Argument Description namestring The unique name of the child workflow. depsArray <optional>
The names of the dependencies that must be met before this activity can execute. workflowNamestring The name of the workflow to execute. workflowVersionstring The version of the workflow to execute. optionsObject <optional>
Custom options for this activity. - Source:
Returns:
This workflow so you can chain commands.- Type
- Fragment
-
decision(name, deps, decisionFn) → {Fragment}
-
Add a decision to the workflow
Parameters:
Name Type Argument Description namestring The unique name of the decision. depsArray <optional>
The names of the dependencies that must be met before this decision can execute. decisionFnFragment~decisionLogic The logic for this decision. - Source:
Returns:
This workflow so you can chain commands.- Type
- Fragment
-
loop(name, deps, fragment, loopFn, options) → {Fragment}
-
Add a looping workflow execution to the workflow The loop executes in batches to help alleviate rate limit exceptions. The number of items to proccess per batch and the delay between batches are both configurable.
Parameters:
Name Type Argument Description namestring The unique name of the loop fragment. depsArray <optional>
The names of the dependencies that must be met before this activity can execute. fragmentFragment The workflow fragment to loop over. Generated by `usher.fragment()` loopFnfunction A function given the taks's input that returns an array. For every item in the Array an execution of the `fragment` workflow will execute. optionsObject <optional>
Custom options for this activity. [itemsPerBatch, batchDelay] - Source:
Returns:
This workflow so you can chain commands.- Type
- Fragment
-
result(name, deps, transformFn) → {Fragment}
-
Add a result transformation to the workflow. This sets the fragments results based on the `transformFn`
Parameters:
Name Type Argument Description namestring The unique name of the result task. depsArray <optional>
The names of the dependencies that must be met before this decision can execute. transformFnFragment~transformationLogic <optional>
The funtion that will perform the transformation. - Source:
Returns:
This workflow so you can chain commands.- Type
- Fragment
-
sequencedTasks() → {Array}
-
Get the defined tasks for the fragment in execution order
- Source:
Returns:
An array of defined tasks- Type
- Array
-
tasks() → {Array}
-
Get the defined tasks for the fragment
- Source:
Returns:
An array of defined tasks- Type
- Array
-
terminate(name, deps) → {Fragment}
-
Add a termination point to the workflow
Parameters:
Name Type Argument Description namestring The unique name that represents this termination point. depsArray <optional>
The names of the dependencies that must be met before the workflow can terminate. - Source:
Returns:
This workflow so you can chain commands.- Type
- Fragment
-
transform(name, deps, transformFn) → {Fragment}
-
Add a transformation to the workflow. Transformations are good for manipulating the results of prior activities into new representations for future dependents.
Parameters:
Name Type Argument Description namestring The unique name of the transformation. depsArray <optional>
The names of the dependencies that must be met before this decision can execute. transformFnFragment~transformationLogic <optional>
The funtion that will perform the transformation. - Source:
Returns:
This workflow so you can chain commands.- Type
- Fragment
-
variable(name, deps, valueFn) → {Fragment}
-
Set an variable accessable to all future scheduled activities
Parameters:
Name Type Argument Description namestring The unique name of the variable. depsArray <optional>
The names of the dependencies that must be met before this variable can be set. valueFnFragment~variableValueFunction <optional>
The funtion that will calculate the variable name. - Source:
Returns:
This workflow so you can chain commands.- Type
- Fragment
-
whileLoop(name, deps, fragment, doneFn, options) → {Fragment}
-
Add a while loop workflow execution to the workflow The loop executes until the `doneFn` returns a truthy value
Parameters:
Name Type Argument Description namestring The unique name of the while loop fragment. depsArray <optional>
The names of the dependencies that must be met before this activity can execute. fragmentFragment The workflow fragment to loop over. Generated by `usher.fragment()` doneFnfunction Indicates when the loop is complete by returning a truthy value. optionsObject <optional>
Custom options for this activity. - Source:
Returns:
This workflow so you can chain commands.- Type
- Fragment
Type Definitions
-
decisionLogic(input) → {Boolean}
-
The decision logic to execute when evaluating the given named decision
Parameters:
Name Type Description inputObject The results of all dependencies for this decision - Source:
Returns:
Should dependents of this decision execute- Type
- Boolean
-
transformationLogic(input) → {*}
-
The tranformation to execute
Parameters:
Name Type Description inputObject The results of all dependencies for this transformation - Source:
Returns:
The transformed input- Type
- *
-
variableValueFunction(input) → {*}
-
A function to determine the value of the variable
Parameters:
Name Type Description inputObject The results of all dependencies for this variable - Source:
Returns:
The variable value- Type
- *