Direct SQLite read with no DID filter — complements the API-backed `webhooks list`, which is scoped per DID.
30 lines
809 B
TypeScript
30 lines
809 B
TypeScript
// Admin: list every webhook subscription from the local SQLite, across all
|
|
// DIDs. Talks to the database directly — does NOT go through the API.
|
|
//
|
|
// deno task webhooks:all
|
|
//
|
|
// Reads SQLITE_PATH (defaults to "notes.db"). The `token` column is
|
|
// intentionally excluded from the output — it is a write-only secret.
|
|
|
|
import { Database } from "@db/sqlite";
|
|
|
|
type WebhookRow = {
|
|
id: number;
|
|
did: string;
|
|
method: string;
|
|
url: string;
|
|
verb: string;
|
|
};
|
|
|
|
const path = Deno.env.get("SQLITE_PATH") ?? "notes.db";
|
|
const db = new Database(path);
|
|
|
|
const rows = db.prepare(
|
|
"SELECT id, did, method, url, verb FROM webhook_subscription ORDER BY did, id",
|
|
).all<WebhookRow>();
|
|
|
|
console.log(JSON.stringify(rows, null, 2));
|
|
console.error(`[done] ${rows.length} subscription(s) at ${path}`);
|
|
|
|
db.close();
|