@aws-sdk/lib-dynamodb 3.425.0 → 3.428.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.
Files changed (61) hide show
  1. package/dist-cjs/baseCommand/DynamoDBDocumentClientCommand.js +4 -1
  2. package/dist-cjs/commands/BatchExecuteStatementCommand.js +18 -4
  3. package/dist-cjs/commands/BatchGetCommand.js +20 -13
  4. package/dist-cjs/commands/BatchWriteCommand.js +30 -22
  5. package/dist-cjs/commands/DeleteCommand.js +15 -12
  6. package/dist-cjs/commands/ExecuteStatementCommand.js +10 -2
  7. package/dist-cjs/commands/ExecuteTransactionCommand.js +15 -2
  8. package/dist-cjs/commands/GetCommand.js +7 -2
  9. package/dist-cjs/commands/PutCommand.js +15 -12
  10. package/dist-cjs/commands/QueryCommand.js +17 -13
  11. package/dist-cjs/commands/ScanCommand.js +14 -9
  12. package/dist-cjs/commands/TransactGetCommand.js +17 -2
  13. package/dist-cjs/commands/TransactWriteCommand.js +29 -16
  14. package/dist-cjs/commands/UpdateCommand.js +18 -16
  15. package/dist-cjs/commands/utils.js +41 -19
  16. package/dist-es/baseCommand/DynamoDBDocumentClientCommand.js +3 -1
  17. package/dist-es/commands/BatchExecuteStatementCommand.js +18 -4
  18. package/dist-es/commands/BatchGetCommand.js +20 -13
  19. package/dist-es/commands/BatchWriteCommand.js +30 -22
  20. package/dist-es/commands/DeleteCommand.js +15 -12
  21. package/dist-es/commands/ExecuteStatementCommand.js +10 -2
  22. package/dist-es/commands/ExecuteTransactionCommand.js +15 -2
  23. package/dist-es/commands/GetCommand.js +7 -2
  24. package/dist-es/commands/PutCommand.js +15 -12
  25. package/dist-es/commands/QueryCommand.js +17 -13
  26. package/dist-es/commands/ScanCommand.js +14 -9
  27. package/dist-es/commands/TransactGetCommand.js +17 -2
  28. package/dist-es/commands/TransactWriteCommand.js +29 -16
  29. package/dist-es/commands/UpdateCommand.js +18 -16
  30. package/dist-es/commands/utils.js +40 -18
  31. package/dist-types/baseCommand/DynamoDBDocumentClientCommand.d.ts +3 -3
  32. package/dist-types/commands/BatchExecuteStatementCommand.d.ts +15 -16
  33. package/dist-types/commands/BatchGetCommand.d.ts +19 -17
  34. package/dist-types/commands/BatchWriteCommand.d.ts +31 -25
  35. package/dist-types/commands/DeleteCommand.d.ts +15 -19
  36. package/dist-types/commands/ExecuteStatementCommand.d.ts +7 -4
  37. package/dist-types/commands/ExecuteTransactionCommand.d.ts +12 -10
  38. package/dist-types/commands/GetCommand.d.ts +4 -4
  39. package/dist-types/commands/PutCommand.d.ts +15 -19
  40. package/dist-types/commands/QueryCommand.d.ts +18 -12
  41. package/dist-types/commands/ScanCommand.d.ts +13 -12
  42. package/dist-types/commands/TransactGetCommand.d.ts +14 -13
  43. package/dist-types/commands/TransactWriteCommand.d.ts +28 -14
  44. package/dist-types/commands/UpdateCommand.d.ts +20 -19
  45. package/dist-types/commands/utils.d.ts +32 -9
  46. package/dist-types/ts3.4/baseCommand/DynamoDBDocumentClientCommand.d.ts +3 -3
  47. package/dist-types/ts3.4/commands/BatchExecuteStatementCommand.d.ts +15 -19
  48. package/dist-types/ts3.4/commands/BatchGetCommand.d.ts +20 -21
  49. package/dist-types/ts3.4/commands/BatchWriteCommand.d.ts +31 -28
  50. package/dist-types/ts3.4/commands/DeleteCommand.d.ts +16 -26
  51. package/dist-types/ts3.4/commands/ExecuteStatementCommand.d.ts +7 -4
  52. package/dist-types/ts3.4/commands/ExecuteTransactionCommand.d.ts +12 -10
  53. package/dist-types/ts3.4/commands/GetCommand.d.ts +4 -4
  54. package/dist-types/ts3.4/commands/PutCommand.d.ts +16 -26
  55. package/dist-types/ts3.4/commands/QueryCommand.d.ts +19 -16
  56. package/dist-types/ts3.4/commands/ScanCommand.d.ts +14 -16
  57. package/dist-types/ts3.4/commands/TransactGetCommand.d.ts +14 -13
  58. package/dist-types/ts3.4/commands/TransactWriteCommand.d.ts +28 -14
  59. package/dist-types/ts3.4/commands/UpdateCommand.d.ts +21 -26
  60. package/dist-types/ts3.4/commands/utils.d.ts +8 -9
  61. package/package.json +7 -6
