node-aws-utils
Advanced tools
Comparing version 1.7.0 to 2.0.0
@@ -6,3 +6,9 @@ import type { TResultAsync } from 'node-result'; | ||
fields?: string[]; | ||
}): TResultAsync<DynamoDB.DocumentClient.AttributeMap | null, Error>; | ||
fieldsMap?: DynamoDB.DocumentClient.ExpressionAttributeNameMap; | ||
consistent?: boolean; | ||
capacity?: DynamoDB.DocumentClient.ReturnConsumedCapacity; | ||
}): TResultAsync<{ | ||
item: DynamoDB.DocumentClient.AttributeMap | null; | ||
capacity: DynamoDB.DocumentClient.ConsumedCapacity | null; | ||
}, Error>; | ||
static getFromIndex(client: DynamoDB.DocumentClient, tableName: DynamoDB.DocumentClient.TableName, indexName: DynamoDB.DocumentClient.IndexName, where: { | ||
@@ -9,0 +15,0 @@ pk: { |
@@ -19,4 +19,10 @@ "use strict"; | ||
params.ProjectionExpression = options.fields.join(','); | ||
const { Item } = await client.get(params).promise(); | ||
return node_result_1.ok(Item || null); | ||
if (options.fieldsMap) | ||
params.ExpressionAttributeNames = options.fieldsMap; | ||
if (options.consistent) | ||
params.ConsistentRead = options.consistent; | ||
if (options.capacity) | ||
params.ReturnConsumedCapacity = options.capacity; | ||
const { Item, ConsumedCapacity } = await client.get(params).promise(); | ||
return node_result_1.ok({ item: Item || null, capacity: ConsumedCapacity || null }); | ||
} | ||
@@ -23,0 +29,0 @@ static async getFromIndex(client, tableName, indexName, where) { |
{ | ||
"name": "node-aws-utils", | ||
"version": "1.7.0", | ||
"version": "2.0.0", | ||
"description": "aws utils", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8172
112