http/surface_query.ts

Pure query functions over AppSurface data.

Usable in tests, the adversarial auth runner, and future surface explorer UI. Replaces duplicated inline .filter() patterns.

Categorical filters (filter_role_routes, filter_keeper_routes, filter_credential_gated_routes) and surface_auth_summary group the flat-record RouteAuth shape into categorical buckets for adversarial test runners and the surface explorer. The buckets are derived views over the authority axes (account, actor, roles, credential_types) — see http/auth_shape.ts for the canonical shape.

view source

Declarations
#

10 declarations

filter_credential_gated_routes
#

http/surface_query.ts view source

(surface: AppSurface): AppSurfaceRoute[] import {filter_credential_gated_routes} from '@fuzdev/fuz_app/http/surface_query.js';

Filter routes gated to a credential channel (any non-empty auth.credential_types), whichever channel that is.

Superset of filter_keeper_routes: keeper is the daemon_token gate, and the same axis points the other way on the session-only routes (the credential-minting actions, POST /logout / POST /password, the audit SSE stream). Adversarial runners need the whole bucket, since every route in it answers credential_type_required to a channel it does not admit.

surface

returns

AppSurfaceRoute[]

filter_keeper_routes
#

filter_protected_routes
#

filter_public_routes
#

filter_role_routes
#

filter_routes_with_input
#

filter_routes_with_params
#

filter_routes_with_query
#

format_route_key
#

http/surface_query.ts view source

(route: { readonly method: string; readonly path: string; }): string import {format_route_key} from '@fuzdev/fuz_app/http/surface_query.js';

Format a route as 'METHOD /path' (e.g. 'GET /health'): a surface route or a route spec, its path the template. The key of a route in a map of route error maps (resolve_app_route_error_maps).

route

the route's method and path template

type { readonly method: string; readonly path: string; }

returns

string

surface_auth_summary
#

http/surface_query.ts view source

(surface: AppSurface): { none: number; authenticated: number; optional: number; role: Map<string, number>; credential: Map<string, number>; keeper: number; other: number; } import {surface_auth_summary} from '@fuzdev/fuz_app/http/surface_query.js';

Summarize route auth distribution across the surface.

Categorical view over the flat auth record — none, keeper, role and credential (counted per name), authenticated, optional, other. Keeper outranks a role, and a role outranks a channel gate, so the audit SSE stream (admin role, session channel) counts under role. Multi-role and multi-channel specs contribute one count per role / channel they admit.

surface

returns

{ none: number; authenticated: number; optional: number; role: Map<string, number>; credential: Map<string, number>; keeper: number; other: number; }

counts by auth category, with role and channel counts broken out by name

Depends on
#

Imported by
#