diff --git a/.projen/tasks.json b/.projen/tasks.json index 7eac626a..7b97f5c6 100644 --- a/.projen/tasks.json +++ b/.projen/tasks.json @@ -85,7 +85,7 @@ "name": "compile", "description": "Only compile", "env": { - "NODE_OPTIONS": "--max-old-space-size=8192" + "NODE_OPTIONS": "--max-old-space-size=4096" }, "steps": [ { @@ -189,7 +189,7 @@ "name": "test", "description": "Run tests", "env": { - "NODE_OPTIONS": "--max-old-space-size=8192", + "NODE_OPTIONS": "--max-old-space-size=4096", "DEFAULT_REGION": "ap-northeast-1", "AWS_ACCOUNT_ID": "000000000000", "AWS_ACCESS_KEY_ID": "test", diff --git a/.projenrc.ts b/.projenrc.ts index 2f5e97f9..b1f343a2 100644 --- a/.projenrc.ts +++ b/.projenrc.ts @@ -215,7 +215,7 @@ packageJson.addOverride("lint-staged", { project.compileTask.prependExec( "yarn link && cd ./test-app && yarn link functionless" ); -project.compileTask.env("NODE_OPTIONS", "--max-old-space-size=8192"); +project.compileTask.env("NODE_OPTIONS", "--max-old-space-size=4096"); project.compileTask.prependExec("ts-node ./scripts/sdk-gen.ts"); project.testTask.prependExec( @@ -224,7 +224,7 @@ project.testTask.prependExec( project.testTask.prependExec("./scripts/localstack"); project.testTask.exec("localstack stop"); -project.testTask.env("NODE_OPTIONS", "--max-old-space-size=8192"); +project.testTask.env("NODE_OPTIONS", "--max-old-space-size=4096"); project.testTask.env("DEFAULT_REGION", "ap-northeast-1"); project.testTask.env("AWS_ACCOUNT_ID", "000000000000"); project.testTask.env("AWS_ACCESS_KEY_ID", "test"); diff --git a/src/step-function.ts b/src/step-function.ts index bd8fcdbe..cad41217 100644 --- a/src/step-function.ts +++ b/src/step-function.ts @@ -1579,9 +1579,9 @@ function getStepFunctionArgs< | [func: StepFunctionClosure] ) { const props = - isFunctionLike(args[0]) || isErr(args[0]) + isFunctionLike(args[0]) || isErr(args[0]) || typeof args[0] === "function" ? {} - : (args[1] as StepFunctionProps); + : args[0]; const func = validateFunctionLike( args.length > 1 ? args[1] : args[0], "StepFunction" diff --git a/test/__snapshots__/step-function.localstack.test.ts.snap b/test/__snapshots__/step-function.localstack.test.ts.snap index bcb7a5a4..82753a7f 100644 --- a/test/__snapshots__/step-function.localstack.test.ts.snap +++ b/test/__snapshots__/step-function.localstack.test.ts.snap @@ -14673,6 +14673,31 @@ Object { } `; +exports[`step function props are passed through to the resource 1`] = ` +Object { + "StartAt": "Initialize Functionless Context", + "States": Object { + "Initialize Functionless Context": Object { + "Next": "return context.StateMachine.Name", + "Parameters": Object { + "_.$": "$$.Execution.Input", + "fnl_context": Object { + "null": null, + }, + }, + "ResultPath": "$", + "Type": "Pass", + }, + "return context.StateMachine.Name": Object { + "End": true, + "InputPath": "$$.StateMachine.Name", + "ResultPath": "$", + "Type": "Pass", + }, + }, +} +`; + exports[`templates 1`] = ` Object { "StartAt": "Initialize Functionless Context", diff --git a/test/step-function.localstack.test.ts b/test/step-function.localstack.test.ts index f9239983..dadc57f8 100644 --- a/test/step-function.localstack.test.ts +++ b/test/step-function.localstack.test.ts @@ -124,6 +124,21 @@ localstackTestSuite("sfnStack", (testResource, _stack, _app) => { "hello world" ); + test( + "step function props are passed through to the resource", + (parent) => { + return new StepFunction( + parent, + "sfn2", + { stateMachineName: "magicMachine" }, + async (_, context) => { + return context.StateMachine.Name; + } + ); + }, + "magicMachine" + ); + test( "duplicate nodes", (parent) => {