@aws-sdk/lib-dynamodb 3.32.0 → 3.36.0
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/CHANGELOG.md +41 -0
- package/dist-cjs/DynamoDBDocument.js +205 -0
- package/dist-cjs/DynamoDBDocumentClient.js +18 -0
- package/dist-cjs/commands/BatchExecuteStatementCommand.js +27 -0
- package/dist-cjs/commands/BatchGetCommand.js +42 -0
- package/dist-cjs/commands/BatchWriteCommand.js +53 -0
- package/dist-cjs/commands/DeleteCommand.js +39 -0
- package/dist-cjs/commands/ExecuteStatementCommand.js +27 -0
- package/dist-cjs/commands/ExecuteTransactionCommand.js +27 -0
- package/dist-cjs/commands/GetCommand.js +27 -0
- package/dist-cjs/commands/PutCommand.js +39 -0
- package/dist-cjs/commands/QueryCommand.js +42 -0
- package/dist-cjs/commands/ScanCommand.js +36 -0
- package/dist-cjs/commands/TransactGetCommand.js +27 -0
- package/dist-cjs/commands/TransactWriteCommand.js +44 -0
- package/dist-cjs/commands/UpdateCommand.js +45 -0
- package/dist-cjs/commands/utils.js +44 -0
- package/dist-cjs/index.js +18 -0
- package/dist-es/DynamoDBDocument.js +208 -0
- package/dist-es/DynamoDBDocumentClient.js +19 -0
- package/dist-es/commands/BatchExecuteStatementCommand.js +33 -0
- package/dist-es/commands/BatchGetCommand.js +48 -0
- package/dist-es/commands/BatchWriteCommand.js +59 -0
- package/dist-es/commands/DeleteCommand.js +45 -0
- package/dist-es/commands/ExecuteStatementCommand.js +33 -0
- package/dist-es/commands/ExecuteTransactionCommand.js +33 -0
- package/dist-es/commands/GetCommand.js +33 -0
- package/dist-es/commands/PutCommand.js +45 -0
- package/dist-es/commands/QueryCommand.js +48 -0
- package/dist-es/commands/ScanCommand.js +42 -0
- package/dist-es/commands/TransactGetCommand.js +33 -0
- package/dist-es/commands/TransactWriteCommand.js +50 -0
- package/dist-es/commands/UpdateCommand.js +51 -0
- package/dist-es/commands/utils.js +46 -0
- package/{dist/types/index.d.ts → dist-es/index.js} +0 -0
- package/{dist/types → dist-types}/DynamoDBDocument.d.ts +3 -3
- package/{dist/types → dist-types}/DynamoDBDocumentClient.d.ts +4 -4
- package/{dist/types → dist-types}/commands/BatchExecuteStatementCommand.d.ts +3 -3
- package/{dist/types → dist-types}/commands/BatchGetCommand.d.ts +3 -3
- package/{dist/types → dist-types}/commands/BatchWriteCommand.d.ts +3 -3
- package/{dist/types → dist-types}/commands/DeleteCommand.d.ts +3 -3
- package/{dist/types → dist-types}/commands/ExecuteStatementCommand.d.ts +2 -2
- package/{dist/types → dist-types}/commands/ExecuteTransactionCommand.d.ts +3 -3
- package/{dist/types → dist-types}/commands/GetCommand.d.ts +2 -2
- package/{dist/types → dist-types}/commands/PutCommand.d.ts +2 -2
- package/{dist/types → dist-types}/commands/QueryCommand.d.ts +2 -2
- package/{dist/types → dist-types}/commands/ScanCommand.d.ts +2 -2
- package/{dist/types → dist-types}/commands/TransactGetCommand.d.ts +2 -2
- package/{dist/types → dist-types}/commands/TransactWriteCommand.d.ts +3 -3
- package/{dist/types → dist-types}/commands/UpdateCommand.d.ts +2 -2
- package/{dist/types → dist-types}/commands/utils.d.ts +0 -0
- package/dist-types/index.d.ts +15 -0
- package/{dist/types → dist-types}/ts3.4/DynamoDBDocument.d.ts +3 -3
- package/{dist/types → dist-types}/ts3.4/DynamoDBDocumentClient.d.ts +4 -4
- package/{dist/types → dist-types}/ts3.4/commands/BatchExecuteStatementCommand.d.ts +3 -3
- package/{dist/types → dist-types}/ts3.4/commands/BatchGetCommand.d.ts +3 -3
- package/{dist/types → dist-types}/ts3.4/commands/BatchWriteCommand.d.ts +3 -3
- package/{dist/types → dist-types}/ts3.4/commands/DeleteCommand.d.ts +3 -3
- package/{dist/types → dist-types}/ts3.4/commands/ExecuteStatementCommand.d.ts +2 -2
- package/{dist/types → dist-types}/ts3.4/commands/ExecuteTransactionCommand.d.ts +3 -3
- package/{dist/types → dist-types}/ts3.4/commands/GetCommand.d.ts +2 -2
- package/{dist/types → dist-types}/ts3.4/commands/PutCommand.d.ts +2 -2
- package/{dist/types → dist-types}/ts3.4/commands/QueryCommand.d.ts +2 -2
- package/{dist/types → dist-types}/ts3.4/commands/ScanCommand.d.ts +2 -2
- package/{dist/types → dist-types}/ts3.4/commands/TransactGetCommand.d.ts +2 -2
- package/{dist/types → dist-types}/ts3.4/commands/TransactWriteCommand.d.ts +3 -3
- package/{dist/types → dist-types}/ts3.4/commands/UpdateCommand.d.ts +2 -2
- package/{dist/types → dist-types}/ts3.4/commands/utils.d.ts +0 -0
- package/{dist/types → dist-types}/ts3.4/index.d.ts +0 -0
- package/package.json +16 -12
- package/dist/cjs/DynamoDBDocument.js +0 -252
- package/dist/cjs/DynamoDBDocumentClient.js +0 -66
- package/dist/cjs/commands/BatchExecuteStatementCommand.js +0 -38
- package/dist/cjs/commands/BatchGetCommand.js +0 -53
- package/dist/cjs/commands/BatchWriteCommand.js +0 -64
- package/dist/cjs/commands/DeleteCommand.js +0 -50
- package/dist/cjs/commands/ExecuteStatementCommand.js +0 -38
- package/dist/cjs/commands/ExecuteTransactionCommand.js +0 -38
- package/dist/cjs/commands/GetCommand.js +0 -38
- package/dist/cjs/commands/PutCommand.js +0 -50
- package/dist/cjs/commands/QueryCommand.js +0 -53
- package/dist/cjs/commands/ScanCommand.js +0 -47
- package/dist/cjs/commands/TransactGetCommand.js +0 -38
- package/dist/cjs/commands/TransactWriteCommand.js +0 -55
- package/dist/cjs/commands/UpdateCommand.js +0 -56
- package/dist/cjs/commands/utils.js +0 -49
- package/dist/cjs/index.js +0 -19
- package/dist/es/DynamoDBDocument.js +0 -255
- package/dist/es/DynamoDBDocumentClient.js +0 -67
- package/dist/es/commands/BatchExecuteStatementCommand.js +0 -44
- package/dist/es/commands/BatchGetCommand.js +0 -59
- package/dist/es/commands/BatchWriteCommand.js +0 -70
- package/dist/es/commands/DeleteCommand.js +0 -56
- package/dist/es/commands/ExecuteStatementCommand.js +0 -44
- package/dist/es/commands/ExecuteTransactionCommand.js +0 -44
- package/dist/es/commands/GetCommand.js +0 -44
- package/dist/es/commands/PutCommand.js +0 -56
- package/dist/es/commands/QueryCommand.js +0 -59
- package/dist/es/commands/ScanCommand.js +0 -53
- package/dist/es/commands/TransactGetCommand.js +0 -44
- package/dist/es/commands/TransactWriteCommand.js +0 -61
- package/dist/es/commands/UpdateCommand.js +0 -62
- package/dist/es/commands/utils.js +0 -51
- package/dist/es/index.js +0 -16
- package/jest.config.js +0 -5
- package/tsconfig.cjs.json +0 -10
- package/tsconfig.es.json +0 -18
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TransactWriteCommand = void 0;
|
|
4
|
+
const client_dynamodb_1 = require("@aws-sdk/client-dynamodb");
|
|
5
|
+
const smithy_client_1 = require("@aws-sdk/smithy-client");
|
|
6
|
+
const utils_1 = require("../commands/utils");
|
|
7
|
+
class TransactWriteCommand extends smithy_client_1.Command {
|
|
8
|
+
constructor(input) {
|
|
9
|
+
super();
|
|
10
|
+
this.input = input;
|
|
11
|
+
this.inputKeyNodes = [
|
|
12
|
+
{
|
|
13
|
+
key: "TransactItems",
|
|
14
|
+
children: [
|
|
15
|
+
{ key: "ConditionCheck", children: [{ key: "Key" }, { key: "ExpressionAttributeValues" }] },
|
|
16
|
+
{ key: "Put", children: [{ key: "Item" }, { key: "ExpressionAttributeValues" }] },
|
|
17
|
+
{ key: "Delete", children: [{ key: "Key" }, { key: "ExpressionAttributeValues" }] },
|
|
18
|
+
{ key: "Update", children: [{ key: "Key" }, { key: "ExpressionAttributeValues" }] },
|
|
19
|
+
],
|
|
20
|
+
},
|
|
21
|
+
];
|
|
22
|
+
this.outputKeyNodes = [
|
|
23
|
+
{
|
|
24
|
+
key: "ItemCollectionMetrics",
|
|
25
|
+
children: {
|
|
26
|
+
children: [{ key: "ItemCollectionKey" }],
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
];
|
|
30
|
+
}
|
|
31
|
+
resolveMiddleware(clientStack, configuration, options) {
|
|
32
|
+
const { marshallOptions, unmarshallOptions } = configuration.translateConfig || {};
|
|
33
|
+
const command = new client_dynamodb_1.TransactWriteItemsCommand(utils_1.marshallInput(this.input, this.inputKeyNodes, marshallOptions));
|
|
34
|
+
const handler = command.resolveMiddleware(clientStack, configuration, options);
|
|
35
|
+
return async () => {
|
|
36
|
+
const data = await handler(command);
|
|
37
|
+
return {
|
|
38
|
+
...data,
|
|
39
|
+
output: utils_1.unmarshallOutput(data.output, this.outputKeyNodes, unmarshallOptions),
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.TransactWriteCommand = TransactWriteCommand;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UpdateCommand = void 0;
|
|
4
|
+
const client_dynamodb_1 = require("@aws-sdk/client-dynamodb");
|
|
5
|
+
const smithy_client_1 = require("@aws-sdk/smithy-client");
|
|
6
|
+
const utils_1 = require("../commands/utils");
|
|
7
|
+
class UpdateCommand extends smithy_client_1.Command {
|
|
8
|
+
constructor(input) {
|
|
9
|
+
super();
|
|
10
|
+
this.input = input;
|
|
11
|
+
this.inputKeyNodes = [
|
|
12
|
+
{ key: "Key" },
|
|
13
|
+
{
|
|
14
|
+
key: "AttributeUpdates",
|
|
15
|
+
children: {
|
|
16
|
+
children: [{ key: "Value" }],
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
key: "Expected",
|
|
21
|
+
children: {
|
|
22
|
+
children: [{ key: "Value" }, { key: "AttributeValueList" }],
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
{ key: "ExpressionAttributeValues" },
|
|
26
|
+
];
|
|
27
|
+
this.outputKeyNodes = [
|
|
28
|
+
{ key: "Attributes" },
|
|
29
|
+
{ key: "ItemCollectionMetrics", children: [{ key: "ItemCollectionKey" }] },
|
|
30
|
+
];
|
|
31
|
+
}
|
|
32
|
+
resolveMiddleware(clientStack, configuration, options) {
|
|
33
|
+
const { marshallOptions, unmarshallOptions } = configuration.translateConfig || {};
|
|
34
|
+
const command = new client_dynamodb_1.UpdateItemCommand(utils_1.marshallInput(this.input, this.inputKeyNodes, marshallOptions));
|
|
35
|
+
const handler = command.resolveMiddleware(clientStack, configuration, options);
|
|
36
|
+
return async () => {
|
|
37
|
+
const data = await handler(command);
|
|
38
|
+
return {
|
|
39
|
+
...data,
|
|
40
|
+
output: utils_1.unmarshallOutput(data.output, this.outputKeyNodes, unmarshallOptions),
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.UpdateCommand = UpdateCommand;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.unmarshallOutput = exports.marshallInput = void 0;
|
|
4
|
+
const util_dynamodb_1 = require("@aws-sdk/util-dynamodb");
|
|
5
|
+
const processObj = (obj, processFunc, children) => {
|
|
6
|
+
if (obj) {
|
|
7
|
+
if (!children || (Array.isArray(children) && children.length === 0)) {
|
|
8
|
+
return processFunc(obj);
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
if (Array.isArray(children)) {
|
|
12
|
+
return processKeysInObj(obj, processFunc, children);
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
return processAllKeysInObj(obj, processFunc, children.children);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return undefined;
|
|
20
|
+
};
|
|
21
|
+
const processKeyInObj = (obj, processFunc, children) => {
|
|
22
|
+
if (Array.isArray(obj)) {
|
|
23
|
+
return obj.map((item) => processObj(item, processFunc, children));
|
|
24
|
+
}
|
|
25
|
+
return processObj(obj, processFunc, children);
|
|
26
|
+
};
|
|
27
|
+
const processKeysInObj = (obj, processFunc, keyNodes) => keyNodes.reduce((acc, { key, children }) => ({
|
|
28
|
+
...acc,
|
|
29
|
+
[key]: processKeyInObj(acc[key], processFunc, children),
|
|
30
|
+
}), obj);
|
|
31
|
+
const processAllKeysInObj = (obj, processFunc, children) => Object.entries(obj).reduce((acc, [key, value]) => ({
|
|
32
|
+
...acc,
|
|
33
|
+
[key]: processKeyInObj(value, processFunc, children),
|
|
34
|
+
}), {});
|
|
35
|
+
const marshallInput = (obj, keyNodes, options) => {
|
|
36
|
+
const marshallFunc = (toMarshall) => util_dynamodb_1.marshall(toMarshall, options);
|
|
37
|
+
return processKeysInObj(obj, marshallFunc, keyNodes);
|
|
38
|
+
};
|
|
39
|
+
exports.marshallInput = marshallInput;
|
|
40
|
+
const unmarshallOutput = (obj, keyNodes, options) => {
|
|
41
|
+
const unmarshallFunc = (toMarshall) => util_dynamodb_1.unmarshall(toMarshall, options);
|
|
42
|
+
return processKeysInObj(obj, unmarshallFunc, keyNodes);
|
|
43
|
+
};
|
|
44
|
+
exports.unmarshallOutput = unmarshallOutput;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./commands/BatchExecuteStatementCommand"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./commands/BatchGetCommand"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./commands/BatchWriteCommand"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./commands/DeleteCommand"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./commands/ExecuteStatementCommand"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./commands/ExecuteTransactionCommand"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./commands/GetCommand"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./commands/PutCommand"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./commands/QueryCommand"), exports);
|
|
13
|
+
tslib_1.__exportStar(require("./commands/ScanCommand"), exports);
|
|
14
|
+
tslib_1.__exportStar(require("./commands/TransactGetCommand"), exports);
|
|
15
|
+
tslib_1.__exportStar(require("./commands/TransactWriteCommand"), exports);
|
|
16
|
+
tslib_1.__exportStar(require("./commands/UpdateCommand"), exports);
|
|
17
|
+
tslib_1.__exportStar(require("./DynamoDBDocumentClient"), exports);
|
|
18
|
+
tslib_1.__exportStar(require("./DynamoDBDocument"), exports);
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { __extends } from "tslib";
|
|
2
|
+
import { BatchExecuteStatementCommand, } from "./commands/BatchExecuteStatementCommand";
|
|
3
|
+
import { BatchGetCommand } from "./commands/BatchGetCommand";
|
|
4
|
+
import { BatchWriteCommand } from "./commands/BatchWriteCommand";
|
|
5
|
+
import { DeleteCommand } from "./commands/DeleteCommand";
|
|
6
|
+
import { ExecuteStatementCommand, } from "./commands/ExecuteStatementCommand";
|
|
7
|
+
import { ExecuteTransactionCommand, } from "./commands/ExecuteTransactionCommand";
|
|
8
|
+
import { GetCommand } from "./commands/GetCommand";
|
|
9
|
+
import { PutCommand } from "./commands/PutCommand";
|
|
10
|
+
import { QueryCommand } from "./commands/QueryCommand";
|
|
11
|
+
import { ScanCommand } from "./commands/ScanCommand";
|
|
12
|
+
import { TransactGetCommand } from "./commands/TransactGetCommand";
|
|
13
|
+
import { TransactWriteCommand, } from "./commands/TransactWriteCommand";
|
|
14
|
+
import { UpdateCommand } from "./commands/UpdateCommand";
|
|
15
|
+
import { DynamoDBDocumentClient } from "./DynamoDBDocumentClient";
|
|
16
|
+
var DynamoDBDocument = (function (_super) {
|
|
17
|
+
__extends(DynamoDBDocument, _super);
|
|
18
|
+
function DynamoDBDocument() {
|
|
19
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
20
|
+
}
|
|
21
|
+
DynamoDBDocument.from = function (client, translateConfig) {
|
|
22
|
+
return new DynamoDBDocument(client, translateConfig);
|
|
23
|
+
};
|
|
24
|
+
DynamoDBDocument.prototype.batchExecuteStatement = function (args, optionsOrCb, cb) {
|
|
25
|
+
var command = new BatchExecuteStatementCommand(args);
|
|
26
|
+
if (typeof optionsOrCb === "function") {
|
|
27
|
+
this.send(command, optionsOrCb);
|
|
28
|
+
}
|
|
29
|
+
else if (typeof cb === "function") {
|
|
30
|
+
if (typeof optionsOrCb !== "object")
|
|
31
|
+
throw new Error("Expect http options but get " + typeof optionsOrCb);
|
|
32
|
+
this.send(command, optionsOrCb || {}, cb);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
return this.send(command, optionsOrCb);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
DynamoDBDocument.prototype.batchGet = function (args, optionsOrCb, cb) {
|
|
39
|
+
var command = new BatchGetCommand(args);
|
|
40
|
+
if (typeof optionsOrCb === "function") {
|
|
41
|
+
this.send(command, optionsOrCb);
|
|
42
|
+
}
|
|
43
|
+
else if (typeof cb === "function") {
|
|
44
|
+
if (typeof optionsOrCb !== "object")
|
|
45
|
+
throw new Error("Expect http options but get " + typeof optionsOrCb);
|
|
46
|
+
this.send(command, optionsOrCb || {}, cb);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
return this.send(command, optionsOrCb);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
DynamoDBDocument.prototype.batchWrite = function (args, optionsOrCb, cb) {
|
|
53
|
+
var command = new BatchWriteCommand(args);
|
|
54
|
+
if (typeof optionsOrCb === "function") {
|
|
55
|
+
this.send(command, optionsOrCb);
|
|
56
|
+
}
|
|
57
|
+
else if (typeof cb === "function") {
|
|
58
|
+
if (typeof optionsOrCb !== "object")
|
|
59
|
+
throw new Error("Expect http options but get " + typeof optionsOrCb);
|
|
60
|
+
this.send(command, optionsOrCb || {}, cb);
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
return this.send(command, optionsOrCb);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
DynamoDBDocument.prototype.delete = function (args, optionsOrCb, cb) {
|
|
67
|
+
var command = new DeleteCommand(args);
|
|
68
|
+
if (typeof optionsOrCb === "function") {
|
|
69
|
+
this.send(command, optionsOrCb);
|
|
70
|
+
}
|
|
71
|
+
else if (typeof cb === "function") {
|
|
72
|
+
if (typeof optionsOrCb !== "object")
|
|
73
|
+
throw new Error("Expect http options but get " + typeof optionsOrCb);
|
|
74
|
+
this.send(command, optionsOrCb || {}, cb);
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
return this.send(command, optionsOrCb);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
DynamoDBDocument.prototype.executeStatement = function (args, optionsOrCb, cb) {
|
|
81
|
+
var command = new ExecuteStatementCommand(args);
|
|
82
|
+
if (typeof optionsOrCb === "function") {
|
|
83
|
+
this.send(command, optionsOrCb);
|
|
84
|
+
}
|
|
85
|
+
else if (typeof cb === "function") {
|
|
86
|
+
if (typeof optionsOrCb !== "object")
|
|
87
|
+
throw new Error("Expect http options but get " + typeof optionsOrCb);
|
|
88
|
+
this.send(command, optionsOrCb || {}, cb);
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
return this.send(command, optionsOrCb);
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
DynamoDBDocument.prototype.executeTransaction = function (args, optionsOrCb, cb) {
|
|
95
|
+
var command = new ExecuteTransactionCommand(args);
|
|
96
|
+
if (typeof optionsOrCb === "function") {
|
|
97
|
+
this.send(command, optionsOrCb);
|
|
98
|
+
}
|
|
99
|
+
else if (typeof cb === "function") {
|
|
100
|
+
if (typeof optionsOrCb !== "object")
|
|
101
|
+
throw new Error("Expect http options but get " + typeof optionsOrCb);
|
|
102
|
+
this.send(command, optionsOrCb || {}, cb);
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
return this.send(command, optionsOrCb);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
DynamoDBDocument.prototype.get = function (args, optionsOrCb, cb) {
|
|
109
|
+
var command = new GetCommand(args);
|
|
110
|
+
if (typeof optionsOrCb === "function") {
|
|
111
|
+
this.send(command, optionsOrCb);
|
|
112
|
+
}
|
|
113
|
+
else if (typeof cb === "function") {
|
|
114
|
+
if (typeof optionsOrCb !== "object")
|
|
115
|
+
throw new Error("Expect http options but get " + typeof optionsOrCb);
|
|
116
|
+
this.send(command, optionsOrCb || {}, cb);
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
return this.send(command, optionsOrCb);
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
DynamoDBDocument.prototype.put = function (args, optionsOrCb, cb) {
|
|
123
|
+
var command = new PutCommand(args);
|
|
124
|
+
if (typeof optionsOrCb === "function") {
|
|
125
|
+
this.send(command, optionsOrCb);
|
|
126
|
+
}
|
|
127
|
+
else if (typeof cb === "function") {
|
|
128
|
+
if (typeof optionsOrCb !== "object")
|
|
129
|
+
throw new Error("Expect http options but get " + typeof optionsOrCb);
|
|
130
|
+
this.send(command, optionsOrCb || {}, cb);
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
return this.send(command, optionsOrCb);
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
DynamoDBDocument.prototype.query = function (args, optionsOrCb, cb) {
|
|
137
|
+
var command = new QueryCommand(args);
|
|
138
|
+
if (typeof optionsOrCb === "function") {
|
|
139
|
+
this.send(command, optionsOrCb);
|
|
140
|
+
}
|
|
141
|
+
else if (typeof cb === "function") {
|
|
142
|
+
if (typeof optionsOrCb !== "object")
|
|
143
|
+
throw new Error("Expect http options but get " + typeof optionsOrCb);
|
|
144
|
+
this.send(command, optionsOrCb || {}, cb);
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
return this.send(command, optionsOrCb);
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
DynamoDBDocument.prototype.scan = function (args, optionsOrCb, cb) {
|
|
151
|
+
var command = new ScanCommand(args);
|
|
152
|
+
if (typeof optionsOrCb === "function") {
|
|
153
|
+
this.send(command, optionsOrCb);
|
|
154
|
+
}
|
|
155
|
+
else if (typeof cb === "function") {
|
|
156
|
+
if (typeof optionsOrCb !== "object")
|
|
157
|
+
throw new Error("Expect http options but get " + typeof optionsOrCb);
|
|
158
|
+
this.send(command, optionsOrCb || {}, cb);
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
return this.send(command, optionsOrCb);
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
DynamoDBDocument.prototype.transactGet = function (args, optionsOrCb, cb) {
|
|
165
|
+
var command = new TransactGetCommand(args);
|
|
166
|
+
if (typeof optionsOrCb === "function") {
|
|
167
|
+
this.send(command, optionsOrCb);
|
|
168
|
+
}
|
|
169
|
+
else if (typeof cb === "function") {
|
|
170
|
+
if (typeof optionsOrCb !== "object")
|
|
171
|
+
throw new Error("Expect http options but get " + typeof optionsOrCb);
|
|
172
|
+
this.send(command, optionsOrCb || {}, cb);
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
return this.send(command, optionsOrCb);
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
DynamoDBDocument.prototype.transactWrite = function (args, optionsOrCb, cb) {
|
|
179
|
+
var command = new TransactWriteCommand(args);
|
|
180
|
+
if (typeof optionsOrCb === "function") {
|
|
181
|
+
this.send(command, optionsOrCb);
|
|
182
|
+
}
|
|
183
|
+
else if (typeof cb === "function") {
|
|
184
|
+
if (typeof optionsOrCb !== "object")
|
|
185
|
+
throw new Error("Expect http options but get " + typeof optionsOrCb);
|
|
186
|
+
this.send(command, optionsOrCb || {}, cb);
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
return this.send(command, optionsOrCb);
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
DynamoDBDocument.prototype.update = function (args, optionsOrCb, cb) {
|
|
193
|
+
var command = new UpdateCommand(args);
|
|
194
|
+
if (typeof optionsOrCb === "function") {
|
|
195
|
+
this.send(command, optionsOrCb);
|
|
196
|
+
}
|
|
197
|
+
else if (typeof cb === "function") {
|
|
198
|
+
if (typeof optionsOrCb !== "object")
|
|
199
|
+
throw new Error("Expect http options but get " + typeof optionsOrCb);
|
|
200
|
+
this.send(command, optionsOrCb || {}, cb);
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
return this.send(command, optionsOrCb);
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
return DynamoDBDocument;
|
|
207
|
+
}(DynamoDBDocumentClient));
|
|
208
|
+
export { DynamoDBDocument };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { __extends } from "tslib";
|
|
2
|
+
import { Client as __Client } from "@aws-sdk/smithy-client";
|
|
3
|
+
var DynamoDBDocumentClient = (function (_super) {
|
|
4
|
+
__extends(DynamoDBDocumentClient, _super);
|
|
5
|
+
function DynamoDBDocumentClient(client, translateConfig) {
|
|
6
|
+
var _this = _super.call(this, client.config) || this;
|
|
7
|
+
_this.config = client.config;
|
|
8
|
+
_this.config.translateConfig = translateConfig;
|
|
9
|
+
_this.middlewareStack = client.middlewareStack;
|
|
10
|
+
return _this;
|
|
11
|
+
}
|
|
12
|
+
DynamoDBDocumentClient.from = function (client, translateConfig) {
|
|
13
|
+
return new DynamoDBDocumentClient(client, translateConfig);
|
|
14
|
+
};
|
|
15
|
+
DynamoDBDocumentClient.prototype.destroy = function () {
|
|
16
|
+
};
|
|
17
|
+
return DynamoDBDocumentClient;
|
|
18
|
+
}(__Client));
|
|
19
|
+
export { DynamoDBDocumentClient };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { __assign, __awaiter, __extends, __generator } from "tslib";
|
|
2
|
+
import { BatchExecuteStatementCommand as __BatchExecuteStatementCommand, } from "@aws-sdk/client-dynamodb";
|
|
3
|
+
import { Command as $Command } from "@aws-sdk/smithy-client";
|
|
4
|
+
import { marshallInput, unmarshallOutput } from "../commands/utils";
|
|
5
|
+
var BatchExecuteStatementCommand = (function (_super) {
|
|
6
|
+
__extends(BatchExecuteStatementCommand, _super);
|
|
7
|
+
function BatchExecuteStatementCommand(input) {
|
|
8
|
+
var _this = _super.call(this) || this;
|
|
9
|
+
_this.input = input;
|
|
10
|
+
_this.inputKeyNodes = [{ key: "Statements", children: [{ key: "Parameters" }] }];
|
|
11
|
+
_this.outputKeyNodes = [{ key: "Responses", children: [{ key: "Item" }] }];
|
|
12
|
+
return _this;
|
|
13
|
+
}
|
|
14
|
+
BatchExecuteStatementCommand.prototype.resolveMiddleware = function (clientStack, configuration, options) {
|
|
15
|
+
var _this = this;
|
|
16
|
+
var _a = configuration.translateConfig || {}, marshallOptions = _a.marshallOptions, unmarshallOptions = _a.unmarshallOptions;
|
|
17
|
+
var command = new __BatchExecuteStatementCommand(marshallInput(this.input, this.inputKeyNodes, marshallOptions));
|
|
18
|
+
var handler = command.resolveMiddleware(clientStack, configuration, options);
|
|
19
|
+
return function () { return __awaiter(_this, void 0, void 0, function () {
|
|
20
|
+
var data;
|
|
21
|
+
return __generator(this, function (_a) {
|
|
22
|
+
switch (_a.label) {
|
|
23
|
+
case 0: return [4, handler(command)];
|
|
24
|
+
case 1:
|
|
25
|
+
data = _a.sent();
|
|
26
|
+
return [2, __assign(__assign({}, data), { output: unmarshallOutput(data.output, this.outputKeyNodes, unmarshallOptions) })];
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}); };
|
|
30
|
+
};
|
|
31
|
+
return BatchExecuteStatementCommand;
|
|
32
|
+
}($Command));
|
|
33
|
+
export { BatchExecuteStatementCommand };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { __assign, __awaiter, __extends, __generator } from "tslib";
|
|
2
|
+
import { BatchGetItemCommand as __BatchGetItemCommand, } from "@aws-sdk/client-dynamodb";
|
|
3
|
+
import { Command as $Command } from "@aws-sdk/smithy-client";
|
|
4
|
+
import { marshallInput, unmarshallOutput } from "../commands/utils";
|
|
5
|
+
var BatchGetCommand = (function (_super) {
|
|
6
|
+
__extends(BatchGetCommand, _super);
|
|
7
|
+
function BatchGetCommand(input) {
|
|
8
|
+
var _this = _super.call(this) || this;
|
|
9
|
+
_this.input = input;
|
|
10
|
+
_this.inputKeyNodes = [
|
|
11
|
+
{
|
|
12
|
+
key: "RequestItems",
|
|
13
|
+
children: {
|
|
14
|
+
children: [{ key: "Keys" }],
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
];
|
|
18
|
+
_this.outputKeyNodes = [
|
|
19
|
+
{ key: "Responses", children: {} },
|
|
20
|
+
{
|
|
21
|
+
key: "UnprocessedKeys",
|
|
22
|
+
children: {
|
|
23
|
+
children: [{ key: "Keys" }],
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
];
|
|
27
|
+
return _this;
|
|
28
|
+
}
|
|
29
|
+
BatchGetCommand.prototype.resolveMiddleware = function (clientStack, configuration, options) {
|
|
30
|
+
var _this = this;
|
|
31
|
+
var _a = configuration.translateConfig || {}, marshallOptions = _a.marshallOptions, unmarshallOptions = _a.unmarshallOptions;
|
|
32
|
+
var command = new __BatchGetItemCommand(marshallInput(this.input, this.inputKeyNodes, marshallOptions));
|
|
33
|
+
var handler = command.resolveMiddleware(clientStack, configuration, options);
|
|
34
|
+
return function () { return __awaiter(_this, void 0, void 0, function () {
|
|
35
|
+
var data;
|
|
36
|
+
return __generator(this, function (_a) {
|
|
37
|
+
switch (_a.label) {
|
|
38
|
+
case 0: return [4, handler(command)];
|
|
39
|
+
case 1:
|
|
40
|
+
data = _a.sent();
|
|
41
|
+
return [2, __assign(__assign({}, data), { output: unmarshallOutput(data.output, this.outputKeyNodes, unmarshallOptions) })];
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}); };
|
|
45
|
+
};
|
|
46
|
+
return BatchGetCommand;
|
|
47
|
+
}($Command));
|
|
48
|
+
export { BatchGetCommand };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { __assign, __awaiter, __extends, __generator } from "tslib";
|
|
2
|
+
import { BatchWriteItemCommand as __BatchWriteItemCommand, } from "@aws-sdk/client-dynamodb";
|
|
3
|
+
import { Command as $Command } from "@aws-sdk/smithy-client";
|
|
4
|
+
import { marshallInput, unmarshallOutput } from "../commands/utils";
|
|
5
|
+
var BatchWriteCommand = (function (_super) {
|
|
6
|
+
__extends(BatchWriteCommand, _super);
|
|
7
|
+
function BatchWriteCommand(input) {
|
|
8
|
+
var _this = _super.call(this) || this;
|
|
9
|
+
_this.input = input;
|
|
10
|
+
_this.inputKeyNodes = [
|
|
11
|
+
{
|
|
12
|
+
key: "RequestItems",
|
|
13
|
+
children: {
|
|
14
|
+
children: [
|
|
15
|
+
{ key: "PutRequest", children: [{ key: "Item" }] },
|
|
16
|
+
{ key: "DeleteRequest", children: [{ key: "Key" }] },
|
|
17
|
+
],
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
];
|
|
21
|
+
_this.outputKeyNodes = [
|
|
22
|
+
{
|
|
23
|
+
key: "UnprocessedItems",
|
|
24
|
+
children: {
|
|
25
|
+
children: [
|
|
26
|
+
{ key: "PutRequest", children: [{ key: "Item" }] },
|
|
27
|
+
{ key: "DeleteRequest", children: [{ key: "Key" }] },
|
|
28
|
+
],
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
key: "ItemCollectionMetrics",
|
|
33
|
+
children: {
|
|
34
|
+
children: [{ key: "ItemCollectionKey" }],
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
];
|
|
38
|
+
return _this;
|
|
39
|
+
}
|
|
40
|
+
BatchWriteCommand.prototype.resolveMiddleware = function (clientStack, configuration, options) {
|
|
41
|
+
var _this = this;
|
|
42
|
+
var _a = configuration.translateConfig || {}, marshallOptions = _a.marshallOptions, unmarshallOptions = _a.unmarshallOptions;
|
|
43
|
+
var command = new __BatchWriteItemCommand(marshallInput(this.input, this.inputKeyNodes, marshallOptions));
|
|
44
|
+
var handler = command.resolveMiddleware(clientStack, configuration, options);
|
|
45
|
+
return function () { return __awaiter(_this, void 0, void 0, function () {
|
|
46
|
+
var data;
|
|
47
|
+
return __generator(this, function (_a) {
|
|
48
|
+
switch (_a.label) {
|
|
49
|
+
case 0: return [4, handler(command)];
|
|
50
|
+
case 1:
|
|
51
|
+
data = _a.sent();
|
|
52
|
+
return [2, __assign(__assign({}, data), { output: unmarshallOutput(data.output, this.outputKeyNodes, unmarshallOptions) })];
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}); };
|
|
56
|
+
};
|
|
57
|
+
return BatchWriteCommand;
|
|
58
|
+
}($Command));
|
|
59
|
+
export { BatchWriteCommand };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { __assign, __awaiter, __extends, __generator } from "tslib";
|
|
2
|
+
import { DeleteItemCommand as __DeleteItemCommand, } from "@aws-sdk/client-dynamodb";
|
|
3
|
+
import { Command as $Command } from "@aws-sdk/smithy-client";
|
|
4
|
+
import { marshallInput, unmarshallOutput } from "../commands/utils";
|
|
5
|
+
var DeleteCommand = (function (_super) {
|
|
6
|
+
__extends(DeleteCommand, _super);
|
|
7
|
+
function DeleteCommand(input) {
|
|
8
|
+
var _this = _super.call(this) || this;
|
|
9
|
+
_this.input = input;
|
|
10
|
+
_this.inputKeyNodes = [
|
|
11
|
+
{ key: "Key" },
|
|
12
|
+
{
|
|
13
|
+
key: "Expected",
|
|
14
|
+
children: {
|
|
15
|
+
children: [{ key: "Value" }, { key: "AttributeValueList" }],
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
{ key: "ExpressionAttributeValues" },
|
|
19
|
+
];
|
|
20
|
+
_this.outputKeyNodes = [
|
|
21
|
+
{ key: "Attributes" },
|
|
22
|
+
{ key: "ItemCollectionMetrics", children: [{ key: "ItemCollectionKey" }] },
|
|
23
|
+
];
|
|
24
|
+
return _this;
|
|
25
|
+
}
|
|
26
|
+
DeleteCommand.prototype.resolveMiddleware = function (clientStack, configuration, options) {
|
|
27
|
+
var _this = this;
|
|
28
|
+
var _a = configuration.translateConfig || {}, marshallOptions = _a.marshallOptions, unmarshallOptions = _a.unmarshallOptions;
|
|
29
|
+
var command = new __DeleteItemCommand(marshallInput(this.input, this.inputKeyNodes, marshallOptions));
|
|
30
|
+
var handler = command.resolveMiddleware(clientStack, configuration, options);
|
|
31
|
+
return function () { return __awaiter(_this, void 0, void 0, function () {
|
|
32
|
+
var data;
|
|
33
|
+
return __generator(this, function (_a) {
|
|
34
|
+
switch (_a.label) {
|
|
35
|
+
case 0: return [4, handler(command)];
|
|
36
|
+
case 1:
|
|
37
|
+
data = _a.sent();
|
|
38
|
+
return [2, __assign(__assign({}, data), { output: unmarshallOutput(data.output, this.outputKeyNodes, unmarshallOptions) })];
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}); };
|
|
42
|
+
};
|
|
43
|
+
return DeleteCommand;
|
|
44
|
+
}($Command));
|
|
45
|
+
export { DeleteCommand };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { __assign, __awaiter, __extends, __generator } from "tslib";
|
|
2
|
+
import { ExecuteStatementCommand as __ExecuteStatementCommand, } from "@aws-sdk/client-dynamodb";
|
|
3
|
+
import { Command as $Command } from "@aws-sdk/smithy-client";
|
|
4
|
+
import { marshallInput, unmarshallOutput } from "../commands/utils";
|
|
5
|
+
var ExecuteStatementCommand = (function (_super) {
|
|
6
|
+
__extends(ExecuteStatementCommand, _super);
|
|
7
|
+
function ExecuteStatementCommand(input) {
|
|
8
|
+
var _this = _super.call(this) || this;
|
|
9
|
+
_this.input = input;
|
|
10
|
+
_this.inputKeyNodes = [{ key: "Parameters" }];
|
|
11
|
+
_this.outputKeyNodes = [{ key: "Items" }];
|
|
12
|
+
return _this;
|
|
13
|
+
}
|
|
14
|
+
ExecuteStatementCommand.prototype.resolveMiddleware = function (clientStack, configuration, options) {
|
|
15
|
+
var _this = this;
|
|
16
|
+
var _a = configuration.translateConfig || {}, marshallOptions = _a.marshallOptions, unmarshallOptions = _a.unmarshallOptions;
|
|
17
|
+
var command = new __ExecuteStatementCommand(marshallInput(this.input, this.inputKeyNodes, marshallOptions));
|
|
18
|
+
var handler = command.resolveMiddleware(clientStack, configuration, options);
|
|
19
|
+
return function () { return __awaiter(_this, void 0, void 0, function () {
|
|
20
|
+
var data;
|
|
21
|
+
return __generator(this, function (_a) {
|
|
22
|
+
switch (_a.label) {
|
|
23
|
+
case 0: return [4, handler(command)];
|
|
24
|
+
case 1:
|
|
25
|
+
data = _a.sent();
|
|
26
|
+
return [2, __assign(__assign({}, data), { output: unmarshallOutput(data.output, this.outputKeyNodes, unmarshallOptions) })];
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}); };
|
|
30
|
+
};
|
|
31
|
+
return ExecuteStatementCommand;
|
|
32
|
+
}($Command));
|
|
33
|
+
export { ExecuteStatementCommand };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { __assign, __awaiter, __extends, __generator } from "tslib";
|
|
2
|
+
import { ExecuteTransactionCommand as __ExecuteTransactionCommand, } from "@aws-sdk/client-dynamodb";
|
|
3
|
+
import { Command as $Command } from "@aws-sdk/smithy-client";
|
|
4
|
+
import { marshallInput, unmarshallOutput } from "../commands/utils";
|
|
5
|
+
var ExecuteTransactionCommand = (function (_super) {
|
|
6
|
+
__extends(ExecuteTransactionCommand, _super);
|
|
7
|
+
function ExecuteTransactionCommand(input) {
|
|
8
|
+
var _this = _super.call(this) || this;
|
|
9
|
+
_this.input = input;
|
|
10
|
+
_this.inputKeyNodes = [{ key: "TransactStatements", children: [{ key: "Parameters" }] }];
|
|
11
|
+
_this.outputKeyNodes = [{ key: "Responses", children: [{ key: "Item" }] }];
|
|
12
|
+
return _this;
|
|
13
|
+
}
|
|
14
|
+
ExecuteTransactionCommand.prototype.resolveMiddleware = function (clientStack, configuration, options) {
|
|
15
|
+
var _this = this;
|
|
16
|
+
var _a = configuration.translateConfig || {}, marshallOptions = _a.marshallOptions, unmarshallOptions = _a.unmarshallOptions;
|
|
17
|
+
var command = new __ExecuteTransactionCommand(marshallInput(this.input, this.inputKeyNodes, marshallOptions));
|
|
18
|
+
var handler = command.resolveMiddleware(clientStack, configuration, options);
|
|
19
|
+
return function () { return __awaiter(_this, void 0, void 0, function () {
|
|
20
|
+
var data;
|
|
21
|
+
return __generator(this, function (_a) {
|
|
22
|
+
switch (_a.label) {
|
|
23
|
+
case 0: return [4, handler(command)];
|
|
24
|
+
case 1:
|
|
25
|
+
data = _a.sent();
|
|
26
|
+
return [2, __assign(__assign({}, data), { output: unmarshallOutput(data.output, this.outputKeyNodes, unmarshallOptions) })];
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}); };
|
|
30
|
+
};
|
|
31
|
+
return ExecuteTransactionCommand;
|
|
32
|
+
}($Command));
|
|
33
|
+
export { ExecuteTransactionCommand };
|