-
Notifications
You must be signed in to change notification settings - Fork 573
/
TransactGetCommand.ts
72 lines (66 loc) · 2.79 KB
/
TransactGetCommand.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import { DynamoDBDocumentClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../DynamoDBDocumentClient";
import { marshallInput, unmarshallOutput } from "../commands/utils";
import {
Get,
ItemResponse,
TransactGetItem,
TransactGetItemsCommand as __TransactGetItemsCommand,
TransactGetItemsCommandInput as __TransactGetItemsCommandInput,
TransactGetItemsCommandOutput as __TransactGetItemsCommandOutput,
} from "@aws-sdk/client-dynamodb";
import { Command as $Command } from "@aws-sdk/smithy-client";
import { Handler, MiddlewareStack, HttpHandlerOptions as __HttpHandlerOptions } from "@aws-sdk/types";
import { NativeAttributeValue } from "@aws-sdk/util-dynamodb";
export type TransactGetCommandInput = Omit<__TransactGetItemsCommandInput, "TransactItems"> & {
TransactItems:
| (Omit<TransactGetItem, "Get"> & {
Get:
| (Omit<Get, "Key"> & {
Key: { [key: string]: NativeAttributeValue } | undefined;
})
| undefined;
})[]
| undefined;
};
export type TransactGetCommandOutput = Omit<__TransactGetItemsCommandOutput, "Responses"> & {
Responses?: (Omit<ItemResponse, "Item"> & {
Item?: { [key: string]: NativeAttributeValue };
})[];
};
/**
* Accepts native JavaScript types instead of `AttributeValue`s, and calls
* TransactGetItemsCommand operation from {@link https://www.npmjs.com/package/@aws-sdk/client-dynamodb @aws-sdk/client-dynamodb}.
*
* JavaScript objects passed in as parameters are marshalled into `AttributeValue` shapes
* required by Amazon DynamoDB. Responses from DynamoDB are unmarshalled into plain JavaScript objects.
*/
export class TransactGetCommand extends $Command<
TransactGetCommandInput,
TransactGetCommandOutput,
DynamoDBDocumentClientResolvedConfig
> {
private readonly inputKeyNodes = [{ key: "TransactItems", children: [{ key: "Get", children: [{ key: "Key" }] }] }];
private readonly outputKeyNodes = [{ key: "Responses", children: [{ key: "Item" }] }];
constructor(readonly input: TransactGetCommandInput) {
super();
}
/**
* @internal
*/
resolveMiddleware(
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
configuration: DynamoDBDocumentClientResolvedConfig,
options?: __HttpHandlerOptions
): Handler<TransactGetCommandInput, TransactGetCommandOutput> {
const { marshallOptions, unmarshallOptions } = configuration.translateConfig || {};
const command = new __TransactGetItemsCommand(marshallInput(this.input, this.inputKeyNodes, marshallOptions));
const handler = command.resolveMiddleware(clientStack, configuration, options);
return async () => {
const data = await handler(command);
return {
...data,
output: unmarshallOutput(data.output, this.outputKeyNodes, unmarshallOptions),
};
};
}
}