@izara_project/izara-core-library-dynamodb 1.0.4 → 1.0.5

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": "@izara_project/izara-core-library-dynamodb",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "Connecting with AWS DynamoDB Resource",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -130,12 +130,13 @@ function validateSideHand(logicalElement, prefixSide) { // helper function
130
130
  }
131
131
 
132
132
  if (checkSides.length == 1) { // if more than one will error
133
-
133
+ let sideHandResult = logicalElement[checkSides[0]];
134
134
  // add : if side type is reference for ExpressionAttributeValues
135
135
  // NOTE not sure about Attribute, will pull values from exist data db
136
136
  // if (checkSides[0].includes('Reference') || checkSides[0].includes('Attribute')) {
137
137
  if (checkSides[0].includes('Reference') && prefixSide !== 'lhs') {
138
- logicalElement[checkSides[0]] = ':' + logicalElement[checkSides[0]]
138
+ // logicalElement[checkSides[0]] = ':' + logicalElement[checkSides[0]]
139
+ sideHandResult = ':' + sideHandResult;
139
140
  }
140
141
  // ***** if side is "lhsReference" not logic to handle for now, so will be throw err *****
141
142
  else if (checkSides[0] == 'lhsReference') {
@@ -146,7 +147,8 @@ function validateSideHand(logicalElement, prefixSide) { // helper function
146
147
  // logicalElement[checkSides[0]] = 'attributes.' + logicalElement[checkSides[0]]
147
148
  // }
148
149
 
149
- return logicalElement[checkSides[0]] // return values eg. :product | product | 3
150
+ // return logicalElement[checkSides[0]] // return values eg. :product | product | 3
151
+ return sideHandResult; // return values eg. :product | product | 3
150
152
 
151
153
  } else if (checkSides.length == 0) {
152
154
  throw new NoRetryError(`"${prefixSide}_" does not set!`)
@@ -766,7 +768,7 @@ module.exports.putItem = async (
766
768
 
767
769
  // for (let idx = 0; idx < attributes.length; idx++) { // for loop more performance than for of
768
770
  for (let idx = 0, len = attributes.length; idx < len; idx++) {
769
- if (attributes[idx].value === undefined) {
771
+ if (attributes[idx].action !== 'REMOVE' && attributes[idx].value === undefined) {
770
772
  continue;
771
773
  }
772
774
 
@@ -923,7 +925,7 @@ module.exports.updateItem = async (_izContext, tableName, keyValues, attributes,
923
925
 
924
926
  // ====== for loop to check each element
925
927
  for (let idx = 0, len = attributes.length; idx < len; idx++) {
926
- if (attributes[idx].value === undefined) continue;
928
+ if (attributes[idx].action !== 'REMOVE' && (attributes[idx].value === undefined)) continue;
927
929
 
928
930
  // change action string to upperCase
929
931
  attributes[idx].action = attributes[idx].action.toUpperCase()