import { NodeDefinition, StatelessGraphNode, StatelessNodeDefinition, StatelessNodeType } from '../../types/graph'; import { OtherwiseNodeDefinition } from './otherwise'; import { WhenNodeDefinition } from './when'; /** * An instance of the [[choose]] node. * See the [[choose]] documentation to find out more. */ export interface ChooseNode extends StatelessGraphNode<'choose', ChooseNodeProperties> { } /** * A definition of the [[choose]] node. * See the [[choose]] documentation to find out more. */ export interface ChooseNodeDefinition extends StatelessNodeDefinition<'choose', ChooseNodeProperties> { } export interface ChooseNodeProperties { options: Array; fallback: OtherwiseNodeDefinition; } /** * The implementation of the [[choose]] node. * See the [[choose]] documentation to learn more. */ export declare const ChooseNodeType: StatelessNodeType<'choose', ChooseNodeProperties>; /** * Creates a new instance of a [[choose]] node, which is used to conditionally return a different value. It works in a similar * way to the [[ifElse]] node, but allows for a more concise definition when defining * more than one condition. * * The conditions are defined with the help of [[case]] and [[otherwise]] nodes. * Each [[switchOn]] can define any number of [[case]] cases, and MUST define exactly one [[otherwise]] node. * * * @example **Simple choose node** * ```js * import muster, { * eq, * choose, * gt, * otherwise, * ref, * variable, * when, * } from '@dws/muster'; * * const app = muster({ * input: variable(10), * something: choose([ * when(eq(ref('input'), 10), 'It\'s ten!'), * when(gt(ref('input'), 32), 'More than 32'), * otherwise('Well, it\'s not ten and not more than 32'), * ]), * }); * * await app.resolve(ref('something')); // === It's ten! * ``` */ export declare function choose(cases: Array): ChooseNodeDefinition; export declare function isChooseNodeDefinition(value: NodeDefinition): value is ChooseNodeDefinition;