Skip to content

Commit 092ab73

Browse files
ParidelPooyaPooya Paridel
andcommitted
fix(sdk): comprehensive ESLint and TSDoc compliance improvements (#86)
- Remove 'any' type defaults from withDurableFunctions generic parameters - Replace 'any' with 'unknown' in logger interfaces for better type safety - Add missing return type annotations across test files and utility functions - Remove unused variable assignments and rename unused parameters with underscore prefix - Fix destructuring assignments to only capture needed variables - Add eslint-disable comments for legitimate console.log usage in tests and loggers - Escape greater-than characters in TSDoc comments to prevent HTML tag confusion - Fix TSDoc parameter documentation with proper hyphen formatting Co-authored-by: Pooya Paridel <parpooya@amazon.com>
1 parent af42312 commit 092ab73

File tree

16 files changed

+165
-160
lines changed

16 files changed

+165
-160
lines changed

packages/aws-durable-execution-sdk-js-testing/src/test-runner/local/__tests__/integration/wait-for-callback-operations.integration.test.ts

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ describe("WaitForCallback Operations Integration", () => {
1717
it("should handle basic waitForCallback with anonymous submitter", async () => {
1818
let receivedCallbackId: string | undefined;
1919

20-
const handler = withDurableFunctions(
20+
const handler = withDurableFunctions<unknown, unknown>(
2121
async (_event: unknown, context: DurableContext) => {
2222
const result = await context.waitForCallback<{ data: string }>(
2323
async (callbackId) => {
@@ -67,7 +67,7 @@ describe("WaitForCallback Operations Integration", () => {
6767

6868
it("should handle basic waitForCallback with named submitter", async () => {
6969
let receivedCallbackId: string | undefined; // simulates a side-effect since it's outside the handler
70-
const handler = withDurableFunctions(
70+
const handler = withDurableFunctions<unknown, unknown>(
7171
async (_event: unknown, context: DurableContext) => {
7272
const result = await context.waitForCallback<{ data: string }>(
7373
async (callbackId) => {
@@ -116,7 +116,7 @@ describe("WaitForCallback Operations Integration", () => {
116116
// Error Handling & Submitter Function Variants Category
117117
describe("Error Handling & Submitter Function Variants", () => {
118118
it("should handle waitForCallback with submitter function synchronous errors", async () => {
119-
const handler = withDurableFunctions(
119+
const handler = withDurableFunctions<unknown, unknown>(
120120
async (_event: unknown, context: DurableContext) => {
121121
try {
122122
const result = await context.waitForCallback<{ data: string }>(
@@ -160,7 +160,7 @@ describe("WaitForCallback Operations Integration", () => {
160160
});
161161

162162
it("should handle waitForCallback with submitter function returning rejected promises", async () => {
163-
const handler = withDurableFunctions(
163+
const handler = withDurableFunctions<unknown, unknown>(
164164
async (_event: unknown, context: DurableContext) => {
165165
try {
166166
const result = await context.waitForCallback<{ data: string }>(
@@ -206,7 +206,7 @@ describe("WaitForCallback Operations Integration", () => {
206206
it("should handle waitForCallback with callback failure scenarios", async () => {
207207
let receivedCallbackId: string | undefined;
208208

209-
const handler = withDurableFunctions(
209+
const handler = withDurableFunctions<unknown, unknown>(
210210
async (_event: unknown, context: DurableContext) => {
211211
try {
212212
const result = await context.waitForCallback<{ data: string }>(
@@ -271,7 +271,7 @@ describe("WaitForCallback Operations Integration", () => {
271271
let scenario2CallbackId: string | undefined;
272272

273273
// Test scenario where submitter fails but callback would have succeeded
274-
const handler1 = withDurableFunctions(
274+
const handler1 = withDurableFunctions<unknown, unknown>(
275275
async (_event: unknown, context: DurableContext) => {
276276
try {
277277
const result = await context.waitForCallback<{ data: string }>(
@@ -310,7 +310,7 @@ describe("WaitForCallback Operations Integration", () => {
310310

311311
// Test scenario where submitter succeeds but callback fails (covered in previous test)
312312
// This test demonstrates the contrast between the two scenarios
313-
const handler2 = withDurableFunctions(
313+
const handler2 = withDurableFunctions<unknown, unknown>(
314314
async (_event: unknown, context: DurableContext) => {
315315
const result = await context.waitForCallback<{ data: string }>(
316316
(callbackId) => {
@@ -361,7 +361,7 @@ describe("WaitForCallback Operations Integration", () => {
361361
let callbackId: string | undefined;
362362
let sideEffectCounter = 0;
363363

364-
const handler = withDurableFunctions(
364+
const handler = withDurableFunctions<unknown, unknown>(
365365
async (_event: unknown, context: DurableContext) => {
366366
try {
367367
const result = await context.waitForCallback<{ data: string }>(
@@ -439,7 +439,7 @@ describe("WaitForCallback Operations Integration", () => {
439439
it("should handle waitForCallback with heartbeat timeout configuration", async () => {
440440
let receivedCallbackId: string | undefined;
441441

442-
const handler = withDurableFunctions(
442+
const handler = withDurableFunctions<unknown, unknown>(
443443
async (_event: unknown, context: DurableContext) => {
444444
const result = await context.waitForCallback<{ data: string }>(
445445
async (callbackId) => {
@@ -508,7 +508,7 @@ describe("WaitForCallback Operations Integration", () => {
508508
let submitterStartTime: number;
509509
let submitterEndTime: number;
510510

511-
const handler = withDurableFunctions(
511+
const handler = withDurableFunctions<unknown, unknown>(
512512
async (_event: unknown, context: DurableContext) => {
513513
const result = await context.waitForCallback<{ processed: number }>(
514514
async (callbackId) => {
@@ -586,7 +586,7 @@ describe("WaitForCallback Operations Integration", () => {
586586

587587
// Skip timeout scenarios until SDK properly supports them (similar to callback-operations.integration.test.ts)
588588
it.skip("should handle waitForCallback timeout scenarios", async () => {
589-
const handler = withDurableFunctions(
589+
const handler = withDurableFunctions<unknown, unknown>(
590590
async (_event: unknown, context: DurableContext) => {
591591
try {
592592
const result = await context.waitForCallback<{ data: string }>(
@@ -636,7 +636,7 @@ describe("WaitForCallback Operations Integration", () => {
636636
let callback2Id: string | undefined;
637637
let callback3Id: string | undefined;
638638

639-
const handler = withDurableFunctions(
639+
const handler = withDurableFunctions<unknown, unknown>(
640640
async (_event: unknown, context: DurableContext) => {
641641
// Start multiple waitForCallback operations concurrently
642642
const [result1, result2, result3] = await Promise.all([
@@ -756,7 +756,7 @@ describe("WaitForCallback Operations Integration", () => {
756756
it.skip("should handle waitForCallback mixed with steps, waits, and other operations", async () => {
757757
let callbackId: string | undefined;
758758

759-
const handler = withDurableFunctions(
759+
const handler = withDurableFunctions<unknown, unknown>(
760760
async (_event: unknown, context: DurableContext) => {
761761
// Mix waitForCallback with other operation types
762762
await context.wait("initial-wait", 50);
@@ -843,7 +843,7 @@ describe("WaitForCallback Operations Integration", () => {
843843
let parentCallbackId: string | undefined;
844844
let childCallbackId: string | undefined;
845845

846-
const handler = withDurableFunctions(
846+
const handler = withDurableFunctions<unknown, unknown>(
847847
async (_event: unknown, context: DurableContext) => {
848848
const parentResult = await context.waitForCallback<{
849849
parentData: string;
@@ -945,7 +945,7 @@ describe("WaitForCallback Operations Integration", () => {
945945
let firstCallbackId: string | undefined;
946946
let secondCallbackId: string | undefined;
947947

948-
const handler = withDurableFunctions(
948+
const handler = withDurableFunctions<unknown, unknown>(
949949
async (_event: unknown, context: DurableContext) => {
950950
await context.wait("wait-invocation-1", 1000);
951951

@@ -1048,7 +1048,7 @@ describe("WaitForCallback Operations Integration", () => {
10481048
let innerCallbackId: string | undefined;
10491049
let nestedCallbackId: string | undefined;
10501050

1051-
const handler = withDurableFunctions(
1051+
const handler = withDurableFunctions<unknown, unknown>(
10521052
async (_event: unknown, context: DurableContext) => {
10531053
const outerResult = await context.waitForCallback<{ level: string }>(
10541054
"outer-callback-op",
@@ -1192,7 +1192,7 @@ describe("WaitForCallback Operations Integration", () => {
11921192
it("should handle waitForCallback with custom timeout settings", async () => {
11931193
let receivedCallbackId: string | undefined;
11941194

1195-
const handler = withDurableFunctions(
1195+
const handler = withDurableFunctions<unknown, unknown>(
11961196
async (_event: unknown, context: DurableContext) => {
11971197
const result = await context.waitForCallback<{ data: string }>(
11981198
"custom-timeout-callback",
@@ -1307,7 +1307,7 @@ describe("WaitForCallback Operations Integration", () => {
13071307
let receivedCallbackId: string | undefined;
13081308
let submitterData: CustomData | undefined;
13091309

1310-
const handler = withDurableFunctions(
1310+
const handler = withDurableFunctions<unknown, unknown>(
13111311
async (_event: unknown, context: DurableContext) => {
13121312
const result = await context.waitForCallback<CustomData>(
13131313
"custom-serdes-callback",
@@ -1396,7 +1396,7 @@ describe("WaitForCallback Operations Integration", () => {
13961396

13971397
describe("Mocking Tests", () => {
13981398
it("should handle basic waitForCallback mocking functionality", async () => {
1399-
const handler = withDurableFunctions(
1399+
const handler = withDurableFunctions<unknown, unknown>(
14001400
async (_event: unknown, context: DurableContext) => {
14011401
const result1 = await context.waitForCallback<{ data: string }>(
14021402
"mock-callback-1",
@@ -1460,7 +1460,7 @@ describe("WaitForCallback Operations Integration", () => {
14601460
});
14611461

14621462
it("should handle waitForCallback error mocking", async () => {
1463-
const handler = withDurableFunctions(
1463+
const handler = withDurableFunctions<unknown, unknown>(
14641464
async (_event: unknown, context: DurableContext) => {
14651465
try {
14661466
const result = await context.waitForCallback<{ data: string }>(

packages/aws-durable-execution-sdk-js/bundle-size-history.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
[
2-
{
3-
"timestamp": "2025-06-27T16:46:43.149Z",
4-
"size": 888765,
5-
"gitCommit": "6c98b2ec2c523a92309a7b8ee00e9c61f83392cf"
6-
},
72
{
83
"timestamp": "2025-06-27T16:47:20.156Z",
94
"size": 888765,
@@ -248,5 +243,10 @@
248243
"timestamp": "2025-09-29T03:15:18.425Z",
249244
"size": 361568,
250245
"gitCommit": "71b458e8159dfc4242c4e8c65820a6c21554e16c"
246+
},
247+
{
248+
"timestamp": "2025-09-29T21:53:05.018Z",
249+
"size": 361581,
250+
"gitCommit": "1eba8c6d9f097275746307697346a5f2caf27c23"
251251
}
252252
]

packages/aws-durable-execution-sdk-js/src/errors/serdes-errors/serdes-errors.test.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ describe("Serdes Errors", () => {
248248
});
249249

250250
// Call safeSerialize but don't await it (it will never resolve due to termination)
251-
const resultPromise = safeSerialize(
251+
safeSerialize(
252252
mockSerdes,
253253
value,
254254
TEST_CONSTANTS.STEP_ID_1,
@@ -276,7 +276,7 @@ describe("Serdes Errors", () => {
276276
});
277277

278278
// Call safeSerialize but don't await it (it will never resolve due to termination)
279-
const resultPromise = safeSerialize(
279+
safeSerialize(
280280
mockSerdes,
281281
value,
282282
TEST_CONSTANTS.STEP_ID_1,
@@ -304,7 +304,7 @@ describe("Serdes Errors", () => {
304304
});
305305

306306
// Call safeSerialize but don't await it (it will never resolve due to termination)
307-
const resultPromise = safeSerialize(
307+
safeSerialize(
308308
mockSerdes,
309309
value,
310310
TEST_CONSTANTS.STEP_ID_1,
@@ -331,7 +331,7 @@ describe("Serdes Errors", () => {
331331
mockSerdes.serialize.mockRejectedValue(originalError);
332332

333333
// Call safeSerialize but don't await it (it will never resolve due to termination)
334-
const resultPromise = safeSerialize(
334+
safeSerialize(
335335
mockSerdes,
336336
value,
337337
TEST_CONSTANTS.STEP_ID_1,
@@ -357,7 +357,7 @@ describe("Serdes Errors", () => {
357357
mockSerdes.serialize.mockRejectedValue("Async string error");
358358

359359
// Call safeSerialize but don't await it (it will never resolve due to termination)
360-
const resultPromise = safeSerialize(
360+
safeSerialize(
361361
mockSerdes,
362362
value,
363363
TEST_CONSTANTS.STEP_ID_1,
@@ -383,7 +383,7 @@ describe("Serdes Errors", () => {
383383
mockSerdes.serialize.mockRejectedValue("Async string error");
384384

385385
// Call safeSerialize but don't await it (it will never resolve due to termination)
386-
const resultPromise = safeSerialize(
386+
safeSerialize(
387387
mockSerdes,
388388
value,
389389
TEST_CONSTANTS.STEP_ID_1,
@@ -469,7 +469,7 @@ describe("Serdes Errors", () => {
469469
});
470470

471471
// Call safeDeserialize but don't await it (it will never resolve due to termination)
472-
const resultPromise = safeDeserialize(
472+
safeDeserialize(
473473
mockSerdes,
474474
data,
475475
TEST_CONSTANTS.STEP_ID_1,
@@ -497,7 +497,7 @@ describe("Serdes Errors", () => {
497497
});
498498

499499
// Call safeDeserialize but don't await it (it will never resolve due to termination)
500-
const resultPromise = safeDeserialize(
500+
safeDeserialize(
501501
mockSerdes,
502502
data,
503503
TEST_CONSTANTS.STEP_ID_1,
@@ -525,7 +525,7 @@ describe("Serdes Errors", () => {
525525
});
526526

527527
// Call safeDeserialize but don't await it (it will never resolve due to termination)
528-
const resultPromise = safeDeserialize(
528+
safeDeserialize(
529529
mockSerdes,
530530
data,
531531
TEST_CONSTANTS.STEP_ID_1,
@@ -552,7 +552,7 @@ describe("Serdes Errors", () => {
552552
mockSerdes.deserialize.mockRejectedValue(originalError);
553553

554554
// Call safeDeserialize but don't await it (it will never resolve due to termination)
555-
const resultPromise = safeDeserialize(
555+
safeDeserialize(
556556
mockSerdes,
557557
data,
558558
TEST_CONSTANTS.STEP_ID_1,
@@ -578,7 +578,7 @@ describe("Serdes Errors", () => {
578578
mockSerdes.deserialize.mockRejectedValue("Async string error");
579579

580580
// Call safeDeserialize but don't await it (it will never resolve due to termination)
581-
const resultPromise = safeDeserialize(
581+
safeDeserialize(
582582
mockSerdes,
583583
data,
584584
TEST_CONSTANTS.STEP_ID_1,
@@ -604,7 +604,7 @@ describe("Serdes Errors", () => {
604604
mockSerdes.deserialize.mockRejectedValue("Async string error");
605605

606606
// Call safeDeserialize but don't await it (it will never resolve due to termination)
607-
const resultPromise = safeDeserialize(
607+
safeDeserialize(
608608
mockSerdes,
609609
data,
610610
TEST_CONSTANTS.STEP_ID_1,

0 commit comments

Comments
 (0)