Skip to content

WebhookModel

Defined in: packages/core/src/models/webhook.ts:17

Data operations for webhook subscriptions.

new WebhookModel(db, tables?, secret?): WebhookModel

Defined in: packages/core/src/models/webhook.ts:27

DatabaseAdapter

Database adapter.

WebhookTables

Table handles.

SecretInput

Server secret for webhook-secret encryption (throws on write/decrypt when unset).

WebhookModel

create(projectId, input): Promise<Webhook>

Defined in: packages/core/src/models/webhook.ts:75

Create a webhook subscription for a project.

string

Project ID.

WebhookCreateInput

Webhook creation input.

Promise<Webhook>

The created webhook.


decryptSecret(row): string

Defined in: packages/core/src/models/webhook.ts:89

Decrypt the secret for a stored row (in memory only, at send time).

Webhook

string


get(projectId, id): Promise<Webhook | null>

Defined in: packages/core/src/models/webhook.ts:94

Fetch a webhook by id scoped to a project, or null if not found.

string

string

Promise<Webhook | null>


issue(projectId, input): Promise<{ secret: string; webhook: Webhook; }>

Defined in: packages/core/src/models/webhook.ts:59

Create a webhook with a freshly generated whsec_ signing secret.

string

string[]

string

Promise<{ secret: string; webhook: Webhook; }>

The stored webhook and the plaintext secret (shown to the user once).


list(projectId): Promise<Webhook[]>

Defined in: packages/core/src/models/webhook.ts:34

List all webhooks for a project.

string

Promise<Webhook[]>


remove(projectId, id): Promise<void>

Defined in: packages/core/src/models/webhook.ts:104

Remove a webhook if it belongs to the given project.

string

string

Promise<void>


static eventsOf(webhook): string[]

Defined in: packages/core/src/models/webhook.ts:112

Decode the JSON-serialized event list of a webhook.

Webhook

string[]


static urlError(url): string | null

Defined in: packages/core/src/models/webhook.ts:41

Validate a webhook target URL; returns an error message, or null when acceptable.

string | undefined

string | null