import { ChanneledAction, AnyAction, ReactiveBinding, Schema } from '../types/index.js'; import { ActionId } from '../boundary/components/tasks/types.js'; /** * Extracts the underlying symbol from an action or channeled action. * This symbol is used as the event emitter key for dispatching. * * @param action The action or channeled action to extract the symbol from. * @returns The underlying symbol, or the action itself if it's already a symbol/string. * * @example * ```typescript * const Increment = Action("Increment"); * getActionSymbol(Increment); // Symbol(march-hare.action/Increment) * getActionSymbol(Increment({ UserId: 5 })); // Symbol(march-hare.action/Increment) * ``` */ export declare function getActionSymbol(action: AnyAction): ActionId; /** * Checks whether an action is a broadcast action. * Broadcast actions are sent to all mounted components that have defined a handler for them. * * @param action The action to check. * @returns True if the action is a broadcast action, false otherwise. */ export declare function isBroadcastAction(action: AnyAction): boolean; /** * Checks whether an action is an omnicast action — a broadcast * action declared with `Distribution.Omnicast(schema?)` that additionally * travels between clients when the App is configured with an `sse` * endpoint. * * @param action The action to check. * @returns True if the action is an omnicast action, false otherwise. */ export declare function isOmnicastAction(action: AnyAction): boolean; /** * Reads the runtime schema off an omnicast action; `null` when the action * was declared without a payload or is not an omnicast action at all. * * @param action The action to read the schema from. * @returns The Zod-style schema supplied at declaration time, or `null`. */ export declare function schemaOf(action: AnyAction): null | Schema; /** * Parses an omnicast payload arriving over the wire against the action's * schema, wrapping any validation failure in a {@link Rejected} error * (with the validator's error preserved on `cause`) so faults report * `Reason.Rejected` through the global `Lifecycle.Fault`. Outgoing * dispatches are deliberately not parsed — the payload type is * inferred from the same schema, so the compiler already guarantees the * sender's side; runtime validation is reserved for the trust boundary. * Payloadless actions pass through untouched. * * @param action The omnicast action whose schema applies. * @param payload The untrusted payload to validate. * @returns The parsed payload. */ export declare function validate(action: AnyAction, payload: unknown): unknown; /** * Extracts the action name from an action. * * Parses regular actions (`march-hare.action/Name`), distributed actions * (`march-hare.action/distributed/Name`), and lifecycle actions * (`march-hare.action.lifecycle/Name`) to extract just the name portion. * * @param action The action to extract the name from. * @returns The extracted action name, or "unknown" if parsing fails. * * @example * ```typescript * const Increment = Action("Increment"); * getName(Increment); // "Increment" * * const SignedOut = Action("SignedOut", Distribution.Broadcast); * getName(SignedOut); // "SignedOut" * * const Mount = Lifecycle.Mount(); * getName(Mount); // "Mount" * * const User = Lifecycle.Reactive("User"); * getName(User); // "User" * ``` */ export declare function getName(action: AnyAction): string; /** * Checks if the given action is a channeled action (result of calling `Action(channel)`). * * @param action - The action to check * @returns `true` if the action is a channeled action with a channel property, `false` otherwise * * @example * ```ts * const UserUpdated = Action("UserUpdated"); * * isChanneledAction(UserUpdated); // false * isChanneledAction(UserUpdated({ UserId: 1 })); // true * ``` */ export declare function isChanneledAction(action: AnyAction): action is ChanneledAction; /** * Checks if the given action is a reactive binding (result of calling a * `Lifecycle.Reactive` static with a value). * * @param action - The action to check * @returns `true` if the action is a reactive binding carrying a bound value * * @example * ```ts * const User = Lifecycle.Reactive("User"); * * isReactiveBinding(User); // false * isReactiveBinding(User(user)); // true * ``` */ export declare function isReactiveBinding(action: AnyAction): action is ReactiveBinding; /** * Extracts the lifecycle type from an action's symbol description. * * Returns the lifecycle name (`"Mount"`, `"Paint"`, `"Unmount"`, `"Error"`, * `"Update"`) when the action symbol's description starts with the lifecycle * prefix, or `null` for non-lifecycle actions. * * @param action The action to inspect. * @returns The lifecycle name, or `null` if not a lifecycle action. * * @example * ```typescript * class Actions { * static Mount = Lifecycle.Mount(); * } * * getLifecycleType(Actions.Mount); // "Mount" * getLifecycleType(Action("Increment")); // null * ``` */ export declare function getLifecycleType(action: AnyAction): string | null; /** * Checks whether an action is a multicast action. * Multicast actions are dispatched to all components within a named scope boundary. * * @param action The action to check. * @returns True if the action is a multicast action, false otherwise. */ export declare function isMulticastAction(action: AnyAction): boolean;