@seamapi/webhook
Advanced tools
Comparing version 1.0.0-rc.0 to 1.0.0-rc.1
@@ -1,13 +0,6 @@ | ||
import type { SeamEvent } from 'seamapi-types'; | ||
export type SeamWebhookEvent = Distribute<SeamEvent['event_type']>; | ||
import type { SeamEvent } from '@seamapi/types/connect'; | ||
export declare class SeamWebhook { | ||
#private; | ||
constructor(secret: string); | ||
verify(payload: string, headers: Record<string, string>): SeamWebhookEvent; | ||
verify(payload: string, headers: Record<string, string>): SeamEvent; | ||
} | ||
type Distribute<EventType> = EventType extends SeamEvent['event_type'] ? { | ||
event_type: EventType; | ||
} & Extract<SeamEvent, { | ||
event_type: EventType; | ||
}>['payload'] : never; | ||
export {}; |
The MIT License (MIT) | ||
Copyright (c) 2021-2023 Seam Labs, Inc. | ||
Copyright (c) 2021-2024 Seam Labs, Inc. | ||
@@ -5,0 +5,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of |
{ | ||
"name": "@seamapi/webhook", | ||
"version": "1.0.0-rc.0", | ||
"version": "1.0.0-rc.1", | ||
"description": "Webhook SDK for the Seam API written in TypeScript.", | ||
@@ -69,11 +69,7 @@ "type": "module", | ||
"peerDependencies": { | ||
"seamapi-types": "^1.42.0", | ||
"type-fest": "^4.0.0" | ||
"@seamapi/types": "^1.166.0" | ||
}, | ||
"peerDependenciesMeta": { | ||
"seamapi-types": { | ||
"@seamapi/types": { | ||
"optional": true | ||
}, | ||
"type-fest": { | ||
"optional": true | ||
} | ||
@@ -85,2 +81,3 @@ }, | ||
"devDependencies": { | ||
"@seamapi/types": "^1.166.0", | ||
"@types/node": "^20.8.10", | ||
@@ -97,9 +94,7 @@ "ava": "^6.0.1", | ||
"prettier": "^3.0.0", | ||
"seamapi-types": "^1.42.0", | ||
"tsc-alias": "^1.8.2", | ||
"tsup": "^8.0.1", | ||
"tsx": "^4.6.2", | ||
"type-fest": "^4.14.0", | ||
"typescript": "^5.1.0" | ||
} | ||
} |
@@ -30,6 +30,7 @@ # Seam Webhook SDK | ||
_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 [seam package]. Seam recommends using that package instead | ||
for simpler dependency management._ | ||
> [!IMPORTANT] | ||
> 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 [seam package]. | ||
> Seam recommends using that package instead for simpler dependency management. | ||
@@ -59,3 +60,3 @@ Add this as a dependency to your project using [npm] with | ||
This package depends on [seamapi-types] for the latest TypeScript 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. | ||
@@ -67,3 +68,3 @@ Unless your project frequently runs a blanket `npm update`, | ||
``` | ||
$ npm install -D seamapi-types | ||
$ npm install -D @seamapi/types | ||
``` | ||
@@ -74,7 +75,5 @@ | ||
``` | ||
$ npm install -D seamapi-types | ||
$ npm install -D @seamapi/types@latest | ||
``` | ||
[seamapi-types]: https://github.com/seamapi/seamapi-types/ | ||
## Usage | ||
@@ -85,3 +84,4 @@ | ||
_This example is for [Express], see the [Svix docs for more examples in specific frameworks](https://docs.svix.com/receiving/verifying-payloads/how)._ | ||
> [!TIP] | ||
> This example is for [Express], see the [Svix docs for more examples in specific frameworks](https://docs.svix.com/receiving/verifying-payloads/how). | ||
@@ -88,0 +88,0 @@ ```js |
@@ -1,7 +0,4 @@ | ||
import type { SeamEvent } from 'seamapi-types' | ||
import type { SeamEvent } from '@seamapi/types/connect' | ||
import { Webhook } from 'svix' | ||
// UPSTREAM: This type should come from @seamapi/types. | ||
export type SeamWebhookEvent = Distribute<SeamEvent['event_type']> | ||
export class SeamWebhook { | ||
@@ -14,11 +11,5 @@ readonly #webhook: Webhook | ||
verify(payload: string, headers: Record<string, string>): SeamWebhookEvent { | ||
return this.#webhook.verify(payload, headers) as SeamWebhookEvent | ||
verify(payload: string, headers: Record<string, string>): SeamEvent { | ||
return this.#webhook.verify(payload, headers) as SeamEvent | ||
} | ||
} | ||
type Distribute<EventType> = EventType extends SeamEvent['event_type'] | ||
? { | ||
event_type: EventType | ||
} & Extract<SeamEvent, { event_type: EventType }>['payload'] | ||
: never |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
2
16
16671
79