@@ -15,7 +15,6 @@ import {
1515 IdempotencyConfig ,
1616 makeIdempotent ,
1717} from "@aws-lambda-powertools/idempotency" ;
18- import { AnyFunction } from "@aws-lambda-powertools/idempotency/lib/cjs/types/IdempotencyOptions" ;
1918import { Deps } from "../config/deps" ;
2019import {
2120 PreparedEvents ,
@@ -189,7 +188,11 @@ function parseQueueMessage(queueMessage: string): QueueMessage {
189188}
190189
191190export default function createUpsertLetterHandler ( deps : Deps ) : SQSHandler {
192- const processRecordIdempotently = makeIdempotentOnId ( processRecord , deps ) ;
191+ const processRecordIdempotently = makeIdempotent ( processRecord , {
192+ persistenceStore : deps . idempotencyLayer ,
193+ config : idempotencyConfig ,
194+ } ) ;
195+
193196 return metricScope ( ( metrics : MetricsLogger ) => {
194197 return async ( event : SQSEvent , context : Context ) => {
195198 const batchItemFailures : SQSBatchItemFailure [ ] = [ ] ;
@@ -284,10 +287,3 @@ async function processRecord(
284287 perSupplierSuccess . set ( supplier , ( perSupplierSuccess . get ( supplier ) || 0 ) + 1 ) ;
285288 return supplier ;
286289}
287-
288- function makeIdempotentOnId ( fn : AnyFunction , deps : Deps ) {
289- return makeIdempotent ( fn , {
290- persistenceStore : deps . idempotencyLayer ,
291- config : idempotencyConfig ,
292- } ) ;
293- }
0 commit comments