seam 1.49.0 → 1.50.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/README.md +28 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -45,6 +45,7 @@ Instead, it re-exports from a core set of Seam modules:
|
|
|
45
45
|
- [Action Attempts](#action-attempts)
|
|
46
46
|
- [Pagination](#pagination)
|
|
47
47
|
- [Manually fetch pages with the nextPageCursor](#manually-fetch-pages-with-the-nextpagecursor)
|
|
48
|
+
- [Resume pagination](#resume-pagination)
|
|
48
49
|
- [Iterate over all pages](#iterate-over-all-pages)
|
|
49
50
|
- [Iterate over all resources](#iterate-over-all-resources)
|
|
50
51
|
- [Return all resources across all pages as an array](#return-all-resources-across-all-pages-as-an-array)
|
|
@@ -339,6 +340,32 @@ if (hasNextPage) {
|
|
|
339
340
|
}
|
|
340
341
|
```
|
|
341
342
|
|
|
343
|
+
#### Resume pagination
|
|
344
|
+
|
|
345
|
+
Get the first page on initial load:
|
|
346
|
+
|
|
347
|
+
```ts
|
|
348
|
+
const params = { limit: 20 }
|
|
349
|
+
|
|
350
|
+
const pages = seam.createPaginator(seam.devices.list(params))
|
|
351
|
+
|
|
352
|
+
const [devices, pagination] = await pages.firstPage()
|
|
353
|
+
|
|
354
|
+
localStorage.setItem('/seam/devices/list', JSON.stringify([params, pagination]))
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
Get the next page at a later time:
|
|
358
|
+
|
|
359
|
+
```ts
|
|
360
|
+
const [params = {}, { hasNextPage = false, nextPageCursor = null } = {}] =
|
|
361
|
+
JSON.parse(localStorage.getItem('/seam/devices/list') ?? '[]')
|
|
362
|
+
|
|
363
|
+
if (hasNextPage) {
|
|
364
|
+
const pages = seam.createPaginator(seam.devices.list(params))
|
|
365
|
+
const [moreDevices] = await pages.nextPage(nextPageCursor)
|
|
366
|
+
}
|
|
367
|
+
```
|
|
368
|
+
|
|
342
369
|
#### Iterate over all pages
|
|
343
370
|
|
|
344
371
|
```ts
|
|
@@ -376,7 +403,7 @@ const pages = seam.createPaginator(
|
|
|
376
403
|
}),
|
|
377
404
|
)
|
|
378
405
|
|
|
379
|
-
const devices = await pages.
|
|
406
|
+
const devices = await pages.flattenToArray()
|
|
380
407
|
```
|
|
381
408
|
|
|
382
409
|
### Interacting with Multiple Workspaces
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "seam",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.50.0",
|
|
4
4
|
"description": "JavaScript SDK for the Seam API written in TypeScript.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"npm": ">= 9.0.0"
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@seamapi/http": "1.25.
|
|
68
|
+
"@seamapi/http": "1.25.1",
|
|
69
69
|
"@seamapi/types": "1.356.0",
|
|
70
70
|
"@seamapi/webhook": "1.1.1",
|
|
71
71
|
"zod": "^3.21.4"
|