Webhooks for the AT Protocol airglow.run
atproto atprotocol automation webhook
12
fork

Configure Feed

Select the types of activity you want to include in your feed.

refactor: dryness

Hugo 119bdb66 11c183b2

+10 -45
+10 -45
lib/automations/sanitize.ts
··· 1 - import type { Action, ForEachConfig } from "../db/schema.ts"; 2 - import type { FollowTarget } from "./follow-targets.js"; 1 + import type { Action, ForEachConfig, WebhookAction } from "../db/schema.ts"; 3 2 4 - type WithForEach = { forEach?: ForEachConfig }; 3 + type PublicWebhookAction = { 4 + $type: "webhook"; 5 + callbackDomain: string; 6 + headerNames?: string[]; 7 + verified?: boolean; 8 + comment?: string; 9 + forEach?: ForEachConfig; 10 + }; 5 11 6 - export type PublicAction = 7 - | (WithForEach & { 8 - $type: "webhook"; 9 - callbackDomain: string; 10 - headerNames?: string[]; 11 - verified?: boolean; 12 - comment?: string; 13 - }) 14 - | (WithForEach & { 15 - $type: "record"; 16 - targetCollection: string; 17 - recordTemplate: string; 18 - comment?: string; 19 - }) 20 - | (WithForEach & { 21 - $type: "bsky-post"; 22 - textTemplate: string; 23 - langs?: string[]; 24 - labels?: string[]; 25 - comment?: string; 26 - }) 27 - | (WithForEach & { 28 - $type: "patch-record"; 29 - targetCollection: string; 30 - baseRecordUri: string; 31 - recordTemplate: string; 32 - comment?: string; 33 - }) 34 - | (WithForEach & { 35 - $type: "bookmark"; 36 - targetSource: string; 37 - targetTitle?: string; 38 - bodyValue?: string; 39 - tags?: string[]; 40 - comment?: string; 41 - }) 42 - | (WithForEach & { 43 - $type: "follow"; 44 - target: FollowTarget; 45 - subject: string; 46 - comment?: string; 47 - }); 12 + export type PublicAction = PublicWebhookAction | Exclude<Action, WebhookAction>; 48 13 49 14 /** Strip instance-local secrets and truncate webhook URLs to domain-only. */ 50 15 export function sanitizeActions(actions: Action[]): PublicAction[] {