Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ describe('Step functions client', () => {
input: JSON.stringify(input),
name: 'no-context'
}
await SFN.startExecution(params).promise()
await // The `.promise()` call might be on an JS SDK v2 client API.
// If yes, please remove .promise(). If not, remove this comment.
SFN.startExecution(params)

const expectedInput = Object.assign({}, input, { __context__: {} })

Expand Down Expand Up @@ -60,7 +62,11 @@ describe('Step functions client', () => {
input: JSON.stringify(input),
name: 'has-context'
}
await SFN.startExecution(params).promise()
await // The `.promise()` call might be on an JS SDK v2 client API.
// If yes, please remove .promise(). If not, remove this comment.
// The `.promise()` call might be on an JS SDK v2 client API.
// If yes, please remove .promise(). If not, remove this comment.
SFN.startExecution(params)

const expectedInput = Object.assign(
{},
Expand All @@ -87,7 +93,11 @@ describe('Step functions client', () => {
input: 'dGhpcyBpcyBub3QgSlNPTg==',
name: 'not-json'
}
await SFN.startExecution(params).promise()
await // The `.promise()` call might be on an JS SDK v2 client API.
// If yes, please remove .promise(). If not, remove this comment.
// The `.promise()` call might be on an JS SDK v2 client API.
// If yes, please remove .promise(). If not, remove this comment.
SFN.startExecution(params).promise()

expect(mockStartExecution).toBeCalledWith(params)
})
Expand All @@ -110,7 +120,11 @@ describe('Step functions client', () => {
input: JSON.stringify(input),
name: 'has-context-child'
}
await SFN.startExecutionWithCorrelationIds(correlationIds, params).promise()
await // The `.promise()` call might be on an JS SDK v2 client API.
// If yes, please remove .promise(). If not, remove this comment.
// The `.promise()` call might be on an JS SDK v2 client API.
// If yes, please remove .promise(). If not, remove this comment.
SFN.startExecutionWithCorrelationIds(correlationIds, params).promise()

const expectedInput = Object.assign(
{},
Expand Down
15 changes: 7 additions & 8 deletions packages/lambda-powertools-step-functions-client/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import StepFunctions from "aws-sdk/clients/stepfunctions";
import { AWSError } from "aws-sdk/lib/error";
import { Request } from "aws-sdk/lib/request";
import { ServiceException } from "@smithy/smithy-client";
import { SFN as sfn, StartExecutionCommandInput, StartExecutionCommandOutput } from "@aws-sdk/client-sfn";
import CorrelationIds from "@dazn/lambda-powertools-correlation-ids";

declare const SFN: StepFunctions & {
declare const SFN: sfn & {
startExecutionWithCorrelationIds(
correlationId: CorrelationIds,
params: StepFunctions.Types.StartExecutionInput,
params: StartExecutionCommandInput,
callback?: (
err: AWSError,
data: StepFunctions.Types.StartExecutionOutput
err: ServiceException,
data: StartExecutionCommandOutput
) => void
): Request<StepFunctions.Types.StartExecutionOutput, AWSError>;
): Promise<StartExecutionCommandOutput, ServiceException>;
};
export default SFN;
4 changes: 2 additions & 2 deletions packages/lambda-powertools-step-functions-client/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
process.env.AWS_NODEJS_CONNECTION_REUSE_ENABLED = '1'
const StepFunctions = require('aws-sdk/clients/stepfunctions')
const client = new StepFunctions()
const { SFN } = require('@aws-sdk/client-sfn');
const client = new SFN()
const Log = require('@dazn/lambda-powertools-logger')
const CorrelationIds = require('@dazn/lambda-powertools-correlation-ids')

Expand Down
Loading