Skip to content

basalt / webhooks-prisma/src / PrismaWebhookStore

Class: PrismaWebhookStore ​

Defined in: webhooks-prisma/src/index.ts:100

Where webhook subscriptions live. Default in-memory; back it with a DB in production.

Implements ​

Constructors ​

Constructor ​

> new PrismaWebhookStore(client, options?): PrismaWebhookStore

Defined in: webhooks-prisma/src/index.ts:103

Parameters ​

client ​

PrismaWebhooksClient

options? ​

PrismaWebhookStoreOptions = {}

Returns ​

PrismaWebhookStore

Methods ​

add() ​

> add(endpoint): Promise<WebhookEndpoint>

Defined in: webhooks-prisma/src/index.ts:123

Adds an endpoint. Re-adding an existing id replaces it only within its own scope (same tenant, or global); an id held by another scope must be refused (the bundled stores throw WebhookEndpointIdInUseError). The check belongs in the store's write — the manager's own check-before-write cannot close the race between two concurrent registrations.

Parameters ​

endpoint ​

Omit<WebhookEndpoint, "id"> & object

Returns ​

Promise<WebhookEndpoint>

Implementation of ​

WebhookStore.add


forEvent() ​

> forEvent(event, tenantId?): Promise<WebhookEndpoint[]>

Defined in: webhooks-prisma/src/index.ts:110

Active endpoints subscribed to event, fail-closed on tenancy: with a tenantId, that tenant's endpoints plus tenant-agnostic ones; WITHOUT one (or with null/''), tenant-agnostic endpoints ONLY — never every tenant's. A deliberate system-wide read goes through list() instead.

Parameters ​

event ​

string

tenantId? ​

string

Returns ​

Promise<WebhookEndpoint[]>

Implementation of ​

WebhookStore.forEvent


list() ​

> list(tenantId?): Promise<WebhookEndpoint[]>

Defined in: webhooks-prisma/src/index.ts:171

Parameters ​

tenantId? ​

string

Returns ​

Promise<WebhookEndpoint[]>

Implementation of ​

WebhookStore.list


remove() ​

> remove(id, tenantId?): Promise<void>

Defined in: webhooks-prisma/src/index.ts:165

Removes an endpoint. When tenantId is given, only if it owns the endpoint.

Parameters ​

id ​

string

tenantId? ​

string

Returns ​

Promise<void>

Implementation of ​

WebhookStore.remove

Released under the MIT License.