import { HandlerPayload, BroadcastPayload, MulticastPayload, OmnicastPayload, OmnicastDistribution, Distribution, Filter } from '../types/index.js'; export { getActionSymbol, getLifecycleType, isBroadcastAction, isMulticastAction, isOmnicastAction, getName, isChanneledAction, isReactiveBinding, schemaOf, validate, } from './utils.js'; /** * Interface for the Action factory function. */ type ActionFactory = { /** * Creates a new unicast action with an optional name. * * `K` is the literal type of the action name and is captured as a phantom * brand so `Action("A")` and `Action("B")` produce structurally-distinct * types. **Note:** when the caller supplies any explicit generic * (`Action
("Name")`), TypeScript fills `K` from its default and the * literal is lost. The Name brand still helps for `Action("Name")` calls * (e.g. lifecycle / no-payload actions) which is the most common source of * foreign-class collisions. * * Omitting the name produces an action whose symbol description has no * suffix. Symbol identity (and therefore dispatch routing) is unaffected * — names are only used for fault reporting and debugger readability. * * @template P The payload type for the action. * @template C The channel type for channeled dispatches. * @template K The literal type of the action name (inferred when no other * generics are supplied; defaults to `string` otherwise). */
(name?: K): HandlerPayload
; /** * Creates a new action with the specified distribution mode. */
(name: K | undefined, distribution: Distribution.Broadcast): BroadcastPayload
;
(name: K | undefined, distribution: Distribution.Multicast): MulticastPayload
;
/**
* Creates an omnicast action from a `Distribution.Omnicast(schema?)`
* marker. The payload type is inferred from the marker's schema rather
* than an explicit generic, keeping the compile-time type and the
* runtime validator in lockstep. The channel type flows from the marker
* when declared via `Distribution.Omnicast (name: K | undefined, distribution: Distribution.Unicast): HandlerPayload ;
(name: K | undefined, distribution: Distribution): HandlerPayload | BroadcastPayload | MulticastPayload ;
};
/**
* Creates a new action with a given payload type, optional channel type, and optional distribution mode.
*
* Actions are strongly typed identifiers used to dispatch and handle state changes.
* By default, actions use `Distribution.Unicast` (local to the defining component).
* Use `Distribution.Broadcast` for actions that need to be shared across components.
*
* When a channel type is specified, the action becomes callable to create channeled dispatches:
* - `Action({ UserId: 5 })` creates a channeled action targeting that specific channel
* - Plain `Action` (uncalled) broadcasts to all handlers
*
* @template P The type of the payload that the action will carry.
* @template C The type of the channel for channeled dispatches (defaults to never).
*
* @example
* ```ts
* export class Actions {
* // Unicast action with no payload
* static Reset = Action("Reset");
*
* // Unicast action with typed payload
* static Increment = Action