-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from mindler-olli/main
intial work for supporting transactions
- Loading branch information
Showing
20 changed files
with
800 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { TransactGetItemNode } from "./transactGetItemNode"; | ||
|
||
export type ReadTransactionNode = { | ||
readonly kind: "ReadTransactionNode"; | ||
readonly transactGetItems: TransactGetItemNode[]; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { GetNode } from "./getNode"; | ||
|
||
export type TransactGetItemNode = { | ||
readonly kind: "TransactGetItemNode"; | ||
readonly Get: GetNode; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { DeleteNode } from "./deleteNode"; | ||
import { PutNode } from "./putNode"; | ||
import { UpdateNode } from "./updateNode"; | ||
|
||
export type TransactWriteItemNode = { | ||
readonly kind: "TransactWriteItemNode"; | ||
readonly Put?: PutNode; | ||
readonly Delete?: DeleteNode; | ||
readonly Update?: UpdateNode; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { TransactWriteItemNode } from "./transactWriteItemNode"; | ||
|
||
export type WriteTransactionNode = { | ||
readonly kind: "WriteTransactionNode"; | ||
readonly transactWriteItems: TransactWriteItemNode[]; | ||
readonly clientRequestToken?: string; | ||
}; |
25 changes: 25 additions & 0 deletions
25
src/queryBuilders/__snapshots__/readTransactionBuilder.integration.test.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html | ||
|
||
exports[`ReadTransactionBuilder > handles transaction with gets 1`] = ` | ||
[ | ||
[ | ||
"myTable", | ||
{ | ||
"dataTimestamp": 222, | ||
"someBoolean": true, | ||
"somethingElse": 2, | ||
"userId": "123", | ||
}, | ||
], | ||
[ | ||
"myOtherTable", | ||
{ | ||
"userId": "123", | ||
}, | ||
], | ||
[ | ||
"myTable", | ||
undefined, | ||
], | ||
] | ||
`; |
37 changes: 37 additions & 0 deletions
37
src/queryBuilders/__snapshots__/writeTransactionBuilder.integration.test.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html | ||
|
||
exports[`WriteTransactionBuilder > handles a transaction with a client request token 1`] = `[IdempotentParameterMismatchException: UnknownError]`; | ||
|
||
exports[`WriteTransactionBuilder > handles a transaction with failing conditions 1`] = `[TransactionCanceledException: Transaction cancelled, please refer cancellation reasons for specific reasons [ConditionalCheckFailed]]`; | ||
|
||
exports[`WriteTransactionBuilder > handles a transaction with puts 1`] = ` | ||
[ | ||
{ | ||
"dataTimestamp": 1, | ||
"userId": "9999", | ||
}, | ||
{ | ||
"dataTimestamp": 2, | ||
"userId": "9999", | ||
}, | ||
] | ||
`; | ||
|
||
exports[`WriteTransactionBuilder > handles a transaction with updates 1`] = ` | ||
[ | ||
{ | ||
"dataTimestamp": 1, | ||
"someBoolean": true, | ||
"userId": "9999", | ||
}, | ||
{ | ||
"dataTimestamp": 2, | ||
"tags": [ | ||
"a", | ||
"b", | ||
"c", | ||
], | ||
"userId": "9999", | ||
}, | ||
] | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.