import { GraphAction, GraphNode, NodeDefinition, NodeLike, StatefulGraphNode, StatefulNodeDefinition, StatefulNodeType } from '../../types/graph'; /** * An instance of the [[removeItemAt]] node. * See the [[removeItemAt]] documentation to find out more. */ export interface RemoveItemAtNode extends StatefulGraphNode<'remove-item-at', RemoveItemAtNodeProperties> { } /** * A definition of the [[removeItemAt]] node. * See the [[removeItemAt]] documentation to find out more. */ export interface RemoveItemAtNodeDefinition extends StatefulNodeDefinition<'remove-item-at', RemoveItemAtNodeProperties> { } export interface RemoveItemAtNodeProperties { index: NodeDefinition; target: NodeDefinition; } export interface RemoveItemAtNodeState { memoized: (targetNode: GraphNode, index: number) => GraphAction; } /** * The implementation of the [[removeItemAt]]. * See the [[removeItemAt]] documentation for more information. */ export declare const RemoveItemAtNodeType: StatefulNodeType<'remove-item-at', RemoveItemAtNodeProperties, RemoveItemAtNodeState, {}>; /** * Creates an instance of an [[remoteItemAt]] node, which is a type of a graph node used when inserting an item into * a mutable collection at a specific index. * * * @example **Remove a number from a mutable collection** * ```js * import muster, { arrayList, entries, query, ref, removeItemAt } from '@dws/muster'; * * const app = muster({ * numbers: arrayList([1, 2, 3]), * }); * * app.resolve(query(ref('numbers'), entries())).subscribe((value) => { * console.log(value); * }); * * await app.resolve(removeItemAt(ref('numbers'), 1)); * * // Console output: * // [1, 2, 3] * // [1, 3] * ``` * This example shows how to remove item at a specific index from a mutable collection. * * * @example **Remove a branch from a mutable collection** * ```js * import muster, { arrayList, entries, key, query, ref, removeItemAt, toNode } from '@dws/muster'; * * const app = muster({ * people: arrayList([ * { firstName: 'Lizzie', lastName: 'Ramirez' }, * { firstName: 'Charlotte', lastName: 'Schneider' }, * ]), * }); * * app.resolve(query(ref('people'), entries({ * firstName: key('firstName'), * }))).subscribe((value) => { * console.log(value); * }); * * await app.resolve( * removeItemAt(ref('people'), 1), * ); * * // Console output: * // [{ firstName: 'Lizzie' }, { firstName: 'Charlotte' }] * // [{ firstName: 'Lizzie' }] * ``` * This example shows how to remove a branch at a specific index from a mutable collection. */ export declare function removeItemAt(target: NodeDefinition, index: NodeLike): RemoveItemAtNodeDefinition;