Skip to content

basalt / webhooks/src / MemoryWebhookStore

Class: MemoryWebhookStore ​

Defined in: webhooks/src/store.ts:81

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

Implements ​

Constructors ​

Constructor ​

> new MemoryWebhookStore(): MemoryWebhookStore

Returns ​

MemoryWebhookStore

Methods ​

add() ​

> add(endpoint): Promise<WebhookEndpoint>

Defined in: webhooks/src/store.ts:94

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/src/store.ts:84

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/src/store.ts:116

Parameters ​

tenantId? ​

string

Returns ​

Promise<WebhookEndpoint[]>

Implementation of ​

WebhookStore.list


remove() ​

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

Defined in: webhooks/src/store.ts:108

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.