actions/action_registry.ts

ActionRegistry — query and filter utility over ActionSpecUnion[].

Vocabulary (see the docs/ directory):

  • *_handled_* — request_response specs the named side receives (so the named side owns the handler). Used by codegen to emit typed handler maps.
  • *_relevant_to_* — the loose "everything this side might encounter" set, used by the typed-Proxy method enums (FrontendActionMethod, BackendActionMethod).
  • broadcast_* — kind-narrow remote_notification set with the streams-target exclusion. Today this matches what the broadcast API exposes.
  • backend_initiated_* — forward-looking kind-agnostic version of the broadcast set. Same content today; will diverge when local_calls or backend request_response join the backend's typed surface.

Cache discipline: spec_by_method (Map) and the internal streams-target set lazy-memoize because the Map is consulted per-RPC dispatch (actions/frontend_rpc_client.ts wires it into lookup_action_spec) and the streams set is rebuilt by two public getters. Array-returning getters recompute on each call so callers can mutate the result freely (.sort(), .push(injected) on a copy, etc.) without affecting the registry — codegen is a build-time path where the extra .filter / .map work is negligible.

view source

Declarations
#

ActionRegistry
#

actions/action_registry.ts view source

import {ActionRegistry} from '@fuzdev/fuz_app/actions/action_registry.js';

specs

type ActionSpecUnion[]

readonly

constructor

type new (specs: ({ method: string; initiator: "frontend" | "backend" | "both"; side_effects: boolean; input: ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>>; output: ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>>; ... 6 more ...; rate_limit?: "both" | ... 2 more ... | undefined; } | { ...; } | { ...; })[]): ActionRegistry

specs

spec_by_method

type Map<string, ActionSpecUnion>

getter

methods

type string[]

getter

request_response_specs

type RequestResponseActionSpec[]

getter

remote_notification_specs

type RemoteNotificationActionSpec[]

getter

local_call_specs

type LocalCallActionSpec[]

getter

request_response_methods

type string[]

getter

remote_notification_methods

type string[]

getter

local_call_methods

type string[]

getter

specs_relevant_to_frontend

type ActionSpecUnion[]

getter

specs_relevant_to_backend

type ActionSpecUnion[]

getter

methods_relevant_to_frontend

type string[]

getter

methods_relevant_to_backend

type string[]

getter

frontend_handled_specs

type RequestResponseActionSpec[]

getter

backend_handled_specs

type RequestResponseActionSpec[]

getter

frontend_handled_methods

type string[]

getter

backend_handled_methods

type string[]

getter

broadcast_specs

type RemoteNotificationActionSpec[]

getter

broadcast_methods

type string[]

getter

backend_initiated_specs

type ActionSpecUnion[]

getter

backend_initiated_methods

type string[]

getter

backend_to_frontend_specs

type ActionSpecUnion[]

getter

frontend_to_backend_specs

type ActionSpecUnion[]

getter

frontend_to_backend_methods

type string[]

getter

backend_to_frontend_methods

type string[]

getter

public_specs

type ActionSpecUnion[]

getter

authenticated_specs

type ActionSpecUnion[]

getter

public_methods

type string[]

getter

authenticated_methods

type string[]

getter

Depends on
#

Imported by
#