@squiz/db-lib 1.70.0 → 1.71.1

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Change Log
2
2
 
3
+ ## 1.71.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 5b7e758: AWS SDK Client versions bumped
8
+
9
+ ## 1.71.0
10
+
11
+ ### Minor Changes
12
+
13
+ - c1cb4d9: ignore non-existent items in delete db transaction
14
+
3
15
  ## 1.70.0
4
16
 
5
17
  ### Minor Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@squiz/db-lib",
3
- "version": "1.70.0",
3
+ "version": "1.71.1",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "private": false,
@@ -32,9 +32,9 @@
32
32
  "typescript": "4.9.4"
33
33
  },
34
34
  "dependencies": {
35
- "@aws-sdk/client-dynamodb": "^3.632.0",
36
- "@aws-sdk/client-secrets-manager": "3.614.0",
37
- "@aws-sdk/lib-dynamodb": "^3.632.0",
35
+ "@aws-sdk/client-dynamodb": "^3.651.1",
36
+ "@aws-sdk/client-secrets-manager": "3.651.1",
37
+ "@aws-sdk/lib-dynamodb": "^3.651.1",
38
38
  "@opentelemetry/api": "^1.6.0",
39
39
  "@squiz/dx-common-lib": "^1.66.4",
40
40
  "@squiz/dx-logger-lib": "^1.64.0",
@@ -774,7 +774,6 @@ describe('AbstractRepository', () => {
774
774
  TransactItems: [
775
775
  {
776
776
  Delete: {
777
- ConditionExpression: 'attribute_exists(pk)',
778
777
  Key: {
779
778
  pk: 'test_item#foo',
780
779
  sk: '#meta',
@@ -307,6 +307,8 @@ export abstract class AbstractDynamoDbRepository<SHAPE extends object, DATA_CLAS
307
307
  };
308
308
 
309
309
  if (transaction.id?.length) {
310
+ // For transaction block, don't worry if the item being deleted does not exist
311
+ delete deleteCommandInput.ConditionExpression;
310
312
  // this command will be executed together with
311
313
  // other db write commands in the "transaction block"
312
314
  this.dbManager.addWriteTransactionItem(transaction.id, {
@@ -49,6 +49,9 @@ export class DynamoDbManager<TRepositories> {
49
49
  if (this.transactionItems[transactionId] === undefined) {
50
50
  throw new TransactionError(`No items in transaction '${transactionId}' to execute`);
51
51
  }
52
+ if (!this.transactionItems[transactionId].length) {
53
+ return;
54
+ }
52
55
 
53
56
  return tracer.startActiveSpan(
54
57
  'executeTransaction',