seam 0.82.0 → 0.84.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.
Files changed (2) hide show
  1. package/README.md +13 -5
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -442,15 +442,15 @@ and obtain a Seam webhook secret.
442
442
  > This example is for [Express], see the [Svix docs for more examples in specific frameworks](https://docs.svix.com/receiving/verifying-payloads/how).
443
443
 
444
444
  ```js
445
+ import { env } from 'node:process'
446
+
445
447
  import { SeamWebhook } from 'seam'
446
448
  import express from 'express'
447
449
  import bodyParser from 'body-parser'
448
450
 
449
- import { storeEvent } from './store-event.js'
450
-
451
451
  const app = express()
452
452
 
453
- const webhook = new SeamWebhook(process.env.SEAM_WEBHOOK_SECRET)
453
+ const webhook = new SeamWebhook(env.SEAM_WEBHOOK_SECRET)
454
454
 
455
455
  app.post(
456
456
  '/webhook',
@@ -458,11 +458,10 @@ app.post(
458
458
  (req, res) => {
459
459
  let data
460
460
  try {
461
- data = webhook.verify(payload, headers)
461
+ data = webhook.verify(req.body, req.headers)
462
462
  } catch {
463
463
  return res.status(400).send()
464
464
  }
465
-
466
465
  storeEvent(data, (err) => {
467
466
  if (err != null) {
468
467
  return res.status(500).send()
@@ -471,6 +470,15 @@ app.post(
471
470
  })
472
471
  },
473
472
  )
473
+
474
+ const storeEvent = (data, callback) => {
475
+ console.log(data)
476
+ callback()
477
+ }
478
+
479
+ app.listen(8080, () => {
480
+ console.log('Ready to receive webhooks at http://localhost:8080/webhook')
481
+ })
474
482
  ```
475
483
 
476
484
  [Express]: https://expressjs.com/
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "seam",
3
- "version": "0.82.0",
3
+ "version": "0.84.0",
4
4
  "description": "JavaScript SDK for the Seam API written in TypeScript.",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -66,8 +66,8 @@
66
66
  },
67
67
  "dependencies": {
68
68
  "@seamapi/http": "1.0.0-rc.1",
69
- "@seamapi/types": "1.184.0",
70
- "@seamapi/webhook": "1.0.0-rc.1",
69
+ "@seamapi/types": "1.185.0",
70
+ "@seamapi/webhook": "1.0.0",
71
71
  "seamapi-types": "1.42.0",
72
72
  "zod": "^3.21.4"
73
73
  },