@softchef/cdk-iot-device-management
Version:
IoT device management is composed of things, thing types, thing groups, jobs, files API services. The constructs can be used independently, that are based on full-managed service to create an API Gateway & Lambda function.
45 lines (44 loc) • 1.93 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.TransactWriteCommand = void 0;
const client_dynamodb_1 = require("@aws-sdk/client-dynamodb");
const smithy_client_1 = require("@aws-sdk/smithy-client");
const utils_1 = require("../commands/utils");
class TransactWriteCommand extends smithy_client_1.Command {
constructor(input) {
super();
this.input = input;
this.inputKeyNodes = [
{
key: "TransactItems",
children: [
{ key: "ConditionCheck", children: [{ key: "Key" }, { key: "ExpressionAttributeValues" }] },
{ key: "Put", children: [{ key: "Item" }, { key: "ExpressionAttributeValues" }] },
{ key: "Delete", children: [{ key: "Key" }, { key: "ExpressionAttributeValues" }] },
{ key: "Update", children: [{ key: "Key" }, { key: "ExpressionAttributeValues" }] },
],
},
];
this.outputKeyNodes = [
{
key: "ItemCollectionMetrics",
children: {
children: [{ key: "ItemCollectionKey" }],
},
},
];
}
resolveMiddleware(clientStack, configuration, options) {
const { marshallOptions, unmarshallOptions } = configuration.translateConfig || {};
const command = new client_dynamodb_1.TransactWriteItemsCommand(utils_1.marshallInput(this.input, this.inputKeyNodes, marshallOptions));
const handler = command.resolveMiddleware(clientStack, configuration, options);
return async () => {
const data = await handler(command);
return {
...data,
output: utils_1.unmarshallOutput(data.output, this.outputKeyNodes, unmarshallOptions),
};
};
}
}
exports.TransactWriteCommand = TransactWriteCommand;