Skip to content

Releases: woltsu/tsynamo

v0.0.11

26 Jun 14:28
Compare
Choose a tag to compare

What's Changed

Full Changelog: v0.0.10...v0.0.11

v0.0.10

31 May 11:15
fd6a3d4
Compare
Choose a tag to compare

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();