@@ -5,7 +5,10 @@ const smithy_client_1 = require("@smithy/smithy-client");
5
5
  const utils_1 = require("../commands/utils");
6
6
  class DynamoDBDocumentClientCommand extends smithy_client_1.Command {
7
7
  addMarshallingMiddleware(configuration) {
8
- const { marshallOptions, unmarshallOptions } = configuration.translateConfig || {};
8
+ var _a, _b;
9
+ const { marshallOptions = {}, unmarshallOptions = {} } = configuration.translateConfig || {};
10
+ marshallOptions.convertTopLevelContainer = (_a = marshallOptions.convertTopLevelContainer) !== null && _a !== void 0 ? _a : true;
11
+ unmarshallOptions.convertWithoutMapWrapper = (_b = unmarshallOptions.convertWithoutMapWrapper) !== null && _b !== void 0 ? _b : true;
9
12
  this.clientCommand.middlewareStack.addRelativeTo((next, context) => async (args) => {
10
13
  args.input = (0, utils_1.marshallInput)(this.input, this.inputKeyNodes, marshallOptions);
11
14
  context.dynamoDbDocumentClientOptions =
@@ -6,14 +6,28 @@ const smithy_client_1 = require("@smithy/smithy-client");
6
6
  Object.defineProperty(exports, "$Command", { enumerable: true, get: function () { return smithy_client_1.Command; } });
7
7
  const DynamoDBDocumentClientCommand_1 = require("../baseCommand/DynamoDBDocumentClientCommand");
8
8
  Object.defineProperty(exports, "DynamoDBDocumentClientCommand", { enumerable: true, get: function () { return DynamoDBDocumentClientCommand_1.DynamoDBDocumentClientCommand; } });
9
+ const utils_1 = require("../commands/utils");
9
10
  class BatchExecuteStatementCommand extends DynamoDBDocumentClientCommand_1.DynamoDBDocumentClientCommand {
10
11
  constructor(input) {
11
12
  super();
12
13
  this.input = input;
13
- this.inputKeyNodes = [{ key: "Statements", children: [{ key: "Parameters" }] }];
14
- this.outputKeyNodes = [
15
- { key: "Responses", children: [{ key: "Error", children: [{ key: "Item" }] }, { key: "Item" }] },
16
- ];
14
+ this.inputKeyNodes = {
15
+ Statements: {
16
+ "*": {
17
+ Parameters: utils_1.ALL_MEMBERS,
18
+ },
19
+ },
20
+ };
21
+ this.outputKeyNodes = {
22
+ Responses: {
23
+ "*": {
24
+ Error: {
25
+ Item: utils_1.ALL_VALUES,
26
+ },
27
+ Item: utils_1.ALL_VALUES,
28
+ },
29
+ },
30
+ };
17
31
  this.clientCommand = new client_dynamodb_1.BatchExecuteStatementCommand(this.input);
18
32
  this.middlewareStack = this.clientCommand.middlewareStack;
19
33
  }
@@ -6,27 +6,34 @@ const smithy_client_1 = require("@smithy/smithy-client");
6
6
  Object.defineProperty(exports, "$Command", { enumerable: true, get: function () { return smithy_client_1.Command; } });
7
7
  const DynamoDBDocumentClientCommand_1 = require("../baseCommand/DynamoDBDocumentClientCommand");
8
8
  Object.defineProperty(exports, "DynamoDBDocumentClientCommand", { enumerable: true, get: function () { return DynamoDBDocumentClientCommand_1.DynamoDBDocumentClientCommand; } });
9
+ const utils_1 = require("../commands/utils");
9
10
  class BatchGetCommand extends DynamoDBDocumentClientCommand_1.DynamoDBDocumentClientCommand {
10
11
  constructor(input) {
11
12
  super();
12
13
  this.input = input;
13
- this.inputKeyNodes = [
14
- {
15
- key: "RequestItems",
16
- children: {
17
- children: [{ key: "Keys" }],
14
+ this.inputKeyNodes = {
15
+ RequestItems: {
16
+ "*": {
17
+ Keys: {
18
+ "*": utils_1.ALL_VALUES,
19
+ },
18
20
  },
19
21
  },
20
- ];
21
- this.outputKeyNodes = [
22
- { key: "Responses", children: {} },
23
- {
24
- key: "UnprocessedKeys",
25
- children: {
26
- children: [{ key: "Keys" }],
22
+ };
23
+ this.outputKeyNodes = {
24
+ Responses: {
25
+ "*": {
26
+ "*": utils_1.ALL_VALUES,
27
27
  },
28
28
  },
29
- ];
29
+ UnprocessedKeys: {
30
+ "*": {
31
+ Keys: {
32
+ "*": utils_1.ALL_VALUES,
33
+ },
34
+ },
35
+ },
36
+ };
30
37
  this.clientCommand = new client_dynamodb_1.BatchGetItemCommand(this.input);
31
38
  this.middlewareStack = this.clientCommand.middlewareStack;
32
39
  }
@@ -6,38 +6,46 @@ const smithy_client_1 = require("@smithy/smithy-client");
6
6
  Object.defineProperty(exports, "$Command", { enumerable: true, get: function () { return smithy_client_1.Command; } });
7
7
  const DynamoDBDocumentClientCommand_1 = require("../baseCommand/DynamoDBDocumentClientCommand");
8
8
  Object.defineProperty(exports, "DynamoDBDocumentClientCommand", { enumerable: true, get: function () { return DynamoDBDocumentClientCommand_1.DynamoDBDocumentClientCommand; } });
9
+ const utils_1 = require("../commands/utils");
9
10
  class BatchWriteCommand extends DynamoDBDocumentClientCommand_1.DynamoDBDocumentClientCommand {
10
11
  constructor(input) {
11
12
  super();
12
13
  this.input = input;
13
- this.inputKeyNodes = [
14
- {
15
- key: "RequestItems",
16
- children: {
17
- children: [
18
- { key: "PutRequest", children: [{ key: "Item" }] },
19
- { key: "DeleteRequest", children: [{ key: "Key" }] },
20
- ],
14
+ this.inputKeyNodes = {
15
+ RequestItems: {
16
+ "*": {
17
+ "*": {
18
+ PutRequest: {
19
+ Item: utils_1.ALL_VALUES,
20
+ },
21
+ DeleteRequest: {
22
+ Key: utils_1.ALL_VALUES,
23
+ },
24
+ },
21
25
  },
22
26
  },
23
- ];
24
- this.outputKeyNodes = [
25
- {
26
- key: "UnprocessedItems",
27
- children: {
28
- children: [
29
- { key: "PutRequest", children: [{ key: "Item" }] },
30
- { key: "DeleteRequest", children: [{ key: "Key" }] },
31
- ],
27
+ };
28
+ this.outputKeyNodes = {
29
+ UnprocessedItems: {
30
+ "*": {
31
+ "*": {
32
+ PutRequest: {
33
+ Item: utils_1.ALL_VALUES,
34
+ },
35
+ DeleteRequest: {
36
+ Key: utils_1.ALL_VALUES,
37
+ },
38
+ },
32
39
  },
33
40
  },
34
- {
35
- key: "ItemCollectionMetrics",
36
- children: {
37
- children: [{ key: "ItemCollectionKey" }],
41
+ ItemCollectionMetrics: {
42
+ "*": {
43
+ "*": {
44
+ ItemCollectionKey: utils_1.ALL_VALUES,
45
+ },
38
46
  },
39
47
  },
40
- ];
48
+ };
41
49
  this.clientCommand = new client_dynamodb_1.BatchWriteItemCommand(this.input);
42
50
  this.middlewareStack = this.clientCommand.middlewareStack;
43
51
  }
@@ -6,24 +6,27 @@ const smithy_client_1 = require("@smithy/smithy-client");
6
6
  Object.defineProperty(exports, "$Command", { enumerable: true, get: function () { return smithy_client_1.Command; } });
7
7
  const DynamoDBDocumentClientCommand_1 = require("../baseCommand/DynamoDBDocumentClientCommand");
8
8
  Object.defineProperty(exports, "DynamoDBDocumentClientCommand", { enumerable: true, get: function () { return DynamoDBDocumentClientCommand_1.DynamoDBDocumentClientCommand; } });
9
+ const utils_1 = require("../commands/utils");
9
10
  class DeleteCommand extends DynamoDBDocumentClientCommand_1.DynamoDBDocumentClientCommand {
10
11
  constructor(input) {
11
12
  super();
12
13
  this.input = input;
13
- this.inputKeyNodes = [
14
- { key: "Key" },
15
- {
16
- key: "Expected",
17
- children: {
18
- children: [{ key: "Value" }, { key: "AttributeValueList" }],
14
+ this.inputKeyNodes = {
15
+ Key: utils_1.ALL_VALUES,
16
+ Expected: {
17
+ "*": {
18
+ Value: utils_1.SELF,
19
+ AttributeValueList: utils_1.ALL_MEMBERS,
19
20
  },
20
21
  },
21
- { key: "ExpressionAttributeValues" },
22
- ];
23
- this.outputKeyNodes = [
24
- { key: "Attributes" },
25
- { key: "ItemCollectionMetrics", children: [{ key: "ItemCollectionKey" }] },
26
- ];
22
+ ExpressionAttributeValues: utils_1.ALL_VALUES,
23
+ };
24
+ this.outputKeyNodes = {
25
+ Attributes: utils_1.ALL_VALUES,
26
+ ItemCollectionMetrics: {
27
+ ItemCollectionKey: utils_1.ALL_VALUES,
28
+ },
29
+ };
27
30
  this.clientCommand = new client_dynamodb_1.DeleteItemCommand(this.input);
28
31
  this.middlewareStack = this.clientCommand.middlewareStack;
29
32
  }
@@ -6,12 +6,20 @@ const smithy_client_1 = require("@smithy/smithy-client");
6
6
  Object.defineProperty(exports, "$Command", { enumerable: true, get: function () { return smithy_client_1.Command; } });
7
7
  const DynamoDBDocumentClientCommand_1 = require("../baseCommand/DynamoDBDocumentClientCommand");
8
8
  Object.defineProperty(exports, "DynamoDBDocumentClientCommand", { enumerable: true, get: function () { return DynamoDBDocumentClientCommand_1.DynamoDBDocumentClientCommand; } });
9
+ const utils_1 = require("../commands/utils");
9
10
  class ExecuteStatementCommand extends DynamoDBDocumentClientCommand_1.DynamoDBDocumentClientCommand {
10
11
  constructor(input) {
11
12
  super();
12
13
  this.input = input;
13
- this.inputKeyNodes = [{ key: "Parameters" }];
14
- this.outputKeyNodes = [{ key: "Items" }, { key: "LastEvaluatedKey" }];
14
+ this.inputKeyNodes = {
15
+ Parameters: utils_1.ALL_MEMBERS,
16
+ };
17
+ this.outputKeyNodes = {
18
+ Items: {
19
+ "*": utils_1.ALL_VALUES,
20
+ },
21
+ LastEvaluatedKey: utils_1.ALL_VALUES,
22
+ };
15
23
  this.clientCommand = new client_dynamodb_1.ExecuteStatementCommand(this.input);
16
24
  this.middlewareStack = this.clientCommand.middlewareStack;
17
25
  }
@@ -6,12 +6,25 @@ const smithy_client_1 = require("@smithy/smithy-client");
6
6
  Object.defineProperty(exports, "$Command", { enumerable: true, get: function () { return smithy_client_1.Command; } });
7
7
  const DynamoDBDocumentClientCommand_1 = require("../baseCommand/DynamoDBDocumentClientCommand");
8
8
  Object.defineProperty(exports, "DynamoDBDocumentClientCommand", { enumerable: true, get: function () { return DynamoDBDocumentClientCommand_1.DynamoDBDocumentClientCommand; } });
9
+ const utils_1 = require("../commands/utils");
9
10
  class ExecuteTransactionCommand extends DynamoDBDocumentClientCommand_1.DynamoDBDocumentClientCommand {
10
11
  constructor(input) {
11
12
  super();
12
13
  this.input = input;
13
- this.inputKeyNodes = [{ key: "TransactStatements", children: [{ key: "Parameters" }] }];
14
- this.outputKeyNodes = [{ key: "Responses", children: [{ key: "Item" }] }];
14
+ this.inputKeyNodes = {
15
+ TransactStatements: {
16
+ "*": {
17
+ Parameters: utils_1.ALL_MEMBERS,
18
+ },
19
+ },
20
+ };
21
+ this.outputKeyNodes = {
22
+ Responses: {
23
+ "*": {
24
+ Item: utils_1.ALL_VALUES,
25
+ },
26
+ },
27
+ };
15
28
  this.clientCommand = new client_dynamodb_1.ExecuteTransactionCommand(this.input);
16
29
  this.middlewareStack = this.clientCommand.middlewareStack;
17
30
  }
@@ -6,12 +6,17 @@ const smithy_client_1 = require("@smithy/smithy-client");
6
6
  Object.defineProperty(exports, "$Command", { enumerable: true, get: function () { return smithy_client_1.Command; } });
7
7
  const DynamoDBDocumentClientCommand_1 = require("../baseCommand/DynamoDBDocumentClientCommand");
8
8
  Object.defineProperty(exports, "DynamoDBDocumentClientCommand", { enumerable: true, get: function () { return DynamoDBDocumentClientCommand_1.DynamoDBDocumentClientCommand; } });
9
+ const utils_1 = require("../commands/utils");
9
10
  class GetCommand extends DynamoDBDocumentClientCommand_1.DynamoDBDocumentClientCommand {
10
11
  constructor(input) {
11
12
  super();
12
13
  this.input = input;
13
- this.inputKeyNodes = [{ key: "Key" }];
14
- this.outputKeyNodes = [{ key: "Item" }];
14
+ this.inputKeyNodes = {
15
+ Key: utils_1.ALL_VALUES,
16
+ };
17
+ this.outputKeyNodes = {
18
+ Item: utils_1.ALL_VALUES,
19
+ };
15
20
  this.clientCommand = new client_dynamodb_1.GetItemCommand(this.input);
16
21
  this.middlewareStack = this.clientCommand.middlewareStack;
17
22
  }
@@ -6,24 +6,27 @@ const smithy_client_1 = require("@smithy/smithy-client");
6
6
  Object.defineProperty(exports, "$Command", { enumerable: true, get: function () { return smithy_client_1.Command; } });
7
7
  const DynamoDBDocumentClientCommand_1 = require("../baseCommand/DynamoDBDocumentClientCommand");
8
8
  Object.defineProperty(exports, "DynamoDBDocumentClientCommand", { enumerable: true, get: function () { return DynamoDBDocumentClientCommand_1.DynamoDBDocumentClientCommand; } });
9
+ const utils_1 = require("../commands/utils");
9
10
  class PutCommand extends DynamoDBDocumentClientCommand_1.DynamoDBDocumentClientCommand {
10
11
  constructor(input) {
11
12
  super();
12
13
  this.input = input;
13
- this.inputKeyNodes = [
14
- { key: "Item" },
15
- {
16
- key: "Expected",
17
- children: {
18
- children: [{ key: "Value" }, { key: "AttributeValueList" }],
14
+ this.inputKeyNodes = {
15
+ Item: utils_1.ALL_VALUES,
16
+ Expected: {
17
+ "*": {
18
+ Value: utils_1.SELF,
19
+ AttributeValueList: utils_1.ALL_MEMBERS,
19
20
  },
20
21
  },
21
- { key: "ExpressionAttributeValues" },
22
- ];
23
- this.outputKeyNodes = [
24
- { key: "Attributes" },
25
- { key: "ItemCollectionMetrics", children: [{ key: "ItemCollectionKey" }] },
26
- ];
22
+ ExpressionAttributeValues: utils_1.ALL_VALUES,
23
+ };
24
+ this.outputKeyNodes = {
25
+ Attributes: utils_1.ALL_VALUES,
26
+ ItemCollectionMetrics: {
27
+ ItemCollectionKey: utils_1.ALL_VALUES,
28
+ },
29
+ };
27
30
  this.clientCommand = new client_dynamodb_1.PutItemCommand(this.input);
28
31
  this.middlewareStack = this.clientCommand.middlewareStack;
29
32
  }
@@ -6,27 +6,31 @@ const smithy_client_1 = require("@smithy/smithy-client");
6
6
  Object.defineProperty(exports, "$Command", { enumerable: true, get: function () { return smithy_client_1.Command; } });
7
7
  const DynamoDBDocumentClientCommand_1 = require("../baseCommand/DynamoDBDocumentClientCommand");
8
8
  Object.defineProperty(exports, "DynamoDBDocumentClientCommand", { enumerable: true, get: function () { return DynamoDBDocumentClientCommand_1.DynamoDBDocumentClientCommand; } });
9
+ const utils_1 = require("../commands/utils");
9
10
  class QueryCommand extends DynamoDBDocumentClientCommand_1.DynamoDBDocumentClientCommand {
10
11
  constructor(input) {
11
12
  super();
12
13
  this.input = input;
13
- this.inputKeyNodes = [
14
- {
15
- key: "KeyConditions",
16
- children: {
17
- children: [{ key: "AttributeValueList" }],
14
+ this.inputKeyNodes = {
15
+ KeyConditions: {
16
+ "*": {
17
+ AttributeValueList: utils_1.ALL_MEMBERS,
18
18
  },
19
19
  },
20
- {
21
- key: "QueryFilter",
22
- children: {
23
- children: [{ key: "AttributeValueList" }],
20
+ QueryFilter: {
21
+ "*": {
22
+ AttributeValueList: utils_1.ALL_MEMBERS,
24
23
  },
25
24
  },
26
- { key: "ExclusiveStartKey" },
27
- { key: "ExpressionAttributeValues" },
28
- ];
29
- this.outputKeyNodes = [{ key: "Items" }, { key: "LastEvaluatedKey" }];
25
+ ExclusiveStartKey: utils_1.ALL_VALUES,
26
+ ExpressionAttributeValues: utils_1.ALL_VALUES,
27
+ };
28
+ this.outputKeyNodes = {
29
+ Items: {
30
+ "*": utils_1.ALL_VALUES,
31
+ },
32
+ LastEvaluatedKey: utils_1.ALL_VALUES,
33
+ };
30
34
  this.clientCommand = new client_dynamodb_1.QueryCommand(this.input);
31
35
  this.middlewareStack = this.clientCommand.middlewareStack;
32
36
  }
@@ -6,21 +6,26 @@ const smithy_client_1 = require("@smithy/smithy-client");
6
6
  Object.defineProperty(exports, "$Command", { enumerable: true, get: function () { return smithy_client_1.Command; } });
7
7
  const DynamoDBDocumentClientCommand_1 = require("../baseCommand/DynamoDBDocumentClientCommand");
8
8
  Object.defineProperty(exports, "DynamoDBDocumentClientCommand", { enumerable: true, get: function () { return DynamoDBDocumentClientCommand_1.DynamoDBDocumentClientCommand; } });
9
+ const utils_1 = require("../commands/utils");
9
10
  class ScanCommand extends DynamoDBDocumentClientCommand_1.DynamoDBDocumentClientCommand {
10
11
  constructor(input) {
11
12
  super();
12
13
  this.input = input;
13
- this.inputKeyNodes = [
14
- {
15
- key: "ScanFilter",
16
- children: {
17
- children: [{ key: "AttributeValueList" }],
14
+ this.inputKeyNodes = {
15
+ ScanFilter: {
16
+ "*": {
17
+ AttributeValueList: utils_1.ALL_MEMBERS,
18
18
  },
19
19
  },
20
- { key: "ExclusiveStartKey" },
21
- { key: "ExpressionAttributeValues" },
22
- ];
23
- this.outputKeyNodes = [{ key: "Items" }, { key: "LastEvaluatedKey" }];
20
+ ExclusiveStartKey: utils_1.ALL_VALUES,
21
+ ExpressionAttributeValues: utils_1.ALL_VALUES,
22
+ };
23
+ this.outputKeyNodes = {
24
+ Items: {
25
+ "*": utils_1.ALL_VALUES,
26
+ },
27
+ LastEvaluatedKey: utils_1.ALL_VALUES,
28
+ };
24
29
  this.clientCommand = new client_dynamodb_1.ScanCommand(this.input);
25
30
  this.middlewareStack = this.clientCommand.middlewareStack;
26
31
  }
@@ -6,12 +6,27 @@ const smithy_client_1 = require("@smithy/smithy-client");
6
6
  Object.defineProperty(exports, "$Command", { enumerable: true, get: function () { return smithy_client_1.Command; } });
7
7
  const DynamoDBDocumentClientCommand_1 = require("../baseCommand/DynamoDBDocumentClientCommand");
8
8
  Object.defineProperty(exports, "DynamoDBDocumentClientCommand", { enumerable: true, get: function () { return DynamoDBDocumentClientCommand_1.DynamoDBDocumentClientCommand; } });
9
+ const utils_1 = require("../commands/utils");
9
10
  class TransactGetCommand extends DynamoDBDocumentClientCommand_1.DynamoDBDocumentClientCommand {
10
11
  constructor(input) {
11
12
  super();
12
13
  this.input = input;
13
- this.inputKeyNodes = [{ key: "TransactItems", children: [{ key: "Get", children: [{ key: "Key" }] }] }];
14
- this.outputKeyNodes = [{ key: "Responses", children: [{ key: "Item" }] }];
14
+ this.inputKeyNodes = {
15
+ TransactItems: {
16
+ "*": {
17
+ Get: {
18
+ Key: utils_1.ALL_VALUES,
19
+ },
20
+ },
21
+ },
22
+ };
23
+ this.outputKeyNodes = {
24
+ Responses: {
25
+ "*": {
26
+ Item: utils_1.ALL_VALUES,
27
+ },
28
+ },
29
+ };
15
30
  this.clientCommand = new client_dynamodb_1.TransactGetItemsCommand(this.input);
16
31
  this.middlewareStack = this.clientCommand.middlewareStack;
17
32
  }
@@ -6,29 +6,42 @@ const smithy_client_1 = require("@smithy/smithy-client");
6
6
  Object.defineProperty(exports, "$Command", { enumerable: true, get: function () { return smithy_client_1.Command; } });
7
7
  const DynamoDBDocumentClientCommand_1 = require("../baseCommand/DynamoDBDocumentClientCommand");
8
8
  Object.defineProperty(exports, "DynamoDBDocumentClientCommand", { enumerable: true, get: function () { return DynamoDBDocumentClientCommand_1.DynamoDBDocumentClientCommand; } });
9
+ const utils_1 = require("../commands/utils");
9
10
  class TransactWriteCommand extends DynamoDBDocumentClientCommand_1.DynamoDBDocumentClientCommand {
10
11
  constructor(input) {
11
12
  super();
12
13
  this.input = input;
13
- this.inputKeyNodes = [
14
- {
15
- key: "TransactItems",
16
- children: [
17
- { key: "ConditionCheck", children: [{ key: "Key" }, { key: "ExpressionAttributeValues" }] },
18
- { key: "Put", children: [{ key: "Item" }, { key: "ExpressionAttributeValues" }] },
19
- { key: "Delete", children: [{ key: "Key" }, { key: "ExpressionAttributeValues" }] },
20
- { key: "Update", children: [{ key: "Key" }, { key: "ExpressionAttributeValues" }] },
21
- ],
14
+ this.inputKeyNodes = {
15
+ TransactItems: {
16
+ "*": {
17
+ ConditionCheck: {
18
+ Key: utils_1.ALL_VALUES,
19
+ ExpressionAttributeValues: utils_1.ALL_VALUES,
20
+ },
21
+ Put: {
22
+ Item: utils_1.ALL_VALUES,
23
+ ExpressionAttributeValues: utils_1.ALL_VALUES,
24
+ },
25
+ Delete: {
26
+ Key: utils_1.ALL_VALUES,
27
+ ExpressionAttributeValues: utils_1.ALL_VALUES,
28
+ },
29
+ Update: {
30
+ Key: utils_1.ALL_VALUES,
31
+ ExpressionAttributeValues: utils_1.ALL_VALUES,
32
+ },
33
+ },
22
34
  },
23
- ];
24
- this.outputKeyNodes = [
25
- {
26
- key: "ItemCollectionMetrics",
27
- children: {
28
- children: [{ key: "ItemCollectionKey" }],
35
+ };
36
+ this.outputKeyNodes = {
37
+ ItemCollectionMetrics: {
38
+ "*": {
39
+ "*": {
40
+ ItemCollectionKey: utils_1.ALL_VALUES,
41
+ },
29
42
  },
30
43
  },
31
- ];
44
+ };
32
45
  this.clientCommand = new client_dynamodb_1.TransactWriteItemsCommand(this.input);
33
46
  this.middlewareStack = this.clientCommand.middlewareStack;
34
47
  }
@@ -6,30 +6,32 @@ const smithy_client_1 = require("@smithy/smithy-client");
6
6
  Object.defineProperty(exports, "$Command", { enumerable: true, get: function () { return smithy_client_1.Command; } });
7
7
  const DynamoDBDocumentClientCommand_1 = require("../baseCommand/DynamoDBDocumentClientCommand");
8
8
  Object.defineProperty(exports, "DynamoDBDocumentClientCommand", { enumerable: true, get: function () { return DynamoDBDocumentClientCommand_1.DynamoDBDocumentClientCommand; } });
9
+ const utils_1 = require("../commands/utils");
9
10
  class UpdateCommand extends DynamoDBDocumentClientCommand_1.DynamoDBDocumentClientCommand {
10
11
  constructor(input) {
11
12
  super();
12
13
  this.input = input;
13
- this.inputKeyNodes = [
14
- { key: "Key" },
15
- {
16
- key: "AttributeUpdates",
17
- children: {
18
- children: [{ key: "Value" }],
14
+ this.inputKeyNodes = {
15
+ Key: utils_1.ALL_VALUES,
16
+ AttributeUpdates: {
17
+ "*": {
18
+ Value: utils_1.SELF,
19
19
  },
20
20
  },
21
- {
22
- key: "Expected",
23
- children: {
24
- children: [{ key: "Value" }, { key: "AttributeValueList" }],
21
+ Expected: {
22
+ "*": {
23
+ Value: utils_1.SELF,
24
+ AttributeValueList: utils_1.ALL_MEMBERS,
25
25
  },
26
26
  },
27
- { key: "ExpressionAttributeValues" },
28
- ];
29
- this.outputKeyNodes = [
30
- { key: "Attributes" },
31
- { key: "ItemCollectionMetrics", children: [{ key: "ItemCollectionKey" }] },
32
- ];
27
+ ExpressionAttributeValues: utils_1.ALL_VALUES,
28
+ };
29
+ this.outputKeyNodes = {
30
+ Attributes: utils_1.ALL_VALUES,
31
+ ItemCollectionMetrics: {
32
+ ItemCollectionKey: utils_1.ALL_VALUES,
33
+ },
34
+ };
33
35
  this.clientCommand = new client_dynamodb_1.UpdateItemCommand(this.input);
34
36
  this.middlewareStack = this.clientCommand.middlewareStack;
35
37
  }
@@ -1,40 +1,62 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.unmarshallOutput = exports.marshallInput = void 0;
3
+ exports.unmarshallOutput = exports.marshallInput = exports.ALL_MEMBERS = exports.ALL_VALUES = exports.SELF = void 0;
4
4
  const util_dynamodb_1 = require("@aws-sdk/util-dynamodb");
5
- const processObj = (obj, processFunc, children) => {
5
+ exports.SELF = null;
6
+ exports.ALL_VALUES = {};
7
+ exports.ALL_MEMBERS = [];
8
+ const NEXT_LEVEL = "*";
9
+ const processObj = (obj, processFunc, keyNodes) => {
6
10
  if (obj !== undefined) {
7
- if (!children || (Array.isArray(children) && children.length === 0)) {
11
+ if (keyNodes == null) {
8
12
  return processFunc(obj);
9
13
  }
10
14
  else {
11
- if (Array.isArray(children)) {
12
- return processKeysInObj(obj, processFunc, children);
15
+ const keys = Object.keys(keyNodes);
16
+ const goToNextLevel = keys.length === 1 && keys[0] === NEXT_LEVEL;
17
+ const someChildren = keys.length >= 1 && !goToNextLevel;
18
+ const allChildren = keys.length === 0;
19
+ if (someChildren) {
20
+ return processKeysInObj(obj, processFunc, keyNodes);
13
21
  }
14
- else {
15
- return processAllKeysInObj(obj, processFunc, children.children);
22
+ else if (allChildren) {
23
+ return processAllKeysInObj(obj, processFunc, exports.SELF);
24
+ }
25
+ else if (goToNextLevel) {
26
+ return Object.entries(obj !== null && obj !== void 0 ? obj : {}).reduce((acc, [k, v]) => {
27
+ acc[k] = processObj(v, processFunc, keyNodes[NEXT_LEVEL]);
28
+ return acc;
29
+ }, (Array.isArray(obj) ? [] : {}));
16
30
  }
17
31
  }
18
32
  }
19
33
  return undefined;
20
34
  };
21
- const processKeyInObj = (obj, processFunc, children) => {
35
+ const processKeysInObj = (obj, processFunc, keyNodes) => {
36
+ let accumulator;
22
37
  if (Array.isArray(obj)) {
23
- return obj.map((item) => processObj(item, processFunc, children));
38
+ accumulator = [...obj];
39
+ }
40
+ else {
41
+ accumulator = { ...obj };
42
+ }
43
+ for (const [nodeKey, nodes] of Object.entries(keyNodes)) {
44
+ const processedValue = processObj(obj[nodeKey], processFunc, nodes);
45
+ if (processedValue !== undefined) {
46
+ accumulator[nodeKey] = processedValue;
47
+ }
24
48
  }
25
- return processObj(obj, processFunc, children);
49
+ return accumulator;
26
50
  };
27
- const processKeysInObj = (obj, processFunc, keyNodes) => {
28
- const accumulator = { ...obj };
29
- return keyNodes.reduce((acc, { key, children }) => {
30
- acc[key] = processKeyInObj(acc[key], processFunc, children);
51
+ const processAllKeysInObj = (obj, processFunc, keyNodes) => {
52
+ if (Array.isArray(obj)) {
53
+ return obj.map((item) => processObj(item, processFunc, keyNodes));
54
+ }
55
+ return Object.entries(obj).reduce((acc, [key, value]) => {
56
+ acc[key] = processObj(value, processFunc, keyNodes);
31
57
  return acc;
32
- }, accumulator);
58
+ }, {});
33
59
  };
34
- const processAllKeysInObj = (obj, processFunc, children) => Object.entries(obj).reduce((acc, [key, value]) => {
35
- acc[key] = processKeyInObj(value, processFunc, children);
36
- return acc;
37
- }, {});
38
60
  const marshallInput = (obj, keyNodes, options) => {
39
61
  const marshallFunc = (toMarshall) => (0, util_dynamodb_1.marshall)(toMarshall, options);
40
62
  return processKeysInObj(obj, marshallFunc, keyNodes);
@@ -2,7 +2,9 @@ import { Command as $Command } from "@smithy/smithy-client";
2
2
  import { marshallInput, unmarshallOutput } from "../commands/utils";
3
3
  export class DynamoDBDocumentClientCommand extends $Command {
4
4
  addMarshallingMiddleware(configuration) {
5
- const { marshallOptions, unmarshallOptions } = configuration.translateConfig || {};
5
+ const { marshallOptions = {}, unmarshallOptions = {} } = configuration.translateConfig || {};
6
+ marshallOptions.convertTopLevelContainer = marshallOptions.convertTopLevelContainer ?? true;
7
+ unmarshallOptions.convertWithoutMapWrapper = unmarshallOptions.convertWithoutMapWrapper ?? true;
6
8
  this.clientCommand.middlewareStack.addRelativeTo((next, context) => async (args) => {
7
9
  args.input = marshallInput(this.input, this.inputKeyNodes, marshallOptions);
8
10
  context.dynamoDbDocumentClientOptions =