UNPKG

@scayle/storefront-core

Version:

Collection of essential utilities to work with the Storefront API

33 lines (32 loc) 1.73 kB
import type { NavigationAllEndpointResponseData, NavigationTree } from '@scayle/storefront-api'; import type { FetchNavigationTreeByIdParams, FetchNavigationTreeByNameParams, FetchNavigationTreesParams, RpcHandler } from '../../types'; /** * Fetches all navigation trees. * * This function uses the Storefront cache (`cached()`) with a `getAll-navigation-trees` key prefix to improve performance. * Cached entries are returned if found; otherwise, data is fetched and cached. * * @param params The parameters for retrieving all navigation tress. * @param params.params The parameters for fetching navigation trees. * @param context The RPC context. * * @returns The navigation trees data. It will return an `ErrorResponse` * if an error occurs during fetching. */ export declare const fetchAllNavigationTrees: RpcHandler<FetchNavigationTreesParams, NavigationAllEndpointResponseData>; /** * Fetches a navigation tree by its ID. * * This function uses the Storefront cache (`cached()`) with a `getById-navigation-trees-${treeId}` key prefix to improve performance. * Cached entries are returned if found; otherwise, data is fetched and cached. * * @param params The parameters for retrieving a navigation tree by its ID. * @param params.treeId The ID of the navigation tree. * @param params.params The parameters for fetching navigation trees. * @param context The RPC context. * * @returns The navigation tree data. It will return an `ErrorResponse` * if an error occurs during fetching. */ export declare const fetchNavigationTreeById: RpcHandler<FetchNavigationTreeByIdParams, NavigationTree>; export declare const fetchNavigationTreeByName: RpcHandler<FetchNavigationTreeByNameParams, NavigationTree>;