Skip to content
Merged
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
12 changes: 7 additions & 5 deletions packages/idempotency/src/makeIdempotent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const isDurableContext = (arg: unknown): boolean => {
typeof arg === 'object' &&
'step' in arg
);
}
};

const isFnHandler = (
fn: AnyFunction,
Expand All @@ -35,7 +35,7 @@ const isFnHandler = (
fn !== undefined &&
fn !== null &&
typeof fn === 'function' &&
(isContext(args[1])|| isDurableContext(args[1]))
(isContext(args[1]) || isDurableContext(args[1]))
);
};

Expand Down Expand Up @@ -136,7 +136,9 @@ function makeIdempotent<Func extends AnyFunction>(
if (isFnHandler(fn, args)) {
// If it's a durable context, retrieve the lambdaContext property
// Otherwise use the context
idempotencyConfig.registerLambdaContext(args[1]?.lambdaContext || args[1]);
idempotencyConfig.registerLambdaContext(
args[1]?.lambdaContext || args[1]
);
functionPayloadToBeHashed = args[0];
} else {
if (isOptionsWithDataIndexArgument(options)) {
Expand All @@ -146,7 +148,7 @@ function makeIdempotent<Func extends AnyFunction>(
}
}

const isReplay = args[1]?.durableExecutionMode === "REPLAY_MODE"
const isReplay = args[1]?.durableExecutionMode === 'ReplayMode';

return new IdempotencyHandler({
functionToMakeIdempotent: fn,
Expand All @@ -156,7 +158,7 @@ function makeIdempotent<Func extends AnyFunction>(
functionArguments: args,
functionPayloadToBeHashed,
thisArg: this,
}).handle({ isReplay }) as ReturnType<Func>
}).handle({ isReplay }) as ReturnType<Func>;
};
}

Expand Down
Loading
Loading