@moicky/dynamodb 3.0.2 → 3.0.3

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.
@@ -171,7 +171,7 @@ async function queryPaginatedItems(keyCondition, key, args) {
171
171
  const queryArgs = {
172
172
  ...args,
173
173
  Limit: pageSize,
174
- ScanIndexForward: direction === "next",
174
+ ScanIndexForward: direction === (args.ScanIndexForward === false ? "previous" : "next"),
175
175
  };
176
176
  let newPageNumber;
177
177
  switch (direction) {
@@ -219,7 +219,7 @@ async function queryPaginatedItems(keyCondition, key, args) {
219
219
  ExclusiveStartKey: data.LastEvaluatedKey,
220
220
  }).then(({ Count }) => Count > 0)));
221
221
  let hasPreviousPage = newPageNumber > 1;
222
- data.Items = data.Items || [];
222
+ data.Items = (data.Items || []).slice(0, pageSize);
223
223
  direction === "previous" && data.Items.reverse();
224
224
  const applySchema = (item) => {
225
225
  return keyAttributes.reduce((acc, key) => ({ ...acc, [key]: item[key] }), {});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moicky/dynamodb",
3
- "version": "3.0.2",
3
+ "version": "3.0.3",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "description": "Contains a collection of convenience functions for working with AWS DynamoDB",