@moicky/dynamodb 3.1.0 → 3.1.2

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.
@@ -31,6 +31,11 @@ const lib_1 = require("../lib");
31
31
  */
32
32
  async function getItem(key, args = {}) {
33
33
  args = (0, lib_1.withDefaults)(args, "getItem");
34
+ if (args?.ProjectionExpression && !args?.ExpressionAttributeNames) {
35
+ args.ExpressionAttributeNames = (0, lib_1.getAttributeNames)(key, {
36
+ attributesToGet: (0, lib_1.getAttributesFromExpression)(args?.ProjectionExpression),
37
+ });
38
+ }
34
39
  return (0, lib_1.getClient)()
35
40
  .send(new client_dynamodb_1.GetItemCommand({
36
41
  Key: (0, lib_1.stripKey)(key, args),
@@ -173,9 +173,10 @@ class Transaction {
173
173
  }
174
174
  this.hasBeenExecuted = true;
175
175
  const operations = Object.values(this.operations);
176
- if (operations.length === 0 ||
177
- (operations.length > OPERATIONS_LIMIT &&
178
- !this.shouldSplitTransactions)) {
176
+ if (operations.length === 0)
177
+ return resolve({});
178
+ if (operations.length > OPERATIONS_LIMIT &&
179
+ !this.shouldSplitTransactions) {
179
180
  reject(new Error("[@moicky/dynamodb]: Invalid number of operations"));
180
181
  }
181
182
  const conditionCheckItems = operations
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moicky/dynamodb",
3
- "version": "3.1.0",
3
+ "version": "3.1.2",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "description": "Contains a collection of convenience functions for working with AWS DynamoDB",
package/readme.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @moicky/dynamodb
2
2
 
3
- ![](https://img.shields.io/github/actions/workflow/status/moicky/dynamodb/npm-publish.yml?label=build)
3
+ ![](https://img.shields.io/github/actions/workflow/status/moicky/dynamodb/run-tests.yml?label=build)
4
4
  ![](https://img.shields.io/github/actions/workflow/status/moicky/dynamodb/run-tests.yml?label=tests)
5
5
 
6
6
  ## Description