import { NodeDefinition, NodeLike, StatelessGraphNode, StatelessNodeDefinition, StatelessNodeType } from '../../types/graph'; /** * An instance of the [[series]] node. * See the [[series]] documentation to find out more. */ export interface SeriesNode extends StatelessGraphNode<'series', SeriesNodeProperties> { } /** * A definition of the [[series]] node. * See the [[series]] documentation to find out more. */ export interface SeriesNodeDefinition extends StatelessNodeDefinition<'series', SeriesNodeProperties> { } export interface SeriesNodeProperties { operations: Array; } /** * The implementation of the [[series]] node. * See the [[series]] documentation to learn more. */ export declare const SeriesNodeType: StatelessNodeType<'series', SeriesNodeProperties>; /** * Creates a new instance of a [[series]] node, which is used when you need to resolve a series of nodes. You can think * of this node as of a list of statements to be executed, and the last statement being a `return` * statement. The statements are executed one after another. * * * @example **Resolve a series** * ```js * import muster, { series, set, value, variable } from '@dws/muster'; * * const app = muster({ * name: variable('initial name'), * description: variable('initial description'), * }); * * const result = await app.resolve(series([ * set('name', 'updated name'), * set('description', 'updated description'), * value(true), * ])); * // result === true * ``` * This example shows how to use the [[series]] to combine multiple operations. One thing to * remember is that the operations are executed in order so one failing operation will prevent * those following from running. * * * @example **Failing operation in the series** * ```js * import muster, { computed, error, ref, series } from '@dws/muster'; * * const app = muster({ * first: computed([], () => { * console.log('Computing first'); * return 1; * }), * second: computed([], () => { * console.log('Computing second'); * throw new Error('Boom!'); * }), * third: computed([], () => { * console.log('Computing third'); * return 3; * }), * }); * * const result = await app.resolve(series([ * ref('first'), * ref('second'), * ref('third'), * ])); * // result === 'Boom!' * * // Console output: * // Computing first * // Computing second * ``` * This example shows what happens with the [[series]] when one of the nodes in the series * returns an error. From the console output you can deduce that the `third` node is never * resolved. */ export declare function series(operations: Array): SeriesNodeDefinition; export declare function isSeriesNodeDefinition(value: NodeDefinition): value is SeriesNodeDefinition;