[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-tanstack-middleware":3,"mdc--dt08a8-key":49,"related-repo-tanstack-middleware":7178,"related-org-tanstack-middleware":7279},{"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":44,"sourceUrl":47,"mdContent":48},"middleware","implement TanStack Router middleware","createMiddleware, request middleware (.server only), server function middleware (.client + .server), context passing via next({ context }), sendContext for client-server transfer, global middleware via createStart in src\u002Fstart.ts, middleware factories, method order enforcement, fetch override precedence.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},"tanstack","TanStack","https:\u002F\u002Fpexgzepcugksgbtrxkhf.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Forg-logos\u002Ftanstack.png",[12,16,18,19],{"name":13,"slug":14,"type":15},"Backend","backend","tag",{"name":17,"slug":4,"type":15},"Middleware",{"name":9,"slug":8,"type":15},{"name":20,"slug":21,"type":15},"Frontend","frontend",14787,"https:\u002F\u002Fgithub.com\u002FTanStack\u002Frouter","2026-07-30T05:26:58.546019",null,1761,[28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43],"framework","fullstack","javascript","react","route","router","routing","rpc","search","searchparams","server-functions","ssr","state-management","typesafe","typescript","url",{"repoUrl":23,"stars":22,"forks":26,"topics":45,"description":46},[28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43],"🤖 A client-first, server-capable, fully type-safe router and full-stack framework for the web (React and more).","https:\u002F\u002Fgithub.com\u002FTanStack\u002Frouter\u002Ftree\u002FHEAD\u002Fpackages\u002Fstart-client-core\u002Fskills\u002Fstart-core\u002Fmiddleware","---\nname: middleware\ndescription: >-\n  createMiddleware, request middleware (.server only), server function\n  middleware (.client + .server), context passing via next({ context }),\n  sendContext for client-server transfer, global middleware via\n  createStart in src\u002Fstart.ts, middleware factories, method order\n  enforcement, fetch override precedence.\nmetadata:\n  type: sub-skill\n  library: tanstack-start\n  library_version: '1.170.14'\nrequires:\n  - start-core\n  - start-core\u002Fserver-functions\nsources:\n  - TanStack\u002Frouter:docs\u002Fstart\u002Fframework\u002Freact\u002Fguide\u002Fmiddleware.md\n---\n\n# Middleware\n\nMiddleware customizes the behavior of server functions and server routes. It is composable — middleware can depend on other middleware to form a chain.\n\n> **CRITICAL**: TypeScript enforces method order: `middleware()` → `validator()` → `client()` → `server()`. Wrong order causes type errors.\n> **CRITICAL**: Validating the _shape_ of `sendContext` (e.g. `z.string().uuid().parse(...)`) is NOT authorization. A parsed identifier is a well-formed identifier, not an authorized one. Always re-check access against the session principal before using a client-sent ID as a query key, filter, or path parameter.\n\n## Two Types of Middleware\n\n| Feature           | Request Middleware                           | Server Function Middleware               |\n| ----------------- | -------------------------------------------- | ---------------------------------------- |\n| Scope             | All server requests (SSR, routes, functions) | Server functions only                    |\n| Methods           | `.server()`                                  | `.client()`, `.server()`                 |\n| Input validation  | No                                           | Yes (`.validator()`)                     |\n| Client-side logic | No                                           | Yes                                      |\n| Created with      | `createMiddleware()`                         | `createMiddleware({ type: 'function' })` |\n\nRequest middleware cannot depend on server function middleware. Server function middleware can depend on both types.\n\n## Request Middleware\n\nRuns on ALL server requests (SSR, server routes, server functions):\n\n```tsx\n\u002F\u002F Use @tanstack\u002F\u003Cframework>-start for your framework (react, solid, vue)\nimport { createMiddleware } from '@tanstack\u002Freact-start'\n\nconst loggingMiddleware = createMiddleware().server(\n  async ({ next, context, request }) => {\n    console.log('Request:', request.url)\n    const result = await next()\n    return result\n  },\n)\n```\n\n## Server Function Middleware\n\nHas both client and server phases:\n\n```tsx\n\u002F\u002F Use @tanstack\u002F\u003Cframework>-start for your framework (react, solid, vue)\nimport { createMiddleware } from '@tanstack\u002Freact-start'\n\nconst authMiddleware = createMiddleware({ type: 'function' })\n  .client(async ({ next }) => {\n    \u002F\u002F Runs on client BEFORE the RPC call\n    const result = await next()\n    \u002F\u002F Runs on client AFTER the RPC response\n    return result\n  })\n  .server(async ({ next, context }) => {\n    \u002F\u002F Runs on server BEFORE the handler\n    const result = await next()\n    \u002F\u002F Runs on server AFTER the handler\n    return result\n  })\n```\n\n## Attaching Middleware to Server Functions\n\n```tsx\n\u002F\u002F Use @tanstack\u002F\u003Cframework>-start for your framework (react, solid, vue)\nimport { createServerFn } from '@tanstack\u002Freact-start'\n\nconst fn = createServerFn()\n  .middleware([authMiddleware])\n  .handler(async ({ context }) => {\n    \u002F\u002F context contains data from middleware\n    return { user: context.user }\n  })\n```\n\n## Context Passing via next()\n\nPass context down the middleware chain:\n\n```tsx\nconst authMiddleware = createMiddleware().server(async ({ next, request }) => {\n  const session = await getSession(request.headers)\n  if (!session) throw new Error('Unauthorized')\n\n  return next({\n    context: { session },\n  })\n})\n\nconst roleMiddleware = createMiddleware()\n  .middleware([authMiddleware])\n  .server(async ({ next, context }) => {\n    console.log('Session:', context.session) \u002F\u002F typed!\n    return next()\n  })\n```\n\n## Sending Context Between Client and Server\n\n### Client → Server (sendContext)\n\n```tsx\nconst workspaceMiddleware = createMiddleware({ type: 'function' })\n  .client(async ({ next, context }) => {\n    return next({\n      sendContext: {\n        workspaceId: context.workspaceId,\n      },\n    })\n  })\n  .server(async ({ next, context }) => {\n    \u002F\u002F workspaceId available here, but VALIDATE IT\n    console.log('Workspace:', context.workspaceId)\n    return next()\n  })\n```\n\n### Server → Client (sendContext in server)\n\n```tsx\nconst serverTimer = createMiddleware({ type: 'function' }).server(\n  async ({ next }) => {\n    return next({\n      sendContext: {\n        timeFromServer: new Date(),\n      },\n    })\n  },\n)\n\nconst clientLogger = createMiddleware({ type: 'function' })\n  .middleware([serverTimer])\n  .client(async ({ next }) => {\n    const result = await next()\n    console.log('Server time:', result.context.timeFromServer)\n    return result\n  })\n```\n\n## Input Validation in Middleware\n\n```tsx\nimport { z } from 'zod'\nimport { zodValidator } from '@tanstack\u002Fzod-adapter'\n\nconst workspaceMiddleware = createMiddleware({ type: 'function' })\n  .validator(zodValidator(z.object({ workspaceId: z.string() })))\n  .server(async ({ next, data }) => {\n    console.log('Workspace:', data.workspaceId)\n    return next()\n  })\n```\n\n## Global Middleware\n\nCreate `src\u002Fstart.ts` to configure global middleware:\n\n```tsx\n\u002F\u002F src\u002Fstart.ts\n\u002F\u002F Use @tanstack\u002F\u003Cframework>-start for your framework (react, solid, vue)\nimport { createStart, createMiddleware } from '@tanstack\u002Freact-start'\n\nconst requestLogger = createMiddleware().server(async ({ next, request }) => {\n  console.log(`${request.method} ${request.url}`)\n  return next()\n})\n\nconst functionAuth = createMiddleware({ type: 'function' }).server(\n  async ({ next }) => {\n    \u002F\u002F runs for every server function\n    return next()\n  },\n)\n\nexport const startInstance = createStart(() => ({\n  requestMiddleware: [requestLogger],\n  functionMiddleware: [functionAuth],\n}))\n```\n\n## Using Middleware with Server Routes\n\n### All handlers in a route\n\n```tsx\nexport const Route = createFileRoute('\u002Fapi\u002Fusers')({\n  server: {\n    middleware: [authMiddleware],\n    handlers: {\n      GET: async ({ context }) => Response.json(context.user),\n      POST: async ({ request }) => {\n        \u002F* ... *\u002F\n      },\n    },\n  },\n})\n```\n\n### Specific handlers only\n\n```tsx\nexport const Route = createFileRoute('\u002Fapi\u002Fusers')({\n  server: {\n    handlers: ({ createHandlers }) =>\n      createHandlers({\n        GET: async () => Response.json({ public: true }),\n        POST: {\n          middleware: [authMiddleware],\n          handler: async ({ context }) => {\n            return Response.json({ user: context.session.user })\n          },\n        },\n      }),\n  },\n})\n```\n\n## Middleware Factories\n\nCreate parameterized middleware for reusable patterns like authorization:\n\n```tsx\nconst authMiddleware = createMiddleware().server(async ({ next, request }) => {\n  const session = await auth.getSession({ headers: request.headers })\n  if (!session) throw new Error('Unauthorized')\n  return next({ context: { session } })\n})\n```\n\n> **Attach `authMiddleware` to every `createServerFn` that needs auth.** Server functions are API endpoints; a route `beforeLoad` does not protect their data, only the route's UI. Protect the endpoint that reads or mutates private data. See [router-core\u002Fauth-and-guards](..\u002F..\u002F..\u002F..\u002Frouter-core\u002Fskills\u002Frouter-core\u002Fauth-and-guards\u002FSKILL.md) and [start-core\u002Fauth-server-primitives](..\u002Fauth-server-primitives\u002FSKILL.md).\n\n```tsx\ntype Permissions = Record\u003Cstring, string[]>\n\nfunction authorizationMiddleware(permissions: Permissions) {\n  return createMiddleware({ type: 'function' })\n    .middleware([authMiddleware])\n    .server(async ({ next, context }) => {\n      const granted = await auth.hasPermission(context.session, permissions)\n      if (!granted) throw new Error('Forbidden')\n      return next()\n    })\n}\n\n\u002F\u002F Usage\nconst getClients = createServerFn()\n  .middleware([authorizationMiddleware({ client: ['read'] })])\n  .handler(async () => {\n    return { message: 'The user can read clients.' }\n  })\n```\n\n## Custom Headers and Fetch\n\n### Setting headers from client middleware\n\n```tsx\nconst authMiddleware = createMiddleware({ type: 'function' }).client(\n  async ({ next }) => {\n    return next({\n      headers: { Authorization: `Bearer ${getToken()}` },\n    })\n  },\n)\n```\n\nHeaders merge across middleware. Later middleware overrides earlier. Call-site headers override all middleware headers.\n\n### Custom fetch\n\n```tsx\n\u002F\u002F Use @tanstack\u002F\u003Cframework>-start for your framework (react, solid, vue)\nimport type { CustomFetch } from '@tanstack\u002Freact-start'\n\nconst loggingMiddleware = createMiddleware({ type: 'function' }).client(\n  async ({ next }) => {\n    const customFetch: CustomFetch = async (url, init) => {\n      console.log('Request:', url)\n      return fetch(url, init)\n    }\n    return next({ fetch: customFetch })\n  },\n)\n```\n\nFetch precedence (highest to lowest): call site → later middleware → earlier middleware → createStart global → default fetch.\n\n## Common Mistakes\n\n### 1. CRITICAL: Trusting client sendContext — shape check is not access check\n\n`sendContext` from a client middleware arrives on the server as untrusted client input. Most agents stop after parsing the shape with Zod and assume the value is safe. It isn't: a parsed UUID is _some_ workspace, not the requesting user's workspace. Without a membership check against the session principal, you've built a tenant-walking endpoint.\n\n**Layer 1 — WRONG (no validation):**\n\n```tsx\n.server(async ({ next, context }) => {\n  \u002F\u002F SQL-injectable AND tenant-walkable\n  await db.query(`SELECT * FROM workspace_${context.workspaceId}`)\n  return next()\n})\n```\n\n**Layer 2 — STILL WRONG (shape only):**\n\n```tsx\n.server(async ({ next, context }) => {\n  \u002F\u002F Looks safe, isn't. UUID is well-formed but the user may not be a member.\n  const workspaceId = z.string().uuid().parse(context.workspaceId)\n  await db.query('SELECT * FROM workspaces WHERE id = $1', [workspaceId])\n  return next()\n})\n```\n\n**Layer 3 — CORRECT (shape AND access):**\n\n```tsx\n.middleware([authMiddleware]) \u002F\u002F session loaded from cookie, NOT from sendContext\n.server(async ({ next, context }) => {\n  const workspaceId = z.string().uuid().parse(context.workspaceId)\n  \u002F\u002F Verify the session principal can access this workspace.\n  const member = await db.memberships.find({\n    userId: context.session.userId,\n    workspaceId,\n  })\n  if (!member) throw new Error('Not a member of this workspace')\n  await db.query('SELECT * FROM workspaces WHERE id = $1', [workspaceId])\n  return next({ context: { workspaceId } })\n})\n```\n\nThe session itself must come from a server-trusted source (the cookie + DB lookup in `authMiddleware`), never from `sendContext` — anything the client can send, the client can lie about. See [start-core\u002Fauth-server-primitives](..\u002Fauth-server-primitives\u002FSKILL.md).\n\n### 2. MEDIUM: Confusing request vs server function middleware\n\nRequest middleware runs on ALL requests (SSR, routes, functions). Server function middleware runs only for `createServerFn` calls and has `.client()` method.\n\n### 3. HIGH: Browser APIs in .client() crash during SSR\n\nDuring SSR, `.client()` callbacks run on the server. Browser-only APIs like `localStorage` or `window` will throw `ReferenceError`:\n\n```tsx\n\u002F\u002F WRONG — localStorage doesn't exist on the server during SSR\nconst middleware = createMiddleware({ type: 'function' }).client(\n  async ({ next }) => {\n    const token = localStorage.getItem('token')\n    return next({ sendContext: { token } })\n  },\n)\n\n\u002F\u002F CORRECT — use cookies\u002Fheaders or guard with typeof window check\nconst middleware = createMiddleware({ type: 'function' }).client(\n  async ({ next }) => {\n    const token =\n      typeof window !== 'undefined' ? localStorage.getItem('token') : null\n    return next({ sendContext: { token } })\n  },\n)\n```\n\n### 4. MEDIUM: Wrong method order\n\n```tsx\n\u002F\u002F WRONG — type error\ncreateMiddleware({ type: 'function' })\n  .server(() => { ... })\n  .client(() => { ... })\n\n\u002F\u002F CORRECT — middleware → validator → client → server\ncreateMiddleware({ type: 'function' })\n  .middleware([dep])\n  .validator(schema)\n  .client(({ next }) => next())\n  .server(({ next }) => next())\n```\n\n## Cross-References\n\n- [start-core\u002Fserver-functions](..\u002Fserver-functions\u002FSKILL.md) — what middleware wraps\n- [start-core\u002Fserver-routes](..\u002Fserver-routes\u002FSKILL.md) — middleware on API endpoints\n- [start-core\u002Fauth-server-primitives](..\u002Fauth-server-primitives\u002FSKILL.md) — building the `authMiddleware` factory itself: session cookie reads, OAuth state, CSRF\n- [router-core\u002Fauth-and-guards](..\u002F..\u002F..\u002F..\u002Frouter-core\u002Fskills\u002Frouter-core\u002Fauth-and-guards\u002FSKILL.md) — routing-side UX guards; data auth belongs in the server function, server route, or API endpoint handler\u002Fmiddleware\n",{"data":50,"body":60},{"name":4,"description":6,"metadata":51,"requires":55,"sources":58},{"type":52,"library":53,"library_version":54},"sub-skill","tanstack-start","1.170.14",[56,57],"start-core","start-core\u002Fserver-functions",[59],"TanStack\u002Frouter:docs\u002Fstart\u002Fframework\u002Freact\u002Fguide\u002Fmiddleware.md",{"type":61,"children":62},"root",[63,70,76,152,159,312,317,322,327,630,635,640,982,988,1182,1188,1193,1631,1637,1644,1983,1989,2416,2422,2769,2775,2788,3272,3278,3284,3537,3543,3915,3921,3926,4183,4236,4801,4807,4813,5015,5020,5026,5376,5381,5387,5393,5410,5418,5566,5574,5787,5795,6225,6249,6255,6274,6280,6315,6801,6807,7115,7121,7172],{"type":64,"tag":65,"props":66,"children":67},"element","h1",{"id":4},[68],{"type":69,"value":17},"text",{"type":64,"tag":71,"props":72,"children":73},"p",{},[74],{"type":69,"value":75},"Middleware customizes the behavior of server functions and server routes. It is composable — middleware can depend on other middleware to form a chain.",{"type":64,"tag":77,"props":78,"children":79},"blockquote",{},[80],{"type":64,"tag":71,"props":81,"children":82},{},[83,89,91,98,100,106,107,113,114,120,122,126,128,134,136,142,144,150],{"type":64,"tag":84,"props":85,"children":86},"strong",{},[87],{"type":69,"value":88},"CRITICAL",{"type":69,"value":90},": TypeScript enforces method order: ",{"type":64,"tag":92,"props":93,"children":95},"code",{"className":94},[],[96],{"type":69,"value":97},"middleware()",{"type":69,"value":99}," → ",{"type":64,"tag":92,"props":101,"children":103},{"className":102},[],[104],{"type":69,"value":105},"validator()",{"type":69,"value":99},{"type":64,"tag":92,"props":108,"children":110},{"className":109},[],[111],{"type":69,"value":112},"client()",{"type":69,"value":99},{"type":64,"tag":92,"props":115,"children":117},{"className":116},[],[118],{"type":69,"value":119},"server()",{"type":69,"value":121},". Wrong order causes type errors.\n",{"type":64,"tag":84,"props":123,"children":124},{},[125],{"type":69,"value":88},{"type":69,"value":127},": Validating the ",{"type":64,"tag":129,"props":130,"children":131},"em",{},[132],{"type":69,"value":133},"shape",{"type":69,"value":135}," of ",{"type":64,"tag":92,"props":137,"children":139},{"className":138},[],[140],{"type":69,"value":141},"sendContext",{"type":69,"value":143}," (e.g. ",{"type":64,"tag":92,"props":145,"children":147},{"className":146},[],[148],{"type":69,"value":149},"z.string().uuid().parse(...)",{"type":69,"value":151},") is NOT authorization. A parsed identifier is a well-formed identifier, not an authorized one. Always re-check access against the session principal before using a client-sent ID as a query key, filter, or path parameter.",{"type":64,"tag":153,"props":154,"children":156},"h2",{"id":155},"two-types-of-middleware",[157],{"type":69,"value":158},"Two Types of Middleware",{"type":64,"tag":160,"props":161,"children":162},"table",{},[163,187],{"type":64,"tag":164,"props":165,"children":166},"thead",{},[167],{"type":64,"tag":168,"props":169,"children":170},"tr",{},[171,177,182],{"type":64,"tag":172,"props":173,"children":174},"th",{},[175],{"type":69,"value":176},"Feature",{"type":64,"tag":172,"props":178,"children":179},{},[180],{"type":69,"value":181},"Request Middleware",{"type":64,"tag":172,"props":183,"children":184},{},[185],{"type":69,"value":186},"Server Function Middleware",{"type":64,"tag":188,"props":189,"children":190},"tbody",{},[191,210,243,269,286],{"type":64,"tag":168,"props":192,"children":193},{},[194,200,205],{"type":64,"tag":195,"props":196,"children":197},"td",{},[198],{"type":69,"value":199},"Scope",{"type":64,"tag":195,"props":201,"children":202},{},[203],{"type":69,"value":204},"All server requests (SSR, routes, functions)",{"type":64,"tag":195,"props":206,"children":207},{},[208],{"type":69,"value":209},"Server functions only",{"type":64,"tag":168,"props":211,"children":212},{},[213,218,227],{"type":64,"tag":195,"props":214,"children":215},{},[216],{"type":69,"value":217},"Methods",{"type":64,"tag":195,"props":219,"children":220},{},[221],{"type":64,"tag":92,"props":222,"children":224},{"className":223},[],[225],{"type":69,"value":226},".server()",{"type":64,"tag":195,"props":228,"children":229},{},[230,236,238],{"type":64,"tag":92,"props":231,"children":233},{"className":232},[],[234],{"type":69,"value":235},".client()",{"type":69,"value":237},", ",{"type":64,"tag":92,"props":239,"children":241},{"className":240},[],[242],{"type":69,"value":226},{"type":64,"tag":168,"props":244,"children":245},{},[246,251,256],{"type":64,"tag":195,"props":247,"children":248},{},[249],{"type":69,"value":250},"Input validation",{"type":64,"tag":195,"props":252,"children":253},{},[254],{"type":69,"value":255},"No",{"type":64,"tag":195,"props":257,"children":258},{},[259,261,267],{"type":69,"value":260},"Yes (",{"type":64,"tag":92,"props":262,"children":264},{"className":263},[],[265],{"type":69,"value":266},".validator()",{"type":69,"value":268},")",{"type":64,"tag":168,"props":270,"children":271},{},[272,277,281],{"type":64,"tag":195,"props":273,"children":274},{},[275],{"type":69,"value":276},"Client-side logic",{"type":64,"tag":195,"props":278,"children":279},{},[280],{"type":69,"value":255},{"type":64,"tag":195,"props":282,"children":283},{},[284],{"type":69,"value":285},"Yes",{"type":64,"tag":168,"props":287,"children":288},{},[289,294,303],{"type":64,"tag":195,"props":290,"children":291},{},[292],{"type":69,"value":293},"Created with",{"type":64,"tag":195,"props":295,"children":296},{},[297],{"type":64,"tag":92,"props":298,"children":300},{"className":299},[],[301],{"type":69,"value":302},"createMiddleware()",{"type":64,"tag":195,"props":304,"children":305},{},[306],{"type":64,"tag":92,"props":307,"children":309},{"className":308},[],[310],{"type":69,"value":311},"createMiddleware({ type: 'function' })",{"type":64,"tag":71,"props":313,"children":314},{},[315],{"type":69,"value":316},"Request middleware cannot depend on server function middleware. Server function middleware can depend on both types.",{"type":64,"tag":153,"props":318,"children":320},{"id":319},"request-middleware",[321],{"type":69,"value":181},{"type":64,"tag":71,"props":323,"children":324},{},[325],{"type":69,"value":326},"Runs on ALL server requests (SSR, server routes, server functions):",{"type":64,"tag":328,"props":329,"children":334},"pre",{"className":330,"code":331,"language":332,"meta":333,"style":333},"language-tsx shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","\u002F\u002F Use @tanstack\u002F\u003Cframework>-start for your framework (react, solid, vue)\nimport { createMiddleware } from '@tanstack\u002Freact-start'\n\nconst loggingMiddleware = createMiddleware().server(\n  async ({ next, context, request }) => {\n    console.log('Request:', request.url)\n    const result = await next()\n    return result\n  },\n)\n","tsx","",[335],{"type":64,"tag":92,"props":336,"children":337},{"__ignoreMap":333},[338,350,398,408,453,507,566,599,613,622],{"type":64,"tag":339,"props":340,"children":343},"span",{"class":341,"line":342},"line",1,[344],{"type":64,"tag":339,"props":345,"children":347},{"style":346},"--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic",[348],{"type":69,"value":349},"\u002F\u002F Use @tanstack\u002F\u003Cframework>-start for your framework (react, solid, vue)\n",{"type":64,"tag":339,"props":351,"children":353},{"class":341,"line":352},2,[354,360,366,372,377,382,387,393],{"type":64,"tag":339,"props":355,"children":357},{"style":356},"--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic",[358],{"type":69,"value":359},"import",{"type":64,"tag":339,"props":361,"children":363},{"style":362},"--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF",[364],{"type":69,"value":365}," {",{"type":64,"tag":339,"props":367,"children":369},{"style":368},"--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8",[370],{"type":69,"value":371}," createMiddleware",{"type":64,"tag":339,"props":373,"children":374},{"style":362},[375],{"type":69,"value":376}," }",{"type":64,"tag":339,"props":378,"children":379},{"style":356},[380],{"type":69,"value":381}," from",{"type":64,"tag":339,"props":383,"children":384},{"style":362},[385],{"type":69,"value":386}," '",{"type":64,"tag":339,"props":388,"children":390},{"style":389},"--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D",[391],{"type":69,"value":392},"@tanstack\u002Freact-start",{"type":64,"tag":339,"props":394,"children":395},{"style":362},[396],{"type":69,"value":397},"'\n",{"type":64,"tag":339,"props":399,"children":401},{"class":341,"line":400},3,[402],{"type":64,"tag":339,"props":403,"children":405},{"emptyLinePlaceholder":404},true,[406],{"type":69,"value":407},"\n",{"type":64,"tag":339,"props":409,"children":411},{"class":341,"line":410},4,[412,418,423,428,433,438,443,448],{"type":64,"tag":339,"props":413,"children":415},{"style":414},"--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA",[416],{"type":69,"value":417},"const",{"type":64,"tag":339,"props":419,"children":420},{"style":368},[421],{"type":69,"value":422}," loggingMiddleware ",{"type":64,"tag":339,"props":424,"children":425},{"style":362},[426],{"type":69,"value":427},"=",{"type":64,"tag":339,"props":429,"children":431},{"style":430},"--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF",[432],{"type":69,"value":371},{"type":64,"tag":339,"props":434,"children":435},{"style":368},[436],{"type":69,"value":437},"()",{"type":64,"tag":339,"props":439,"children":440},{"style":362},[441],{"type":69,"value":442},".",{"type":64,"tag":339,"props":444,"children":445},{"style":430},[446],{"type":69,"value":447},"server",{"type":64,"tag":339,"props":449,"children":450},{"style":368},[451],{"type":69,"value":452},"(\n",{"type":64,"tag":339,"props":454,"children":456},{"class":341,"line":455},5,[457,462,467,473,478,483,487,492,497,502],{"type":64,"tag":339,"props":458,"children":459},{"style":414},[460],{"type":69,"value":461},"  async",{"type":64,"tag":339,"props":463,"children":464},{"style":362},[465],{"type":69,"value":466}," ({",{"type":64,"tag":339,"props":468,"children":470},{"style":469},"--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#EEFFFF;--shiki-default-font-style:italic;--shiki-dark:#BABED8;--shiki-dark-font-style:italic",[471],{"type":69,"value":472}," next",{"type":64,"tag":339,"props":474,"children":475},{"style":362},[476],{"type":69,"value":477},",",{"type":64,"tag":339,"props":479,"children":480},{"style":469},[481],{"type":69,"value":482}," context",{"type":64,"tag":339,"props":484,"children":485},{"style":362},[486],{"type":69,"value":477},{"type":64,"tag":339,"props":488,"children":489},{"style":469},[490],{"type":69,"value":491}," request",{"type":64,"tag":339,"props":493,"children":494},{"style":362},[495],{"type":69,"value":496}," })",{"type":64,"tag":339,"props":498,"children":499},{"style":414},[500],{"type":69,"value":501}," =>",{"type":64,"tag":339,"props":503,"children":504},{"style":362},[505],{"type":69,"value":506}," {\n",{"type":64,"tag":339,"props":508,"children":510},{"class":341,"line":509},6,[511,516,520,525,531,536,541,545,549,553,557,561],{"type":64,"tag":339,"props":512,"children":513},{"style":368},[514],{"type":69,"value":515},"    console",{"type":64,"tag":339,"props":517,"children":518},{"style":362},[519],{"type":69,"value":442},{"type":64,"tag":339,"props":521,"children":522},{"style":430},[523],{"type":69,"value":524},"log",{"type":64,"tag":339,"props":526,"children":528},{"style":527},"--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178",[529],{"type":69,"value":530},"(",{"type":64,"tag":339,"props":532,"children":533},{"style":362},[534],{"type":69,"value":535},"'",{"type":64,"tag":339,"props":537,"children":538},{"style":389},[539],{"type":69,"value":540},"Request:",{"type":64,"tag":339,"props":542,"children":543},{"style":362},[544],{"type":69,"value":535},{"type":64,"tag":339,"props":546,"children":547},{"style":362},[548],{"type":69,"value":477},{"type":64,"tag":339,"props":550,"children":551},{"style":368},[552],{"type":69,"value":491},{"type":64,"tag":339,"props":554,"children":555},{"style":362},[556],{"type":69,"value":442},{"type":64,"tag":339,"props":558,"children":559},{"style":368},[560],{"type":69,"value":43},{"type":64,"tag":339,"props":562,"children":563},{"style":527},[564],{"type":69,"value":565},")\n",{"type":64,"tag":339,"props":567,"children":569},{"class":341,"line":568},7,[570,575,580,585,590,594],{"type":64,"tag":339,"props":571,"children":572},{"style":414},[573],{"type":69,"value":574},"    const",{"type":64,"tag":339,"props":576,"children":577},{"style":368},[578],{"type":69,"value":579}," result",{"type":64,"tag":339,"props":581,"children":582},{"style":362},[583],{"type":69,"value":584}," =",{"type":64,"tag":339,"props":586,"children":587},{"style":356},[588],{"type":69,"value":589}," await",{"type":64,"tag":339,"props":591,"children":592},{"style":430},[593],{"type":69,"value":472},{"type":64,"tag":339,"props":595,"children":596},{"style":527},[597],{"type":69,"value":598},"()\n",{"type":64,"tag":339,"props":600,"children":602},{"class":341,"line":601},8,[603,608],{"type":64,"tag":339,"props":604,"children":605},{"style":356},[606],{"type":69,"value":607},"    return",{"type":64,"tag":339,"props":609,"children":610},{"style":368},[611],{"type":69,"value":612}," result\n",{"type":64,"tag":339,"props":614,"children":616},{"class":341,"line":615},9,[617],{"type":64,"tag":339,"props":618,"children":619},{"style":362},[620],{"type":69,"value":621},"  },\n",{"type":64,"tag":339,"props":623,"children":625},{"class":341,"line":624},10,[626],{"type":64,"tag":339,"props":627,"children":628},{"style":368},[629],{"type":69,"value":565},{"type":64,"tag":153,"props":631,"children":633},{"id":632},"server-function-middleware",[634],{"type":69,"value":186},{"type":64,"tag":71,"props":636,"children":637},{},[638],{"type":69,"value":639},"Has both client and server phases:",{"type":64,"tag":328,"props":641,"children":643},{"className":330,"code":642,"language":332,"meta":333,"style":333},"\u002F\u002F Use @tanstack\u002F\u003Cframework>-start for your framework (react, solid, vue)\nimport { createMiddleware } from '@tanstack\u002Freact-start'\n\nconst authMiddleware = createMiddleware({ type: 'function' })\n  .client(async ({ next }) => {\n    \u002F\u002F Runs on client BEFORE the RPC call\n    const result = await next()\n    \u002F\u002F Runs on client AFTER the RPC response\n    return result\n  })\n  .server(async ({ next, context }) => {\n    \u002F\u002F Runs on server BEFORE the handler\n    const result = await next()\n    \u002F\u002F Runs on server AFTER the handler\n    return result\n  })\n",[644],{"type":64,"tag":92,"props":645,"children":646},{"__ignoreMap":333},[647,654,689,696,756,798,806,833,841,852,864,912,921,949,958,970],{"type":64,"tag":339,"props":648,"children":649},{"class":341,"line":342},[650],{"type":64,"tag":339,"props":651,"children":652},{"style":346},[653],{"type":69,"value":349},{"type":64,"tag":339,"props":655,"children":656},{"class":341,"line":352},[657,661,665,669,673,677,681,685],{"type":64,"tag":339,"props":658,"children":659},{"style":356},[660],{"type":69,"value":359},{"type":64,"tag":339,"props":662,"children":663},{"style":362},[664],{"type":69,"value":365},{"type":64,"tag":339,"props":666,"children":667},{"style":368},[668],{"type":69,"value":371},{"type":64,"tag":339,"props":670,"children":671},{"style":362},[672],{"type":69,"value":376},{"type":64,"tag":339,"props":674,"children":675},{"style":356},[676],{"type":69,"value":381},{"type":64,"tag":339,"props":678,"children":679},{"style":362},[680],{"type":69,"value":386},{"type":64,"tag":339,"props":682,"children":683},{"style":389},[684],{"type":69,"value":392},{"type":64,"tag":339,"props":686,"children":687},{"style":362},[688],{"type":69,"value":397},{"type":64,"tag":339,"props":690,"children":691},{"class":341,"line":400},[692],{"type":64,"tag":339,"props":693,"children":694},{"emptyLinePlaceholder":404},[695],{"type":69,"value":407},{"type":64,"tag":339,"props":697,"children":698},{"class":341,"line":410},[699,703,708,712,716,720,725,730,735,739,744,748,752],{"type":64,"tag":339,"props":700,"children":701},{"style":414},[702],{"type":69,"value":417},{"type":64,"tag":339,"props":704,"children":705},{"style":368},[706],{"type":69,"value":707}," authMiddleware ",{"type":64,"tag":339,"props":709,"children":710},{"style":362},[711],{"type":69,"value":427},{"type":64,"tag":339,"props":713,"children":714},{"style":430},[715],{"type":69,"value":371},{"type":64,"tag":339,"props":717,"children":718},{"style":368},[719],{"type":69,"value":530},{"type":64,"tag":339,"props":721,"children":722},{"style":362},[723],{"type":69,"value":724},"{",{"type":64,"tag":339,"props":726,"children":727},{"style":527},[728],{"type":69,"value":729}," type",{"type":64,"tag":339,"props":731,"children":732},{"style":362},[733],{"type":69,"value":734},":",{"type":64,"tag":339,"props":736,"children":737},{"style":362},[738],{"type":69,"value":386},{"type":64,"tag":339,"props":740,"children":741},{"style":389},[742],{"type":69,"value":743},"function",{"type":64,"tag":339,"props":745,"children":746},{"style":362},[747],{"type":69,"value":535},{"type":64,"tag":339,"props":749,"children":750},{"style":362},[751],{"type":69,"value":376},{"type":64,"tag":339,"props":753,"children":754},{"style":368},[755],{"type":69,"value":565},{"type":64,"tag":339,"props":757,"children":758},{"class":341,"line":455},[759,764,769,773,778,782,786,790,794],{"type":64,"tag":339,"props":760,"children":761},{"style":362},[762],{"type":69,"value":763},"  .",{"type":64,"tag":339,"props":765,"children":766},{"style":430},[767],{"type":69,"value":768},"client",{"type":64,"tag":339,"props":770,"children":771},{"style":368},[772],{"type":69,"value":530},{"type":64,"tag":339,"props":774,"children":775},{"style":414},[776],{"type":69,"value":777},"async",{"type":64,"tag":339,"props":779,"children":780},{"style":362},[781],{"type":69,"value":466},{"type":64,"tag":339,"props":783,"children":784},{"style":469},[785],{"type":69,"value":472},{"type":64,"tag":339,"props":787,"children":788},{"style":362},[789],{"type":69,"value":496},{"type":64,"tag":339,"props":791,"children":792},{"style":414},[793],{"type":69,"value":501},{"type":64,"tag":339,"props":795,"children":796},{"style":362},[797],{"type":69,"value":506},{"type":64,"tag":339,"props":799,"children":800},{"class":341,"line":509},[801],{"type":64,"tag":339,"props":802,"children":803},{"style":346},[804],{"type":69,"value":805},"    \u002F\u002F Runs on client BEFORE the RPC call\n",{"type":64,"tag":339,"props":807,"children":808},{"class":341,"line":568},[809,813,817,821,825,829],{"type":64,"tag":339,"props":810,"children":811},{"style":414},[812],{"type":69,"value":574},{"type":64,"tag":339,"props":814,"children":815},{"style":368},[816],{"type":69,"value":579},{"type":64,"tag":339,"props":818,"children":819},{"style":362},[820],{"type":69,"value":584},{"type":64,"tag":339,"props":822,"children":823},{"style":356},[824],{"type":69,"value":589},{"type":64,"tag":339,"props":826,"children":827},{"style":430},[828],{"type":69,"value":472},{"type":64,"tag":339,"props":830,"children":831},{"style":527},[832],{"type":69,"value":598},{"type":64,"tag":339,"props":834,"children":835},{"class":341,"line":601},[836],{"type":64,"tag":339,"props":837,"children":838},{"style":346},[839],{"type":69,"value":840},"    \u002F\u002F Runs on client AFTER the RPC response\n",{"type":64,"tag":339,"props":842,"children":843},{"class":341,"line":615},[844,848],{"type":64,"tag":339,"props":845,"children":846},{"style":356},[847],{"type":69,"value":607},{"type":64,"tag":339,"props":849,"children":850},{"style":368},[851],{"type":69,"value":612},{"type":64,"tag":339,"props":853,"children":854},{"class":341,"line":624},[855,860],{"type":64,"tag":339,"props":856,"children":857},{"style":362},[858],{"type":69,"value":859},"  }",{"type":64,"tag":339,"props":861,"children":862},{"style":368},[863],{"type":69,"value":565},{"type":64,"tag":339,"props":865,"children":867},{"class":341,"line":866},11,[868,872,876,880,884,888,892,896,900,904,908],{"type":64,"tag":339,"props":869,"children":870},{"style":362},[871],{"type":69,"value":763},{"type":64,"tag":339,"props":873,"children":874},{"style":430},[875],{"type":69,"value":447},{"type":64,"tag":339,"props":877,"children":878},{"style":368},[879],{"type":69,"value":530},{"type":64,"tag":339,"props":881,"children":882},{"style":414},[883],{"type":69,"value":777},{"type":64,"tag":339,"props":885,"children":886},{"style":362},[887],{"type":69,"value":466},{"type":64,"tag":339,"props":889,"children":890},{"style":469},[891],{"type":69,"value":472},{"type":64,"tag":339,"props":893,"children":894},{"style":362},[895],{"type":69,"value":477},{"type":64,"tag":339,"props":897,"children":898},{"style":469},[899],{"type":69,"value":482},{"type":64,"tag":339,"props":901,"children":902},{"style":362},[903],{"type":69,"value":496},{"type":64,"tag":339,"props":905,"children":906},{"style":414},[907],{"type":69,"value":501},{"type":64,"tag":339,"props":909,"children":910},{"style":362},[911],{"type":69,"value":506},{"type":64,"tag":339,"props":913,"children":915},{"class":341,"line":914},12,[916],{"type":64,"tag":339,"props":917,"children":918},{"style":346},[919],{"type":69,"value":920},"    \u002F\u002F Runs on server BEFORE the handler\n",{"type":64,"tag":339,"props":922,"children":924},{"class":341,"line":923},13,[925,929,933,937,941,945],{"type":64,"tag":339,"props":926,"children":927},{"style":414},[928],{"type":69,"value":574},{"type":64,"tag":339,"props":930,"children":931},{"style":368},[932],{"type":69,"value":579},{"type":64,"tag":339,"props":934,"children":935},{"style":362},[936],{"type":69,"value":584},{"type":64,"tag":339,"props":938,"children":939},{"style":356},[940],{"type":69,"value":589},{"type":64,"tag":339,"props":942,"children":943},{"style":430},[944],{"type":69,"value":472},{"type":64,"tag":339,"props":946,"children":947},{"style":527},[948],{"type":69,"value":598},{"type":64,"tag":339,"props":950,"children":952},{"class":341,"line":951},14,[953],{"type":64,"tag":339,"props":954,"children":955},{"style":346},[956],{"type":69,"value":957},"    \u002F\u002F Runs on server AFTER the handler\n",{"type":64,"tag":339,"props":959,"children":961},{"class":341,"line":960},15,[962,966],{"type":64,"tag":339,"props":963,"children":964},{"style":356},[965],{"type":69,"value":607},{"type":64,"tag":339,"props":967,"children":968},{"style":368},[969],{"type":69,"value":612},{"type":64,"tag":339,"props":971,"children":973},{"class":341,"line":972},16,[974,978],{"type":64,"tag":339,"props":975,"children":976},{"style":362},[977],{"type":69,"value":859},{"type":64,"tag":339,"props":979,"children":980},{"style":368},[981],{"type":69,"value":565},{"type":64,"tag":153,"props":983,"children":985},{"id":984},"attaching-middleware-to-server-functions",[986],{"type":69,"value":987},"Attaching Middleware to Server Functions",{"type":64,"tag":328,"props":989,"children":991},{"className":330,"code":990,"language":332,"meta":333,"style":333},"\u002F\u002F Use @tanstack\u002F\u003Cframework>-start for your framework (react, solid, vue)\nimport { createServerFn } from '@tanstack\u002Freact-start'\n\nconst fn = createServerFn()\n  .middleware([authMiddleware])\n  .handler(async ({ context }) => {\n    \u002F\u002F context contains data from middleware\n    return { user: context.user }\n  })\n",[992],{"type":64,"tag":92,"props":993,"children":994},{"__ignoreMap":333},[995,1002,1038,1045,1069,1085,1125,1133,1171],{"type":64,"tag":339,"props":996,"children":997},{"class":341,"line":342},[998],{"type":64,"tag":339,"props":999,"children":1000},{"style":346},[1001],{"type":69,"value":349},{"type":64,"tag":339,"props":1003,"children":1004},{"class":341,"line":352},[1005,1009,1013,1018,1022,1026,1030,1034],{"type":64,"tag":339,"props":1006,"children":1007},{"style":356},[1008],{"type":69,"value":359},{"type":64,"tag":339,"props":1010,"children":1011},{"style":362},[1012],{"type":69,"value":365},{"type":64,"tag":339,"props":1014,"children":1015},{"style":368},[1016],{"type":69,"value":1017}," createServerFn",{"type":64,"tag":339,"props":1019,"children":1020},{"style":362},[1021],{"type":69,"value":376},{"type":64,"tag":339,"props":1023,"children":1024},{"style":356},[1025],{"type":69,"value":381},{"type":64,"tag":339,"props":1027,"children":1028},{"style":362},[1029],{"type":69,"value":386},{"type":64,"tag":339,"props":1031,"children":1032},{"style":389},[1033],{"type":69,"value":392},{"type":64,"tag":339,"props":1035,"children":1036},{"style":362},[1037],{"type":69,"value":397},{"type":64,"tag":339,"props":1039,"children":1040},{"class":341,"line":400},[1041],{"type":64,"tag":339,"props":1042,"children":1043},{"emptyLinePlaceholder":404},[1044],{"type":69,"value":407},{"type":64,"tag":339,"props":1046,"children":1047},{"class":341,"line":410},[1048,1052,1057,1061,1065],{"type":64,"tag":339,"props":1049,"children":1050},{"style":414},[1051],{"type":69,"value":417},{"type":64,"tag":339,"props":1053,"children":1054},{"style":368},[1055],{"type":69,"value":1056}," fn ",{"type":64,"tag":339,"props":1058,"children":1059},{"style":362},[1060],{"type":69,"value":427},{"type":64,"tag":339,"props":1062,"children":1063},{"style":430},[1064],{"type":69,"value":1017},{"type":64,"tag":339,"props":1066,"children":1067},{"style":368},[1068],{"type":69,"value":598},{"type":64,"tag":339,"props":1070,"children":1071},{"class":341,"line":455},[1072,1076,1080],{"type":64,"tag":339,"props":1073,"children":1074},{"style":362},[1075],{"type":69,"value":763},{"type":64,"tag":339,"props":1077,"children":1078},{"style":430},[1079],{"type":69,"value":4},{"type":64,"tag":339,"props":1081,"children":1082},{"style":368},[1083],{"type":69,"value":1084},"([authMiddleware])\n",{"type":64,"tag":339,"props":1086,"children":1087},{"class":341,"line":509},[1088,1092,1097,1101,1105,1109,1113,1117,1121],{"type":64,"tag":339,"props":1089,"children":1090},{"style":362},[1091],{"type":69,"value":763},{"type":64,"tag":339,"props":1093,"children":1094},{"style":430},[1095],{"type":69,"value":1096},"handler",{"type":64,"tag":339,"props":1098,"children":1099},{"style":368},[1100],{"type":69,"value":530},{"type":64,"tag":339,"props":1102,"children":1103},{"style":414},[1104],{"type":69,"value":777},{"type":64,"tag":339,"props":1106,"children":1107},{"style":362},[1108],{"type":69,"value":466},{"type":64,"tag":339,"props":1110,"children":1111},{"style":469},[1112],{"type":69,"value":482},{"type":64,"tag":339,"props":1114,"children":1115},{"style":362},[1116],{"type":69,"value":496},{"type":64,"tag":339,"props":1118,"children":1119},{"style":414},[1120],{"type":69,"value":501},{"type":64,"tag":339,"props":1122,"children":1123},{"style":362},[1124],{"type":69,"value":506},{"type":64,"tag":339,"props":1126,"children":1127},{"class":341,"line":568},[1128],{"type":64,"tag":339,"props":1129,"children":1130},{"style":346},[1131],{"type":69,"value":1132},"    \u002F\u002F context contains data from middleware\n",{"type":64,"tag":339,"props":1134,"children":1135},{"class":341,"line":601},[1136,1140,1144,1149,1153,1157,1161,1166],{"type":64,"tag":339,"props":1137,"children":1138},{"style":356},[1139],{"type":69,"value":607},{"type":64,"tag":339,"props":1141,"children":1142},{"style":362},[1143],{"type":69,"value":365},{"type":64,"tag":339,"props":1145,"children":1146},{"style":527},[1147],{"type":69,"value":1148}," user",{"type":64,"tag":339,"props":1150,"children":1151},{"style":362},[1152],{"type":69,"value":734},{"type":64,"tag":339,"props":1154,"children":1155},{"style":368},[1156],{"type":69,"value":482},{"type":64,"tag":339,"props":1158,"children":1159},{"style":362},[1160],{"type":69,"value":442},{"type":64,"tag":339,"props":1162,"children":1163},{"style":368},[1164],{"type":69,"value":1165},"user",{"type":64,"tag":339,"props":1167,"children":1168},{"style":362},[1169],{"type":69,"value":1170}," }\n",{"type":64,"tag":339,"props":1172,"children":1173},{"class":341,"line":615},[1174,1178],{"type":64,"tag":339,"props":1175,"children":1176},{"style":362},[1177],{"type":69,"value":859},{"type":64,"tag":339,"props":1179,"children":1180},{"style":368},[1181],{"type":69,"value":565},{"type":64,"tag":153,"props":1183,"children":1185},{"id":1184},"context-passing-via-next",[1186],{"type":69,"value":1187},"Context Passing via next()",{"type":64,"tag":71,"props":1189,"children":1190},{},[1191],{"type":69,"value":1192},"Pass context down the middleware chain:",{"type":64,"tag":328,"props":1194,"children":1196},{"className":330,"code":1195,"language":332,"meta":333,"style":333},"const authMiddleware = createMiddleware().server(async ({ next, request }) => {\n  const session = await getSession(request.headers)\n  if (!session) throw new Error('Unauthorized')\n\n  return next({\n    context: { session },\n  })\n})\n\nconst roleMiddleware = createMiddleware()\n  .middleware([authMiddleware])\n  .server(async ({ next, context }) => {\n    console.log('Session:', context.session) \u002F\u002F typed!\n    return next()\n  })\n",[1197],{"type":64,"tag":92,"props":1198,"children":1199},{"__ignoreMap":333},[1200,1267,1315,1379,1386,1407,1432,1443,1455,1462,1486,1501,1548,1605,1620],{"type":64,"tag":339,"props":1201,"children":1202},{"class":341,"line":342},[1203,1207,1211,1215,1219,1223,1227,1231,1235,1239,1243,1247,1251,1255,1259,1263],{"type":64,"tag":339,"props":1204,"children":1205},{"style":414},[1206],{"type":69,"value":417},{"type":64,"tag":339,"props":1208,"children":1209},{"style":368},[1210],{"type":69,"value":707},{"type":64,"tag":339,"props":1212,"children":1213},{"style":362},[1214],{"type":69,"value":427},{"type":64,"tag":339,"props":1216,"children":1217},{"style":430},[1218],{"type":69,"value":371},{"type":64,"tag":339,"props":1220,"children":1221},{"style":368},[1222],{"type":69,"value":437},{"type":64,"tag":339,"props":1224,"children":1225},{"style":362},[1226],{"type":69,"value":442},{"type":64,"tag":339,"props":1228,"children":1229},{"style":430},[1230],{"type":69,"value":447},{"type":64,"tag":339,"props":1232,"children":1233},{"style":368},[1234],{"type":69,"value":530},{"type":64,"tag":339,"props":1236,"children":1237},{"style":414},[1238],{"type":69,"value":777},{"type":64,"tag":339,"props":1240,"children":1241},{"style":362},[1242],{"type":69,"value":466},{"type":64,"tag":339,"props":1244,"children":1245},{"style":469},[1246],{"type":69,"value":472},{"type":64,"tag":339,"props":1248,"children":1249},{"style":362},[1250],{"type":69,"value":477},{"type":64,"tag":339,"props":1252,"children":1253},{"style":469},[1254],{"type":69,"value":491},{"type":64,"tag":339,"props":1256,"children":1257},{"style":362},[1258],{"type":69,"value":496},{"type":64,"tag":339,"props":1260,"children":1261},{"style":414},[1262],{"type":69,"value":501},{"type":64,"tag":339,"props":1264,"children":1265},{"style":362},[1266],{"type":69,"value":506},{"type":64,"tag":339,"props":1268,"children":1269},{"class":341,"line":352},[1270,1275,1280,1284,1288,1293,1297,1302,1306,1311],{"type":64,"tag":339,"props":1271,"children":1272},{"style":414},[1273],{"type":69,"value":1274},"  const",{"type":64,"tag":339,"props":1276,"children":1277},{"style":368},[1278],{"type":69,"value":1279}," session",{"type":64,"tag":339,"props":1281,"children":1282},{"style":362},[1283],{"type":69,"value":584},{"type":64,"tag":339,"props":1285,"children":1286},{"style":356},[1287],{"type":69,"value":589},{"type":64,"tag":339,"props":1289,"children":1290},{"style":430},[1291],{"type":69,"value":1292}," getSession",{"type":64,"tag":339,"props":1294,"children":1295},{"style":527},[1296],{"type":69,"value":530},{"type":64,"tag":339,"props":1298,"children":1299},{"style":368},[1300],{"type":69,"value":1301},"request",{"type":64,"tag":339,"props":1303,"children":1304},{"style":362},[1305],{"type":69,"value":442},{"type":64,"tag":339,"props":1307,"children":1308},{"style":368},[1309],{"type":69,"value":1310},"headers",{"type":64,"tag":339,"props":1312,"children":1313},{"style":527},[1314],{"type":69,"value":565},{"type":64,"tag":339,"props":1316,"children":1317},{"class":341,"line":400},[1318,1323,1328,1333,1338,1343,1348,1353,1358,1362,1366,1371,1375],{"type":64,"tag":339,"props":1319,"children":1320},{"style":356},[1321],{"type":69,"value":1322},"  if",{"type":64,"tag":339,"props":1324,"children":1325},{"style":527},[1326],{"type":69,"value":1327}," (",{"type":64,"tag":339,"props":1329,"children":1330},{"style":362},[1331],{"type":69,"value":1332},"!",{"type":64,"tag":339,"props":1334,"children":1335},{"style":368},[1336],{"type":69,"value":1337},"session",{"type":64,"tag":339,"props":1339,"children":1340},{"style":527},[1341],{"type":69,"value":1342},") ",{"type":64,"tag":339,"props":1344,"children":1345},{"style":356},[1346],{"type":69,"value":1347},"throw",{"type":64,"tag":339,"props":1349,"children":1350},{"style":362},[1351],{"type":69,"value":1352}," new",{"type":64,"tag":339,"props":1354,"children":1355},{"style":430},[1356],{"type":69,"value":1357}," Error",{"type":64,"tag":339,"props":1359,"children":1360},{"style":527},[1361],{"type":69,"value":530},{"type":64,"tag":339,"props":1363,"children":1364},{"style":362},[1365],{"type":69,"value":535},{"type":64,"tag":339,"props":1367,"children":1368},{"style":389},[1369],{"type":69,"value":1370},"Unauthorized",{"type":64,"tag":339,"props":1372,"children":1373},{"style":362},[1374],{"type":69,"value":535},{"type":64,"tag":339,"props":1376,"children":1377},{"style":527},[1378],{"type":69,"value":565},{"type":64,"tag":339,"props":1380,"children":1381},{"class":341,"line":410},[1382],{"type":64,"tag":339,"props":1383,"children":1384},{"emptyLinePlaceholder":404},[1385],{"type":69,"value":407},{"type":64,"tag":339,"props":1387,"children":1388},{"class":341,"line":455},[1389,1394,1398,1402],{"type":64,"tag":339,"props":1390,"children":1391},{"style":356},[1392],{"type":69,"value":1393},"  return",{"type":64,"tag":339,"props":1395,"children":1396},{"style":430},[1397],{"type":69,"value":472},{"type":64,"tag":339,"props":1399,"children":1400},{"style":527},[1401],{"type":69,"value":530},{"type":64,"tag":339,"props":1403,"children":1404},{"style":362},[1405],{"type":69,"value":1406},"{\n",{"type":64,"tag":339,"props":1408,"children":1409},{"class":341,"line":509},[1410,1415,1419,1423,1427],{"type":64,"tag":339,"props":1411,"children":1412},{"style":527},[1413],{"type":69,"value":1414},"    context",{"type":64,"tag":339,"props":1416,"children":1417},{"style":362},[1418],{"type":69,"value":734},{"type":64,"tag":339,"props":1420,"children":1421},{"style":362},[1422],{"type":69,"value":365},{"type":64,"tag":339,"props":1424,"children":1425},{"style":368},[1426],{"type":69,"value":1279},{"type":64,"tag":339,"props":1428,"children":1429},{"style":362},[1430],{"type":69,"value":1431}," },\n",{"type":64,"tag":339,"props":1433,"children":1434},{"class":341,"line":568},[1435,1439],{"type":64,"tag":339,"props":1436,"children":1437},{"style":362},[1438],{"type":69,"value":859},{"type":64,"tag":339,"props":1440,"children":1441},{"style":527},[1442],{"type":69,"value":565},{"type":64,"tag":339,"props":1444,"children":1445},{"class":341,"line":601},[1446,1451],{"type":64,"tag":339,"props":1447,"children":1448},{"style":362},[1449],{"type":69,"value":1450},"}",{"type":64,"tag":339,"props":1452,"children":1453},{"style":368},[1454],{"type":69,"value":565},{"type":64,"tag":339,"props":1456,"children":1457},{"class":341,"line":615},[1458],{"type":64,"tag":339,"props":1459,"children":1460},{"emptyLinePlaceholder":404},[1461],{"type":69,"value":407},{"type":64,"tag":339,"props":1463,"children":1464},{"class":341,"line":624},[1465,1469,1474,1478,1482],{"type":64,"tag":339,"props":1466,"children":1467},{"style":414},[1468],{"type":69,"value":417},{"type":64,"tag":339,"props":1470,"children":1471},{"style":368},[1472],{"type":69,"value":1473}," roleMiddleware ",{"type":64,"tag":339,"props":1475,"children":1476},{"style":362},[1477],{"type":69,"value":427},{"type":64,"tag":339,"props":1479,"children":1480},{"style":430},[1481],{"type":69,"value":371},{"type":64,"tag":339,"props":1483,"children":1484},{"style":368},[1485],{"type":69,"value":598},{"type":64,"tag":339,"props":1487,"children":1488},{"class":341,"line":866},[1489,1493,1497],{"type":64,"tag":339,"props":1490,"children":1491},{"style":362},[1492],{"type":69,"value":763},{"type":64,"tag":339,"props":1494,"children":1495},{"style":430},[1496],{"type":69,"value":4},{"type":64,"tag":339,"props":1498,"children":1499},{"style":368},[1500],{"type":69,"value":1084},{"type":64,"tag":339,"props":1502,"children":1503},{"class":341,"line":914},[1504,1508,1512,1516,1520,1524,1528,1532,1536,1540,1544],{"type":64,"tag":339,"props":1505,"children":1506},{"style":362},[1507],{"type":69,"value":763},{"type":64,"tag":339,"props":1509,"children":1510},{"style":430},[1511],{"type":69,"value":447},{"type":64,"tag":339,"props":1513,"children":1514},{"style":368},[1515],{"type":69,"value":530},{"type":64,"tag":339,"props":1517,"children":1518},{"style":414},[1519],{"type":69,"value":777},{"type":64,"tag":339,"props":1521,"children":1522},{"style":362},[1523],{"type":69,"value":466},{"type":64,"tag":339,"props":1525,"children":1526},{"style":469},[1527],{"type":69,"value":472},{"type":64,"tag":339,"props":1529,"children":1530},{"style":362},[1531],{"type":69,"value":477},{"type":64,"tag":339,"props":1533,"children":1534},{"style":469},[1535],{"type":69,"value":482},{"type":64,"tag":339,"props":1537,"children":1538},{"style":362},[1539],{"type":69,"value":496},{"type":64,"tag":339,"props":1541,"children":1542},{"style":414},[1543],{"type":69,"value":501},{"type":64,"tag":339,"props":1545,"children":1546},{"style":362},[1547],{"type":69,"value":506},{"type":64,"tag":339,"props":1549,"children":1550},{"class":341,"line":923},[1551,1555,1559,1563,1567,1571,1576,1580,1584,1588,1592,1596,1600],{"type":64,"tag":339,"props":1552,"children":1553},{"style":368},[1554],{"type":69,"value":515},{"type":64,"tag":339,"props":1556,"children":1557},{"style":362},[1558],{"type":69,"value":442},{"type":64,"tag":339,"props":1560,"children":1561},{"style":430},[1562],{"type":69,"value":524},{"type":64,"tag":339,"props":1564,"children":1565},{"style":527},[1566],{"type":69,"value":530},{"type":64,"tag":339,"props":1568,"children":1569},{"style":362},[1570],{"type":69,"value":535},{"type":64,"tag":339,"props":1572,"children":1573},{"style":389},[1574],{"type":69,"value":1575},"Session:",{"type":64,"tag":339,"props":1577,"children":1578},{"style":362},[1579],{"type":69,"value":535},{"type":64,"tag":339,"props":1581,"children":1582},{"style":362},[1583],{"type":69,"value":477},{"type":64,"tag":339,"props":1585,"children":1586},{"style":368},[1587],{"type":69,"value":482},{"type":64,"tag":339,"props":1589,"children":1590},{"style":362},[1591],{"type":69,"value":442},{"type":64,"tag":339,"props":1593,"children":1594},{"style":368},[1595],{"type":69,"value":1337},{"type":64,"tag":339,"props":1597,"children":1598},{"style":527},[1599],{"type":69,"value":1342},{"type":64,"tag":339,"props":1601,"children":1602},{"style":346},[1603],{"type":69,"value":1604},"\u002F\u002F typed!\n",{"type":64,"tag":339,"props":1606,"children":1607},{"class":341,"line":951},[1608,1612,1616],{"type":64,"tag":339,"props":1609,"children":1610},{"style":356},[1611],{"type":69,"value":607},{"type":64,"tag":339,"props":1613,"children":1614},{"style":430},[1615],{"type":69,"value":472},{"type":64,"tag":339,"props":1617,"children":1618},{"style":527},[1619],{"type":69,"value":598},{"type":64,"tag":339,"props":1621,"children":1622},{"class":341,"line":960},[1623,1627],{"type":64,"tag":339,"props":1624,"children":1625},{"style":362},[1626],{"type":69,"value":859},{"type":64,"tag":339,"props":1628,"children":1629},{"style":368},[1630],{"type":69,"value":565},{"type":64,"tag":153,"props":1632,"children":1634},{"id":1633},"sending-context-between-client-and-server",[1635],{"type":69,"value":1636},"Sending Context Between Client and Server",{"type":64,"tag":1638,"props":1639,"children":1641},"h3",{"id":1640},"client-server-sendcontext",[1642],{"type":69,"value":1643},"Client → Server (sendContext)",{"type":64,"tag":328,"props":1645,"children":1647},{"className":330,"code":1646,"language":332,"meta":333,"style":333},"const workspaceMiddleware = createMiddleware({ type: 'function' })\n  .client(async ({ next, context }) => {\n    return next({\n      sendContext: {\n        workspaceId: context.workspaceId,\n      },\n    })\n  })\n  .server(async ({ next, context }) => {\n    \u002F\u002F workspaceId available here, but VALIDATE IT\n    console.log('Workspace:', context.workspaceId)\n    return next()\n  })\n",[1648],{"type":64,"tag":92,"props":1649,"children":1650},{"__ignoreMap":333},[1651,1707,1754,1773,1789,1819,1827,1839,1850,1897,1905,1957,1972],{"type":64,"tag":339,"props":1652,"children":1653},{"class":341,"line":342},[1654,1658,1663,1667,1671,1675,1679,1683,1687,1691,1695,1699,1703],{"type":64,"tag":339,"props":1655,"children":1656},{"style":414},[1657],{"type":69,"value":417},{"type":64,"tag":339,"props":1659,"children":1660},{"style":368},[1661],{"type":69,"value":1662}," workspaceMiddleware ",{"type":64,"tag":339,"props":1664,"children":1665},{"style":362},[1666],{"type":69,"value":427},{"type":64,"tag":339,"props":1668,"children":1669},{"style":430},[1670],{"type":69,"value":371},{"type":64,"tag":339,"props":1672,"children":1673},{"style":368},[1674],{"type":69,"value":530},{"type":64,"tag":339,"props":1676,"children":1677},{"style":362},[1678],{"type":69,"value":724},{"type":64,"tag":339,"props":1680,"children":1681},{"style":527},[1682],{"type":69,"value":729},{"type":64,"tag":339,"props":1684,"children":1685},{"style":362},[1686],{"type":69,"value":734},{"type":64,"tag":339,"props":1688,"children":1689},{"style":362},[1690],{"type":69,"value":386},{"type":64,"tag":339,"props":1692,"children":1693},{"style":389},[1694],{"type":69,"value":743},{"type":64,"tag":339,"props":1696,"children":1697},{"style":362},[1698],{"type":69,"value":535},{"type":64,"tag":339,"props":1700,"children":1701},{"style":362},[1702],{"type":69,"value":376},{"type":64,"tag":339,"props":1704,"children":1705},{"style":368},[1706],{"type":69,"value":565},{"type":64,"tag":339,"props":1708,"children":1709},{"class":341,"line":352},[1710,1714,1718,1722,1726,1730,1734,1738,1742,1746,1750],{"type":64,"tag":339,"props":1711,"children":1712},{"style":362},[1713],{"type":69,"value":763},{"type":64,"tag":339,"props":1715,"children":1716},{"style":430},[1717],{"type":69,"value":768},{"type":64,"tag":339,"props":1719,"children":1720},{"style":368},[1721],{"type":69,"value":530},{"type":64,"tag":339,"props":1723,"children":1724},{"style":414},[1725],{"type":69,"value":777},{"type":64,"tag":339,"props":1727,"children":1728},{"style":362},[1729],{"type":69,"value":466},{"type":64,"tag":339,"props":1731,"children":1732},{"style":469},[1733],{"type":69,"value":472},{"type":64,"tag":339,"props":1735,"children":1736},{"style":362},[1737],{"type":69,"value":477},{"type":64,"tag":339,"props":1739,"children":1740},{"style":469},[1741],{"type":69,"value":482},{"type":64,"tag":339,"props":1743,"children":1744},{"style":362},[1745],{"type":69,"value":496},{"type":64,"tag":339,"props":1747,"children":1748},{"style":414},[1749],{"type":69,"value":501},{"type":64,"tag":339,"props":1751,"children":1752},{"style":362},[1753],{"type":69,"value":506},{"type":64,"tag":339,"props":1755,"children":1756},{"class":341,"line":400},[1757,1761,1765,1769],{"type":64,"tag":339,"props":1758,"children":1759},{"style":356},[1760],{"type":69,"value":607},{"type":64,"tag":339,"props":1762,"children":1763},{"style":430},[1764],{"type":69,"value":472},{"type":64,"tag":339,"props":1766,"children":1767},{"style":527},[1768],{"type":69,"value":530},{"type":64,"tag":339,"props":1770,"children":1771},{"style":362},[1772],{"type":69,"value":1406},{"type":64,"tag":339,"props":1774,"children":1775},{"class":341,"line":410},[1776,1781,1785],{"type":64,"tag":339,"props":1777,"children":1778},{"style":527},[1779],{"type":69,"value":1780},"      sendContext",{"type":64,"tag":339,"props":1782,"children":1783},{"style":362},[1784],{"type":69,"value":734},{"type":64,"tag":339,"props":1786,"children":1787},{"style":362},[1788],{"type":69,"value":506},{"type":64,"tag":339,"props":1790,"children":1791},{"class":341,"line":455},[1792,1797,1801,1805,1809,1814],{"type":64,"tag":339,"props":1793,"children":1794},{"style":527},[1795],{"type":69,"value":1796},"        workspaceId",{"type":64,"tag":339,"props":1798,"children":1799},{"style":362},[1800],{"type":69,"value":734},{"type":64,"tag":339,"props":1802,"children":1803},{"style":368},[1804],{"type":69,"value":482},{"type":64,"tag":339,"props":1806,"children":1807},{"style":362},[1808],{"type":69,"value":442},{"type":64,"tag":339,"props":1810,"children":1811},{"style":368},[1812],{"type":69,"value":1813},"workspaceId",{"type":64,"tag":339,"props":1815,"children":1816},{"style":362},[1817],{"type":69,"value":1818},",\n",{"type":64,"tag":339,"props":1820,"children":1821},{"class":341,"line":509},[1822],{"type":64,"tag":339,"props":1823,"children":1824},{"style":362},[1825],{"type":69,"value":1826},"      },\n",{"type":64,"tag":339,"props":1828,"children":1829},{"class":341,"line":568},[1830,1835],{"type":64,"tag":339,"props":1831,"children":1832},{"style":362},[1833],{"type":69,"value":1834},"    }",{"type":64,"tag":339,"props":1836,"children":1837},{"style":527},[1838],{"type":69,"value":565},{"type":64,"tag":339,"props":1840,"children":1841},{"class":341,"line":601},[1842,1846],{"type":64,"tag":339,"props":1843,"children":1844},{"style":362},[1845],{"type":69,"value":859},{"type":64,"tag":339,"props":1847,"children":1848},{"style":368},[1849],{"type":69,"value":565},{"type":64,"tag":339,"props":1851,"children":1852},{"class":341,"line":615},[1853,1857,1861,1865,1869,1873,1877,1881,1885,1889,1893],{"type":64,"tag":339,"props":1854,"children":1855},{"style":362},[1856],{"type":69,"value":763},{"type":64,"tag":339,"props":1858,"children":1859},{"style":430},[1860],{"type":69,"value":447},{"type":64,"tag":339,"props":1862,"children":1863},{"style":368},[1864],{"type":69,"value":530},{"type":64,"tag":339,"props":1866,"children":1867},{"style":414},[1868],{"type":69,"value":777},{"type":64,"tag":339,"props":1870,"children":1871},{"style":362},[1872],{"type":69,"value":466},{"type":64,"tag":339,"props":1874,"children":1875},{"style":469},[1876],{"type":69,"value":472},{"type":64,"tag":339,"props":1878,"children":1879},{"style":362},[1880],{"type":69,"value":477},{"type":64,"tag":339,"props":1882,"children":1883},{"style":469},[1884],{"type":69,"value":482},{"type":64,"tag":339,"props":1886,"children":1887},{"style":362},[1888],{"type":69,"value":496},{"type":64,"tag":339,"props":1890,"children":1891},{"style":414},[1892],{"type":69,"value":501},{"type":64,"tag":339,"props":1894,"children":1895},{"style":362},[1896],{"type":69,"value":506},{"type":64,"tag":339,"props":1898,"children":1899},{"class":341,"line":624},[1900],{"type":64,"tag":339,"props":1901,"children":1902},{"style":346},[1903],{"type":69,"value":1904},"    \u002F\u002F workspaceId available here, but VALIDATE IT\n",{"type":64,"tag":339,"props":1906,"children":1907},{"class":341,"line":866},[1908,1912,1916,1920,1924,1928,1933,1937,1941,1945,1949,1953],{"type":64,"tag":339,"props":1909,"children":1910},{"style":368},[1911],{"type":69,"value":515},{"type":64,"tag":339,"props":1913,"children":1914},{"style":362},[1915],{"type":69,"value":442},{"type":64,"tag":339,"props":1917,"children":1918},{"style":430},[1919],{"type":69,"value":524},{"type":64,"tag":339,"props":1921,"children":1922},{"style":527},[1923],{"type":69,"value":530},{"type":64,"tag":339,"props":1925,"children":1926},{"style":362},[1927],{"type":69,"value":535},{"type":64,"tag":339,"props":1929,"children":1930},{"style":389},[1931],{"type":69,"value":1932},"Workspace:",{"type":64,"tag":339,"props":1934,"children":1935},{"style":362},[1936],{"type":69,"value":535},{"type":64,"tag":339,"props":1938,"children":1939},{"style":362},[1940],{"type":69,"value":477},{"type":64,"tag":339,"props":1942,"children":1943},{"style":368},[1944],{"type":69,"value":482},{"type":64,"tag":339,"props":1946,"children":1947},{"style":362},[1948],{"type":69,"value":442},{"type":64,"tag":339,"props":1950,"children":1951},{"style":368},[1952],{"type":69,"value":1813},{"type":64,"tag":339,"props":1954,"children":1955},{"style":527},[1956],{"type":69,"value":565},{"type":64,"tag":339,"props":1958,"children":1959},{"class":341,"line":914},[1960,1964,1968],{"type":64,"tag":339,"props":1961,"children":1962},{"style":356},[1963],{"type":69,"value":607},{"type":64,"tag":339,"props":1965,"children":1966},{"style":430},[1967],{"type":69,"value":472},{"type":64,"tag":339,"props":1969,"children":1970},{"style":527},[1971],{"type":69,"value":598},{"type":64,"tag":339,"props":1973,"children":1974},{"class":341,"line":923},[1975,1979],{"type":64,"tag":339,"props":1976,"children":1977},{"style":362},[1978],{"type":69,"value":859},{"type":64,"tag":339,"props":1980,"children":1981},{"style":368},[1982],{"type":69,"value":565},{"type":64,"tag":1638,"props":1984,"children":1986},{"id":1985},"server-client-sendcontext-in-server",[1987],{"type":69,"value":1988},"Server → Client (sendContext in server)",{"type":64,"tag":328,"props":1990,"children":1992},{"className":330,"code":1991,"language":332,"meta":333,"style":333},"const serverTimer = createMiddleware({ type: 'function' }).server(\n  async ({ next }) => {\n    return next({\n      sendContext: {\n        timeFromServer: new Date(),\n      },\n    })\n  },\n)\n\nconst clientLogger = createMiddleware({ type: 'function' })\n  .middleware([serverTimer])\n  .client(async ({ next }) => {\n    const result = await next()\n    console.log('Server time:', result.context.timeFromServer)\n    return result\n  })\n",[1993],{"type":64,"tag":92,"props":1994,"children":1995},{"__ignoreMap":333},[1996,2064,2091,2110,2125,2154,2161,2172,2179,2186,2193,2249,2265,2304,2331,2393,2404],{"type":64,"tag":339,"props":1997,"children":1998},{"class":341,"line":342},[1999,2003,2008,2012,2016,2020,2024,2028,2032,2036,2040,2044,2048,2052,2056,2060],{"type":64,"tag":339,"props":2000,"children":2001},{"style":414},[2002],{"type":69,"value":417},{"type":64,"tag":339,"props":2004,"children":2005},{"style":368},[2006],{"type":69,"value":2007}," serverTimer ",{"type":64,"tag":339,"props":2009,"children":2010},{"style":362},[2011],{"type":69,"value":427},{"type":64,"tag":339,"props":2013,"children":2014},{"style":430},[2015],{"type":69,"value":371},{"type":64,"tag":339,"props":2017,"children":2018},{"style":368},[2019],{"type":69,"value":530},{"type":64,"tag":339,"props":2021,"children":2022},{"style":362},[2023],{"type":69,"value":724},{"type":64,"tag":339,"props":2025,"children":2026},{"style":527},[2027],{"type":69,"value":729},{"type":64,"tag":339,"props":2029,"children":2030},{"style":362},[2031],{"type":69,"value":734},{"type":64,"tag":339,"props":2033,"children":2034},{"style":362},[2035],{"type":69,"value":386},{"type":64,"tag":339,"props":2037,"children":2038},{"style":389},[2039],{"type":69,"value":743},{"type":64,"tag":339,"props":2041,"children":2042},{"style":362},[2043],{"type":69,"value":535},{"type":64,"tag":339,"props":2045,"children":2046},{"style":362},[2047],{"type":69,"value":376},{"type":64,"tag":339,"props":2049,"children":2050},{"style":368},[2051],{"type":69,"value":268},{"type":64,"tag":339,"props":2053,"children":2054},{"style":362},[2055],{"type":69,"value":442},{"type":64,"tag":339,"props":2057,"children":2058},{"style":430},[2059],{"type":69,"value":447},{"type":64,"tag":339,"props":2061,"children":2062},{"style":368},[2063],{"type":69,"value":452},{"type":64,"tag":339,"props":2065,"children":2066},{"class":341,"line":352},[2067,2071,2075,2079,2083,2087],{"type":64,"tag":339,"props":2068,"children":2069},{"style":414},[2070],{"type":69,"value":461},{"type":64,"tag":339,"props":2072,"children":2073},{"style":362},[2074],{"type":69,"value":466},{"type":64,"tag":339,"props":2076,"children":2077},{"style":469},[2078],{"type":69,"value":472},{"type":64,"tag":339,"props":2080,"children":2081},{"style":362},[2082],{"type":69,"value":496},{"type":64,"tag":339,"props":2084,"children":2085},{"style":414},[2086],{"type":69,"value":501},{"type":64,"tag":339,"props":2088,"children":2089},{"style":362},[2090],{"type":69,"value":506},{"type":64,"tag":339,"props":2092,"children":2093},{"class":341,"line":400},[2094,2098,2102,2106],{"type":64,"tag":339,"props":2095,"children":2096},{"style":356},[2097],{"type":69,"value":607},{"type":64,"tag":339,"props":2099,"children":2100},{"style":430},[2101],{"type":69,"value":472},{"type":64,"tag":339,"props":2103,"children":2104},{"style":527},[2105],{"type":69,"value":530},{"type":64,"tag":339,"props":2107,"children":2108},{"style":362},[2109],{"type":69,"value":1406},{"type":64,"tag":339,"props":2111,"children":2112},{"class":341,"line":410},[2113,2117,2121],{"type":64,"tag":339,"props":2114,"children":2115},{"style":527},[2116],{"type":69,"value":1780},{"type":64,"tag":339,"props":2118,"children":2119},{"style":362},[2120],{"type":69,"value":734},{"type":64,"tag":339,"props":2122,"children":2123},{"style":362},[2124],{"type":69,"value":506},{"type":64,"tag":339,"props":2126,"children":2127},{"class":341,"line":455},[2128,2133,2137,2141,2146,2150],{"type":64,"tag":339,"props":2129,"children":2130},{"style":527},[2131],{"type":69,"value":2132},"        timeFromServer",{"type":64,"tag":339,"props":2134,"children":2135},{"style":362},[2136],{"type":69,"value":734},{"type":64,"tag":339,"props":2138,"children":2139},{"style":362},[2140],{"type":69,"value":1352},{"type":64,"tag":339,"props":2142,"children":2143},{"style":430},[2144],{"type":69,"value":2145}," Date",{"type":64,"tag":339,"props":2147,"children":2148},{"style":527},[2149],{"type":69,"value":437},{"type":64,"tag":339,"props":2151,"children":2152},{"style":362},[2153],{"type":69,"value":1818},{"type":64,"tag":339,"props":2155,"children":2156},{"class":341,"line":509},[2157],{"type":64,"tag":339,"props":2158,"children":2159},{"style":362},[2160],{"type":69,"value":1826},{"type":64,"tag":339,"props":2162,"children":2163},{"class":341,"line":568},[2164,2168],{"type":64,"tag":339,"props":2165,"children":2166},{"style":362},[2167],{"type":69,"value":1834},{"type":64,"tag":339,"props":2169,"children":2170},{"style":527},[2171],{"type":69,"value":565},{"type":64,"tag":339,"props":2173,"children":2174},{"class":341,"line":601},[2175],{"type":64,"tag":339,"props":2176,"children":2177},{"style":362},[2178],{"type":69,"value":621},{"type":64,"tag":339,"props":2180,"children":2181},{"class":341,"line":615},[2182],{"type":64,"tag":339,"props":2183,"children":2184},{"style":368},[2185],{"type":69,"value":565},{"type":64,"tag":339,"props":2187,"children":2188},{"class":341,"line":624},[2189],{"type":64,"tag":339,"props":2190,"children":2191},{"emptyLinePlaceholder":404},[2192],{"type":69,"value":407},{"type":64,"tag":339,"props":2194,"children":2195},{"class":341,"line":866},[2196,2200,2205,2209,2213,2217,2221,2225,2229,2233,2237,2241,2245],{"type":64,"tag":339,"props":2197,"children":2198},{"style":414},[2199],{"type":69,"value":417},{"type":64,"tag":339,"props":2201,"children":2202},{"style":368},[2203],{"type":69,"value":2204}," clientLogger ",{"type":64,"tag":339,"props":2206,"children":2207},{"style":362},[2208],{"type":69,"value":427},{"type":64,"tag":339,"props":2210,"children":2211},{"style":430},[2212],{"type":69,"value":371},{"type":64,"tag":339,"props":2214,"children":2215},{"style":368},[2216],{"type":69,"value":530},{"type":64,"tag":339,"props":2218,"children":2219},{"style":362},[2220],{"type":69,"value":724},{"type":64,"tag":339,"props":2222,"children":2223},{"style":527},[2224],{"type":69,"value":729},{"type":64,"tag":339,"props":2226,"children":2227},{"style":362},[2228],{"type":69,"value":734},{"type":64,"tag":339,"props":2230,"children":2231},{"style":362},[2232],{"type":69,"value":386},{"type":64,"tag":339,"props":2234,"children":2235},{"style":389},[2236],{"type":69,"value":743},{"type":64,"tag":339,"props":2238,"children":2239},{"style":362},[2240],{"type":69,"value":535},{"type":64,"tag":339,"props":2242,"children":2243},{"style":362},[2244],{"type":69,"value":376},{"type":64,"tag":339,"props":2246,"children":2247},{"style":368},[2248],{"type":69,"value":565},{"type":64,"tag":339,"props":2250,"children":2251},{"class":341,"line":914},[2252,2256,2260],{"type":64,"tag":339,"props":2253,"children":2254},{"style":362},[2255],{"type":69,"value":763},{"type":64,"tag":339,"props":2257,"children":2258},{"style":430},[2259],{"type":69,"value":4},{"type":64,"tag":339,"props":2261,"children":2262},{"style":368},[2263],{"type":69,"value":2264},"([serverTimer])\n",{"type":64,"tag":339,"props":2266,"children":2267},{"class":341,"line":923},[2268,2272,2276,2280,2284,2288,2292,2296,2300],{"type":64,"tag":339,"props":2269,"children":2270},{"style":362},[2271],{"type":69,"value":763},{"type":64,"tag":339,"props":2273,"children":2274},{"style":430},[2275],{"type":69,"value":768},{"type":64,"tag":339,"props":2277,"children":2278},{"style":368},[2279],{"type":69,"value":530},{"type":64,"tag":339,"props":2281,"children":2282},{"style":414},[2283],{"type":69,"value":777},{"type":64,"tag":339,"props":2285,"children":2286},{"style":362},[2287],{"type":69,"value":466},{"type":64,"tag":339,"props":2289,"children":2290},{"style":469},[2291],{"type":69,"value":472},{"type":64,"tag":339,"props":2293,"children":2294},{"style":362},[2295],{"type":69,"value":496},{"type":64,"tag":339,"props":2297,"children":2298},{"style":414},[2299],{"type":69,"value":501},{"type":64,"tag":339,"props":2301,"children":2302},{"style":362},[2303],{"type":69,"value":506},{"type":64,"tag":339,"props":2305,"children":2306},{"class":341,"line":951},[2307,2311,2315,2319,2323,2327],{"type":64,"tag":339,"props":2308,"children":2309},{"style":414},[2310],{"type":69,"value":574},{"type":64,"tag":339,"props":2312,"children":2313},{"style":368},[2314],{"type":69,"value":579},{"type":64,"tag":339,"props":2316,"children":2317},{"style":362},[2318],{"type":69,"value":584},{"type":64,"tag":339,"props":2320,"children":2321},{"style":356},[2322],{"type":69,"value":589},{"type":64,"tag":339,"props":2324,"children":2325},{"style":430},[2326],{"type":69,"value":472},{"type":64,"tag":339,"props":2328,"children":2329},{"style":527},[2330],{"type":69,"value":598},{"type":64,"tag":339,"props":2332,"children":2333},{"class":341,"line":960},[2334,2338,2342,2346,2350,2354,2359,2363,2367,2371,2375,2380,2384,2389],{"type":64,"tag":339,"props":2335,"children":2336},{"style":368},[2337],{"type":69,"value":515},{"type":64,"tag":339,"props":2339,"children":2340},{"style":362},[2341],{"type":69,"value":442},{"type":64,"tag":339,"props":2343,"children":2344},{"style":430},[2345],{"type":69,"value":524},{"type":64,"tag":339,"props":2347,"children":2348},{"style":527},[2349],{"type":69,"value":530},{"type":64,"tag":339,"props":2351,"children":2352},{"style":362},[2353],{"type":69,"value":535},{"type":64,"tag":339,"props":2355,"children":2356},{"style":389},[2357],{"type":69,"value":2358},"Server time:",{"type":64,"tag":339,"props":2360,"children":2361},{"style":362},[2362],{"type":69,"value":535},{"type":64,"tag":339,"props":2364,"children":2365},{"style":362},[2366],{"type":69,"value":477},{"type":64,"tag":339,"props":2368,"children":2369},{"style":368},[2370],{"type":69,"value":579},{"type":64,"tag":339,"props":2372,"children":2373},{"style":362},[2374],{"type":69,"value":442},{"type":64,"tag":339,"props":2376,"children":2377},{"style":368},[2378],{"type":69,"value":2379},"context",{"type":64,"tag":339,"props":2381,"children":2382},{"style":362},[2383],{"type":69,"value":442},{"type":64,"tag":339,"props":2385,"children":2386},{"style":368},[2387],{"type":69,"value":2388},"timeFromServer",{"type":64,"tag":339,"props":2390,"children":2391},{"style":527},[2392],{"type":69,"value":565},{"type":64,"tag":339,"props":2394,"children":2395},{"class":341,"line":972},[2396,2400],{"type":64,"tag":339,"props":2397,"children":2398},{"style":356},[2399],{"type":69,"value":607},{"type":64,"tag":339,"props":2401,"children":2402},{"style":368},[2403],{"type":69,"value":612},{"type":64,"tag":339,"props":2405,"children":2407},{"class":341,"line":2406},17,[2408,2412],{"type":64,"tag":339,"props":2409,"children":2410},{"style":362},[2411],{"type":69,"value":859},{"type":64,"tag":339,"props":2413,"children":2414},{"style":368},[2415],{"type":69,"value":565},{"type":64,"tag":153,"props":2417,"children":2419},{"id":2418},"input-validation-in-middleware",[2420],{"type":69,"value":2421},"Input Validation in Middleware",{"type":64,"tag":328,"props":2423,"children":2425},{"className":330,"code":2424,"language":332,"meta":333,"style":333},"import { z } from 'zod'\nimport { zodValidator } from '@tanstack\u002Fzod-adapter'\n\nconst workspaceMiddleware = createMiddleware({ type: 'function' })\n  .validator(zodValidator(z.object({ workspaceId: z.string() })))\n  .server(async ({ next, data }) => {\n    console.log('Workspace:', data.workspaceId)\n    return next()\n  })\n",[2426],{"type":64,"tag":92,"props":2427,"children":2428},{"__ignoreMap":333},[2429,2466,2503,2510,2565,2644,2692,2743,2758],{"type":64,"tag":339,"props":2430,"children":2431},{"class":341,"line":342},[2432,2436,2440,2445,2449,2453,2457,2462],{"type":64,"tag":339,"props":2433,"children":2434},{"style":356},[2435],{"type":69,"value":359},{"type":64,"tag":339,"props":2437,"children":2438},{"style":362},[2439],{"type":69,"value":365},{"type":64,"tag":339,"props":2441,"children":2442},{"style":368},[2443],{"type":69,"value":2444}," z",{"type":64,"tag":339,"props":2446,"children":2447},{"style":362},[2448],{"type":69,"value":376},{"type":64,"tag":339,"props":2450,"children":2451},{"style":356},[2452],{"type":69,"value":381},{"type":64,"tag":339,"props":2454,"children":2455},{"style":362},[2456],{"type":69,"value":386},{"type":64,"tag":339,"props":2458,"children":2459},{"style":389},[2460],{"type":69,"value":2461},"zod",{"type":64,"tag":339,"props":2463,"children":2464},{"style":362},[2465],{"type":69,"value":397},{"type":64,"tag":339,"props":2467,"children":2468},{"class":341,"line":352},[2469,2473,2477,2482,2486,2490,2494,2499],{"type":64,"tag":339,"props":2470,"children":2471},{"style":356},[2472],{"type":69,"value":359},{"type":64,"tag":339,"props":2474,"children":2475},{"style":362},[2476],{"type":69,"value":365},{"type":64,"tag":339,"props":2478,"children":2479},{"style":368},[2480],{"type":69,"value":2481}," zodValidator",{"type":64,"tag":339,"props":2483,"children":2484},{"style":362},[2485],{"type":69,"value":376},{"type":64,"tag":339,"props":2487,"children":2488},{"style":356},[2489],{"type":69,"value":381},{"type":64,"tag":339,"props":2491,"children":2492},{"style":362},[2493],{"type":69,"value":386},{"type":64,"tag":339,"props":2495,"children":2496},{"style":389},[2497],{"type":69,"value":2498},"@tanstack\u002Fzod-adapter",{"type":64,"tag":339,"props":2500,"children":2501},{"style":362},[2502],{"type":69,"value":397},{"type":64,"tag":339,"props":2504,"children":2505},{"class":341,"line":400},[2506],{"type":64,"tag":339,"props":2507,"children":2508},{"emptyLinePlaceholder":404},[2509],{"type":69,"value":407},{"type":64,"tag":339,"props":2511,"children":2512},{"class":341,"line":410},[2513,2517,2521,2525,2529,2533,2537,2541,2545,2549,2553,2557,2561],{"type":64,"tag":339,"props":2514,"children":2515},{"style":414},[2516],{"type":69,"value":417},{"type":64,"tag":339,"props":2518,"children":2519},{"style":368},[2520],{"type":69,"value":1662},{"type":64,"tag":339,"props":2522,"children":2523},{"style":362},[2524],{"type":69,"value":427},{"type":64,"tag":339,"props":2526,"children":2527},{"style":430},[2528],{"type":69,"value":371},{"type":64,"tag":339,"props":2530,"children":2531},{"style":368},[2532],{"type":69,"value":530},{"type":64,"tag":339,"props":2534,"children":2535},{"style":362},[2536],{"type":69,"value":724},{"type":64,"tag":339,"props":2538,"children":2539},{"style":527},[2540],{"type":69,"value":729},{"type":64,"tag":339,"props":2542,"children":2543},{"style":362},[2544],{"type":69,"value":734},{"type":64,"tag":339,"props":2546,"children":2547},{"style":362},[2548],{"type":69,"value":386},{"type":64,"tag":339,"props":2550,"children":2551},{"style":389},[2552],{"type":69,"value":743},{"type":64,"tag":339,"props":2554,"children":2555},{"style":362},[2556],{"type":69,"value":535},{"type":64,"tag":339,"props":2558,"children":2559},{"style":362},[2560],{"type":69,"value":376},{"type":64,"tag":339,"props":2562,"children":2563},{"style":368},[2564],{"type":69,"value":565},{"type":64,"tag":339,"props":2566,"children":2567},{"class":341,"line":455},[2568,2572,2577,2581,2586,2591,2595,2600,2604,2608,2613,2617,2621,2625,2630,2635,2639],{"type":64,"tag":339,"props":2569,"children":2570},{"style":362},[2571],{"type":69,"value":763},{"type":64,"tag":339,"props":2573,"children":2574},{"style":430},[2575],{"type":69,"value":2576},"validator",{"type":64,"tag":339,"props":2578,"children":2579},{"style":368},[2580],{"type":69,"value":530},{"type":64,"tag":339,"props":2582,"children":2583},{"style":430},[2584],{"type":69,"value":2585},"zodValidator",{"type":64,"tag":339,"props":2587,"children":2588},{"style":368},[2589],{"type":69,"value":2590},"(z",{"type":64,"tag":339,"props":2592,"children":2593},{"style":362},[2594],{"type":69,"value":442},{"type":64,"tag":339,"props":2596,"children":2597},{"style":430},[2598],{"type":69,"value":2599},"object",{"type":64,"tag":339,"props":2601,"children":2602},{"style":368},[2603],{"type":69,"value":530},{"type":64,"tag":339,"props":2605,"children":2606},{"style":362},[2607],{"type":69,"value":724},{"type":64,"tag":339,"props":2609,"children":2610},{"style":527},[2611],{"type":69,"value":2612}," workspaceId",{"type":64,"tag":339,"props":2614,"children":2615},{"style":362},[2616],{"type":69,"value":734},{"type":64,"tag":339,"props":2618,"children":2619},{"style":368},[2620],{"type":69,"value":2444},{"type":64,"tag":339,"props":2622,"children":2623},{"style":362},[2624],{"type":69,"value":442},{"type":64,"tag":339,"props":2626,"children":2627},{"style":430},[2628],{"type":69,"value":2629},"string",{"type":64,"tag":339,"props":2631,"children":2632},{"style":368},[2633],{"type":69,"value":2634},"() ",{"type":64,"tag":339,"props":2636,"children":2637},{"style":362},[2638],{"type":69,"value":1450},{"type":64,"tag":339,"props":2640,"children":2641},{"style":368},[2642],{"type":69,"value":2643},")))\n",{"type":64,"tag":339,"props":2645,"children":2646},{"class":341,"line":509},[2647,2651,2655,2659,2663,2667,2671,2675,2680,2684,2688],{"type":64,"tag":339,"props":2648,"children":2649},{"style":362},[2650],{"type":69,"value":763},{"type":64,"tag":339,"props":2652,"children":2653},{"style":430},[2654],{"type":69,"value":447},{"type":64,"tag":339,"props":2656,"children":2657},{"style":368},[2658],{"type":69,"value":530},{"type":64,"tag":339,"props":2660,"children":2661},{"style":414},[2662],{"type":69,"value":777},{"type":64,"tag":339,"props":2664,"children":2665},{"style":362},[2666],{"type":69,"value":466},{"type":64,"tag":339,"props":2668,"children":2669},{"style":469},[2670],{"type":69,"value":472},{"type":64,"tag":339,"props":2672,"children":2673},{"style":362},[2674],{"type":69,"value":477},{"type":64,"tag":339,"props":2676,"children":2677},{"style":469},[2678],{"type":69,"value":2679}," data",{"type":64,"tag":339,"props":2681,"children":2682},{"style":362},[2683],{"type":69,"value":496},{"type":64,"tag":339,"props":2685,"children":2686},{"style":414},[2687],{"type":69,"value":501},{"type":64,"tag":339,"props":2689,"children":2690},{"style":362},[2691],{"type":69,"value":506},{"type":64,"tag":339,"props":2693,"children":2694},{"class":341,"line":568},[2695,2699,2703,2707,2711,2715,2719,2723,2727,2731,2735,2739],{"type":64,"tag":339,"props":2696,"children":2697},{"style":368},[2698],{"type":69,"value":515},{"type":64,"tag":339,"props":2700,"children":2701},{"style":362},[2702],{"type":69,"value":442},{"type":64,"tag":339,"props":2704,"children":2705},{"style":430},[2706],{"type":69,"value":524},{"type":64,"tag":339,"props":2708,"children":2709},{"style":527},[2710],{"type":69,"value":530},{"type":64,"tag":339,"props":2712,"children":2713},{"style":362},[2714],{"type":69,"value":535},{"type":64,"tag":339,"props":2716,"children":2717},{"style":389},[2718],{"type":69,"value":1932},{"type":64,"tag":339,"props":2720,"children":2721},{"style":362},[2722],{"type":69,"value":535},{"type":64,"tag":339,"props":2724,"children":2725},{"style":362},[2726],{"type":69,"value":477},{"type":64,"tag":339,"props":2728,"children":2729},{"style":368},[2730],{"type":69,"value":2679},{"type":64,"tag":339,"props":2732,"children":2733},{"style":362},[2734],{"type":69,"value":442},{"type":64,"tag":339,"props":2736,"children":2737},{"style":368},[2738],{"type":69,"value":1813},{"type":64,"tag":339,"props":2740,"children":2741},{"style":527},[2742],{"type":69,"value":565},{"type":64,"tag":339,"props":2744,"children":2745},{"class":341,"line":601},[2746,2750,2754],{"type":64,"tag":339,"props":2747,"children":2748},{"style":356},[2749],{"type":69,"value":607},{"type":64,"tag":339,"props":2751,"children":2752},{"style":430},[2753],{"type":69,"value":472},{"type":64,"tag":339,"props":2755,"children":2756},{"style":527},[2757],{"type":69,"value":598},{"type":64,"tag":339,"props":2759,"children":2760},{"class":341,"line":615},[2761,2765],{"type":64,"tag":339,"props":2762,"children":2763},{"style":362},[2764],{"type":69,"value":859},{"type":64,"tag":339,"props":2766,"children":2767},{"style":368},[2768],{"type":69,"value":565},{"type":64,"tag":153,"props":2770,"children":2772},{"id":2771},"global-middleware",[2773],{"type":69,"value":2774},"Global Middleware",{"type":64,"tag":71,"props":2776,"children":2777},{},[2778,2780,2786],{"type":69,"value":2779},"Create ",{"type":64,"tag":92,"props":2781,"children":2783},{"className":2782},[],[2784],{"type":69,"value":2785},"src\u002Fstart.ts",{"type":69,"value":2787}," to configure global middleware:",{"type":64,"tag":328,"props":2789,"children":2791},{"className":330,"code":2790,"language":332,"meta":333,"style":333},"\u002F\u002F src\u002Fstart.ts\n\u002F\u002F Use @tanstack\u002F\u003Cframework>-start for your framework (react, solid, vue)\nimport { createStart, createMiddleware } from '@tanstack\u002Freact-start'\n\nconst requestLogger = createMiddleware().server(async ({ next, request }) => {\n  console.log(`${request.method} ${request.url}`)\n  return next()\n})\n\nconst functionAuth = createMiddleware({ type: 'function' }).server(\n  async ({ next }) => {\n    \u002F\u002F runs for every server function\n    return next()\n  },\n)\n\nexport const startInstance = createStart(() => ({\n  requestMiddleware: [requestLogger],\n  functionMiddleware: [functionAuth],\n}))\n",[2792],{"type":64,"tag":92,"props":2793,"children":2794},{"__ignoreMap":333},[2795,2803,2810,2854,2861,2929,2997,3012,3023,3030,3098,3125,3133,3148,3155,3162,3169,3215,3237,3259],{"type":64,"tag":339,"props":2796,"children":2797},{"class":341,"line":342},[2798],{"type":64,"tag":339,"props":2799,"children":2800},{"style":346},[2801],{"type":69,"value":2802},"\u002F\u002F src\u002Fstart.ts\n",{"type":64,"tag":339,"props":2804,"children":2805},{"class":341,"line":352},[2806],{"type":64,"tag":339,"props":2807,"children":2808},{"style":346},[2809],{"type":69,"value":349},{"type":64,"tag":339,"props":2811,"children":2812},{"class":341,"line":400},[2813,2817,2821,2826,2830,2834,2838,2842,2846,2850],{"type":64,"tag":339,"props":2814,"children":2815},{"style":356},[2816],{"type":69,"value":359},{"type":64,"tag":339,"props":2818,"children":2819},{"style":362},[2820],{"type":69,"value":365},{"type":64,"tag":339,"props":2822,"children":2823},{"style":368},[2824],{"type":69,"value":2825}," createStart",{"type":64,"tag":339,"props":2827,"children":2828},{"style":362},[2829],{"type":69,"value":477},{"type":64,"tag":339,"props":2831,"children":2832},{"style":368},[2833],{"type":69,"value":371},{"type":64,"tag":339,"props":2835,"children":2836},{"style":362},[2837],{"type":69,"value":376},{"type":64,"tag":339,"props":2839,"children":2840},{"style":356},[2841],{"type":69,"value":381},{"type":64,"tag":339,"props":2843,"children":2844},{"style":362},[2845],{"type":69,"value":386},{"type":64,"tag":339,"props":2847,"children":2848},{"style":389},[2849],{"type":69,"value":392},{"type":64,"tag":339,"props":2851,"children":2852},{"style":362},[2853],{"type":69,"value":397},{"type":64,"tag":339,"props":2855,"children":2856},{"class":341,"line":410},[2857],{"type":64,"tag":339,"props":2858,"children":2859},{"emptyLinePlaceholder":404},[2860],{"type":69,"value":407},{"type":64,"tag":339,"props":2862,"children":2863},{"class":341,"line":455},[2864,2868,2873,2877,2881,2885,2889,2893,2897,2901,2905,2909,2913,2917,2921,2925],{"type":64,"tag":339,"props":2865,"children":2866},{"style":414},[2867],{"type":69,"value":417},{"type":64,"tag":339,"props":2869,"children":2870},{"style":368},[2871],{"type":69,"value":2872}," requestLogger ",{"type":64,"tag":339,"props":2874,"children":2875},{"style":362},[2876],{"type":69,"value":427},{"type":64,"tag":339,"props":2878,"children":2879},{"style":430},[2880],{"type":69,"value":371},{"type":64,"tag":339,"props":2882,"children":2883},{"style":368},[2884],{"type":69,"value":437},{"type":64,"tag":339,"props":2886,"children":2887},{"style":362},[2888],{"type":69,"value":442},{"type":64,"tag":339,"props":2890,"children":2891},{"style":430},[2892],{"type":69,"value":447},{"type":64,"tag":339,"props":2894,"children":2895},{"style":368},[2896],{"type":69,"value":530},{"type":64,"tag":339,"props":2898,"children":2899},{"style":414},[2900],{"type":69,"value":777},{"type":64,"tag":339,"props":2902,"children":2903},{"style":362},[2904],{"type":69,"value":466},{"type":64,"tag":339,"props":2906,"children":2907},{"style":469},[2908],{"type":69,"value":472},{"type":64,"tag":339,"props":2910,"children":2911},{"style":362},[2912],{"type":69,"value":477},{"type":64,"tag":339,"props":2914,"children":2915},{"style":469},[2916],{"type":69,"value":491},{"type":64,"tag":339,"props":2918,"children":2919},{"style":362},[2920],{"type":69,"value":496},{"type":64,"tag":339,"props":2922,"children":2923},{"style":414},[2924],{"type":69,"value":501},{"type":64,"tag":339,"props":2926,"children":2927},{"style":362},[2928],{"type":69,"value":506},{"type":64,"tag":339,"props":2930,"children":2931},{"class":341,"line":509},[2932,2937,2941,2945,2949,2954,2958,2962,2967,2971,2976,2980,2984,2988,2993],{"type":64,"tag":339,"props":2933,"children":2934},{"style":368},[2935],{"type":69,"value":2936},"  console",{"type":64,"tag":339,"props":2938,"children":2939},{"style":362},[2940],{"type":69,"value":442},{"type":64,"tag":339,"props":2942,"children":2943},{"style":430},[2944],{"type":69,"value":524},{"type":64,"tag":339,"props":2946,"children":2947},{"style":527},[2948],{"type":69,"value":530},{"type":64,"tag":339,"props":2950,"children":2951},{"style":362},[2952],{"type":69,"value":2953},"`${",{"type":64,"tag":339,"props":2955,"children":2956},{"style":368},[2957],{"type":69,"value":1301},{"type":64,"tag":339,"props":2959,"children":2960},{"style":362},[2961],{"type":69,"value":442},{"type":64,"tag":339,"props":2963,"children":2964},{"style":368},[2965],{"type":69,"value":2966},"method",{"type":64,"tag":339,"props":2968,"children":2969},{"style":362},[2970],{"type":69,"value":1450},{"type":64,"tag":339,"props":2972,"children":2973},{"style":362},[2974],{"type":69,"value":2975}," ${",{"type":64,"tag":339,"props":2977,"children":2978},{"style":368},[2979],{"type":69,"value":1301},{"type":64,"tag":339,"props":2981,"children":2982},{"style":362},[2983],{"type":69,"value":442},{"type":64,"tag":339,"props":2985,"children":2986},{"style":368},[2987],{"type":69,"value":43},{"type":64,"tag":339,"props":2989,"children":2990},{"style":362},[2991],{"type":69,"value":2992},"}`",{"type":64,"tag":339,"props":2994,"children":2995},{"style":527},[2996],{"type":69,"value":565},{"type":64,"tag":339,"props":2998,"children":2999},{"class":341,"line":568},[3000,3004,3008],{"type":64,"tag":339,"props":3001,"children":3002},{"style":356},[3003],{"type":69,"value":1393},{"type":64,"tag":339,"props":3005,"children":3006},{"style":430},[3007],{"type":69,"value":472},{"type":64,"tag":339,"props":3009,"children":3010},{"style":527},[3011],{"type":69,"value":598},{"type":64,"tag":339,"props":3013,"children":3014},{"class":341,"line":601},[3015,3019],{"type":64,"tag":339,"props":3016,"children":3017},{"style":362},[3018],{"type":69,"value":1450},{"type":64,"tag":339,"props":3020,"children":3021},{"style":368},[3022],{"type":69,"value":565},{"type":64,"tag":339,"props":3024,"children":3025},{"class":341,"line":615},[3026],{"type":64,"tag":339,"props":3027,"children":3028},{"emptyLinePlaceholder":404},[3029],{"type":69,"value":407},{"type":64,"tag":339,"props":3031,"children":3032},{"class":341,"line":624},[3033,3037,3042,3046,3050,3054,3058,3062,3066,3070,3074,3078,3082,3086,3090,3094],{"type":64,"tag":339,"props":3034,"children":3035},{"style":414},[3036],{"type":69,"value":417},{"type":64,"tag":339,"props":3038,"children":3039},{"style":368},[3040],{"type":69,"value":3041}," functionAuth ",{"type":64,"tag":339,"props":3043,"children":3044},{"style":362},[3045],{"type":69,"value":427},{"type":64,"tag":339,"props":3047,"children":3048},{"style":430},[3049],{"type":69,"value":371},{"type":64,"tag":339,"props":3051,"children":3052},{"style":368},[3053],{"type":69,"value":530},{"type":64,"tag":339,"props":3055,"children":3056},{"style":362},[3057],{"type":69,"value":724},{"type":64,"tag":339,"props":3059,"children":3060},{"style":527},[3061],{"type":69,"value":729},{"type":64,"tag":339,"props":3063,"children":3064},{"style":362},[3065],{"type":69,"value":734},{"type":64,"tag":339,"props":3067,"children":3068},{"style":362},[3069],{"type":69,"value":386},{"type":64,"tag":339,"props":3071,"children":3072},{"style":389},[3073],{"type":69,"value":743},{"type":64,"tag":339,"props":3075,"children":3076},{"style":362},[3077],{"type":69,"value":535},{"type":64,"tag":339,"props":3079,"children":3080},{"style":362},[3081],{"type":69,"value":376},{"type":64,"tag":339,"props":3083,"children":3084},{"style":368},[3085],{"type":69,"value":268},{"type":64,"tag":339,"props":3087,"children":3088},{"style":362},[3089],{"type":69,"value":442},{"type":64,"tag":339,"props":3091,"children":3092},{"style":430},[3093],{"type":69,"value":447},{"type":64,"tag":339,"props":3095,"children":3096},{"style":368},[3097],{"type":69,"value":452},{"type":64,"tag":339,"props":3099,"children":3100},{"class":341,"line":866},[3101,3105,3109,3113,3117,3121],{"type":64,"tag":339,"props":3102,"children":3103},{"style":414},[3104],{"type":69,"value":461},{"type":64,"tag":339,"props":3106,"children":3107},{"style":362},[3108],{"type":69,"value":466},{"type":64,"tag":339,"props":3110,"children":3111},{"style":469},[3112],{"type":69,"value":472},{"type":64,"tag":339,"props":3114,"children":3115},{"style":362},[3116],{"type":69,"value":496},{"type":64,"tag":339,"props":3118,"children":3119},{"style":414},[3120],{"type":69,"value":501},{"type":64,"tag":339,"props":3122,"children":3123},{"style":362},[3124],{"type":69,"value":506},{"type":64,"tag":339,"props":3126,"children":3127},{"class":341,"line":914},[3128],{"type":64,"tag":339,"props":3129,"children":3130},{"style":346},[3131],{"type":69,"value":3132},"    \u002F\u002F runs for every server function\n",{"type":64,"tag":339,"props":3134,"children":3135},{"class":341,"line":923},[3136,3140,3144],{"type":64,"tag":339,"props":3137,"children":3138},{"style":356},[3139],{"type":69,"value":607},{"type":64,"tag":339,"props":3141,"children":3142},{"style":430},[3143],{"type":69,"value":472},{"type":64,"tag":339,"props":3145,"children":3146},{"style":527},[3147],{"type":69,"value":598},{"type":64,"tag":339,"props":3149,"children":3150},{"class":341,"line":951},[3151],{"type":64,"tag":339,"props":3152,"children":3153},{"style":362},[3154],{"type":69,"value":621},{"type":64,"tag":339,"props":3156,"children":3157},{"class":341,"line":960},[3158],{"type":64,"tag":339,"props":3159,"children":3160},{"style":368},[3161],{"type":69,"value":565},{"type":64,"tag":339,"props":3163,"children":3164},{"class":341,"line":972},[3165],{"type":64,"tag":339,"props":3166,"children":3167},{"emptyLinePlaceholder":404},[3168],{"type":69,"value":407},{"type":64,"tag":339,"props":3170,"children":3171},{"class":341,"line":2406},[3172,3177,3182,3187,3191,3195,3199,3203,3207,3211],{"type":64,"tag":339,"props":3173,"children":3174},{"style":356},[3175],{"type":69,"value":3176},"export",{"type":64,"tag":339,"props":3178,"children":3179},{"style":414},[3180],{"type":69,"value":3181}," const",{"type":64,"tag":339,"props":3183,"children":3184},{"style":368},[3185],{"type":69,"value":3186}," startInstance ",{"type":64,"tag":339,"props":3188,"children":3189},{"style":362},[3190],{"type":69,"value":427},{"type":64,"tag":339,"props":3192,"children":3193},{"style":430},[3194],{"type":69,"value":2825},{"type":64,"tag":339,"props":3196,"children":3197},{"style":368},[3198],{"type":69,"value":530},{"type":64,"tag":339,"props":3200,"children":3201},{"style":362},[3202],{"type":69,"value":437},{"type":64,"tag":339,"props":3204,"children":3205},{"style":414},[3206],{"type":69,"value":501},{"type":64,"tag":339,"props":3208,"children":3209},{"style":368},[3210],{"type":69,"value":1327},{"type":64,"tag":339,"props":3212,"children":3213},{"style":362},[3214],{"type":69,"value":1406},{"type":64,"tag":339,"props":3216,"children":3218},{"class":341,"line":3217},18,[3219,3224,3228,3233],{"type":64,"tag":339,"props":3220,"children":3221},{"style":527},[3222],{"type":69,"value":3223},"  requestMiddleware",{"type":64,"tag":339,"props":3225,"children":3226},{"style":362},[3227],{"type":69,"value":734},{"type":64,"tag":339,"props":3229,"children":3230},{"style":368},[3231],{"type":69,"value":3232}," [requestLogger]",{"type":64,"tag":339,"props":3234,"children":3235},{"style":362},[3236],{"type":69,"value":1818},{"type":64,"tag":339,"props":3238,"children":3240},{"class":341,"line":3239},19,[3241,3246,3250,3255],{"type":64,"tag":339,"props":3242,"children":3243},{"style":527},[3244],{"type":69,"value":3245},"  functionMiddleware",{"type":64,"tag":339,"props":3247,"children":3248},{"style":362},[3249],{"type":69,"value":734},{"type":64,"tag":339,"props":3251,"children":3252},{"style":368},[3253],{"type":69,"value":3254}," [functionAuth]",{"type":64,"tag":339,"props":3256,"children":3257},{"style":362},[3258],{"type":69,"value":1818},{"type":64,"tag":339,"props":3260,"children":3262},{"class":341,"line":3261},20,[3263,3267],{"type":64,"tag":339,"props":3264,"children":3265},{"style":362},[3266],{"type":69,"value":1450},{"type":64,"tag":339,"props":3268,"children":3269},{"style":368},[3270],{"type":69,"value":3271},"))\n",{"type":64,"tag":153,"props":3273,"children":3275},{"id":3274},"using-middleware-with-server-routes",[3276],{"type":69,"value":3277},"Using Middleware with Server Routes",{"type":64,"tag":1638,"props":3279,"children":3281},{"id":3280},"all-handlers-in-a-route",[3282],{"type":69,"value":3283},"All handlers in a route",{"type":64,"tag":328,"props":3285,"children":3287},{"className":330,"code":3286,"language":332,"meta":333,"style":333},"export const Route = createFileRoute('\u002Fapi\u002Fusers')({\n  server: {\n    middleware: [authMiddleware],\n    handlers: {\n      GET: async ({ context }) => Response.json(context.user),\n      POST: async ({ request }) => {\n        \u002F* ... *\u002F\n      },\n    },\n  },\n})\n",[3288],{"type":64,"tag":92,"props":3289,"children":3290},{"__ignoreMap":333},[3291,3342,3358,3379,3395,3460,3496,3504,3511,3519,3526],{"type":64,"tag":339,"props":3292,"children":3293},{"class":341,"line":342},[3294,3298,3302,3307,3311,3316,3320,3324,3329,3333,3338],{"type":64,"tag":339,"props":3295,"children":3296},{"style":356},[3297],{"type":69,"value":3176},{"type":64,"tag":339,"props":3299,"children":3300},{"style":414},[3301],{"type":69,"value":3181},{"type":64,"tag":339,"props":3303,"children":3304},{"style":368},[3305],{"type":69,"value":3306}," Route ",{"type":64,"tag":339,"props":3308,"children":3309},{"style":362},[3310],{"type":69,"value":427},{"type":64,"tag":339,"props":3312,"children":3313},{"style":430},[3314],{"type":69,"value":3315}," createFileRoute",{"type":64,"tag":339,"props":3317,"children":3318},{"style":368},[3319],{"type":69,"value":530},{"type":64,"tag":339,"props":3321,"children":3322},{"style":362},[3323],{"type":69,"value":535},{"type":64,"tag":339,"props":3325,"children":3326},{"style":389},[3327],{"type":69,"value":3328},"\u002Fapi\u002Fusers",{"type":64,"tag":339,"props":3330,"children":3331},{"style":362},[3332],{"type":69,"value":535},{"type":64,"tag":339,"props":3334,"children":3335},{"style":368},[3336],{"type":69,"value":3337},")(",{"type":64,"tag":339,"props":3339,"children":3340},{"style":362},[3341],{"type":69,"value":1406},{"type":64,"tag":339,"props":3343,"children":3344},{"class":341,"line":352},[3345,3350,3354],{"type":64,"tag":339,"props":3346,"children":3347},{"style":527},[3348],{"type":69,"value":3349},"  server",{"type":64,"tag":339,"props":3351,"children":3352},{"style":362},[3353],{"type":69,"value":734},{"type":64,"tag":339,"props":3355,"children":3356},{"style":362},[3357],{"type":69,"value":506},{"type":64,"tag":339,"props":3359,"children":3360},{"class":341,"line":400},[3361,3366,3370,3375],{"type":64,"tag":339,"props":3362,"children":3363},{"style":527},[3364],{"type":69,"value":3365},"    middleware",{"type":64,"tag":339,"props":3367,"children":3368},{"style":362},[3369],{"type":69,"value":734},{"type":64,"tag":339,"props":3371,"children":3372},{"style":368},[3373],{"type":69,"value":3374}," [authMiddleware]",{"type":64,"tag":339,"props":3376,"children":3377},{"style":362},[3378],{"type":69,"value":1818},{"type":64,"tag":339,"props":3380,"children":3381},{"class":341,"line":410},[3382,3387,3391],{"type":64,"tag":339,"props":3383,"children":3384},{"style":527},[3385],{"type":69,"value":3386},"    handlers",{"type":64,"tag":339,"props":3388,"children":3389},{"style":362},[3390],{"type":69,"value":734},{"type":64,"tag":339,"props":3392,"children":3393},{"style":362},[3394],{"type":69,"value":506},{"type":64,"tag":339,"props":3396,"children":3397},{"class":341,"line":455},[3398,3403,3407,3412,3416,3420,3424,3428,3433,3437,3442,3447,3451,3456],{"type":64,"tag":339,"props":3399,"children":3400},{"style":430},[3401],{"type":69,"value":3402},"      GET",{"type":64,"tag":339,"props":3404,"children":3405},{"style":362},[3406],{"type":69,"value":734},{"type":64,"tag":339,"props":3408,"children":3409},{"style":414},[3410],{"type":69,"value":3411}," async",{"type":64,"tag":339,"props":3413,"children":3414},{"style":362},[3415],{"type":69,"value":466},{"type":64,"tag":339,"props":3417,"children":3418},{"style":469},[3419],{"type":69,"value":482},{"type":64,"tag":339,"props":3421,"children":3422},{"style":362},[3423],{"type":69,"value":496},{"type":64,"tag":339,"props":3425,"children":3426},{"style":414},[3427],{"type":69,"value":501},{"type":64,"tag":339,"props":3429,"children":3430},{"style":368},[3431],{"type":69,"value":3432}," Response",{"type":64,"tag":339,"props":3434,"children":3435},{"style":362},[3436],{"type":69,"value":442},{"type":64,"tag":339,"props":3438,"children":3439},{"style":430},[3440],{"type":69,"value":3441},"json",{"type":64,"tag":339,"props":3443,"children":3444},{"style":368},[3445],{"type":69,"value":3446},"(context",{"type":64,"tag":339,"props":3448,"children":3449},{"style":362},[3450],{"type":69,"value":442},{"type":64,"tag":339,"props":3452,"children":3453},{"style":368},[3454],{"type":69,"value":3455},"user)",{"type":64,"tag":339,"props":3457,"children":3458},{"style":362},[3459],{"type":69,"value":1818},{"type":64,"tag":339,"props":3461,"children":3462},{"class":341,"line":509},[3463,3468,3472,3476,3480,3484,3488,3492],{"type":64,"tag":339,"props":3464,"children":3465},{"style":430},[3466],{"type":69,"value":3467},"      POST",{"type":64,"tag":339,"props":3469,"children":3470},{"style":362},[3471],{"type":69,"value":734},{"type":64,"tag":339,"props":3473,"children":3474},{"style":414},[3475],{"type":69,"value":3411},{"type":64,"tag":339,"props":3477,"children":3478},{"style":362},[3479],{"type":69,"value":466},{"type":64,"tag":339,"props":3481,"children":3482},{"style":469},[3483],{"type":69,"value":491},{"type":64,"tag":339,"props":3485,"children":3486},{"style":362},[3487],{"type":69,"value":496},{"type":64,"tag":339,"props":3489,"children":3490},{"style":414},[3491],{"type":69,"value":501},{"type":64,"tag":339,"props":3493,"children":3494},{"style":362},[3495],{"type":69,"value":506},{"type":64,"tag":339,"props":3497,"children":3498},{"class":341,"line":568},[3499],{"type":64,"tag":339,"props":3500,"children":3501},{"style":346},[3502],{"type":69,"value":3503},"        \u002F* ... *\u002F\n",{"type":64,"tag":339,"props":3505,"children":3506},{"class":341,"line":601},[3507],{"type":64,"tag":339,"props":3508,"children":3509},{"style":362},[3510],{"type":69,"value":1826},{"type":64,"tag":339,"props":3512,"children":3513},{"class":341,"line":615},[3514],{"type":64,"tag":339,"props":3515,"children":3516},{"style":362},[3517],{"type":69,"value":3518},"    },\n",{"type":64,"tag":339,"props":3520,"children":3521},{"class":341,"line":624},[3522],{"type":64,"tag":339,"props":3523,"children":3524},{"style":362},[3525],{"type":69,"value":621},{"type":64,"tag":339,"props":3527,"children":3528},{"class":341,"line":866},[3529,3533],{"type":64,"tag":339,"props":3530,"children":3531},{"style":362},[3532],{"type":69,"value":1450},{"type":64,"tag":339,"props":3534,"children":3535},{"style":368},[3536],{"type":69,"value":565},{"type":64,"tag":1638,"props":3538,"children":3540},{"id":3539},"specific-handlers-only",[3541],{"type":69,"value":3542},"Specific handlers only",{"type":64,"tag":328,"props":3544,"children":3546},{"className":330,"code":3545,"language":332,"meta":333,"style":333},"export const Route = createFileRoute('\u002Fapi\u002Fusers')({\n  server: {\n    handlers: ({ createHandlers }) =>\n      createHandlers({\n        GET: async () => Response.json({ public: true }),\n        POST: {\n          middleware: [authMiddleware],\n          handler: async ({ context }) => {\n            return Response.json({ user: context.session.user })\n          },\n        },\n      }),\n  },\n})\n",[3547],{"type":64,"tag":92,"props":3548,"children":3549},{"__ignoreMap":333},[3550,3597,3612,3641,3657,3729,3745,3765,3801,3865,3873,3881,3897,3904],{"type":64,"tag":339,"props":3551,"children":3552},{"class":341,"line":342},[3553,3557,3561,3565,3569,3573,3577,3581,3585,3589,3593],{"type":64,"tag":339,"props":3554,"children":3555},{"style":356},[3556],{"type":69,"value":3176},{"type":64,"tag":339,"props":3558,"children":3559},{"style":414},[3560],{"type":69,"value":3181},{"type":64,"tag":339,"props":3562,"children":3563},{"style":368},[3564],{"type":69,"value":3306},{"type":64,"tag":339,"props":3566,"children":3567},{"style":362},[3568],{"type":69,"value":427},{"type":64,"tag":339,"props":3570,"children":3571},{"style":430},[3572],{"type":69,"value":3315},{"type":64,"tag":339,"props":3574,"children":3575},{"style":368},[3576],{"type":69,"value":530},{"type":64,"tag":339,"props":3578,"children":3579},{"style":362},[3580],{"type":69,"value":535},{"type":64,"tag":339,"props":3582,"children":3583},{"style":389},[3584],{"type":69,"value":3328},{"type":64,"tag":339,"props":3586,"children":3587},{"style":362},[3588],{"type":69,"value":535},{"type":64,"tag":339,"props":3590,"children":3591},{"style":368},[3592],{"type":69,"value":3337},{"type":64,"tag":339,"props":3594,"children":3595},{"style":362},[3596],{"type":69,"value":1406},{"type":64,"tag":339,"props":3598,"children":3599},{"class":341,"line":352},[3600,3604,3608],{"type":64,"tag":339,"props":3601,"children":3602},{"style":527},[3603],{"type":69,"value":3349},{"type":64,"tag":339,"props":3605,"children":3606},{"style":362},[3607],{"type":69,"value":734},{"type":64,"tag":339,"props":3609,"children":3610},{"style":362},[3611],{"type":69,"value":506},{"type":64,"tag":339,"props":3613,"children":3614},{"class":341,"line":400},[3615,3619,3623,3627,3632,3636],{"type":64,"tag":339,"props":3616,"children":3617},{"style":430},[3618],{"type":69,"value":3386},{"type":64,"tag":339,"props":3620,"children":3621},{"style":362},[3622],{"type":69,"value":734},{"type":64,"tag":339,"props":3624,"children":3625},{"style":362},[3626],{"type":69,"value":466},{"type":64,"tag":339,"props":3628,"children":3629},{"style":469},[3630],{"type":69,"value":3631}," createHandlers",{"type":64,"tag":339,"props":3633,"children":3634},{"style":362},[3635],{"type":69,"value":496},{"type":64,"tag":339,"props":3637,"children":3638},{"style":414},[3639],{"type":69,"value":3640}," =>\n",{"type":64,"tag":339,"props":3642,"children":3643},{"class":341,"line":410},[3644,3649,3653],{"type":64,"tag":339,"props":3645,"children":3646},{"style":430},[3647],{"type":69,"value":3648},"      createHandlers",{"type":64,"tag":339,"props":3650,"children":3651},{"style":368},[3652],{"type":69,"value":530},{"type":64,"tag":339,"props":3654,"children":3655},{"style":362},[3656],{"type":69,"value":1406},{"type":64,"tag":339,"props":3658,"children":3659},{"class":341,"line":455},[3660,3665,3669,3673,3678,3682,3686,3690,3694,3698,3702,3707,3711,3717,3721,3725],{"type":64,"tag":339,"props":3661,"children":3662},{"style":430},[3663],{"type":69,"value":3664},"        GET",{"type":64,"tag":339,"props":3666,"children":3667},{"style":362},[3668],{"type":69,"value":734},{"type":64,"tag":339,"props":3670,"children":3671},{"style":414},[3672],{"type":69,"value":3411},{"type":64,"tag":339,"props":3674,"children":3675},{"style":362},[3676],{"type":69,"value":3677}," ()",{"type":64,"tag":339,"props":3679,"children":3680},{"style":414},[3681],{"type":69,"value":501},{"type":64,"tag":339,"props":3683,"children":3684},{"style":368},[3685],{"type":69,"value":3432},{"type":64,"tag":339,"props":3687,"children":3688},{"style":362},[3689],{"type":69,"value":442},{"type":64,"tag":339,"props":3691,"children":3692},{"style":430},[3693],{"type":69,"value":3441},{"type":64,"tag":339,"props":3695,"children":3696},{"style":368},[3697],{"type":69,"value":530},{"type":64,"tag":339,"props":3699,"children":3700},{"style":362},[3701],{"type":69,"value":724},{"type":64,"tag":339,"props":3703,"children":3704},{"style":527},[3705],{"type":69,"value":3706}," public",{"type":64,"tag":339,"props":3708,"children":3709},{"style":362},[3710],{"type":69,"value":734},{"type":64,"tag":339,"props":3712,"children":3714},{"style":3713},"--shiki-light:#FF5370;--shiki-default:#FF9CAC;--shiki-dark:#FF9CAC",[3715],{"type":69,"value":3716}," true",{"type":64,"tag":339,"props":3718,"children":3719},{"style":362},[3720],{"type":69,"value":376},{"type":64,"tag":339,"props":3722,"children":3723},{"style":368},[3724],{"type":69,"value":268},{"type":64,"tag":339,"props":3726,"children":3727},{"style":362},[3728],{"type":69,"value":1818},{"type":64,"tag":339,"props":3730,"children":3731},{"class":341,"line":509},[3732,3737,3741],{"type":64,"tag":339,"props":3733,"children":3734},{"style":527},[3735],{"type":69,"value":3736},"        POST",{"type":64,"tag":339,"props":3738,"children":3739},{"style":362},[3740],{"type":69,"value":734},{"type":64,"tag":339,"props":3742,"children":3743},{"style":362},[3744],{"type":69,"value":506},{"type":64,"tag":339,"props":3746,"children":3747},{"class":341,"line":568},[3748,3753,3757,3761],{"type":64,"tag":339,"props":3749,"children":3750},{"style":527},[3751],{"type":69,"value":3752},"          middleware",{"type":64,"tag":339,"props":3754,"children":3755},{"style":362},[3756],{"type":69,"value":734},{"type":64,"tag":339,"props":3758,"children":3759},{"style":368},[3760],{"type":69,"value":3374},{"type":64,"tag":339,"props":3762,"children":3763},{"style":362},[3764],{"type":69,"value":1818},{"type":64,"tag":339,"props":3766,"children":3767},{"class":341,"line":601},[3768,3773,3777,3781,3785,3789,3793,3797],{"type":64,"tag":339,"props":3769,"children":3770},{"style":430},[3771],{"type":69,"value":3772},"          handler",{"type":64,"tag":339,"props":3774,"children":3775},{"style":362},[3776],{"type":69,"value":734},{"type":64,"tag":339,"props":3778,"children":3779},{"style":414},[3780],{"type":69,"value":3411},{"type":64,"tag":339,"props":3782,"children":3783},{"style":362},[3784],{"type":69,"value":466},{"type":64,"tag":339,"props":3786,"children":3787},{"style":469},[3788],{"type":69,"value":482},{"type":64,"tag":339,"props":3790,"children":3791},{"style":362},[3792],{"type":69,"value":496},{"type":64,"tag":339,"props":3794,"children":3795},{"style":414},[3796],{"type":69,"value":501},{"type":64,"tag":339,"props":3798,"children":3799},{"style":362},[3800],{"type":69,"value":506},{"type":64,"tag":339,"props":3802,"children":3803},{"class":341,"line":615},[3804,3809,3813,3817,3821,3825,3829,3833,3837,3841,3845,3849,3853,3857,3861],{"type":64,"tag":339,"props":3805,"children":3806},{"style":356},[3807],{"type":69,"value":3808},"            return",{"type":64,"tag":339,"props":3810,"children":3811},{"style":368},[3812],{"type":69,"value":3432},{"type":64,"tag":339,"props":3814,"children":3815},{"style":362},[3816],{"type":69,"value":442},{"type":64,"tag":339,"props":3818,"children":3819},{"style":430},[3820],{"type":69,"value":3441},{"type":64,"tag":339,"props":3822,"children":3823},{"style":527},[3824],{"type":69,"value":530},{"type":64,"tag":339,"props":3826,"children":3827},{"style":362},[3828],{"type":69,"value":724},{"type":64,"tag":339,"props":3830,"children":3831},{"style":527},[3832],{"type":69,"value":1148},{"type":64,"tag":339,"props":3834,"children":3835},{"style":362},[3836],{"type":69,"value":734},{"type":64,"tag":339,"props":3838,"children":3839},{"style":368},[3840],{"type":69,"value":482},{"type":64,"tag":339,"props":3842,"children":3843},{"style":362},[3844],{"type":69,"value":442},{"type":64,"tag":339,"props":3846,"children":3847},{"style":368},[3848],{"type":69,"value":1337},{"type":64,"tag":339,"props":3850,"children":3851},{"style":362},[3852],{"type":69,"value":442},{"type":64,"tag":339,"props":3854,"children":3855},{"style":368},[3856],{"type":69,"value":1165},{"type":64,"tag":339,"props":3858,"children":3859},{"style":362},[3860],{"type":69,"value":376},{"type":64,"tag":339,"props":3862,"children":3863},{"style":527},[3864],{"type":69,"value":565},{"type":64,"tag":339,"props":3866,"children":3867},{"class":341,"line":624},[3868],{"type":64,"tag":339,"props":3869,"children":3870},{"style":362},[3871],{"type":69,"value":3872},"          },\n",{"type":64,"tag":339,"props":3874,"children":3875},{"class":341,"line":866},[3876],{"type":64,"tag":339,"props":3877,"children":3878},{"style":362},[3879],{"type":69,"value":3880},"        },\n",{"type":64,"tag":339,"props":3882,"children":3883},{"class":341,"line":914},[3884,3889,3893],{"type":64,"tag":339,"props":3885,"children":3886},{"style":362},[3887],{"type":69,"value":3888},"      }",{"type":64,"tag":339,"props":3890,"children":3891},{"style":368},[3892],{"type":69,"value":268},{"type":64,"tag":339,"props":3894,"children":3895},{"style":362},[3896],{"type":69,"value":1818},{"type":64,"tag":339,"props":3898,"children":3899},{"class":341,"line":923},[3900],{"type":64,"tag":339,"props":3901,"children":3902},{"style":362},[3903],{"type":69,"value":621},{"type":64,"tag":339,"props":3905,"children":3906},{"class":341,"line":951},[3907,3911],{"type":64,"tag":339,"props":3908,"children":3909},{"style":362},[3910],{"type":69,"value":1450},{"type":64,"tag":339,"props":3912,"children":3913},{"style":368},[3914],{"type":69,"value":565},{"type":64,"tag":153,"props":3916,"children":3918},{"id":3917},"middleware-factories",[3919],{"type":69,"value":3920},"Middleware Factories",{"type":64,"tag":71,"props":3922,"children":3923},{},[3924],{"type":69,"value":3925},"Create parameterized middleware for reusable patterns like authorization:",{"type":64,"tag":328,"props":3927,"children":3929},{"className":330,"code":3928,"language":332,"meta":333,"style":333},"const authMiddleware = createMiddleware().server(async ({ next, request }) => {\n  const session = await auth.getSession({ headers: request.headers })\n  if (!session) throw new Error('Unauthorized')\n  return next({ context: { session } })\n})\n",[3930],{"type":64,"tag":92,"props":3931,"children":3932},{"__ignoreMap":333},[3933,4000,4070,4125,4172],{"type":64,"tag":339,"props":3934,"children":3935},{"class":341,"line":342},[3936,3940,3944,3948,3952,3956,3960,3964,3968,3972,3976,3980,3984,3988,3992,3996],{"type":64,"tag":339,"props":3937,"children":3938},{"style":414},[3939],{"type":69,"value":417},{"type":64,"tag":339,"props":3941,"children":3942},{"style":368},[3943],{"type":69,"value":707},{"type":64,"tag":339,"props":3945,"children":3946},{"style":362},[3947],{"type":69,"value":427},{"type":64,"tag":339,"props":3949,"children":3950},{"style":430},[3951],{"type":69,"value":371},{"type":64,"tag":339,"props":3953,"children":3954},{"style":368},[3955],{"type":69,"value":437},{"type":64,"tag":339,"props":3957,"children":3958},{"style":362},[3959],{"type":69,"value":442},{"type":64,"tag":339,"props":3961,"children":3962},{"style":430},[3963],{"type":69,"value":447},{"type":64,"tag":339,"props":3965,"children":3966},{"style":368},[3967],{"type":69,"value":530},{"type":64,"tag":339,"props":3969,"children":3970},{"style":414},[3971],{"type":69,"value":777},{"type":64,"tag":339,"props":3973,"children":3974},{"style":362},[3975],{"type":69,"value":466},{"type":64,"tag":339,"props":3977,"children":3978},{"style":469},[3979],{"type":69,"value":472},{"type":64,"tag":339,"props":3981,"children":3982},{"style":362},[3983],{"type":69,"value":477},{"type":64,"tag":339,"props":3985,"children":3986},{"style":469},[3987],{"type":69,"value":491},{"type":64,"tag":339,"props":3989,"children":3990},{"style":362},[3991],{"type":69,"value":496},{"type":64,"tag":339,"props":3993,"children":3994},{"style":414},[3995],{"type":69,"value":501},{"type":64,"tag":339,"props":3997,"children":3998},{"style":362},[3999],{"type":69,"value":506},{"type":64,"tag":339,"props":4001,"children":4002},{"class":341,"line":352},[4003,4007,4011,4015,4019,4024,4028,4033,4037,4041,4046,4050,4054,4058,4062,4066],{"type":64,"tag":339,"props":4004,"children":4005},{"style":414},[4006],{"type":69,"value":1274},{"type":64,"tag":339,"props":4008,"children":4009},{"style":368},[4010],{"type":69,"value":1279},{"type":64,"tag":339,"props":4012,"children":4013},{"style":362},[4014],{"type":69,"value":584},{"type":64,"tag":339,"props":4016,"children":4017},{"style":356},[4018],{"type":69,"value":589},{"type":64,"tag":339,"props":4020,"children":4021},{"style":368},[4022],{"type":69,"value":4023}," auth",{"type":64,"tag":339,"props":4025,"children":4026},{"style":362},[4027],{"type":69,"value":442},{"type":64,"tag":339,"props":4029,"children":4030},{"style":430},[4031],{"type":69,"value":4032},"getSession",{"type":64,"tag":339,"props":4034,"children":4035},{"style":527},[4036],{"type":69,"value":530},{"type":64,"tag":339,"props":4038,"children":4039},{"style":362},[4040],{"type":69,"value":724},{"type":64,"tag":339,"props":4042,"children":4043},{"style":527},[4044],{"type":69,"value":4045}," headers",{"type":64,"tag":339,"props":4047,"children":4048},{"style":362},[4049],{"type":69,"value":734},{"type":64,"tag":339,"props":4051,"children":4052},{"style":368},[4053],{"type":69,"value":491},{"type":64,"tag":339,"props":4055,"children":4056},{"style":362},[4057],{"type":69,"value":442},{"type":64,"tag":339,"props":4059,"children":4060},{"style":368},[4061],{"type":69,"value":1310},{"type":64,"tag":339,"props":4063,"children":4064},{"style":362},[4065],{"type":69,"value":376},{"type":64,"tag":339,"props":4067,"children":4068},{"style":527},[4069],{"type":69,"value":565},{"type":64,"tag":339,"props":4071,"children":4072},{"class":341,"line":400},[4073,4077,4081,4085,4089,4093,4097,4101,4105,4109,4113,4117,4121],{"type":64,"tag":339,"props":4074,"children":4075},{"style":356},[4076],{"type":69,"value":1322},{"type":64,"tag":339,"props":4078,"children":4079},{"style":527},[4080],{"type":69,"value":1327},{"type":64,"tag":339,"props":4082,"children":4083},{"style":362},[4084],{"type":69,"value":1332},{"type":64,"tag":339,"props":4086,"children":4087},{"style":368},[4088],{"type":69,"value":1337},{"type":64,"tag":339,"props":4090,"children":4091},{"style":527},[4092],{"type":69,"value":1342},{"type":64,"tag":339,"props":4094,"children":4095},{"style":356},[4096],{"type":69,"value":1347},{"type":64,"tag":339,"props":4098,"children":4099},{"style":362},[4100],{"type":69,"value":1352},{"type":64,"tag":339,"props":4102,"children":4103},{"style":430},[4104],{"type":69,"value":1357},{"type":64,"tag":339,"props":4106,"children":4107},{"style":527},[4108],{"type":69,"value":530},{"type":64,"tag":339,"props":4110,"children":4111},{"style":362},[4112],{"type":69,"value":535},{"type":64,"tag":339,"props":4114,"children":4115},{"style":389},[4116],{"type":69,"value":1370},{"type":64,"tag":339,"props":4118,"children":4119},{"style":362},[4120],{"type":69,"value":535},{"type":64,"tag":339,"props":4122,"children":4123},{"style":527},[4124],{"type":69,"value":565},{"type":64,"tag":339,"props":4126,"children":4127},{"class":341,"line":410},[4128,4132,4136,4140,4144,4148,4152,4156,4160,4164,4168],{"type":64,"tag":339,"props":4129,"children":4130},{"style":356},[4131],{"type":69,"value":1393},{"type":64,"tag":339,"props":4133,"children":4134},{"style":430},[4135],{"type":69,"value":472},{"type":64,"tag":339,"props":4137,"children":4138},{"style":527},[4139],{"type":69,"value":530},{"type":64,"tag":339,"props":4141,"children":4142},{"style":362},[4143],{"type":69,"value":724},{"type":64,"tag":339,"props":4145,"children":4146},{"style":527},[4147],{"type":69,"value":482},{"type":64,"tag":339,"props":4149,"children":4150},{"style":362},[4151],{"type":69,"value":734},{"type":64,"tag":339,"props":4153,"children":4154},{"style":362},[4155],{"type":69,"value":365},{"type":64,"tag":339,"props":4157,"children":4158},{"style":368},[4159],{"type":69,"value":1279},{"type":64,"tag":339,"props":4161,"children":4162},{"style":362},[4163],{"type":69,"value":376},{"type":64,"tag":339,"props":4165,"children":4166},{"style":362},[4167],{"type":69,"value":376},{"type":64,"tag":339,"props":4169,"children":4170},{"style":527},[4171],{"type":69,"value":565},{"type":64,"tag":339,"props":4173,"children":4174},{"class":341,"line":455},[4175,4179],{"type":64,"tag":339,"props":4176,"children":4177},{"style":362},[4178],{"type":69,"value":1450},{"type":64,"tag":339,"props":4180,"children":4181},{"style":368},[4182],{"type":69,"value":565},{"type":64,"tag":77,"props":4184,"children":4185},{},[4186],{"type":64,"tag":71,"props":4187,"children":4188},{},[4189,4210,4212,4218,4220,4227,4229,4235],{"type":64,"tag":84,"props":4190,"children":4191},{},[4192,4194,4200,4202,4208],{"type":69,"value":4193},"Attach ",{"type":64,"tag":92,"props":4195,"children":4197},{"className":4196},[],[4198],{"type":69,"value":4199},"authMiddleware",{"type":69,"value":4201}," to every ",{"type":64,"tag":92,"props":4203,"children":4205},{"className":4204},[],[4206],{"type":69,"value":4207},"createServerFn",{"type":69,"value":4209}," that needs auth.",{"type":69,"value":4211}," Server functions are API endpoints; a route ",{"type":64,"tag":92,"props":4213,"children":4215},{"className":4214},[],[4216],{"type":69,"value":4217},"beforeLoad",{"type":69,"value":4219}," does not protect their data, only the route's UI. Protect the endpoint that reads or mutates private data. See ",{"type":64,"tag":4221,"props":4222,"children":4224},"a",{"href":4223},"..\u002F..\u002F..\u002F..\u002Frouter-core\u002Fskills\u002Frouter-core\u002Fauth-and-guards\u002FSKILL.md",[4225],{"type":69,"value":4226},"router-core\u002Fauth-and-guards",{"type":69,"value":4228}," and ",{"type":64,"tag":4221,"props":4230,"children":4232},{"href":4231},"..\u002Fauth-server-primitives\u002FSKILL.md",[4233],{"type":69,"value":4234},"start-core\u002Fauth-server-primitives",{"type":69,"value":442},{"type":64,"tag":328,"props":4237,"children":4239},{"className":330,"code":4238,"language":332,"meta":333,"style":333},"type Permissions = Record\u003Cstring, string[]>\n\nfunction authorizationMiddleware(permissions: Permissions) {\n  return createMiddleware({ type: 'function' })\n    .middleware([authMiddleware])\n    .server(async ({ next, context }) => {\n      const granted = await auth.hasPermission(context.session, permissions)\n      if (!granted) throw new Error('Forbidden')\n      return next()\n    })\n}\n\n\u002F\u002F Usage\nconst getClients = createServerFn()\n  .middleware([authorizationMiddleware({ client: ['read'] })])\n  .handler(async () => {\n    return { message: 'The user can read clients.' }\n  })\n",[4240],{"type":64,"tag":92,"props":4241,"children":4242},{"__ignoreMap":333},[4243,4294,4301,4338,4385,4411,4458,4521,4579,4595,4606,4614,4621,4629,4653,4722,4753,4790],{"type":64,"tag":339,"props":4244,"children":4245},{"class":341,"line":342},[4246,4251,4257,4261,4266,4271,4275,4279,4284,4289],{"type":64,"tag":339,"props":4247,"children":4248},{"style":414},[4249],{"type":69,"value":4250},"type",{"type":64,"tag":339,"props":4252,"children":4254},{"style":4253},"--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B",[4255],{"type":69,"value":4256}," Permissions",{"type":64,"tag":339,"props":4258,"children":4259},{"style":362},[4260],{"type":69,"value":584},{"type":64,"tag":339,"props":4262,"children":4263},{"style":4253},[4264],{"type":69,"value":4265}," Record",{"type":64,"tag":339,"props":4267,"children":4268},{"style":362},[4269],{"type":69,"value":4270},"\u003C",{"type":64,"tag":339,"props":4272,"children":4273},{"style":4253},[4274],{"type":69,"value":2629},{"type":64,"tag":339,"props":4276,"children":4277},{"style":362},[4278],{"type":69,"value":477},{"type":64,"tag":339,"props":4280,"children":4281},{"style":4253},[4282],{"type":69,"value":4283}," string",{"type":64,"tag":339,"props":4285,"children":4286},{"style":368},[4287],{"type":69,"value":4288},"[]",{"type":64,"tag":339,"props":4290,"children":4291},{"style":362},[4292],{"type":69,"value":4293},">\n",{"type":64,"tag":339,"props":4295,"children":4296},{"class":341,"line":352},[4297],{"type":64,"tag":339,"props":4298,"children":4299},{"emptyLinePlaceholder":404},[4300],{"type":69,"value":407},{"type":64,"tag":339,"props":4302,"children":4303},{"class":341,"line":400},[4304,4308,4313,4317,4322,4326,4330,4334],{"type":64,"tag":339,"props":4305,"children":4306},{"style":414},[4307],{"type":69,"value":743},{"type":64,"tag":339,"props":4309,"children":4310},{"style":430},[4311],{"type":69,"value":4312}," authorizationMiddleware",{"type":64,"tag":339,"props":4314,"children":4315},{"style":362},[4316],{"type":69,"value":530},{"type":64,"tag":339,"props":4318,"children":4319},{"style":469},[4320],{"type":69,"value":4321},"permissions",{"type":64,"tag":339,"props":4323,"children":4324},{"style":362},[4325],{"type":69,"value":734},{"type":64,"tag":339,"props":4327,"children":4328},{"style":4253},[4329],{"type":69,"value":4256},{"type":64,"tag":339,"props":4331,"children":4332},{"style":362},[4333],{"type":69,"value":268},{"type":64,"tag":339,"props":4335,"children":4336},{"style":362},[4337],{"type":69,"value":506},{"type":64,"tag":339,"props":4339,"children":4340},{"class":341,"line":410},[4341,4345,4349,4353,4357,4361,4365,4369,4373,4377,4381],{"type":64,"tag":339,"props":4342,"children":4343},{"style":356},[4344],{"type":69,"value":1393},{"type":64,"tag":339,"props":4346,"children":4347},{"style":430},[4348],{"type":69,"value":371},{"type":64,"tag":339,"props":4350,"children":4351},{"style":527},[4352],{"type":69,"value":530},{"type":64,"tag":339,"props":4354,"children":4355},{"style":362},[4356],{"type":69,"value":724},{"type":64,"tag":339,"props":4358,"children":4359},{"style":527},[4360],{"type":69,"value":729},{"type":64,"tag":339,"props":4362,"children":4363},{"style":362},[4364],{"type":69,"value":734},{"type":64,"tag":339,"props":4366,"children":4367},{"style":362},[4368],{"type":69,"value":386},{"type":64,"tag":339,"props":4370,"children":4371},{"style":389},[4372],{"type":69,"value":743},{"type":64,"tag":339,"props":4374,"children":4375},{"style":362},[4376],{"type":69,"value":535},{"type":64,"tag":339,"props":4378,"children":4379},{"style":362},[4380],{"type":69,"value":376},{"type":64,"tag":339,"props":4382,"children":4383},{"style":527},[4384],{"type":69,"value":565},{"type":64,"tag":339,"props":4386,"children":4387},{"class":341,"line":455},[4388,4393,4397,4402,4406],{"type":64,"tag":339,"props":4389,"children":4390},{"style":362},[4391],{"type":69,"value":4392},"    .",{"type":64,"tag":339,"props":4394,"children":4395},{"style":430},[4396],{"type":69,"value":4},{"type":64,"tag":339,"props":4398,"children":4399},{"style":527},[4400],{"type":69,"value":4401},"([",{"type":64,"tag":339,"props":4403,"children":4404},{"style":368},[4405],{"type":69,"value":4199},{"type":64,"tag":339,"props":4407,"children":4408},{"style":527},[4409],{"type":69,"value":4410},"])\n",{"type":64,"tag":339,"props":4412,"children":4413},{"class":341,"line":509},[4414,4418,4422,4426,4430,4434,4438,4442,4446,4450,4454],{"type":64,"tag":339,"props":4415,"children":4416},{"style":362},[4417],{"type":69,"value":4392},{"type":64,"tag":339,"props":4419,"children":4420},{"style":430},[4421],{"type":69,"value":447},{"type":64,"tag":339,"props":4423,"children":4424},{"style":527},[4425],{"type":69,"value":530},{"type":64,"tag":339,"props":4427,"children":4428},{"style":414},[4429],{"type":69,"value":777},{"type":64,"tag":339,"props":4431,"children":4432},{"style":362},[4433],{"type":69,"value":466},{"type":64,"tag":339,"props":4435,"children":4436},{"style":469},[4437],{"type":69,"value":472},{"type":64,"tag":339,"props":4439,"children":4440},{"style":362},[4441],{"type":69,"value":477},{"type":64,"tag":339,"props":4443,"children":4444},{"style":469},[4445],{"type":69,"value":482},{"type":64,"tag":339,"props":4447,"children":4448},{"style":362},[4449],{"type":69,"value":496},{"type":64,"tag":339,"props":4451,"children":4452},{"style":414},[4453],{"type":69,"value":501},{"type":64,"tag":339,"props":4455,"children":4456},{"style":362},[4457],{"type":69,"value":506},{"type":64,"tag":339,"props":4459,"children":4460},{"class":341,"line":568},[4461,4466,4471,4475,4479,4483,4487,4492,4496,4500,4504,4508,4512,4517],{"type":64,"tag":339,"props":4462,"children":4463},{"style":414},[4464],{"type":69,"value":4465},"      const",{"type":64,"tag":339,"props":4467,"children":4468},{"style":368},[4469],{"type":69,"value":4470}," granted",{"type":64,"tag":339,"props":4472,"children":4473},{"style":362},[4474],{"type":69,"value":584},{"type":64,"tag":339,"props":4476,"children":4477},{"style":356},[4478],{"type":69,"value":589},{"type":64,"tag":339,"props":4480,"children":4481},{"style":368},[4482],{"type":69,"value":4023},{"type":64,"tag":339,"props":4484,"children":4485},{"style":362},[4486],{"type":69,"value":442},{"type":64,"tag":339,"props":4488,"children":4489},{"style":430},[4490],{"type":69,"value":4491},"hasPermission",{"type":64,"tag":339,"props":4493,"children":4494},{"style":527},[4495],{"type":69,"value":530},{"type":64,"tag":339,"props":4497,"children":4498},{"style":368},[4499],{"type":69,"value":2379},{"type":64,"tag":339,"props":4501,"children":4502},{"style":362},[4503],{"type":69,"value":442},{"type":64,"tag":339,"props":4505,"children":4506},{"style":368},[4507],{"type":69,"value":1337},{"type":64,"tag":339,"props":4509,"children":4510},{"style":362},[4511],{"type":69,"value":477},{"type":64,"tag":339,"props":4513,"children":4514},{"style":368},[4515],{"type":69,"value":4516}," permissions",{"type":64,"tag":339,"props":4518,"children":4519},{"style":527},[4520],{"type":69,"value":565},{"type":64,"tag":339,"props":4522,"children":4523},{"class":341,"line":601},[4524,4529,4533,4537,4542,4546,4550,4554,4558,4562,4566,4571,4575],{"type":64,"tag":339,"props":4525,"children":4526},{"style":356},[4527],{"type":69,"value":4528},"      if",{"type":64,"tag":339,"props":4530,"children":4531},{"style":527},[4532],{"type":69,"value":1327},{"type":64,"tag":339,"props":4534,"children":4535},{"style":362},[4536],{"type":69,"value":1332},{"type":64,"tag":339,"props":4538,"children":4539},{"style":368},[4540],{"type":69,"value":4541},"granted",{"type":64,"tag":339,"props":4543,"children":4544},{"style":527},[4545],{"type":69,"value":1342},{"type":64,"tag":339,"props":4547,"children":4548},{"style":356},[4549],{"type":69,"value":1347},{"type":64,"tag":339,"props":4551,"children":4552},{"style":362},[4553],{"type":69,"value":1352},{"type":64,"tag":339,"props":4555,"children":4556},{"style":430},[4557],{"type":69,"value":1357},{"type":64,"tag":339,"props":4559,"children":4560},{"style":527},[4561],{"type":69,"value":530},{"type":64,"tag":339,"props":4563,"children":4564},{"style":362},[4565],{"type":69,"value":535},{"type":64,"tag":339,"props":4567,"children":4568},{"style":389},[4569],{"type":69,"value":4570},"Forbidden",{"type":64,"tag":339,"props":4572,"children":4573},{"style":362},[4574],{"type":69,"value":535},{"type":64,"tag":339,"props":4576,"children":4577},{"style":527},[4578],{"type":69,"value":565},{"type":64,"tag":339,"props":4580,"children":4581},{"class":341,"line":615},[4582,4587,4591],{"type":64,"tag":339,"props":4583,"children":4584},{"style":356},[4585],{"type":69,"value":4586},"      return",{"type":64,"tag":339,"props":4588,"children":4589},{"style":430},[4590],{"type":69,"value":472},{"type":64,"tag":339,"props":4592,"children":4593},{"style":527},[4594],{"type":69,"value":598},{"type":64,"tag":339,"props":4596,"children":4597},{"class":341,"line":624},[4598,4602],{"type":64,"tag":339,"props":4599,"children":4600},{"style":362},[4601],{"type":69,"value":1834},{"type":64,"tag":339,"props":4603,"children":4604},{"style":527},[4605],{"type":69,"value":565},{"type":64,"tag":339,"props":4607,"children":4608},{"class":341,"line":866},[4609],{"type":64,"tag":339,"props":4610,"children":4611},{"style":362},[4612],{"type":69,"value":4613},"}\n",{"type":64,"tag":339,"props":4615,"children":4616},{"class":341,"line":914},[4617],{"type":64,"tag":339,"props":4618,"children":4619},{"emptyLinePlaceholder":404},[4620],{"type":69,"value":407},{"type":64,"tag":339,"props":4622,"children":4623},{"class":341,"line":923},[4624],{"type":64,"tag":339,"props":4625,"children":4626},{"style":346},[4627],{"type":69,"value":4628},"\u002F\u002F Usage\n",{"type":64,"tag":339,"props":4630,"children":4631},{"class":341,"line":951},[4632,4636,4641,4645,4649],{"type":64,"tag":339,"props":4633,"children":4634},{"style":414},[4635],{"type":69,"value":417},{"type":64,"tag":339,"props":4637,"children":4638},{"style":368},[4639],{"type":69,"value":4640}," getClients ",{"type":64,"tag":339,"props":4642,"children":4643},{"style":362},[4644],{"type":69,"value":427},{"type":64,"tag":339,"props":4646,"children":4647},{"style":430},[4648],{"type":69,"value":1017},{"type":64,"tag":339,"props":4650,"children":4651},{"style":368},[4652],{"type":69,"value":598},{"type":64,"tag":339,"props":4654,"children":4655},{"class":341,"line":960},[4656,4660,4664,4668,4673,4677,4681,4686,4690,4695,4699,4704,4708,4713,4717],{"type":64,"tag":339,"props":4657,"children":4658},{"style":362},[4659],{"type":69,"value":763},{"type":64,"tag":339,"props":4661,"children":4662},{"style":430},[4663],{"type":69,"value":4},{"type":64,"tag":339,"props":4665,"children":4666},{"style":368},[4667],{"type":69,"value":4401},{"type":64,"tag":339,"props":4669,"children":4670},{"style":430},[4671],{"type":69,"value":4672},"authorizationMiddleware",{"type":64,"tag":339,"props":4674,"children":4675},{"style":368},[4676],{"type":69,"value":530},{"type":64,"tag":339,"props":4678,"children":4679},{"style":362},[4680],{"type":69,"value":724},{"type":64,"tag":339,"props":4682,"children":4683},{"style":527},[4684],{"type":69,"value":4685}," client",{"type":64,"tag":339,"props":4687,"children":4688},{"style":362},[4689],{"type":69,"value":734},{"type":64,"tag":339,"props":4691,"children":4692},{"style":368},[4693],{"type":69,"value":4694}," [",{"type":64,"tag":339,"props":4696,"children":4697},{"style":362},[4698],{"type":69,"value":535},{"type":64,"tag":339,"props":4700,"children":4701},{"style":389},[4702],{"type":69,"value":4703},"read",{"type":64,"tag":339,"props":4705,"children":4706},{"style":362},[4707],{"type":69,"value":535},{"type":64,"tag":339,"props":4709,"children":4710},{"style":368},[4711],{"type":69,"value":4712},"] ",{"type":64,"tag":339,"props":4714,"children":4715},{"style":362},[4716],{"type":69,"value":1450},{"type":64,"tag":339,"props":4718,"children":4719},{"style":368},[4720],{"type":69,"value":4721},")])\n",{"type":64,"tag":339,"props":4723,"children":4724},{"class":341,"line":972},[4725,4729,4733,4737,4741,4745,4749],{"type":64,"tag":339,"props":4726,"children":4727},{"style":362},[4728],{"type":69,"value":763},{"type":64,"tag":339,"props":4730,"children":4731},{"style":430},[4732],{"type":69,"value":1096},{"type":64,"tag":339,"props":4734,"children":4735},{"style":368},[4736],{"type":69,"value":530},{"type":64,"tag":339,"props":4738,"children":4739},{"style":414},[4740],{"type":69,"value":777},{"type":64,"tag":339,"props":4742,"children":4743},{"style":362},[4744],{"type":69,"value":3677},{"type":64,"tag":339,"props":4746,"children":4747},{"style":414},[4748],{"type":69,"value":501},{"type":64,"tag":339,"props":4750,"children":4751},{"style":362},[4752],{"type":69,"value":506},{"type":64,"tag":339,"props":4754,"children":4755},{"class":341,"line":2406},[4756,4760,4764,4769,4773,4777,4782,4786],{"type":64,"tag":339,"props":4757,"children":4758},{"style":356},[4759],{"type":69,"value":607},{"type":64,"tag":339,"props":4761,"children":4762},{"style":362},[4763],{"type":69,"value":365},{"type":64,"tag":339,"props":4765,"children":4766},{"style":527},[4767],{"type":69,"value":4768}," message",{"type":64,"tag":339,"props":4770,"children":4771},{"style":362},[4772],{"type":69,"value":734},{"type":64,"tag":339,"props":4774,"children":4775},{"style":362},[4776],{"type":69,"value":386},{"type":64,"tag":339,"props":4778,"children":4779},{"style":389},[4780],{"type":69,"value":4781},"The user can read clients.",{"type":64,"tag":339,"props":4783,"children":4784},{"style":362},[4785],{"type":69,"value":535},{"type":64,"tag":339,"props":4787,"children":4788},{"style":362},[4789],{"type":69,"value":1170},{"type":64,"tag":339,"props":4791,"children":4792},{"class":341,"line":3217},[4793,4797],{"type":64,"tag":339,"props":4794,"children":4795},{"style":362},[4796],{"type":69,"value":859},{"type":64,"tag":339,"props":4798,"children":4799},{"style":368},[4800],{"type":69,"value":565},{"type":64,"tag":153,"props":4802,"children":4804},{"id":4803},"custom-headers-and-fetch",[4805],{"type":69,"value":4806},"Custom Headers and Fetch",{"type":64,"tag":1638,"props":4808,"children":4810},{"id":4809},"setting-headers-from-client-middleware",[4811],{"type":69,"value":4812},"Setting headers from client middleware",{"type":64,"tag":328,"props":4814,"children":4816},{"className":330,"code":4815,"language":332,"meta":333,"style":333},"const authMiddleware = createMiddleware({ type: 'function' }).client(\n  async ({ next }) => {\n    return next({\n      headers: { Authorization: `Bearer ${getToken()}` },\n    })\n  },\n)\n",[4817],{"type":64,"tag":92,"props":4818,"children":4819},{"__ignoreMap":333},[4820,4887,4914,4933,4990,5001,5008],{"type":64,"tag":339,"props":4821,"children":4822},{"class":341,"line":342},[4823,4827,4831,4835,4839,4843,4847,4851,4855,4859,4863,4867,4871,4875,4879,4883],{"type":64,"tag":339,"props":4824,"children":4825},{"style":414},[4826],{"type":69,"value":417},{"type":64,"tag":339,"props":4828,"children":4829},{"style":368},[4830],{"type":69,"value":707},{"type":64,"tag":339,"props":4832,"children":4833},{"style":362},[4834],{"type":69,"value":427},{"type":64,"tag":339,"props":4836,"children":4837},{"style":430},[4838],{"type":69,"value":371},{"type":64,"tag":339,"props":4840,"children":4841},{"style":368},[4842],{"type":69,"value":530},{"type":64,"tag":339,"props":4844,"children":4845},{"style":362},[4846],{"type":69,"value":724},{"type":64,"tag":339,"props":4848,"children":4849},{"style":527},[4850],{"type":69,"value":729},{"type":64,"tag":339,"props":4852,"children":4853},{"style":362},[4854],{"type":69,"value":734},{"type":64,"tag":339,"props":4856,"children":4857},{"style":362},[4858],{"type":69,"value":386},{"type":64,"tag":339,"props":4860,"children":4861},{"style":389},[4862],{"type":69,"value":743},{"type":64,"tag":339,"props":4864,"children":4865},{"style":362},[4866],{"type":69,"value":535},{"type":64,"tag":339,"props":4868,"children":4869},{"style":362},[4870],{"type":69,"value":376},{"type":64,"tag":339,"props":4872,"children":4873},{"style":368},[4874],{"type":69,"value":268},{"type":64,"tag":339,"props":4876,"children":4877},{"style":362},[4878],{"type":69,"value":442},{"type":64,"tag":339,"props":4880,"children":4881},{"style":430},[4882],{"type":69,"value":768},{"type":64,"tag":339,"props":4884,"children":4885},{"style":368},[4886],{"type":69,"value":452},{"type":64,"tag":339,"props":4888,"children":4889},{"class":341,"line":352},[4890,4894,4898,4902,4906,4910],{"type":64,"tag":339,"props":4891,"children":4892},{"style":414},[4893],{"type":69,"value":461},{"type":64,"tag":339,"props":4895,"children":4896},{"style":362},[4897],{"type":69,"value":466},{"type":64,"tag":339,"props":4899,"children":4900},{"style":469},[4901],{"type":69,"value":472},{"type":64,"tag":339,"props":4903,"children":4904},{"style":362},[4905],{"type":69,"value":496},{"type":64,"tag":339,"props":4907,"children":4908},{"style":414},[4909],{"type":69,"value":501},{"type":64,"tag":339,"props":4911,"children":4912},{"style":362},[4913],{"type":69,"value":506},{"type":64,"tag":339,"props":4915,"children":4916},{"class":341,"line":400},[4917,4921,4925,4929],{"type":64,"tag":339,"props":4918,"children":4919},{"style":356},[4920],{"type":69,"value":607},{"type":64,"tag":339,"props":4922,"children":4923},{"style":430},[4924],{"type":69,"value":472},{"type":64,"tag":339,"props":4926,"children":4927},{"style":527},[4928],{"type":69,"value":530},{"type":64,"tag":339,"props":4930,"children":4931},{"style":362},[4932],{"type":69,"value":1406},{"type":64,"tag":339,"props":4934,"children":4935},{"class":341,"line":410},[4936,4941,4945,4949,4954,4958,4963,4968,4973,4978,4982,4986],{"type":64,"tag":339,"props":4937,"children":4938},{"style":527},[4939],{"type":69,"value":4940},"      headers",{"type":64,"tag":339,"props":4942,"children":4943},{"style":362},[4944],{"type":69,"value":734},{"type":64,"tag":339,"props":4946,"children":4947},{"style":362},[4948],{"type":69,"value":365},{"type":64,"tag":339,"props":4950,"children":4951},{"style":527},[4952],{"type":69,"value":4953}," Authorization",{"type":64,"tag":339,"props":4955,"children":4956},{"style":362},[4957],{"type":69,"value":734},{"type":64,"tag":339,"props":4959,"children":4960},{"style":362},[4961],{"type":69,"value":4962}," `",{"type":64,"tag":339,"props":4964,"children":4965},{"style":389},[4966],{"type":69,"value":4967},"Bearer ",{"type":64,"tag":339,"props":4969,"children":4970},{"style":362},[4971],{"type":69,"value":4972},"${",{"type":64,"tag":339,"props":4974,"children":4975},{"style":430},[4976],{"type":69,"value":4977},"getToken",{"type":64,"tag":339,"props":4979,"children":4980},{"style":368},[4981],{"type":69,"value":437},{"type":64,"tag":339,"props":4983,"children":4984},{"style":362},[4985],{"type":69,"value":2992},{"type":64,"tag":339,"props":4987,"children":4988},{"style":362},[4989],{"type":69,"value":1431},{"type":64,"tag":339,"props":4991,"children":4992},{"class":341,"line":455},[4993,4997],{"type":64,"tag":339,"props":4994,"children":4995},{"style":362},[4996],{"type":69,"value":1834},{"type":64,"tag":339,"props":4998,"children":4999},{"style":527},[5000],{"type":69,"value":565},{"type":64,"tag":339,"props":5002,"children":5003},{"class":341,"line":509},[5004],{"type":64,"tag":339,"props":5005,"children":5006},{"style":362},[5007],{"type":69,"value":621},{"type":64,"tag":339,"props":5009,"children":5010},{"class":341,"line":568},[5011],{"type":64,"tag":339,"props":5012,"children":5013},{"style":368},[5014],{"type":69,"value":565},{"type":64,"tag":71,"props":5016,"children":5017},{},[5018],{"type":69,"value":5019},"Headers merge across middleware. Later middleware overrides earlier. Call-site headers override all middleware headers.",{"type":64,"tag":1638,"props":5021,"children":5023},{"id":5022},"custom-fetch",[5024],{"type":69,"value":5025},"Custom fetch",{"type":64,"tag":328,"props":5027,"children":5029},{"className":330,"code":5028,"language":332,"meta":333,"style":333},"\u002F\u002F Use @tanstack\u002F\u003Cframework>-start for your framework (react, solid, vue)\nimport type { CustomFetch } from '@tanstack\u002Freact-start'\n\nconst loggingMiddleware = createMiddleware({ type: 'function' }).client(\n  async ({ next }) => {\n    const customFetch: CustomFetch = async (url, init) => {\n      console.log('Request:', url)\n      return fetch(url, init)\n    }\n    return next({ fetch: customFetch })\n  },\n)\n",[5030],{"type":64,"tag":92,"props":5031,"children":5032},{"__ignoreMap":333},[5033,5040,5080,5087,5154,5181,5238,5283,5315,5323,5362,5369],{"type":64,"tag":339,"props":5034,"children":5035},{"class":341,"line":342},[5036],{"type":64,"tag":339,"props":5037,"children":5038},{"style":346},[5039],{"type":69,"value":349},{"type":64,"tag":339,"props":5041,"children":5042},{"class":341,"line":352},[5043,5047,5051,5055,5060,5064,5068,5072,5076],{"type":64,"tag":339,"props":5044,"children":5045},{"style":356},[5046],{"type":69,"value":359},{"type":64,"tag":339,"props":5048,"children":5049},{"style":356},[5050],{"type":69,"value":729},{"type":64,"tag":339,"props":5052,"children":5053},{"style":362},[5054],{"type":69,"value":365},{"type":64,"tag":339,"props":5056,"children":5057},{"style":368},[5058],{"type":69,"value":5059}," CustomFetch",{"type":64,"tag":339,"props":5061,"children":5062},{"style":362},[5063],{"type":69,"value":376},{"type":64,"tag":339,"props":5065,"children":5066},{"style":356},[5067],{"type":69,"value":381},{"type":64,"tag":339,"props":5069,"children":5070},{"style":362},[5071],{"type":69,"value":386},{"type":64,"tag":339,"props":5073,"children":5074},{"style":389},[5075],{"type":69,"value":392},{"type":64,"tag":339,"props":5077,"children":5078},{"style":362},[5079],{"type":69,"value":397},{"type":64,"tag":339,"props":5081,"children":5082},{"class":341,"line":400},[5083],{"type":64,"tag":339,"props":5084,"children":5085},{"emptyLinePlaceholder":404},[5086],{"type":69,"value":407},{"type":64,"tag":339,"props":5088,"children":5089},{"class":341,"line":410},[5090,5094,5098,5102,5106,5110,5114,5118,5122,5126,5130,5134,5138,5142,5146,5150],{"type":64,"tag":339,"props":5091,"children":5092},{"style":414},[5093],{"type":69,"value":417},{"type":64,"tag":339,"props":5095,"children":5096},{"style":368},[5097],{"type":69,"value":422},{"type":64,"tag":339,"props":5099,"children":5100},{"style":362},[5101],{"type":69,"value":427},{"type":64,"tag":339,"props":5103,"children":5104},{"style":430},[5105],{"type":69,"value":371},{"type":64,"tag":339,"props":5107,"children":5108},{"style":368},[5109],{"type":69,"value":530},{"type":64,"tag":339,"props":5111,"children":5112},{"style":362},[5113],{"type":69,"value":724},{"type":64,"tag":339,"props":5115,"children":5116},{"style":527},[5117],{"type":69,"value":729},{"type":64,"tag":339,"props":5119,"children":5120},{"style":362},[5121],{"type":69,"value":734},{"type":64,"tag":339,"props":5123,"children":5124},{"style":362},[5125],{"type":69,"value":386},{"type":64,"tag":339,"props":5127,"children":5128},{"style":389},[5129],{"type":69,"value":743},{"type":64,"tag":339,"props":5131,"children":5132},{"style":362},[5133],{"type":69,"value":535},{"type":64,"tag":339,"props":5135,"children":5136},{"style":362},[5137],{"type":69,"value":376},{"type":64,"tag":339,"props":5139,"children":5140},{"style":368},[5141],{"type":69,"value":268},{"type":64,"tag":339,"props":5143,"children":5144},{"style":362},[5145],{"type":69,"value":442},{"type":64,"tag":339,"props":5147,"children":5148},{"style":430},[5149],{"type":69,"value":768},{"type":64,"tag":339,"props":5151,"children":5152},{"style":368},[5153],{"type":69,"value":452},{"type":64,"tag":339,"props":5155,"children":5156},{"class":341,"line":455},[5157,5161,5165,5169,5173,5177],{"type":64,"tag":339,"props":5158,"children":5159},{"style":414},[5160],{"type":69,"value":461},{"type":64,"tag":339,"props":5162,"children":5163},{"style":362},[5164],{"type":69,"value":466},{"type":64,"tag":339,"props":5166,"children":5167},{"style":469},[5168],{"type":69,"value":472},{"type":64,"tag":339,"props":5170,"children":5171},{"style":362},[5172],{"type":69,"value":496},{"type":64,"tag":339,"props":5174,"children":5175},{"style":414},[5176],{"type":69,"value":501},{"type":64,"tag":339,"props":5178,"children":5179},{"style":362},[5180],{"type":69,"value":506},{"type":64,"tag":339,"props":5182,"children":5183},{"class":341,"line":509},[5184,5188,5193,5197,5201,5205,5209,5213,5217,5221,5226,5230,5234],{"type":64,"tag":339,"props":5185,"children":5186},{"style":414},[5187],{"type":69,"value":574},{"type":64,"tag":339,"props":5189,"children":5190},{"style":368},[5191],{"type":69,"value":5192}," customFetch",{"type":64,"tag":339,"props":5194,"children":5195},{"style":362},[5196],{"type":69,"value":734},{"type":64,"tag":339,"props":5198,"children":5199},{"style":4253},[5200],{"type":69,"value":5059},{"type":64,"tag":339,"props":5202,"children":5203},{"style":362},[5204],{"type":69,"value":584},{"type":64,"tag":339,"props":5206,"children":5207},{"style":414},[5208],{"type":69,"value":3411},{"type":64,"tag":339,"props":5210,"children":5211},{"style":362},[5212],{"type":69,"value":1327},{"type":64,"tag":339,"props":5214,"children":5215},{"style":469},[5216],{"type":69,"value":43},{"type":64,"tag":339,"props":5218,"children":5219},{"style":362},[5220],{"type":69,"value":477},{"type":64,"tag":339,"props":5222,"children":5223},{"style":469},[5224],{"type":69,"value":5225}," init",{"type":64,"tag":339,"props":5227,"children":5228},{"style":362},[5229],{"type":69,"value":268},{"type":64,"tag":339,"props":5231,"children":5232},{"style":414},[5233],{"type":69,"value":501},{"type":64,"tag":339,"props":5235,"children":5236},{"style":362},[5237],{"type":69,"value":506},{"type":64,"tag":339,"props":5239,"children":5240},{"class":341,"line":568},[5241,5246,5250,5254,5258,5262,5266,5270,5274,5279],{"type":64,"tag":339,"props":5242,"children":5243},{"style":368},[5244],{"type":69,"value":5245},"      console",{"type":64,"tag":339,"props":5247,"children":5248},{"style":362},[5249],{"type":69,"value":442},{"type":64,"tag":339,"props":5251,"children":5252},{"style":430},[5253],{"type":69,"value":524},{"type":64,"tag":339,"props":5255,"children":5256},{"style":527},[5257],{"type":69,"value":530},{"type":64,"tag":339,"props":5259,"children":5260},{"style":362},[5261],{"type":69,"value":535},{"type":64,"tag":339,"props":5263,"children":5264},{"style":389},[5265],{"type":69,"value":540},{"type":64,"tag":339,"props":5267,"children":5268},{"style":362},[5269],{"type":69,"value":535},{"type":64,"tag":339,"props":5271,"children":5272},{"style":362},[5273],{"type":69,"value":477},{"type":64,"tag":339,"props":5275,"children":5276},{"style":368},[5277],{"type":69,"value":5278}," url",{"type":64,"tag":339,"props":5280,"children":5281},{"style":527},[5282],{"type":69,"value":565},{"type":64,"tag":339,"props":5284,"children":5285},{"class":341,"line":601},[5286,5290,5295,5299,5303,5307,5311],{"type":64,"tag":339,"props":5287,"children":5288},{"style":356},[5289],{"type":69,"value":4586},{"type":64,"tag":339,"props":5291,"children":5292},{"style":430},[5293],{"type":69,"value":5294}," fetch",{"type":64,"tag":339,"props":5296,"children":5297},{"style":527},[5298],{"type":69,"value":530},{"type":64,"tag":339,"props":5300,"children":5301},{"style":368},[5302],{"type":69,"value":43},{"type":64,"tag":339,"props":5304,"children":5305},{"style":362},[5306],{"type":69,"value":477},{"type":64,"tag":339,"props":5308,"children":5309},{"style":368},[5310],{"type":69,"value":5225},{"type":64,"tag":339,"props":5312,"children":5313},{"style":527},[5314],{"type":69,"value":565},{"type":64,"tag":339,"props":5316,"children":5317},{"class":341,"line":615},[5318],{"type":64,"tag":339,"props":5319,"children":5320},{"style":362},[5321],{"type":69,"value":5322},"    }\n",{"type":64,"tag":339,"props":5324,"children":5325},{"class":341,"line":624},[5326,5330,5334,5338,5342,5346,5350,5354,5358],{"type":64,"tag":339,"props":5327,"children":5328},{"style":356},[5329],{"type":69,"value":607},{"type":64,"tag":339,"props":5331,"children":5332},{"style":430},[5333],{"type":69,"value":472},{"type":64,"tag":339,"props":5335,"children":5336},{"style":527},[5337],{"type":69,"value":530},{"type":64,"tag":339,"props":5339,"children":5340},{"style":362},[5341],{"type":69,"value":724},{"type":64,"tag":339,"props":5343,"children":5344},{"style":527},[5345],{"type":69,"value":5294},{"type":64,"tag":339,"props":5347,"children":5348},{"style":362},[5349],{"type":69,"value":734},{"type":64,"tag":339,"props":5351,"children":5352},{"style":368},[5353],{"type":69,"value":5192},{"type":64,"tag":339,"props":5355,"children":5356},{"style":362},[5357],{"type":69,"value":376},{"type":64,"tag":339,"props":5359,"children":5360},{"style":527},[5361],{"type":69,"value":565},{"type":64,"tag":339,"props":5363,"children":5364},{"class":341,"line":866},[5365],{"type":64,"tag":339,"props":5366,"children":5367},{"style":362},[5368],{"type":69,"value":621},{"type":64,"tag":339,"props":5370,"children":5371},{"class":341,"line":914},[5372],{"type":64,"tag":339,"props":5373,"children":5374},{"style":368},[5375],{"type":69,"value":565},{"type":64,"tag":71,"props":5377,"children":5378},{},[5379],{"type":69,"value":5380},"Fetch precedence (highest to lowest): call site → later middleware → earlier middleware → createStart global → default fetch.",{"type":64,"tag":153,"props":5382,"children":5384},{"id":5383},"common-mistakes",[5385],{"type":69,"value":5386},"Common Mistakes",{"type":64,"tag":1638,"props":5388,"children":5390},{"id":5389},"_1-critical-trusting-client-sendcontext-shape-check-is-not-access-check",[5391],{"type":69,"value":5392},"1. CRITICAL: Trusting client sendContext — shape check is not access check",{"type":64,"tag":71,"props":5394,"children":5395},{},[5396,5401,5403,5408],{"type":64,"tag":92,"props":5397,"children":5399},{"className":5398},[],[5400],{"type":69,"value":141},{"type":69,"value":5402}," from a client middleware arrives on the server as untrusted client input. Most agents stop after parsing the shape with Zod and assume the value is safe. It isn't: a parsed UUID is ",{"type":64,"tag":129,"props":5404,"children":5405},{},[5406],{"type":69,"value":5407},"some",{"type":69,"value":5409}," workspace, not the requesting user's workspace. Without a membership check against the session principal, you've built a tenant-walking endpoint.",{"type":64,"tag":71,"props":5411,"children":5412},{},[5413],{"type":64,"tag":84,"props":5414,"children":5415},{},[5416],{"type":69,"value":5417},"Layer 1 — WRONG (no validation):",{"type":64,"tag":328,"props":5419,"children":5421},{"className":330,"code":5420,"language":332,"meta":333,"style":333},".server(async ({ next, context }) => {\n  \u002F\u002F SQL-injectable AND tenant-walkable\n  await db.query(`SELECT * FROM workspace_${context.workspaceId}`)\n  return next()\n})\n",[5422],{"type":64,"tag":92,"props":5423,"children":5424},{"__ignoreMap":333},[5425,5472,5480,5540,5555],{"type":64,"tag":339,"props":5426,"children":5427},{"class":341,"line":342},[5428,5432,5436,5440,5444,5448,5452,5456,5460,5464,5468],{"type":64,"tag":339,"props":5429,"children":5430},{"style":362},[5431],{"type":69,"value":442},{"type":64,"tag":339,"props":5433,"children":5434},{"style":430},[5435],{"type":69,"value":447},{"type":64,"tag":339,"props":5437,"children":5438},{"style":368},[5439],{"type":69,"value":530},{"type":64,"tag":339,"props":5441,"children":5442},{"style":414},[5443],{"type":69,"value":777},{"type":64,"tag":339,"props":5445,"children":5446},{"style":362},[5447],{"type":69,"value":466},{"type":64,"tag":339,"props":5449,"children":5450},{"style":469},[5451],{"type":69,"value":472},{"type":64,"tag":339,"props":5453,"children":5454},{"style":362},[5455],{"type":69,"value":477},{"type":64,"tag":339,"props":5457,"children":5458},{"style":469},[5459],{"type":69,"value":482},{"type":64,"tag":339,"props":5461,"children":5462},{"style":362},[5463],{"type":69,"value":496},{"type":64,"tag":339,"props":5465,"children":5466},{"style":414},[5467],{"type":69,"value":501},{"type":64,"tag":339,"props":5469,"children":5470},{"style":362},[5471],{"type":69,"value":506},{"type":64,"tag":339,"props":5473,"children":5474},{"class":341,"line":352},[5475],{"type":64,"tag":339,"props":5476,"children":5477},{"style":346},[5478],{"type":69,"value":5479},"  \u002F\u002F SQL-injectable AND tenant-walkable\n",{"type":64,"tag":339,"props":5481,"children":5482},{"class":341,"line":400},[5483,5488,5493,5497,5502,5506,5511,5516,5520,5524,5528,5532,5536],{"type":64,"tag":339,"props":5484,"children":5485},{"style":356},[5486],{"type":69,"value":5487},"  await",{"type":64,"tag":339,"props":5489,"children":5490},{"style":368},[5491],{"type":69,"value":5492}," db",{"type":64,"tag":339,"props":5494,"children":5495},{"style":362},[5496],{"type":69,"value":442},{"type":64,"tag":339,"props":5498,"children":5499},{"style":430},[5500],{"type":69,"value":5501},"query",{"type":64,"tag":339,"props":5503,"children":5504},{"style":527},[5505],{"type":69,"value":530},{"type":64,"tag":339,"props":5507,"children":5508},{"style":362},[5509],{"type":69,"value":5510},"`",{"type":64,"tag":339,"props":5512,"children":5513},{"style":389},[5514],{"type":69,"value":5515},"SELECT * FROM workspace_",{"type":64,"tag":339,"props":5517,"children":5518},{"style":362},[5519],{"type":69,"value":4972},{"type":64,"tag":339,"props":5521,"children":5522},{"style":368},[5523],{"type":69,"value":2379},{"type":64,"tag":339,"props":5525,"children":5526},{"style":362},[5527],{"type":69,"value":442},{"type":64,"tag":339,"props":5529,"children":5530},{"style":368},[5531],{"type":69,"value":1813},{"type":64,"tag":339,"props":5533,"children":5534},{"style":362},[5535],{"type":69,"value":2992},{"type":64,"tag":339,"props":5537,"children":5538},{"style":527},[5539],{"type":69,"value":565},{"type":64,"tag":339,"props":5541,"children":5542},{"class":341,"line":410},[5543,5547,5551],{"type":64,"tag":339,"props":5544,"children":5545},{"style":356},[5546],{"type":69,"value":1393},{"type":64,"tag":339,"props":5548,"children":5549},{"style":430},[5550],{"type":69,"value":472},{"type":64,"tag":339,"props":5552,"children":5553},{"style":527},[5554],{"type":69,"value":598},{"type":64,"tag":339,"props":5556,"children":5557},{"class":341,"line":455},[5558,5562],{"type":64,"tag":339,"props":5559,"children":5560},{"style":362},[5561],{"type":69,"value":1450},{"type":64,"tag":339,"props":5563,"children":5564},{"style":368},[5565],{"type":69,"value":565},{"type":64,"tag":71,"props":5567,"children":5568},{},[5569],{"type":64,"tag":84,"props":5570,"children":5571},{},[5572],{"type":69,"value":5573},"Layer 2 — STILL WRONG (shape only):",{"type":64,"tag":328,"props":5575,"children":5577},{"className":330,"code":5576,"language":332,"meta":333,"style":333},".server(async ({ next, context }) => {\n  \u002F\u002F Looks safe, isn't. UUID is well-formed but the user may not be a member.\n  const workspaceId = z.string().uuid().parse(context.workspaceId)\n  await db.query('SELECT * FROM workspaces WHERE id = $1', [workspaceId])\n  return next()\n})\n",[5578],{"type":64,"tag":92,"props":5579,"children":5580},{"__ignoreMap":333},[5581,5628,5636,5709,5761,5776],{"type":64,"tag":339,"props":5582,"children":5583},{"class":341,"line":342},[5584,5588,5592,5596,5600,5604,5608,5612,5616,5620,5624],{"type":64,"tag":339,"props":5585,"children":5586},{"style":362},[5587],{"type":69,"value":442},{"type":64,"tag":339,"props":5589,"children":5590},{"style":430},[5591],{"type":69,"value":447},{"type":64,"tag":339,"props":5593,"children":5594},{"style":368},[5595],{"type":69,"value":530},{"type":64,"tag":339,"props":5597,"children":5598},{"style":414},[5599],{"type":69,"value":777},{"type":64,"tag":339,"props":5601,"children":5602},{"style":362},[5603],{"type":69,"value":466},{"type":64,"tag":339,"props":5605,"children":5606},{"style":469},[5607],{"type":69,"value":472},{"type":64,"tag":339,"props":5609,"children":5610},{"style":362},[5611],{"type":69,"value":477},{"type":64,"tag":339,"props":5613,"children":5614},{"style":469},[5615],{"type":69,"value":482},{"type":64,"tag":339,"props":5617,"children":5618},{"style":362},[5619],{"type":69,"value":496},{"type":64,"tag":339,"props":5621,"children":5622},{"style":414},[5623],{"type":69,"value":501},{"type":64,"tag":339,"props":5625,"children":5626},{"style":362},[5627],{"type":69,"value":506},{"type":64,"tag":339,"props":5629,"children":5630},{"class":341,"line":352},[5631],{"type":64,"tag":339,"props":5632,"children":5633},{"style":346},[5634],{"type":69,"value":5635},"  \u002F\u002F Looks safe, isn't. UUID is well-formed but the user may not be a member.\n",{"type":64,"tag":339,"props":5637,"children":5638},{"class":341,"line":400},[5639,5643,5647,5651,5655,5659,5663,5667,5671,5676,5680,5684,5689,5693,5697,5701,5705],{"type":64,"tag":339,"props":5640,"children":5641},{"style":414},[5642],{"type":69,"value":1274},{"type":64,"tag":339,"props":5644,"children":5645},{"style":368},[5646],{"type":69,"value":2612},{"type":64,"tag":339,"props":5648,"children":5649},{"style":362},[5650],{"type":69,"value":584},{"type":64,"tag":339,"props":5652,"children":5653},{"style":368},[5654],{"type":69,"value":2444},{"type":64,"tag":339,"props":5656,"children":5657},{"style":362},[5658],{"type":69,"value":442},{"type":64,"tag":339,"props":5660,"children":5661},{"style":430},[5662],{"type":69,"value":2629},{"type":64,"tag":339,"props":5664,"children":5665},{"style":527},[5666],{"type":69,"value":437},{"type":64,"tag":339,"props":5668,"children":5669},{"style":362},[5670],{"type":69,"value":442},{"type":64,"tag":339,"props":5672,"children":5673},{"style":430},[5674],{"type":69,"value":5675},"uuid",{"type":64,"tag":339,"props":5677,"children":5678},{"style":527},[5679],{"type":69,"value":437},{"type":64,"tag":339,"props":5681,"children":5682},{"style":362},[5683],{"type":69,"value":442},{"type":64,"tag":339,"props":5685,"children":5686},{"style":430},[5687],{"type":69,"value":5688},"parse",{"type":64,"tag":339,"props":5690,"children":5691},{"style":527},[5692],{"type":69,"value":530},{"type":64,"tag":339,"props":5694,"children":5695},{"style":368},[5696],{"type":69,"value":2379},{"type":64,"tag":339,"props":5698,"children":5699},{"style":362},[5700],{"type":69,"value":442},{"type":64,"tag":339,"props":5702,"children":5703},{"style":368},[5704],{"type":69,"value":1813},{"type":64,"tag":339,"props":5706,"children":5707},{"style":527},[5708],{"type":69,"value":565},{"type":64,"tag":339,"props":5710,"children":5711},{"class":341,"line":410},[5712,5716,5720,5724,5728,5732,5736,5741,5745,5749,5753,5757],{"type":64,"tag":339,"props":5713,"children":5714},{"style":356},[5715],{"type":69,"value":5487},{"type":64,"tag":339,"props":5717,"children":5718},{"style":368},[5719],{"type":69,"value":5492},{"type":64,"tag":339,"props":5721,"children":5722},{"style":362},[5723],{"type":69,"value":442},{"type":64,"tag":339,"props":5725,"children":5726},{"style":430},[5727],{"type":69,"value":5501},{"type":64,"tag":339,"props":5729,"children":5730},{"style":527},[5731],{"type":69,"value":530},{"type":64,"tag":339,"props":5733,"children":5734},{"style":362},[5735],{"type":69,"value":535},{"type":64,"tag":339,"props":5737,"children":5738},{"style":389},[5739],{"type":69,"value":5740},"SELECT * FROM workspaces WHERE id = $1",{"type":64,"tag":339,"props":5742,"children":5743},{"style":362},[5744],{"type":69,"value":535},{"type":64,"tag":339,"props":5746,"children":5747},{"style":362},[5748],{"type":69,"value":477},{"type":64,"tag":339,"props":5750,"children":5751},{"style":527},[5752],{"type":69,"value":4694},{"type":64,"tag":339,"props":5754,"children":5755},{"style":368},[5756],{"type":69,"value":1813},{"type":64,"tag":339,"props":5758,"children":5759},{"style":527},[5760],{"type":69,"value":4410},{"type":64,"tag":339,"props":5762,"children":5763},{"class":341,"line":455},[5764,5768,5772],{"type":64,"tag":339,"props":5765,"children":5766},{"style":356},[5767],{"type":69,"value":1393},{"type":64,"tag":339,"props":5769,"children":5770},{"style":430},[5771],{"type":69,"value":472},{"type":64,"tag":339,"props":5773,"children":5774},{"style":527},[5775],{"type":69,"value":598},{"type":64,"tag":339,"props":5777,"children":5778},{"class":341,"line":509},[5779,5783],{"type":64,"tag":339,"props":5780,"children":5781},{"style":362},[5782],{"type":69,"value":1450},{"type":64,"tag":339,"props":5784,"children":5785},{"style":368},[5786],{"type":69,"value":565},{"type":64,"tag":71,"props":5788,"children":5789},{},[5790],{"type":64,"tag":84,"props":5791,"children":5792},{},[5793],{"type":69,"value":5794},"Layer 3 — CORRECT (shape AND access):",{"type":64,"tag":328,"props":5796,"children":5798},{"className":330,"code":5797,"language":332,"meta":333,"style":333},".middleware([authMiddleware]) \u002F\u002F session loaded from cookie, NOT from sendContext\n.server(async ({ next, context }) => {\n  const workspaceId = z.string().uuid().parse(context.workspaceId)\n  \u002F\u002F Verify the session principal can access this workspace.\n  const member = await db.memberships.find({\n    userId: context.session.userId,\n    workspaceId,\n  })\n  if (!member) throw new Error('Not a member of this workspace')\n  await db.query('SELECT * FROM workspaces WHERE id = $1', [workspaceId])\n  return next({ context: { workspaceId } })\n})\n",[5799],{"type":64,"tag":92,"props":5800,"children":5801},{"__ignoreMap":333},[5802,5823,5870,5941,5949,5999,6036,6048,6059,6116,6167,6214],{"type":64,"tag":339,"props":5803,"children":5804},{"class":341,"line":342},[5805,5809,5813,5818],{"type":64,"tag":339,"props":5806,"children":5807},{"style":362},[5808],{"type":69,"value":442},{"type":64,"tag":339,"props":5810,"children":5811},{"style":430},[5812],{"type":69,"value":4},{"type":64,"tag":339,"props":5814,"children":5815},{"style":368},[5816],{"type":69,"value":5817},"([authMiddleware]) ",{"type":64,"tag":339,"props":5819,"children":5820},{"style":346},[5821],{"type":69,"value":5822},"\u002F\u002F session loaded from cookie, NOT from sendContext\n",{"type":64,"tag":339,"props":5824,"children":5825},{"class":341,"line":352},[5826,5830,5834,5838,5842,5846,5850,5854,5858,5862,5866],{"type":64,"tag":339,"props":5827,"children":5828},{"style":362},[5829],{"type":69,"value":442},{"type":64,"tag":339,"props":5831,"children":5832},{"style":430},[5833],{"type":69,"value":447},{"type":64,"tag":339,"props":5835,"children":5836},{"style":368},[5837],{"type":69,"value":530},{"type":64,"tag":339,"props":5839,"children":5840},{"style":414},[5841],{"type":69,"value":777},{"type":64,"tag":339,"props":5843,"children":5844},{"style":362},[5845],{"type":69,"value":466},{"type":64,"tag":339,"props":5847,"children":5848},{"style":469},[5849],{"type":69,"value":472},{"type":64,"tag":339,"props":5851,"children":5852},{"style":362},[5853],{"type":69,"value":477},{"type":64,"tag":339,"props":5855,"children":5856},{"style":469},[5857],{"type":69,"value":482},{"type":64,"tag":339,"props":5859,"children":5860},{"style":362},[5861],{"type":69,"value":496},{"type":64,"tag":339,"props":5863,"children":5864},{"style":414},[5865],{"type":69,"value":501},{"type":64,"tag":339,"props":5867,"children":5868},{"style":362},[5869],{"type":69,"value":506},{"type":64,"tag":339,"props":5871,"children":5872},{"class":341,"line":400},[5873,5877,5881,5885,5889,5893,5897,5901,5905,5909,5913,5917,5921,5925,5929,5933,5937],{"type":64,"tag":339,"props":5874,"children":5875},{"style":414},[5876],{"type":69,"value":1274},{"type":64,"tag":339,"props":5878,"children":5879},{"style":368},[5880],{"type":69,"value":2612},{"type":64,"tag":339,"props":5882,"children":5883},{"style":362},[5884],{"type":69,"value":584},{"type":64,"tag":339,"props":5886,"children":5887},{"style":368},[5888],{"type":69,"value":2444},{"type":64,"tag":339,"props":5890,"children":5891},{"style":362},[5892],{"type":69,"value":442},{"type":64,"tag":339,"props":5894,"children":5895},{"style":430},[5896],{"type":69,"value":2629},{"type":64,"tag":339,"props":5898,"children":5899},{"style":527},[5900],{"type":69,"value":437},{"type":64,"tag":339,"props":5902,"children":5903},{"style":362},[5904],{"type":69,"value":442},{"type":64,"tag":339,"props":5906,"children":5907},{"style":430},[5908],{"type":69,"value":5675},{"type":64,"tag":339,"props":5910,"children":5911},{"style":527},[5912],{"type":69,"value":437},{"type":64,"tag":339,"props":5914,"children":5915},{"style":362},[5916],{"type":69,"value":442},{"type":64,"tag":339,"props":5918,"children":5919},{"style":430},[5920],{"type":69,"value":5688},{"type":64,"tag":339,"props":5922,"children":5923},{"style":527},[5924],{"type":69,"value":530},{"type":64,"tag":339,"props":5926,"children":5927},{"style":368},[5928],{"type":69,"value":2379},{"type":64,"tag":339,"props":5930,"children":5931},{"style":362},[5932],{"type":69,"value":442},{"type":64,"tag":339,"props":5934,"children":5935},{"style":368},[5936],{"type":69,"value":1813},{"type":64,"tag":339,"props":5938,"children":5939},{"style":527},[5940],{"type":69,"value":565},{"type":64,"tag":339,"props":5942,"children":5943},{"class":341,"line":410},[5944],{"type":64,"tag":339,"props":5945,"children":5946},{"style":346},[5947],{"type":69,"value":5948},"  \u002F\u002F Verify the session principal can access this workspace.\n",{"type":64,"tag":339,"props":5950,"children":5951},{"class":341,"line":455},[5952,5956,5961,5965,5969,5973,5977,5982,5986,5991,5995],{"type":64,"tag":339,"props":5953,"children":5954},{"style":414},[5955],{"type":69,"value":1274},{"type":64,"tag":339,"props":5957,"children":5958},{"style":368},[5959],{"type":69,"value":5960}," member",{"type":64,"tag":339,"props":5962,"children":5963},{"style":362},[5964],{"type":69,"value":584},{"type":64,"tag":339,"props":5966,"children":5967},{"style":356},[5968],{"type":69,"value":589},{"type":64,"tag":339,"props":5970,"children":5971},{"style":368},[5972],{"type":69,"value":5492},{"type":64,"tag":339,"props":5974,"children":5975},{"style":362},[5976],{"type":69,"value":442},{"type":64,"tag":339,"props":5978,"children":5979},{"style":368},[5980],{"type":69,"value":5981},"memberships",{"type":64,"tag":339,"props":5983,"children":5984},{"style":362},[5985],{"type":69,"value":442},{"type":64,"tag":339,"props":5987,"children":5988},{"style":430},[5989],{"type":69,"value":5990},"find",{"type":64,"tag":339,"props":5992,"children":5993},{"style":527},[5994],{"type":69,"value":530},{"type":64,"tag":339,"props":5996,"children":5997},{"style":362},[5998],{"type":69,"value":1406},{"type":64,"tag":339,"props":6000,"children":6001},{"class":341,"line":509},[6002,6007,6011,6015,6019,6023,6027,6032],{"type":64,"tag":339,"props":6003,"children":6004},{"style":527},[6005],{"type":69,"value":6006},"    userId",{"type":64,"tag":339,"props":6008,"children":6009},{"style":362},[6010],{"type":69,"value":734},{"type":64,"tag":339,"props":6012,"children":6013},{"style":368},[6014],{"type":69,"value":482},{"type":64,"tag":339,"props":6016,"children":6017},{"style":362},[6018],{"type":69,"value":442},{"type":64,"tag":339,"props":6020,"children":6021},{"style":368},[6022],{"type":69,"value":1337},{"type":64,"tag":339,"props":6024,"children":6025},{"style":362},[6026],{"type":69,"value":442},{"type":64,"tag":339,"props":6028,"children":6029},{"style":368},[6030],{"type":69,"value":6031},"userId",{"type":64,"tag":339,"props":6033,"children":6034},{"style":362},[6035],{"type":69,"value":1818},{"type":64,"tag":339,"props":6037,"children":6038},{"class":341,"line":568},[6039,6044],{"type":64,"tag":339,"props":6040,"children":6041},{"style":368},[6042],{"type":69,"value":6043},"    workspaceId",{"type":64,"tag":339,"props":6045,"children":6046},{"style":362},[6047],{"type":69,"value":1818},{"type":64,"tag":339,"props":6049,"children":6050},{"class":341,"line":601},[6051,6055],{"type":64,"tag":339,"props":6052,"children":6053},{"style":362},[6054],{"type":69,"value":859},{"type":64,"tag":339,"props":6056,"children":6057},{"style":527},[6058],{"type":69,"value":565},{"type":64,"tag":339,"props":6060,"children":6061},{"class":341,"line":615},[6062,6066,6070,6074,6079,6083,6087,6091,6095,6099,6103,6108,6112],{"type":64,"tag":339,"props":6063,"children":6064},{"style":356},[6065],{"type":69,"value":1322},{"type":64,"tag":339,"props":6067,"children":6068},{"style":527},[6069],{"type":69,"value":1327},{"type":64,"tag":339,"props":6071,"children":6072},{"style":362},[6073],{"type":69,"value":1332},{"type":64,"tag":339,"props":6075,"children":6076},{"style":368},[6077],{"type":69,"value":6078},"member",{"type":64,"tag":339,"props":6080,"children":6081},{"style":527},[6082],{"type":69,"value":1342},{"type":64,"tag":339,"props":6084,"children":6085},{"style":356},[6086],{"type":69,"value":1347},{"type":64,"tag":339,"props":6088,"children":6089},{"style":362},[6090],{"type":69,"value":1352},{"type":64,"tag":339,"props":6092,"children":6093},{"style":430},[6094],{"type":69,"value":1357},{"type":64,"tag":339,"props":6096,"children":6097},{"style":527},[6098],{"type":69,"value":530},{"type":64,"tag":339,"props":6100,"children":6101},{"style":362},[6102],{"type":69,"value":535},{"type":64,"tag":339,"props":6104,"children":6105},{"style":389},[6106],{"type":69,"value":6107},"Not a member of this workspace",{"type":64,"tag":339,"props":6109,"children":6110},{"style":362},[6111],{"type":69,"value":535},{"type":64,"tag":339,"props":6113,"children":6114},{"style":527},[6115],{"type":69,"value":565},{"type":64,"tag":339,"props":6117,"children":6118},{"class":341,"line":624},[6119,6123,6127,6131,6135,6139,6143,6147,6151,6155,6159,6163],{"type":64,"tag":339,"props":6120,"children":6121},{"style":356},[6122],{"type":69,"value":5487},{"type":64,"tag":339,"props":6124,"children":6125},{"style":368},[6126],{"type":69,"value":5492},{"type":64,"tag":339,"props":6128,"children":6129},{"style":362},[6130],{"type":69,"value":442},{"type":64,"tag":339,"props":6132,"children":6133},{"style":430},[6134],{"type":69,"value":5501},{"type":64,"tag":339,"props":6136,"children":6137},{"style":527},[6138],{"type":69,"value":530},{"type":64,"tag":339,"props":6140,"children":6141},{"style":362},[6142],{"type":69,"value":535},{"type":64,"tag":339,"props":6144,"children":6145},{"style":389},[6146],{"type":69,"value":5740},{"type":64,"tag":339,"props":6148,"children":6149},{"style":362},[6150],{"type":69,"value":535},{"type":64,"tag":339,"props":6152,"children":6153},{"style":362},[6154],{"type":69,"value":477},{"type":64,"tag":339,"props":6156,"children":6157},{"style":527},[6158],{"type":69,"value":4694},{"type":64,"tag":339,"props":6160,"children":6161},{"style":368},[6162],{"type":69,"value":1813},{"type":64,"tag":339,"props":6164,"children":6165},{"style":527},[6166],{"type":69,"value":4410},{"type":64,"tag":339,"props":6168,"children":6169},{"class":341,"line":866},[6170,6174,6178,6182,6186,6190,6194,6198,6202,6206,6210],{"type":64,"tag":339,"props":6171,"children":6172},{"style":356},[6173],{"type":69,"value":1393},{"type":64,"tag":339,"props":6175,"children":6176},{"style":430},[6177],{"type":69,"value":472},{"type":64,"tag":339,"props":6179,"children":6180},{"style":527},[6181],{"type":69,"value":530},{"type":64,"tag":339,"props":6183,"children":6184},{"style":362},[6185],{"type":69,"value":724},{"type":64,"tag":339,"props":6187,"children":6188},{"style":527},[6189],{"type":69,"value":482},{"type":64,"tag":339,"props":6191,"children":6192},{"style":362},[6193],{"type":69,"value":734},{"type":64,"tag":339,"props":6195,"children":6196},{"style":362},[6197],{"type":69,"value":365},{"type":64,"tag":339,"props":6199,"children":6200},{"style":368},[6201],{"type":69,"value":2612},{"type":64,"tag":339,"props":6203,"children":6204},{"style":362},[6205],{"type":69,"value":376},{"type":64,"tag":339,"props":6207,"children":6208},{"style":362},[6209],{"type":69,"value":376},{"type":64,"tag":339,"props":6211,"children":6212},{"style":527},[6213],{"type":69,"value":565},{"type":64,"tag":339,"props":6215,"children":6216},{"class":341,"line":914},[6217,6221],{"type":64,"tag":339,"props":6218,"children":6219},{"style":362},[6220],{"type":69,"value":1450},{"type":64,"tag":339,"props":6222,"children":6223},{"style":368},[6224],{"type":69,"value":565},{"type":64,"tag":71,"props":6226,"children":6227},{},[6228,6230,6235,6237,6242,6244,6248],{"type":69,"value":6229},"The session itself must come from a server-trusted source (the cookie + DB lookup in ",{"type":64,"tag":92,"props":6231,"children":6233},{"className":6232},[],[6234],{"type":69,"value":4199},{"type":69,"value":6236},"), never from ",{"type":64,"tag":92,"props":6238,"children":6240},{"className":6239},[],[6241],{"type":69,"value":141},{"type":69,"value":6243}," — anything the client can send, the client can lie about. See ",{"type":64,"tag":4221,"props":6245,"children":6246},{"href":4231},[6247],{"type":69,"value":4234},{"type":69,"value":442},{"type":64,"tag":1638,"props":6250,"children":6252},{"id":6251},"_2-medium-confusing-request-vs-server-function-middleware",[6253],{"type":69,"value":6254},"2. MEDIUM: Confusing request vs server function middleware",{"type":64,"tag":71,"props":6256,"children":6257},{},[6258,6260,6265,6267,6272],{"type":69,"value":6259},"Request middleware runs on ALL requests (SSR, routes, functions). Server function middleware runs only for ",{"type":64,"tag":92,"props":6261,"children":6263},{"className":6262},[],[6264],{"type":69,"value":4207},{"type":69,"value":6266}," calls and has ",{"type":64,"tag":92,"props":6268,"children":6270},{"className":6269},[],[6271],{"type":69,"value":235},{"type":69,"value":6273}," method.",{"type":64,"tag":1638,"props":6275,"children":6277},{"id":6276},"_3-high-browser-apis-in-client-crash-during-ssr",[6278],{"type":69,"value":6279},"3. HIGH: Browser APIs in .client() crash during SSR",{"type":64,"tag":71,"props":6281,"children":6282},{},[6283,6285,6290,6292,6298,6300,6306,6308,6314],{"type":69,"value":6284},"During SSR, ",{"type":64,"tag":92,"props":6286,"children":6288},{"className":6287},[],[6289],{"type":69,"value":235},{"type":69,"value":6291}," callbacks run on the server. Browser-only APIs like ",{"type":64,"tag":92,"props":6293,"children":6295},{"className":6294},[],[6296],{"type":69,"value":6297},"localStorage",{"type":69,"value":6299}," or ",{"type":64,"tag":92,"props":6301,"children":6303},{"className":6302},[],[6304],{"type":69,"value":6305},"window",{"type":69,"value":6307}," will throw ",{"type":64,"tag":92,"props":6309,"children":6311},{"className":6310},[],[6312],{"type":69,"value":6313},"ReferenceError",{"type":69,"value":734},{"type":64,"tag":328,"props":6316,"children":6318},{"className":330,"code":6317,"language":332,"meta":333,"style":333},"\u002F\u002F WRONG — localStorage doesn't exist on the server during SSR\nconst middleware = createMiddleware({ type: 'function' }).client(\n  async ({ next }) => {\n    const token = localStorage.getItem('token')\n    return next({ sendContext: { token } })\n  },\n)\n\n\u002F\u002F CORRECT — use cookies\u002Fheaders or guard with typeof window check\nconst middleware = createMiddleware({ type: 'function' }).client(\n  async ({ next }) => {\n    const token =\n      typeof window !== 'undefined' ? localStorage.getItem('token') : null\n    return next({ sendContext: { token } })\n  },\n)\n",[6319],{"type":64,"tag":92,"props":6320,"children":6321},{"__ignoreMap":333},[6322,6330,6398,6425,6476,6524,6531,6538,6545,6553,6620,6647,6663,6740,6787,6794],{"type":64,"tag":339,"props":6323,"children":6324},{"class":341,"line":342},[6325],{"type":64,"tag":339,"props":6326,"children":6327},{"style":346},[6328],{"type":69,"value":6329},"\u002F\u002F WRONG — localStorage doesn't exist on the server during SSR\n",{"type":64,"tag":339,"props":6331,"children":6332},{"class":341,"line":352},[6333,6337,6342,6346,6350,6354,6358,6362,6366,6370,6374,6378,6382,6386,6390,6394],{"type":64,"tag":339,"props":6334,"children":6335},{"style":414},[6336],{"type":69,"value":417},{"type":64,"tag":339,"props":6338,"children":6339},{"style":368},[6340],{"type":69,"value":6341}," middleware ",{"type":64,"tag":339,"props":6343,"children":6344},{"style":362},[6345],{"type":69,"value":427},{"type":64,"tag":339,"props":6347,"children":6348},{"style":430},[6349],{"type":69,"value":371},{"type":64,"tag":339,"props":6351,"children":6352},{"style":368},[6353],{"type":69,"value":530},{"type":64,"tag":339,"props":6355,"children":6356},{"style":362},[6357],{"type":69,"value":724},{"type":64,"tag":339,"props":6359,"children":6360},{"style":527},[6361],{"type":69,"value":729},{"type":64,"tag":339,"props":6363,"children":6364},{"style":362},[6365],{"type":69,"value":734},{"type":64,"tag":339,"props":6367,"children":6368},{"style":362},[6369],{"type":69,"value":386},{"type":64,"tag":339,"props":6371,"children":6372},{"style":389},[6373],{"type":69,"value":743},{"type":64,"tag":339,"props":6375,"children":6376},{"style":362},[6377],{"type":69,"value":535},{"type":64,"tag":339,"props":6379,"children":6380},{"style":362},[6381],{"type":69,"value":376},{"type":64,"tag":339,"props":6383,"children":6384},{"style":368},[6385],{"type":69,"value":268},{"type":64,"tag":339,"props":6387,"children":6388},{"style":362},[6389],{"type":69,"value":442},{"type":64,"tag":339,"props":6391,"children":6392},{"style":430},[6393],{"type":69,"value":768},{"type":64,"tag":339,"props":6395,"children":6396},{"style":368},[6397],{"type":69,"value":452},{"type":64,"tag":339,"props":6399,"children":6400},{"class":341,"line":400},[6401,6405,6409,6413,6417,6421],{"type":64,"tag":339,"props":6402,"children":6403},{"style":414},[6404],{"type":69,"value":461},{"type":64,"tag":339,"props":6406,"children":6407},{"style":362},[6408],{"type":69,"value":466},{"type":64,"tag":339,"props":6410,"children":6411},{"style":469},[6412],{"type":69,"value":472},{"type":64,"tag":339,"props":6414,"children":6415},{"style":362},[6416],{"type":69,"value":496},{"type":64,"tag":339,"props":6418,"children":6419},{"style":414},[6420],{"type":69,"value":501},{"type":64,"tag":339,"props":6422,"children":6423},{"style":362},[6424],{"type":69,"value":506},{"type":64,"tag":339,"props":6426,"children":6427},{"class":341,"line":410},[6428,6432,6437,6441,6446,6450,6455,6459,6463,6468,6472],{"type":64,"tag":339,"props":6429,"children":6430},{"style":414},[6431],{"type":69,"value":574},{"type":64,"tag":339,"props":6433,"children":6434},{"style":368},[6435],{"type":69,"value":6436}," token",{"type":64,"tag":339,"props":6438,"children":6439},{"style":362},[6440],{"type":69,"value":584},{"type":64,"tag":339,"props":6442,"children":6443},{"style":368},[6444],{"type":69,"value":6445}," localStorage",{"type":64,"tag":339,"props":6447,"children":6448},{"style":362},[6449],{"type":69,"value":442},{"type":64,"tag":339,"props":6451,"children":6452},{"style":430},[6453],{"type":69,"value":6454},"getItem",{"type":64,"tag":339,"props":6456,"children":6457},{"style":527},[6458],{"type":69,"value":530},{"type":64,"tag":339,"props":6460,"children":6461},{"style":362},[6462],{"type":69,"value":535},{"type":64,"tag":339,"props":6464,"children":6465},{"style":389},[6466],{"type":69,"value":6467},"token",{"type":64,"tag":339,"props":6469,"children":6470},{"style":362},[6471],{"type":69,"value":535},{"type":64,"tag":339,"props":6473,"children":6474},{"style":527},[6475],{"type":69,"value":565},{"type":64,"tag":339,"props":6477,"children":6478},{"class":341,"line":455},[6479,6483,6487,6491,6495,6500,6504,6508,6512,6516,6520],{"type":64,"tag":339,"props":6480,"children":6481},{"style":356},[6482],{"type":69,"value":607},{"type":64,"tag":339,"props":6484,"children":6485},{"style":430},[6486],{"type":69,"value":472},{"type":64,"tag":339,"props":6488,"children":6489},{"style":527},[6490],{"type":69,"value":530},{"type":64,"tag":339,"props":6492,"children":6493},{"style":362},[6494],{"type":69,"value":724},{"type":64,"tag":339,"props":6496,"children":6497},{"style":527},[6498],{"type":69,"value":6499}," sendContext",{"type":64,"tag":339,"props":6501,"children":6502},{"style":362},[6503],{"type":69,"value":734},{"type":64,"tag":339,"props":6505,"children":6506},{"style":362},[6507],{"type":69,"value":365},{"type":64,"tag":339,"props":6509,"children":6510},{"style":368},[6511],{"type":69,"value":6436},{"type":64,"tag":339,"props":6513,"children":6514},{"style":362},[6515],{"type":69,"value":376},{"type":64,"tag":339,"props":6517,"children":6518},{"style":362},[6519],{"type":69,"value":376},{"type":64,"tag":339,"props":6521,"children":6522},{"style":527},[6523],{"type":69,"value":565},{"type":64,"tag":339,"props":6525,"children":6526},{"class":341,"line":509},[6527],{"type":64,"tag":339,"props":6528,"children":6529},{"style":362},[6530],{"type":69,"value":621},{"type":64,"tag":339,"props":6532,"children":6533},{"class":341,"line":568},[6534],{"type":64,"tag":339,"props":6535,"children":6536},{"style":368},[6537],{"type":69,"value":565},{"type":64,"tag":339,"props":6539,"children":6540},{"class":341,"line":601},[6541],{"type":64,"tag":339,"props":6542,"children":6543},{"emptyLinePlaceholder":404},[6544],{"type":69,"value":407},{"type":64,"tag":339,"props":6546,"children":6547},{"class":341,"line":615},[6548],{"type":64,"tag":339,"props":6549,"children":6550},{"style":346},[6551],{"type":69,"value":6552},"\u002F\u002F CORRECT — use cookies\u002Fheaders or guard with typeof window check\n",{"type":64,"tag":339,"props":6554,"children":6555},{"class":341,"line":624},[6556,6560,6564,6568,6572,6576,6580,6584,6588,6592,6596,6600,6604,6608,6612,6616],{"type":64,"tag":339,"props":6557,"children":6558},{"style":414},[6559],{"type":69,"value":417},{"type":64,"tag":339,"props":6561,"children":6562},{"style":368},[6563],{"type":69,"value":6341},{"type":64,"tag":339,"props":6565,"children":6566},{"style":362},[6567],{"type":69,"value":427},{"type":64,"tag":339,"props":6569,"children":6570},{"style":430},[6571],{"type":69,"value":371},{"type":64,"tag":339,"props":6573,"children":6574},{"style":368},[6575],{"type":69,"value":530},{"type":64,"tag":339,"props":6577,"children":6578},{"style":362},[6579],{"type":69,"value":724},{"type":64,"tag":339,"props":6581,"children":6582},{"style":527},[6583],{"type":69,"value":729},{"type":64,"tag":339,"props":6585,"children":6586},{"style":362},[6587],{"type":69,"value":734},{"type":64,"tag":339,"props":6589,"children":6590},{"style":362},[6591],{"type":69,"value":386},{"type":64,"tag":339,"props":6593,"children":6594},{"style":389},[6595],{"type":69,"value":743},{"type":64,"tag":339,"props":6597,"children":6598},{"style":362},[6599],{"type":69,"value":535},{"type":64,"tag":339,"props":6601,"children":6602},{"style":362},[6603],{"type":69,"value":376},{"type":64,"tag":339,"props":6605,"children":6606},{"style":368},[6607],{"type":69,"value":268},{"type":64,"tag":339,"props":6609,"children":6610},{"style":362},[6611],{"type":69,"value":442},{"type":64,"tag":339,"props":6613,"children":6614},{"style":430},[6615],{"type":69,"value":768},{"type":64,"tag":339,"props":6617,"children":6618},{"style":368},[6619],{"type":69,"value":452},{"type":64,"tag":339,"props":6621,"children":6622},{"class":341,"line":866},[6623,6627,6631,6635,6639,6643],{"type":64,"tag":339,"props":6624,"children":6625},{"style":414},[6626],{"type":69,"value":461},{"type":64,"tag":339,"props":6628,"children":6629},{"style":362},[6630],{"type":69,"value":466},{"type":64,"tag":339,"props":6632,"children":6633},{"style":469},[6634],{"type":69,"value":472},{"type":64,"tag":339,"props":6636,"children":6637},{"style":362},[6638],{"type":69,"value":496},{"type":64,"tag":339,"props":6640,"children":6641},{"style":414},[6642],{"type":69,"value":501},{"type":64,"tag":339,"props":6644,"children":6645},{"style":362},[6646],{"type":69,"value":506},{"type":64,"tag":339,"props":6648,"children":6649},{"class":341,"line":914},[6650,6654,6658],{"type":64,"tag":339,"props":6651,"children":6652},{"style":414},[6653],{"type":69,"value":574},{"type":64,"tag":339,"props":6655,"children":6656},{"style":368},[6657],{"type":69,"value":6436},{"type":64,"tag":339,"props":6659,"children":6660},{"style":362},[6661],{"type":69,"value":6662}," =\n",{"type":64,"tag":339,"props":6664,"children":6665},{"class":341,"line":923},[6666,6671,6676,6681,6685,6690,6694,6699,6703,6707,6711,6715,6719,6723,6727,6731,6735],{"type":64,"tag":339,"props":6667,"children":6668},{"style":362},[6669],{"type":69,"value":6670},"      typeof",{"type":64,"tag":339,"props":6672,"children":6673},{"style":368},[6674],{"type":69,"value":6675}," window",{"type":64,"tag":339,"props":6677,"children":6678},{"style":362},[6679],{"type":69,"value":6680}," !==",{"type":64,"tag":339,"props":6682,"children":6683},{"style":362},[6684],{"type":69,"value":386},{"type":64,"tag":339,"props":6686,"children":6687},{"style":389},[6688],{"type":69,"value":6689},"undefined",{"type":64,"tag":339,"props":6691,"children":6692},{"style":362},[6693],{"type":69,"value":535},{"type":64,"tag":339,"props":6695,"children":6696},{"style":362},[6697],{"type":69,"value":6698}," ?",{"type":64,"tag":339,"props":6700,"children":6701},{"style":368},[6702],{"type":69,"value":6445},{"type":64,"tag":339,"props":6704,"children":6705},{"style":362},[6706],{"type":69,"value":442},{"type":64,"tag":339,"props":6708,"children":6709},{"style":430},[6710],{"type":69,"value":6454},{"type":64,"tag":339,"props":6712,"children":6713},{"style":527},[6714],{"type":69,"value":530},{"type":64,"tag":339,"props":6716,"children":6717},{"style":362},[6718],{"type":69,"value":535},{"type":64,"tag":339,"props":6720,"children":6721},{"style":389},[6722],{"type":69,"value":6467},{"type":64,"tag":339,"props":6724,"children":6725},{"style":362},[6726],{"type":69,"value":535},{"type":64,"tag":339,"props":6728,"children":6729},{"style":527},[6730],{"type":69,"value":1342},{"type":64,"tag":339,"props":6732,"children":6733},{"style":362},[6734],{"type":69,"value":734},{"type":64,"tag":339,"props":6736,"children":6737},{"style":362},[6738],{"type":69,"value":6739}," null\n",{"type":64,"tag":339,"props":6741,"children":6742},{"class":341,"line":951},[6743,6747,6751,6755,6759,6763,6767,6771,6775,6779,6783],{"type":64,"tag":339,"props":6744,"children":6745},{"style":356},[6746],{"type":69,"value":607},{"type":64,"tag":339,"props":6748,"children":6749},{"style":430},[6750],{"type":69,"value":472},{"type":64,"tag":339,"props":6752,"children":6753},{"style":527},[6754],{"type":69,"value":530},{"type":64,"tag":339,"props":6756,"children":6757},{"style":362},[6758],{"type":69,"value":724},{"type":64,"tag":339,"props":6760,"children":6761},{"style":527},[6762],{"type":69,"value":6499},{"type":64,"tag":339,"props":6764,"children":6765},{"style":362},[6766],{"type":69,"value":734},{"type":64,"tag":339,"props":6768,"children":6769},{"style":362},[6770],{"type":69,"value":365},{"type":64,"tag":339,"props":6772,"children":6773},{"style":368},[6774],{"type":69,"value":6436},{"type":64,"tag":339,"props":6776,"children":6777},{"style":362},[6778],{"type":69,"value":376},{"type":64,"tag":339,"props":6780,"children":6781},{"style":362},[6782],{"type":69,"value":376},{"type":64,"tag":339,"props":6784,"children":6785},{"style":527},[6786],{"type":69,"value":565},{"type":64,"tag":339,"props":6788,"children":6789},{"class":341,"line":960},[6790],{"type":64,"tag":339,"props":6791,"children":6792},{"style":362},[6793],{"type":69,"value":621},{"type":64,"tag":339,"props":6795,"children":6796},{"class":341,"line":972},[6797],{"type":64,"tag":339,"props":6798,"children":6799},{"style":368},[6800],{"type":69,"value":565},{"type":64,"tag":1638,"props":6802,"children":6804},{"id":6803},"_4-medium-wrong-method-order",[6805],{"type":69,"value":6806},"4. MEDIUM: Wrong method order",{"type":64,"tag":328,"props":6808,"children":6810},{"className":330,"code":6809,"language":332,"meta":333,"style":333},"\u002F\u002F WRONG — type error\ncreateMiddleware({ type: 'function' })\n  .server(() => { ... })\n  .client(() => { ... })\n\n\u002F\u002F CORRECT — middleware → validator → client → server\ncreateMiddleware({ type: 'function' })\n  .middleware([dep])\n  .validator(schema)\n  .client(({ next }) => next())\n  .server(({ next }) => next())\n",[6811],{"type":64,"tag":92,"props":6812,"children":6813},{"__ignoreMap":333},[6814,6822,6866,6906,6945,6952,6960,7003,7019,7035,7076],{"type":64,"tag":339,"props":6815,"children":6816},{"class":341,"line":342},[6817],{"type":64,"tag":339,"props":6818,"children":6819},{"style":346},[6820],{"type":69,"value":6821},"\u002F\u002F WRONG — type error\n",{"type":64,"tag":339,"props":6823,"children":6824},{"class":341,"line":352},[6825,6830,6834,6838,6842,6846,6850,6854,6858,6862],{"type":64,"tag":339,"props":6826,"children":6827},{"style":430},[6828],{"type":69,"value":6829},"createMiddleware",{"type":64,"tag":339,"props":6831,"children":6832},{"style":368},[6833],{"type":69,"value":530},{"type":64,"tag":339,"props":6835,"children":6836},{"style":362},[6837],{"type":69,"value":724},{"type":64,"tag":339,"props":6839,"children":6840},{"style":527},[6841],{"type":69,"value":729},{"type":64,"tag":339,"props":6843,"children":6844},{"style":362},[6845],{"type":69,"value":734},{"type":64,"tag":339,"props":6847,"children":6848},{"style":362},[6849],{"type":69,"value":386},{"type":64,"tag":339,"props":6851,"children":6852},{"style":389},[6853],{"type":69,"value":743},{"type":64,"tag":339,"props":6855,"children":6856},{"style":362},[6857],{"type":69,"value":535},{"type":64,"tag":339,"props":6859,"children":6860},{"style":362},[6861],{"type":69,"value":376},{"type":64,"tag":339,"props":6863,"children":6864},{"style":368},[6865],{"type":69,"value":565},{"type":64,"tag":339,"props":6867,"children":6868},{"class":341,"line":400},[6869,6873,6877,6881,6885,6889,6893,6898,6902],{"type":64,"tag":339,"props":6870,"children":6871},{"style":362},[6872],{"type":69,"value":763},{"type":64,"tag":339,"props":6874,"children":6875},{"style":430},[6876],{"type":69,"value":447},{"type":64,"tag":339,"props":6878,"children":6879},{"style":368},[6880],{"type":69,"value":530},{"type":64,"tag":339,"props":6882,"children":6883},{"style":362},[6884],{"type":69,"value":437},{"type":64,"tag":339,"props":6886,"children":6887},{"style":414},[6888],{"type":69,"value":501},{"type":64,"tag":339,"props":6890,"children":6891},{"style":362},[6892],{"type":69,"value":365},{"type":64,"tag":339,"props":6894,"children":6895},{"style":362},[6896],{"type":69,"value":6897}," ...",{"type":64,"tag":339,"props":6899,"children":6900},{"style":362},[6901],{"type":69,"value":376},{"type":64,"tag":339,"props":6903,"children":6904},{"style":368},[6905],{"type":69,"value":565},{"type":64,"tag":339,"props":6907,"children":6908},{"class":341,"line":410},[6909,6913,6917,6921,6925,6929,6933,6937,6941],{"type":64,"tag":339,"props":6910,"children":6911},{"style":362},[6912],{"type":69,"value":763},{"type":64,"tag":339,"props":6914,"children":6915},{"style":430},[6916],{"type":69,"value":768},{"type":64,"tag":339,"props":6918,"children":6919},{"style":368},[6920],{"type":69,"value":530},{"type":64,"tag":339,"props":6922,"children":6923},{"style":362},[6924],{"type":69,"value":437},{"type":64,"tag":339,"props":6926,"children":6927},{"style":414},[6928],{"type":69,"value":501},{"type":64,"tag":339,"props":6930,"children":6931},{"style":362},[6932],{"type":69,"value":365},{"type":64,"tag":339,"props":6934,"children":6935},{"style":362},[6936],{"type":69,"value":6897},{"type":64,"tag":339,"props":6938,"children":6939},{"style":362},[6940],{"type":69,"value":376},{"type":64,"tag":339,"props":6942,"children":6943},{"style":368},[6944],{"type":69,"value":565},{"type":64,"tag":339,"props":6946,"children":6947},{"class":341,"line":455},[6948],{"type":64,"tag":339,"props":6949,"children":6950},{"emptyLinePlaceholder":404},[6951],{"type":69,"value":407},{"type":64,"tag":339,"props":6953,"children":6954},{"class":341,"line":509},[6955],{"type":64,"tag":339,"props":6956,"children":6957},{"style":346},[6958],{"type":69,"value":6959},"\u002F\u002F CORRECT — middleware → validator → client → server\n",{"type":64,"tag":339,"props":6961,"children":6962},{"class":341,"line":568},[6963,6967,6971,6975,6979,6983,6987,6991,6995,6999],{"type":64,"tag":339,"props":6964,"children":6965},{"style":430},[6966],{"type":69,"value":6829},{"type":64,"tag":339,"props":6968,"children":6969},{"style":368},[6970],{"type":69,"value":530},{"type":64,"tag":339,"props":6972,"children":6973},{"style":362},[6974],{"type":69,"value":724},{"type":64,"tag":339,"props":6976,"children":6977},{"style":527},[6978],{"type":69,"value":729},{"type":64,"tag":339,"props":6980,"children":6981},{"style":362},[6982],{"type":69,"value":734},{"type":64,"tag":339,"props":6984,"children":6985},{"style":362},[6986],{"type":69,"value":386},{"type":64,"tag":339,"props":6988,"children":6989},{"style":389},[6990],{"type":69,"value":743},{"type":64,"tag":339,"props":6992,"children":6993},{"style":362},[6994],{"type":69,"value":535},{"type":64,"tag":339,"props":6996,"children":6997},{"style":362},[6998],{"type":69,"value":376},{"type":64,"tag":339,"props":7000,"children":7001},{"style":368},[7002],{"type":69,"value":565},{"type":64,"tag":339,"props":7004,"children":7005},{"class":341,"line":601},[7006,7010,7014],{"type":64,"tag":339,"props":7007,"children":7008},{"style":362},[7009],{"type":69,"value":763},{"type":64,"tag":339,"props":7011,"children":7012},{"style":430},[7013],{"type":69,"value":4},{"type":64,"tag":339,"props":7015,"children":7016},{"style":368},[7017],{"type":69,"value":7018},"([dep])\n",{"type":64,"tag":339,"props":7020,"children":7021},{"class":341,"line":615},[7022,7026,7030],{"type":64,"tag":339,"props":7023,"children":7024},{"style":362},[7025],{"type":69,"value":763},{"type":64,"tag":339,"props":7027,"children":7028},{"style":430},[7029],{"type":69,"value":2576},{"type":64,"tag":339,"props":7031,"children":7032},{"style":368},[7033],{"type":69,"value":7034},"(schema)\n",{"type":64,"tag":339,"props":7036,"children":7037},{"class":341,"line":624},[7038,7042,7046,7050,7055,7059,7063,7067,7071],{"type":64,"tag":339,"props":7039,"children":7040},{"style":362},[7041],{"type":69,"value":763},{"type":64,"tag":339,"props":7043,"children":7044},{"style":430},[7045],{"type":69,"value":768},{"type":64,"tag":339,"props":7047,"children":7048},{"style":368},[7049],{"type":69,"value":530},{"type":64,"tag":339,"props":7051,"children":7052},{"style":362},[7053],{"type":69,"value":7054},"({",{"type":64,"tag":339,"props":7056,"children":7057},{"style":469},[7058],{"type":69,"value":472},{"type":64,"tag":339,"props":7060,"children":7061},{"style":362},[7062],{"type":69,"value":496},{"type":64,"tag":339,"props":7064,"children":7065},{"style":414},[7066],{"type":69,"value":501},{"type":64,"tag":339,"props":7068,"children":7069},{"style":430},[7070],{"type":69,"value":472},{"type":64,"tag":339,"props":7072,"children":7073},{"style":368},[7074],{"type":69,"value":7075},"())\n",{"type":64,"tag":339,"props":7077,"children":7078},{"class":341,"line":866},[7079,7083,7087,7091,7095,7099,7103,7107,7111],{"type":64,"tag":339,"props":7080,"children":7081},{"style":362},[7082],{"type":69,"value":763},{"type":64,"tag":339,"props":7084,"children":7085},{"style":430},[7086],{"type":69,"value":447},{"type":64,"tag":339,"props":7088,"children":7089},{"style":368},[7090],{"type":69,"value":530},{"type":64,"tag":339,"props":7092,"children":7093},{"style":362},[7094],{"type":69,"value":7054},{"type":64,"tag":339,"props":7096,"children":7097},{"style":469},[7098],{"type":69,"value":472},{"type":64,"tag":339,"props":7100,"children":7101},{"style":362},[7102],{"type":69,"value":496},{"type":64,"tag":339,"props":7104,"children":7105},{"style":414},[7106],{"type":69,"value":501},{"type":64,"tag":339,"props":7108,"children":7109},{"style":430},[7110],{"type":69,"value":472},{"type":64,"tag":339,"props":7112,"children":7113},{"style":368},[7114],{"type":69,"value":7075},{"type":64,"tag":153,"props":7116,"children":7118},{"id":7117},"cross-references",[7119],{"type":69,"value":7120},"Cross-References",{"type":64,"tag":7122,"props":7123,"children":7124},"ul",{},[7125,7136,7147,7163],{"type":64,"tag":7126,"props":7127,"children":7128},"li",{},[7129,7134],{"type":64,"tag":4221,"props":7130,"children":7132},{"href":7131},"..\u002Fserver-functions\u002FSKILL.md",[7133],{"type":69,"value":57},{"type":69,"value":7135}," — what middleware wraps",{"type":64,"tag":7126,"props":7137,"children":7138},{},[7139,7145],{"type":64,"tag":4221,"props":7140,"children":7142},{"href":7141},"..\u002Fserver-routes\u002FSKILL.md",[7143],{"type":69,"value":7144},"start-core\u002Fserver-routes",{"type":69,"value":7146}," — middleware on API endpoints",{"type":64,"tag":7126,"props":7148,"children":7149},{},[7150,7154,7156,7161],{"type":64,"tag":4221,"props":7151,"children":7152},{"href":4231},[7153],{"type":69,"value":4234},{"type":69,"value":7155}," — building the ",{"type":64,"tag":92,"props":7157,"children":7159},{"className":7158},[],[7160],{"type":69,"value":4199},{"type":69,"value":7162}," factory itself: session cookie reads, OAuth state, CSRF",{"type":64,"tag":7126,"props":7164,"children":7165},{},[7166,7170],{"type":64,"tag":4221,"props":7167,"children":7168},{"href":4223},[7169],{"type":69,"value":4226},{"type":69,"value":7171}," — routing-side UX guards; data auth belongs in the server function, server route, or API endpoint handler\u002Fmiddleware",{"type":64,"tag":7173,"props":7174,"children":7175},"style",{},[7176],{"type":69,"value":7177},"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":7179,"total":7278},[7180,7197,7212,7228,7241,7260,7271],{"slug":7181,"name":7181,"fn":7182,"description":7183,"org":7184,"tags":7185,"stars":22,"repoUrl":23,"updatedAt":7196},"auth-and-guards","implement route protection in TanStack Router","Route protection with beforeLoad, redirect()\u002Fthrow redirect(), isRedirect helper, authenticated layout routes (_authenticated), non-redirect auth (inline login), RBAC with roles and permissions, auth provider integration (Auth0, Clerk, Supabase), router context for auth state.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[7186,7189,7190,7192,7193],{"name":7187,"slug":7188,"type":15},"Auth","auth",{"name":20,"slug":21,"type":15},{"name":7191,"slug":34,"type":15},"Routing",{"name":9,"slug":8,"type":15},{"name":7194,"slug":7195,"type":15},"TanStack Router","tanstack-router","2026-07-30T05:27:07.639032",{"slug":7198,"name":7198,"fn":7199,"description":7200,"org":7201,"tags":7202,"stars":22,"repoUrl":23,"updatedAt":7211},"auth-server-primitives","implement server-side authentication primitives","Server-side authentication primitives for TanStack Start: session cookies (HttpOnly, Secure, SameSite, __Host- prefix), session read\u002Fissue\u002Fdestroy via createServerFn and middleware, OAuth authorization-code flow with state and PKCE, password-reset enumeration defense, CSRF for non-GET RPCs, rate limiting auth endpoints, session rotation on privilege change. Pairs with router-core\u002Fauth-and-guards for the routing side.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[7203,7204,7207,7210],{"name":7187,"slug":7188,"type":15},{"name":7205,"slug":7206,"type":15},"OAuth","oauth",{"name":7208,"slug":7209,"type":15},"Security","security",{"name":9,"slug":8,"type":15},"2026-07-30T05:26:59.504396",{"slug":7213,"name":7213,"fn":7214,"description":7215,"org":7216,"tags":7217,"stars":22,"repoUrl":23,"updatedAt":7227},"code-splitting","configure code splitting in TanStack Router","Automatic code splitting (autoCodeSplitting), .lazy.tsx convention, createLazyFileRoute, createLazyRoute, lazyRouteComponent, getRouteApi for typed hooks in split files, codeSplitGroupings per-route override, splitBehavior programmatic config, critical vs non-critical properties.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[7218,7221,7222,7225,7226],{"name":7219,"slug":7220,"type":15},"Engineering","engineering",{"name":20,"slug":21,"type":15},{"name":7223,"slug":7224,"type":15},"Performance","performance",{"name":9,"slug":8,"type":15},{"name":7194,"slug":7195,"type":15},"2026-07-30T05:27:11.494406",{"slug":7229,"name":7229,"fn":7230,"description":7231,"org":7232,"tags":7233,"stars":22,"repoUrl":23,"updatedAt":7240},"data-loading","manage data loading in TanStack Router","Route loader option, loaderDeps for cache keys, staleTime\u002FgcTime\u002F defaultPreloadStaleTime SWR caching, pendingComponent\u002FpendingMs\u002F pendingMinMs, errorComponent\u002FonError\u002FonCatch, beforeLoad, router context and createRootRouteWithContext DI pattern, router.invalidate, Await component, deferred data loading with unawaited promises.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[7234,7237,7238,7239],{"name":7235,"slug":7236,"type":15},"Caching","caching",{"name":7223,"slug":7224,"type":15},{"name":9,"slug":8,"type":15},{"name":7194,"slug":7195,"type":15},"2026-07-30T05:26:54.487943",{"slug":7242,"name":7242,"fn":7243,"description":7244,"org":7245,"tags":7246,"stars":22,"repoUrl":23,"updatedAt":7259},"deployment","deploy TanStack Start applications","Deploy to Cloudflare Workers, Netlify, Vercel, Node.js\u002FDocker, Bun, Railway. Selective SSR (ssr option per route), SPA mode, static prerendering, ISR with Cache-Control headers, SEO and head management.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[7247,7250,7252,7255,7256],{"name":7248,"slug":7249,"type":15},"Cloudflare","cloudflare",{"name":7251,"slug":7242,"type":15},"Deployment",{"name":7253,"slug":7254,"type":15},"Netlify","netlify",{"name":9,"slug":8,"type":15},{"name":7257,"slug":7258,"type":15},"Vercel","vercel","2026-07-30T05:26:50.509927",{"slug":7261,"name":7261,"fn":7262,"description":7263,"org":7264,"tags":7265,"stars":22,"repoUrl":23,"updatedAt":7270},"execution-model","manage isomorphic execution models","Isomorphic-by-default principle, environment boundary functions (createServerFn, createServerOnlyFn, createClientOnlyFn, createIsomorphicFn), ClientOnly component, useHydrated hook, import protection, dead code elimination, environment variable safety (VITE_ prefix, process.env).",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[7266,7269],{"name":7267,"slug":7268,"type":15},"Architecture","architecture",{"name":9,"slug":8,"type":15},"2026-07-30T05:27:04.558441",{"slug":4,"name":4,"fn":5,"description":6,"org":7272,"tags":7273,"stars":22,"repoUrl":23,"updatedAt":24},{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[7274,7275,7276,7277],{"name":13,"slug":14,"type":15},{"name":20,"slug":21,"type":15},{"name":17,"slug":4,"type":15},{"name":9,"slug":8,"type":15},30,{"items":7280,"total":7418},[7281,7295,7307,7319,7332,7344,7354,7364,7377,7387,7398,7408],{"slug":7282,"name":7282,"fn":7283,"description":7284,"org":7285,"tags":7286,"stars":7292,"repoUrl":7293,"updatedAt":7294},"aggregation","perform data aggregation in TanStack Table","Aggregate TanStack Table columns independently of grouping, including grand totals, caller-selected row totals, multiple keyed aggregations, custom context-based definitions, grouped merges, manual values, and worker constraints.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[7287,7290,7291],{"name":7288,"slug":7289,"type":15},"Data Analysis","data-analysis",{"name":20,"slug":21,"type":15},{"name":9,"slug":8,"type":15},28175,"https:\u002F\u002Fgithub.com\u002FTanStack\u002Ftable","2026-07-30T05:25:59.429787",{"slug":7296,"name":7296,"fn":7297,"description":7298,"org":7299,"tags":7300,"stars":7292,"repoUrl":7293,"updatedAt":7306},"api-not-found","diagnose TanStack Table API errors","Diagnose missing TanStack Table v9 exports, options, state slices, and instance methods. Load before inventing an API when code sees a type error, undefined feature method, absent object key, adapter mismatch, or v8-shaped example.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[7301,7304,7305],{"name":7302,"slug":7303,"type":15},"Debugging","debugging",{"name":20,"slug":21,"type":15},{"name":9,"slug":8,"type":15},"2026-07-30T05:26:05.418735",{"slug":7308,"name":7308,"fn":7309,"description":7310,"org":7311,"tags":7312,"stars":7292,"repoUrl":7293,"updatedAt":7318},"cell-selection","select rectangular cell ranges in tables","Select rectangular cell ranges with cellSelectionFeature: two-corner range state keyed by row and column id, mousedown\u002Fmouseenter handlers, selection edges, render-order resolution under pinning, and autoResetCellSelection. Load when ranges widen unexpectedly after sorting or column reordering, when a drag re-renders the whole table, or when building copy-to-clipboard from a selection.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[7313,7314,7315],{"name":7288,"slug":7289,"type":15},{"name":9,"slug":8,"type":15},{"name":7316,"slug":7317,"type":15},"UI Components","ui-components","2026-07-30T05:25:38.403427",{"slug":7320,"name":7320,"fn":7321,"description":7322,"org":7323,"tags":7324,"stars":7292,"repoUrl":7293,"updatedAt":7331},"client-vs-server","manage TanStack Table data pipelines","Choose client or server ownership for filtering, grouping, sorting, expanding, and pagination in TanStack Table v9. Load for manual* flags, mixed pipelines, server counts, or deciding which dataset each row-model stage receives.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[7325,7328,7329,7330],{"name":7326,"slug":7327,"type":15},"Data Pipeline","data-pipeline",{"name":20,"slug":21,"type":15},{"name":7223,"slug":7224,"type":15},{"name":9,"slug":8,"type":15},"2026-07-30T05:25:45.400104",{"slug":7333,"name":7333,"fn":7334,"description":7335,"org":7336,"tags":7337,"stars":7292,"repoUrl":7293,"updatedAt":7343},"column-faceting","build faceted filter UIs","Build faceted filter UIs with columnFacetingFeature, facetedRowModel, facetedUniqueValues, and facetedMinMaxValues. Load for facet counts, numeric ranges, own-filter exclusion, or server-page facet completeness.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[7338,7341,7342],{"name":7339,"slug":7340,"type":15},"Data Visualization","data-visualization",{"name":20,"slug":21,"type":15},{"name":9,"slug":8,"type":15},"2026-07-30T05:25:41.397257",{"slug":7345,"name":7345,"fn":7346,"description":7347,"org":7348,"tags":7349,"stars":7292,"repoUrl":7293,"updatedAt":7353},"column-filtering","implement column filtering in TanStack Table","Filter columns with columnFilteringFeature, filteredRowModel, filterFns, filterMeta, nested-row direction, and manualFiltering. Load for accessor compatibility, controlled filter updaters, fuzzy metadata, or client\u002Fserver ownership.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[7350,7351,7352],{"name":7288,"slug":7289,"type":15},{"name":20,"slug":21,"type":15},{"name":9,"slug":8,"type":15},"2026-07-30T05:25:53.391632",{"slug":7355,"name":7355,"fn":7356,"description":7357,"org":7358,"tags":7359,"stars":7292,"repoUrl":7293,"updatedAt":7363},"column-ordering","manage TanStack Table column ordering","Control TanStack Table v9 leaf columnOrder with stable IDs while accounting for pinning regions, visibility, and groupedColumnMode precedence. Load for drag-and-drop columns or rendered order that differs from state.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[7360,7361,7362],{"name":20,"slug":21,"type":15},{"name":9,"slug":8,"type":15},{"name":7316,"slug":7317,"type":15},"2026-07-30T05:26:03.37801",{"slug":7365,"name":7365,"fn":7366,"description":7367,"org":7368,"tags":7369,"stars":7292,"repoUrl":7293,"updatedAt":7376},"column-pinning","configure column pinning in TanStack Table","Pin columns into logical start, center, and end regions with columnPinningFeature and renderer-owned sticky CSS. Load for RTL offsets, z-index, backgrounds, overflow, widths, gaps, or overlaps.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[7370,7373,7374,7375],{"name":7371,"slug":7372,"type":15},"CSS","css",{"name":20,"slug":21,"type":15},{"name":9,"slug":8,"type":15},{"name":7316,"slug":7317,"type":15},"2026-07-30T05:25:55.377366",{"slug":7378,"name":7378,"fn":7379,"description":7380,"org":7381,"tags":7382,"stars":7292,"repoUrl":7293,"updatedAt":7386},"column-resizing","implement column resizing in TanStack Table","Wire columnResizingFeature, header.getResizeHandler, resize mode and direction, pointer or touch events, and performant CSS-variable updates. Load when resize state changes but widths do not, or large tables resize slowly.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[7383,7384,7385],{"name":20,"slug":21,"type":15},{"name":9,"slug":8,"type":15},{"name":7316,"slug":7317,"type":15},"2026-07-30T05:25:51.400011",{"slug":7388,"name":7388,"fn":7389,"description":7390,"org":7391,"tags":7392,"stars":7292,"repoUrl":7293,"updatedAt":7397},"column-sizing","configure column sizing in TanStack Table","Use columnSizingFeature numeric size, minSize, maxSize, getSize, getStart, getAfter, and total-size APIs in table, grid, or flex CSS. Load for auto or percentage misconceptions and sizing\u002Fpinning layout mismatch.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[7393,7394,7395,7396],{"name":7371,"slug":7372,"type":15},{"name":20,"slug":21,"type":15},{"name":9,"slug":8,"type":15},{"name":7316,"slug":7317,"type":15},"2026-07-30T05:25:48.703799",{"slug":7399,"name":7399,"fn":7400,"description":7401,"org":7402,"tags":7403,"stars":7292,"repoUrl":7293,"updatedAt":7407},"column-visibility","manage column visibility in TanStack Table","Hide columns with columnVisibilityFeature while rendering visibility-aware header, column, and cell collections. Load when hidden columns remain in the DOM, false-versus-absent state is confused, or enableHiding is misunderstood.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[7404,7405,7406],{"name":20,"slug":21,"type":15},{"name":9,"slug":8,"type":15},{"name":7316,"slug":7317,"type":15},"2026-07-30T05:25:47.367943",{"slug":7409,"name":7409,"fn":7410,"description":7411,"org":7412,"tags":7413,"stars":7292,"repoUrl":7293,"updatedAt":7417},"core","build data grids with TanStack Table","Use TanStack Table v9 as a headless data-grid state and row-processing engine. Load for first-table architecture, stable data and columns, row numbering with getDisplayIndex, semantic rendering, framework adapter choice, or deciding what Table owns versus the renderer.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[7414,7415,7416],{"name":7288,"slug":7289,"type":15},{"name":20,"slug":21,"type":15},{"name":7316,"slug":7317,"type":15},"2026-07-30T05:25:52.366295",125]