diff --git a/src/queryBuilders/deleteItemQueryBuilder.integration.test.ts b/src/queryBuilders/deleteItemQueryBuilder.integration.test.ts index 93b63fb..daa0ea4 100644 --- a/src/queryBuilders/deleteItemQueryBuilder.integration.test.ts +++ b/src/queryBuilders/deleteItemQueryBuilder.integration.test.ts @@ -86,7 +86,7 @@ describe("DeleteItemQueryBuilder", () => { expect(res).toBeDefined(); }); - it("doesn't return values if no returnValues is specified", async () => { + it("doesn't return values if no returnValues is specified or its set to NONE", async () => { await tsynamoClient .putItem("myTable") .item({ @@ -101,8 +101,16 @@ describe("DeleteItemQueryBuilder", () => { .execute(); expectTypeOf(res).toBeNever(); - expect(res).toBeUndefined(); + + const res2 = await tsynamoClient + .deleteItem("myTable") + .keys({ userId: "1", dataTimestamp: 2 }) + .returnValues("NONE") + .execute(); + + expectTypeOf(res2).toBeNever(); + expect(res2).toBeUndefined(); }); it("does return values if returnValues is specified", async () => { await tsynamoClient diff --git a/src/queryBuilders/deleteItemQueryBuilder.ts b/src/queryBuilders/deleteItemQueryBuilder.ts index 44a29aa..793721a 100644 --- a/src/queryBuilders/deleteItemQueryBuilder.ts +++ b/src/queryBuilders/deleteItemQueryBuilder.ts @@ -84,13 +84,21 @@ export interface DeleteItemQueryBuilderInterface< ...args: BuilderExprArg ): DeleteItemQueryBuilder; - returnValues( - option: Extract - ): DeleteItemQueryBuilder>; - - returnValuesOnConditionCheckFailure( - option: Extract - ): DeleteItemQueryBuilder>; + returnValues( + option: Extract + ): DeleteItemQueryBuilder< + DDB, + Table, + "NONE" extends Choice ? O : ExecuteOutput + >; + + returnValuesOnConditionCheckFailure( + option: Extract + ): DeleteItemQueryBuilder< + DDB, + Table, + "NONE" extends Choice ? O : ExecuteOutput + >; keys & PickSkRequired>( pk: Keys @@ -148,9 +156,13 @@ export class DeleteItemQueryBuilder }); } - returnValues( - option: Extract - ): DeleteItemQueryBuilder> { + returnValues( + option: Extract + ): DeleteItemQueryBuilder< + DDB, + Table, + "NONE" extends Choice ? O : ExecuteOutput + > { return new DeleteItemQueryBuilder({ ...this.#props, node: { @@ -163,9 +175,13 @@ export class DeleteItemQueryBuilder }); } - returnValuesOnConditionCheckFailure( - option: Extract - ): DeleteItemQueryBuilder> { + returnValuesOnConditionCheckFailure( + option: Extract + ): DeleteItemQueryBuilder< + DDB, + Table, + "NONE" extends Choice ? O : ExecuteOutput + > { return new DeleteItemQueryBuilder({ ...this.#props, node: { diff --git a/src/queryBuilders/putItemQueryBuilder.integration.test.ts b/src/queryBuilders/putItemQueryBuilder.integration.test.ts index 4433c04..b1af9eb 100644 --- a/src/queryBuilders/putItemQueryBuilder.integration.test.ts +++ b/src/queryBuilders/putItemQueryBuilder.integration.test.ts @@ -44,7 +44,7 @@ describe("PutItemQueryBuilder", () => { expect(result).toEqual(itemToPut); }); - it("doesnt return values without returnValues", async () => { + it("doesnt return values without returnValues or when its set to NONE", async () => { let result = await tsynamoClient .putItem("myTable") .item(itemToPut) @@ -52,6 +52,15 @@ describe("PutItemQueryBuilder", () => { expectTypeOf(result).toBeNever(); expect(result).toBeUndefined(); + + let result2 = await tsynamoClient + .putItem("myTable") + .item(itemToPut) + .returnValues("NONE") + .execute(); + + expectTypeOf(result2).toBeNever(); + expect(result2).toBeUndefined(); }); it("handles ReturnValues option", async () => { diff --git a/src/queryBuilders/putItemQueryBuilder.ts b/src/queryBuilders/putItemQueryBuilder.ts index d634599..445819d 100644 --- a/src/queryBuilders/putItemQueryBuilder.ts +++ b/src/queryBuilders/putItemQueryBuilder.ts @@ -75,9 +75,13 @@ export interface PutItemQueryBuilderInterface { ...args: BuilderExprArg ): PutItemQueryBuilder; - returnValues( - option: Extract - ): PutItemQueryBuilder>; + returnValues( + option: Extract + ): PutItemQueryBuilder< + DDB, + Table, + "NONE" extends Choice ? O : ExecuteOutput + >; item>( item: Item @@ -147,9 +151,13 @@ export class PutItemQueryBuilder }); } - returnValues( - option: Extract - ): PutItemQueryBuilder> { + returnValues( + option: Extract + ): PutItemQueryBuilder< + DDB, + Table, + "NONE" extends Choice ? O : ExecuteOutput + > { return new PutItemQueryBuilder({ ...this.#props, node: {