@aws-sdk/lib-dynamodb 3.181.0 → 3.185.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.
@@ -1,26 +1,18 @@
1
- import { __awaiter, __extends, __generator } from "tslib";
2
1
  import { ExecuteTransactionCommand as __ExecuteTransactionCommand, } from "@aws-sdk/client-dynamodb";
3
2
  import { DynamoDBDocumentClientCommand } from "../baseCommand/DynamoDBDocumentClientCommand";
4
- var ExecuteTransactionCommand = (function (_super) {
5
- __extends(ExecuteTransactionCommand, _super);
6
- function ExecuteTransactionCommand(input) {
7
- var _this = _super.call(this) || this;
8
- _this.input = input;
9
- _this.inputKeyNodes = [{ key: "TransactStatements", children: [{ key: "Parameters" }] }];
10
- _this.outputKeyNodes = [{ key: "Responses", children: [{ key: "Item" }] }];
11
- _this.clientCommand = new __ExecuteTransactionCommand(_this.input);
12
- _this.middlewareStack = _this.clientCommand.middlewareStack;
13
- return _this;
3
+ export class ExecuteTransactionCommand extends DynamoDBDocumentClientCommand {
4
+ constructor(input) {
5
+ super();
6
+ this.input = input;
7
+ this.inputKeyNodes = [{ key: "TransactStatements", children: [{ key: "Parameters" }] }];
8
+ this.outputKeyNodes = [{ key: "Responses", children: [{ key: "Item" }] }];
9
+ this.clientCommand = new __ExecuteTransactionCommand(this.input);
10
+ this.middlewareStack = this.clientCommand.middlewareStack;
14
11
  }
15
- ExecuteTransactionCommand.prototype.resolveMiddleware = function (clientStack, configuration, options) {
16
- var _this = this;
12
+ resolveMiddleware(clientStack, configuration, options) {
17
13
  this.addMarshallingMiddleware(configuration);
18
- var stack = clientStack.concat(this.middlewareStack);
19
- var handler = this.clientCommand.resolveMiddleware(stack, configuration, options);
20
- return function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
21
- return [2, handler(this.clientCommand)];
22
- }); }); };
23
- };
24
- return ExecuteTransactionCommand;
25
- }(DynamoDBDocumentClientCommand));
26
- export { ExecuteTransactionCommand };
14
+ const stack = clientStack.concat(this.middlewareStack);
15
+ const handler = this.clientCommand.resolveMiddleware(stack, configuration, options);
16
+ return async () => handler(this.clientCommand);
17
+ }
18
+ }
@@ -1,26 +1,18 @@
1
- import { __awaiter, __extends, __generator } from "tslib";
2
1
  import { GetItemCommand as __GetItemCommand, } from "@aws-sdk/client-dynamodb";
3
2
  import { DynamoDBDocumentClientCommand } from "../baseCommand/DynamoDBDocumentClientCommand";
4
- var GetCommand = (function (_super) {
5
- __extends(GetCommand, _super);
6
- function GetCommand(input) {
7
- var _this = _super.call(this) || this;
8
- _this.input = input;
9
- _this.inputKeyNodes = [{ key: "Key" }];
10
- _this.outputKeyNodes = [{ key: "Item" }];
11
- _this.clientCommand = new __GetItemCommand(_this.input);
12
- _this.middlewareStack = _this.clientCommand.middlewareStack;
13
- return _this;
3
+ export class GetCommand extends DynamoDBDocumentClientCommand {
4
+ constructor(input) {
5
+ super();
6
+ this.input = input;
7
+ this.inputKeyNodes = [{ key: "Key" }];
8
+ this.outputKeyNodes = [{ key: "Item" }];
9
+ this.clientCommand = new __GetItemCommand(this.input);
10
+ this.middlewareStack = this.clientCommand.middlewareStack;
14
11
  }
15
- GetCommand.prototype.resolveMiddleware = function (clientStack, configuration, options) {
16
- var _this = this;
12
+ resolveMiddleware(clientStack, configuration, options) {
17
13
  this.addMarshallingMiddleware(configuration);
18
- var stack = clientStack.concat(this.middlewareStack);
19
- var handler = this.clientCommand.resolveMiddleware(stack, configuration, options);
20
- return function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
21
- return [2, handler(this.clientCommand)];
22
- }); }); };
23
- };
24
- return GetCommand;
25
- }(DynamoDBDocumentClientCommand));
26
- export { GetCommand };
14
+ const stack = clientStack.concat(this.middlewareStack);
15
+ const handler = this.clientCommand.resolveMiddleware(stack, configuration, options);
16
+ return async () => handler(this.clientCommand);
17
+ }
18
+ }
@@ -1,12 +1,10 @@
1
- import { __awaiter, __extends, __generator } from "tslib";
2
1
  import { PutItemCommand as __PutItemCommand, } from "@aws-sdk/client-dynamodb";
