import type { UComponent, UElement, UNode, UniversalProps } from "@alkdev/ujsx"; import type { PropValue } from "@alkdev/ujsx"; export interface OperationProps extends UniversalProps { name: string; input?: PropValue; retries?: number; timeout?: number; } export const Operation: UComponent = ( props: OperationProps & { children?: UNode[] }, ): UElement => { const { name, input, retries, timeout, children, ...rest } = props; const elementProps: UniversalProps = { ...rest, name }; if (input !== undefined) { elementProps.input = input; } if (retries !== undefined) { elementProps.retries = retries; } if (timeout !== undefined) { elementProps.timeout = timeout; } return { type: "operation", props: elementProps, children: [], }; }; Operation.displayName = "Operation";