import { StatelessGraphNode, StatelessNodeDefinition, StatelessNodeType } from '../../../types/graph'; /** * An instance of the [[firstItem]] node. * See the [[firstItem]] documentation to find out more. */ export interface FirstItemNode extends StatelessGraphNode<'firstItem', FirstItemNodeProperties> { } /** * A definition of the [[firstItem]] node. * See the [[firstItem]] documentation to find out more. */ export interface FirstItemNodeDefinition extends StatelessNodeDefinition<'firstItem', FirstItemNodeProperties> { } export interface FirstItemNodeProperties { } /** * The implementation of the [[firstItem]] node. * See the [[firstItem]] documentation to learn more. */ export declare const FirstItemNodeType: StatelessNodeType<'firstItem', FirstItemNodeProperties>; /** * Creates a new instance of a [[firstItem]] node, which is a type of collection transform used * when taking the first item out of a collection. * This node serves as a fast implementation of the `take(1)`. It also comes with a shorthand * version to be used in the [ref](_utils_ref_.html#ref). See the **References to items in collections** example * from the [ref](_utils_ref_.html#ref) documentation. * * * @example **Take first item (using transform)** * ```js * import muster, { entries, firstItem, query, ref, withTransforms } from '@dws/muster'; * * const app = muster({ * numbers: [1, 2, 3, 4, 5], * }); * * const item = await app.resolve(query(ref('numbers'), withTransforms([ * firstItem(), * ], entries()))); * // item === [1] * ``` * This example shows how to use a [[firstItem]] transform to take the first item out of a * collection. */ export declare function firstItem(): FirstItemNodeDefinition;