New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@seamapi/webhook

Package Overview
Dependencies
Maintainers
6
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@seamapi/webhook - npm Package Compare versions

Comparing version 0.0.1 to 0.1.0

dist/index.cjs

1

index.d.ts

@@ -1,2 +0,1 @@

export { default } from './lib/index.js';
export * from './lib/index.js';

@@ -1,3 +0,2 @@

export { default } from './lib/index.js';
export * from './lib/index.js';
//# sourceMappingURL=index.js.map

@@ -1,2 +0,1 @@

export { todo as default } from './todo.js';
export { todo } from './todo.js';
export * from './seam-webhook.js';

@@ -1,3 +0,2 @@

export { todo as default } from './todo.js';
export { todo } from './todo.js';
export * from './seam-webhook.js';
//# sourceMappingURL=index.js.map
{
"name": "@seamapi/webhook",
"version": "0.0.1",
"version": "0.1.0",
"description": "Webhook SDK for the Seam API written in TypeScript.",

@@ -10,4 +10,10 @@ "type": "module",

".": {
"import": "./index.js",
"types": "./index.d.ts"
"import": {
"types": "./index.d.ts",
"default": "./index.js"
},
"require": {
"types": "./dist/index.d.cts",
"default": "./dist/index.cjs"
}
}

@@ -34,7 +40,11 @@ },

"src",
"dist",
"!**/*.test.ts"
],
"scripts": {
"build": "npm run build:ts",
"build": "npm run build:entrypoints",
"prebuild": "tsx src/index.ts",
"postbuild": "node ./index.js",
"build:entrypoints": "npm run build:ts",
"postbuild:entrypoints": "tsup",
"build:ts": "tsc --project tsconfig.build.json",

@@ -52,4 +62,2 @@ "prebuild:ts": "del 'index.*' lib",

"postversion": "git push --follow-tags",
"example": "tsx examples",
"example:inspect": "tsx --inspect examples",
"format": "eslint --ignore-path .gitignore --fix .",

@@ -63,2 +71,13 @@ "preformat": "prettier --write --ignore-path .gitignore .",

},
"peerDependencies": {
"seamapi-types": "^1.32.0"
},
"peerDependenciesMeta": {
"seamapi-types": {
"optional": true
}
},
"dependencies": {
"svix": "^1.15.0"
},
"devDependencies": {

@@ -75,5 +94,6 @@ "@types/node": "^20.8.10",

"eslint-plugin-unused-imports": "^3.0.0",
"landlubber": "^1.0.0",
"prettier": "^3.0.0",
"seamapi-types": "^1.32.0",
"tsc-alias": "^1.8.2",
"tsup": "^8.0.1",
"tsx": "^4.6.2",

@@ -80,0 +100,0 @@ "typescript": "^5.1.0"

@@ -10,6 +10,27 @@ # Seam Webhook SDK

TODO
[Seam] makes it easy to integrate IoT devices with your applications.
This is an official SDK for the Seam API.
Please refer to the official [Seam Docs] to get started.
The Seam API implements webhooks using [Svix].
This SDK exports a thin wrapper around the svix package
Use it to parse and validate Seam webhook events
with full TypeScript support for Seam event types.
Refer to the [Svix docs on Consuming Webhooks] for
an in-depth guide on best-practices for handling webhooks
in your application.
[Seam]: https://www.seam.co/
[Seam Docs]: https://docs.seam.co/latest/
[Svix]: https://www.svix.com/
[Svix docs on Consuming Webhooks]: https://docs.svix.com/receiving/introduction
## Installation
_This is a low-level package meant for applications and libraries with particular dependency requirements.
Before using this package, ensure you understand the installation and updating instructions.
This SDK is entirely contained in the [seamapi] package. Seam recommends using that package instead
for simpler dependency management._
Add this as a dependency to your project using [npm] with

@@ -22,3 +43,77 @@

[npm]: https://www.npmjs.com/
[seamapi]: https://www.npmjs.com/package/seamapi
### Optional Peer Dependencies for TypeScript
This package has optional peer dependencies for TypeScript users.
Recent versions of npm will automatically install peer dependencies by default.
For those users, no additional steps are necessary for full TypeScript support,
however users should still explicitly install the latest types (see the next section).
Other package managers require peer dependencies to be added manually.
Refer to any warnings generated by your package manager
about missing peer dependencies and install them as needed.
Refer to the next section for keeping the types updated.
#### Keeping up with the latest types
This package depends on [seamapi-types] for the latest TypeScript types.
New versions of this SDK are generally not released when new types are published.
Unless your project frequently runs a blanket `npm update`,
the types will become outdated with the Seam API over time.
Thus, users of this package should explicitly install the types with
```
$ npm install -D seamapi-types
```
and update them when consuming new API features with
```
$ npm install -D seamapi-types
```
[seamapi-types]: https://github.com/seamapi/seamapi-types/
## Usage
First, create a webhook using the Seam API or Seam Console
and obtain a Seam webhook secret.
_This example is for [Express], see the [Svix docs for more examples in specific frameworks](https://docs.svix.com/receiving/verifying-payloads/how)._
```js
import { SeamWebhook } from '@seamapi/webhook'
import express from 'express'
import bodyParser from 'body-parser'
import { storeEvent } from './store-event.js'
const app = express()
const webhook = new SeamWebhook(process.env.SEAM_WEBHOOK_SECRET)
app.post(
'/webhook',
bodyParser.raw({ type: 'application/json' }),
(req, res) => {
let data
try {
data = webhook.verify(payload, headers)
} catch {
return res.status(400).send()
}
storeEvent(data, (err) => {
if (err != null) {
return res.status(500).send()
}
res.status(204).send()
})
},
)
```
[Express]: https://expressjs.com/
## Development and Testing

@@ -25,0 +120,0 @@

@@ -1,2 +0,1 @@

export { default } from 'lib/index.js'
export * from 'lib/index.js'

@@ -1,2 +0,1 @@

export { todo as default } from './todo.js'
export { todo } from './todo.js'
export * from './seam-webhook.js'

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc