basalt / webhooks/src / WebhookStore
Interface: WebhookStore
Defined in: webhooks/src/store.ts:60
Where webhook subscriptions live. Default in-memory; back it with a DB in production.
Methods
add()
> add(endpoint): Promise<WebhookEndpoint>
Defined in: webhooks/src/store.ts:75
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>
forEvent()
> forEvent(event, tenantId?): Promise<WebhookEndpoint[]>
Defined in: webhooks/src/store.ts:67
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[]>
list()
> list(tenantId?): Promise<WebhookEndpoint[]>
Defined in: webhooks/src/store.ts:78
Parameters
tenantId?
string
Returns
Promise<WebhookEndpoint[]>
remove()
> remove(id, tenantId?): Promise<void>
Defined in: webhooks/src/store.ts:77
Removes an endpoint. When tenantId is given, only if it owns the endpoint.
Parameters
id
string
tenantId?
string
Returns
Promise<void>