New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

serverless-step-functions

Package Overview
Dependencies
Maintainers
1
Versions
132
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

serverless-step-functions - npm Package Compare versions

Comparing version 0.4.2 to 1.0.0

lib/deploy/events/apiGateway/apigateway-to-stepfunctions-assume-role.json

458

lib/index.js
'use strict';
const stateMachine = require('./stateMachine');
const activity = require('./activity');
const iam = require('./iam');
const dataProcessing = require('./dataProcessing');
const utils = require('./utils');
const BbPromise = require('bluebird');
const compileStateMachines = require('./deploy/stepFunctions/compileStateMachines');
const compileActivities = require('./deploy/stepFunctions/compileActivities');
const compileIamRole = require('./deploy/stepFunctions/compileIamRole');
const httpValidate = require('./deploy/events/apiGateway/validate');
const httpResources = require('./deploy/events/apiGateway/resources');
const httpMethods = require('./deploy/events/apiGateway/methods');
const httpIamRole = require('./deploy/events/apiGateway/iamRole');
const httpDeployment = require('./deploy/events/apiGateway/deployment');
const httpRestApi = require('./deploy/events/apiGateway/restApi');
const httpInfo = require('./deploy/events/apiGateway/endpointInfo');
const invoke = require('./invoke/invoke');
const yamlParser = require('./yamlParser');
const naming = require('./naming');
const _ = require('lodash');

@@ -22,135 +31,18 @@ const chalk = require('chalk');

