inlaweb-lib-dynamodb 1.0.7 → 1.0.9
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 -1
- package/index.js +2 -10
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export declare class DynamoLib {
|
|
|
6
6
|
constructor();
|
|
7
7
|
putItem(tableName: string, item: KeyValue): Promise<void>;
|
|
8
8
|
getItem<T>(tableName: string, key: KeyValue, projectionExpression?: string): Promise<T>;
|
|
9
|
-
updateItem(params: InputUpdate): Promise<
|
|
9
|
+
updateItem<T>(params: InputUpdate): Promise<T>;
|
|
10
10
|
query<T>(params: {
|
|
11
11
|
tableName: string;
|
|
12
12
|
searchParameters: SearchParameters;
|
package/index.js
CHANGED
|
@@ -64,7 +64,7 @@ class DynamoLib {
|
|
|
64
64
|
this.logger.debug(`UpdateItem: ${JSON.stringify(itemUpdate.Update)}`);
|
|
65
65
|
const result = await this.docClient.send(new lib_dynamodb_1.UpdateCommand(itemUpdate.Update));
|
|
66
66
|
this.logger.debug(`UpdateItem Result: ${JSON.stringify(result)}`);
|
|
67
|
-
return
|
|
67
|
+
return result.Attributes;
|
|
68
68
|
}
|
|
69
69
|
catch (error) {
|
|
70
70
|
this.logger.error(error.message);
|
|
@@ -263,15 +263,6 @@ class DynamoLib {
|
|
|
263
263
|
}
|
|
264
264
|
createUpdateParams(params) {
|
|
265
265
|
const { table, PK, SK, item, setAttributes, addAttributes, removeAttributes, username, } = params;
|
|
266
|
-
// Se agregan los datos de auditoría para la actualización
|
|
267
|
-
item.updateUser = username;
|
|
268
|
-
item.updateDate = moment_timezone_1.default
|
|
269
|
-
.tz(new Date(), "America/Bogota")
|
|
270
|
-
.format("YYYY-MM-DD");
|
|
271
|
-
if (!setAttributes.includes("updateUser"))
|
|
272
|
-
setAttributes.push("updateUser");
|
|
273
|
-
if (!setAttributes.includes("updateDate"))
|
|
274
|
-
setAttributes.push("updateDate");
|
|
275
266
|
// Se crea el objeto de la operación
|
|
276
267
|
let itemUpdate = {
|
|
277
268
|
Update: {
|
|
@@ -281,6 +272,7 @@ class DynamoLib {
|
|
|
281
272
|
ExpressionAttributeNames: {},
|
|
282
273
|
ExpressionAttributeValues: {},
|
|
283
274
|
ReturnConsumedCapacity: "TOTAL",
|
|
275
|
+
ReturnValues: "ALL_NEW",
|
|
284
276
|
},
|
|
285
277
|
};
|
|
286
278
|
// Se agregan los campos a modificar
|