Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@xapp/dynamo-service

Package Overview
Dependencies
Maintainers
5
Versions
155
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@xapp/dynamo-service - npm Package Compare versions

Comparing version 1.0.0-alpha.12 to 1.0.0-alpha.13

11

dist/service/__test__/DynamoService.test.js

@@ -343,3 +343,3 @@ "use strict";

};
Item = Object.assign({}, Key, { StringParam1: "One", NumberParam1: 2, ObjParam1: { Param: "Value" }, 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] });
yield client.put({

@@ -397,2 +397,11 @@ TableName: testTable.TableName,

}));
it("Tests that a nested attribute is updated.", () => __awaiter(this, void 0, void 0, function* () {
yield service.update(testTable.TableName, Key, {
set: {
"ObjParam2.Param1": "NewValue"
}
});
const updatedObj = yield client.get({ TableName: testTable.TableName, Key }).promise();
expect(updatedObj.Item.ObjParam2).to.deep.equal({ Param1: "NewValue", Param2: "Value2" });
}));
it("Tests that an empty string is allowed to be set in an object.", () => __awaiter(this, void 0, void 0, function* () {

@@ -399,0 +408,0 @@ yield service.update(testTable.TableName, Key, { set: { ObjParam1: { Param: "", Param2: "Test" } } });

11

dist/service/DynamoService.js

@@ -258,7 +258,12 @@ "use strict";

if (set.hasOwnProperty(key)) {
const alias = "#__dynoservice_updateset_a" + index;
const splitKeys = key.split(".");
const aliases = [];
for (const splitKey of splitKeys) {
const alias = "#__dynoservice_updateset_a" + ++index;
setAliasMap[alias] = splitKey;
aliases.push(alias);
}
const name = ":__dynoservice_updateset_a" + ++index;
setExpression += alias + " = " + name + ",";
setExpression += aliases.join(".") + " = " + name + ",";
setValues[name] = set[key];
setAliasMap[alias] = key;
}

@@ -265,0 +270,0 @@ }

@@ -98,2 +98,24 @@ "use strict";

});
it("Tests that nested parameters are retained if the trimUnknown flag is true.", () => {
const schema = buildTableSchema({
mapParam: {
type: "M",
attributes: {
param1: {
type: "S"
},
param2: {
type: "S"
}
}
}
});
const builder = new Builder.TableSchemaBuilder(schema, { trimUnknown: true });
const obj = builder.convertObjectToSchema({
"primaryKey": "TestKey",
"mapParam.param1": "Test",
"unknownMapParam.param1": "Test"
});
expect(obj).to.deep.equal({ "primaryKey": "TestKey", "mapParam.param1": "Test" });
});
it("Tests that constant parameters are *not* removed if the trimConstants flag is true.", () => {

@@ -161,2 +183,25 @@ const schema = buildTableSchema({ "stringParam": { type: "S", constant: true } });

});
it("Tests that nested items in the set object are retained if the trimUnknown flag is set to true.", () => {
const schema = buildTableSchema({
mapParam: {
type: "M",
attributes: {
param1: {
type: "S"
},
param2: {
type: "S"
}
}
}
});
const builder = new Builder.TableSchemaBuilder(schema, { trimUnknown: true });
const obj = builder.convertUpdateObjectToSchema({
set: {
"mapParam.param1": "Test",
"unknownMapParam.param1": "Test"
}
});
expect(obj).to.deep.equal({ set: { "mapParam.param1": "Test" } });
});
it("Tests that constant parameters are not removed from the set object if the trimConstants flag is true.", () => {

@@ -163,0 +208,0 @@ const schema = buildTableSchema({ "stringParam": { type: "S", constant: true } });

@@ -94,4 +94,5 @@ "use strict";

const obj = {};
for (const key of knownKeys) {
if (originalObj.hasOwnProperty(key)) {
const objKeys = Object.keys(originalObj || {});
for (const key of objKeys) {
if (knownKeys.indexOf(key.split(".")[0]) >= 0) {
obj[key] = originalObj[key];

@@ -98,0 +99,0 @@ }

{
"name": "@xapp/dynamo-service",
"version": "1.0.0-alpha.12",
"version": "1.0.0-alpha.13",
"description": "A dynamo help class which will help maintain data integrity.",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc