@aws-sdk/lib-dynamodb 3.185.0 → 3.186.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,18 +1,26 @@
1
+ import { __awaiter, __extends, __generator } from "tslib";
1
2
  import { ExecuteTransactionCommand as __ExecuteTransactionCommand, } from "@aws-sdk/client-dynamodb";
2
3
  import { DynamoDBDocumentClientCommand } from "../baseCommand/DynamoDBDocumentClientCommand";
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;
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;
11
14
  }
12
- resolveMiddleware(clientStack, configuration, options) {
15
+ ExecuteTransactionCommand.prototype.resolveMiddleware = function (clientStack, configuration, options) {
16
+ var _this = this;
13
17
  this.addMarshallingMiddleware(configuration);
14
- const stack = clientStack.concat(this.middlewareStack);
15
- const handler = this.clientCommand.resolveMiddleware(stack, configuration, options);
16
- return async () => handler(this.clientCommand);
17
- }
18
- }
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 };
@@ -1,18 +1,26 @@
1
+ import { __awaiter, __extends, __generator } from "tslib";
1
2
  import { GetItemCommand as __GetItemCommand, } from "@aws-sdk/client-dynamodb";
2
3
  import { DynamoDBDocumentClientCommand } from "../baseCommand/DynamoDBDocumentClientCommand";
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;
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;
11
14
  }
12
- resolveMiddleware(clientStack, configuration, options) {
15
+ GetCommand.prototype.resolveMiddleware = function (clientStack, configuration, options) {
16
+ var _this = this;
13
17
  this.addMarshallingMiddleware(configuration);
14
- const stack = clientStack.concat(this.middlewareStack);
15
- const handler = this.clientCommand.resolveMiddleware(stack, configuration, options);
16
- return async () => handler(this.clientCommand);
17
- }
18
- }
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 };
@@ -1,10 +1,12 @@
1
+ import { __awaiter, __extends, __generator } from "tslib";
1
2
  import { PutItemCommand as __PutItemCommand, } from "@aws-sdk/client-dynamodb";
2
3
  import { DynamoDBDocumentClientCommand } from "../baseCommand/DynamoDBDocumentClientCommand";
3
- export class PutCommand extends DynamoDBDocumentClientCommand {
4
- constructor(input) {
5
- super();
6
- this.input = input;
7
- this.inputKeyNodes = [
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 = [
8
10
  { key: "Item" },
9
11
  {
10
12
  key: "Expected",
@@ -14,17 +16,23 @@ export class PutCommand extends DynamoDBDocumentClientCommand {
14
16
  },
15
17
  { key: "ExpressionAttributeValues" },
16
18
  ];
17
- this.outputKeyNodes = [
19
+ _this.outputKeyNodes = [
18
20
  { key: "Attributes" },
19
21
  { key: "ItemCollectionMetrics", children: [{ key: "ItemCollectionKey" }] },
20
22
  ];
21
- this.clientCommand = new __PutItemCommand(this.input);
22
- this.middlewareStack = this.clientCommand.middlewareStack;
23
+ _this.clientCommand = new __PutItemCommand(_this.input);
24
+ _this.middlewareStack = _this.clientCommand.middlewareStack;
25
+ return _this;
23
26
  }
24
- resolveMiddleware(clientStack, configuration, options) {
27
+ PutCommand.prototype.resolveMiddleware = function (clientStack, configuration, options) {
28
+ var _this = this;
25
29
  this.addMarshallingMiddleware(configuration);
26
- const stack = clientStack.concat(this.middlewareStack);
27
- const handler = this.clientCommand.resolveMiddleware(stack, configuration, options);
28
- return async () => handler(this.clientCommand);
29
- }
30
- }
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 };
@@ -1,10 +1,12 @@
1
+ import { __awaiter, __extends, __generator } from "tslib";
1
2
  import { QueryCommand as __QueryCommand, } from "@aws-sdk/client-dynamodb";
2
3
  import { DynamoDBDocumentClientCommand } from "../baseCommand/DynamoDBDocumentClientCommand";
3
- export class QueryCommand extends DynamoDBDocumentClientCommand {
4
- constructor(input) {
5
- super();
6
- this.input = input;
7
- this.inputKeyNodes = [
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 = [
8
10
  {
9
11
  key: "KeyConditions",
10
12
  children: {
@@ -20,14 +22,20 @@ export class QueryCommand extends DynamoDBDocumentClientCommand {
20
22
  { key: "ExclusiveStartKey" },
21
23
  { key: "ExpressionAttributeValues" },
22
24
  ];
23
- this.outputKeyNodes = [{ key: "Items" }, { key: "LastEvaluatedKey" }];
24
- this.clientCommand = new __QueryCommand(this.input);
25
- this.middlewareStack = this.clientCommand.middlewareStack;
25
+ _this.outputKeyNodes = [{ key: "Items" }, { key: "LastEvaluatedKey" }];
26
+ _this.clientCommand = new __QueryCommand(_this.input);
27
+ _this.middlewareStack = _this.clientCommand.middlewareStack;
28
+ return _this;
26
29
  }
27
- resolveMiddleware(clientStack, configuration, options) {
30
+ QueryCommand.prototype.resolveMiddleware = function (clientStack, configuration, options) {
31
+ var _this = this;
28
32
  this.addMarshallingMiddleware(configuration);
29
- const stack = clientStack.concat(this.middlewareStack);
30
- const handler = this.clientCommand.resolveMiddleware(stack, configuration, options);
31
- return async () => handler(this.clientCommand);
32
- }
33
- }
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 };
@@ -1,10 +1,12 @@
1
+ import { __awaiter, __extends, __generator } from "tslib";
1
2
  import { ScanCommand as __ScanCommand, } from "@aws-sdk/client-dynamodb";
2
3
  import { DynamoDBDocumentClientCommand } from "../baseCommand/DynamoDBDocumentClientCommand";
3
- export class ScanCommand extends DynamoDBDocumentClientCommand {
4
- constructor(input) {
5
- super();
6
- this.input = input;
7
- this.inputKeyNodes = [
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 = [
8
10
  {
9
11
  key: "ScanFilter",
10
12
  children: {
@@ -14,14 +16,20 @@ export class ScanCommand extends DynamoDBDocumentClientCommand {
14
16
  { key: "ExclusiveStartKey" },
15
17
  { key: "ExpressionAttributeValues" },
16
18
  ];
17
- this.outputKeyNodes = [{ key: "Items" }, { key: "LastEvaluatedKey" }];
18
- this.clientCommand = new __ScanCommand(this.input);
19
- this.middlewareStack = this.clientCommand.middlewareStack;
19
+ _this.outputKeyNodes = [{ key: "Items" }, { key: "LastEvaluatedKey" }];
20
+ _this.clientCommand = new __ScanCommand(_this.input);
21
+ _this.middlewareStack = _this.clientCommand.middlewareStack;
22
+ return _this;
20
23
  }
21
- resolveMiddleware(clientStack, configuration, options) {
24
+ ScanCommand.prototype.resolveMiddleware = function (clientStack, configuration, options) {
25
+ var _this = this;
22
26
  this.addMarshallingMiddleware(configuration);
23
- const stack = clientStack.concat(this.middlewareStack);
24
- const handler = this.clientCommand.resolveMiddleware(stack, configuration, options);
25
- return async () => handler(this.clientCommand);
26
- }
27
- }
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 };
@@ -1,18 +1,26 @@
1
+ import { __awaiter, __extends, __generator } from "tslib";
1
2
  import { TransactGetItemsCommand as __TransactGetItemsCommand, } from "@aws-sdk/client-dynamodb";
2
3
  import { DynamoDBDocumentClientCommand } from "../baseCommand/DynamoDBDocumentClientCommand";
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;
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;
11
14
  }
12
- resolveMiddleware(clientStack, configuration, options) {
15
+ TransactGetCommand.prototype.resolveMiddleware = function (clientStack, configuration, options) {
16
+ var _this = this;
13
17
  this.addMarshallingMiddleware(configuration);
14
- const stack = clientStack.concat(this.middlewareStack);
15
- const handler = this.clientCommand.resolveMiddleware(stack, configuration, options);
16
- return async () => handler(this.clientCommand);
17
- }
18
- }
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 };
@@ -1,10 +1,12 @@
1
+ import { __awaiter, __extends, __generator } from "tslib";
1
2
  import { TransactWriteItemsCommand as __TransactWriteItemsCommand, } from "@aws-sdk/client-dynamodb";
2
3
  import { DynamoDBDocumentClientCommand } from "../baseCommand/DynamoDBDocumentClientCommand";
3
- export class TransactWriteCommand extends DynamoDBDocumentClientCommand {
4
- constructor(input) {
5
- super();
6
- this.input = input;
7
- this.inputKeyNodes = [
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 = [
8
10
  {
9
11
  key: "TransactItems",
10
12
  children: [
@@ -15,7 +17,7 @@ export class TransactWriteCommand extends DynamoDBDocumentClientCommand {
15
17
  ],
16
18
  },
17
19
  ];
18
- this.outputKeyNodes = [
20
+ _this.outputKeyNodes = [
19
21
  {
20
22
  key: "ItemCollectionMetrics",
21
23
  children: {
@@ -23,13 +25,19 @@ export class TransactWriteCommand extends DynamoDBDocumentClientCommand {
23
25
  },
24
26
  },
25
27
  ];
26
- this.clientCommand = new __TransactWriteItemsCommand(this.input);
27
- this.middlewareStack = this.clientCommand.middlewareStack;
28
+ _this.clientCommand = new __TransactWriteItemsCommand(_this.input);
29
+ _this.middlewareStack = _this.clientCommand.middlewareStack;
30
+ return _this;
28
31
  }
29
- resolveMiddleware(clientStack, configuration, options) {
32
+ TransactWriteCommand.prototype.resolveMiddleware = function (clientStack, configuration, options) {
33
+ var _this = this;
30
34
  this.addMarshallingMiddleware(configuration);
31
- const stack = clientStack.concat(this.middlewareStack);
32
- const handler = this.clientCommand.resolveMiddleware(stack, configuration, options);
33
- return async () => handler(this.clientCommand);
34
- }
35
- }
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 };
@@ -1,10 +1,12 @@
1
+ import { __awaiter, __extends, __generator } from "tslib";
1
2
  import { UpdateItemCommand as __UpdateItemCommand, } from "@aws-sdk/client-dynamodb";
2
3
  import { DynamoDBDocumentClientCommand } from "../baseCommand/DynamoDBDocumentClientCommand";
3
- export class UpdateCommand extends DynamoDBDocumentClientCommand {
4
- constructor(input) {
5
- super();
6
- this.input = input;
7
- this.inputKeyNodes = [
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 = [
8
10
  { key: "Key" },
9
11
  {
10
12
  key: "AttributeUpdates",
@@ -20,17 +22,23 @@ export class UpdateCommand extends DynamoDBDocumentClientCommand {
20
22
  },
21
23
  { key: "ExpressionAttributeValues" },
22
24
  ];
23
- this.outputKeyNodes = [
25
+ _this.outputKeyNodes = [
24
26
  { key: "Attributes" },
25
27
  { key: "ItemCollectionMetrics", children: [{ key: "ItemCollectionKey" }] },
26
28
  ];
27
- this.clientCommand = new __UpdateItemCommand(this.input);
28
- this.middlewareStack = this.clientCommand.middlewareStack;
29
+ _this.clientCommand = new __UpdateItemCommand(_this.input);
30
+ _this.middlewareStack = _this.clientCommand.middlewareStack;
31
+ return _this;
29
32
  }
30
- resolveMiddleware(clientStack, configuration, options) {
33
+ UpdateCommand.prototype.resolveMiddleware = function (clientStack, configuration, options) {
34
+ var _this = this;
31
35
  this.addMarshallingMiddleware(configuration);
32
- const stack = clientStack.concat(this.middlewareStack);
33
- const handler = this.clientCommand.resolveMiddleware(stack, configuration, options);
34
- return async () => handler(this.clientCommand);
35
- }
36
- }
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 };
@@ -1,5 +1,6 @@
1
+ import { __assign, __read } from "tslib";
1
2
  import { marshall, unmarshall } from "@aws-sdk/util-dynamodb";
2
- const processObj = (obj, processFunc, children) => {
3
+ var processObj = function (obj, processFunc, children) {
3
4
  if (obj !== undefined) {
4
5
  if (!children || (Array.isArray(children) && children.length === 0)) {
5
6
  return processFunc(obj);
@@ -15,25 +16,31 @@ const processObj = (obj, processFunc, children) => {
15
16
  }
16
17
  return undefined;
17
18
  };
18
- const processKeyInObj = (obj, processFunc, children) => {
19
+ var processKeyInObj = function (obj, processFunc, children) {
19
20
  if (Array.isArray(obj)) {
20
- return obj.map((item) => processObj(item, processFunc, children));
21
+ return obj.map(function (item) { return processObj(item, processFunc, children); });
21
22
  }
22
23
  return processObj(obj, processFunc, children);
23
24
  };
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);
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); };
34
41
  return processKeysInObj(obj, marshallFunc, keyNodes);
35
42
  };
36
- export const unmarshallOutput = (obj, keyNodes, options) => {
37
- const unmarshallFunc = (toMarshall) => unmarshall(toMarshall, options);
43
+ export var unmarshallOutput = function (obj, keyNodes, options) {
44
+ var unmarshallFunc = function (toMarshall) { return unmarshall(toMarshall, options); };
38
45
  return processKeysInObj(obj, unmarshallFunc, keyNodes);
39
46
  };
@@ -1,31 +1,74 @@
1
+ import { __asyncGenerator, __await, __awaiter, __generator, __read, __spreadArray } from "tslib";
1
2
  import { QueryCommand } from "../commands/QueryCommand";
2
3
  import { DynamoDBDocument } from "../DynamoDBDocument";
3
4
  import { DynamoDBDocumentClient } from "../DynamoDBDocumentClient";
4
- const makePagedClientRequest = async (client, input, ...args) => {
5
- return await client.send(new QueryCommand(input), ...args);
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
+ });
6
18
  };
7
- const makePagedRequest = async (client, input, ...args) => {
8
- return await client.query(input, ...args);
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
+ });
9
32
  };
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;
33
+ export function paginateQuery(config, input) {
34
+ var additionalArguments = [];
35
+ for (var _i = 2; _i < arguments.length; _i++) {
36
+ additionalArguments[_i - 2] = arguments[_i];
29
37
  }
30
- return undefined;
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
+ });
31
74
  }
@@ -1,31 +1,74 @@
1
+ import { __asyncGenerator, __await, __awaiter, __generator, __read, __spreadArray } from "tslib";
1
2
  import { ScanCommand } from "../commands/ScanCommand";
2
3
  import { DynamoDBDocument } from "../DynamoDBDocument";
3
4
  import { DynamoDBDocumentClient } from "../DynamoDBDocumentClient";
4
- const makePagedClientRequest = async (client, input, ...args) => {
5
- return await client.send(new ScanCommand(input), ...args);
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
+ });
6
18
  };
7
- const makePagedRequest = async (client, input, ...args) => {
8
- return await client.scan(input, ...args);
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
+ });
9
32
  };
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;
33
+ export function paginateScan(config, input) {
34
+ var additionalArguments = [];
35
+ for (var _i = 2; _i < arguments.length; _i++) {
36
+ additionalArguments[_i - 2] = arguments[_i];
29
37
  }
30
- return undefined;
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
+ });
31
74
  }