feat: fire webhooks on jetstream events, cap at 10 per DID
- db.ts: getWebhooksByDid returns the 10 most recent subscriptions (ORDER BY id DESC LIMIT 10) - jetstream.ts: fireWebhooks fans out to registered URLs via Promise.allSettled after each create/update/delete event
This commit is contained in:
@@ -92,6 +92,12 @@ export const deleteWebhooksByDid = (did: string): void => {
|
||||
db.exec("DELETE FROM webhook_subscription WHERE did = ?", did);
|
||||
};
|
||||
|
||||
export const getWebhooksByDid = (did: string): WebhookSubscriptionRow[] => {
|
||||
return db.prepare(
|
||||
"SELECT id, did, method, url FROM webhook_subscription WHERE did = ? ORDER BY id DESC LIMIT 10",
|
||||
).all<WebhookSubscriptionRow>(did);
|
||||
};
|
||||
|
||||
export const upsertNote = (note: Note) => {
|
||||
const now = new Date().toISOString();
|
||||
db.exec(
|
||||
|
||||
Reference in New Issue
Block a user