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_authenticated_routes, filter_role_routes, filter_keeper_routes) group the new flat-record RouteAuth shape into the legacy categorical buckets ('authenticated', 'role', 'keeper') for adversarial test runners and the surface explorer. The buckets are derived views over the four axes (account, actor, roles, credential_types) — see http/auth_shape.ts for the canonical shape.

Declarations
#

16 declarations

view source

filter_authenticated_routes
#

http/surface_query.ts view source

(surface: AppSurface): AppSurfaceRoute[]

Filter routes that require basic authentication only — account === 'required' with no role / credential gate.

surface

returns

AppSurfaceRoute[]

filter_keeper_routes
#

filter_mutation_routes
#

filter_protected_routes
#

filter_public_routes
#

filter_rate_limited_routes
#

filter_role_routes
#

filter_routes_by_prefix
#

filter_routes_for_role
#

http/surface_query.ts view source

(surface: AppSurface, role: string): AppSurfaceRoute[]

Filter routes whose auth.roles includes the named role.

surface

role

type string

returns

AppSurfaceRoute[]

filter_routes_with_input
#

filter_routes_with_params
#

filter_routes_with_query
#

format_route_key
#

RouteAuthCategory
#

http/surface_query.ts view source

RouteAuthCategory

Categorize a RouteAuth into one of the legacy auth buckets.

Returns: - 'none' for fully public routes (account === 'none' && actor === 'none') - 'keeper' when credential_types includes 'daemon_token' - 'role:<name>' for each role declared on auth.roles (multi-role specs are emitted multiple times; callers that need single-bucket grouping should pre-collapse) - 'authenticated' for account === 'required' without role / credential gate - 'optional' when either axis is 'optional' and no other bucket fits - 'other' as a last-resort bucket for shapes that don't match above

routes_by_auth_type
#

surface_auth_summary
#

http/surface_query.ts view source

(surface: AppSurface): { none: number; authenticated: number; optional: number; role: Map<string, number>; keeper: number; other: number; }

Summarize route auth distribution across the surface.

Categorical view over the four-axis flat record. Multi-role specs contribute one count per role they admit.

surface

returns

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

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

Depends on
#

Imported by
#