server/surface_route.ts

The surface explorer route — GET /api/surface, serving the generated AppSurface as JSON.

Opt-in on create_app_server (surface_route: true), and admin-only when mounted: the surface is a map of every route, its auth, and its schemas.

view source

Declarations
#

2 declarations

create_surface_route_spec
#

server/surface_route.ts view source

(options: SurfaceRouteOptions): RouteSpec import {create_surface_route_spec} from '@fuzdev/fuz_app/server/surface_route.js';

Create the admin-only route spec that serves the AppSurface as JSON.

Surface data reveals API structure (routes, auth, schemas), so the route requires the global admin role. It is also a non-RPC surface: it declares required_scope: 'surface:app_surface', so a narrowed API token is refused it whatever its method list says (403 token_scope_required, ahead of the role gate), while a full-scope admin bearer passes. The admin role implies actor: 'required', so the route takes the ?acting= selector a multi-actor admin disambiguates with.

options

the surface to serve

returns

RouteSpec

the GET /api/surface route spec

SurfaceRouteOptions
#

server/surface_route.ts view source

SurfaceRouteOptions import type {SurfaceRouteOptions} from '@fuzdev/fuz_app/server/surface_route.js';

Options for the surface explorer route.

surface

The generated app surface to serve — read per request, so a backfilled ref serves the final surface.

type AppSurface

Depends on
#

Imported by
#