a little carrier pigeon that ferries figma events to discord
4
fork

Configure Feed

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

at main 40 lines 1.3 kB view raw
1/** 2 * Shared types for the worker. 3 */ 4 5export interface Env { 6 /** KV: key = Figma file_key, value = Discord channel webhook URL. */ 7 FIGMA_DISCORD_WEBHOOK: KVNamespace; 8 /** Durable Object namespace for the Batcher class. */ 9 BATCHER: DurableObjectNamespace; 10 /** Shared secret that Figma echoes back in every webhook payload. */ 11 FIGMA_PASSCODE: string; 12} 13 14/** A single published item from a Figma library (component, style, or variable). */ 15export interface LibraryItem { 16 key: string; 17 name: string; 18} 19 20/** Buckets of items pending flush for one file. */ 21export interface BatchItems { 22 components: Record<string, LibraryItem>; 23 styles: Record<string, LibraryItem>; 24 variables: Record<string, LibraryItem>; 25} 26 27/** Persistent state held by a Batcher Durable Object for a single file. */ 28export interface BatchState { 29 fileKey: string; 30 fileName: string; 31 /** Optional publish description from the designer. */ 32 fileDescription: string; 33 /** Timestamp of the first event in the current batch (ms since epoch). */ 34 firstSeenAt: number; 35 items: BatchItems; 36 /** The Discord webhook URL to flush to, captured from KV on first ingest. */ 37 discordWebhookUrl: string; 38 /** Number of flush attempts made so far (bounded to prevent loops). */ 39 flushAttempts: number; 40}