serverless-spy
Version:
CDK-based library for writing elegant integration tests on AWS serverless architecture and an additional web console to monitor events in real time.
41 lines (40 loc) • 1.56 kB
JavaScript
import { UpdateItemCommand as __UpdateItemCommand } from "@aws-sdk/client-dynamodb";
import { Command as $Command } from "@smithy/smithy-client";
import { DynamoDBDocumentClientCommand } from "../baseCommand/DynamoDBDocumentClientCommand";
import { ALL_MEMBERS, ALL_VALUES, SELF } from "../commands/utils";
export { DynamoDBDocumentClientCommand, $Command };
export class UpdateCommand extends DynamoDBDocumentClientCommand {
constructor(input) {
super();
this.input = input;
this.inputKeyNodes = {
Key: ALL_VALUES,
AttributeUpdates: {
"*": {
Value: SELF,
},
},
Expected: {
"*": {
Value: SELF,
AttributeValueList: ALL_MEMBERS,
},
},
ExpressionAttributeValues: ALL_VALUES,
};
this.outputKeyNodes = {
Attributes: ALL_VALUES,
ItemCollectionMetrics: {
ItemCollectionKey: ALL_VALUES,
},
};
this.clientCommand = new __UpdateItemCommand(this.input);
this.middlewareStack = this.clientCommand.middlewareStack;
}
resolveMiddleware(clientStack, configuration, options) {
this.addMarshallingMiddleware(configuration);
const stack = clientStack.concat(this.middlewareStack);
const handler = this.clientCommand.resolveMiddleware(stack, configuration, options);
return async () => handler(this.clientCommand);
}
}