import { NodeDefinition, NodeLike, StatelessGraphNode, StatelessNodeDefinition, StatelessNodeType } from '../../types/graph'; /** * An instance of the [[property]] node. * See the [[property]] documentation to find out more. */ export interface PropertyNode extends StatelessGraphNode<'property', PropertyNodeProperties> { } /** * A definition of the [[property]] node. * See the [[property]] documentation to find out more. */ export interface PropertyNodeDefinition extends StatelessNodeDefinition<'property', PropertyNodeProperties> { } export interface PropertyNodeProperties { subject: NodeDefinition; path: Array; } /** * The implementation of the [[property]] node. * See the [[property]] documentation to learn more. */ export declare const PropertyNodeType: StatelessNodeType<'property', PropertyNodeProperties>; /** * Creates a new instance of a [[property]] node, which is used when extracting a value of a property from a pure JS object. * It works in the same way as `get` from `lodash`. * * * @example **Extract property from an object** * ```js * import muster, { property, value } from '@dws/muster'; * * const app = muster({}); * * await app.resolve( * property( * value({ name: 'Bob', description: 'Some description' }), * 'name' * ), * ); * // === 'Bob' * ``` * This example shows how to use the [[property]] to extract the value of a property from a pure JS object. * * * @example **Extract nested property from an object** * ```js * import muster, { property, value } from '@dws/muster'; * * const app = muster({}); * * await app.resolve( * property( * value({ * deeply: { * nested: { name: 'Bob', description: 'Some description' }, * }, * }), * ['deeply', 'nested', 'name'] * ), * ); * // === 'Bob' * ``` * This example shows how to use the [[property]] to extract the value of a deeply nested property from a pure JS object. * * * @example **Extract property from a node in the graph** * ```js * import muster, { property, ref, value } from '@dws/muster'; * * const app = muster({ * user: value({ * name: 'Bob', * description: 'Some description', * }), * }); * * await app.resolve(property(ref('user'), 'name')); * // === 'Bob' * ``` * This example shows that the [[property]] can operate on any kind of node that resolves to a [[value]]. */ export declare function property(subject: NodeDefinition | NodeLike, path: string | Array): PropertyNodeDefinition; export declare function isPropertyNodeDefinition(value: NodeDefinition): value is PropertyNodeDefinition;