From 9261ef7926ad1dcc09ca54daded529cd95dc7556 Mon Sep 17 00:00:00 2001 From: Warren Parad Date: Thu, 15 Feb 2024 12:52:17 +0100 Subject: [PATCH] Update requirements for put and query. --- src/dynamoDbSafe.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dynamoDbSafe.js b/src/dynamoDbSafe.js index d4c8f61..efb2b53 100644 --- a/src/dynamoDbSafe.js +++ b/src/dynamoDbSafe.js @@ -81,7 +81,7 @@ class DynamoDB extends DynamoDbOriginal.DocumentClient { query(originalParams) { if (!originalParams || !originalParams.TableName) { throw new DynamoDbError({ error: 'TableName not specified', parameters: originalParams }, 'InvalidParameters'); } - if (!originalParams.Key) { throw new DynamoDbError({ error: 'Key not specified', parameters: originalParams }, 'InvalidParameters'); } + if (!originalParams.KeyConditionExpression) { throw new DynamoDbError({ error: 'KeyConditionExpression not specified', parameters: originalParams }, 'InvalidParameters'); } const params = originalParams; const capturedStack = { name: 'DynamoDB.update() Error:' }; @@ -122,7 +122,7 @@ class DynamoDB extends DynamoDbOriginal.DocumentClient { put(originalParams) { if (!originalParams || !originalParams.TableName) { throw new DynamoDbError({ error: 'TableName not specified', parameters: originalParams }, 'InvalidParameters'); } - if (!originalParams.Key) { throw new DynamoDbError({ error: 'Key not specified', parameters: originalParams }, 'InvalidParameters'); } + if (!originalParams.Item) { throw new DynamoDbError({ error: 'Item not specified', parameters: originalParams }, 'InvalidParameters'); } const conditionExpressionTokens = parseExpression(originalParams.ConditionExpression); if (conditionExpressionTokens) {