EndpointInfo today exposes the wire shape of a route (method, path, handler, file, params, auth) but not its categorical role. Consumers like apex currently derive that with hand-written file-path regex, which puts framework-specific knowledge in the wrong repo.
Add a required kind field to EndpointInfo in src/types.ts, plus an optional kind? parameter to the endpoint() factory in src/utils.ts (defaulting to "api" for migration ergonomics). Existing extractors get explicit kind: "api" calls — mechanical no-op since the factory default matches.
Four values:
"api" — REST / GraphQL / RPC / generic JSON HTTP routes.
"page" — server-rendered or client-routed page returning HTML/RSC.
"action" — RPC-style call invoked from UI (Next.js Server Actions). Companion to `method: "ACTION"`.
"websocket" — persistent bidirectional channel. Companion to `method: "WS"`.
The factoring is deliberate: method carries the HTTP verb (or wire-shape distinction for WS / ACTION today, until they migrate to kind), kind carries the protocol/role category. Two fields, orthogonal concepts.
Foundation for the Next.js page extraction work and future page detection in Rails / Django / FastAPI / Spring view-rendering routes.
EndpointInfotoday exposes the wire shape of a route (method, path, handler, file, params, auth) but not its categorical role. Consumers like apex currently derive that with hand-written file-path regex, which puts framework-specific knowledge in the wrong repo.Add a required
kindfield toEndpointInfoinsrc/types.ts, plus an optionalkind?parameter to theendpoint()factory insrc/utils.ts(defaulting to"api"for migration ergonomics). Existing extractors get explicitkind: "api"calls — mechanical no-op since the factory default matches.Four values:
"api"— REST / GraphQL / RPC / generic JSON HTTP routes."page"— server-rendered or client-routed page returning HTML/RSC."action"— RPC-style call invoked from UI (Next.js Server Actions). Companion to `method: "ACTION"`."websocket"— persistent bidirectional channel. Companion to `method: "WS"`.The factoring is deliberate:
methodcarries the HTTP verb (or wire-shape distinction forWS/ACTIONtoday, until they migrate to kind),kindcarries the protocol/role category. Two fields, orthogonal concepts.Foundation for the Next.js page extraction work and future page detection in Rails / Django / FastAPI / Spring view-rendering routes.