Skip to content

basalt / webhooks-sqlite/src / SqliteWebhookStore

Class: SqliteWebhookStore ​

Defined in: webhooks-sqlite/src/index.ts:90

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

Implements ​

Constructors ​

Constructor ​

> new SqliteWebhookStore(db): SqliteWebhookStore

Defined in: webhooks-sqlite/src/index.ts:91

Parameters ​

db ​

DatabaseSync

Returns ​

SqliteWebhookStore

Methods ​

add() ​

> add(endpoint): Promise<WebhookEndpoint>

Defined in: webhooks-sqlite/src/index.ts:111

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-sqlite/src/index.ts:93

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-sqlite/src/index.ts:163

Parameters ​

tenantId? ​

string

Returns ​

Promise<WebhookEndpoint[]>

Implementation of ​

WebhookStore.list


remove() ​

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

Defined in: webhooks-sqlite/src/index.ts:155

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.