dynamo-bao 0.3.5 → 0.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dynamo-bao",
3
- "version": "0.3.5",
3
+ "version": "0.3.6",
4
4
  "description": "Simple powerful data modeling primitives for DynamoDB in JavaScript.",
5
5
  "main": "src/index.js",
6
6
  "exports": {
@@ -49,7 +49,6 @@
49
49
  "jest": "^29.7.0",
50
50
  "jsdoc": "^4.0.4",
51
51
  "prettier": "3.4.2",
52
- "serverless": "^3.38.0",
53
52
  "eslint-plugin-promise": "^6.1.1"
54
53
  },
55
54
  "bin": {
@@ -528,12 +528,18 @@ const MutationMethods = {
528
528
  // Fetch the item since transactWrite doesn't return values
529
529
  const savedItem = await this.find(primaryId, { batchDelay: 0 });
530
530
 
531
+ // if the item doesn't exist, sleep for 200ms and try again
532
+ if (!savedItem.exists()) {
533
+ await new Promise((resolve) => setTimeout(resolve, 200));
534
+ savedItem = await this.find(primaryId, { batchDelay: 0 });
535
+ }
536
+
531
537
  logger.debug("savedItem", savedItem);
532
- logger.debug("savedItem.getPrimaryId()", savedItem.getPrimaryId());
533
538
 
534
539
  if (!savedItem.exists()) {
535
540
  throw new ConditionalError("Failed to fetch saved item", "update");
536
541
  }
542
+ logger.debug("savedItem.getPrimaryId()", savedItem.getPrimaryId());
537
543
 
538
544
  // Set the consumed capacity from the transaction
539
545
  savedItem._addConsumedCapacity(