import { NodeDefinition, NodeLike, StaticGraphNode, StaticNodeDefinition, StaticNodeType } from '../../types/graph'; /** * An instance of the [[value]] node. * See the [[value]] documentation to find out more. */ export interface ValueNode extends StaticGraphNode<'value', ValueNodeProperties> { } /** * A definition of the [[value]] node. * See the [[value]] documentation to find out more. */ export interface ValueNodeDefinition extends StaticNodeDefinition<'value', ValueNodeProperties> { } export interface ValueNodeProperties { value: T; } /** * The implementation of the [[value]] node. * See the [[value]] documentation to learn more. */ export declare const ValueNodeType: StaticNodeType<'value', ValueNodeProperties>; /** * Creates a new instance of the [[value]] node, which is used for storing raw data and for sending data to other nodes. * * Use [[value]] helper to make new instance of this node. * * This node is serializable and allowed to send over-the-wire to remote instances of muster. * To find out more about node serialization visit the [[serialize]] documentation. Additionally, * check out [[proxy]] and [[remote]] for more information on how remote query execution * works. * * * @example **Creating instances of this node** * ```js * import { value } from '@dws/muster'; * * value('Hello world'); // Create a value node storing a string * value(123); // Create a value node storing a number * value({ hello: 'world' }); // Create a value node storing an object * ``` * * * @example **Sending values to computed nodes** * ```js * import { computed, value } from '@dws/muster'; * * computed( * [value('Hello'), value('world')], * (left, right) => `${left} ${right}`, * ); * ``` * In this example we have created a computed node whose task is to combine two values, left * and right, into one string containing both of these values separated by a space. Note the * value nodes are passed into the dependency section of the computed node. In this example they * serve as static data. One thing to note is that in this example there's one more value node being * implicitly created. Because everything in muster graph must be a node, the return value of the * computed node is converted to a value node. * * More explicit definition of this computed node could look like this: * ```js * import { computed, value } from '@dws/muster'; * * computed( * [value('Hello'), value('world')], * (left, right) => value(`${left} ${right}`), * ); * ``` * To find out more about the [[computed]], visit its documentation. */ export declare function value(data: T): ValueNodeDefinition; export declare function isValueNodeDefinition(value: NodeDefinition): value is ValueNodeDefinition; export declare function toValue(node: T): T; export declare function toValue(node: T): ValueNodeDefinition;