@moicky/dynamodb 2.0.1 → 2.2.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.
- package/dist/lib/client.d.ts +8 -0
- package/dist/lib/client.js +8 -0
- package/dist/lib/defaultArguments.d.ts +33 -1
- package/dist/lib/defaultArguments.js +31 -0
- package/dist/lib/fixes.d.ts +50 -0
- package/dist/lib/fixes.js +33 -0
- package/dist/lib/schemas.d.ts +31 -0
- package/dist/lib/schemas.js +24 -0
- package/dist/operations/delete.d.ts +63 -2
- package/dist/operations/delete.js +59 -0
- package/dist/operations/get.d.ts +77 -2
- package/dist/operations/get.js +73 -0
- package/dist/operations/misc.d.ts +44 -0
- package/dist/operations/misc.js +44 -0
- package/dist/operations/put.d.ts +43 -2
- package/dist/operations/put.js +39 -0
- package/dist/operations/query.d.ts +124 -0
- package/dist/operations/query.js +188 -5
- package/dist/operations/update.d.ts +46 -0
- package/dist/operations/update.js +46 -0
- package/package.json +1 -1
- package/readme.md +19 -0
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -15,6 +15,7 @@ Contains convenience functions for all major dynamodb operations. Requires very
|
|
|
15
15
|
- 👻 Will **use placeholders** to avoid colliding with [reserved words](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ReservedWords.html) if applicable
|
|
16
16
|
- 🌎 Supports globally defined default arguments for each operation ([example](#configuring-global-defaults))
|
|
17
17
|
- 🔨 Supports fixes for several issues with dynamodb ([example](#applying-fixes))
|
|
18
|
+
- 📖 Offers a convenient way to use pagination with queries
|
|
18
19
|
|
|
19
20
|
## Installation
|
|
20
21
|
|
|
@@ -219,6 +220,24 @@ const booksWithFilter = await queryAllItems(
|
|
|
219
220
|
// additional args with filterExpression for example
|
|
220
221
|
{ FilterExpression: "#released BETWEEN :from AND :to" }
|
|
221
222
|
);
|
|
223
|
+
|
|
224
|
+
// Pagination
|
|
225
|
+
const { items, hasNextPage, hasPreviousPage, currentPage } =
|
|
226
|
+
await queryPaginatedItems(
|
|
227
|
+
"#PK = :PK and begins_with(#SK, :SK)",
|
|
228
|
+
{ PK: "User/1", SK: "Book/" },
|
|
229
|
+
{ pageSize: 100 }
|
|
230
|
+
);
|
|
231
|
+
// items: The items on the current page.
|
|
232
|
+
// currentPage: { number: 1, firstKey: { ... }, lastKey: { ... } }
|
|
233
|
+
|
|
234
|
+
const { items: nextItems, currentPage: nextPage } = await queryPaginatedItems(
|
|
235
|
+
"#PK = :PK and begins_with(#SK, :SK)",
|
|
236
|
+
{ PK: "User/1", SK: "Book/" },
|
|
237
|
+
{ pageSize: 100, currentPage }
|
|
238
|
+
);
|
|
239
|
+
// items: The items on the second page.
|
|
240
|
+
// currentPage: { number: 2, firstKey: { ... }, lastKey: { ... } }
|
|
222
241
|
```
|
|
223
242
|
|
|
224
243
|
### Miscellaneous
|