@xapp/dynamo-service
Advanced tools
Comparing version 1.2.0 to 1.3.0
@@ -20,3 +20,9 @@ { | ||
"dynoservice" | ||
] | ||
], | ||
"license-header-manager.additionalCommentStyles": [{ | ||
"extension": ".ts", | ||
"commentStart": "/**", | ||
"commentMiddle": " *", | ||
"commentEnd": " */" | ||
}] | ||
} |
@@ -5,2 +5,11 @@ # Changelog | ||
## [1.3.0](https://github.com/XappMedia/dynamo-service/compare/v1.2.0...v1.3.0) (2019-08-26) | ||
### Features | ||
* Adding ability to update nested attributes. ([adb762e](https://github.com/XappMedia/dynamo-service/commit/adb762e)) | ||
## [1.2.0](https://github.com/XappMedia/dynamo-service/compare/v1.1.0...v1.2.0) (2019-08-06) | ||
@@ -7,0 +16,0 @@ |
@@ -346,3 +346,11 @@ "use strict"; | ||
}; | ||
Item = Object.assign({}, Key, { StringParam1: "One", NumberParam1: 2, ObjParam1: { Param: "Value" }, ObjParam2: { Param1: "Value1", Param2: "Value2" }, ListParam1: [1, 2, 3, 4, 5, 6] }); | ||
Item = Object.assign({}, Key, { StringParam1: "One", NumberParam1: 2, ObjParam1: { Param: "Value" }, ObjParam2: { Param1: "Value1", Param2: "Value2" }, ListParam1: [1, 2, 3, 4, 5, 6], NestedLIstParam1: { | ||
list: [{ | ||
param1: "Value", | ||
param2: "Value" | ||
}, { | ||
param3: "Value", | ||
param4: "Value" | ||
}] | ||
} }); | ||
yield client.put({ | ||
@@ -421,2 +429,18 @@ TableName: testTable.TableName, | ||
})); | ||
it("Tests that an attribute in the nested list parameter is updated.", () => __awaiter(this, void 0, void 0, function* () { | ||
yield service.update(testTable.TableName, Key, { set: { | ||
"NestedLIstParam1.list[0].param3": "NewValue" | ||
} }); | ||
const updatedObj = yield client.get({ TableName: testTable.TableName, Key }).promise(); | ||
expect(updatedObj.Item.NestedLIstParam1).to.deep.equal({ | ||
list: [{ | ||
param1: "Value", | ||
param2: "Value", | ||
param3: "NewValue" | ||
}, { | ||
param3: "Value", | ||
param4: "Value" | ||
}] | ||
}); | ||
})); | ||
it("Tests that an null object is not turned to an object.", () => __awaiter(this, void 0, void 0, function* () { | ||
@@ -423,0 +447,0 @@ const updateObj = { |
@@ -275,4 +275,5 @@ "use strict"; | ||
for (const splitKey of splitKeys) { | ||
const alias = "#__dynoservice_updateset_a" + ++index; | ||
setAliasMap[alias] = splitKey; | ||
const matchKey = splitKey.match(/^([^[\]]+)(\[[0-9]+\])?$/); | ||
const alias = "#__dynoservice_updateset_a" + ++index + (matchKey[2] || ""); | ||
setAliasMap[alias] = matchKey[1]; | ||
aliases.push(alias); | ||
@@ -320,3 +321,7 @@ } | ||
if (Object_1.objHasAttrs(setAliasMap)) { | ||
returnValue = Object.assign({}, returnValue, { ExpressionAttributeNames: setAliasMap }); | ||
const ExpressionAttributeNames = Object.keys(setAliasMap).reduce((last, currentKey) => { | ||
last[currentKey.replace(/\[[0-9]+\]$/, "")] = setAliasMap[currentKey]; | ||
return last; | ||
}, {}); | ||
returnValue = Object.assign({}, returnValue, { ExpressionAttributeNames }); | ||
} | ||
@@ -323,0 +328,0 @@ return returnValue; |
{ | ||
"name": "@xapp/dynamo-service", | ||
"version": "1.2.0", | ||
"author": "XAPPmedia", | ||
"license": "Apache-2.0", | ||
"version": "1.3.0", | ||
"description": "A dynamo help class which will help maintain data integrity.", | ||
@@ -24,4 +26,2 @@ "main": "dist/index.js", | ||
], | ||
"author": "", | ||
"license": "ISC", | ||
"devDependencies": { | ||
@@ -28,0 +28,0 @@ "@types/chai": "^4.1.7", |
Sorry, the diff of this file is too big to display
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
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
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
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
513896
119
10695
1