-
Notifications
You must be signed in to change notification settings - Fork 611
/
Copy pathGetCommand.ts
88 lines (78 loc) · 2.77 KB
/
GetCommand.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
// smithy-typescript generated code
import { GetItemCommand as __GetItemCommand } from "@aws-sdk/client-dynamodb";
import { Command as $Command } from "@smithy/smithy-client";
import type { Handler, HttpHandlerOptions as __HttpHandlerOptions, MiddlewareStack } from "@smithy/types";
import { DynamoDBDocumentClientCommand } from "../baseCommand/DynamoDBDocumentClientCommand";
import { ALL_VALUES } from "../commands/utils";
import type {
DynamoDBDocumentClientResolvedConfig,
ServiceInputTypes,
ServiceOutputTypes,
} from "../DynamoDBDocumentClient";
/**
* @public
*/
export { DynamoDBDocumentClientCommand, $Command };
/**
* @public
*/
export type GetCommandInput = Omit<__GetItemCommandInput, "Key"> & {
Key: Record<string, NativeAttributeValue> | undefined;
};
/**
* @public
*/
export type GetCommandOutput = Omit<__GetItemCommandOutput, "Item"> & {
Item?: Record<string, NativeAttributeValue>;
};
/**
* Accepts native JavaScript types instead of `AttributeValue`s, and calls
* GetItemCommand operation from {@link @aws-sdk/client-dynamodb#GetItemCommand}.
*
* JavaScript objects passed in as parameters are marshalled into `AttributeValue` shapes
* required by Amazon DynamoDB. Responses from DynamoDB are unmarshalled into plain JavaScript objects.
*
* @public
*/
export class GetCommand extends DynamoDBDocumentClientCommand<
GetCommandInput,
GetCommandOutput,
__GetItemCommandInput,
__GetItemCommandOutput,
DynamoDBDocumentClientResolvedConfig
> {
protected readonly inputKeyNodes = {
Key: ALL_VALUES, // map with AttributeValue
};
protected readonly outputKeyNodes = {
Item: ALL_VALUES, // map with AttributeValue
};
protected readonly clientCommand: __GetItemCommand;
public readonly middlewareStack: MiddlewareStack<
GetCommandInput | __GetItemCommandInput,
GetCommandOutput | __GetItemCommandOutput
>;
constructor(readonly input: GetCommandInput) {
super();
this.clientCommand = new __GetItemCommand(this.input as any);
this.middlewareStack = this.clientCommand.middlewareStack;
}
/**
* @internal
*/
resolveMiddleware(
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
configuration: DynamoDBDocumentClientResolvedConfig,
options?: __HttpHandlerOptions
): Handler<GetCommandInput, GetCommandOutput> {
this.addMarshallingMiddleware(configuration);
const stack = clientStack.concat(this.middlewareStack as typeof clientStack);
const handler = this.clientCommand.resolveMiddleware(stack, configuration, options);
return async () => handler(this.clientCommand);
}
}
import type {
GetItemCommandInput as __GetItemCommandInput,
GetItemCommandOutput as __GetItemCommandOutput,
} from "@aws-sdk/client-dynamodb";
import type { NativeAttributeValue } from "@aws-sdk/util-dynamodb";