Skip to content

Commit d5194ee

Browse files
committed
chore: remove comments
1 parent 016cf31 commit d5194ee

File tree

1 file changed

+1
-36
lines changed

1 file changed

+1
-36
lines changed

packages/idempotency/src/makeIdempotent.ts

+1-36
Original file line numberDiff line numberDiff line change
@@ -72,40 +72,6 @@ const isOptionsWithDataIndexArgument = (
7272
*
7373
* ```
7474
*/
75-
/* const makeIdempotent = <Func extends AnyFunction>(
76-
fn: Func,
77-
options: ItempotentFunctionOptions<Parameters<Func>>,
78-
thisArg: Handler
79-
): ((...args: Parameters<Func>) => ReturnType<Func>) => {
80-
const { persistenceStore, config } = options;
81-
const idempotencyConfig = config ? config : new IdempotencyConfig({});
82-
83-
if (!idempotencyConfig.isEnabled()) return fn;
84-
85-
return (...args: Parameters<Func>): ReturnType<Func> => {
86-
let functionPayloadToBeHashed;
87-
88-
if (isFnHandler(fn, args)) {
89-
idempotencyConfig.registerLambdaContext(args[1]);
90-
functionPayloadToBeHashed = args[0];
91-
} else {
92-
if (isOptionsWithDataIndexArgument(options)) {
93-
functionPayloadToBeHashed = args[options.dataIndexArgument];
94-
} else {
95-
functionPayloadToBeHashed = args[0];
96-
}
97-
}
98-
99-
return new IdempotencyHandler({
100-
functionToMakeIdempotent: fn,
101-
idempotencyConfig: idempotencyConfig,
102-
persistenceStore: persistenceStore,
103-
functionArguments: args,
104-
functionPayloadToBeHashed,
105-
thisArg,
106-
}).handle() as ReturnType<Func>;
107-
};
108-
}; */
10975
// eslint-disable-next-line func-style
11076
function makeIdempotent<Func extends AnyFunction>(
11177
fn: Func,
@@ -116,7 +82,7 @@ function makeIdempotent<Func extends AnyFunction>(
11682

11783
if (!idempotencyConfig.isEnabled()) return fn;
11884

119-
return function (...args: Parameters<Func>): ReturnType<Func> {
85+
return function (this: Handler, ...args: Parameters<Func>): ReturnType<Func> {
12086
let functionPayloadToBeHashed;
12187

12288
if (isFnHandler(fn, args)) {
@@ -136,7 +102,6 @@ function makeIdempotent<Func extends AnyFunction>(
136102
persistenceStore: persistenceStore,
137103
functionArguments: args,
138104
functionPayloadToBeHashed,
139-
// @ts-expect-error abc
140105
thisArg: this,
141106
}).handle() as ReturnType<Func>;
142107
};

0 commit comments

Comments
 (0)