actions/action_bridge.ts view source
ActionEventOptions Options for deriving an EventSpec from an ActionSpec.
channel
stringBridge functions to derive RouteSpec and EventSpec from ActionSpec.
Action specs define the contract (method, input/output, auth, side effects). Bridge functions produce transport-specific specs from them. HTTP-specific concerns (path, handler) come from options.
5 declarations
actions/action_bridge.ts view source
ActionEventOptions Options for deriving an EventSpec from an ActionSpec.
channelstringactions/action_bridge.ts view source
ActionRouteOptions Options for deriving a RouteSpec from an ActionSpec.
pathstringhandlerparamsURL path parameter schema. Use z.strictObject() with string fields matching :param segments.
z.ZodObjectqueryURL query parameter schema. Use z.strictObject() with string fields.
z.ZodObjecthttp_methodOverride the default HTTP method (default: side_effects → POST, else GET).
authOverride the route's auth shape — defaults to the action spec's auth
(the canonical four-axis shape from http/auth_shape.ts is shared
verbatim between action specs and route specs, so no mapping is needed).
errorsHandler-specific error schemas (HTTP status code → Zod schema). Transport-specific — not on ActionSpec.
actions/action_bridge.ts view source
(spec: { method: string; kind: "request_response" | "remote_notification" | "local_call"; initiator: "frontend" | "backend" | "both"; auth: { account: "none" | "optional" | "required"; actor: "none" | ... 1 more ... | "required"; roles?: readonly string[] | undefined; credential_types?: readonly string[] | undefined; } | null; ... 7 more ...; rate_limit?: "both" | ... 2 more ... | undefined; }, options?: ActionEventOptions | undefined): EventSpec Derive an EventSpec from an ActionSpec.
Only remote_notification actions can become push events.
specthe action spec (must have kind: 'remote_notification')
{ method: string; kind: "request_response" | "remote_notification" | "local_call"; initiator: "frontend" | "backend" | "both"; auth: { account: "none" | "optional" | "required"; actor: "none" | ... 1 more ... | "required"; roles?: readonly string[] | undefined; credential_types?: readonly string[] | undefined; } | n...options?optional event-specific options (channel)
ActionEventOptions | undefinedEventSpec an EventSpec ready for create_validated_broadcaster
Error - if `spec.kind` is not `'remote_notification'`actions/action_bridge.ts view source
(spec: { method: string; kind: "request_response" | "remote_notification" | "local_call"; initiator: "frontend" | "backend" | "both"; auth: { account: "none" | "optional" | "required"; actor: "none" | ... 1 more ... | "required"; roles?: readonly string[] | undefined; credential_types?: readonly string[] | undefined; } | null; ... 7 more ...; rate_limit?: "both" | ... 2 more ... | undefined; }, options: ActionRouteOptions): RouteSpec Derive a RouteSpec from an ActionSpec and options.
Only request_response actions (which require non-null auth) can become routes.
remote_notification actions (auth null) should use create_action_event_spec.
local_call actions are not for HTTP transport.
Error schemas are transport-specific (keyed by HTTP status codes) and belong on the options, not the action spec. Action specs define the contract; transport concerns like HTTP error codes are added at the bridge layer.
specthe action spec (must have non-null auth)
{ method: string; kind: "request_response" | "remote_notification" | "local_call"; initiator: "frontend" | "backend" | "both"; auth: { account: "none" | "optional" | "required"; actor: "none" | ... 1 more ... | "required"; roles?: readonly string[] | undefined; credential_types?: readonly string[] | undefined; } | n...optionsHTTP-specific options (path, handler, optional overrides)
RouteSpec a RouteSpec ready for apply_route_specs
Error - if `spec.auth` is null (only `request_response` actions canactions/action_bridge.ts view source
(side_effects: boolean): RouteMethod Derive the default HTTP method from side effects.
side_effectsbooleanRouteMethod