3
2
  import { DynamoDBDocumentClientCommand } from "../baseCommand/DynamoDBDocumentClientCommand";
4
- var PutCommand = (function (_super) {
5
- __extends(PutCommand, _super);
6
- function PutCommand(input) {
7
- var _this = _super.call(this) || this;
8
- _this.input = input;
9
- _this.inputKeyNodes = [
3
+ export class PutCommand extends DynamoDBDocumentClientCommand {
4
+ constructor(input) {
5
+ super();
6
+ this.input = input;
7
+ this.inputKeyNodes = [
10
8
  { key: "Item" },
11
9
  {
12
10
  key: "Expected",
@@ -16,23 +14,17 @@ var PutCommand = (function (_super) {
16
14
  },
17
15
  { key: "ExpressionAttributeValues" },
18
16
  ];
19
- _this.outputKeyNodes = [
17
+ this.outputKeyNodes = [
20
18
  { key: "Attributes" },
21
19
  { key: "ItemCollectionMetrics", children: [{ key: "ItemCollectionKey" }] },
22
20
  ];
23
- _this.clientCommand = new __PutItemCommand(_this.input);
24
- _this.middlewareStack = _this.clientCommand.middlewareStack;
25
- return _this;
21
+ this.clientCommand = new __PutItemCommand(this.input);
22
+ this.middlewareStack = this.clientCommand.middlewareStack;
26
23
  }
27
- PutCommand.prototype.resolveMiddleware = function (clientStack, configuration, options) {
28
- var _this = this;
24
+ resolveMiddleware(clientStack, configuration, options) {
29
25
  this.addMarshallingMiddleware(configuration);
30
- var stack = clientStack.concat(this.middlewareStack);
31
- var handler = this.clientCommand.resolveMiddleware(stack, configuration, options);
32
- return function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
33
- return [2, handler(this.clientCommand)];
34
- }); }); };
35
- };
36
- return PutCommand;
37
- }(DynamoDBDocumentClientCommand));
38
- export { PutCommand };
26
+ const stack = clientStack.concat(this.middlewareStack);
27
+ const handler = this.clientCommand.resolveMiddleware(stack, configuration, options);
28
+ return async () => handler(this.clientCommand);
29
+ }
30
+ }
@@ -1,12 +1,10 @@
1
- import { __awaiter, __extends, __generator } from "tslib";
2
1
  import { QueryCommand as __QueryCommand, } from "@aws-sdk/client-dynamodb";
3
2
  import { DynamoDBDocumentClientCommand } from "../baseCommand/DynamoDBDocumentClientCommand";
4
- var QueryCommand = (function (_super) {
5
- __extends(QueryCommand, _super);
6
- function QueryCommand(input) {
7
- var _this = _super.call(this) || this;
8
- _this.input = input;
9
- _this.inputKeyNodes = [
3
+ export class QueryCommand extends DynamoDBDocumentClientCommand {
4
+ constructor(input) {
5
+ super();
6
+ this.input = input;
7
+ this.inputKeyNodes = [
10
8
  {
11
9
  key: "KeyConditions",
12
10
  children: {
@@ -22,20 +20,14 @@ var QueryCommand = (function (_super) {
22
20
  { key: "ExclusiveStartKey" },
23
21
  { key: "ExpressionAttributeValues" },
24
22
  ];
25
- _this.outputKeyNodes = [{ key: "Items" }, { key: "LastEvaluatedKey" }];
26
- _this.clientCommand = new __QueryCommand(_this.input);
27
- _this.middlewareStack = _this.clientCommand.middlewareStack;
28
- return _this;
23
+ this.outputKeyNodes = [{ key: "Items" }, { key: "LastEvaluatedKey" }];
24
+ this.clientCommand = new __QueryCommand(this.input);
25
+ this.middlewareStack = this.clientCommand.middlewareStack;
29
26
  }
30
- QueryCommand.prototype.resolveMiddleware = function (clientStack, configuration, options) {
31
- var _this = this;
27
+ resolveMiddleware(clientStack, configuration, options) {
32
28
  this.addMarshallingMiddleware(configuration);
33
- var stack = clientStack.concat(this.middlewareStack);
34
- var handler = this.clientCommand.resolveMiddleware(stack, configuration, options);
35
- return function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
36
- return [2, handler(this.clientCommand)];
37
- }); }); };
38
- };
39
- return QueryCommand;
40
- }(DynamoDBDocumentClientCommand));
41
- export { QueryCommand };
29
+ const stack = clientStack.concat(this.middlewareStack);
30
+ const handler = this.clientCommand.resolveMiddleware(stack, configuration, options);
31
+ return async () => handler(this.clientCommand);
32
+ }
33
+ }
@@ -1,12 +1,10 @@
1
- import { __awaiter, __extends, __generator } from "tslib";
2
1
  import { ScanCommand as __ScanCommand, } from "@aws-sdk/client-dynamodb";
3
2
  import { DynamoDBDocumentClientCommand } from "../baseCommand/DynamoDBDocumentClientCommand";
4
- var ScanCommand = (function (_super) {
5
- __extends(ScanCommand, _super);
6
- function ScanCommand(input) {
7
- var _this = _super.call(this) || this;
8
- _this.input = input;
9
- _this.inputKeyNodes = [
3
+ export class ScanCommand extends DynamoDBDocumentClientCommand {
4
+ constructor(input) {
5
+ super();
6
+ this.input = input;
7
+ this.inputKeyNodes = [
10
8
  {
11
9
  key: "ScanFilter",
12
10
  children: {
@@ -16,20 +14,14 @@ var ScanCommand = (function (_super) {
16
14
  { key: "ExclusiveStartKey" },
17
15
  { key: "ExpressionAttributeValues" },
18
16
  ];
19
- _this.outputKeyNodes = [{ key: "Items" }, { key: "LastEvaluatedKey" }];
20
- _this.clientCommand = new __ScanCommand(_this.input);
21
- _this.middlewareStack = _this.clientCommand.middlewareStack;
22
- return _this;
17
+ this.outputKeyNodes = [{ key: "Items" }, { key: "LastEvaluatedKey" }];
18
+ this.clientCommand = new __ScanCommand(this.input);
19
+ this.middlewareStack = this.clientCommand.middlewareStack;
23
20
  }
24
- ScanCommand.prototype.resolveMiddleware = function (clientStack, configuration, options) {
25
- var _this = this;
21
+ resolveMiddleware(clientStack, configuration, options) {
26
22
  this.addMarshallingMiddleware(configuration);
27
- var stack = clientStack.concat(this.middlewareStack);
28
- var handler = this.clientCommand.resolveMiddleware(stack, configuration, options);
29
- return function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
30
- return [2, handler(this.clientCommand)];
31
- }); }); };
32
- };
33
- return ScanCommand;
34
- }(DynamoDBDocumentClientCommand));
35
- export { ScanCommand };
23
+ const stack = clientStack.concat(this.middlewareStack);
24
+ const handler = this.clientCommand.resolveMiddleware(stack, configuration, options);
25
+ return async () => handler(this.clientCommand);
26
+ }
27
+ }
@@ -1,26 +1,18 @@
1
- import { __awaiter, __extends, __generator } from "tslib";
2
1
  import { TransactGetItemsCommand as __TransactGetItemsCommand, } from "@aws-sdk/client-dynamodb";
3
2
  import { DynamoDBDocumentClientCommand } from "../baseCommand/DynamoDBDocumentClientCommand";
4
- var TransactGetCommand = (function (_super) {
5
- __extends(TransactGetCommand, _super);
6
- function TransactGetCommand(input) {
7
- var _this = _super.call(this) || this;
8
- _this.input = input;
9
- _this.inputKeyNodes = [{ key: "TransactItems", children: [{ key: "Get", children: [{ key: "Key" }] }] }];
10
- _this.outputKeyNodes = [{ key: "Responses", children: [{ key: "Item" }] }];
11
- _this.clientCommand = new __TransactGetItemsCommand(_this.input);
12
- _this.middlewareStack = _this.clientCommand.middlewareStack;
13
- return _this;
3
+ export class TransactGetCommand extends DynamoDBDocumentClientCommand {
4
+ constructor(input) {
5
+ super();
6
+ this.input = input;
7
+ this.inputKeyNodes = [{ key: "TransactItems", children: [{ key: "Get", children: [{ key: "Key" }] }] }];
8
+ this.outputKeyNodes = [{ key: "Responses", children: [{ key: "Item" }] }];
9
+ this.clientCommand = new __TransactGetItemsCommand(this.input);
10
+ this.middlewareStack = this.clientCommand.middlewareStack;
14
11
  }
15
- TransactGetCommand.prototype.resolveMiddleware = function (clientStack, configuration, options) {
16
- var _this = this;
12
+ resolveMiddleware(clientStack, configuration, options) {
17
13
  this.addMarshallingMiddleware(configuration);
18
- var stack = clientStack.concat(this.middlewareStack);
19
- var handler = this.clientCommand.resolveMiddleware(stack, configuration, options);
20
- return function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
21
- return [2, handler(this.clientCommand)];
22
- }); }); };
23
- };
24
- return TransactGetCommand;
25
- }(DynamoDBDocumentClientCommand));
26
- export { TransactGetCommand };
14
+ const stack = clientStack.concat(this.middlewareStack);
15
+ const handler = this.clientCommand.resolveMiddleware(stack, configuration, options);
16
+ return async () => handler(this.clientCommand);
17
+ }
18
+ }
@@ -1,12 +1,10 @@
1
- import { __awaiter, __extends, __generator } from "tslib";
2
1
  import { TransactWriteItemsCommand as __TransactWriteItemsCommand, } from "@aws-sdk/client-dynamodb";
