{"version":3,"file":"define-channel.mjs","names":[],"sources":["../../../../../../../notifications/src/dispatch/define-channel.ts"],"sourcesContent":["import type { Channel } from \"../contracts\";\n\n/**\n * Identity helper that narrows the channel type to its payload. Use it when\n * you want TypeScript to enforce the `send` payload shape against the\n * payload type you declared.\n *\n * Built-in channels (`mail`, `database`) ship as factories; custom channels\n * are usually defined with this helper.\n *\n * @example\n *   import { defineChannel } from \"@warlock.js/notifications\";\n *\n *   type DiscordPayload = { content: string };\n *\n *   export const discordChannel = () =>\n *     defineChannel<DiscordPayload>({\n *       name: \"discord\",\n *       route: (n) => n.get(\"discord_webhook\"),\n *       async send({ payload, route }) {\n *         await fetch(route as string, {\n *           method: \"POST\",\n *           headers: { \"content-type\": \"application/json\" },\n *           body: JSON.stringify(payload),\n *         });\n *       },\n *     });\n *\n *   // Then teach the registry:\n *   declare module \"@warlock.js/notifications\" {\n *     interface NotificationChannels { discord: DiscordPayload }\n *   }\n */\nexport function defineChannel<P>(channel: Channel<P>): Channel<P> {\n  return channel;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,SAAgB,cAAiB,SAAiC;CAChE,OAAO;AACT"}