seam 1.41.0 → 1.48.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/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2021-2023 Seam Labs, Inc.
3
+ Copyright (c) 2021-2025 Seam Labs, Inc.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of
6
6
  this software and associated documentation files (the "Software"), to deal in
package/README.md CHANGED
@@ -43,6 +43,11 @@ Instead, it re-exports from a core set of Seam modules:
43
43
  - [Personal Access Token](#personal-access-token)
44
44
  - [Console Session Token](#console-session-token)
45
45
  - [Action Attempts](#action-attempts)
46
+ - [Pagination](#pagination)
47
+ - [Manually fetch pages with the nextPageCursor](#manually-fetch-pages-with-the-nextpagecursor)
48
+ - [Iterate over all pages](#iterate-over-all-pages)
49
+ - [Iterate over all resources](#iterate-over-all-resources)
50
+ - [Return all resources across all pages as an array](#return-all-resources-across-all-pages-as-an-array)
46
51
  - [Interacting with Multiple Workspaces](#interacting-with-multiple-workspaces)
47
52
  - [Personal Access Token](#personal-access-token-1)
48
53
  - [Console Session Token](#console-session-token-1)
@@ -313,6 +318,67 @@ try {
313
318
 
314
319
  [action attempt]: https://docs.seam.co/latest/core-concepts/action-attempts
315
320
 
321
+ ### Pagination
322
+
323
+ Some Seam API endpoints that return lists of resources support pagination.
324
+ Use the `SeamPaginator` class to fetch and process resources across multiple pages.
325
+
326
+ #### Manually fetch pages with the nextPageCursor
327
+
328
+ ```ts
329
+ const pages = seam.createPaginator(
330
+ seam.devices.list({
331
+ limit: 20,
332
+ }),
333
+ )
334
+
335
+ const [devices, { hasNextPage, nextPageCursor }] = await pages.firstPage()
336
+
337
+ if (hasNextPage) {
338
+ const [moreDevices] = await pages.nextPage(nextPageCursor)
339
+ }
340
+ ```
341
+
342
+ #### Iterate over all pages
343
+
344
+ ```ts
345
+ const pages = seam.createPaginator(
346
+ seam.devices.list({
347
+ limit: 20,
348
+ }),
349
+ )
350
+
351
+ for await (const devices of pages) {
352
+ console.log(`There are ${devices.length} devices on this page.`)
353
+ }
354
+ ```
355
+
356
+ #### Iterate over all resources
357
+
358
+ ```ts
359
+ const pages = seam.createPaginator(
360
+ seam.devices.list({
361
+ limit: 20,
362
+ }),
363
+ )
364
+
365
+ for await (const device of pages.flatten()) {
366
+ console.log(devices.name)
367
+ }
368
+ ```
369
+
370
+ #### Return all resources across all pages as an array
371
+
372
+ ```ts
373
+ const pages = seam.createPaginator(
374
+ seam.devices.list({
375
+ limit: 20,
376
+ }),
377
+ )
378
+
379
+ const devices = await pages.toArray()
380
+ ```
381
+
316
382
  ### Interacting with Multiple Workspaces
317
383
 
318
384
  Some Seam API endpoints interact with multiple workspaces.
package/dist/index.cjs CHANGED
@@ -25,5 +25,5 @@ Object.keys(webhook).forEach(function (k) {
25
25
  get: function () { return webhook[k]; }
26
26
  });
27
27
  });
28
- //# sourceMappingURL=out.js.map
28
+ //# sourceMappingURL=index.cjs.map
29
29
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";AAAA;AAAA,EACE,YAAY;AAAA,EACZ,0BAA0B;AAAA,OAGrB;AAEP,cAAc;AAEd,cAAc","sourcesContent":["import {\n SeamHttp as Seam,\n SeamHttpMultiWorkspace as SeamMultiWorkspace,\n type SeamHttpMultiWorkspaceOptions as SeamMultiWorkspaceOptions,\n type SeamHttpOptions as SeamOptions,\n} from '@seamapi/http/connect'\n\nexport * from '@seamapi/http/connect'\nexport type * from '@seamapi/types/connect'\nexport * from '@seamapi/webhook'\nexport { Seam, SeamMultiWorkspace }\nexport type { SeamMultiWorkspaceOptions, SeamOptions }\n"]}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.cjs","sourcesContent":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "seam",
3
- "version": "1.41.0",
3
+ "version": "1.48.0",
4
4
  "description": "JavaScript SDK for the Seam API written in TypeScript.",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -65,8 +65,8 @@
65
65
  "npm": ">= 9.0.0"
66
66
  },
67
67
  "dependencies": {
68
- "@seamapi/http": "1.17.0",
69
- "@seamapi/types": "1.304.0",
68
+ "@seamapi/http": "1.25.0",
69
+ "@seamapi/types": "1.355.0",
70
70
  "@seamapi/webhook": "1.1.1",
71
71
  "zod": "^3.21.4"
72
72
  },