import { NodeDefinition, StaticGraphNode, StaticNodeDefinition, StaticNodeType } from '../../types/graph'; /** * An instance of the [[fetchItems]] node. * See the [[fetchItems]] documentation to find out more. */ export interface FetchItemsNode extends StaticGraphNode<'fetch-items', FetchItemsNodeProperties> { } /** * A definition of the [[fetchItems]] node. * See the [[fetchItems]] documentation to find out more. */ export interface FetchItemsNodeDefinition extends StaticNodeDefinition<'fetch-items', FetchItemsNodeProperties> { } export interface FetchItemsNodeProperties { target: NodeDefinition; } /** * An implementation of the [[fetchItems]] node. * See the [[fetchItems]] documentation to find out more. */ export declare const FetchItemsNodeType: StaticNodeType<'fetch-items', FetchItemsNodeProperties>; /** * Creates a new instance of the [[fetchItems]] node. This node can be used to create collection transform boundaries * by making sure that the transforms sent to the [[fetchItems]] node get run only after the target gets fully resolved. * * * @example **Map transform that returns a computed node** * ```js * import muster, { * applyTransforms, * computed, * entries, * extend, * fetchItems, * fromStreamMiddleware, * get, * key, * map, * query, * proxy, * ref, * } from '@dws/muster'; * * const remoteInstance = muster({ * people: [ * { firstName: 'Bob', lastName: 'Smith' }, * { firstName: 'Jane', lastName: 'Jonson' }, * { firstName: 'Sabine', lastName: 'Summers' }, * ], * }); * * const app = muster({ * remote: proxy([ * fromStreamMiddleware((req) => remoteInstance.resolve(req, { raw: true })), * ]), * peopleWithFullNames: applyTransforms( * fetchItems(ref('remote', 'people')), * [ * map((user) => extend(user, { * fullName: computed( * [get(user, 'firstName'), get(user, 'lastName')], * (first, last) => `${first} ${last}`, * ), * })), * ], * ), * }); * * await app.resolve(query(ref('peopleWithFullNames'), { * fullName: key('fullName') * })); // === [{ fullName: Bob Smith'' }, { fullName: 'Jane Jonson' }, { fullName: 'Sabine Summers' }] * ``` * This example shows how to use a [[fetchItems]] to create a boundary for transforms. Note that the `peopleWithFullNames` * node uses a [[map]] with a [[computed]] node, which can't be serialised and sent over to the remote instance of muster. * For this reason we have to wrap the remote collection in a [[fetchItems]] node. */ export declare function fetchItems(target: NodeDefinition): FetchItemsNodeDefinition; export declare function isFetchItemsNodeDefinition(fetchItems: NodeDefinition): fetchItems is FetchItemsNodeDefinition;