@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.
- package/dist/operations/query.js +2 -2
- package/package.json +1 -1
package/dist/operations/query.js
CHANGED
|
@@ -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] }), {});
|