import { NodeDefinition, StatelessGraphNode, StatelessNodeDefinition, StatelessNodeType } from '../../types/graph'; /** * An instance of the [[head]] node. * See the [[head]] documentation to find out more. */ export interface HeadNode extends StatelessGraphNode<'head', HeadNodeProperties> { } /** * A definition of the [[head]] node. * See the [[head]] documentation to find out more. */ export interface HeadNodeDefinition extends StatelessNodeDefinition<'head', HeadNodeProperties> { } export interface HeadNodeProperties { target: NodeDefinition; } /** * The implementation of the [[head]] node. * See the [[head]] documentation to learn more. */ export declare const HeadNodeType: StatelessNodeType<'head', HeadNodeProperties>; /** * Creates a new instance of a [[head]] node, which is a type of a [[NodeDefinition]] used by the [[get]] * when extracting the first item from the collection. * It serves as a helper node that generates a [[firstItem]] transform and applies that to the target collection. * This node resolves to a single [[NodeDefinition]] or a [[nil]] when the collection is found to be empty. * * @example **Take first item from the collection** * ```js * import muster, { head, ref } from '@dws/muster'; * * const app = muster({ * numbers: [1, 2, 3, 4], * }); * * await app.resolve(head(ref('numbers'))); * // === 1 * ``` * This example shows how to use the [[head]] node to extract the first item from the [[array]]. */ export declare function head(target: NodeDefinition): HeadNodeDefinition;