3
2
  import { DynamoDBDocumentClientCommand } from "../baseCommand/DynamoDBDocumentClientCommand";
4
- var TransactWriteCommand = (function (_super) {
5
- __extends(TransactWriteCommand, _super);
6
- function TransactWriteCommand(input) {
7
- var _this = _super.call(this) || this;
8
- _this.input = input;
9
- _this.inputKeyNodes = [
3
+ export class TransactWriteCommand extends DynamoDBDocumentClientCommand {
4
+ constructor(input) {
5
+ super();
6
+ this.input = input;
7
+ this.inputKeyNodes = [
10
8
  {
11
9
  key: "TransactItems",
12
10
  children: [
@@ -17,7 +15,7 @@ var TransactWriteCommand = (function (_super) {
17
15
  ],
18
16
  },
19
17
  ];
20
- _this.outputKeyNodes = [
18
+ this.outputKeyNodes = [
21
19
  {
22
20
  key: "ItemCollectionMetrics",
23
21
  children: {
@@ -25,19 +23,13 @@ var TransactWriteCommand = (function (_super) {
25
23
  },
26
24
  },
27
25
  ];
28
- _this.clientCommand = new __TransactWriteItemsCommand(_this.input);
29
- _this.middlewareStack = _this.clientCommand.middlewareStack;
30
- return _this;
26
+ this.clientCommand = new __TransactWriteItemsCommand(this.input);
27
+ this.middlewareStack = this.clientCommand.middlewareStack;
31
28
  }
32
- TransactWriteCommand.prototype.resolveMiddleware = function (clientStack, configuration, options) {
33
- var _this = this;
29
+ resolveMiddleware(clientStack, configuration, options) {
34
30
  this.addMarshallingMiddleware(configuration);
35
- var stack = clientStack.concat(this.middlewareStack);
36
- var handler = this.clientCommand.resolveMiddleware(stack, configuration, options);
37
- return function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
38
- return [2, handler(this.clientCommand)];
39
- }); }); };
40
- };
41
- return TransactWriteCommand;
42
- }(DynamoDBDocumentClientCommand));
43
- export { TransactWriteCommand };
31
+ const stack = clientStack.concat(this.middlewareStack);
32
+ const handler = this.clientCommand.resolveMiddleware(stack, configuration, options);
33
+ return async () => handler(this.clientCommand);
34
+ }
35
+ }
@@ -1,12 +1,10 @@
1
- import { __awaiter, __extends, __generator } from "tslib";
2
1
  import { UpdateItemCommand as __UpdateItemCommand, } from "@aws-sdk/client-dynamodb";
3
2
  import { DynamoDBDocumentClientCommand } from "../baseCommand/DynamoDBDocumentClientCommand";
4
- var UpdateCommand = (function (_super) {
5
- __extends(UpdateCommand, _super);
6
- function UpdateCommand(input) {
7
- var _this = _super.call(this) || this;
8
- _this.input = input;
9
- _this.inputKeyNodes = [
3
+ export class UpdateCommand extends DynamoDBDocumentClientCommand {
4
+ constructor(input) {
5
+ super();
6
+ this.input = input;
7
+ this.inputKeyNodes = [
10
8
  { key: "Key" },
11
9
  {
12
10
  key: "AttributeUpdates",
@@ -22,23 +20,17 @@ var UpdateCommand = (function (_super) {
22
20
  },
23
21
  { key: "ExpressionAttributeValues" },
24
22
  ];
25
- _this.outputKeyNodes = [
23
+ this.outputKeyNodes = [
26
24
  { key: "Attributes" },
27
25
  { key: "ItemCollectionMetrics", children: [{ key: "ItemCollectionKey" }] },
28
26
  ];
29
- _this.clientCommand = new __UpdateItemCommand(_this.input);
30
- _this.middlewareStack = _this.clientCommand.middlewareStack;
31
- return _this;
27
+ this.clientCommand = new __UpdateItemCommand(this.input);
28
+ this.middlewareStack = this.clientCommand.middlewareStack;
32
29
  }
33
- UpdateCommand.prototype.resolveMiddleware = function (clientStack, configuration, options) {
34
- var _this = this;
30
+ resolveMiddleware(clientStack, configuration, options) {
35
31
  this.addMarshallingMiddleware(configuration);
36
- var stack = clientStack.concat(this.middlewareStack);
37
- var handler = this.clientCommand.resolveMiddleware(stack, configuration, options);
38
- return function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
39
- return [2, handler(this.clientCommand)];
40
- }); }); };
41
- };
42
- return UpdateCommand;
43
- }(DynamoDBDocumentClientCommand));
44
- export { UpdateCommand };
32
+ const stack = clientStack.concat(this.middlewareStack);
33
+ const handler = this.clientCommand.resolveMiddleware(stack, configuration, options);
34
+ return async () => handler(this.clientCommand);
35
+ }
36
+ }
@@ -1,6 +1,5 @@
1
- import { __assign, __read } from "tslib";
2
1
  import { marshall, unmarshall } from "@aws-sdk/util-dynamodb";
3
- var processObj = function (obj, processFunc, children) {
2
+ const processObj = (obj, processFunc, children) => {
4
3
  if (obj !== undefined) {
5
4
  if (!children || (Array.isArray(children) && children.length === 0)) {
6
5
  return processFunc(obj);
@@ -16,31 +15,25 @@ var processObj = function (obj, processFunc, children) {
16
15
  }
17
16
  return undefined;
18
17
  };
19
- var processKeyInObj = function (obj, processFunc, children) {
18
+ const processKeyInObj = (obj, processFunc, children) => {
20
19
  if (Array.isArray(obj)) {
21
- return obj.map(function (item) { return processObj(item, processFunc, children); });
20
+ return obj.map((item) => processObj(item, processFunc, children));
22
21
  }
23
22
  return processObj(obj, processFunc, children);
24
23
  };
25
- var processKeysInObj = function (obj, processFunc, keyNodes) {
26
- return keyNodes.reduce(function (acc, _a) {
27
- var _b;
28
- var key = _a.key, children = _a.children;
29
- return (__assign(__assign({}, acc), (_b = {}, _b[key] = processKeyInObj(acc[key], processFunc, children), _b)));
30
- }, obj);
31
- };
32
- var processAllKeysInObj = function (obj, processFunc, children) {
33
- return Object.entries(obj).reduce(function (acc, _a) {
34
- var _b;
35
- var _c = __read(_a, 2), key = _c[0], value = _c[1];
36
- return (__assign(__assign({}, acc), (_b = {}, _b[key] = processKeyInObj(value, processFunc, children), _b)));
37
- }, {});
38
- };
39
- export var marshallInput = function (obj, keyNodes, options) {
40
- var marshallFunc = function (toMarshall) { return marshall(toMarshall, options); };
24
+ const processKeysInObj = (obj, processFunc, keyNodes) => keyNodes.reduce((acc, { key, children }) => ({
25
+ ...acc,
26
+ [key]: processKeyInObj(acc[key], processFunc, children),
27
+ }), obj);
28
+ const processAllKeysInObj = (obj, processFunc, children) => Object.entries(obj).reduce((acc, [key, value]) => ({
29
+ ...acc,
30
+ [key]: processKeyInObj(value, processFunc, children),
31
+ }), {});
32
+ export const marshallInput = (obj, keyNodes, options) => {
33
+ const marshallFunc = (toMarshall) => marshall(toMarshall, options);
41
34
  return processKeysInObj(obj, marshallFunc, keyNodes);
42
35
  };
43
- export var unmarshallOutput = function (obj, keyNodes, options) {
44
- var unmarshallFunc = function (toMarshall) { return unmarshall(toMarshall, options); };
36
+ export const unmarshallOutput = (obj, keyNodes, options) => {
37
+ const unmarshallFunc = (toMarshall) => unmarshall(toMarshall, options);
45
38
  return processKeysInObj(obj, unmarshallFunc, keyNodes);
46
39
  };
@@ -1,74 +1,31 @@
1
- import { __asyncGenerator, __await, __awaiter, __generator, __read, __spreadArray } from "tslib";
2
1
  import { QueryCommand } from "../commands/QueryCommand";
3
2
  import { DynamoDBDocument } from "../DynamoDBDocument";
4
3
  import { DynamoDBDocumentClient } from "../DynamoDBDocumentClient";
5
- var makePagedClientRequest = function (client, input) {
6
- var args = [];
7
- for (var _i = 2; _i < arguments.length; _i++) {
8
- args[_i - 2] = arguments[_i];
9
- }
10
- return __awaiter(void 0, void 0, void 0, function () {
11
- return __generator(this, function (_a) {
12
- switch (_a.label) {
13
- case 0: return [4, client.send.apply(client, __spreadArray([new QueryCommand(input)], __read(args), false))];
14
- case 1: return [2, _a.sent()];
15
- }
16
- });
17
- });
4
+ const makePagedClientRequest = async (client, input, ...args) => {
5
+ return await client.send(new QueryCommand(input), ...args);
18
6
  };
19
- var makePagedRequest = function (client, input) {
20
- var args = [];
21
- for (var _i = 2; _i < arguments.length; _i++) {
22
- args[_i - 2] = arguments[_i];
23
- }
24
- return __awaiter(void 0, void 0, void 0, function () {
25
- return __generator(this, function (_a) {
26
- switch (_a.label) {
27
- case 0: return [4, client.query.apply(client, __spreadArray([input], __read(args), false))];
28
- case 1: return [2, _a.sent()];
29
- }
30
- });
31
- });
7
+ const makePagedRequest = async (client, input, ...args) => {
8
+ return await client.query(input, ...args);
32
9
  };
33
- export function paginateQuery(config, input) {
34
- var additionalArguments = [];
35
- for (var _i = 2; _i < arguments.length; _i++) {
36
- additionalArguments[_i - 2] = arguments[_i];
10
+ export async function* paginateQuery(config, input, ...additionalArguments) {
11
+ let token = config.startingToken || undefined;
12
+ let hasNext = true;
13
+ let page;
14
+ while (hasNext) {
15
+ input.ExclusiveStartKey = token;
16
+ input["Limit"] = config.pageSize;
17
+ if (config.client instanceof DynamoDBDocument) {
18
+ page = await makePagedRequest(config.client, input, ...additionalArguments);
19
+ }
20
+ else if (config.client instanceof DynamoDBDocumentClient) {
21
+ page = await makePagedClientRequest(config.client, input, ...additionalArguments);
22
+ }
23
+ else {
24
+ throw new Error("Invalid client, expected DynamoDBDocument | DynamoDBDocumentClient");
25
+ }
26
+ yield page;
27
+ token = page.LastEvaluatedKey;
28
+ hasNext = !!token;
37
29
  }
38
- return __asyncGenerator(this, arguments, function paginateQuery_1() {
39
- var token, hasNext, page;
40
- return __generator(this, function (_a) {
41
- switch (_a.label) {
42
- case 0:
43
- token = config.startingToken || undefined;
44
- hasNext = true;
45
- _a.label = 1;
46
- case 1:
47
- if (!hasNext) return [3, 9];
48
- input.ExclusiveStartKey = token;
49
- input["Limit"] = config.pageSize;
50
- if (!(config.client instanceof DynamoDBDocument)) return [3, 3];
51
- return [4, __await(makePagedRequest.apply(void 0, __spreadArray([config.client, input], __read(additionalArguments), false)))];
52
- case 2:
53
- page = _a.sent();
54
- return [3, 6];
55
- case 3:
56
- if (!(config.client instanceof DynamoDBDocumentClient)) return [3, 5];
57
- return [4, __await(makePagedClientRequest.apply(void 0, __spreadArray([config.client, input], __read(additionalArguments), false)))];
58
- case 4:
59
- page = _a.sent();
60
- return [3, 6];
61
- case 5: throw new Error("Invalid client, expected DynamoDBDocument | DynamoDBDocumentClient");
62
- case 6: return [4, __await(page)];
63
- case 7: return [4, _a.sent()];
64
- case 8:
65
- _a.sent();
66
- token = page.LastEvaluatedKey;
67
- hasNext = !!token;
68
- return [3, 1];
69
- case 9: return [4, __await(undefined)];
70
- case 10: return [2, _a.sent()];
71
- }
72
- });
73
- });
30
+ return undefined;
74
31
  }
@@ -1,74 +1,31 @@
1
- import { __asyncGenerator, __await, __awaiter, __generator, __read, __spreadArray } from "tslib";
2
1
  import { ScanCommand } from "../commands/ScanCommand";
3
2
  import { DynamoDBDocument } from "../DynamoDBDocument";
4
3
  import { DynamoDBDocumentClient } from "../DynamoDBDocumentClient";
5
- var makePagedClientRequest = function (client, input) {
6
- var args = [];
7
- for (var _i = 2; _i < arguments.length; _i++) {
8
- args[_i - 2] = arguments[_i];
9
- }
10
- return __awaiter(void 0, void 0, void 0, function () {
11
- return __generator(this, function (_a) {
12
- switch (_a.label) {
13
- case 0: return [4, client.send.apply(client, __spreadArray([new ScanCommand(input)], __read(args), false))];
14
- case 1: return [2, _a.sent()];
15
- }
16
- });
17
- });
4
+ const makePagedClientRequest = async (client, input, ...args) => {
5
+ return await client.send(new ScanCommand(input), ...args);
18
6
  };
19
- var makePagedRequest = function (client, input) {
20
- var args = [];
21
- for (var _i = 2; _i < arguments.length; _i++) {
22
- args[_i - 2] = arguments[_i];
23
- }
24
- return __awaiter(void 0, void 0, void 0, function () {
25
- return __generator(this, function (_a) {
26
- switch (_a.label) {
27
- case 0: return [4, client.scan.apply(client, __spreadArray([input], __read(args), false))];
28
- case 1: return [2, _a.sent()];
29
- }
30
- });
31
- });
7
+ const makePagedRequest = async (client, input, ...args) => {
8
+ return await client.scan(input, ...args);
32
9
  };
33
- export function paginateScan(config, input) {
34
- var additionalArguments = [];
35
- for (var _i = 2; _i < arguments.length; _i++) {
36
- additionalArguments[_i - 2] = arguments[_i];
10
+ export async function* paginateScan(config, input, ...additionalArguments) {
11
+ let token = config.startingToken || undefined;
12
+ let hasNext = true;
13
+ let page;
14
+ while (hasNext) {
15
+ input.ExclusiveStartKey = token;
16
+ input["Limit"] = config.pageSize;
17
+ if (config.client instanceof DynamoDBDocument) {
18
+ page = await makePagedRequest(config.client, input, ...additionalArguments);
19
+ }
20
+ else if (config.client instanceof DynamoDBDocumentClient) {
21
+ page = await makePagedClientRequest(config.client, input, ...additionalArguments);
22
+ }
23
+ else {
24
+ throw new Error("Invalid client, expected DynamoDBDocument | DynamoDBDocumentClient");
25
+ }
26
+ yield page;
27
+ token = page.LastEvaluatedKey;
28
+ hasNext = !!token;
37
29
  }
38
- return __asyncGenerator(this, arguments, function paginateScan_1() {
39
- var token, hasNext, page;
40
- return __generator(this, function (_a) {
41
- switch (_a.label) {
42
- case 0:
43
- token = config.startingToken || undefined;
44
- hasNext = true;
45
- _a.label = 1;
46
- case 1:
47
- if (!hasNext) return [3, 9];
48
- input.ExclusiveStartKey = token;
49
- input["Limit"] = config.pageSize;
50
- if (!(config.client instanceof DynamoDBDocument)) return [3, 3];
51
- return [4, __await(makePagedRequest.apply(void 0, __spreadArray([config.client, input], __read(additionalArguments), false)))];
52
- case 2:
53
- page = _a.sent();
54
- return [3, 6];
55
- case 3:
56
- if (!(config.client instanceof DynamoDBDocumentClient)) return [3, 5];
57
- return [4, __await(makePagedClientRequest.apply(void 0, __spreadArray([config.client, input], __read(additionalArguments), false)))];
58
- case 4:
59
- page = _a.sent();
60
- return [3, 6];
61
- case 5: throw new Error("Invalid client, expected DynamoDBDocument | DynamoDBDocumentClient");
62
- case 6: return [4, __await(page)];
63
- case 7: return [4, _a.sent()];
64
- case 8:
65
- _a.sent();
66
- token = page.LastEvaluatedKey;
67
- hasNext = !!token;
68
- return [3, 1];
69
- case 9: return [4, __await(undefined)];
70
- case 10: return [2, _a.sent()];
71
- }
72
- });
73
- });
30
+ return undefined;
74
31
  }