Releases: woltsu/tsynamo
Releases · woltsu/tsynamo
v0.0.11
What's Changed
- add JSDoc by @mindler-sasu in #29
- Simplify output types by @mindler-sasu in #35
- fix delete and put item typing when no returnValues set by @mindler-sasu in #33
Full Changelog: v0.0.10...v0.0.11
v0.0.10
Added support for DynamoDB Transactions! With these, you can perform multiple operations to different tables using a single command. Also, by providing an optional ClientRequestToken
parameter to the write transaction, you can ensure idempotency in your DynamoDB calls.
An example of a read transaction
const trx = tsynamoClient.createReadTransaction();
trx.addItem({
Get: tsynamoClient.getItem("myTable").keys({
userId: "123",
dataTimestamp: 222,
}),
});
trx.addItem({
Get: tsynamoClient.getItem("myOtherTable").keys({
userId: "321",
stringTimestamp: "222",
}),
});
const result = await trx.execute();
An example of a write transaction
const trx = tsynamoClient.createWriteTransaction("some client request token"); // NOTE: The token is optional
trx.addItem({
Put: tsynamoClient
.putItem("myTable")
.item({ userId: "313", dataTimestamp: 1 }),
});
trx.addItem({
Update: tsynamoClient
.updateItem("myTable")
.keys({ userId: "313", dataTimestamp: 2 })
.set("tags", "=", ["a", "b", "c"]),
});
trx.addItem({
Delete: tsynamoClient.deleteItem("myOtherTable").keys({
userId: "321",
stringTimestamp: "222",
}),
});
await trx.execute();