inlaweb-lib-dynamodb 1.0.6 → 1.0.8
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/index.d.ts +1 -0
- package/index.js +16 -9
- package/package.json +1 -1
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -84,6 +84,22 @@ class DynamoLib {
|
|
|
84
84
|
throw error;
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
+
async deleteItem(tableName, key) {
|
|
88
|
+
try {
|
|
89
|
+
const params = {
|
|
90
|
+
TableName: tableName,
|
|
91
|
+
Key: key,
|
|
92
|
+
ReturnConsumedCapacity: "TOTAL",
|
|
93
|
+
};
|
|
94
|
+
this.logger.debug(`DeleteItem: ${JSON.stringify(params)}`);
|
|
95
|
+
const response = await this.docClient.send(new lib_dynamodb_1.DeleteCommand(params));
|
|
96
|
+
this.logger.debug(`DeleteItem Result: ${JSON.stringify(response)}`);
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
this.logger.error(error.message);
|
|
100
|
+
throw error;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
87
103
|
buildQueryParams(params) {
|
|
88
104
|
const projection = this.buildProjectionExpression(params.searchParameters.projectionExpression);
|
|
89
105
|
const parameters = {
|
|
@@ -247,15 +263,6 @@ class DynamoLib {
|
|
|
247
263
|
}
|
|
248
264
|
createUpdateParams(params) {
|
|
249
265
|
const { table, PK, SK, item, setAttributes, addAttributes, removeAttributes, username, } = params;
|
|
250
|
-
// Se agregan los datos de auditoría para la actualización
|
|
251
|
-
item.updateUser = username;
|
|
252
|
-
item.updateDate = moment_timezone_1.default
|
|
253
|
-
.tz(new Date(), "America/Bogota")
|
|
254
|
-
.format("YYYY-MM-DD");
|
|
255
|
-
if (!setAttributes.includes("updateUser"))
|
|
256
|
-
setAttributes.push("updateUser");
|
|
257
|
-
if (!setAttributes.includes("updateDate"))
|
|
258
|
-
setAttributes.push("updateDate");
|
|
259
266
|
// Se crea el objeto de la operación
|
|
260
267
|
let itemUpdate = {
|
|
261
268
|
Update: {
|