Something went wrong. Try again.
a little carrier pigeon that ferries figma events to discord
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041/** * Shared types for the worker. */
export interface Env { /** KV: key = Figma file_key, value = Discord channel webhook URL. */ FIGMA_DISCORD_WEBHOOK: KVNamespace; /** Durable Object namespace for the Batcher class. */ BATCHER: DurableObjectNamespace; /** Shared secret that Figma echoes back in every webhook payload. */ FIGMA_PASSCODE: string;}
/** A single published item from a Figma library (component, style, or variable). */export interface LibraryItem { key: string; name: string;}
/** Buckets of items pending flush for one file. */export interface BatchItems { components: Record<string, LibraryItem>; styles: Record<string, LibraryItem>; variables: Record<string, LibraryItem>;}
/** Persistent state held by a Batcher Durable Object for a single file. */export interface BatchState { fileKey: string; fileName: string; /** Optional publish description from the designer. */ fileDescription: string; /** Timestamp of the first event in the current batch (ms since epoch). */ firstSeenAt: number; items: BatchItems; /** The Discord webhook URL to flush to, captured from KV on first ingest. */ discordWebhookUrl: string; /** Number of flush attempts made so far (bounded to prevent loops). */ flushAttempts: number;}