this,
stateMachine,
activity,
iam,
dataProcessing,
utils
compileStateMachines,
compileActivities,
compileIamRole,
httpRestApi,
httpInfo,
httpValidate,
httpResources,
httpMethods,
httpIamRole,
httpDeployment,
invoke,
yamlParser,
naming
);
this.assumeRolePolicyDocument =
this.assumeRolePolicyDocument.replace('[region]', this.region);
this.commands = {
deploy: {
commands: {
stepf: {
usage: 'Deploy the State Machine Step functions',
lifecycleEvents: [
'deploy',
],
options: {
stage: {
usage: 'Stage of the service',
shortcut: 's',
},
region: {
usage: 'Region of the service',
shortcut: 'r',
},
},
commands: {
activities: {
usage: 'Deploy Step function Tasks',
lifecycleEvents: [
'deploy',
],
options: {
name: {
usage: 'Name of the Task',
shortcut: 'n',
},
stage: {
usage: 'Stage of the service',
shortcut: 's',
},
region: {
usage: 'Region of the service',
shortcut: 'r',
},
},
},
statemachines: {
usage: 'Deploy Step function StateMachines',
lifecycleEvents: [
'deploy',
],
options: {
name: {
usage: 'Name of StateMachine',
shortcut: 'n',
},
stage: {
usage: 'Stage of the service',
shortcut: 's',
},
region: {
usage: 'Region of the service',
shortcut: 'r',
},
},
},
},
},
},
},
remove: {
commands: {
stepf: {
usage: 'Remove Step functions',
lifecycleEvents: [
'remove',
],
options: {
stage: {
usage: 'Stage of the service',
shortcut: 's',
},
region: {
usage: 'Region of the service',
shortcut: 'r',
},
},
commands: {
activities: {
usage: 'Remove Step function Tasks',
lifecycleEvents: [
'remove',
],
options: {
name: {
usage: 'Name of the Task',
shortcut: 'n',
},
stage: {
usage: 'Stage of the service',
shortcut: 's',
},
region: {
usage: 'Region of the service',
shortcut: 'r',
},
},
},
statemachines: {
usage: 'Remove Step function StateMachines',
lifecycleEvents: [
'remove',
],
options: {
name: {
usage: 'Name of StateMachine',
shortcut: 'n',
},
stage: {
usage: 'Stage of the service',
shortcut: 's',
},
region: {
usage: 'Region of the service',
shortcut: 'r',
},
},
},
},
},
},
},
invoke: {

@@ -165,3 +57,3 @@ commands: {

name: {
usage: 'Name of the State Machine',
usage: 'The StateMachine name',
shortcut: 'n',

@@ -194,237 +86,32 @@ required: true,

this.hooks = {
'deploy:stepf:deploy': () => BbPromise.bind(this)
.then(this.allDeploy),
'remove:stepf:remove': () => BbPromise.bind(this)
.then(this.allRemove),
'deploy:stepf:statemachines:deploy': () => BbPromise.bind(this)
.then(this.stateMachineDeploy),
'remove:stepf:statemachines:remove': () => BbPromise.bind(this)
.then(this.stateMachineRemove),
'invoke:stepf:invoke': () => BbPromise.bind(this)
.then(this.stateMachineInvoke),
'deploy:stepf:activities:deploy': () => BbPromise.bind(this)
.then(this.activityDeploy),
'remove:stepf:activities:remove': () => BbPromise.bind(this)
.then(this.activityRemove),
};
}
.then(this.invoke),
'deploy:initialize': () => BbPromise.bind(this)
.then(this.yamlParse),
'deploy:compileFunctions': () => BbPromise.bind(this)
.then(this.compileIamRole)
.then(this.compileStateMachines)
.then(this.compileActivities),
'deploy:compileEvents': () => {
this.pluginhttpValidated = this.httpValidate();
allDeploy() {
this.serverless.cli.log('Start to deploy for all stateMachies and activities...');
return BbPromise.bind(this)
.then(this.yamlParse)
.then(this.getActivityArns)
.then(this.describeActivities)
.then(this.createActivities)
.then(this.getStateMachineNames)
.then(this.getFunctionArns)
.then(this.compileAll)
.then(this.getIamRoles)
.then(this.deleteStateMachines)
.then(this.createStateMachines)
.then(() => {
this.serverless.cli.consoleLog('');
this.serverless.cli.log('Deployed all stateMachies and activities\n');
let message = '';
message += `${chalk.yellow.underline('Service Information')}\n`;
message += `${chalk.yellow('service:')} ${this.service}\n`;
message += `${chalk.yellow('stage:')} ${this.stage}\n`;
message += `${chalk.yellow('region:')} ${this.region}\n\n`;
message += `${chalk.yellow.underline('State Machine Information')}\n`;
_.forEach(this.stateMachineArns, (arn, name) => {
message += `${chalk.yellow(name)}${chalk.yellow(':')} ${arn}\n`;
});
message += '\n';
message += `${chalk.yellow.underline('Deployed Activity ARNs')}\n`;
_.forEach(this.activityArns, (value, key) => {
message += `${chalk.yellow(key)}${chalk.yellow(':')} `;
message += `${value}\n`;
});
this.serverless.cli.consoleLog(message);
return BbPromise.resolve();
});
}
allRemove() {
this.serverless.cli.log('Start to remove for all statemachies and activities...');
return BbPromise.bind(this)
.then(this.yamlParse)
.then(this.deleteIamRoles)
.then(this.getStateMachineNames)
.then(this.deleteStateMachines)
.then(this.getActivityArns)
.then(this.describeActivities)
.then(this.deleteActivities)
.then(() => {
this.serverless.cli.log('Removed for all statemachies and activities...');
});
}
activityDeploy() {
if (this.options.name) {
this.serverless.cli.log(`Start to deploy ${this.options.name} activity...`);
return BbPromise.bind(this)
.then(this.yamlParse)
.then(this.checkActivitySetting)
.then(this.getActivityArn)
.then(this.describeActivity)
.then(() => {
if (this.deployedActivities[this.options.name] === 'notDeployed') {
return BbPromise.bind(this)
.then(this.createActivity)
.then(() => {
this.serverless.cli.log('Finished to deploy');
let message = '';
message += `${chalk.yellow.underline('Service Information')}\n`;
message += `${chalk.yellow('service:')} ${this.service}\n`;
message += `${chalk.yellow('stage:')} ${this.stage}\n`;
message += `${chalk.yellow('region:')} ${this.region}\n\n`;
message += `${chalk.yellow.underline('Deployed Activity ARN')}\n`;
message += `${chalk.yellow(this.options.name)}${chalk.yellow(':')} `;
message += `${this.activityArns[this.options.name]}\n`;
this.serverless.cli.consoleLog(message);
return BbPromise.resolve();
});
if (this.pluginhttpValidated.events.length === 0) {
return BbPromise.resolve();
}
this.serverless.cli.log(`${this.options.name} activity have already deployed`);
return BbPromise.resolve();
});
}
this.serverless.cli.log('Start to deploy all activities...');
return BbPromise.bind(this)
.then(this.yamlParse)
.then(this.checkActivitySettings)
.then(this.getActivityArns)
.then(this.describeActivities)
.then(this.createActivities)
.then(() => {
this.serverless.cli.log('Finish to deploy');
let message = '';
message += `${chalk.yellow.underline('Service Information')}\n`;
message += `${chalk.yellow('service:')} ${this.service}\n`;
message += `${chalk.yellow('stage:')} ${this.stage}\n`;
message += `${chalk.yellow('region:')} ${this.region}\n\n`;
message += `${chalk.yellow.underline('Deployed Activity ARNs')}\n`;
_.forEach(this.activityArns, (value, key) => {
message += `${chalk.yellow(key)}${chalk.yellow(':')} `;
message += `${value}\n`;
});
this.serverless.cli.consoleLog(message);
return BbPromise.resolve();
});
return BbPromise.bind(this)
.then(this.compileRestApi)
.then(this.compileResources)
.then(this.compileMethods)
.then(this.compileHttpIamRole)
.then(this.compileDeployment);
},
'after:deploy:deploy': () => BbPromise.bind(this)
.then(this.getEndpointInfo)
.then(this.display),
};
}
activityRemove() {
if (this.options.name) {
this.serverless.cli.log(`Start to remove ${this.options.name} activity...`);
return BbPromise.bind(this)
.then(this.yamlParse)
.then(this.checkActivitySetting)
.then(this.getActivityArn)
.then(this.describeActivity)
.then(() => {
if (this.deployedActivities[this.options.name] === 'deployed') {
return BbPromise.bind(this)
.then(this.deleteActivity)
.then(() => {
this.serverless.cli.log('Finished to remove');
});
}
this.serverless.cli.log(`${this.options.name} activity is not deployed`);
return BbPromise.resolve();
});
}
this.serverless.cli.log('Start to remove all activities...');
invoke() {
return BbPromise.bind(this)
.then(this.yamlParse)
.then(this.checkActivitySettings)
.then(this.getActivityArns)
.then(this.describeActivities)
.then(this.deleteActivities)
.then(() => {
this.serverless.cli.log('Removed all activities');
return BbPromise.resolve();
});
}
stateMachineDeploy() {
if (this.options.name) {
this.serverless.cli.log(`Start to deploy ${this.options.name} step function...`);
return BbPromise.bind(this)
.then(this.yamlParse)
.then(this.getStateMachineArn)
.then(this.getFunctionArns)
.then(this.getActivityArns)
.then(this.compile)
.then(this.getIamRole)
.then(this.deleteStateMachine)
.then(this.createStateMachine)
.then(() => {
this.serverless.cli.consoleLog('');
this.serverless.cli.log(`Finish deployment of the ${this.options.name} step function`);
let message = '';
message += `${chalk.yellow.underline('Service Information')}\n`;
message += `${chalk.yellow('service:')} ${this.service}\n`;
message += `${chalk.yellow('stage:')} ${this.stage}\n`;
message += `${chalk.yellow('region:')} ${this.region}\n\n`;
message += `${chalk.yellow.underline('State Machine Information')}\n`;
message += `${chalk.yellow(this.options.name)}${chalk.yellow(':')} `;
message += `${this.stateMachineArns[this.options.name]}\n`;
this.serverless.cli.consoleLog(message);
return BbPromise.resolve();
});
}
this.serverless.cli.log('Start deployment of all Step function StateMachines...');
return BbPromise.bind(this)
.then(this.yamlParse)
.then(this.getStateMachineNames)
.then(this.getFunctionArns)
.then(this.compileAll)
.then(this.getIamRoles)
.then(this.deleteStateMachines)
.then(this.createStateMachines)
.then(() => {
this.serverless.cli.consoleLog('');
this.serverless.cli.log('Finished to deploy all stateMachines');
let message = '';
message += `${chalk.yellow.underline('Service Information')}\n`;
message += `${chalk.yellow('service:')} ${this.service}\n`;
message += `${chalk.yellow('stage:')} ${this.stage}\n`;
message += `${chalk.yellow('region:')} ${this.region}\n\n`;
message += `${chalk.yellow.underline('State Machine Information')}\n`;
_.forEach(this.stateMachineArns, (arn, name) => {
message += `${chalk.yellow(name)}${chalk.yellow(':')} ${arn}\n`;
});
this.serverless.cli.consoleLog(message);
return BbPromise.resolve();
});
}
stateMachineRemove() {
if (this.options.name) {
return BbPromise.bind(this)
.then(this.yamlParse)
.then(this.deleteIamRole)
.then(this.getStateMachineArn)
.then(this.deleteStateMachine)
.then(() => {
this.serverless.cli.log(`Remove ${this.options.name}`);
return BbPromise.resolve();
});
}
return BbPromise.bind(this)
.then(this.yamlParse)
.then(this.deleteIamRoles)
.then(this.getStateMachineNames)
.then(this.deleteStateMachines)
.then(() => {
this.serverless.cli.log('Removed all stateMachines');
return BbPromise.resolve();
});
}
stateMachineInvoke() {
return BbPromise.bind(this)
.then(this.parseInputdate)
.then(this.getStateMachineArn)

@@ -435,21 +122,44 @@ .then(this.startExecution)

this.serverless.cli.consoleLog('');
this.serverless.cli.consoleLog(chalk.yellow.underline('Execution Result'));
this.serverless.cli.consoleLog('');
this.serverless.cli.consoleLog(result);
if (result.status === 'FAILED') {
return this.getExecutionHistory()
.then((error) => {
this.serverless.cli.consoleLog('');
this.serverless.cli.consoleLog(chalk.yellow.underline('Error Log'));
this.serverless.cli.consoleLog('');
this.serverless.cli.consoleLog(error.events[error.events.length - 1]
.executionFailedEventDetails);
this.serverless.cli.consoleLog(_.merge(result, error.events[error.events.length - 1]
.executionFailedEventDetails));
process.exitCode = 1;
});
}
this.serverless.cli.consoleLog(result);
return BbPromise.resolve();
});
}
display() {
let message = '';
const endpointInfo = this.endpointInfo;
message += `${chalk.yellow.underline('Serverless StepFunctions OutPuts')}\n`;
message += `${chalk.yellow('endpoints:')}`;
_.forEach(this.getAllStateMachines(), (stateMachineName) => {
const stateMachineObj = this.getStateMachine(stateMachineName);
stateMachineObj.events.forEach(event => {
if (event.http) {
let method;
let path;
if (typeof event.http === 'object') {
method = event.http.method.toUpperCase();
path = event.http.path;
} else {
method = event.http.split(' ')[0].toUpperCase();
path = event.http.split(' ')[1];
}
path = path !== '/' ? `/${path.split('/').filter(p => p !== '').join('/')}` : '';
message += `\n ${method} - ${endpointInfo}${path}`;
}
});
});
message += '\n';
this.serverless.cli.consoleLog(message);
}
}
module.exports = ServerlessStepFunctions;
{
"name": "serverless-step-functions",
"version": "0.4.2",
"version": "1.0.0",
"description": "The module is AWS Step Functions plugin for Serverless Framework",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

[![serverless](http://public.serverless.com/badges/v3.svg)](http://www.serverless.com) [![Build Status](https://travis-ci.org/horike37/serverless-step-functions.svg?branch=master)](https://travis-ci.org/horike37/serverless-step-functions) [![npm version](https://badge.fury.io/js/serverless-step-functions.svg)](https://badge.fury.io/js/serverless-step-functions) [![Coverage Status](https://coveralls.io/repos/github/horike37/serverless-step-functions/badge.svg?branch=master)](https://coveralls.io/github/horike37/serverless-step-functions?branch=master) [![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](LICENSE)
# Serverless Step Functions (BETA)
# Serverless Step Functions
Serverless plugin for AWS Step Functions.

@@ -20,7 +20,8 @@

## Setup
Write definitions yaml using Amazon States Language in a `stepFunctions` statement in serverless.yml.
`Resource` statements refer to `functions` or `activities` statements. Therefore, you do not need to write a function arn or activity arn directly.
Of course, you can also specify arn directly.
Specifies your statemachine definition using Amazon States Language in a `definition` statement in serverless.yml.
```yml
custom:
accountId: xxxxxxxx
functions:

@@ -33,16 +34,22 @@ hellofunc:

hellostepfunc1:
Comment: "A Hello World example of the Amazon States Language using an AWS Lambda Function"
StartAt: HelloWorld1
States:
HelloWorld1:
Type: Task
Resource: hellofunc
End: true
events:
- http:
path: gofunction
method: GET
definition:
Comment: "A Hello World example of the Amazon States Language using an AWS Lambda Function"
StartAt: HelloWorld1
States:
HelloWorld1:
Type: Task
Resource: arn:aws:lambda:${opt:region}:${self:custom.accountId}:function:${self:service}-${opt:stage}-hello
End: true
hellostepfunc2:
StartAt: HelloWorld2
States:
HelloWorld2:
Type: Task
Resource: myTask
End: true
definition:
StartAt: HelloWorld2
States:
HelloWorld2:
Type: Task
Resource: arn:aws:states:${opt:region}:${self:custom.accountId}:activity:myTask
End: true
activities:

@@ -53,50 +60,52 @@ - myTask

## Command
### deploy
#### All StateMachines and Activities deploy
```
$ sls deploy stepf
```
## Events
### API Gateway
To create HTTP endpoints as Event sources for your StepFunctions statemachine
##### options
- --stage or -s The stage in your service you want to deploy your step function.
- --region or -r The region in your stage that you want to deploy your step function.
#### Simple HTTP Endpoint
This setup specifies that the hello statemachine should be run when someone accesses the API gateway at hello via a GET request.
#### All StateMachines deploy
Here's an example:
```yml
stepFunctions:
stateMachines:
hello:
events:
- http:
path: hello
method: GET
definition:
```
$ sls deploy stepf statemachines
```
#### HTTP Endpoint with Extended Options
##### options
- --stage or -s The stage in your service you want to deploy your step function.
- --region or -r The region in your stage that you want to deploy your step function.
Here You can define an POST endpoint for the path posts/create.
#### Single StateMachine deploy
```yml
stepFunctions:
stateMachines:
hello:
events:
- http:
path: posts/create
method: POST
definition:
```
$ sls deploy stepf statemachines --name <stepfunctionname>
```
##### options
- --name or -n The name of the step function in your service that you want to deploy.
- --stage or -s The stage in your service you want to deploy your step function.
- --region or -r The region in your stage that you want to deploy your step function.
#### All Activities deploy
#### Send request to an API
You can input an value as json in request body, the value is passed as the input value of your statemachine
```
$ sls deploy stepf activities
$ curl -XPOST https://xxxxxxxxx.execute-api.us-east-1.amazonaws.com/dev/posts/create -d '{"foo":"bar"}'
```
##### options
- --stage or -s The stage in your service you want to deploy your step function.
- --region or -r The region in your stage that you want to deploy your step function.
## Command
### deploy
Runn `sls deploy`, the defined Stepfunctions are deployed.
#### Single Activity deploy
### invoke
```
$ sls deploy stepf activities --name <activityname>
$ sls invoke stepf --name <stepfunctionname> --data '{"foo":"bar"}'
```
##### options
- --name or -n The name of the step function in your service that you want to deploy.
- --stage or -s The stage in your service you want to deploy your step function.
- --region or -r The region in your stage that you want to deploy your step function.
### invoke
#### options

@@ -109,251 +118,14 @@

- --path or -p The path to a json file with input data to be passed to the invoked step function.
```
$ sls invoke stepf --name <stepfunctionname> --data '{"foo":"bar"}'
```
### remove
#### All StateMachines and Activities remove
## IAM Role
The IAM roles required to run Statemachine are automatically generated. It is also possible to specify ARN directly.
```
$ sls remove stepf
```
Here's an example:
##### options
- --stage or -s The stage in your service you want to deploy your step function.
- --region or -r The region in your stage that you want to deploy your step function.
#### All StateMachines remove
```
$ sls remove stepf statemachines
```
##### options
- --stage or -s The stage in your service you want to deploy your step function.
- --region or -r The region in your stage that you want to deploy your step function.
#### Single StateMachine remove
```
$ sls remove stepf --name <stepfunctionname>
```
#### options
- --name or -n The name of the step function in your service that you want to remove. Required.
- --stage or -s The stage in your service you want to invoke your step remove.
- --region or -r The region in your stage that you want to invoke your step remove.
#### All Activities remove
```
$ sls remove stepf activities
```
##### options
- --stage or -s The stage in your service you want to deploy your step function.
- --region or -r The region in your stage that you want to deploy your step function.
#### Single Activity remove
```
$ sls remove stepf activities --name <activityname>
```
##### options
- --name or -n The name of the step function in your service that you want to deploy.
- --stage or -s The stage in your service you want to deploy your step function.
- --region or -r The region in your stage that you want to deploy your step function.
## Sample statemachines setting in serverless.yml
### Waite State
```yml
functions:
hellofunc:
handler: handler.hello
stepFunctions:
stateMachines:
yourWateMachine:
Comment: "An example of the Amazon States Language using wait states"
StartAt: FirstState
States:
FirstState:
Type: Task
Resource: hellofunc
Next: wait_using_seconds
wait_using_seconds:
Type: Wait
Seconds: 10
Next: wait_using_timestamp
wait_using_timestamp:
Type: Wait
Timestamp: '2015-09-04T01:59:00Z'
Next: wait_using_timestamp_path
wait_using_timestamp_path:
Type: Wait
TimestampPath: "$.expirydate"
Next: wait_using_seconds_path
wait_using_seconds_path:
Type: Wait
SecondsPath: "$.expiryseconds"
Next: FinalState
FinalState:
Type: Task
Resource: hellofunc
End: true
hello:
role: arn:aws:iam::xxxxxxxx:role/yourRole
definition:
```
### Retry Failture
```yml
functions:
hellofunc:
handler: handler.hello
stepFunctions:
stateMachines:
yourRetryMachine:
Comment: "A Retry example of the Amazon States Language using an AWS Lambda Function"
StartAt: HelloWorld
States:
HelloWorld:
Type: Task
Resource: hellofunc
Retry:
- ErrorEquals:
- HandledError
IntervalSeconds: 1
MaxAttempts: 2
BackoffRate: 2
- ErrorEquals:
- States.TaskFailed
IntervalSeconds: 30
MaxAttempts: 2
BackoffRate: 2
- ErrorEquals:
- States.ALL
IntervalSeconds: 5
MaxAttempts: 5
BackoffRate: 2
End: true
```
### Parallel
```yml
stepFunctions:
stateMachines:
yourParallelMachine:
Comment: "An example of the Amazon States Language using a parallel state to execute two branches at the same time."
StartAt: Parallel
States:
Parallel:
Type: Parallel
Next: Final State
Branches:
- StartAt: Wait 20s
States:
Wait 20s:
Type: Wait
Seconds: 20
End: true
- StartAt: Pass
States:
Pass:
Type: Pass
Next: Wait 10s
Wait 10s:
Type: Wait
Seconds: 10
End: true
Final State:
Type: Pass
End: true
```
### Catch Failture
```yml
functions:
hellofunc:
handler: handler.hello
stepFunctions:
stateMachines:
yourCatchMachine:
Comment: "A Catch example of the Amazon States Language using an AWS Lambda Function"
StartAt: HelloWorld
States:
HelloWorld:
Type: Task
Resource: hellofunc
Catch:
- ErrorEquals:
- HandledError
Next: CustomErrorFallback
- ErrorEquals:
- States.TaskFailed
Next: ReservedTypeFallback
- ErrorEquals:
- States.ALL
Next: CatchAllFallback
End: true
CustomErrorFallback:
Type: Pass
Result: "This is a fallback from a custom lambda function exception"
End: true
ReservedTypeFallback:
Type: Pass
Result: "This is a fallback from a reserved error code"
End: true
CatchAllFallback:
Type: Pass
Result: "This is a fallback from a reserved error code"
End: true
```
### Choice
```yml
functions:
hellofunc1:
handler: handler.hello1
hellofunc2:
handler: handler.hello2
hellofunc3:
handler: handler.hello3
hellofunc4:
handler: handler.hello4
stepFunctions:
stateMachines:
yourChoiceMachine:
Comment: "An example of the Amazon States Language using a choice state."
StartAt: FirstState
States:
FirstState:
Type: Task
Resource: hellofunc1
Next: ChoiceState
ChoiceState:
Type: Choice
Choices:
- Variable: "$.foo"
NumericEquals: 1
Next: FirstMatchState
- Variable: "$.foo"
NumericEquals: 2
Next: SecondMatchState
Default: DefaultState
FirstMatchState:
Type: Task
Resource: hellofunc2
Next: NextState
SecondMatchState:
Type: Task
Resource: hellofunc3
Next: NextState
DefaultState:
Type: Fail
Cause: "No Matches!"
NextState:
Type: Task
Resource: hellofunc4
End: true
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc