[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-trpc-auth":3,"mdc--a1i9ec-key":39,"related-org-trpc-auth":6181,"related-repo-trpc-auth":6336},{"slug":4,"name":4,"fn":5,"description":6,"org":7,"tags":11,"stars":22,"repoUrl":23,"updatedAt":24,"license":25,"forks":26,"topics":27,"repo":34,"sourceUrl":37,"mdContent":38},"auth","implement authentication in tRPC applications","Implement JWT\u002Fcookie authentication and authorization in tRPC using createContext for user extraction, t.middleware with opts.next({ ctx }) for context narrowing to non-null user, protectedProcedure base pattern, client-side Authorization headers via httpBatchLink headers(), WebSocket connectionParams, and SSE auth via cookies or EventSource polyfill custom headers.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},"trpc","tRPC","https:\u002F\u002Fpexgzepcugksgbtrxkhf.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Forg-logos\u002Ftrpc.png",[12,16,18,19],{"name":13,"slug":14,"type":15},"Backend","backend","tag",{"name":17,"slug":4,"type":15},"Auth",{"name":9,"slug":8,"type":15},{"name":20,"slug":21,"type":15},"Authentication","authentication",40424,"https:\u002F\u002Fgithub.com\u002Ftrpc\u002Ftrpc","2026-07-18T05:46:45.347628",null,1636,[28,29,30,31,32,33],"api","next","nextjs","prisma","react","typescript",{"repoUrl":23,"stars":22,"forks":26,"topics":35,"description":36},[28,29,30,31,32,33],"🧙‍♀️  Move Fast and Break Nothing. End-to-end typesafe APIs made easy. ","https:\u002F\u002Fgithub.com\u002Ftrpc\u002Ftrpc\u002Ftree\u002FHEAD\u002Fpackages\u002Fserver\u002Fskills\u002Fauth","---\nname: auth\ndescription: >\n  Implement JWT\u002Fcookie authentication and authorization in tRPC using createContext\n  for user extraction, t.middleware with opts.next({ ctx }) for context narrowing to\n  non-null user, protectedProcedure base pattern, client-side Authorization headers\n  via httpBatchLink headers(), WebSocket connectionParams, and SSE auth via cookies\n  or EventSource polyfill custom headers.\ntype: composition\nlibrary: trpc\nlibrary_version: '11.16.0'\nrequires:\n  - server-setup\n  - middlewares\n  - client-setup\nsources:\n  - www\u002Fdocs\u002Fserver\u002Fauthorization.md\n  - www\u002Fdocs\u002Fclient\u002Fheaders.md\n  - www\u002Fdocs\u002Fclient\u002Flinks\u002FhttpSubscriptionLink.md\n  - www\u002Fdocs\u002Fserver\u002Fwebsockets.md\n---\n\n# tRPC — Auth\n\n## Setup\n\n```ts\n\u002F\u002F server\u002Ftrpc.ts\nimport { initTRPC, TRPCError } from '@trpc\u002Fserver';\nimport type { CreateHTTPContextOptions } from '@trpc\u002Fserver\u002Fadapters\u002Fstandalone';\n\nexport async function createContext({ req }: CreateHTTPContextOptions) {\n  async function getUserFromHeader() {\n    const token = req.headers.authorization?.split(' ')[1];\n    if (token) {\n      const user = await verifyJwt(token); \u002F\u002F your JWT verification\n      return user; \u002F\u002F e.g. { id: string; name: string; role: string }\n    }\n    return null;\n  }\n  return { user: await getUserFromHeader() };\n}\n\nexport type Context = Awaited\u003CReturnType\u003Ctypeof createContext>>;\n\nconst t = initTRPC.context\u003CContext>().create();\n\nexport const publicProcedure = t.procedure;\n\nexport const protectedProcedure = t.procedure.use(\n  async function isAuthed(opts) {\n    const { ctx } = opts;\n    if (!ctx.user) {\n      throw new TRPCError({ code: 'UNAUTHORIZED' });\n    }\n    return opts.next({\n      ctx: {\n        user: ctx.user, \u002F\u002F narrows user to non-null\n      },\n    });\n  },\n);\n\nexport const router = t.router;\n```\n\n```ts\n\u002F\u002F client\u002Ftrpc.ts\nimport { createTRPCClient, httpBatchLink } from '@trpc\u002Fclient';\nimport type { AppRouter } from '..\u002Fserver\u002Frouter';\n\nlet token = '';\nexport function setToken(t: string) {\n  token = t;\n}\n\nexport const trpc = createTRPCClient\u003CAppRouter>({\n  links: [\n    httpBatchLink({\n      url: 'http:\u002F\u002Flocalhost:3000\u002Ftrpc',\n      headers() {\n        return { Authorization: `Bearer ${token}` };\n      },\n    }),\n  ],\n});\n```\n\n## Core Patterns\n\n### Context narrowing with auth middleware\n\n```ts\nimport { initTRPC, TRPCError } from '@trpc\u002Fserver';\n\ntype Context = { user: { id: string; role: string } | null };\nconst t = initTRPC.context\u003CContext>().create();\n\nconst isAuthed = t.middleware(async ({ ctx, next }) => {\n  if (!ctx.user) {\n    throw new TRPCError({ code: 'UNAUTHORIZED' });\n  }\n  return next({ ctx: { user: ctx.user } });\n});\n\nconst isAdmin = t.middleware(async ({ ctx, next }) => {\n  if (!ctx.user || ctx.user.role !== 'admin') {\n    throw new TRPCError({ code: 'FORBIDDEN' });\n  }\n  return next({ ctx: { user: ctx.user } });\n});\n\nexport const protectedProcedure = t.procedure.use(isAuthed);\nexport const adminProcedure = t.procedure.use(isAdmin);\n```\n\n### SSE subscription auth with EventSource polyfill\n\n```ts\nimport {\n  createTRPCClient,\n  httpBatchLink,\n  httpSubscriptionLink,\n  splitLink,\n} from '@trpc\u002Fclient';\nimport { EventSourcePolyfill } from 'event-source-polyfill';\nimport type { AppRouter } from '..\u002Fserver\u002Frouter';\n\nconst trpc = createTRPCClient\u003CAppRouter>({\n  links: [\n    splitLink({\n      condition: (op) => op.type === 'subscription',\n      true: httpSubscriptionLink({\n        url: 'http:\u002F\u002Flocalhost:3000\u002Ftrpc',\n        EventSource: EventSourcePolyfill,\n        eventSourceOptions: async () => {\n          return {\n            headers: {\n              authorization: `Bearer ${getToken()}`,\n            },\n          };\n        },\n      }),\n      false: httpBatchLink({\n        url: 'http:\u002F\u002Flocalhost:3000\u002Ftrpc',\n        headers() {\n          return { Authorization: `Bearer ${getToken()}` };\n        },\n      }),\n    }),\n  ],\n});\n```\n\n### WebSocket auth with connectionParams\n\n```ts\n\u002F\u002F server\u002Fcontext.ts\nimport type { CreateWSSContextFnOptions } from '@trpc\u002Fserver\u002Fadapters\u002Fws';\n\nexport const createContext = async (opts: CreateWSSContextFnOptions) => {\n  const token = opts.info.connectionParams?.token;\n  const user = token ? await verifyJwt(token) : null;\n  return { user };\n};\n```\n\n```ts\n\u002F\u002F client\u002Ftrpc.ts\nimport { createTRPCClient, createWSClient, wsLink } from '@trpc\u002Fclient';\nimport type { AppRouter } from '..\u002Fserver\u002Frouter';\n\nconst wsClient = createWSClient({\n  url: 'ws:\u002F\u002Flocalhost:3001',\n  connectionParams: async () => ({\n    token: getToken(),\n  }),\n});\n\nconst trpc = createTRPCClient\u003CAppRouter>({\n  links: [wsLink({ client: wsClient })],\n});\n```\n\n### SSE auth with cookies (same domain)\n\n```ts\nimport {\n  createTRPCClient,\n  httpBatchLink,\n  httpSubscriptionLink,\n  splitLink,\n} from '@trpc\u002Fclient';\nimport type { AppRouter } from '..\u002Fserver\u002Frouter';\n\nconst trpc = createTRPCClient\u003CAppRouter>({\n  links: [\n    splitLink({\n      condition: (op) => op.type === 'subscription',\n      true: httpSubscriptionLink({\n        url: '\u002Fapi\u002Ftrpc',\n        eventSourceOptions() {\n          return { withCredentials: true };\n        },\n      }),\n      false: httpBatchLink({ url: '\u002Fapi\u002Ftrpc' }),\n    }),\n  ],\n});\n```\n\n## Common Mistakes\n\n### HIGH Not narrowing user type in auth middleware\n\nWrong:\n\n```ts\nconst authMiddleware = t.middleware(async ({ ctx, next }) => {\n  if (!ctx.user) throw new TRPCError({ code: 'UNAUTHORIZED' });\n  return next(); \u002F\u002F user still nullable downstream\n});\n```\n\nCorrect:\n\n```ts\nconst authMiddleware = t.middleware(async ({ ctx, next }) => {\n  if (!ctx.user) throw new TRPCError({ code: 'UNAUTHORIZED' });\n  return next({ ctx: { user: ctx.user } }); \u002F\u002F narrows to non-null\n});\n```\n\nWithout `opts.next({ ctx })`, downstream procedures still see `user` as `{ id: string } | null`, requiring redundant null checks.\n\nSource: www\u002Fdocs\u002Fserver\u002Fauthorization.md\n\n### HIGH SSE auth via URL query params exposes tokens\n\nWrong:\n\n```ts\nhttpSubscriptionLink({\n  url: 'http:\u002F\u002Flocalhost:3000\u002Ftrpc',\n  connectionParams: async () => ({\n    token: 'my-secret-jwt',\n  }),\n});\n```\n\nCorrect:\n\n```ts\nimport { EventSourcePolyfill } from 'event-source-polyfill';\n\nhttpSubscriptionLink({\n  url: 'http:\u002F\u002Flocalhost:3000\u002Ftrpc',\n  EventSource: EventSourcePolyfill,\n  eventSourceOptions: async () => ({\n    headers: { authorization: 'Bearer my-secret-jwt' },\n  }),\n});\n```\n\n`connectionParams` are serialized as URL query strings for SSE, exposing tokens in server logs and browser history. Use cookies for same-domain or custom headers via an EventSource polyfill instead.\n\nSource: www\u002Fdocs\u002Fclient\u002Flinks\u002FhttpSubscriptionLink.md\n\n### MEDIUM Async headers causing stuck isFetching\n\nWrong:\n\n```ts\nhttpBatchLink({\n  url: '\u002Fapi\u002Ftrpc',\n  async headers() {\n    const token = await refreshToken(); \u002F\u002F can race\n    return { Authorization: `Bearer ${token}` };\n  },\n});\n```\n\nCorrect:\n\n```ts\nlet cachedToken: string | null = null;\n\nasync function ensureToken() {\n  if (!cachedToken) cachedToken = await refreshToken();\n  return cachedToken;\n}\n\nhttpBatchLink({\n  url: '\u002Fapi\u002Ftrpc',\n  async headers() {\n    return { Authorization: `Bearer ${await ensureToken()}` };\n  },\n});\n```\n\nWhen the headers function is async (e.g., refreshing auth tokens), React Query's `isFetching` can get stuck permanently in certain race conditions.\n\nSource: https:\u002F\u002Fgithub.com\u002Ftrpc\u002Ftrpc\u002Fissues\u002F7001\n\n### HIGH Skipping auth or opening CORS too wide in prototypes\n\nWrong:\n\n```ts\nimport cors from 'cors';\n\ncreateHTTPServer({\n  middleware: cors(), \u002F\u002F origin: '*' by default\n  router: appRouter,\n  createContext() {\n    return {};\n  }, \u002F\u002F no auth\n}).listen(3000);\n```\n\nCorrect:\n\n```ts\nimport cors from 'cors';\n\ncreateHTTPServer({\n  middleware: cors({ origin: 'https:\u002F\u002Fmyapp.com' }),\n  router: appRouter,\n  createContext,\n}).listen(3000);\n```\n\nWildcard CORS and missing auth middleware are acceptable only during local development. Always restrict CORS origins and add auth before deploying.\n\nSource: maintainer interview\n\n## See Also\n\n- **middlewares** -- context narrowing, `.use()`, `.concat()`, base procedure patterns\n- **subscriptions** -- SSE and WebSocket transport setup for authenticated subscriptions\n- **client-setup** -- `createTRPCClient`, link chain, `headers` option\n- **links** -- `splitLink`, `httpSubscriptionLink`, `wsLink` configuration\n",{"data":40,"body":52},{"name":4,"description":6,"type":41,"library":8,"library_version":42,"requires":43,"sources":47},"composition","11.16.0",[44,45,46],"server-setup","middlewares","client-setup",[48,49,50,51],"www\u002Fdocs\u002Fserver\u002Fauthorization.md","www\u002Fdocs\u002Fclient\u002Fheaders.md","www\u002Fdocs\u002Fclient\u002Flinks\u002FhttpSubscriptionLink.md","www\u002Fdocs\u002Fserver\u002Fwebsockets.md",{"type":53,"children":54},"root",[55,64,71,1151,1594,1600,1607,2464,2470,3177,3183,3430,3812,3818,4300,4306,4312,4318,4512,4517,4757,4785,4790,4796,4800,4939,4943,5163,5173,5178,5184,5188,5360,5364,5650,5663,5676,5682,5686,5879,5883,6065,6070,6075,6081,6175],{"type":56,"tag":57,"props":58,"children":60},"element","h1",{"id":59},"trpc-auth",[61],{"type":62,"value":63},"text","tRPC — Auth",{"type":56,"tag":65,"props":66,"children":68},"h2",{"id":67},"setup",[69],{"type":62,"value":70},"Setup",{"type":56,"tag":72,"props":73,"children":78},"pre",{"className":74,"code":75,"language":76,"meta":77,"style":77},"language-ts shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","\u002F\u002F server\u002Ftrpc.ts\nimport { initTRPC, TRPCError } from '@trpc\u002Fserver';\nimport type { CreateHTTPContextOptions } from '@trpc\u002Fserver\u002Fadapters\u002Fstandalone';\n\nexport async function createContext({ req }: CreateHTTPContextOptions) {\n  async function getUserFromHeader() {\n    const token = req.headers.authorization?.split(' ')[1];\n    if (token) {\n      const user = await verifyJwt(token); \u002F\u002F your JWT verification\n      return user; \u002F\u002F e.g. { id: string; name: string; role: string }\n    }\n    return null;\n  }\n  return { user: await getUserFromHeader() };\n}\n\nexport type Context = Awaited\u003CReturnType\u003Ctypeof createContext>>;\n\nconst t = initTRPC.context\u003CContext>().create();\n\nexport const publicProcedure = t.procedure;\n\nexport const protectedProcedure = t.procedure.use(\n  async function isAuthed(opts) {\n    const { ctx } = opts;\n    if (!ctx.user) {\n      throw new TRPCError({ code: 'UNAUTHORIZED' });\n    }\n    return opts.next({\n      ctx: {\n        user: ctx.user, \u002F\u002F narrows user to non-null\n      },\n    });\n  },\n);\n\nexport const router = t.router;\n","ts","",[79],{"type":56,"tag":80,"props":81,"children":82},"code",{"__ignoreMap":77},[83,95,158,205,215,272,299,385,414,464,486,495,509,518,558,567,575,625,633,700,708,748,756,803,837,871,910,971,979,1007,1024,1058,1067,1084,1093,1105,1113],{"type":56,"tag":84,"props":85,"children":88},"span",{"class":86,"line":87},"line",1,[89],{"type":56,"tag":84,"props":90,"children":92},{"style":91},"--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic",[93],{"type":62,"value":94},"\u002F\u002F server\u002Ftrpc.ts\n",{"type":56,"tag":84,"props":96,"children":98},{"class":86,"line":97},2,[99,105,111,117,122,127,132,137,142,148,153],{"type":56,"tag":84,"props":100,"children":102},{"style":101},"--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic",[103],{"type":62,"value":104},"import",{"type":56,"tag":84,"props":106,"children":108},{"style":107},"--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF",[109],{"type":62,"value":110}," {",{"type":56,"tag":84,"props":112,"children":114},{"style":113},"--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8",[115],{"type":62,"value":116}," initTRPC",{"type":56,"tag":84,"props":118,"children":119},{"style":107},[120],{"type":62,"value":121},",",{"type":56,"tag":84,"props":123,"children":124},{"style":113},[125],{"type":62,"value":126}," TRPCError",{"type":56,"tag":84,"props":128,"children":129},{"style":107},[130],{"type":62,"value":131}," }",{"type":56,"tag":84,"props":133,"children":134},{"style":101},[135],{"type":62,"value":136}," from",{"type":56,"tag":84,"props":138,"children":139},{"style":107},[140],{"type":62,"value":141}," '",{"type":56,"tag":84,"props":143,"children":145},{"style":144},"--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D",[146],{"type":62,"value":147},"@trpc\u002Fserver",{"type":56,"tag":84,"props":149,"children":150},{"style":107},[151],{"type":62,"value":152},"'",{"type":56,"tag":84,"props":154,"children":155},{"style":107},[156],{"type":62,"value":157},";\n",{"type":56,"tag":84,"props":159,"children":161},{"class":86,"line":160},3,[162,166,171,175,180,184,188,192,197,201],{"type":56,"tag":84,"props":163,"children":164},{"style":101},[165],{"type":62,"value":104},{"type":56,"tag":84,"props":167,"children":168},{"style":101},[169],{"type":62,"value":170}," type",{"type":56,"tag":84,"props":172,"children":173},{"style":107},[174],{"type":62,"value":110},{"type":56,"tag":84,"props":176,"children":177},{"style":113},[178],{"type":62,"value":179}," CreateHTTPContextOptions",{"type":56,"tag":84,"props":181,"children":182},{"style":107},[183],{"type":62,"value":131},{"type":56,"tag":84,"props":185,"children":186},{"style":101},[187],{"type":62,"value":136},{"type":56,"tag":84,"props":189,"children":190},{"style":107},[191],{"type":62,"value":141},{"type":56,"tag":84,"props":193,"children":194},{"style":144},[195],{"type":62,"value":196},"@trpc\u002Fserver\u002Fadapters\u002Fstandalone",{"type":56,"tag":84,"props":198,"children":199},{"style":107},[200],{"type":62,"value":152},{"type":56,"tag":84,"props":202,"children":203},{"style":107},[204],{"type":62,"value":157},{"type":56,"tag":84,"props":206,"children":208},{"class":86,"line":207},4,[209],{"type":56,"tag":84,"props":210,"children":212},{"emptyLinePlaceholder":211},true,[213],{"type":62,"value":214},"\n",{"type":56,"tag":84,"props":216,"children":218},{"class":86,"line":217},5,[219,224,230,235,241,246,252,257,262,267],{"type":56,"tag":84,"props":220,"children":221},{"style":101},[222],{"type":62,"value":223},"export",{"type":56,"tag":84,"props":225,"children":227},{"style":226},"--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA",[228],{"type":62,"value":229}," async",{"type":56,"tag":84,"props":231,"children":232},{"style":226},[233],{"type":62,"value":234}," function",{"type":56,"tag":84,"props":236,"children":238},{"style":237},"--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF",[239],{"type":62,"value":240}," createContext",{"type":56,"tag":84,"props":242,"children":243},{"style":107},[244],{"type":62,"value":245},"({",{"type":56,"tag":84,"props":247,"children":249},{"style":248},"--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#EEFFFF;--shiki-default-font-style:italic;--shiki-dark:#BABED8;--shiki-dark-font-style:italic",[250],{"type":62,"value":251}," req",{"type":56,"tag":84,"props":253,"children":254},{"style":107},[255],{"type":62,"value":256}," }:",{"type":56,"tag":84,"props":258,"children":260},{"style":259},"--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B",[261],{"type":62,"value":179},{"type":56,"tag":84,"props":263,"children":264},{"style":107},[265],{"type":62,"value":266},")",{"type":56,"tag":84,"props":268,"children":269},{"style":107},[270],{"type":62,"value":271}," {\n",{"type":56,"tag":84,"props":273,"children":275},{"class":86,"line":274},6,[276,281,285,290,295],{"type":56,"tag":84,"props":277,"children":278},{"style":226},[279],{"type":62,"value":280},"  async",{"type":56,"tag":84,"props":282,"children":283},{"style":226},[284],{"type":62,"value":234},{"type":56,"tag":84,"props":286,"children":287},{"style":237},[288],{"type":62,"value":289}," getUserFromHeader",{"type":56,"tag":84,"props":291,"children":292},{"style":107},[293],{"type":62,"value":294},"()",{"type":56,"tag":84,"props":296,"children":297},{"style":107},[298],{"type":62,"value":271},{"type":56,"tag":84,"props":300,"children":302},{"class":86,"line":301},7,[303,308,313,318,322,327,332,336,341,346,351,357,361,365,370,376,381],{"type":56,"tag":84,"props":304,"children":305},{"style":226},[306],{"type":62,"value":307},"    const",{"type":56,"tag":84,"props":309,"children":310},{"style":113},[311],{"type":62,"value":312}," token",{"type":56,"tag":84,"props":314,"children":315},{"style":107},[316],{"type":62,"value":317}," =",{"type":56,"tag":84,"props":319,"children":320},{"style":113},[321],{"type":62,"value":251},{"type":56,"tag":84,"props":323,"children":324},{"style":107},[325],{"type":62,"value":326},".",{"type":56,"tag":84,"props":328,"children":329},{"style":113},[330],{"type":62,"value":331},"headers",{"type":56,"tag":84,"props":333,"children":334},{"style":107},[335],{"type":62,"value":326},{"type":56,"tag":84,"props":337,"children":338},{"style":113},[339],{"type":62,"value":340},"authorization",{"type":56,"tag":84,"props":342,"children":343},{"style":107},[344],{"type":62,"value":345},"?.",{"type":56,"tag":84,"props":347,"children":348},{"style":237},[349],{"type":62,"value":350},"split",{"type":56,"tag":84,"props":352,"children":354},{"style":353},"--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178",[355],{"type":62,"value":356},"(",{"type":56,"tag":84,"props":358,"children":359},{"style":107},[360],{"type":62,"value":152},{"type":56,"tag":84,"props":362,"children":363},{"style":107},[364],{"type":62,"value":141},{"type":56,"tag":84,"props":366,"children":367},{"style":353},[368],{"type":62,"value":369},")[",{"type":56,"tag":84,"props":371,"children":373},{"style":372},"--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C",[374],{"type":62,"value":375},"1",{"type":56,"tag":84,"props":377,"children":378},{"style":353},[379],{"type":62,"value":380},"]",{"type":56,"tag":84,"props":382,"children":383},{"style":107},[384],{"type":62,"value":157},{"type":56,"tag":84,"props":386,"children":388},{"class":86,"line":387},8,[389,394,399,404,409],{"type":56,"tag":84,"props":390,"children":391},{"style":101},[392],{"type":62,"value":393},"    if",{"type":56,"tag":84,"props":395,"children":396},{"style":353},[397],{"type":62,"value":398}," (",{"type":56,"tag":84,"props":400,"children":401},{"style":113},[402],{"type":62,"value":403},"token",{"type":56,"tag":84,"props":405,"children":406},{"style":353},[407],{"type":62,"value":408},") ",{"type":56,"tag":84,"props":410,"children":411},{"style":107},[412],{"type":62,"value":413},"{\n",{"type":56,"tag":84,"props":415,"children":417},{"class":86,"line":416},9,[418,423,428,432,437,442,446,450,454,459],{"type":56,"tag":84,"props":419,"children":420},{"style":226},[421],{"type":62,"value":422},"      const",{"type":56,"tag":84,"props":424,"children":425},{"style":113},[426],{"type":62,"value":427}," user",{"type":56,"tag":84,"props":429,"children":430},{"style":107},[431],{"type":62,"value":317},{"type":56,"tag":84,"props":433,"children":434},{"style":101},[435],{"type":62,"value":436}," await",{"type":56,"tag":84,"props":438,"children":439},{"style":237},[440],{"type":62,"value":441}," verifyJwt",{"type":56,"tag":84,"props":443,"children":444},{"style":353},[445],{"type":62,"value":356},{"type":56,"tag":84,"props":447,"children":448},{"style":113},[449],{"type":62,"value":403},{"type":56,"tag":84,"props":451,"children":452},{"style":353},[453],{"type":62,"value":266},{"type":56,"tag":84,"props":455,"children":456},{"style":107},[457],{"type":62,"value":458},";",{"type":56,"tag":84,"props":460,"children":461},{"style":91},[462],{"type":62,"value":463}," \u002F\u002F your JWT verification\n",{"type":56,"tag":84,"props":465,"children":467},{"class":86,"line":466},10,[468,473,477,481],{"type":56,"tag":84,"props":469,"children":470},{"style":101},[471],{"type":62,"value":472},"      return",{"type":56,"tag":84,"props":474,"children":475},{"style":113},[476],{"type":62,"value":427},{"type":56,"tag":84,"props":478,"children":479},{"style":107},[480],{"type":62,"value":458},{"type":56,"tag":84,"props":482,"children":483},{"style":91},[484],{"type":62,"value":485}," \u002F\u002F e.g. { id: string; name: string; role: string }\n",{"type":56,"tag":84,"props":487,"children":489},{"class":86,"line":488},11,[490],{"type":56,"tag":84,"props":491,"children":492},{"style":107},[493],{"type":62,"value":494},"    }\n",{"type":56,"tag":84,"props":496,"children":498},{"class":86,"line":497},12,[499,504],{"type":56,"tag":84,"props":500,"children":501},{"style":101},[502],{"type":62,"value":503},"    return",{"type":56,"tag":84,"props":505,"children":506},{"style":107},[507],{"type":62,"value":508}," null;\n",{"type":56,"tag":84,"props":510,"children":512},{"class":86,"line":511},13,[513],{"type":56,"tag":84,"props":514,"children":515},{"style":107},[516],{"type":62,"value":517},"  }\n",{"type":56,"tag":84,"props":519,"children":521},{"class":86,"line":520},14,[522,527,531,535,540,544,548,553],{"type":56,"tag":84,"props":523,"children":524},{"style":101},[525],{"type":62,"value":526},"  return",{"type":56,"tag":84,"props":528,"children":529},{"style":107},[530],{"type":62,"value":110},{"type":56,"tag":84,"props":532,"children":533},{"style":353},[534],{"type":62,"value":427},{"type":56,"tag":84,"props":536,"children":537},{"style":107},[538],{"type":62,"value":539},":",{"type":56,"tag":84,"props":541,"children":542},{"style":101},[543],{"type":62,"value":436},{"type":56,"tag":84,"props":545,"children":546},{"style":237},[547],{"type":62,"value":289},{"type":56,"tag":84,"props":549,"children":550},{"style":353},[551],{"type":62,"value":552},"() ",{"type":56,"tag":84,"props":554,"children":555},{"style":107},[556],{"type":62,"value":557},"};\n",{"type":56,"tag":84,"props":559,"children":561},{"class":86,"line":560},15,[562],{"type":56,"tag":84,"props":563,"children":564},{"style":107},[565],{"type":62,"value":566},"}\n",{"type":56,"tag":84,"props":568,"children":570},{"class":86,"line":569},16,[571],{"type":56,"tag":84,"props":572,"children":573},{"emptyLinePlaceholder":211},[574],{"type":62,"value":214},{"type":56,"tag":84,"props":576,"children":578},{"class":86,"line":577},17,[579,583,587,592,596,601,606,611,616,620],{"type":56,"tag":84,"props":580,"children":581},{"style":101},[582],{"type":62,"value":223},{"type":56,"tag":84,"props":584,"children":585},{"style":226},[586],{"type":62,"value":170},{"type":56,"tag":84,"props":588,"children":589},{"style":259},[590],{"type":62,"value":591}," Context",{"type":56,"tag":84,"props":593,"children":594},{"style":107},[595],{"type":62,"value":317},{"type":56,"tag":84,"props":597,"children":598},{"style":259},[599],{"type":62,"value":600}," Awaited",{"type":56,"tag":84,"props":602,"children":603},{"style":107},[604],{"type":62,"value":605},"\u003C",{"type":56,"tag":84,"props":607,"children":608},{"style":259},[609],{"type":62,"value":610},"ReturnType",{"type":56,"tag":84,"props":612,"children":613},{"style":107},[614],{"type":62,"value":615},"\u003Ctypeof",{"type":56,"tag":84,"props":617,"children":618},{"style":113},[619],{"type":62,"value":240},{"type":56,"tag":84,"props":621,"children":622},{"style":107},[623],{"type":62,"value":624},">>;\n",{"type":56,"tag":84,"props":626,"children":628},{"class":86,"line":627},18,[629],{"type":56,"tag":84,"props":630,"children":631},{"emptyLinePlaceholder":211},[632],{"type":62,"value":214},{"type":56,"tag":84,"props":634,"children":636},{"class":86,"line":635},19,[637,642,647,652,656,660,665,669,674,679,683,687,692,696],{"type":56,"tag":84,"props":638,"children":639},{"style":226},[640],{"type":62,"value":641},"const",{"type":56,"tag":84,"props":643,"children":644},{"style":113},[645],{"type":62,"value":646}," t ",{"type":56,"tag":84,"props":648,"children":649},{"style":107},[650],{"type":62,"value":651},"=",{"type":56,"tag":84,"props":653,"children":654},{"style":113},[655],{"type":62,"value":116},{"type":56,"tag":84,"props":657,"children":658},{"style":107},[659],{"type":62,"value":326},{"type":56,"tag":84,"props":661,"children":662},{"style":237},[663],{"type":62,"value":664},"context",{"type":56,"tag":84,"props":666,"children":667},{"style":107},[668],{"type":62,"value":605},{"type":56,"tag":84,"props":670,"children":671},{"style":259},[672],{"type":62,"value":673},"Context",{"type":56,"tag":84,"props":675,"children":676},{"style":107},[677],{"type":62,"value":678},">",{"type":56,"tag":84,"props":680,"children":681},{"style":113},[682],{"type":62,"value":294},{"type":56,"tag":84,"props":684,"children":685},{"style":107},[686],{"type":62,"value":326},{"type":56,"tag":84,"props":688,"children":689},{"style":237},[690],{"type":62,"value":691},"create",{"type":56,"tag":84,"props":693,"children":694},{"style":113},[695],{"type":62,"value":294},{"type":56,"tag":84,"props":697,"children":698},{"style":107},[699],{"type":62,"value":157},{"type":56,"tag":84,"props":701,"children":703},{"class":86,"line":702},20,[704],{"type":56,"tag":84,"props":705,"children":706},{"emptyLinePlaceholder":211},[707],{"type":62,"value":214},{"type":56,"tag":84,"props":709,"children":711},{"class":86,"line":710},21,[712,716,721,726,730,735,739,744],{"type":56,"tag":84,"props":713,"children":714},{"style":101},[715],{"type":62,"value":223},{"type":56,"tag":84,"props":717,"children":718},{"style":226},[719],{"type":62,"value":720}," const",{"type":56,"tag":84,"props":722,"children":723},{"style":113},[724],{"type":62,"value":725}," publicProcedure ",{"type":56,"tag":84,"props":727,"children":728},{"style":107},[729],{"type":62,"value":651},{"type":56,"tag":84,"props":731,"children":732},{"style":113},[733],{"type":62,"value":734}," t",{"type":56,"tag":84,"props":736,"children":737},{"style":107},[738],{"type":62,"value":326},{"type":56,"tag":84,"props":740,"children":741},{"style":113},[742],{"type":62,"value":743},"procedure",{"type":56,"tag":84,"props":745,"children":746},{"style":107},[747],{"type":62,"value":157},{"type":56,"tag":84,"props":749,"children":751},{"class":86,"line":750},22,[752],{"type":56,"tag":84,"props":753,"children":754},{"emptyLinePlaceholder":211},[755],{"type":62,"value":214},{"type":56,"tag":84,"props":757,"children":759},{"class":86,"line":758},23,[760,764,768,773,777,781,785,789,793,798],{"type":56,"tag":84,"props":761,"children":762},{"style":101},[763],{"type":62,"value":223},{"type":56,"tag":84,"props":765,"children":766},{"style":226},[767],{"type":62,"value":720},{"type":56,"tag":84,"props":769,"children":770},{"style":113},[771],{"type":62,"value":772}," protectedProcedure ",{"type":56,"tag":84,"props":774,"children":775},{"style":107},[776],{"type":62,"value":651},{"type":56,"tag":84,"props":778,"children":779},{"style":113},[780],{"type":62,"value":734},{"type":56,"tag":84,"props":782,"children":783},{"style":107},[784],{"type":62,"value":326},{"type":56,"tag":84,"props":786,"children":787},{"style":113},[788],{"type":62,"value":743},{"type":56,"tag":84,"props":790,"children":791},{"style":107},[792],{"type":62,"value":326},{"type":56,"tag":84,"props":794,"children":795},{"style":237},[796],{"type":62,"value":797},"use",{"type":56,"tag":84,"props":799,"children":800},{"style":113},[801],{"type":62,"value":802},"(\n",{"type":56,"tag":84,"props":804,"children":806},{"class":86,"line":805},24,[807,811,815,820,824,829,833],{"type":56,"tag":84,"props":808,"children":809},{"style":226},[810],{"type":62,"value":280},{"type":56,"tag":84,"props":812,"children":813},{"style":226},[814],{"type":62,"value":234},{"type":56,"tag":84,"props":816,"children":817},{"style":237},[818],{"type":62,"value":819}," isAuthed",{"type":56,"tag":84,"props":821,"children":822},{"style":107},[823],{"type":62,"value":356},{"type":56,"tag":84,"props":825,"children":826},{"style":248},[827],{"type":62,"value":828},"opts",{"type":56,"tag":84,"props":830,"children":831},{"style":107},[832],{"type":62,"value":266},{"type":56,"tag":84,"props":834,"children":835},{"style":107},[836],{"type":62,"value":271},{"type":56,"tag":84,"props":838,"children":840},{"class":86,"line":839},25,[841,845,849,854,858,862,867],{"type":56,"tag":84,"props":842,"children":843},{"style":226},[844],{"type":62,"value":307},{"type":56,"tag":84,"props":846,"children":847},{"style":107},[848],{"type":62,"value":110},{"type":56,"tag":84,"props":850,"children":851},{"style":113},[852],{"type":62,"value":853}," ctx",{"type":56,"tag":84,"props":855,"children":856},{"style":107},[857],{"type":62,"value":131},{"type":56,"tag":84,"props":859,"children":860},{"style":107},[861],{"type":62,"value":317},{"type":56,"tag":84,"props":863,"children":864},{"style":113},[865],{"type":62,"value":866}," opts",{"type":56,"tag":84,"props":868,"children":869},{"style":107},[870],{"type":62,"value":157},{"type":56,"tag":84,"props":872,"children":874},{"class":86,"line":873},26,[875,879,883,888,893,897,902,906],{"type":56,"tag":84,"props":876,"children":877},{"style":101},[878],{"type":62,"value":393},{"type":56,"tag":84,"props":880,"children":881},{"style":353},[882],{"type":62,"value":398},{"type":56,"tag":84,"props":884,"children":885},{"style":107},[886],{"type":62,"value":887},"!",{"type":56,"tag":84,"props":889,"children":890},{"style":113},[891],{"type":62,"value":892},"ctx",{"type":56,"tag":84,"props":894,"children":895},{"style":107},[896],{"type":62,"value":326},{"type":56,"tag":84,"props":898,"children":899},{"style":113},[900],{"type":62,"value":901},"user",{"type":56,"tag":84,"props":903,"children":904},{"style":353},[905],{"type":62,"value":408},{"type":56,"tag":84,"props":907,"children":908},{"style":107},[909],{"type":62,"value":413},{"type":56,"tag":84,"props":911,"children":913},{"class":86,"line":912},27,[914,919,924,928,932,937,942,946,950,955,959,963,967],{"type":56,"tag":84,"props":915,"children":916},{"style":101},[917],{"type":62,"value":918},"      throw",{"type":56,"tag":84,"props":920,"children":921},{"style":107},[922],{"type":62,"value":923}," new",{"type":56,"tag":84,"props":925,"children":926},{"style":237},[927],{"type":62,"value":126},{"type":56,"tag":84,"props":929,"children":930},{"style":353},[931],{"type":62,"value":356},{"type":56,"tag":84,"props":933,"children":934},{"style":107},[935],{"type":62,"value":936},"{",{"type":56,"tag":84,"props":938,"children":939},{"style":353},[940],{"type":62,"value":941}," code",{"type":56,"tag":84,"props":943,"children":944},{"style":107},[945],{"type":62,"value":539},{"type":56,"tag":84,"props":947,"children":948},{"style":107},[949],{"type":62,"value":141},{"type":56,"tag":84,"props":951,"children":952},{"style":144},[953],{"type":62,"value":954},"UNAUTHORIZED",{"type":56,"tag":84,"props":956,"children":957},{"style":107},[958],{"type":62,"value":152},{"type":56,"tag":84,"props":960,"children":961},{"style":107},[962],{"type":62,"value":131},{"type":56,"tag":84,"props":964,"children":965},{"style":353},[966],{"type":62,"value":266},{"type":56,"tag":84,"props":968,"children":969},{"style":107},[970],{"type":62,"value":157},{"type":56,"tag":84,"props":972,"children":974},{"class":86,"line":973},28,[975],{"type":56,"tag":84,"props":976,"children":977},{"style":107},[978],{"type":62,"value":494},{"type":56,"tag":84,"props":980,"children":982},{"class":86,"line":981},29,[983,987,991,995,999,1003],{"type":56,"tag":84,"props":984,"children":985},{"style":101},[986],{"type":62,"value":503},{"type":56,"tag":84,"props":988,"children":989},{"style":113},[990],{"type":62,"value":866},{"type":56,"tag":84,"props":992,"children":993},{"style":107},[994],{"type":62,"value":326},{"type":56,"tag":84,"props":996,"children":997},{"style":237},[998],{"type":62,"value":29},{"type":56,"tag":84,"props":1000,"children":1001},{"style":353},[1002],{"type":62,"value":356},{"type":56,"tag":84,"props":1004,"children":1005},{"style":107},[1006],{"type":62,"value":413},{"type":56,"tag":84,"props":1008,"children":1010},{"class":86,"line":1009},30,[1011,1016,1020],{"type":56,"tag":84,"props":1012,"children":1013},{"style":353},[1014],{"type":62,"value":1015},"      ctx",{"type":56,"tag":84,"props":1017,"children":1018},{"style":107},[1019],{"type":62,"value":539},{"type":56,"tag":84,"props":1021,"children":1022},{"style":107},[1023],{"type":62,"value":271},{"type":56,"tag":84,"props":1025,"children":1027},{"class":86,"line":1026},31,[1028,1033,1037,1041,1045,1049,1053],{"type":56,"tag":84,"props":1029,"children":1030},{"style":353},[1031],{"type":62,"value":1032},"        user",{"type":56,"tag":84,"props":1034,"children":1035},{"style":107},[1036],{"type":62,"value":539},{"type":56,"tag":84,"props":1038,"children":1039},{"style":113},[1040],{"type":62,"value":853},{"type":56,"tag":84,"props":1042,"children":1043},{"style":107},[1044],{"type":62,"value":326},{"type":56,"tag":84,"props":1046,"children":1047},{"style":113},[1048],{"type":62,"value":901},{"type":56,"tag":84,"props":1050,"children":1051},{"style":107},[1052],{"type":62,"value":121},{"type":56,"tag":84,"props":1054,"children":1055},{"style":91},[1056],{"type":62,"value":1057}," \u002F\u002F narrows user to non-null\n",{"type":56,"tag":84,"props":1059,"children":1061},{"class":86,"line":1060},32,[1062],{"type":56,"tag":84,"props":1063,"children":1064},{"style":107},[1065],{"type":62,"value":1066},"      },\n",{"type":56,"tag":84,"props":1068,"children":1070},{"class":86,"line":1069},33,[1071,1076,1080],{"type":56,"tag":84,"props":1072,"children":1073},{"style":107},[1074],{"type":62,"value":1075},"    }",{"type":56,"tag":84,"props":1077,"children":1078},{"style":353},[1079],{"type":62,"value":266},{"type":56,"tag":84,"props":1081,"children":1082},{"style":107},[1083],{"type":62,"value":157},{"type":56,"tag":84,"props":1085,"children":1087},{"class":86,"line":1086},34,[1088],{"type":56,"tag":84,"props":1089,"children":1090},{"style":107},[1091],{"type":62,"value":1092},"  },\n",{"type":56,"tag":84,"props":1094,"children":1096},{"class":86,"line":1095},35,[1097,1101],{"type":56,"tag":84,"props":1098,"children":1099},{"style":113},[1100],{"type":62,"value":266},{"type":56,"tag":84,"props":1102,"children":1103},{"style":107},[1104],{"type":62,"value":157},{"type":56,"tag":84,"props":1106,"children":1108},{"class":86,"line":1107},36,[1109],{"type":56,"tag":84,"props":1110,"children":1111},{"emptyLinePlaceholder":211},[1112],{"type":62,"value":214},{"type":56,"tag":84,"props":1114,"children":1116},{"class":86,"line":1115},37,[1117,1121,1125,1130,1134,1138,1142,1147],{"type":56,"tag":84,"props":1118,"children":1119},{"style":101},[1120],{"type":62,"value":223},{"type":56,"tag":84,"props":1122,"children":1123},{"style":226},[1124],{"type":62,"value":720},{"type":56,"tag":84,"props":1126,"children":1127},{"style":113},[1128],{"type":62,"value":1129}," router ",{"type":56,"tag":84,"props":1131,"children":1132},{"style":107},[1133],{"type":62,"value":651},{"type":56,"tag":84,"props":1135,"children":1136},{"style":113},[1137],{"type":62,"value":734},{"type":56,"tag":84,"props":1139,"children":1140},{"style":107},[1141],{"type":62,"value":326},{"type":56,"tag":84,"props":1143,"children":1144},{"style":113},[1145],{"type":62,"value":1146},"router",{"type":56,"tag":84,"props":1148,"children":1149},{"style":107},[1150],{"type":62,"value":157},{"type":56,"tag":72,"props":1152,"children":1154},{"className":74,"code":1153,"language":76,"meta":77,"style":77},"\u002F\u002F client\u002Ftrpc.ts\nimport { createTRPCClient, httpBatchLink } from '@trpc\u002Fclient';\nimport type { AppRouter } from '..\u002Fserver\u002Frouter';\n\nlet token = '';\nexport function setToken(t: string) {\n  token = t;\n}\n\nexport const trpc = createTRPCClient\u003CAppRouter>({\n  links: [\n    httpBatchLink({\n      url: 'http:\u002F\u002Flocalhost:3000\u002Ftrpc',\n      headers() {\n        return { Authorization: `Bearer ${token}` };\n      },\n    }),\n  ],\n});\n",[1155],{"type":56,"tag":80,"props":1156,"children":1157},{"__ignoreMap":77},[1158,1166,1216,1261,1268,1294,1336,1356,1363,1370,1415,1432,1448,1478,1494,1544,1551,1566,1578],{"type":56,"tag":84,"props":1159,"children":1160},{"class":86,"line":87},[1161],{"type":56,"tag":84,"props":1162,"children":1163},{"style":91},[1164],{"type":62,"value":1165},"\u002F\u002F client\u002Ftrpc.ts\n",{"type":56,"tag":84,"props":1167,"children":1168},{"class":86,"line":97},[1169,1173,1177,1182,1186,1191,1195,1199,1203,1208,1212],{"type":56,"tag":84,"props":1170,"children":1171},{"style":101},[1172],{"type":62,"value":104},{"type":56,"tag":84,"props":1174,"children":1175},{"style":107},[1176],{"type":62,"value":110},{"type":56,"tag":84,"props":1178,"children":1179},{"style":113},[1180],{"type":62,"value":1181}," createTRPCClient",{"type":56,"tag":84,"props":1183,"children":1184},{"style":107},[1185],{"type":62,"value":121},{"type":56,"tag":84,"props":1187,"children":1188},{"style":113},[1189],{"type":62,"value":1190}," httpBatchLink",{"type":56,"tag":84,"props":1192,"children":1193},{"style":107},[1194],{"type":62,"value":131},{"type":56,"tag":84,"props":1196,"children":1197},{"style":101},[1198],{"type":62,"value":136},{"type":56,"tag":84,"props":1200,"children":1201},{"style":107},[1202],{"type":62,"value":141},{"type":56,"tag":84,"props":1204,"children":1205},{"style":144},[1206],{"type":62,"value":1207},"@trpc\u002Fclient",{"type":56,"tag":84,"props":1209,"children":1210},{"style":107},[1211],{"type":62,"value":152},{"type":56,"tag":84,"props":1213,"children":1214},{"style":107},[1215],{"type":62,"value":157},{"type":56,"tag":84,"props":1217,"children":1218},{"class":86,"line":160},[1219,1223,1227,1231,1236,1240,1244,1248,1253,1257],{"type":56,"tag":84,"props":1220,"children":1221},{"style":101},[1222],{"type":62,"value":104},{"type":56,"tag":84,"props":1224,"children":1225},{"style":101},[1226],{"type":62,"value":170},{"type":56,"tag":84,"props":1228,"children":1229},{"style":107},[1230],{"type":62,"value":110},{"type":56,"tag":84,"props":1232,"children":1233},{"style":113},[1234],{"type":62,"value":1235}," AppRouter",{"type":56,"tag":84,"props":1237,"children":1238},{"style":107},[1239],{"type":62,"value":131},{"type":56,"tag":84,"props":1241,"children":1242},{"style":101},[1243],{"type":62,"value":136},{"type":56,"tag":84,"props":1245,"children":1246},{"style":107},[1247],{"type":62,"value":141},{"type":56,"tag":84,"props":1249,"children":1250},{"style":144},[1251],{"type":62,"value":1252},"..\u002Fserver\u002Frouter",{"type":56,"tag":84,"props":1254,"children":1255},{"style":107},[1256],{"type":62,"value":152},{"type":56,"tag":84,"props":1258,"children":1259},{"style":107},[1260],{"type":62,"value":157},{"type":56,"tag":84,"props":1262,"children":1263},{"class":86,"line":207},[1264],{"type":56,"tag":84,"props":1265,"children":1266},{"emptyLinePlaceholder":211},[1267],{"type":62,"value":214},{"type":56,"tag":84,"props":1269,"children":1270},{"class":86,"line":217},[1271,1276,1281,1285,1290],{"type":56,"tag":84,"props":1272,"children":1273},{"style":226},[1274],{"type":62,"value":1275},"let",{"type":56,"tag":84,"props":1277,"children":1278},{"style":113},[1279],{"type":62,"value":1280}," token ",{"type":56,"tag":84,"props":1282,"children":1283},{"style":107},[1284],{"type":62,"value":651},{"type":56,"tag":84,"props":1286,"children":1287},{"style":107},[1288],{"type":62,"value":1289}," ''",{"type":56,"tag":84,"props":1291,"children":1292},{"style":107},[1293],{"type":62,"value":157},{"type":56,"tag":84,"props":1295,"children":1296},{"class":86,"line":274},[1297,1301,1305,1310,1314,1319,1323,1328,1332],{"type":56,"tag":84,"props":1298,"children":1299},{"style":101},[1300],{"type":62,"value":223},{"type":56,"tag":84,"props":1302,"children":1303},{"style":226},[1304],{"type":62,"value":234},{"type":56,"tag":84,"props":1306,"children":1307},{"style":237},[1308],{"type":62,"value":1309}," setToken",{"type":56,"tag":84,"props":1311,"children":1312},{"style":107},[1313],{"type":62,"value":356},{"type":56,"tag":84,"props":1315,"children":1316},{"style":248},[1317],{"type":62,"value":1318},"t",{"type":56,"tag":84,"props":1320,"children":1321},{"style":107},[1322],{"type":62,"value":539},{"type":56,"tag":84,"props":1324,"children":1325},{"style":259},[1326],{"type":62,"value":1327}," string",{"type":56,"tag":84,"props":1329,"children":1330},{"style":107},[1331],{"type":62,"value":266},{"type":56,"tag":84,"props":1333,"children":1334},{"style":107},[1335],{"type":62,"value":271},{"type":56,"tag":84,"props":1337,"children":1338},{"class":86,"line":301},[1339,1344,1348,1352],{"type":56,"tag":84,"props":1340,"children":1341},{"style":113},[1342],{"type":62,"value":1343},"  token",{"type":56,"tag":84,"props":1345,"children":1346},{"style":107},[1347],{"type":62,"value":317},{"type":56,"tag":84,"props":1349,"children":1350},{"style":113},[1351],{"type":62,"value":734},{"type":56,"tag":84,"props":1353,"children":1354},{"style":107},[1355],{"type":62,"value":157},{"type":56,"tag":84,"props":1357,"children":1358},{"class":86,"line":387},[1359],{"type":56,"tag":84,"props":1360,"children":1361},{"style":107},[1362],{"type":62,"value":566},{"type":56,"tag":84,"props":1364,"children":1365},{"class":86,"line":416},[1366],{"type":56,"tag":84,"props":1367,"children":1368},{"emptyLinePlaceholder":211},[1369],{"type":62,"value":214},{"type":56,"tag":84,"props":1371,"children":1372},{"class":86,"line":466},[1373,1377,1381,1386,1390,1394,1398,1403,1407,1411],{"type":56,"tag":84,"props":1374,"children":1375},{"style":101},[1376],{"type":62,"value":223},{"type":56,"tag":84,"props":1378,"children":1379},{"style":226},[1380],{"type":62,"value":720},{"type":56,"tag":84,"props":1382,"children":1383},{"style":113},[1384],{"type":62,"value":1385}," trpc ",{"type":56,"tag":84,"props":1387,"children":1388},{"style":107},[1389],{"type":62,"value":651},{"type":56,"tag":84,"props":1391,"children":1392},{"style":237},[1393],{"type":62,"value":1181},{"type":56,"tag":84,"props":1395,"children":1396},{"style":107},[1397],{"type":62,"value":605},{"type":56,"tag":84,"props":1399,"children":1400},{"style":259},[1401],{"type":62,"value":1402},"AppRouter",{"type":56,"tag":84,"props":1404,"children":1405},{"style":107},[1406],{"type":62,"value":678},{"type":56,"tag":84,"props":1408,"children":1409},{"style":113},[1410],{"type":62,"value":356},{"type":56,"tag":84,"props":1412,"children":1413},{"style":107},[1414],{"type":62,"value":413},{"type":56,"tag":84,"props":1416,"children":1417},{"class":86,"line":488},[1418,1423,1427],{"type":56,"tag":84,"props":1419,"children":1420},{"style":353},[1421],{"type":62,"value":1422},"  links",{"type":56,"tag":84,"props":1424,"children":1425},{"style":107},[1426],{"type":62,"value":539},{"type":56,"tag":84,"props":1428,"children":1429},{"style":113},[1430],{"type":62,"value":1431}," [\n",{"type":56,"tag":84,"props":1433,"children":1434},{"class":86,"line":497},[1435,1440,1444],{"type":56,"tag":84,"props":1436,"children":1437},{"style":237},[1438],{"type":62,"value":1439},"    httpBatchLink",{"type":56,"tag":84,"props":1441,"children":1442},{"style":113},[1443],{"type":62,"value":356},{"type":56,"tag":84,"props":1445,"children":1446},{"style":107},[1447],{"type":62,"value":413},{"type":56,"tag":84,"props":1449,"children":1450},{"class":86,"line":511},[1451,1456,1460,1464,1469,1473],{"type":56,"tag":84,"props":1452,"children":1453},{"style":353},[1454],{"type":62,"value":1455},"      url",{"type":56,"tag":84,"props":1457,"children":1458},{"style":107},[1459],{"type":62,"value":539},{"type":56,"tag":84,"props":1461,"children":1462},{"style":107},[1463],{"type":62,"value":141},{"type":56,"tag":84,"props":1465,"children":1466},{"style":144},[1467],{"type":62,"value":1468},"http:\u002F\u002Flocalhost:3000\u002Ftrpc",{"type":56,"tag":84,"props":1470,"children":1471},{"style":107},[1472],{"type":62,"value":152},{"type":56,"tag":84,"props":1474,"children":1475},{"style":107},[1476],{"type":62,"value":1477},",\n",{"type":56,"tag":84,"props":1479,"children":1480},{"class":86,"line":520},[1481,1486,1490],{"type":56,"tag":84,"props":1482,"children":1483},{"style":353},[1484],{"type":62,"value":1485},"      headers",{"type":56,"tag":84,"props":1487,"children":1488},{"style":107},[1489],{"type":62,"value":294},{"type":56,"tag":84,"props":1491,"children":1492},{"style":107},[1493],{"type":62,"value":271},{"type":56,"tag":84,"props":1495,"children":1496},{"class":86,"line":560},[1497,1502,1506,1511,1515,1520,1525,1530,1534,1539],{"type":56,"tag":84,"props":1498,"children":1499},{"style":101},[1500],{"type":62,"value":1501},"        return",{"type":56,"tag":84,"props":1503,"children":1504},{"style":107},[1505],{"type":62,"value":110},{"type":56,"tag":84,"props":1507,"children":1508},{"style":353},[1509],{"type":62,"value":1510}," Authorization",{"type":56,"tag":84,"props":1512,"children":1513},{"style":107},[1514],{"type":62,"value":539},{"type":56,"tag":84,"props":1516,"children":1517},{"style":107},[1518],{"type":62,"value":1519}," `",{"type":56,"tag":84,"props":1521,"children":1522},{"style":144},[1523],{"type":62,"value":1524},"Bearer ",{"type":56,"tag":84,"props":1526,"children":1527},{"style":107},[1528],{"type":62,"value":1529},"${",{"type":56,"tag":84,"props":1531,"children":1532},{"style":113},[1533],{"type":62,"value":403},{"type":56,"tag":84,"props":1535,"children":1536},{"style":107},[1537],{"type":62,"value":1538},"}`",{"type":56,"tag":84,"props":1540,"children":1541},{"style":107},[1542],{"type":62,"value":1543}," };\n",{"type":56,"tag":84,"props":1545,"children":1546},{"class":86,"line":569},[1547],{"type":56,"tag":84,"props":1548,"children":1549},{"style":107},[1550],{"type":62,"value":1066},{"type":56,"tag":84,"props":1552,"children":1553},{"class":86,"line":577},[1554,1558,1562],{"type":56,"tag":84,"props":1555,"children":1556},{"style":107},[1557],{"type":62,"value":1075},{"type":56,"tag":84,"props":1559,"children":1560},{"style":113},[1561],{"type":62,"value":266},{"type":56,"tag":84,"props":1563,"children":1564},{"style":107},[1565],{"type":62,"value":1477},{"type":56,"tag":84,"props":1567,"children":1568},{"class":86,"line":627},[1569,1574],{"type":56,"tag":84,"props":1570,"children":1571},{"style":113},[1572],{"type":62,"value":1573},"  ]",{"type":56,"tag":84,"props":1575,"children":1576},{"style":107},[1577],{"type":62,"value":1477},{"type":56,"tag":84,"props":1579,"children":1580},{"class":86,"line":635},[1581,1586,1590],{"type":56,"tag":84,"props":1582,"children":1583},{"style":107},[1584],{"type":62,"value":1585},"}",{"type":56,"tag":84,"props":1587,"children":1588},{"style":113},[1589],{"type":62,"value":266},{"type":56,"tag":84,"props":1591,"children":1592},{"style":107},[1593],{"type":62,"value":157},{"type":56,"tag":65,"props":1595,"children":1597},{"id":1596},"core-patterns",[1598],{"type":62,"value":1599},"Core Patterns",{"type":56,"tag":1601,"props":1602,"children":1604},"h3",{"id":1603},"context-narrowing-with-auth-middleware",[1605],{"type":62,"value":1606},"Context narrowing with auth middleware",{"type":56,"tag":72,"props":1608,"children":1610},{"className":74,"code":1609,"language":76,"meta":77,"style":77},"import { initTRPC, TRPCError } from '@trpc\u002Fserver';\n\ntype Context = { user: { id: string; role: string } | null };\nconst t = initTRPC.context\u003CContext>().create();\n\nconst isAuthed = t.middleware(async ({ ctx, next }) => {\n  if (!ctx.user) {\n    throw new TRPCError({ code: 'UNAUTHORIZED' });\n  }\n  return next({ ctx: { user: ctx.user } });\n});\n\nconst isAdmin = t.middleware(async ({ ctx, next }) => {\n  if (!ctx.user || ctx.user.role !== 'admin') {\n    throw new TRPCError({ code: 'FORBIDDEN' });\n  }\n  return next({ ctx: { user: ctx.user } });\n});\n\nexport const protectedProcedure = t.procedure.use(isAuthed);\nexport const adminProcedure = t.procedure.use(isAdmin);\n",[1611],{"type":56,"tag":80,"props":1612,"children":1613},{"__ignoreMap":77},[1614,1661,1668,1748,1807,1814,1884,1920,1976,1983,2050,2065,2072,2136,2215,2271,2278,2345,2360,2367,2415],{"type":56,"tag":84,"props":1615,"children":1616},{"class":86,"line":87},[1617,1621,1625,1629,1633,1637,1641,1645,1649,1653,1657],{"type":56,"tag":84,"props":1618,"children":1619},{"style":101},[1620],{"type":62,"value":104},{"type":56,"tag":84,"props":1622,"children":1623},{"style":107},[1624],{"type":62,"value":110},{"type":56,"tag":84,"props":1626,"children":1627},{"style":113},[1628],{"type":62,"value":116},{"type":56,"tag":84,"props":1630,"children":1631},{"style":107},[1632],{"type":62,"value":121},{"type":56,"tag":84,"props":1634,"children":1635},{"style":113},[1636],{"type":62,"value":126},{"type":56,"tag":84,"props":1638,"children":1639},{"style":107},[1640],{"type":62,"value":131},{"type":56,"tag":84,"props":1642,"children":1643},{"style":101},[1644],{"type":62,"value":136},{"type":56,"tag":84,"props":1646,"children":1647},{"style":107},[1648],{"type":62,"value":141},{"type":56,"tag":84,"props":1650,"children":1651},{"style":144},[1652],{"type":62,"value":147},{"type":56,"tag":84,"props":1654,"children":1655},{"style":107},[1656],{"type":62,"value":152},{"type":56,"tag":84,"props":1658,"children":1659},{"style":107},[1660],{"type":62,"value":157},{"type":56,"tag":84,"props":1662,"children":1663},{"class":86,"line":97},[1664],{"type":56,"tag":84,"props":1665,"children":1666},{"emptyLinePlaceholder":211},[1667],{"type":62,"value":214},{"type":56,"tag":84,"props":1669,"children":1670},{"class":86,"line":160},[1671,1676,1680,1684,1688,1692,1696,1700,1705,1709,1713,1717,1722,1726,1730,1734,1739,1744],{"type":56,"tag":84,"props":1672,"children":1673},{"style":226},[1674],{"type":62,"value":1675},"type",{"type":56,"tag":84,"props":1677,"children":1678},{"style":259},[1679],{"type":62,"value":591},{"type":56,"tag":84,"props":1681,"children":1682},{"style":107},[1683],{"type":62,"value":317},{"type":56,"tag":84,"props":1685,"children":1686},{"style":107},[1687],{"type":62,"value":110},{"type":56,"tag":84,"props":1689,"children":1690},{"style":353},[1691],{"type":62,"value":427},{"type":56,"tag":84,"props":1693,"children":1694},{"style":107},[1695],{"type":62,"value":539},{"type":56,"tag":84,"props":1697,"children":1698},{"style":107},[1699],{"type":62,"value":110},{"type":56,"tag":84,"props":1701,"children":1702},{"style":353},[1703],{"type":62,"value":1704}," id",{"type":56,"tag":84,"props":1706,"children":1707},{"style":107},[1708],{"type":62,"value":539},{"type":56,"tag":84,"props":1710,"children":1711},{"style":259},[1712],{"type":62,"value":1327},{"type":56,"tag":84,"props":1714,"children":1715},{"style":107},[1716],{"type":62,"value":458},{"type":56,"tag":84,"props":1718,"children":1719},{"style":353},[1720],{"type":62,"value":1721}," role",{"type":56,"tag":84,"props":1723,"children":1724},{"style":107},[1725],{"type":62,"value":539},{"type":56,"tag":84,"props":1727,"children":1728},{"style":259},[1729],{"type":62,"value":1327},{"type":56,"tag":84,"props":1731,"children":1732},{"style":107},[1733],{"type":62,"value":131},{"type":56,"tag":84,"props":1735,"children":1736},{"style":107},[1737],{"type":62,"value":1738}," |",{"type":56,"tag":84,"props":1740,"children":1741},{"style":259},[1742],{"type":62,"value":1743}," null",{"type":56,"tag":84,"props":1745,"children":1746},{"style":107},[1747],{"type":62,"value":1543},{"type":56,"tag":84,"props":1749,"children":1750},{"class":86,"line":207},[1751,1755,1759,1763,1767,1771,1775,1779,1783,1787,1791,1795,1799,1803],{"type":56,"tag":84,"props":1752,"children":1753},{"style":226},[1754],{"type":62,"value":641},{"type":56,"tag":84,"props":1756,"children":1757},{"style":113},[1758],{"type":62,"value":646},{"type":56,"tag":84,"props":1760,"children":1761},{"style":107},[1762],{"type":62,"value":651},{"type":56,"tag":84,"props":1764,"children":1765},{"style":113},[1766],{"type":62,"value":116},{"type":56,"tag":84,"props":1768,"children":1769},{"style":107},[1770],{"type":62,"value":326},{"type":56,"tag":84,"props":1772,"children":1773},{"style":237},[1774],{"type":62,"value":664},{"type":56,"tag":84,"props":1776,"children":1777},{"style":107},[1778],{"type":62,"value":605},{"type":56,"tag":84,"props":1780,"children":1781},{"style":259},[1782],{"type":62,"value":673},{"type":56,"tag":84,"props":1784,"children":1785},{"style":107},[1786],{"type":62,"value":678},{"type":56,"tag":84,"props":1788,"children":1789},{"style":113},[1790],{"type":62,"value":294},{"type":56,"tag":84,"props":1792,"children":1793},{"style":107},[1794],{"type":62,"value":326},{"type":56,"tag":84,"props":1796,"children":1797},{"style":237},[1798],{"type":62,"value":691},{"type":56,"tag":84,"props":1800,"children":1801},{"style":113},[1802],{"type":62,"value":294},{"type":56,"tag":84,"props":1804,"children":1805},{"style":107},[1806],{"type":62,"value":157},{"type":56,"tag":84,"props":1808,"children":1809},{"class":86,"line":217},[1810],{"type":56,"tag":84,"props":1811,"children":1812},{"emptyLinePlaceholder":211},[1813],{"type":62,"value":214},{"type":56,"tag":84,"props":1815,"children":1816},{"class":86,"line":274},[1817,1821,1826,1830,1834,1838,1843,1847,1852,1857,1861,1865,1870,1875,1880],{"type":56,"tag":84,"props":1818,"children":1819},{"style":226},[1820],{"type":62,"value":641},{"type":56,"tag":84,"props":1822,"children":1823},{"style":113},[1824],{"type":62,"value":1825}," isAuthed ",{"type":56,"tag":84,"props":1827,"children":1828},{"style":107},[1829],{"type":62,"value":651},{"type":56,"tag":84,"props":1831,"children":1832},{"style":113},[1833],{"type":62,"value":734},{"type":56,"tag":84,"props":1835,"children":1836},{"style":107},[1837],{"type":62,"value":326},{"type":56,"tag":84,"props":1839,"children":1840},{"style":237},[1841],{"type":62,"value":1842},"middleware",{"type":56,"tag":84,"props":1844,"children":1845},{"style":113},[1846],{"type":62,"value":356},{"type":56,"tag":84,"props":1848,"children":1849},{"style":226},[1850],{"type":62,"value":1851},"async",{"type":56,"tag":84,"props":1853,"children":1854},{"style":107},[1855],{"type":62,"value":1856}," ({",{"type":56,"tag":84,"props":1858,"children":1859},{"style":248},[1860],{"type":62,"value":853},{"type":56,"tag":84,"props":1862,"children":1863},{"style":107},[1864],{"type":62,"value":121},{"type":56,"tag":84,"props":1866,"children":1867},{"style":248},[1868],{"type":62,"value":1869}," next",{"type":56,"tag":84,"props":1871,"children":1872},{"style":107},[1873],{"type":62,"value":1874}," })",{"type":56,"tag":84,"props":1876,"children":1877},{"style":226},[1878],{"type":62,"value":1879}," =>",{"type":56,"tag":84,"props":1881,"children":1882},{"style":107},[1883],{"type":62,"value":271},{"type":56,"tag":84,"props":1885,"children":1886},{"class":86,"line":301},[1887,1892,1896,1900,1904,1908,1912,1916],{"type":56,"tag":84,"props":1888,"children":1889},{"style":101},[1890],{"type":62,"value":1891},"  if",{"type":56,"tag":84,"props":1893,"children":1894},{"style":353},[1895],{"type":62,"value":398},{"type":56,"tag":84,"props":1897,"children":1898},{"style":107},[1899],{"type":62,"value":887},{"type":56,"tag":84,"props":1901,"children":1902},{"style":113},[1903],{"type":62,"value":892},{"type":56,"tag":84,"props":1905,"children":1906},{"style":107},[1907],{"type":62,"value":326},{"type":56,"tag":84,"props":1909,"children":1910},{"style":113},[1911],{"type":62,"value":901},{"type":56,"tag":84,"props":1913,"children":1914},{"style":353},[1915],{"type":62,"value":408},{"type":56,"tag":84,"props":1917,"children":1918},{"style":107},[1919],{"type":62,"value":413},{"type":56,"tag":84,"props":1921,"children":1922},{"class":86,"line":387},[1923,1928,1932,1936,1940,1944,1948,1952,1956,1960,1964,1968,1972],{"type":56,"tag":84,"props":1924,"children":1925},{"style":101},[1926],{"type":62,"value":1927},"    throw",{"type":56,"tag":84,"props":1929,"children":1930},{"style":107},[1931],{"type":62,"value":923},{"type":56,"tag":84,"props":1933,"children":1934},{"style":237},[1935],{"type":62,"value":126},{"type":56,"tag":84,"props":1937,"children":1938},{"style":353},[1939],{"type":62,"value":356},{"type":56,"tag":84,"props":1941,"children":1942},{"style":107},[1943],{"type":62,"value":936},{"type":56,"tag":84,"props":1945,"children":1946},{"style":353},[1947],{"type":62,"value":941},{"type":56,"tag":84,"props":1949,"children":1950},{"style":107},[1951],{"type":62,"value":539},{"type":56,"tag":84,"props":1953,"children":1954},{"style":107},[1955],{"type":62,"value":141},{"type":56,"tag":84,"props":1957,"children":1958},{"style":144},[1959],{"type":62,"value":954},{"type":56,"tag":84,"props":1961,"children":1962},{"style":107},[1963],{"type":62,"value":152},{"type":56,"tag":84,"props":1965,"children":1966},{"style":107},[1967],{"type":62,"value":131},{"type":56,"tag":84,"props":1969,"children":1970},{"style":353},[1971],{"type":62,"value":266},{"type":56,"tag":84,"props":1973,"children":1974},{"style":107},[1975],{"type":62,"value":157},{"type":56,"tag":84,"props":1977,"children":1978},{"class":86,"line":416},[1979],{"type":56,"tag":84,"props":1980,"children":1981},{"style":107},[1982],{"type":62,"value":517},{"type":56,"tag":84,"props":1984,"children":1985},{"class":86,"line":466},[1986,1990,1994,1998,2002,2006,2010,2014,2018,2022,2026,2030,2034,2038,2042,2046],{"type":56,"tag":84,"props":1987,"children":1988},{"style":101},[1989],{"type":62,"value":526},{"type":56,"tag":84,"props":1991,"children":1992},{"style":237},[1993],{"type":62,"value":1869},{"type":56,"tag":84,"props":1995,"children":1996},{"style":353},[1997],{"type":62,"value":356},{"type":56,"tag":84,"props":1999,"children":2000},{"style":107},[2001],{"type":62,"value":936},{"type":56,"tag":84,"props":2003,"children":2004},{"style":353},[2005],{"type":62,"value":853},{"type":56,"tag":84,"props":2007,"children":2008},{"style":107},[2009],{"type":62,"value":539},{"type":56,"tag":84,"props":2011,"children":2012},{"style":107},[2013],{"type":62,"value":110},{"type":56,"tag":84,"props":2015,"children":2016},{"style":353},[2017],{"type":62,"value":427},{"type":56,"tag":84,"props":2019,"children":2020},{"style":107},[2021],{"type":62,"value":539},{"type":56,"tag":84,"props":2023,"children":2024},{"style":113},[2025],{"type":62,"value":853},{"type":56,"tag":84,"props":2027,"children":2028},{"style":107},[2029],{"type":62,"value":326},{"type":56,"tag":84,"props":2031,"children":2032},{"style":113},[2033],{"type":62,"value":901},{"type":56,"tag":84,"props":2035,"children":2036},{"style":107},[2037],{"type":62,"value":131},{"type":56,"tag":84,"props":2039,"children":2040},{"style":107},[2041],{"type":62,"value":131},{"type":56,"tag":84,"props":2043,"children":2044},{"style":353},[2045],{"type":62,"value":266},{"type":56,"tag":84,"props":2047,"children":2048},{"style":107},[2049],{"type":62,"value":157},{"type":56,"tag":84,"props":2051,"children":2052},{"class":86,"line":488},[2053,2057,2061],{"type":56,"tag":84,"props":2054,"children":2055},{"style":107},[2056],{"type":62,"value":1585},{"type":56,"tag":84,"props":2058,"children":2059},{"style":113},[2060],{"type":62,"value":266},{"type":56,"tag":84,"props":2062,"children":2063},{"style":107},[2064],{"type":62,"value":157},{"type":56,"tag":84,"props":2066,"children":2067},{"class":86,"line":497},[2068],{"type":56,"tag":84,"props":2069,"children":2070},{"emptyLinePlaceholder":211},[2071],{"type":62,"value":214},{"type":56,"tag":84,"props":2073,"children":2074},{"class":86,"line":511},[2075,2079,2084,2088,2092,2096,2100,2104,2108,2112,2116,2120,2124,2128,2132],{"type":56,"tag":84,"props":2076,"children":2077},{"style":226},[2078],{"type":62,"value":641},{"type":56,"tag":84,"props":2080,"children":2081},{"style":113},[2082],{"type":62,"value":2083}," isAdmin ",{"type":56,"tag":84,"props":2085,"children":2086},{"style":107},[2087],{"type":62,"value":651},{"type":56,"tag":84,"props":2089,"children":2090},{"style":113},[2091],{"type":62,"value":734},{"type":56,"tag":84,"props":2093,"children":2094},{"style":107},[2095],{"type":62,"value":326},{"type":56,"tag":84,"props":2097,"children":2098},{"style":237},[2099],{"type":62,"value":1842},{"type":56,"tag":84,"props":2101,"children":2102},{"style":113},[2103],{"type":62,"value":356},{"type":56,"tag":84,"props":2105,"children":2106},{"style":226},[2107],{"type":62,"value":1851},{"type":56,"tag":84,"props":2109,"children":2110},{"style":107},[2111],{"type":62,"value":1856},{"type":56,"tag":84,"props":2113,"children":2114},{"style":248},[2115],{"type":62,"value":853},{"type":56,"tag":84,"props":2117,"children":2118},{"style":107},[2119],{"type":62,"value":121},{"type":56,"tag":84,"props":2121,"children":2122},{"style":248},[2123],{"type":62,"value":1869},{"type":56,"tag":84,"props":2125,"children":2126},{"style":107},[2127],{"type":62,"value":1874},{"type":56,"tag":84,"props":2129,"children":2130},{"style":226},[2131],{"type":62,"value":1879},{"type":56,"tag":84,"props":2133,"children":2134},{"style":107},[2135],{"type":62,"value":271},{"type":56,"tag":84,"props":2137,"children":2138},{"class":86,"line":520},[2139,2143,2147,2151,2155,2159,2163,2168,2172,2176,2180,2184,2189,2194,2198,2203,2207,2211],{"type":56,"tag":84,"props":2140,"children":2141},{"style":101},[2142],{"type":62,"value":1891},{"type":56,"tag":84,"props":2144,"children":2145},{"style":353},[2146],{"type":62,"value":398},{"type":56,"tag":84,"props":2148,"children":2149},{"style":107},[2150],{"type":62,"value":887},{"type":56,"tag":84,"props":2152,"children":2153},{"style":113},[2154],{"type":62,"value":892},{"type":56,"tag":84,"props":2156,"children":2157},{"style":107},[2158],{"type":62,"value":326},{"type":56,"tag":84,"props":2160,"children":2161},{"style":113},[2162],{"type":62,"value":901},{"type":56,"tag":84,"props":2164,"children":2165},{"style":107},[2166],{"type":62,"value":2167}," ||",{"type":56,"tag":84,"props":2169,"children":2170},{"style":113},[2171],{"type":62,"value":853},{"type":56,"tag":84,"props":2173,"children":2174},{"style":107},[2175],{"type":62,"value":326},{"type":56,"tag":84,"props":2177,"children":2178},{"style":113},[2179],{"type":62,"value":901},{"type":56,"tag":84,"props":2181,"children":2182},{"style":107},[2183],{"type":62,"value":326},{"type":56,"tag":84,"props":2185,"children":2186},{"style":113},[2187],{"type":62,"value":2188},"role",{"type":56,"tag":84,"props":2190,"children":2191},{"style":107},[2192],{"type":62,"value":2193}," !==",{"type":56,"tag":84,"props":2195,"children":2196},{"style":107},[2197],{"type":62,"value":141},{"type":56,"tag":84,"props":2199,"children":2200},{"style":144},[2201],{"type":62,"value":2202},"admin",{"type":56,"tag":84,"props":2204,"children":2205},{"style":107},[2206],{"type":62,"value":152},{"type":56,"tag":84,"props":2208,"children":2209},{"style":353},[2210],{"type":62,"value":408},{"type":56,"tag":84,"props":2212,"children":2213},{"style":107},[2214],{"type":62,"value":413},{"type":56,"tag":84,"props":2216,"children":2217},{"class":86,"line":560},[2218,2222,2226,2230,2234,2238,2242,2246,2250,2255,2259,2263,2267],{"type":56,"tag":84,"props":2219,"children":2220},{"style":101},[2221],{"type":62,"value":1927},{"type":56,"tag":84,"props":2223,"children":2224},{"style":107},[2225],{"type":62,"value":923},{"type":56,"tag":84,"props":2227,"children":2228},{"style":237},[2229],{"type":62,"value":126},{"type":56,"tag":84,"props":2231,"children":2232},{"style":353},[2233],{"type":62,"value":356},{"type":56,"tag":84,"props":2235,"children":2236},{"style":107},[2237],{"type":62,"value":936},{"type":56,"tag":84,"props":2239,"children":2240},{"style":353},[2241],{"type":62,"value":941},{"type":56,"tag":84,"props":2243,"children":2244},{"style":107},[2245],{"type":62,"value":539},{"type":56,"tag":84,"props":2247,"children":2248},{"style":107},[2249],{"type":62,"value":141},{"type":56,"tag":84,"props":2251,"children":2252},{"style":144},[2253],{"type":62,"value":2254},"FORBIDDEN",{"type":56,"tag":84,"props":2256,"children":2257},{"style":107},[2258],{"type":62,"value":152},{"type":56,"tag":84,"props":2260,"children":2261},{"style":107},[2262],{"type":62,"value":131},{"type":56,"tag":84,"props":2264,"children":2265},{"style":353},[2266],{"type":62,"value":266},{"type":56,"tag":84,"props":2268,"children":2269},{"style":107},[2270],{"type":62,"value":157},{"type":56,"tag":84,"props":2272,"children":2273},{"class":86,"line":569},[2274],{"type":56,"tag":84,"props":2275,"children":2276},{"style":107},[2277],{"type":62,"value":517},{"type":56,"tag":84,"props":2279,"children":2280},{"class":86,"line":577},[2281,2285,2289,2293,2297,2301,2305,2309,2313,2317,2321,2325,2329,2333,2337,2341],{"type":56,"tag":84,"props":2282,"children":2283},{"style":101},[2284],{"type":62,"value":526},{"type":56,"tag":84,"props":2286,"children":2287},{"style":237},[2288],{"type":62,"value":1869},{"type":56,"tag":84,"props":2290,"children":2291},{"style":353},[2292],{"type":62,"value":356},{"type":56,"tag":84,"props":2294,"children":2295},{"style":107},[2296],{"type":62,"value":936},{"type":56,"tag":84,"props":2298,"children":2299},{"style":353},[2300],{"type":62,"value":853},{"type":56,"tag":84,"props":2302,"children":2303},{"style":107},[2304],{"type":62,"value":539},{"type":56,"tag":84,"props":2306,"children":2307},{"style":107},[2308],{"type":62,"value":110},{"type":56,"tag":84,"props":2310,"children":2311},{"style":353},[2312],{"type":62,"value":427},{"type":56,"tag":84,"props":2314,"children":2315},{"style":107},[2316],{"type":62,"value":539},{"type":56,"tag":84,"props":2318,"children":2319},{"style":113},[2320],{"type":62,"value":853},{"type":56,"tag":84,"props":2322,"children":2323},{"style":107},[2324],{"type":62,"value":326},{"type":56,"tag":84,"props":2326,"children":2327},{"style":113},[2328],{"type":62,"value":901},{"type":56,"tag":84,"props":2330,"children":2331},{"style":107},[2332],{"type":62,"value":131},{"type":56,"tag":84,"props":2334,"children":2335},{"style":107},[2336],{"type":62,"value":131},{"type":56,"tag":84,"props":2338,"children":2339},{"style":353},[2340],{"type":62,"value":266},{"type":56,"tag":84,"props":2342,"children":2343},{"style":107},[2344],{"type":62,"value":157},{"type":56,"tag":84,"props":2346,"children":2347},{"class":86,"line":627},[2348,2352,2356],{"type":56,"tag":84,"props":2349,"children":2350},{"style":107},[2351],{"type":62,"value":1585},{"type":56,"tag":84,"props":2353,"children":2354},{"style":113},[2355],{"type":62,"value":266},{"type":56,"tag":84,"props":2357,"children":2358},{"style":107},[2359],{"type":62,"value":157},{"type":56,"tag":84,"props":2361,"children":2362},{"class":86,"line":635},[2363],{"type":56,"tag":84,"props":2364,"children":2365},{"emptyLinePlaceholder":211},[2366],{"type":62,"value":214},{"type":56,"tag":84,"props":2368,"children":2369},{"class":86,"line":702},[2370,2374,2378,2382,2386,2390,2394,2398,2402,2406,2411],{"type":56,"tag":84,"props":2371,"children":2372},{"style":101},[2373],{"type":62,"value":223},{"type":56,"tag":84,"props":2375,"children":2376},{"style":226},[2377],{"type":62,"value":720},{"type":56,"tag":84,"props":2379,"children":2380},{"style":113},[2381],{"type":62,"value":772},{"type":56,"tag":84,"props":2383,"children":2384},{"style":107},[2385],{"type":62,"value":651},{"type":56,"tag":84,"props":2387,"children":2388},{"style":113},[2389],{"type":62,"value":734},{"type":56,"tag":84,"props":2391,"children":2392},{"style":107},[2393],{"type":62,"value":326},{"type":56,"tag":84,"props":2395,"children":2396},{"style":113},[2397],{"type":62,"value":743},{"type":56,"tag":84,"props":2399,"children":2400},{"style":107},[2401],{"type":62,"value":326},{"type":56,"tag":84,"props":2403,"children":2404},{"style":237},[2405],{"type":62,"value":797},{"type":56,"tag":84,"props":2407,"children":2408},{"style":113},[2409],{"type":62,"value":2410},"(isAuthed)",{"type":56,"tag":84,"props":2412,"children":2413},{"style":107},[2414],{"type":62,"value":157},{"type":56,"tag":84,"props":2416,"children":2417},{"class":86,"line":710},[2418,2422,2426,2431,2435,2439,2443,2447,2451,2455,2460],{"type":56,"tag":84,"props":2419,"children":2420},{"style":101},[2421],{"type":62,"value":223},{"type":56,"tag":84,"props":2423,"children":2424},{"style":226},[2425],{"type":62,"value":720},{"type":56,"tag":84,"props":2427,"children":2428},{"style":113},[2429],{"type":62,"value":2430}," adminProcedure ",{"type":56,"tag":84,"props":2432,"children":2433},{"style":107},[2434],{"type":62,"value":651},{"type":56,"tag":84,"props":2436,"children":2437},{"style":113},[2438],{"type":62,"value":734},{"type":56,"tag":84,"props":2440,"children":2441},{"style":107},[2442],{"type":62,"value":326},{"type":56,"tag":84,"props":2444,"children":2445},{"style":113},[2446],{"type":62,"value":743},{"type":56,"tag":84,"props":2448,"children":2449},{"style":107},[2450],{"type":62,"value":326},{"type":56,"tag":84,"props":2452,"children":2453},{"style":237},[2454],{"type":62,"value":797},{"type":56,"tag":84,"props":2456,"children":2457},{"style":113},[2458],{"type":62,"value":2459},"(isAdmin)",{"type":56,"tag":84,"props":2461,"children":2462},{"style":107},[2463],{"type":62,"value":157},{"type":56,"tag":1601,"props":2465,"children":2467},{"id":2466},"sse-subscription-auth-with-eventsource-polyfill",[2468],{"type":62,"value":2469},"SSE subscription auth with EventSource polyfill",{"type":56,"tag":72,"props":2471,"children":2473},{"className":74,"code":2472,"language":76,"meta":77,"style":77},"import {\n  createTRPCClient,\n  httpBatchLink,\n  httpSubscriptionLink,\n  splitLink,\n} from '@trpc\u002Fclient';\nimport { EventSourcePolyfill } from 'event-source-polyfill';\nimport type { AppRouter } from '..\u002Fserver\u002Frouter';\n\nconst trpc = createTRPCClient\u003CAppRouter>({\n  links: [\n    splitLink({\n      condition: (op) => op.type === 'subscription',\n      true: httpSubscriptionLink({\n        url: 'http:\u002F\u002Flocalhost:3000\u002Ftrpc',\n        EventSource: EventSourcePolyfill,\n        eventSourceOptions: async () => {\n          return {\n            headers: {\n              authorization: `Bearer ${getToken()}`,\n            },\n          };\n        },\n      }),\n      false: httpBatchLink({\n        url: 'http:\u002F\u002Flocalhost:3000\u002Ftrpc',\n        headers() {\n          return { Authorization: `Bearer ${getToken()}` };\n        },\n      }),\n    }),\n  ],\n});\n",[2474],{"type":56,"tag":80,"props":2475,"children":2476},{"__ignoreMap":77},[2477,2488,2500,2512,2524,2536,2563,2604,2647,2654,2693,2708,2724,2789,2814,2842,2862,2891,2903,2919,2960,2968,2976,2984,3000,3024,3051,3067,3114,3121,3136,3151,3162],{"type":56,"tag":84,"props":2478,"children":2479},{"class":86,"line":87},[2480,2484],{"type":56,"tag":84,"props":2481,"children":2482},{"style":101},[2483],{"type":62,"value":104},{"type":56,"tag":84,"props":2485,"children":2486},{"style":107},[2487],{"type":62,"value":271},{"type":56,"tag":84,"props":2489,"children":2490},{"class":86,"line":97},[2491,2496],{"type":56,"tag":84,"props":2492,"children":2493},{"style":113},[2494],{"type":62,"value":2495},"  createTRPCClient",{"type":56,"tag":84,"props":2497,"children":2498},{"style":107},[2499],{"type":62,"value":1477},{"type":56,"tag":84,"props":2501,"children":2502},{"class":86,"line":160},[2503,2508],{"type":56,"tag":84,"props":2504,"children":2505},{"style":113},[2506],{"type":62,"value":2507},"  httpBatchLink",{"type":56,"tag":84,"props":2509,"children":2510},{"style":107},[2511],{"type":62,"value":1477},{"type":56,"tag":84,"props":2513,"children":2514},{"class":86,"line":207},[2515,2520],{"type":56,"tag":84,"props":2516,"children":2517},{"style":113},[2518],{"type":62,"value":2519},"  httpSubscriptionLink",{"type":56,"tag":84,"props":2521,"children":2522},{"style":107},[2523],{"type":62,"value":1477},{"type":56,"tag":84,"props":2525,"children":2526},{"class":86,"line":217},[2527,2532],{"type":56,"tag":84,"props":2528,"children":2529},{"style":113},[2530],{"type":62,"value":2531},"  splitLink",{"type":56,"tag":84,"props":2533,"children":2534},{"style":107},[2535],{"type":62,"value":1477},{"type":56,"tag":84,"props":2537,"children":2538},{"class":86,"line":274},[2539,2543,2547,2551,2555,2559],{"type":56,"tag":84,"props":2540,"children":2541},{"style":107},[2542],{"type":62,"value":1585},{"type":56,"tag":84,"props":2544,"children":2545},{"style":101},[2546],{"type":62,"value":136},{"type":56,"tag":84,"props":2548,"children":2549},{"style":107},[2550],{"type":62,"value":141},{"type":56,"tag":84,"props":2552,"children":2553},{"style":144},[2554],{"type":62,"value":1207},{"type":56,"tag":84,"props":2556,"children":2557},{"style":107},[2558],{"type":62,"value":152},{"type":56,"tag":84,"props":2560,"children":2561},{"style":107},[2562],{"type":62,"value":157},{"type":56,"tag":84,"props":2564,"children":2565},{"class":86,"line":301},[2566,2570,2574,2579,2583,2587,2591,2596,2600],{"type":56,"tag":84,"props":2567,"children":2568},{"style":101},[2569],{"type":62,"value":104},{"type":56,"tag":84,"props":2571,"children":2572},{"style":107},[2573],{"type":62,"value":110},{"type":56,"tag":84,"props":2575,"children":2576},{"style":113},[2577],{"type":62,"value":2578}," EventSourcePolyfill",{"type":56,"tag":84,"props":2580,"children":2581},{"style":107},[2582],{"type":62,"value":131},{"type":56,"tag":84,"props":2584,"children":2585},{"style":101},[2586],{"type":62,"value":136},{"type":56,"tag":84,"props":2588,"children":2589},{"style":107},[2590],{"type":62,"value":141},{"type":56,"tag":84,"props":2592,"children":2593},{"style":144},[2594],{"type":62,"value":2595},"event-source-polyfill",{"type":56,"tag":84,"props":2597,"children":2598},{"style":107},[2599],{"type":62,"value":152},{"type":56,"tag":84,"props":2601,"children":2602},{"style":107},[2603],{"type":62,"value":157},{"type":56,"tag":84,"props":2605,"children":2606},{"class":86,"line":387},[2607,2611,2615,2619,2623,2627,2631,2635,2639,2643],{"type":56,"tag":84,"props":2608,"children":2609},{"style":101},[2610],{"type":62,"value":104},{"type":56,"tag":84,"props":2612,"children":2613},{"style":101},[2614],{"type":62,"value":170},{"type":56,"tag":84,"props":2616,"children":2617},{"style":107},[2618],{"type":62,"value":110},{"type":56,"tag":84,"props":2620,"children":2621},{"style":113},[2622],{"type":62,"value":1235},{"type":56,"tag":84,"props":2624,"children":2625},{"style":107},[2626],{"type":62,"value":131},{"type":56,"tag":84,"props":2628,"children":2629},{"style":101},[2630],{"type":62,"value":136},{"type":56,"tag":84,"props":2632,"children":2633},{"style":107},[2634],{"type":62,"value":141},{"type":56,"tag":84,"props":2636,"children":2637},{"style":144},[2638],{"type":62,"value":1252},{"type":56,"tag":84,"props":2640,"children":2641},{"style":107},[2642],{"type":62,"value":152},{"type":56,"tag":84,"props":2644,"children":2645},{"style":107},[2646],{"type":62,"value":157},{"type":56,"tag":84,"props":2648,"children":2649},{"class":86,"line":416},[2650],{"type":56,"tag":84,"props":2651,"children":2652},{"emptyLinePlaceholder":211},[2653],{"type":62,"value":214},{"type":56,"tag":84,"props":2655,"children":2656},{"class":86,"line":466},[2657,2661,2665,2669,2673,2677,2681,2685,2689],{"type":56,"tag":84,"props":2658,"children":2659},{"style":226},[2660],{"type":62,"value":641},{"type":56,"tag":84,"props":2662,"children":2663},{"style":113},[2664],{"type":62,"value":1385},{"type":56,"tag":84,"props":2666,"children":2667},{"style":107},[2668],{"type":62,"value":651},{"type":56,"tag":84,"props":2670,"children":2671},{"style":237},[2672],{"type":62,"value":1181},{"type":56,"tag":84,"props":2674,"children":2675},{"style":107},[2676],{"type":62,"value":605},{"type":56,"tag":84,"props":2678,"children":2679},{"style":259},[2680],{"type":62,"value":1402},{"type":56,"tag":84,"props":2682,"children":2683},{"style":107},[2684],{"type":62,"value":678},{"type":56,"tag":84,"props":2686,"children":2687},{"style":113},[2688],{"type":62,"value":356},{"type":56,"tag":84,"props":2690,"children":2691},{"style":107},[2692],{"type":62,"value":413},{"type":56,"tag":84,"props":2694,"children":2695},{"class":86,"line":488},[2696,2700,2704],{"type":56,"tag":84,"props":2697,"children":2698},{"style":353},[2699],{"type":62,"value":1422},{"type":56,"tag":84,"props":2701,"children":2702},{"style":107},[2703],{"type":62,"value":539},{"type":56,"tag":84,"props":2705,"children":2706},{"style":113},[2707],{"type":62,"value":1431},{"type":56,"tag":84,"props":2709,"children":2710},{"class":86,"line":497},[2711,2716,2720],{"type":56,"tag":84,"props":2712,"children":2713},{"style":237},[2714],{"type":62,"value":2715},"    splitLink",{"type":56,"tag":84,"props":2717,"children":2718},{"style":113},[2719],{"type":62,"value":356},{"type":56,"tag":84,"props":2721,"children":2722},{"style":107},[2723],{"type":62,"value":413},{"type":56,"tag":84,"props":2725,"children":2726},{"class":86,"line":511},[2727,2732,2736,2740,2745,2749,2753,2758,2762,2767,2772,2776,2781,2785],{"type":56,"tag":84,"props":2728,"children":2729},{"style":237},[2730],{"type":62,"value":2731},"      condition",{"type":56,"tag":84,"props":2733,"children":2734},{"style":107},[2735],{"type":62,"value":539},{"type":56,"tag":84,"props":2737,"children":2738},{"style":107},[2739],{"type":62,"value":398},{"type":56,"tag":84,"props":2741,"children":2742},{"style":248},[2743],{"type":62,"value":2744},"op",{"type":56,"tag":84,"props":2746,"children":2747},{"style":107},[2748],{"type":62,"value":266},{"type":56,"tag":84,"props":2750,"children":2751},{"style":226},[2752],{"type":62,"value":1879},{"type":56,"tag":84,"props":2754,"children":2755},{"style":113},[2756],{"type":62,"value":2757}," op",{"type":56,"tag":84,"props":2759,"children":2760},{"style":107},[2761],{"type":62,"value":326},{"type":56,"tag":84,"props":2763,"children":2764},{"style":113},[2765],{"type":62,"value":2766},"type ",{"type":56,"tag":84,"props":2768,"children":2769},{"style":107},[2770],{"type":62,"value":2771},"===",{"type":56,"tag":84,"props":2773,"children":2774},{"style":107},[2775],{"type":62,"value":141},{"type":56,"tag":84,"props":2777,"children":2778},{"style":144},[2779],{"type":62,"value":2780},"subscription",{"type":56,"tag":84,"props":2782,"children":2783},{"style":107},[2784],{"type":62,"value":152},{"type":56,"tag":84,"props":2786,"children":2787},{"style":107},[2788],{"type":62,"value":1477},{"type":56,"tag":84,"props":2790,"children":2791},{"class":86,"line":520},[2792,2797,2801,2806,2810],{"type":56,"tag":84,"props":2793,"children":2794},{"style":353},[2795],{"type":62,"value":2796},"      true",{"type":56,"tag":84,"props":2798,"children":2799},{"style":107},[2800],{"type":62,"value":539},{"type":56,"tag":84,"props":2802,"children":2803},{"style":237},[2804],{"type":62,"value":2805}," httpSubscriptionLink",{"type":56,"tag":84,"props":2807,"children":2808},{"style":113},[2809],{"type":62,"value":356},{"type":56,"tag":84,"props":2811,"children":2812},{"style":107},[2813],{"type":62,"value":413},{"type":56,"tag":84,"props":2815,"children":2816},{"class":86,"line":560},[2817,2822,2826,2830,2834,2838],{"type":56,"tag":84,"props":2818,"children":2819},{"style":353},[2820],{"type":62,"value":2821},"        url",{"type":56,"tag":84,"props":2823,"children":2824},{"style":107},[2825],{"type":62,"value":539},{"type":56,"tag":84,"props":2827,"children":2828},{"style":107},[2829],{"type":62,"value":141},{"type":56,"tag":84,"props":2831,"children":2832},{"style":144},[2833],{"type":62,"value":1468},{"type":56,"tag":84,"props":2835,"children":2836},{"style":107},[2837],{"type":62,"value":152},{"type":56,"tag":84,"props":2839,"children":2840},{"style":107},[2841],{"type":62,"value":1477},{"type":56,"tag":84,"props":2843,"children":2844},{"class":86,"line":569},[2845,2850,2854,2858],{"type":56,"tag":84,"props":2846,"children":2847},{"style":353},[2848],{"type":62,"value":2849},"        EventSource",{"type":56,"tag":84,"props":2851,"children":2852},{"style":107},[2853],{"type":62,"value":539},{"type":56,"tag":84,"props":2855,"children":2856},{"style":113},[2857],{"type":62,"value":2578},{"type":56,"tag":84,"props":2859,"children":2860},{"style":107},[2861],{"type":62,"value":1477},{"type":56,"tag":84,"props":2863,"children":2864},{"class":86,"line":577},[2865,2870,2874,2878,2883,2887],{"type":56,"tag":84,"props":2866,"children":2867},{"style":237},[2868],{"type":62,"value":2869},"        eventSourceOptions",{"type":56,"tag":84,"props":2871,"children":2872},{"style":107},[2873],{"type":62,"value":539},{"type":56,"tag":84,"props":2875,"children":2876},{"style":226},[2877],{"type":62,"value":229},{"type":56,"tag":84,"props":2879,"children":2880},{"style":107},[2881],{"type":62,"value":2882}," ()",{"type":56,"tag":84,"props":2884,"children":2885},{"style":226},[2886],{"type":62,"value":1879},{"type":56,"tag":84,"props":2888,"children":2889},{"style":107},[2890],{"type":62,"value":271},{"type":56,"tag":84,"props":2892,"children":2893},{"class":86,"line":627},[2894,2899],{"type":56,"tag":84,"props":2895,"children":2896},{"style":101},[2897],{"type":62,"value":2898},"          return",{"type":56,"tag":84,"props":2900,"children":2901},{"style":107},[2902],{"type":62,"value":271},{"type":56,"tag":84,"props":2904,"children":2905},{"class":86,"line":635},[2906,2911,2915],{"type":56,"tag":84,"props":2907,"children":2908},{"style":353},[2909],{"type":62,"value":2910},"            headers",{"type":56,"tag":84,"props":2912,"children":2913},{"style":107},[2914],{"type":62,"value":539},{"type":56,"tag":84,"props":2916,"children":2917},{"style":107},[2918],{"type":62,"value":271},{"type":56,"tag":84,"props":2920,"children":2921},{"class":86,"line":702},[2922,2927,2931,2935,2939,2943,2948,2952,2956],{"type":56,"tag":84,"props":2923,"children":2924},{"style":353},[2925],{"type":62,"value":2926},"              authorization",{"type":56,"tag":84,"props":2928,"children":2929},{"style":107},[2930],{"type":62,"value":539},{"type":56,"tag":84,"props":2932,"children":2933},{"style":107},[2934],{"type":62,"value":1519},{"type":56,"tag":84,"props":2936,"children":2937},{"style":144},[2938],{"type":62,"value":1524},{"type":56,"tag":84,"props":2940,"children":2941},{"style":107},[2942],{"type":62,"value":1529},{"type":56,"tag":84,"props":2944,"children":2945},{"style":237},[2946],{"type":62,"value":2947},"getToken",{"type":56,"tag":84,"props":2949,"children":2950},{"style":113},[2951],{"type":62,"value":294},{"type":56,"tag":84,"props":2953,"children":2954},{"style":107},[2955],{"type":62,"value":1538},{"type":56,"tag":84,"props":2957,"children":2958},{"style":107},[2959],{"type":62,"value":1477},{"type":56,"tag":84,"props":2961,"children":2962},{"class":86,"line":710},[2963],{"type":56,"tag":84,"props":2964,"children":2965},{"style":107},[2966],{"type":62,"value":2967},"            },\n",{"type":56,"tag":84,"props":2969,"children":2970},{"class":86,"line":750},[2971],{"type":56,"tag":84,"props":2972,"children":2973},{"style":107},[2974],{"type":62,"value":2975},"          };\n",{"type":56,"tag":84,"props":2977,"children":2978},{"class":86,"line":758},[2979],{"type":56,"tag":84,"props":2980,"children":2981},{"style":107},[2982],{"type":62,"value":2983},"        },\n",{"type":56,"tag":84,"props":2985,"children":2986},{"class":86,"line":805},[2987,2992,2996],{"type":56,"tag":84,"props":2988,"children":2989},{"style":107},[2990],{"type":62,"value":2991},"      }",{"type":56,"tag":84,"props":2993,"children":2994},{"style":113},[2995],{"type":62,"value":266},{"type":56,"tag":84,"props":2997,"children":2998},{"style":107},[2999],{"type":62,"value":1477},{"type":56,"tag":84,"props":3001,"children":3002},{"class":86,"line":839},[3003,3008,3012,3016,3020],{"type":56,"tag":84,"props":3004,"children":3005},{"style":353},[3006],{"type":62,"value":3007},"      false",{"type":56,"tag":84,"props":3009,"children":3010},{"style":107},[3011],{"type":62,"value":539},{"type":56,"tag":84,"props":3013,"children":3014},{"style":237},[3015],{"type":62,"value":1190},{"type":56,"tag":84,"props":3017,"children":3018},{"style":113},[3019],{"type":62,"value":356},{"type":56,"tag":84,"props":3021,"children":3022},{"style":107},[3023],{"type":62,"value":413},{"type":56,"tag":84,"props":3025,"children":3026},{"class":86,"line":873},[3027,3031,3035,3039,3043,3047],{"type":56,"tag":84,"props":3028,"children":3029},{"style":353},[3030],{"type":62,"value":2821},{"type":56,"tag":84,"props":3032,"children":3033},{"style":107},[3034],{"type":62,"value":539},{"type":56,"tag":84,"props":3036,"children":3037},{"style":107},[3038],{"type":62,"value":141},{"type":56,"tag":84,"props":3040,"children":3041},{"style":144},[3042],{"type":62,"value":1468},{"type":56,"tag":84,"props":3044,"children":3045},{"style":107},[3046],{"type":62,"value":152},{"type":56,"tag":84,"props":3048,"children":3049},{"style":107},[3050],{"type":62,"value":1477},{"type":56,"tag":84,"props":3052,"children":3053},{"class":86,"line":912},[3054,3059,3063],{"type":56,"tag":84,"props":3055,"children":3056},{"style":353},[3057],{"type":62,"value":3058},"        headers",{"type":56,"tag":84,"props":3060,"children":3061},{"style":107},[3062],{"type":62,"value":294},{"type":56,"tag":84,"props":3064,"children":3065},{"style":107},[3066],{"type":62,"value":271},{"type":56,"tag":84,"props":3068,"children":3069},{"class":86,"line":973},[3070,3074,3078,3082,3086,3090,3094,3098,3102,3106,3110],{"type":56,"tag":84,"props":3071,"children":3072},{"style":101},[3073],{"type":62,"value":2898},{"type":56,"tag":84,"props":3075,"children":3076},{"style":107},[3077],{"type":62,"value":110},{"type":56,"tag":84,"props":3079,"children":3080},{"style":353},[3081],{"type":62,"value":1510},{"type":56,"tag":84,"props":3083,"children":3084},{"style":107},[3085],{"type":62,"value":539},{"type":56,"tag":84,"props":3087,"children":3088},{"style":107},[3089],{"type":62,"value":1519},{"type":56,"tag":84,"props":3091,"children":3092},{"style":144},[3093],{"type":62,"value":1524},{"type":56,"tag":84,"props":3095,"children":3096},{"style":107},[3097],{"type":62,"value":1529},{"type":56,"tag":84,"props":3099,"children":3100},{"style":237},[3101],{"type":62,"value":2947},{"type":56,"tag":84,"props":3103,"children":3104},{"style":113},[3105],{"type":62,"value":294},{"type":56,"tag":84,"props":3107,"children":3108},{"style":107},[3109],{"type":62,"value":1538},{"type":56,"tag":84,"props":3111,"children":3112},{"style":107},[3113],{"type":62,"value":1543},{"type":56,"tag":84,"props":3115,"children":3116},{"class":86,"line":981},[3117],{"type":56,"tag":84,"props":3118,"children":3119},{"style":107},[3120],{"type":62,"value":2983},{"type":56,"tag":84,"props":3122,"children":3123},{"class":86,"line":1009},[3124,3128,3132],{"type":56,"tag":84,"props":3125,"children":3126},{"style":107},[3127],{"type":62,"value":2991},{"type":56,"tag":84,"props":3129,"children":3130},{"style":113},[3131],{"type":62,"value":266},{"type":56,"tag":84,"props":3133,"children":3134},{"style":107},[3135],{"type":62,"value":1477},{"type":56,"tag":84,"props":3137,"children":3138},{"class":86,"line":1026},[3139,3143,3147],{"type":56,"tag":84,"props":3140,"children":3141},{"style":107},[3142],{"type":62,"value":1075},{"type":56,"tag":84,"props":3144,"children":3145},{"style":113},[3146],{"type":62,"value":266},{"type":56,"tag":84,"props":3148,"children":3149},{"style":107},[3150],{"type":62,"value":1477},{"type":56,"tag":84,"props":3152,"children":3153},{"class":86,"line":1060},[3154,3158],{"type":56,"tag":84,"props":3155,"children":3156},{"style":113},[3157],{"type":62,"value":1573},{"type":56,"tag":84,"props":3159,"children":3160},{"style":107},[3161],{"type":62,"value":1477},{"type":56,"tag":84,"props":3163,"children":3164},{"class":86,"line":1069},[3165,3169,3173],{"type":56,"tag":84,"props":3166,"children":3167},{"style":107},[3168],{"type":62,"value":1585},{"type":56,"tag":84,"props":3170,"children":3171},{"style":113},[3172],{"type":62,"value":266},{"type":56,"tag":84,"props":3174,"children":3175},{"style":107},[3176],{"type":62,"value":157},{"type":56,"tag":1601,"props":3178,"children":3180},{"id":3179},"websocket-auth-with-connectionparams",[3181],{"type":62,"value":3182},"WebSocket auth with connectionParams",{"type":56,"tag":72,"props":3184,"children":3186},{"className":74,"code":3185,"language":76,"meta":77,"style":77},"\u002F\u002F server\u002Fcontext.ts\nimport type { CreateWSSContextFnOptions } from '@trpc\u002Fserver\u002Fadapters\u002Fws';\n\nexport const createContext = async (opts: CreateWSSContextFnOptions) => {\n  const token = opts.info.connectionParams?.token;\n  const user = token ? await verifyJwt(token) : null;\n  return { user };\n};\n",[3187],{"type":56,"tag":80,"props":3188,"children":3189},{"__ignoreMap":77},[3190,3198,3243,3250,3302,3352,3404,3423],{"type":56,"tag":84,"props":3191,"children":3192},{"class":86,"line":87},[3193],{"type":56,"tag":84,"props":3194,"children":3195},{"style":91},[3196],{"type":62,"value":3197},"\u002F\u002F server\u002Fcontext.ts\n",{"type":56,"tag":84,"props":3199,"children":3200},{"class":86,"line":97},[3201,3205,3209,3213,3218,3222,3226,3230,3235,3239],{"type":56,"tag":84,"props":3202,"children":3203},{"style":101},[3204],{"type":62,"value":104},{"type":56,"tag":84,"props":3206,"children":3207},{"style":101},[3208],{"type":62,"value":170},{"type":56,"tag":84,"props":3210,"children":3211},{"style":107},[3212],{"type":62,"value":110},{"type":56,"tag":84,"props":3214,"children":3215},{"style":113},[3216],{"type":62,"value":3217}," CreateWSSContextFnOptions",{"type":56,"tag":84,"props":3219,"children":3220},{"style":107},[3221],{"type":62,"value":131},{"type":56,"tag":84,"props":3223,"children":3224},{"style":101},[3225],{"type":62,"value":136},{"type":56,"tag":84,"props":3227,"children":3228},{"style":107},[3229],{"type":62,"value":141},{"type":56,"tag":84,"props":3231,"children":3232},{"style":144},[3233],{"type":62,"value":3234},"@trpc\u002Fserver\u002Fadapters\u002Fws",{"type":56,"tag":84,"props":3236,"children":3237},{"style":107},[3238],{"type":62,"value":152},{"type":56,"tag":84,"props":3240,"children":3241},{"style":107},[3242],{"type":62,"value":157},{"type":56,"tag":84,"props":3244,"children":3245},{"class":86,"line":160},[3246],{"type":56,"tag":84,"props":3247,"children":3248},{"emptyLinePlaceholder":211},[3249],{"type":62,"value":214},{"type":56,"tag":84,"props":3251,"children":3252},{"class":86,"line":207},[3253,3257,3261,3266,3270,3274,3278,3282,3286,3290,3294,3298],{"type":56,"tag":84,"props":3254,"children":3255},{"style":101},[3256],{"type":62,"value":223},{"type":56,"tag":84,"props":3258,"children":3259},{"style":226},[3260],{"type":62,"value":720},{"type":56,"tag":84,"props":3262,"children":3263},{"style":113},[3264],{"type":62,"value":3265}," createContext ",{"type":56,"tag":84,"props":3267,"children":3268},{"style":107},[3269],{"type":62,"value":651},{"type":56,"tag":84,"props":3271,"children":3272},{"style":226},[3273],{"type":62,"value":229},{"type":56,"tag":84,"props":3275,"children":3276},{"style":107},[3277],{"type":62,"value":398},{"type":56,"tag":84,"props":3279,"children":3280},{"style":248},[3281],{"type":62,"value":828},{"type":56,"tag":84,"props":3283,"children":3284},{"style":107},[3285],{"type":62,"value":539},{"type":56,"tag":84,"props":3287,"children":3288},{"style":259},[3289],{"type":62,"value":3217},{"type":56,"tag":84,"props":3291,"children":3292},{"style":107},[3293],{"type":62,"value":266},{"type":56,"tag":84,"props":3295,"children":3296},{"style":226},[3297],{"type":62,"value":1879},{"type":56,"tag":84,"props":3299,"children":3300},{"style":107},[3301],{"type":62,"value":271},{"type":56,"tag":84,"props":3303,"children":3304},{"class":86,"line":217},[3305,3310,3314,3318,3322,3326,3331,3335,3340,3344,3348],{"type":56,"tag":84,"props":3306,"children":3307},{"style":226},[3308],{"type":62,"value":3309},"  const",{"type":56,"tag":84,"props":3311,"children":3312},{"style":113},[3313],{"type":62,"value":312},{"type":56,"tag":84,"props":3315,"children":3316},{"style":107},[3317],{"type":62,"value":317},{"type":56,"tag":84,"props":3319,"children":3320},{"style":113},[3321],{"type":62,"value":866},{"type":56,"tag":84,"props":3323,"children":3324},{"style":107},[3325],{"type":62,"value":326},{"type":56,"tag":84,"props":3327,"children":3328},{"style":113},[3329],{"type":62,"value":3330},"info",{"type":56,"tag":84,"props":3332,"children":3333},{"style":107},[3334],{"type":62,"value":326},{"type":56,"tag":84,"props":3336,"children":3337},{"style":113},[3338],{"type":62,"value":3339},"connectionParams",{"type":56,"tag":84,"props":3341,"children":3342},{"style":107},[3343],{"type":62,"value":345},{"type":56,"tag":84,"props":3345,"children":3346},{"style":113},[3347],{"type":62,"value":403},{"type":56,"tag":84,"props":3349,"children":3350},{"style":107},[3351],{"type":62,"value":157},{"type":56,"tag":84,"props":3353,"children":3354},{"class":86,"line":274},[3355,3359,3363,3367,3371,3376,3380,3384,3388,3392,3396,3400],{"type":56,"tag":84,"props":3356,"children":3357},{"style":226},[3358],{"type":62,"value":3309},{"type":56,"tag":84,"props":3360,"children":3361},{"style":113},[3362],{"type":62,"value":427},{"type":56,"tag":84,"props":3364,"children":3365},{"style":107},[3366],{"type":62,"value":317},{"type":56,"tag":84,"props":3368,"children":3369},{"style":113},[3370],{"type":62,"value":312},{"type":56,"tag":84,"props":3372,"children":3373},{"style":107},[3374],{"type":62,"value":3375}," ?",{"type":56,"tag":84,"props":3377,"children":3378},{"style":101},[3379],{"type":62,"value":436},{"type":56,"tag":84,"props":3381,"children":3382},{"style":237},[3383],{"type":62,"value":441},{"type":56,"tag":84,"props":3385,"children":3386},{"style":353},[3387],{"type":62,"value":356},{"type":56,"tag":84,"props":3389,"children":3390},{"style":113},[3391],{"type":62,"value":403},{"type":56,"tag":84,"props":3393,"children":3394},{"style":353},[3395],{"type":62,"value":408},{"type":56,"tag":84,"props":3397,"children":3398},{"style":107},[3399],{"type":62,"value":539},{"type":56,"tag":84,"props":3401,"children":3402},{"style":107},[3403],{"type":62,"value":508},{"type":56,"tag":84,"props":3405,"children":3406},{"class":86,"line":301},[3407,3411,3415,3419],{"type":56,"tag":84,"props":3408,"children":3409},{"style":101},[3410],{"type":62,"value":526},{"type":56,"tag":84,"props":3412,"children":3413},{"style":107},[3414],{"type":62,"value":110},{"type":56,"tag":84,"props":3416,"children":3417},{"style":113},[3418],{"type":62,"value":427},{"type":56,"tag":84,"props":3420,"children":3421},{"style":107},[3422],{"type":62,"value":1543},{"type":56,"tag":84,"props":3424,"children":3425},{"class":86,"line":387},[3426],{"type":56,"tag":84,"props":3427,"children":3428},{"style":107},[3429],{"type":62,"value":557},{"type":56,"tag":72,"props":3431,"children":3433},{"className":74,"code":3432,"language":76,"meta":77,"style":77},"\u002F\u002F client\u002Ftrpc.ts\nimport { createTRPCClient, createWSClient, wsLink } from '@trpc\u002Fclient';\nimport type { AppRouter } from '..\u002Fserver\u002Frouter';\n\nconst wsClient = createWSClient({\n  url: 'ws:\u002F\u002Flocalhost:3001',\n  connectionParams: async () => ({\n    token: getToken(),\n  }),\n});\n\nconst trpc = createTRPCClient\u003CAppRouter>({\n  links: [wsLink({ client: wsClient })],\n});\n",[3434],{"type":56,"tag":80,"props":3435,"children":3436},{"__ignoreMap":77},[3437,3444,3501,3544,3551,3579,3608,3640,3665,3681,3696,3703,3742,3797],{"type":56,"tag":84,"props":3438,"children":3439},{"class":86,"line":87},[3440],{"type":56,"tag":84,"props":3441,"children":3442},{"style":91},[3443],{"type":62,"value":1165},{"type":56,"tag":84,"props":3445,"children":3446},{"class":86,"line":97},[3447,3451,3455,3459,3463,3468,3472,3477,3481,3485,3489,3493,3497],{"type":56,"tag":84,"props":3448,"children":3449},{"style":101},[3450],{"type":62,"value":104},{"type":56,"tag":84,"props":3452,"children":3453},{"style":107},[3454],{"type":62,"value":110},{"type":56,"tag":84,"props":3456,"children":3457},{"style":113},[3458],{"type":62,"value":1181},{"type":56,"tag":84,"props":3460,"children":3461},{"style":107},[3462],{"type":62,"value":121},{"type":56,"tag":84,"props":3464,"children":3465},{"style":113},[3466],{"type":62,"value":3467}," createWSClient",{"type":56,"tag":84,"props":3469,"children":3470},{"style":107},[3471],{"type":62,"value":121},{"type":56,"tag":84,"props":3473,"children":3474},{"style":113},[3475],{"type":62,"value":3476}," wsLink",{"type":56,"tag":84,"props":3478,"children":3479},{"style":107},[3480],{"type":62,"value":131},{"type":56,"tag":84,"props":3482,"children":3483},{"style":101},[3484],{"type":62,"value":136},{"type":56,"tag":84,"props":3486,"children":3487},{"style":107},[3488],{"type":62,"value":141},{"type":56,"tag":84,"props":3490,"children":3491},{"style":144},[3492],{"type":62,"value":1207},{"type":56,"tag":84,"props":3494,"children":3495},{"style":107},[3496],{"type":62,"value":152},{"type":56,"tag":84,"props":3498,"children":3499},{"style":107},[3500],{"type":62,"value":157},{"type":56,"tag":84,"props":3502,"children":3503},{"class":86,"line":160},[3504,3508,3512,3516,3520,3524,3528,3532,3536,3540],{"type":56,"tag":84,"props":3505,"children":3506},{"style":101},[3507],{"type":62,"value":104},{"type":56,"tag":84,"props":3509,"children":3510},{"style":101},[3511],{"type":62,"value":170},{"type":56,"tag":84,"props":3513,"children":3514},{"style":107},[3515],{"type":62,"value":110},{"type":56,"tag":84,"props":3517,"children":3518},{"style":113},[3519],{"type":62,"value":1235},{"type":56,"tag":84,"props":3521,"children":3522},{"style":107},[3523],{"type":62,"value":131},{"type":56,"tag":84,"props":3525,"children":3526},{"style":101},[3527],{"type":62,"value":136},{"type":56,"tag":84,"props":3529,"children":3530},{"style":107},[3531],{"type":62,"value":141},{"type":56,"tag":84,"props":3533,"children":3534},{"style":144},[3535],{"type":62,"value":1252},{"type":56,"tag":84,"props":3537,"children":3538},{"style":107},[3539],{"type":62,"value":152},{"type":56,"tag":84,"props":3541,"children":3542},{"style":107},[3543],{"type":62,"value":157},{"type":56,"tag":84,"props":3545,"children":3546},{"class":86,"line":207},[3547],{"type":56,"tag":84,"props":3548,"children":3549},{"emptyLinePlaceholder":211},[3550],{"type":62,"value":214},{"type":56,"tag":84,"props":3552,"children":3553},{"class":86,"line":217},[3554,3558,3563,3567,3571,3575],{"type":56,"tag":84,"props":3555,"children":3556},{"style":226},[3557],{"type":62,"value":641},{"type":56,"tag":84,"props":3559,"children":3560},{"style":113},[3561],{"type":62,"value":3562}," wsClient ",{"type":56,"tag":84,"props":3564,"children":3565},{"style":107},[3566],{"type":62,"value":651},{"type":56,"tag":84,"props":3568,"children":3569},{"style":237},[3570],{"type":62,"value":3467},{"type":56,"tag":84,"props":3572,"children":3573},{"style":113},[3574],{"type":62,"value":356},{"type":56,"tag":84,"props":3576,"children":3577},{"style":107},[3578],{"type":62,"value":413},{"type":56,"tag":84,"props":3580,"children":3581},{"class":86,"line":274},[3582,3587,3591,3595,3600,3604],{"type":56,"tag":84,"props":3583,"children":3584},{"style":353},[3585],{"type":62,"value":3586},"  url",{"type":56,"tag":84,"props":3588,"children":3589},{"style":107},[3590],{"type":62,"value":539},{"type":56,"tag":84,"props":3592,"children":3593},{"style":107},[3594],{"type":62,"value":141},{"type":56,"tag":84,"props":3596,"children":3597},{"style":144},[3598],{"type":62,"value":3599},"ws:\u002F\u002Flocalhost:3001",{"type":56,"tag":84,"props":3601,"children":3602},{"style":107},[3603],{"type":62,"value":152},{"type":56,"tag":84,"props":3605,"children":3606},{"style":107},[3607],{"type":62,"value":1477},{"type":56,"tag":84,"props":3609,"children":3610},{"class":86,"line":301},[3611,3616,3620,3624,3628,3632,3636],{"type":56,"tag":84,"props":3612,"children":3613},{"style":237},[3614],{"type":62,"value":3615},"  connectionParams",{"type":56,"tag":84,"props":3617,"children":3618},{"style":107},[3619],{"type":62,"value":539},{"type":56,"tag":84,"props":3621,"children":3622},{"style":226},[3623],{"type":62,"value":229},{"type":56,"tag":84,"props":3625,"children":3626},{"style":107},[3627],{"type":62,"value":2882},{"type":56,"tag":84,"props":3629,"children":3630},{"style":226},[3631],{"type":62,"value":1879},{"type":56,"tag":84,"props":3633,"children":3634},{"style":113},[3635],{"type":62,"value":398},{"type":56,"tag":84,"props":3637,"children":3638},{"style":107},[3639],{"type":62,"value":413},{"type":56,"tag":84,"props":3641,"children":3642},{"class":86,"line":387},[3643,3648,3652,3657,3661],{"type":56,"tag":84,"props":3644,"children":3645},{"style":353},[3646],{"type":62,"value":3647},"    token",{"type":56,"tag":84,"props":3649,"children":3650},{"style":107},[3651],{"type":62,"value":539},{"type":56,"tag":84,"props":3653,"children":3654},{"style":237},[3655],{"type":62,"value":3656}," getToken",{"type":56,"tag":84,"props":3658,"children":3659},{"style":113},[3660],{"type":62,"value":294},{"type":56,"tag":84,"props":3662,"children":3663},{"style":107},[3664],{"type":62,"value":1477},{"type":56,"tag":84,"props":3666,"children":3667},{"class":86,"line":416},[3668,3673,3677],{"type":56,"tag":84,"props":3669,"children":3670},{"style":107},[3671],{"type":62,"value":3672},"  }",{"type":56,"tag":84,"props":3674,"children":3675},{"style":113},[3676],{"type":62,"value":266},{"type":56,"tag":84,"props":3678,"children":3679},{"style":107},[3680],{"type":62,"value":1477},{"type":56,"tag":84,"props":3682,"children":3683},{"class":86,"line":466},[3684,3688,3692],{"type":56,"tag":84,"props":3685,"children":3686},{"style":107},[3687],{"type":62,"value":1585},{"type":56,"tag":84,"props":3689,"children":3690},{"style":113},[3691],{"type":62,"value":266},{"type":56,"tag":84,"props":3693,"children":3694},{"style":107},[3695],{"type":62,"value":157},{"type":56,"tag":84,"props":3697,"children":3698},{"class":86,"line":488},[3699],{"type":56,"tag":84,"props":3700,"children":3701},{"emptyLinePlaceholder":211},[3702],{"type":62,"value":214},{"type":56,"tag":84,"props":3704,"children":3705},{"class":86,"line":497},[3706,3710,3714,3718,3722,3726,3730,3734,3738],{"type":56,"tag":84,"props":3707,"children":3708},{"style":226},[3709],{"type":62,"value":641},{"type":56,"tag":84,"props":3711,"children":3712},{"style":113},[3713],{"type":62,"value":1385},{"type":56,"tag":84,"props":3715,"children":3716},{"style":107},[3717],{"type":62,"value":651},{"type":56,"tag":84,"props":3719,"children":3720},{"style":237},[3721],{"type":62,"value":1181},{"type":56,"tag":84,"props":3723,"children":3724},{"style":107},[3725],{"type":62,"value":605},{"type":56,"tag":84,"props":3727,"children":3728},{"style":259},[3729],{"type":62,"value":1402},{"type":56,"tag":84,"props":3731,"children":3732},{"style":107},[3733],{"type":62,"value":678},{"type":56,"tag":84,"props":3735,"children":3736},{"style":113},[3737],{"type":62,"value":356},{"type":56,"tag":84,"props":3739,"children":3740},{"style":107},[3741],{"type":62,"value":413},{"type":56,"tag":84,"props":3743,"children":3744},{"class":86,"line":511},[3745,3749,3753,3758,3763,3767,3771,3776,3780,3784,3788,3793],{"type":56,"tag":84,"props":3746,"children":3747},{"style":353},[3748],{"type":62,"value":1422},{"type":56,"tag":84,"props":3750,"children":3751},{"style":107},[3752],{"type":62,"value":539},{"type":56,"tag":84,"props":3754,"children":3755},{"style":113},[3756],{"type":62,"value":3757}," [",{"type":56,"tag":84,"props":3759,"children":3760},{"style":237},[3761],{"type":62,"value":3762},"wsLink",{"type":56,"tag":84,"props":3764,"children":3765},{"style":113},[3766],{"type":62,"value":356},{"type":56,"tag":84,"props":3768,"children":3769},{"style":107},[3770],{"type":62,"value":936},{"type":56,"tag":84,"props":3772,"children":3773},{"style":353},[3774],{"type":62,"value":3775}," client",{"type":56,"tag":84,"props":3777,"children":3778},{"style":107},[3779],{"type":62,"value":539},{"type":56,"tag":84,"props":3781,"children":3782},{"style":113},[3783],{"type":62,"value":3562},{"type":56,"tag":84,"props":3785,"children":3786},{"style":107},[3787],{"type":62,"value":1585},{"type":56,"tag":84,"props":3789,"children":3790},{"style":113},[3791],{"type":62,"value":3792},")]",{"type":56,"tag":84,"props":3794,"children":3795},{"style":107},[3796],{"type":62,"value":1477},{"type":56,"tag":84,"props":3798,"children":3799},{"class":86,"line":520},[3800,3804,3808],{"type":56,"tag":84,"props":3801,"children":3802},{"style":107},[3803],{"type":62,"value":1585},{"type":56,"tag":84,"props":3805,"children":3806},{"style":113},[3807],{"type":62,"value":266},{"type":56,"tag":84,"props":3809,"children":3810},{"style":107},[3811],{"type":62,"value":157},{"type":56,"tag":1601,"props":3813,"children":3815},{"id":3814},"sse-auth-with-cookies-same-domain",[3816],{"type":62,"value":3817},"SSE auth with cookies (same domain)",{"type":56,"tag":72,"props":3819,"children":3821},{"className":74,"code":3820,"language":76,"meta":77,"style":77},"import {\n  createTRPCClient,\n  httpBatchLink,\n  httpSubscriptionLink,\n  splitLink,\n} from '@trpc\u002Fclient';\nimport type { AppRouter } from '..\u002Fserver\u002Frouter';\n\nconst trpc = createTRPCClient\u003CAppRouter>({\n  links: [\n    splitLink({\n      condition: (op) => op.type === 'subscription',\n      true: httpSubscriptionLink({\n        url: '\u002Fapi\u002Ftrpc',\n        eventSourceOptions() {\n          return { withCredentials: true };\n        },\n      }),\n      false: httpBatchLink({ url: '\u002Fapi\u002Ftrpc' }),\n    }),\n  ],\n});\n",[3822],{"type":56,"tag":80,"props":3823,"children":3824},{"__ignoreMap":77},[3825,3836,3847,3858,3869,3880,3907,3950,3957,3996,4011,4026,4085,4108,4136,4151,4181,4188,4203,4259,4274,4285],{"type":56,"tag":84,"props":3826,"children":3827},{"class":86,"line":87},[3828,3832],{"type":56,"tag":84,"props":3829,"children":3830},{"style":101},[3831],{"type":62,"value":104},{"type":56,"tag":84,"props":3833,"children":3834},{"style":107},[3835],{"type":62,"value":271},{"type":56,"tag":84,"props":3837,"children":3838},{"class":86,"line":97},[3839,3843],{"type":56,"tag":84,"props":3840,"children":3841},{"style":113},[3842],{"type":62,"value":2495},{"type":56,"tag":84,"props":3844,"children":3845},{"style":107},[3846],{"type":62,"value":1477},{"type":56,"tag":84,"props":3848,"children":3849},{"class":86,"line":160},[3850,3854],{"type":56,"tag":84,"props":3851,"children":3852},{"style":113},[3853],{"type":62,"value":2507},{"type":56,"tag":84,"props":3855,"children":3856},{"style":107},[3857],{"type":62,"value":1477},{"type":56,"tag":84,"props":3859,"children":3860},{"class":86,"line":207},[3861,3865],{"type":56,"tag":84,"props":3862,"children":3863},{"style":113},[3864],{"type":62,"value":2519},{"type":56,"tag":84,"props":3866,"children":3867},{"style":107},[3868],{"type":62,"value":1477},{"type":56,"tag":84,"props":3870,"children":3871},{"class":86,"line":217},[3872,3876],{"type":56,"tag":84,"props":3873,"children":3874},{"style":113},[3875],{"type":62,"value":2531},{"type":56,"tag":84,"props":3877,"children":3878},{"style":107},[3879],{"type":62,"value":1477},{"type":56,"tag":84,"props":3881,"children":3882},{"class":86,"line":274},[3883,3887,3891,3895,3899,3903],{"type":56,"tag":84,"props":3884,"children":3885},{"style":107},[3886],{"type":62,"value":1585},{"type":56,"tag":84,"props":3888,"children":3889},{"style":101},[3890],{"type":62,"value":136},{"type":56,"tag":84,"props":3892,"children":3893},{"style":107},[3894],{"type":62,"value":141},{"type":56,"tag":84,"props":3896,"children":3897},{"style":144},[3898],{"type":62,"value":1207},{"type":56,"tag":84,"props":3900,"children":3901},{"style":107},[3902],{"type":62,"value":152},{"type":56,"tag":84,"props":3904,"children":3905},{"style":107},[3906],{"type":62,"value":157},{"type":56,"tag":84,"props":3908,"children":3909},{"class":86,"line":301},[3910,3914,3918,3922,3926,3930,3934,3938,3942,3946],{"type":56,"tag":84,"props":3911,"children":3912},{"style":101},[3913],{"type":62,"value":104},{"type":56,"tag":84,"props":3915,"children":3916},{"style":101},[3917],{"type":62,"value":170},{"type":56,"tag":84,"props":3919,"children":3920},{"style":107},[3921],{"type":62,"value":110},{"type":56,"tag":84,"props":3923,"children":3924},{"style":113},[3925],{"type":62,"value":1235},{"type":56,"tag":84,"props":3927,"children":3928},{"style":107},[3929],{"type":62,"value":131},{"type":56,"tag":84,"props":3931,"children":3932},{"style":101},[3933],{"type":62,"value":136},{"type":56,"tag":84,"props":3935,"children":3936},{"style":107},[3937],{"type":62,"value":141},{"type":56,"tag":84,"props":3939,"children":3940},{"style":144},[3941],{"type":62,"value":1252},{"type":56,"tag":84,"props":3943,"children":3944},{"style":107},[3945],{"type":62,"value":152},{"type":56,"tag":84,"props":3947,"children":3948},{"style":107},[3949],{"type":62,"value":157},{"type":56,"tag":84,"props":3951,"children":3952},{"class":86,"line":387},[3953],{"type":56,"tag":84,"props":3954,"children":3955},{"emptyLinePlaceholder":211},[3956],{"type":62,"value":214},{"type":56,"tag":84,"props":3958,"children":3959},{"class":86,"line":416},[3960,3964,3968,3972,3976,3980,3984,3988,3992],{"type":56,"tag":84,"props":3961,"children":3962},{"style":226},[3963],{"type":62,"value":641},{"type":56,"tag":84,"props":3965,"children":3966},{"style":113},[3967],{"type":62,"value":1385},{"type":56,"tag":84,"props":3969,"children":3970},{"style":107},[3971],{"type":62,"value":651},{"type":56,"tag":84,"props":3973,"children":3974},{"style":237},[3975],{"type":62,"value":1181},{"type":56,"tag":84,"props":3977,"children":3978},{"style":107},[3979],{"type":62,"value":605},{"type":56,"tag":84,"props":3981,"children":3982},{"style":259},[3983],{"type":62,"value":1402},{"type":56,"tag":84,"props":3985,"children":3986},{"style":107},[3987],{"type":62,"value":678},{"type":56,"tag":84,"props":3989,"children":3990},{"style":113},[3991],{"type":62,"value":356},{"type":56,"tag":84,"props":3993,"children":3994},{"style":107},[3995],{"type":62,"value":413},{"type":56,"tag":84,"props":3997,"children":3998},{"class":86,"line":466},[3999,4003,4007],{"type":56,"tag":84,"props":4000,"children":4001},{"style":353},[4002],{"type":62,"value":1422},{"type":56,"tag":84,"props":4004,"children":4005},{"style":107},[4006],{"type":62,"value":539},{"type":56,"tag":84,"props":4008,"children":4009},{"style":113},[4010],{"type":62,"value":1431},{"type":56,"tag":84,"props":4012,"children":4013},{"class":86,"line":488},[4014,4018,4022],{"type":56,"tag":84,"props":4015,"children":4016},{"style":237},[4017],{"type":62,"value":2715},{"type":56,"tag":84,"props":4019,"children":4020},{"style":113},[4021],{"type":62,"value":356},{"type":56,"tag":84,"props":4023,"children":4024},{"style":107},[4025],{"type":62,"value":413},{"type":56,"tag":84,"props":4027,"children":4028},{"class":86,"line":497},[4029,4033,4037,4041,4045,4049,4053,4057,4061,4065,4069,4073,4077,4081],{"type":56,"tag":84,"props":4030,"children":4031},{"style":237},[4032],{"type":62,"value":2731},{"type":56,"tag":84,"props":4034,"children":4035},{"style":107},[4036],{"type":62,"value":539},{"type":56,"tag":84,"props":4038,"children":4039},{"style":107},[4040],{"type":62,"value":398},{"type":56,"tag":84,"props":4042,"children":4043},{"style":248},[4044],{"type":62,"value":2744},{"type":56,"tag":84,"props":4046,"children":4047},{"style":107},[4048],{"type":62,"value":266},{"type":56,"tag":84,"props":4050,"children":4051},{"style":226},[4052],{"type":62,"value":1879},{"type":56,"tag":84,"props":4054,"children":4055},{"style":113},[4056],{"type":62,"value":2757},{"type":56,"tag":84,"props":4058,"children":4059},{"style":107},[4060],{"type":62,"value":326},{"type":56,"tag":84,"props":4062,"children":4063},{"style":113},[4064],{"type":62,"value":2766},{"type":56,"tag":84,"props":4066,"children":4067},{"style":107},[4068],{"type":62,"value":2771},{"type":56,"tag":84,"props":4070,"children":4071},{"style":107},[4072],{"type":62,"value":141},{"type":56,"tag":84,"props":4074,"children":4075},{"style":144},[4076],{"type":62,"value":2780},{"type":56,"tag":84,"props":4078,"children":4079},{"style":107},[4080],{"type":62,"value":152},{"type":56,"tag":84,"props":4082,"children":4083},{"style":107},[4084],{"type":62,"value":1477},{"type":56,"tag":84,"props":4086,"children":4087},{"class":86,"line":511},[4088,4092,4096,4100,4104],{"type":56,"tag":84,"props":4089,"children":4090},{"style":353},[4091],{"type":62,"value":2796},{"type":56,"tag":84,"props":4093,"children":4094},{"style":107},[4095],{"type":62,"value":539},{"type":56,"tag":84,"props":4097,"children":4098},{"style":237},[4099],{"type":62,"value":2805},{"type":56,"tag":84,"props":4101,"children":4102},{"style":113},[4103],{"type":62,"value":356},{"type":56,"tag":84,"props":4105,"children":4106},{"style":107},[4107],{"type":62,"value":413},{"type":56,"tag":84,"props":4109,"children":4110},{"class":86,"line":520},[4111,4115,4119,4123,4128,4132],{"type":56,"tag":84,"props":4112,"children":4113},{"style":353},[4114],{"type":62,"value":2821},{"type":56,"tag":84,"props":4116,"children":4117},{"style":107},[4118],{"type":62,"value":539},{"type":56,"tag":84,"props":4120,"children":4121},{"style":107},[4122],{"type":62,"value":141},{"type":56,"tag":84,"props":4124,"children":4125},{"style":144},[4126],{"type":62,"value":4127},"\u002Fapi\u002Ftrpc",{"type":56,"tag":84,"props":4129,"children":4130},{"style":107},[4131],{"type":62,"value":152},{"type":56,"tag":84,"props":4133,"children":4134},{"style":107},[4135],{"type":62,"value":1477},{"type":56,"tag":84,"props":4137,"children":4138},{"class":86,"line":560},[4139,4143,4147],{"type":56,"tag":84,"props":4140,"children":4141},{"style":353},[4142],{"type":62,"value":2869},{"type":56,"tag":84,"props":4144,"children":4145},{"style":107},[4146],{"type":62,"value":294},{"type":56,"tag":84,"props":4148,"children":4149},{"style":107},[4150],{"type":62,"value":271},{"type":56,"tag":84,"props":4152,"children":4153},{"class":86,"line":569},[4154,4158,4162,4167,4171,4177],{"type":56,"tag":84,"props":4155,"children":4156},{"style":101},[4157],{"type":62,"value":2898},{"type":56,"tag":84,"props":4159,"children":4160},{"style":107},[4161],{"type":62,"value":110},{"type":56,"tag":84,"props":4163,"children":4164},{"style":353},[4165],{"type":62,"value":4166}," withCredentials",{"type":56,"tag":84,"props":4168,"children":4169},{"style":107},[4170],{"type":62,"value":539},{"type":56,"tag":84,"props":4172,"children":4174},{"style":4173},"--shiki-light:#FF5370;--shiki-default:#FF9CAC;--shiki-dark:#FF9CAC",[4175],{"type":62,"value":4176}," true",{"type":56,"tag":84,"props":4178,"children":4179},{"style":107},[4180],{"type":62,"value":1543},{"type":56,"tag":84,"props":4182,"children":4183},{"class":86,"line":577},[4184],{"type":56,"tag":84,"props":4185,"children":4186},{"style":107},[4187],{"type":62,"value":2983},{"type":56,"tag":84,"props":4189,"children":4190},{"class":86,"line":627},[4191,4195,4199],{"type":56,"tag":84,"props":4192,"children":4193},{"style":107},[4194],{"type":62,"value":2991},{"type":56,"tag":84,"props":4196,"children":4197},{"style":113},[4198],{"type":62,"value":266},{"type":56,"tag":84,"props":4200,"children":4201},{"style":107},[4202],{"type":62,"value":1477},{"type":56,"tag":84,"props":4204,"children":4205},{"class":86,"line":635},[4206,4210,4214,4218,4222,4226,4231,4235,4239,4243,4247,4251,4255],{"type":56,"tag":84,"props":4207,"children":4208},{"style":353},[4209],{"type":62,"value":3007},{"type":56,"tag":84,"props":4211,"children":4212},{"style":107},[4213],{"type":62,"value":539},{"type":56,"tag":84,"props":4215,"children":4216},{"style":237},[4217],{"type":62,"value":1190},{"type":56,"tag":84,"props":4219,"children":4220},{"style":113},[4221],{"type":62,"value":356},{"type":56,"tag":84,"props":4223,"children":4224},{"style":107},[4225],{"type":62,"value":936},{"type":56,"tag":84,"props":4227,"children":4228},{"style":353},[4229],{"type":62,"value":4230}," url",{"type":56,"tag":84,"props":4232,"children":4233},{"style":107},[4234],{"type":62,"value":539},{"type":56,"tag":84,"props":4236,"children":4237},{"style":107},[4238],{"type":62,"value":141},{"type":56,"tag":84,"props":4240,"children":4241},{"style":144},[4242],{"type":62,"value":4127},{"type":56,"tag":84,"props":4244,"children":4245},{"style":107},[4246],{"type":62,"value":152},{"type":56,"tag":84,"props":4248,"children":4249},{"style":107},[4250],{"type":62,"value":131},{"type":56,"tag":84,"props":4252,"children":4253},{"style":113},[4254],{"type":62,"value":266},{"type":56,"tag":84,"props":4256,"children":4257},{"style":107},[4258],{"type":62,"value":1477},{"type":56,"tag":84,"props":4260,"children":4261},{"class":86,"line":702},[4262,4266,4270],{"type":56,"tag":84,"props":4263,"children":4264},{"style":107},[4265],{"type":62,"value":1075},{"type":56,"tag":84,"props":4267,"children":4268},{"style":113},[4269],{"type":62,"value":266},{"type":56,"tag":84,"props":4271,"children":4272},{"style":107},[4273],{"type":62,"value":1477},{"type":56,"tag":84,"props":4275,"children":4276},{"class":86,"line":710},[4277,4281],{"type":56,"tag":84,"props":4278,"children":4279},{"style":113},[4280],{"type":62,"value":1573},{"type":56,"tag":84,"props":4282,"children":4283},{"style":107},[4284],{"type":62,"value":1477},{"type":56,"tag":84,"props":4286,"children":4287},{"class":86,"line":750},[4288,4292,4296],{"type":56,"tag":84,"props":4289,"children":4290},{"style":107},[4291],{"type":62,"value":1585},{"type":56,"tag":84,"props":4293,"children":4294},{"style":113},[4295],{"type":62,"value":266},{"type":56,"tag":84,"props":4297,"children":4298},{"style":107},[4299],{"type":62,"value":157},{"type":56,"tag":65,"props":4301,"children":4303},{"id":4302},"common-mistakes",[4304],{"type":62,"value":4305},"Common Mistakes",{"type":56,"tag":1601,"props":4307,"children":4309},{"id":4308},"high-not-narrowing-user-type-in-auth-middleware",[4310],{"type":62,"value":4311},"HIGH Not narrowing user type in auth middleware",{"type":56,"tag":4313,"props":4314,"children":4315},"p",{},[4316],{"type":62,"value":4317},"Wrong:",{"type":56,"tag":72,"props":4319,"children":4321},{"className":74,"code":4320,"language":76,"meta":77,"style":77},"const authMiddleware = t.middleware(async ({ ctx, next }) => {\n  if (!ctx.user) throw new TRPCError({ code: 'UNAUTHORIZED' });\n  return next(); \u002F\u002F user still nullable downstream\n});\n",[4322],{"type":56,"tag":80,"props":4323,"children":4324},{"__ignoreMap":77},[4325,4389,4473,4497],{"type":56,"tag":84,"props":4326,"children":4327},{"class":86,"line":87},[4328,4332,4337,4341,4345,4349,4353,4357,4361,4365,4369,4373,4377,4381,4385],{"type":56,"tag":84,"props":4329,"children":4330},{"style":226},[4331],{"type":62,"value":641},{"type":56,"tag":84,"props":4333,"children":4334},{"style":113},[4335],{"type":62,"value":4336}," authMiddleware ",{"type":56,"tag":84,"props":4338,"children":4339},{"style":107},[4340],{"type":62,"value":651},{"type":56,"tag":84,"props":4342,"children":4343},{"style":113},[4344],{"type":62,"value":734},{"type":56,"tag":84,"props":4346,"children":4347},{"style":107},[4348],{"type":62,"value":326},{"type":56,"tag":84,"props":4350,"children":4351},{"style":237},[4352],{"type":62,"value":1842},{"type":56,"tag":84,"props":4354,"children":4355},{"style":113},[4356],{"type":62,"value":356},{"type":56,"tag":84,"props":4358,"children":4359},{"style":226},[4360],{"type":62,"value":1851},{"type":56,"tag":84,"props":4362,"children":4363},{"style":107},[4364],{"type":62,"value":1856},{"type":56,"tag":84,"props":4366,"children":4367},{"style":248},[4368],{"type":62,"value":853},{"type":56,"tag":84,"props":4370,"children":4371},{"style":107},[4372],{"type":62,"value":121},{"type":56,"tag":84,"props":4374,"children":4375},{"style":248},[4376],{"type":62,"value":1869},{"type":56,"tag":84,"props":4378,"children":4379},{"style":107},[4380],{"type":62,"value":1874},{"type":56,"tag":84,"props":4382,"children":4383},{"style":226},[4384],{"type":62,"value":1879},{"type":56,"tag":84,"props":4386,"children":4387},{"style":107},[4388],{"type":62,"value":271},{"type":56,"tag":84,"props":4390,"children":4391},{"class":86,"line":97},[4392,4396,4400,4404,4408,4412,4416,4420,4425,4429,4433,4437,4441,4445,4449,4453,4457,4461,4465,4469],{"type":56,"tag":84,"props":4393,"children":4394},{"style":101},[4395],{"type":62,"value":1891},{"type":56,"tag":84,"props":4397,"children":4398},{"style":353},[4399],{"type":62,"value":398},{"type":56,"tag":84,"props":4401,"children":4402},{"style":107},[4403],{"type":62,"value":887},{"type":56,"tag":84,"props":4405,"children":4406},{"style":113},[4407],{"type":62,"value":892},{"type":56,"tag":84,"props":4409,"children":4410},{"style":107},[4411],{"type":62,"value":326},{"type":56,"tag":84,"props":4413,"children":4414},{"style":113},[4415],{"type":62,"value":901},{"type":56,"tag":84,"props":4417,"children":4418},{"style":353},[4419],{"type":62,"value":408},{"type":56,"tag":84,"props":4421,"children":4422},{"style":101},[4423],{"type":62,"value":4424},"throw",{"type":56,"tag":84,"props":4426,"children":4427},{"style":107},[4428],{"type":62,"value":923},{"type":56,"tag":84,"props":4430,"children":4431},{"style":237},[4432],{"type":62,"value":126},{"type":56,"tag":84,"props":4434,"children":4435},{"style":353},[4436],{"type":62,"value":356},{"type":56,"tag":84,"props":4438,"children":4439},{"style":107},[4440],{"type":62,"value":936},{"type":56,"tag":84,"props":4442,"children":4443},{"style":353},[4444],{"type":62,"value":941},{"type":56,"tag":84,"props":4446,"children":4447},{"style":107},[4448],{"type":62,"value":539},{"type":56,"tag":84,"props":4450,"children":4451},{"style":107},[4452],{"type":62,"value":141},{"type":56,"tag":84,"props":4454,"children":4455},{"style":144},[4456],{"type":62,"value":954},{"type":56,"tag":84,"props":4458,"children":4459},{"style":107},[4460],{"type":62,"value":152},{"type":56,"tag":84,"props":4462,"children":4463},{"style":107},[4464],{"type":62,"value":131},{"type":56,"tag":84,"props":4466,"children":4467},{"style":353},[4468],{"type":62,"value":266},{"type":56,"tag":84,"props":4470,"children":4471},{"style":107},[4472],{"type":62,"value":157},{"type":56,"tag":84,"props":4474,"children":4475},{"class":86,"line":160},[4476,4480,4484,4488,4492],{"type":56,"tag":84,"props":4477,"children":4478},{"style":101},[4479],{"type":62,"value":526},{"type":56,"tag":84,"props":4481,"children":4482},{"style":237},[4483],{"type":62,"value":1869},{"type":56,"tag":84,"props":4485,"children":4486},{"style":353},[4487],{"type":62,"value":294},{"type":56,"tag":84,"props":4489,"children":4490},{"style":107},[4491],{"type":62,"value":458},{"type":56,"tag":84,"props":4493,"children":4494},{"style":91},[4495],{"type":62,"value":4496}," \u002F\u002F user still nullable downstream\n",{"type":56,"tag":84,"props":4498,"children":4499},{"class":86,"line":207},[4500,4504,4508],{"type":56,"tag":84,"props":4501,"children":4502},{"style":107},[4503],{"type":62,"value":1585},{"type":56,"tag":84,"props":4505,"children":4506},{"style":113},[4507],{"type":62,"value":266},{"type":56,"tag":84,"props":4509,"children":4510},{"style":107},[4511],{"type":62,"value":157},{"type":56,"tag":4313,"props":4513,"children":4514},{},[4515],{"type":62,"value":4516},"Correct:",{"type":56,"tag":72,"props":4518,"children":4520},{"className":74,"code":4519,"language":76,"meta":77,"style":77},"const authMiddleware = t.middleware(async ({ ctx, next }) => {\n  if (!ctx.user) throw new TRPCError({ code: 'UNAUTHORIZED' });\n  return next({ ctx: { user: ctx.user } }); \u002F\u002F narrows to non-null\n});\n",[4521],{"type":56,"tag":80,"props":4522,"children":4523},{"__ignoreMap":77},[4524,4587,4670,4742],{"type":56,"tag":84,"props":4525,"children":4526},{"class":86,"line":87},[4527,4531,4535,4539,4543,4547,4551,4555,4559,4563,4567,4571,4575,4579,4583],{"type":56,"tag":84,"props":4528,"children":4529},{"style":226},[4530],{"type":62,"value":641},{"type":56,"tag":84,"props":4532,"children":4533},{"style":113},[4534],{"type":62,"value":4336},{"type":56,"tag":84,"props":4536,"children":4537},{"style":107},[4538],{"type":62,"value":651},{"type":56,"tag":84,"props":4540,"children":4541},{"style":113},[4542],{"type":62,"value":734},{"type":56,"tag":84,"props":4544,"children":4545},{"style":107},[4546],{"type":62,"value":326},{"type":56,"tag":84,"props":4548,"children":4549},{"style":237},[4550],{"type":62,"value":1842},{"type":56,"tag":84,"props":4552,"children":4553},{"style":113},[4554],{"type":62,"value":356},{"type":56,"tag":84,"props":4556,"children":4557},{"style":226},[4558],{"type":62,"value":1851},{"type":56,"tag":84,"props":4560,"children":4561},{"style":107},[4562],{"type":62,"value":1856},{"type":56,"tag":84,"props":4564,"children":4565},{"style":248},[4566],{"type":62,"value":853},{"type":56,"tag":84,"props":4568,"children":4569},{"style":107},[4570],{"type":62,"value":121},{"type":56,"tag":84,"props":4572,"children":4573},{"style":248},[4574],{"type":62,"value":1869},{"type":56,"tag":84,"props":4576,"children":4577},{"style":107},[4578],{"type":62,"value":1874},{"type":56,"tag":84,"props":4580,"children":4581},{"style":226},[4582],{"type":62,"value":1879},{"type":56,"tag":84,"props":4584,"children":4585},{"style":107},[4586],{"type":62,"value":271},{"type":56,"tag":84,"props":4588,"children":4589},{"class":86,"line":97},[4590,4594,4598,4602,4606,4610,4614,4618,4622,4626,4630,4634,4638,4642,4646,4650,4654,4658,4662,4666],{"type":56,"tag":84,"props":4591,"children":4592},{"style":101},[4593],{"type":62,"value":1891},{"type":56,"tag":84,"props":4595,"children":4596},{"style":353},[4597],{"type":62,"value":398},{"type":56,"tag":84,"props":4599,"children":4600},{"style":107},[4601],{"type":62,"value":887},{"type":56,"tag":84,"props":4603,"children":4604},{"style":113},[4605],{"type":62,"value":892},{"type":56,"tag":84,"props":4607,"children":4608},{"style":107},[4609],{"type":62,"value":326},{"type":56,"tag":84,"props":4611,"children":4612},{"style":113},[4613],{"type":62,"value":901},{"type":56,"tag":84,"props":4615,"children":4616},{"style":353},[4617],{"type":62,"value":408},{"type":56,"tag":84,"props":4619,"children":4620},{"style":101},[4621],{"type":62,"value":4424},{"type":56,"tag":84,"props":4623,"children":4624},{"style":107},[4625],{"type":62,"value":923},{"type":56,"tag":84,"props":4627,"children":4628},{"style":237},[4629],{"type":62,"value":126},{"type":56,"tag":84,"props":4631,"children":4632},{"style":353},[4633],{"type":62,"value":356},{"type":56,"tag":84,"props":4635,"children":4636},{"style":107},[4637],{"type":62,"value":936},{"type":56,"tag":84,"props":4639,"children":4640},{"style":353},[4641],{"type":62,"value":941},{"type":56,"tag":84,"props":4643,"children":4644},{"style":107},[4645],{"type":62,"value":539},{"type":56,"tag":84,"props":4647,"children":4648},{"style":107},[4649],{"type":62,"value":141},{"type":56,"tag":84,"props":4651,"children":4652},{"style":144},[4653],{"type":62,"value":954},{"type":56,"tag":84,"props":4655,"children":4656},{"style":107},[4657],{"type":62,"value":152},{"type":56,"tag":84,"props":4659,"children":4660},{"style":107},[4661],{"type":62,"value":131},{"type":56,"tag":84,"props":4663,"children":4664},{"style":353},[4665],{"type":62,"value":266},{"type":56,"tag":84,"props":4667,"children":4668},{"style":107},[4669],{"type":62,"value":157},{"type":56,"tag":84,"props":4671,"children":4672},{"class":86,"line":160},[4673,4677,4681,4685,4689,4693,4697,4701,4705,4709,4713,4717,4721,4725,4729,4733,4737],{"type":56,"tag":84,"props":4674,"children":4675},{"style":101},[4676],{"type":62,"value":526},{"type":56,"tag":84,"props":4678,"children":4679},{"style":237},[4680],{"type":62,"value":1869},{"type":56,"tag":84,"props":4682,"children":4683},{"style":353},[4684],{"type":62,"value":356},{"type":56,"tag":84,"props":4686,"children":4687},{"style":107},[4688],{"type":62,"value":936},{"type":56,"tag":84,"props":4690,"children":4691},{"style":353},[4692],{"type":62,"value":853},{"type":56,"tag":84,"props":4694,"children":4695},{"style":107},[4696],{"type":62,"value":539},{"type":56,"tag":84,"props":4698,"children":4699},{"style":107},[4700],{"type":62,"value":110},{"type":56,"tag":84,"props":4702,"children":4703},{"style":353},[4704],{"type":62,"value":427},{"type":56,"tag":84,"props":4706,"children":4707},{"style":107},[4708],{"type":62,"value":539},{"type":56,"tag":84,"props":4710,"children":4711},{"style":113},[4712],{"type":62,"value":853},{"type":56,"tag":84,"props":4714,"children":4715},{"style":107},[4716],{"type":62,"value":326},{"type":56,"tag":84,"props":4718,"children":4719},{"style":113},[4720],{"type":62,"value":901},{"type":56,"tag":84,"props":4722,"children":4723},{"style":107},[4724],{"type":62,"value":131},{"type":56,"tag":84,"props":4726,"children":4727},{"style":107},[4728],{"type":62,"value":131},{"type":56,"tag":84,"props":4730,"children":4731},{"style":353},[4732],{"type":62,"value":266},{"type":56,"tag":84,"props":4734,"children":4735},{"style":107},[4736],{"type":62,"value":458},{"type":56,"tag":84,"props":4738,"children":4739},{"style":91},[4740],{"type":62,"value":4741}," \u002F\u002F narrows to non-null\n",{"type":56,"tag":84,"props":4743,"children":4744},{"class":86,"line":207},[4745,4749,4753],{"type":56,"tag":84,"props":4746,"children":4747},{"style":107},[4748],{"type":62,"value":1585},{"type":56,"tag":84,"props":4750,"children":4751},{"style":113},[4752],{"type":62,"value":266},{"type":56,"tag":84,"props":4754,"children":4755},{"style":107},[4756],{"type":62,"value":157},{"type":56,"tag":4313,"props":4758,"children":4759},{},[4760,4762,4768,4770,4775,4777,4783],{"type":62,"value":4761},"Without ",{"type":56,"tag":80,"props":4763,"children":4765},{"className":4764},[],[4766],{"type":62,"value":4767},"opts.next({ ctx })",{"type":62,"value":4769},", downstream procedures still see ",{"type":56,"tag":80,"props":4771,"children":4773},{"className":4772},[],[4774],{"type":62,"value":901},{"type":62,"value":4776}," as ",{"type":56,"tag":80,"props":4778,"children":4780},{"className":4779},[],[4781],{"type":62,"value":4782},"{ id: string } | null",{"type":62,"value":4784},", requiring redundant null checks.",{"type":56,"tag":4313,"props":4786,"children":4787},{},[4788],{"type":62,"value":4789},"Source: www\u002Fdocs\u002Fserver\u002Fauthorization.md",{"type":56,"tag":1601,"props":4791,"children":4793},{"id":4792},"high-sse-auth-via-url-query-params-exposes-tokens",[4794],{"type":62,"value":4795},"HIGH SSE auth via URL query params exposes tokens",{"type":56,"tag":4313,"props":4797,"children":4798},{},[4799],{"type":62,"value":4317},{"type":56,"tag":72,"props":4801,"children":4803},{"className":74,"code":4802,"language":76,"meta":77,"style":77},"httpSubscriptionLink({\n  url: 'http:\u002F\u002Flocalhost:3000\u002Ftrpc',\n  connectionParams: async () => ({\n    token: 'my-secret-jwt',\n  }),\n});\n",[4804],{"type":56,"tag":80,"props":4805,"children":4806},{"__ignoreMap":77},[4807,4823,4850,4881,4909,4924],{"type":56,"tag":84,"props":4808,"children":4809},{"class":86,"line":87},[4810,4815,4819],{"type":56,"tag":84,"props":4811,"children":4812},{"style":237},[4813],{"type":62,"value":4814},"httpSubscriptionLink",{"type":56,"tag":84,"props":4816,"children":4817},{"style":113},[4818],{"type":62,"value":356},{"type":56,"tag":84,"props":4820,"children":4821},{"style":107},[4822],{"type":62,"value":413},{"type":56,"tag":84,"props":4824,"children":4825},{"class":86,"line":97},[4826,4830,4834,4838,4842,4846],{"type":56,"tag":84,"props":4827,"children":4828},{"style":353},[4829],{"type":62,"value":3586},{"type":56,"tag":84,"props":4831,"children":4832},{"style":107},[4833],{"type":62,"value":539},{"type":56,"tag":84,"props":4835,"children":4836},{"style":107},[4837],{"type":62,"value":141},{"type":56,"tag":84,"props":4839,"children":4840},{"style":144},[4841],{"type":62,"value":1468},{"type":56,"tag":84,"props":4843,"children":4844},{"style":107},[4845],{"type":62,"value":152},{"type":56,"tag":84,"props":4847,"children":4848},{"style":107},[4849],{"type":62,"value":1477},{"type":56,"tag":84,"props":4851,"children":4852},{"class":86,"line":160},[4853,4857,4861,4865,4869,4873,4877],{"type":56,"tag":84,"props":4854,"children":4855},{"style":237},[4856],{"type":62,"value":3615},{"type":56,"tag":84,"props":4858,"children":4859},{"style":107},[4860],{"type":62,"value":539},{"type":56,"tag":84,"props":4862,"children":4863},{"style":226},[4864],{"type":62,"value":229},{"type":56,"tag":84,"props":4866,"children":4867},{"style":107},[4868],{"type":62,"value":2882},{"type":56,"tag":84,"props":4870,"children":4871},{"style":226},[4872],{"type":62,"value":1879},{"type":56,"tag":84,"props":4874,"children":4875},{"style":113},[4876],{"type":62,"value":398},{"type":56,"tag":84,"props":4878,"children":4879},{"style":107},[4880],{"type":62,"value":413},{"type":56,"tag":84,"props":4882,"children":4883},{"class":86,"line":207},[4884,4888,4892,4896,4901,4905],{"type":56,"tag":84,"props":4885,"children":4886},{"style":353},[4887],{"type":62,"value":3647},{"type":56,"tag":84,"props":4889,"children":4890},{"style":107},[4891],{"type":62,"value":539},{"type":56,"tag":84,"props":4893,"children":4894},{"style":107},[4895],{"type":62,"value":141},{"type":56,"tag":84,"props":4897,"children":4898},{"style":144},[4899],{"type":62,"value":4900},"my-secret-jwt",{"type":56,"tag":84,"props":4902,"children":4903},{"style":107},[4904],{"type":62,"value":152},{"type":56,"tag":84,"props":4906,"children":4907},{"style":107},[4908],{"type":62,"value":1477},{"type":56,"tag":84,"props":4910,"children":4911},{"class":86,"line":217},[4912,4916,4920],{"type":56,"tag":84,"props":4913,"children":4914},{"style":107},[4915],{"type":62,"value":3672},{"type":56,"tag":84,"props":4917,"children":4918},{"style":113},[4919],{"type":62,"value":266},{"type":56,"tag":84,"props":4921,"children":4922},{"style":107},[4923],{"type":62,"value":1477},{"type":56,"tag":84,"props":4925,"children":4926},{"class":86,"line":274},[4927,4931,4935],{"type":56,"tag":84,"props":4928,"children":4929},{"style":107},[4930],{"type":62,"value":1585},{"type":56,"tag":84,"props":4932,"children":4933},{"style":113},[4934],{"type":62,"value":266},{"type":56,"tag":84,"props":4936,"children":4937},{"style":107},[4938],{"type":62,"value":157},{"type":56,"tag":4313,"props":4940,"children":4941},{},[4942],{"type":62,"value":4516},{"type":56,"tag":72,"props":4944,"children":4946},{"className":74,"code":4945,"language":76,"meta":77,"style":77},"import { EventSourcePolyfill } from 'event-source-polyfill';\n\nhttpSubscriptionLink({\n  url: 'http:\u002F\u002Flocalhost:3000\u002Ftrpc',\n  EventSource: EventSourcePolyfill,\n  eventSourceOptions: async () => ({\n    headers: { authorization: 'Bearer my-secret-jwt' },\n  }),\n});\n",[4947],{"type":56,"tag":80,"props":4948,"children":4949},{"__ignoreMap":77},[4950,4989,4996,5011,5038,5058,5090,5133,5148],{"type":56,"tag":84,"props":4951,"children":4952},{"class":86,"line":87},[4953,4957,4961,4965,4969,4973,4977,4981,4985],{"type":56,"tag":84,"props":4954,"children":4955},{"style":101},[4956],{"type":62,"value":104},{"type":56,"tag":84,"props":4958,"children":4959},{"style":107},[4960],{"type":62,"value":110},{"type":56,"tag":84,"props":4962,"children":4963},{"style":113},[4964],{"type":62,"value":2578},{"type":56,"tag":84,"props":4966,"children":4967},{"style":107},[4968],{"type":62,"value":131},{"type":56,"tag":84,"props":4970,"children":4971},{"style":101},[4972],{"type":62,"value":136},{"type":56,"tag":84,"props":4974,"children":4975},{"style":107},[4976],{"type":62,"value":141},{"type":56,"tag":84,"props":4978,"children":4979},{"style":144},[4980],{"type":62,"value":2595},{"type":56,"tag":84,"props":4982,"children":4983},{"style":107},[4984],{"type":62,"value":152},{"type":56,"tag":84,"props":4986,"children":4987},{"style":107},[4988],{"type":62,"value":157},{"type":56,"tag":84,"props":4990,"children":4991},{"class":86,"line":97},[4992],{"type":56,"tag":84,"props":4993,"children":4994},{"emptyLinePlaceholder":211},[4995],{"type":62,"value":214},{"type":56,"tag":84,"props":4997,"children":4998},{"class":86,"line":160},[4999,5003,5007],{"type":56,"tag":84,"props":5000,"children":5001},{"style":237},[5002],{"type":62,"value":4814},{"type":56,"tag":84,"props":5004,"children":5005},{"style":113},[5006],{"type":62,"value":356},{"type":56,"tag":84,"props":5008,"children":5009},{"style":107},[5010],{"type":62,"value":413},{"type":56,"tag":84,"props":5012,"children":5013},{"class":86,"line":207},[5014,5018,5022,5026,5030,5034],{"type":56,"tag":84,"props":5015,"children":5016},{"style":353},[5017],{"type":62,"value":3586},{"type":56,"tag":84,"props":5019,"children":5020},{"style":107},[5021],{"type":62,"value":539},{"type":56,"tag":84,"props":5023,"children":5024},{"style":107},[5025],{"type":62,"value":141},{"type":56,"tag":84,"props":5027,"children":5028},{"style":144},[5029],{"type":62,"value":1468},{"type":56,"tag":84,"props":5031,"children":5032},{"style":107},[5033],{"type":62,"value":152},{"type":56,"tag":84,"props":5035,"children":5036},{"style":107},[5037],{"type":62,"value":1477},{"type":56,"tag":84,"props":5039,"children":5040},{"class":86,"line":217},[5041,5046,5050,5054],{"type":56,"tag":84,"props":5042,"children":5043},{"style":353},[5044],{"type":62,"value":5045},"  EventSource",{"type":56,"tag":84,"props":5047,"children":5048},{"style":107},[5049],{"type":62,"value":539},{"type":56,"tag":84,"props":5051,"children":5052},{"style":113},[5053],{"type":62,"value":2578},{"type":56,"tag":84,"props":5055,"children":5056},{"style":107},[5057],{"type":62,"value":1477},{"type":56,"tag":84,"props":5059,"children":5060},{"class":86,"line":274},[5061,5066,5070,5074,5078,5082,5086],{"type":56,"tag":84,"props":5062,"children":5063},{"style":237},[5064],{"type":62,"value":5065},"  eventSourceOptions",{"type":56,"tag":84,"props":5067,"children":5068},{"style":107},[5069],{"type":62,"value":539},{"type":56,"tag":84,"props":5071,"children":5072},{"style":226},[5073],{"type":62,"value":229},{"type":56,"tag":84,"props":5075,"children":5076},{"style":107},[5077],{"type":62,"value":2882},{"type":56,"tag":84,"props":5079,"children":5080},{"style":226},[5081],{"type":62,"value":1879},{"type":56,"tag":84,"props":5083,"children":5084},{"style":113},[5085],{"type":62,"value":398},{"type":56,"tag":84,"props":5087,"children":5088},{"style":107},[5089],{"type":62,"value":413},{"type":56,"tag":84,"props":5091,"children":5092},{"class":86,"line":301},[5093,5098,5102,5106,5111,5115,5119,5124,5128],{"type":56,"tag":84,"props":5094,"children":5095},{"style":353},[5096],{"type":62,"value":5097},"    headers",{"type":56,"tag":84,"props":5099,"children":5100},{"style":107},[5101],{"type":62,"value":539},{"type":56,"tag":84,"props":5103,"children":5104},{"style":107},[5105],{"type":62,"value":110},{"type":56,"tag":84,"props":5107,"children":5108},{"style":353},[5109],{"type":62,"value":5110}," authorization",{"type":56,"tag":84,"props":5112,"children":5113},{"style":107},[5114],{"type":62,"value":539},{"type":56,"tag":84,"props":5116,"children":5117},{"style":107},[5118],{"type":62,"value":141},{"type":56,"tag":84,"props":5120,"children":5121},{"style":144},[5122],{"type":62,"value":5123},"Bearer my-secret-jwt",{"type":56,"tag":84,"props":5125,"children":5126},{"style":107},[5127],{"type":62,"value":152},{"type":56,"tag":84,"props":5129,"children":5130},{"style":107},[5131],{"type":62,"value":5132}," },\n",{"type":56,"tag":84,"props":5134,"children":5135},{"class":86,"line":387},[5136,5140,5144],{"type":56,"tag":84,"props":5137,"children":5138},{"style":107},[5139],{"type":62,"value":3672},{"type":56,"tag":84,"props":5141,"children":5142},{"style":113},[5143],{"type":62,"value":266},{"type":56,"tag":84,"props":5145,"children":5146},{"style":107},[5147],{"type":62,"value":1477},{"type":56,"tag":84,"props":5149,"children":5150},{"class":86,"line":416},[5151,5155,5159],{"type":56,"tag":84,"props":5152,"children":5153},{"style":107},[5154],{"type":62,"value":1585},{"type":56,"tag":84,"props":5156,"children":5157},{"style":113},[5158],{"type":62,"value":266},{"type":56,"tag":84,"props":5160,"children":5161},{"style":107},[5162],{"type":62,"value":157},{"type":56,"tag":4313,"props":5164,"children":5165},{},[5166,5171],{"type":56,"tag":80,"props":5167,"children":5169},{"className":5168},[],[5170],{"type":62,"value":3339},{"type":62,"value":5172}," are serialized as URL query strings for SSE, exposing tokens in server logs and browser history. Use cookies for same-domain or custom headers via an EventSource polyfill instead.",{"type":56,"tag":4313,"props":5174,"children":5175},{},[5176],{"type":62,"value":5177},"Source: www\u002Fdocs\u002Fclient\u002Flinks\u002FhttpSubscriptionLink.md",{"type":56,"tag":1601,"props":5179,"children":5181},{"id":5180},"medium-async-headers-causing-stuck-isfetching",[5182],{"type":62,"value":5183},"MEDIUM Async headers causing stuck isFetching",{"type":56,"tag":4313,"props":5185,"children":5186},{},[5187],{"type":62,"value":4317},{"type":56,"tag":72,"props":5189,"children":5191},{"className":74,"code":5190,"language":76,"meta":77,"style":77},"httpBatchLink({\n  url: '\u002Fapi\u002Ftrpc',\n  async headers() {\n    const token = await refreshToken(); \u002F\u002F can race\n    return { Authorization: `Bearer ${token}` };\n  },\n});\n",[5192],{"type":56,"tag":80,"props":5193,"children":5194},{"__ignoreMap":77},[5195,5211,5238,5258,5295,5338,5345],{"type":56,"tag":84,"props":5196,"children":5197},{"class":86,"line":87},[5198,5203,5207],{"type":56,"tag":84,"props":5199,"children":5200},{"style":237},[5201],{"type":62,"value":5202},"httpBatchLink",{"type":56,"tag":84,"props":5204,"children":5205},{"style":113},[5206],{"type":62,"value":356},{"type":56,"tag":84,"props":5208,"children":5209},{"style":107},[5210],{"type":62,"value":413},{"type":56,"tag":84,"props":5212,"children":5213},{"class":86,"line":97},[5214,5218,5222,5226,5230,5234],{"type":56,"tag":84,"props":5215,"children":5216},{"style":353},[5217],{"type":62,"value":3586},{"type":56,"tag":84,"props":5219,"children":5220},{"style":107},[5221],{"type":62,"value":539},{"type":56,"tag":84,"props":5223,"children":5224},{"style":107},[5225],{"type":62,"value":141},{"type":56,"tag":84,"props":5227,"children":5228},{"style":144},[5229],{"type":62,"value":4127},{"type":56,"tag":84,"props":5231,"children":5232},{"style":107},[5233],{"type":62,"value":152},{"type":56,"tag":84,"props":5235,"children":5236},{"style":107},[5237],{"type":62,"value":1477},{"type":56,"tag":84,"props":5239,"children":5240},{"class":86,"line":160},[5241,5245,5250,5254],{"type":56,"tag":84,"props":5242,"children":5243},{"style":226},[5244],{"type":62,"value":280},{"type":56,"tag":84,"props":5246,"children":5247},{"style":353},[5248],{"type":62,"value":5249}," headers",{"type":56,"tag":84,"props":5251,"children":5252},{"style":107},[5253],{"type":62,"value":294},{"type":56,"tag":84,"props":5255,"children":5256},{"style":107},[5257],{"type":62,"value":271},{"type":56,"tag":84,"props":5259,"children":5260},{"class":86,"line":207},[5261,5265,5269,5273,5277,5282,5286,5290],{"type":56,"tag":84,"props":5262,"children":5263},{"style":226},[5264],{"type":62,"value":307},{"type":56,"tag":84,"props":5266,"children":5267},{"style":113},[5268],{"type":62,"value":312},{"type":56,"tag":84,"props":5270,"children":5271},{"style":107},[5272],{"type":62,"value":317},{"type":56,"tag":84,"props":5274,"children":5275},{"style":101},[5276],{"type":62,"value":436},{"type":56,"tag":84,"props":5278,"children":5279},{"style":237},[5280],{"type":62,"value":5281}," refreshToken",{"type":56,"tag":84,"props":5283,"children":5284},{"style":353},[5285],{"type":62,"value":294},{"type":56,"tag":84,"props":5287,"children":5288},{"style":107},[5289],{"type":62,"value":458},{"type":56,"tag":84,"props":5291,"children":5292},{"style":91},[5293],{"type":62,"value":5294}," \u002F\u002F can race\n",{"type":56,"tag":84,"props":5296,"children":5297},{"class":86,"line":217},[5298,5302,5306,5310,5314,5318,5322,5326,5330,5334],{"type":56,"tag":84,"props":5299,"children":5300},{"style":101},[5301],{"type":62,"value":503},{"type":56,"tag":84,"props":5303,"children":5304},{"style":107},[5305],{"type":62,"value":110},{"type":56,"tag":84,"props":5307,"children":5308},{"style":353},[5309],{"type":62,"value":1510},{"type":56,"tag":84,"props":5311,"children":5312},{"style":107},[5313],{"type":62,"value":539},{"type":56,"tag":84,"props":5315,"children":5316},{"style":107},[5317],{"type":62,"value":1519},{"type":56,"tag":84,"props":5319,"children":5320},{"style":144},[5321],{"type":62,"value":1524},{"type":56,"tag":84,"props":5323,"children":5324},{"style":107},[5325],{"type":62,"value":1529},{"type":56,"tag":84,"props":5327,"children":5328},{"style":113},[5329],{"type":62,"value":403},{"type":56,"tag":84,"props":5331,"children":5332},{"style":107},[5333],{"type":62,"value":1538},{"type":56,"tag":84,"props":5335,"children":5336},{"style":107},[5337],{"type":62,"value":1543},{"type":56,"tag":84,"props":5339,"children":5340},{"class":86,"line":274},[5341],{"type":56,"tag":84,"props":5342,"children":5343},{"style":107},[5344],{"type":62,"value":1092},{"type":56,"tag":84,"props":5346,"children":5347},{"class":86,"line":301},[5348,5352,5356],{"type":56,"tag":84,"props":5349,"children":5350},{"style":107},[5351],{"type":62,"value":1585},{"type":56,"tag":84,"props":5353,"children":5354},{"style":113},[5355],{"type":62,"value":266},{"type":56,"tag":84,"props":5357,"children":5358},{"style":107},[5359],{"type":62,"value":157},{"type":56,"tag":4313,"props":5361,"children":5362},{},[5363],{"type":62,"value":4516},{"type":56,"tag":72,"props":5365,"children":5367},{"className":74,"code":5366,"language":76,"meta":77,"style":77},"let cachedToken: string | null = null;\n\nasync function ensureToken() {\n  if (!cachedToken) cachedToken = await refreshToken();\n  return cachedToken;\n}\n\nhttpBatchLink({\n  url: '\u002Fapi\u002Ftrpc',\n  async headers() {\n    return { Authorization: `Bearer ${await ensureToken()}` };\n  },\n});\n",[5368],{"type":56,"tag":80,"props":5369,"children":5370},{"__ignoreMap":77},[5371,5407,5414,5438,5486,5501,5508,5515,5530,5557,5576,5628,5635],{"type":56,"tag":84,"props":5372,"children":5373},{"class":86,"line":87},[5374,5378,5383,5387,5391,5395,5399,5403],{"type":56,"tag":84,"props":5375,"children":5376},{"style":226},[5377],{"type":62,"value":1275},{"type":56,"tag":84,"props":5379,"children":5380},{"style":113},[5381],{"type":62,"value":5382}," cachedToken",{"type":56,"tag":84,"props":5384,"children":5385},{"style":107},[5386],{"type":62,"value":539},{"type":56,"tag":84,"props":5388,"children":5389},{"style":259},[5390],{"type":62,"value":1327},{"type":56,"tag":84,"props":5392,"children":5393},{"style":107},[5394],{"type":62,"value":1738},{"type":56,"tag":84,"props":5396,"children":5397},{"style":259},[5398],{"type":62,"value":1743},{"type":56,"tag":84,"props":5400,"children":5401},{"style":107},[5402],{"type":62,"value":317},{"type":56,"tag":84,"props":5404,"children":5405},{"style":107},[5406],{"type":62,"value":508},{"type":56,"tag":84,"props":5408,"children":5409},{"class":86,"line":97},[5410],{"type":56,"tag":84,"props":5411,"children":5412},{"emptyLinePlaceholder":211},[5413],{"type":62,"value":214},{"type":56,"tag":84,"props":5415,"children":5416},{"class":86,"line":160},[5417,5421,5425,5430,5434],{"type":56,"tag":84,"props":5418,"children":5419},{"style":226},[5420],{"type":62,"value":1851},{"type":56,"tag":84,"props":5422,"children":5423},{"style":226},[5424],{"type":62,"value":234},{"type":56,"tag":84,"props":5426,"children":5427},{"style":237},[5428],{"type":62,"value":5429}," ensureToken",{"type":56,"tag":84,"props":5431,"children":5432},{"style":107},[5433],{"type":62,"value":294},{"type":56,"tag":84,"props":5435,"children":5436},{"style":107},[5437],{"type":62,"value":271},{"type":56,"tag":84,"props":5439,"children":5440},{"class":86,"line":207},[5441,5445,5449,5453,5458,5462,5466,5470,5474,5478,5482],{"type":56,"tag":84,"props":5442,"children":5443},{"style":101},[5444],{"type":62,"value":1891},{"type":56,"tag":84,"props":5446,"children":5447},{"style":353},[5448],{"type":62,"value":398},{"type":56,"tag":84,"props":5450,"children":5451},{"style":107},[5452],{"type":62,"value":887},{"type":56,"tag":84,"props":5454,"children":5455},{"style":113},[5456],{"type":62,"value":5457},"cachedToken",{"type":56,"tag":84,"props":5459,"children":5460},{"style":353},[5461],{"type":62,"value":408},{"type":56,"tag":84,"props":5463,"children":5464},{"style":113},[5465],{"type":62,"value":5457},{"type":56,"tag":84,"props":5467,"children":5468},{"style":107},[5469],{"type":62,"value":317},{"type":56,"tag":84,"props":5471,"children":5472},{"style":101},[5473],{"type":62,"value":436},{"type":56,"tag":84,"props":5475,"children":5476},{"style":237},[5477],{"type":62,"value":5281},{"type":56,"tag":84,"props":5479,"children":5480},{"style":353},[5481],{"type":62,"value":294},{"type":56,"tag":84,"props":5483,"children":5484},{"style":107},[5485],{"type":62,"value":157},{"type":56,"tag":84,"props":5487,"children":5488},{"class":86,"line":217},[5489,5493,5497],{"type":56,"tag":84,"props":5490,"children":5491},{"style":101},[5492],{"type":62,"value":526},{"type":56,"tag":84,"props":5494,"children":5495},{"style":113},[5496],{"type":62,"value":5382},{"type":56,"tag":84,"props":5498,"children":5499},{"style":107},[5500],{"type":62,"value":157},{"type":56,"tag":84,"props":5502,"children":5503},{"class":86,"line":274},[5504],{"type":56,"tag":84,"props":5505,"children":5506},{"style":107},[5507],{"type":62,"value":566},{"type":56,"tag":84,"props":5509,"children":5510},{"class":86,"line":301},[5511],{"type":56,"tag":84,"props":5512,"children":5513},{"emptyLinePlaceholder":211},[5514],{"type":62,"value":214},{"type":56,"tag":84,"props":5516,"children":5517},{"class":86,"line":387},[5518,5522,5526],{"type":56,"tag":84,"props":5519,"children":5520},{"style":237},[5521],{"type":62,"value":5202},{"type":56,"tag":84,"props":5523,"children":5524},{"style":113},[5525],{"type":62,"value":356},{"type":56,"tag":84,"props":5527,"children":5528},{"style":107},[5529],{"type":62,"value":413},{"type":56,"tag":84,"props":5531,"children":5532},{"class":86,"line":416},[5533,5537,5541,5545,5549,5553],{"type":56,"tag":84,"props":5534,"children":5535},{"style":353},[5536],{"type":62,"value":3586},{"type":56,"tag":84,"props":5538,"children":5539},{"style":107},[5540],{"type":62,"value":539},{"type":56,"tag":84,"props":5542,"children":5543},{"style":107},[5544],{"type":62,"value":141},{"type":56,"tag":84,"props":5546,"children":5547},{"style":144},[5548],{"type":62,"value":4127},{"type":56,"tag":84,"props":5550,"children":5551},{"style":107},[5552],{"type":62,"value":152},{"type":56,"tag":84,"props":5554,"children":5555},{"style":107},[5556],{"type":62,"value":1477},{"type":56,"tag":84,"props":5558,"children":5559},{"class":86,"line":466},[5560,5564,5568,5572],{"type":56,"tag":84,"props":5561,"children":5562},{"style":226},[5563],{"type":62,"value":280},{"type":56,"tag":84,"props":5565,"children":5566},{"style":353},[5567],{"type":62,"value":5249},{"type":56,"tag":84,"props":5569,"children":5570},{"style":107},[5571],{"type":62,"value":294},{"type":56,"tag":84,"props":5573,"children":5574},{"style":107},[5575],{"type":62,"value":271},{"type":56,"tag":84,"props":5577,"children":5578},{"class":86,"line":488},[5579,5583,5587,5591,5595,5599,5603,5607,5612,5616,5620,5624],{"type":56,"tag":84,"props":5580,"children":5581},{"style":101},[5582],{"type":62,"value":503},{"type":56,"tag":84,"props":5584,"children":5585},{"style":107},[5586],{"type":62,"value":110},{"type":56,"tag":84,"props":5588,"children":5589},{"style":353},[5590],{"type":62,"value":1510},{"type":56,"tag":84,"props":5592,"children":5593},{"style":107},[5594],{"type":62,"value":539},{"type":56,"tag":84,"props":5596,"children":5597},{"style":107},[5598],{"type":62,"value":1519},{"type":56,"tag":84,"props":5600,"children":5601},{"style":144},[5602],{"type":62,"value":1524},{"type":56,"tag":84,"props":5604,"children":5605},{"style":107},[5606],{"type":62,"value":1529},{"type":56,"tag":84,"props":5608,"children":5609},{"style":101},[5610],{"type":62,"value":5611},"await",{"type":56,"tag":84,"props":5613,"children":5614},{"style":237},[5615],{"type":62,"value":5429},{"type":56,"tag":84,"props":5617,"children":5618},{"style":113},[5619],{"type":62,"value":294},{"type":56,"tag":84,"props":5621,"children":5622},{"style":107},[5623],{"type":62,"value":1538},{"type":56,"tag":84,"props":5625,"children":5626},{"style":107},[5627],{"type":62,"value":1543},{"type":56,"tag":84,"props":5629,"children":5630},{"class":86,"line":497},[5631],{"type":56,"tag":84,"props":5632,"children":5633},{"style":107},[5634],{"type":62,"value":1092},{"type":56,"tag":84,"props":5636,"children":5637},{"class":86,"line":511},[5638,5642,5646],{"type":56,"tag":84,"props":5639,"children":5640},{"style":107},[5641],{"type":62,"value":1585},{"type":56,"tag":84,"props":5643,"children":5644},{"style":113},[5645],{"type":62,"value":266},{"type":56,"tag":84,"props":5647,"children":5648},{"style":107},[5649],{"type":62,"value":157},{"type":56,"tag":4313,"props":5651,"children":5652},{},[5653,5655,5661],{"type":62,"value":5654},"When the headers function is async (e.g., refreshing auth tokens), React Query's ",{"type":56,"tag":80,"props":5656,"children":5658},{"className":5657},[],[5659],{"type":62,"value":5660},"isFetching",{"type":62,"value":5662}," can get stuck permanently in certain race conditions.",{"type":56,"tag":4313,"props":5664,"children":5665},{},[5666,5668],{"type":62,"value":5667},"Source: ",{"type":56,"tag":5669,"props":5670,"children":5674},"a",{"href":5671,"rel":5672},"https:\u002F\u002Fgithub.com\u002Ftrpc\u002Ftrpc\u002Fissues\u002F7001",[5673],"nofollow",[5675],{"type":62,"value":5671},{"type":56,"tag":1601,"props":5677,"children":5679},{"id":5678},"high-skipping-auth-or-opening-cors-too-wide-in-prototypes",[5680],{"type":62,"value":5681},"HIGH Skipping auth or opening CORS too wide in prototypes",{"type":56,"tag":4313,"props":5683,"children":5684},{},[5685],{"type":62,"value":4317},{"type":56,"tag":72,"props":5687,"children":5689},{"className":74,"code":5688,"language":76,"meta":77,"style":77},"import cors from 'cors';\n\ncreateHTTPServer({\n  middleware: cors(), \u002F\u002F origin: '*' by default\n  router: appRouter,\n  createContext() {\n    return {};\n  }, \u002F\u002F no auth\n}).listen(3000);\n",[5690],{"type":56,"tag":80,"props":5691,"children":5692},{"__ignoreMap":77},[5693,5727,5734,5750,5780,5801,5817,5829,5842],{"type":56,"tag":84,"props":5694,"children":5695},{"class":86,"line":87},[5696,5700,5705,5710,5714,5719,5723],{"type":56,"tag":84,"props":5697,"children":5698},{"style":101},[5699],{"type":62,"value":104},{"type":56,"tag":84,"props":5701,"children":5702},{"style":113},[5703],{"type":62,"value":5704}," cors ",{"type":56,"tag":84,"props":5706,"children":5707},{"style":101},[5708],{"type":62,"value":5709},"from",{"type":56,"tag":84,"props":5711,"children":5712},{"style":107},[5713],{"type":62,"value":141},{"type":56,"tag":84,"props":5715,"children":5716},{"style":144},[5717],{"type":62,"value":5718},"cors",{"type":56,"tag":84,"props":5720,"children":5721},{"style":107},[5722],{"type":62,"value":152},{"type":56,"tag":84,"props":5724,"children":5725},{"style":107},[5726],{"type":62,"value":157},{"type":56,"tag":84,"props":5728,"children":5729},{"class":86,"line":97},[5730],{"type":56,"tag":84,"props":5731,"children":5732},{"emptyLinePlaceholder":211},[5733],{"type":62,"value":214},{"type":56,"tag":84,"props":5735,"children":5736},{"class":86,"line":160},[5737,5742,5746],{"type":56,"tag":84,"props":5738,"children":5739},{"style":237},[5740],{"type":62,"value":5741},"createHTTPServer",{"type":56,"tag":84,"props":5743,"children":5744},{"style":113},[5745],{"type":62,"value":356},{"type":56,"tag":84,"props":5747,"children":5748},{"style":107},[5749],{"type":62,"value":413},{"type":56,"tag":84,"props":5751,"children":5752},{"class":86,"line":207},[5753,5758,5762,5767,5771,5775],{"type":56,"tag":84,"props":5754,"children":5755},{"style":353},[5756],{"type":62,"value":5757},"  middleware",{"type":56,"tag":84,"props":5759,"children":5760},{"style":107},[5761],{"type":62,"value":539},{"type":56,"tag":84,"props":5763,"children":5764},{"style":237},[5765],{"type":62,"value":5766}," cors",{"type":56,"tag":84,"props":5768,"children":5769},{"style":113},[5770],{"type":62,"value":294},{"type":56,"tag":84,"props":5772,"children":5773},{"style":107},[5774],{"type":62,"value":121},{"type":56,"tag":84,"props":5776,"children":5777},{"style":91},[5778],{"type":62,"value":5779}," \u002F\u002F origin: '*' by default\n",{"type":56,"tag":84,"props":5781,"children":5782},{"class":86,"line":217},[5783,5788,5792,5797],{"type":56,"tag":84,"props":5784,"children":5785},{"style":353},[5786],{"type":62,"value":5787},"  router",{"type":56,"tag":84,"props":5789,"children":5790},{"style":107},[5791],{"type":62,"value":539},{"type":56,"tag":84,"props":5793,"children":5794},{"style":113},[5795],{"type":62,"value":5796}," appRouter",{"type":56,"tag":84,"props":5798,"children":5799},{"style":107},[5800],{"type":62,"value":1477},{"type":56,"tag":84,"props":5802,"children":5803},{"class":86,"line":274},[5804,5809,5813],{"type":56,"tag":84,"props":5805,"children":5806},{"style":353},[5807],{"type":62,"value":5808},"  createContext",{"type":56,"tag":84,"props":5810,"children":5811},{"style":107},[5812],{"type":62,"value":294},{"type":56,"tag":84,"props":5814,"children":5815},{"style":107},[5816],{"type":62,"value":271},{"type":56,"tag":84,"props":5818,"children":5819},{"class":86,"line":301},[5820,5824],{"type":56,"tag":84,"props":5821,"children":5822},{"style":101},[5823],{"type":62,"value":503},{"type":56,"tag":84,"props":5825,"children":5826},{"style":107},[5827],{"type":62,"value":5828}," {};\n",{"type":56,"tag":84,"props":5830,"children":5831},{"class":86,"line":387},[5832,5837],{"type":56,"tag":84,"props":5833,"children":5834},{"style":107},[5835],{"type":62,"value":5836},"  },",{"type":56,"tag":84,"props":5838,"children":5839},{"style":91},[5840],{"type":62,"value":5841}," \u002F\u002F no auth\n",{"type":56,"tag":84,"props":5843,"children":5844},{"class":86,"line":416},[5845,5849,5853,5857,5862,5866,5871,5875],{"type":56,"tag":84,"props":5846,"children":5847},{"style":107},[5848],{"type":62,"value":1585},{"type":56,"tag":84,"props":5850,"children":5851},{"style":113},[5852],{"type":62,"value":266},{"type":56,"tag":84,"props":5854,"children":5855},{"style":107},[5856],{"type":62,"value":326},{"type":56,"tag":84,"props":5858,"children":5859},{"style":237},[5860],{"type":62,"value":5861},"listen",{"type":56,"tag":84,"props":5863,"children":5864},{"style":113},[5865],{"type":62,"value":356},{"type":56,"tag":84,"props":5867,"children":5868},{"style":372},[5869],{"type":62,"value":5870},"3000",{"type":56,"tag":84,"props":5872,"children":5873},{"style":113},[5874],{"type":62,"value":266},{"type":56,"tag":84,"props":5876,"children":5877},{"style":107},[5878],{"type":62,"value":157},{"type":56,"tag":4313,"props":5880,"children":5881},{},[5882],{"type":62,"value":4516},{"type":56,"tag":72,"props":5884,"children":5886},{"className":74,"code":5885,"language":76,"meta":77,"style":77},"import cors from 'cors';\n\ncreateHTTPServer({\n  middleware: cors({ origin: 'https:\u002F\u002Fmyapp.com' }),\n  router: appRouter,\n  createContext,\n}).listen(3000);\n",[5887],{"type":56,"tag":80,"props":5888,"children":5889},{"__ignoreMap":77},[5890,5921,5928,5943,6000,6019,6030],{"type":56,"tag":84,"props":5891,"children":5892},{"class":86,"line":87},[5893,5897,5901,5905,5909,5913,5917],{"type":56,"tag":84,"props":5894,"children":5895},{"style":101},[5896],{"type":62,"value":104},{"type":56,"tag":84,"props":5898,"children":5899},{"style":113},[5900],{"type":62,"value":5704},{"type":56,"tag":84,"props":5902,"children":5903},{"style":101},[5904],{"type":62,"value":5709},{"type":56,"tag":84,"props":5906,"children":5907},{"style":107},[5908],{"type":62,"value":141},{"type":56,"tag":84,"props":5910,"children":5911},{"style":144},[5912],{"type":62,"value":5718},{"type":56,"tag":84,"props":5914,"children":5915},{"style":107},[5916],{"type":62,"value":152},{"type":56,"tag":84,"props":5918,"children":5919},{"style":107},[5920],{"type":62,"value":157},{"type":56,"tag":84,"props":5922,"children":5923},{"class":86,"line":97},[5924],{"type":56,"tag":84,"props":5925,"children":5926},{"emptyLinePlaceholder":211},[5927],{"type":62,"value":214},{"type":56,"tag":84,"props":5929,"children":5930},{"class":86,"line":160},[5931,5935,5939],{"type":56,"tag":84,"props":5932,"children":5933},{"style":237},[5934],{"type":62,"value":5741},{"type":56,"tag":84,"props":5936,"children":5937},{"style":113},[5938],{"type":62,"value":356},{"type":56,"tag":84,"props":5940,"children":5941},{"style":107},[5942],{"type":62,"value":413},{"type":56,"tag":84,"props":5944,"children":5945},{"class":86,"line":207},[5946,5950,5954,5958,5962,5966,5971,5975,5979,5984,5988,5992,5996],{"type":56,"tag":84,"props":5947,"children":5948},{"style":353},[5949],{"type":62,"value":5757},{"type":56,"tag":84,"props":5951,"children":5952},{"style":107},[5953],{"type":62,"value":539},{"type":56,"tag":84,"props":5955,"children":5956},{"style":237},[5957],{"type":62,"value":5766},{"type":56,"tag":84,"props":5959,"children":5960},{"style":113},[5961],{"type":62,"value":356},{"type":56,"tag":84,"props":5963,"children":5964},{"style":107},[5965],{"type":62,"value":936},{"type":56,"tag":84,"props":5967,"children":5968},{"style":353},[5969],{"type":62,"value":5970}," origin",{"type":56,"tag":84,"props":5972,"children":5973},{"style":107},[5974],{"type":62,"value":539},{"type":56,"tag":84,"props":5976,"children":5977},{"style":107},[5978],{"type":62,"value":141},{"type":56,"tag":84,"props":5980,"children":5981},{"style":144},[5982],{"type":62,"value":5983},"https:\u002F\u002Fmyapp.com",{"type":56,"tag":84,"props":5985,"children":5986},{"style":107},[5987],{"type":62,"value":152},{"type":56,"tag":84,"props":5989,"children":5990},{"style":107},[5991],{"type":62,"value":131},{"type":56,"tag":84,"props":5993,"children":5994},{"style":113},[5995],{"type":62,"value":266},{"type":56,"tag":84,"props":5997,"children":5998},{"style":107},[5999],{"type":62,"value":1477},{"type":56,"tag":84,"props":6001,"children":6002},{"class":86,"line":217},[6003,6007,6011,6015],{"type":56,"tag":84,"props":6004,"children":6005},{"style":353},[6006],{"type":62,"value":5787},{"type":56,"tag":84,"props":6008,"children":6009},{"style":107},[6010],{"type":62,"value":539},{"type":56,"tag":84,"props":6012,"children":6013},{"style":113},[6014],{"type":62,"value":5796},{"type":56,"tag":84,"props":6016,"children":6017},{"style":107},[6018],{"type":62,"value":1477},{"type":56,"tag":84,"props":6020,"children":6021},{"class":86,"line":274},[6022,6026],{"type":56,"tag":84,"props":6023,"children":6024},{"style":113},[6025],{"type":62,"value":5808},{"type":56,"tag":84,"props":6027,"children":6028},{"style":107},[6029],{"type":62,"value":1477},{"type":56,"tag":84,"props":6031,"children":6032},{"class":86,"line":301},[6033,6037,6041,6045,6049,6053,6057,6061],{"type":56,"tag":84,"props":6034,"children":6035},{"style":107},[6036],{"type":62,"value":1585},{"type":56,"tag":84,"props":6038,"children":6039},{"style":113},[6040],{"type":62,"value":266},{"type":56,"tag":84,"props":6042,"children":6043},{"style":107},[6044],{"type":62,"value":326},{"type":56,"tag":84,"props":6046,"children":6047},{"style":237},[6048],{"type":62,"value":5861},{"type":56,"tag":84,"props":6050,"children":6051},{"style":113},[6052],{"type":62,"value":356},{"type":56,"tag":84,"props":6054,"children":6055},{"style":372},[6056],{"type":62,"value":5870},{"type":56,"tag":84,"props":6058,"children":6059},{"style":113},[6060],{"type":62,"value":266},{"type":56,"tag":84,"props":6062,"children":6063},{"style":107},[6064],{"type":62,"value":157},{"type":56,"tag":4313,"props":6066,"children":6067},{},[6068],{"type":62,"value":6069},"Wildcard CORS and missing auth middleware are acceptable only during local development. Always restrict CORS origins and add auth before deploying.",{"type":56,"tag":4313,"props":6071,"children":6072},{},[6073],{"type":62,"value":6074},"Source: maintainer interview",{"type":56,"tag":65,"props":6076,"children":6078},{"id":6077},"see-also",[6079],{"type":62,"value":6080},"See Also",{"type":56,"tag":6082,"props":6083,"children":6084},"ul",{},[6085,6112,6122,6146],{"type":56,"tag":6086,"props":6087,"children":6088},"li",{},[6089,6094,6096,6102,6104,6110],{"type":56,"tag":6090,"props":6091,"children":6092},"strong",{},[6093],{"type":62,"value":45},{"type":62,"value":6095}," -- context narrowing, ",{"type":56,"tag":80,"props":6097,"children":6099},{"className":6098},[],[6100],{"type":62,"value":6101},".use()",{"type":62,"value":6103},", ",{"type":56,"tag":80,"props":6105,"children":6107},{"className":6106},[],[6108],{"type":62,"value":6109},".concat()",{"type":62,"value":6111},", base procedure patterns",{"type":56,"tag":6086,"props":6113,"children":6114},{},[6115,6120],{"type":56,"tag":6090,"props":6116,"children":6117},{},[6118],{"type":62,"value":6119},"subscriptions",{"type":62,"value":6121}," -- SSE and WebSocket transport setup for authenticated subscriptions",{"type":56,"tag":6086,"props":6123,"children":6124},{},[6125,6129,6131,6137,6139,6144],{"type":56,"tag":6090,"props":6126,"children":6127},{},[6128],{"type":62,"value":46},{"type":62,"value":6130}," -- ",{"type":56,"tag":80,"props":6132,"children":6134},{"className":6133},[],[6135],{"type":62,"value":6136},"createTRPCClient",{"type":62,"value":6138},", link chain, ",{"type":56,"tag":80,"props":6140,"children":6142},{"className":6141},[],[6143],{"type":62,"value":331},{"type":62,"value":6145}," option",{"type":56,"tag":6086,"props":6147,"children":6148},{},[6149,6154,6155,6161,6162,6167,6168,6173],{"type":56,"tag":6090,"props":6150,"children":6151},{},[6152],{"type":62,"value":6153},"links",{"type":62,"value":6130},{"type":56,"tag":80,"props":6156,"children":6158},{"className":6157},[],[6159],{"type":62,"value":6160},"splitLink",{"type":62,"value":6103},{"type":56,"tag":80,"props":6163,"children":6165},{"className":6164},[],[6166],{"type":62,"value":4814},{"type":62,"value":6103},{"type":56,"tag":80,"props":6169,"children":6171},{"className":6170},[],[6172],{"type":62,"value":3762},{"type":62,"value":6174}," configuration",{"type":56,"tag":6176,"props":6177,"children":6178},"style",{},[6179],{"type":62,"value":6180},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"items":6182,"total":805},[6183,6198,6211,6224,6244,6257,6264,6278,6289,6303,6312,6322],{"slug":6184,"name":6184,"fn":6185,"description":6186,"org":6187,"tags":6188,"stars":22,"repoUrl":23,"updatedAt":6197},"adapter-aws-lambda","deploy tRPC APIs on AWS Lambda","Deploy tRPC on AWS Lambda with awsLambdaRequestHandler() from @trpc\u002Fserver\u002Fadapters\u002Faws-lambda for API Gateway v1 (REST, APIGatewayProxyEvent) and v2 (HTTP, APIGatewayProxyEventV2), and Lambda Function URLs. Enable response streaming with awsLambdaStreamingRequestHandler() wrapped in awslambda.streamifyResponse(). CreateAWSLambdaContextOptions provides event and context for context creation.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[6189,6192,6195,6196],{"name":6190,"slug":6191,"type":15},"API Development","api-development",{"name":6193,"slug":6194,"type":15},"AWS","aws",{"name":13,"slug":14,"type":15},{"name":9,"slug":8,"type":15},"2026-07-18T05:47:05.451869",{"slug":6199,"name":6199,"fn":6200,"description":6201,"org":6202,"tags":6203,"stars":22,"repoUrl":23,"updatedAt":6210},"adapter-express","mount tRPC as Express middleware","Mount tRPC as Express middleware with createExpressMiddleware() from @trpc\u002Fserver\u002Fadapters\u002Fexpress. Access Express req\u002Fres in createContext via CreateExpressContextOptions. Mount at a path prefix like app.use('\u002Ftrpc', ...). Avoid global express.json() conflicting with tRPC body parsing for FormData.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[6204,6205,6206,6209],{"name":6190,"slug":6191,"type":15},{"name":13,"slug":14,"type":15},{"name":6207,"slug":6208,"type":15},"Express","express",{"name":9,"slug":8,"type":15},"2026-07-18T05:46:53.274248",{"slug":6212,"name":6212,"fn":6213,"description":6214,"org":6215,"tags":6216,"stars":22,"repoUrl":23,"updatedAt":6223},"adapter-fastify","mount tRPC as a Fastify plugin","Mount tRPC as a Fastify plugin with fastifyTRPCPlugin from @trpc\u002Fserver\u002Fadapters\u002Ffastify. Configure prefix, trpcOptions (router, createContext, onError). Enable WebSocket subscriptions with useWSS and @fastify\u002Fwebsocket. Set routerOptions.maxParamLength for batch requests. Requires Fastify v5+. FastifyTRPCPluginOptions for type-safe onError. CreateFastifyContextOptions provides req, res.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[6217,6218,6219,6222],{"name":6190,"slug":6191,"type":15},{"name":13,"slug":14,"type":15},{"name":6220,"slug":6221,"type":15},"Fastify","fastify",{"name":9,"slug":8,"type":15},"2026-07-18T05:46:53.746621",{"slug":6225,"name":6225,"fn":6226,"description":6227,"org":6228,"tags":6229,"stars":22,"repoUrl":23,"updatedAt":6243},"adapter-fetch","deploy tRPC on edge runtimes","Deploy tRPC on WinterCG-compliant edge runtimes with fetchRequestHandler() from @trpc\u002Fserver\u002Fadapters\u002Ffetch. Supports Cloudflare Workers, Deno Deploy, Vercel Edge Runtime, Astro, Remix, SolidStart. FetchCreateContextFnOptions provides req (Request) and resHeaders (Headers) for context creation. The endpoint option must match the URL path prefix where the handler is mounted.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[6230,6233,6236,6239,6240],{"name":6231,"slug":6232,"type":15},"Cloudflare","cloudflare",{"name":6234,"slug":6235,"type":15},"Deployment","deployment",{"name":6237,"slug":6238,"type":15},"Edge","edge",{"name":9,"slug":8,"type":15},{"name":6241,"slug":6242,"type":15},"Vercel","vercel","2026-07-18T05:46:50.548228",{"slug":6245,"name":6245,"fn":6246,"description":6247,"org":6248,"tags":6249,"stars":22,"repoUrl":23,"updatedAt":6256},"adapter-standalone","mount tRPC on Node.js servers","Mount tRPC on Node.js built-in HTTP server with createHTTPServer() from @trpc\u002Fserver\u002Fadapters\u002Fstandalone, createHTTPHandler() for custom http.createServer, createHTTP2Handler() for HTTP\u002F2 with TLS. Configure basePath to slice URL prefix, CORS via the cors npm package passed as middleware option. CreateHTTPContextOptions provides req and res for context creation.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[6250,6251,6252,6255],{"name":6190,"slug":6191,"type":15},{"name":13,"slug":14,"type":15},{"name":6253,"slug":6254,"type":15},"Node.js","node-js",{"name":9,"slug":8,"type":15},"2026-07-18T05:46:58.093869",{"slug":4,"name":4,"fn":5,"description":6,"org":6258,"tags":6259,"stars":22,"repoUrl":23,"updatedAt":24},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[6260,6261,6262,6263],{"name":17,"slug":4,"type":15},{"name":20,"slug":21,"type":15},{"name":13,"slug":14,"type":15},{"name":9,"slug":8,"type":15},{"slug":6265,"name":6265,"fn":6266,"description":6267,"org":6268,"tags":6269,"stars":22,"repoUrl":23,"updatedAt":6277},"caching","configure HTTP caching for tRPC queries","Set HTTP cache headers on tRPC query responses via responseMeta callback for CDN and browser caching. Configure Cache-Control, s-maxage, stale-while-revalidate. Handle caching with batching and authenticated requests. Avoid caching mutations, errors, and authenticated responses.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[6270,6271,6273,6276],{"name":13,"slug":14,"type":15},{"name":6272,"slug":6265,"type":15},"Caching",{"name":6274,"slug":6275,"type":15},"Performance","performance",{"name":9,"slug":8,"type":15},"2026-07-18T05:46:45.86443",{"slug":46,"name":46,"fn":6279,"description":6280,"org":6281,"tags":6282,"stars":22,"repoUrl":23,"updatedAt":6288},"set up vanilla tRPC clients","Create a vanilla tRPC client with createTRPCClient\u003CAppRouter>(), configure link chain with httpBatchLink\u002FhttpLink, dynamic headers for auth, transformer on links (not client constructor). Infer types with inferRouterInputs and inferRouterOutputs. AbortController signal support. TRPCClientError typing.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[6283,6284,6287],{"name":6190,"slug":6191,"type":15},{"name":6285,"slug":6286,"type":15},"Frontend","frontend",{"name":9,"slug":8,"type":15},"2026-07-18T05:48:11.437946",{"slug":6290,"name":6290,"fn":6291,"description":6292,"org":6293,"tags":6294,"stars":22,"repoUrl":23,"updatedAt":6302},"error-handling","implement typed error handling in tRPC","Throw typed errors with TRPCError and error codes (NOT_FOUND, UNAUTHORIZED, BAD_REQUEST, INTERNAL_SERVER_ERROR), configure errorFormatter for client-side Zod error display, handle errors globally with onError callback, map tRPC errors to HTTP status codes with getHTTPStatusCodeFromError().\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[6295,6296,6299,6300],{"name":13,"slug":14,"type":15},{"name":6297,"slug":6298,"type":15},"Debugging","debugging",{"name":9,"slug":8,"type":15},{"name":6301,"slug":33,"type":15},"TypeScript","2026-07-18T05:46:52.798151",{"slug":6153,"name":6153,"fn":6304,"description":6305,"org":6306,"tags":6307,"stars":22,"repoUrl":23,"updatedAt":6311},"configure tRPC client link chains","Configure the tRPC client link chain: httpLink, httpBatchLink, httpBatchStreamLink, splitLink, loggerLink, wsLink, createWSClient, httpSubscriptionLink, unstable_localLink, retryLink. Choose the right terminating link. Route subscriptions via splitLink. Build custom links for SOA routing. Link options: url, headers, transformer, maxURLLength, maxItems, connectionParams, EventSource ponyfill.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[6308,6309,6310],{"name":6190,"slug":6191,"type":15},{"name":6285,"slug":6286,"type":15},{"name":9,"slug":8,"type":15},"2026-07-18T05:47:06.847309",{"slug":45,"name":45,"fn":6313,"description":6314,"org":6315,"tags":6316,"stars":22,"repoUrl":23,"updatedAt":6321},"compose middleware for tRPC procedures","Create and compose tRPC middleware with t.procedure.use(), extend context via opts.next({ ctx }), build reusable middleware with .concat() and .unstable_pipe(), define base procedures like publicProcedure and authedProcedure. Access raw input with getRawInput(). Logging, timing, OTEL tracing patterns.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[6317,6318,6320],{"name":13,"slug":14,"type":15},{"name":6319,"slug":1842,"type":15},"Middleware",{"name":9,"slug":8,"type":15},"2026-07-18T05:46:49.132255",{"slug":6323,"name":6323,"fn":6324,"description":6325,"org":6326,"tags":6327,"stars":22,"repoUrl":23,"updatedAt":6335},"nextjs-app-router","implement tRPC in Next.js App Router","Full end-to-end tRPC setup for Next.js App Router. Covers route handler with fetchRequestHandler (GET + POST exports), TRPCProvider with QueryClientProvider, createTRPCOptionsProxy for RSC prefetching, HydrateClient\u002FHydrationBoundary for hydration, useSuspenseQuery for Suspense, and server-side callers.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[6328,6329,6330,6333,6334],{"name":13,"slug":14,"type":15},{"name":6285,"slug":6286,"type":15},{"name":6331,"slug":6332,"type":15},"Next.js","next-js",{"name":9,"slug":8,"type":15},{"name":6301,"slug":33,"type":15},"2026-07-18T05:47:10.468453",{"items":6337,"total":805},[6338,6345,6352,6359,6367,6374,6381],{"slug":6184,"name":6184,"fn":6185,"description":6186,"org":6339,"tags":6340,"stars":22,"repoUrl":23,"updatedAt":6197},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[6341,6342,6343,6344],{"name":6190,"slug":6191,"type":15},{"name":6193,"slug":6194,"type":15},{"name":13,"slug":14,"type":15},{"name":9,"slug":8,"type":15},{"slug":6199,"name":6199,"fn":6200,"description":6201,"org":6346,"tags":6347,"stars":22,"repoUrl":23,"updatedAt":6210},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[6348,6349,6350,6351],{"name":6190,"slug":6191,"type":15},{"name":13,"slug":14,"type":15},{"name":6207,"slug":6208,"type":15},{"name":9,"slug":8,"type":15},{"slug":6212,"name":6212,"fn":6213,"description":6214,"org":6353,"tags":6354,"stars":22,"repoUrl":23,"updatedAt":6223},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[6355,6356,6357,6358],{"name":6190,"slug":6191,"type":15},{"name":13,"slug":14,"type":15},{"name":6220,"slug":6221,"type":15},{"name":9,"slug":8,"type":15},{"slug":6225,"name":6225,"fn":6226,"description":6227,"org":6360,"tags":6361,"stars":22,"repoUrl":23,"updatedAt":6243},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[6362,6363,6364,6365,6366],{"name":6231,"slug":6232,"type":15},{"name":6234,"slug":6235,"type":15},{"name":6237,"slug":6238,"type":15},{"name":9,"slug":8,"type":15},{"name":6241,"slug":6242,"type":15},{"slug":6245,"name":6245,"fn":6246,"description":6247,"org":6368,"tags":6369,"stars":22,"repoUrl":23,"updatedAt":6256},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[6370,6371,6372,6373],{"name":6190,"slug":6191,"type":15},{"name":13,"slug":14,"type":15},{"name":6253,"slug":6254,"type":15},{"name":9,"slug":8,"type":15},{"slug":4,"name":4,"fn":5,"description":6,"org":6375,"tags":6376,"stars":22,"repoUrl":23,"updatedAt":24},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[6377,6378,6379,6380],{"name":17,"slug":4,"type":15},{"name":20,"slug":21,"type":15},{"name":13,"slug":14,"type":15},{"name":9,"slug":8,"type":15},{"slug":6265,"name":6265,"fn":6266,"description":6267,"org":6382,"tags":6383,"stars":22,"repoUrl":23,"updatedAt":6277},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[6384,6385,6386,6387],{"name":13,"slug":14,"type":15},{"name":6272,"slug":6265,"type":15},{"name":6274,"slug":6275,"type":15},{"name":9,"slug":8,"type":15}]