Skip to content

Commit ea136b4

Browse files
committed
Check for ReplayMode instead of REPLAY_MODE
The durableExecutionMode property updated it's value types. This commit uses the correct value
1 parent a8650c8 commit ea136b4

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

packages/idempotency/src/makeIdempotent.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const isDurableContext = (arg: unknown): boolean => {
2424
typeof arg === 'object' &&
2525
'step' in arg
2626
);
27-
}
27+
};
2828

2929
const isFnHandler = (
3030
fn: AnyFunction,
@@ -35,7 +35,7 @@ const isFnHandler = (
3535
fn !== undefined &&
3636
fn !== null &&
3737
typeof fn === 'function' &&
38-
(isContext(args[1])|| isDurableContext(args[1]))
38+
(isContext(args[1]) || isDurableContext(args[1]))
3939
);
4040
};
4141

@@ -136,7 +136,9 @@ function makeIdempotent<Func extends AnyFunction>(
136136
if (isFnHandler(fn, args)) {
137137
// If it's a durable context, retrieve the lambdaContext property
138138
// Otherwise use the context
139-
idempotencyConfig.registerLambdaContext(args[1]?.lambdaContext || args[1]);
139+
idempotencyConfig.registerLambdaContext(
140+
args[1]?.lambdaContext || args[1]
141+
);
140142
functionPayloadToBeHashed = args[0];
141143
} else {
142144
if (isOptionsWithDataIndexArgument(options)) {
@@ -146,7 +148,7 @@ function makeIdempotent<Func extends AnyFunction>(
146148
}
147149
}
148150

149-
const isReplay = args[1]?.durableExecutionMode === "REPLAY_MODE"
151+
const isReplay = args[1]?.durableExecutionMode === 'ReplayMode';
150152

151153
return new IdempotencyHandler({
152154
functionToMakeIdempotent: fn,
@@ -156,7 +158,7 @@ function makeIdempotent<Func extends AnyFunction>(
156158
functionArguments: args,
157159
functionPayloadToBeHashed,
158160
thisArg: this,
159-
}).handle({ isReplay }) as ReturnType<Func>
161+
}).handle({ isReplay }) as ReturnType<Func>;
160162
};
161163
}
162164

0 commit comments

Comments
 (0)