@izara_project/izara-core-library-dynamodb 1.0.3 → 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 +7 -7
- package/src/DynamodbSharedLib.js +7 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@izara_project/izara-core-library-dynamodb",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "Connecting with AWS DynamoDB Resource",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -20,12 +20,12 @@
|
|
|
20
20
|
"testEnvironment": "node"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@aws-sdk/client-dynamodb": "^3.
|
|
24
|
-
"@aws-sdk/lib-dynamodb": "^3.
|
|
25
|
-
"@aws-sdk/util-dynamodb": "^3.
|
|
26
|
-
"@izara_project/izara-core-library-core": "^1.0.
|
|
27
|
-
"@izara_project/izara-core-library-logger": "^1.0.
|
|
28
|
-
"@izara_project/izara-core-library-service-schemas": "^1.0.
|
|
23
|
+
"@aws-sdk/client-dynamodb": "^3.782.0",
|
|
24
|
+
"@aws-sdk/lib-dynamodb": "^3.782.0",
|
|
25
|
+
"@aws-sdk/util-dynamodb": "^3.782.0",
|
|
26
|
+
"@izara_project/izara-core-library-core": "^1.0.18",
|
|
27
|
+
"@izara_project/izara-core-library-logger": "^1.0.7",
|
|
28
|
+
"@izara_project/izara-core-library-service-schemas": "^1.0.49",
|
|
29
29
|
"lodash.clonedeep": "^4.5.0"
|
|
30
30
|
}
|
|
31
31
|
}
|
package/src/DynamodbSharedLib.js
CHANGED
|
@@ -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()
|