@veap/plugins collects navigation entries from enabled plugins, filters them by the current user's roles/permissions, and exposes them for public, admin (/app) and settings surfaces. It also builds breadcrumbs from the route tree.
Navigation model#
PluginNavigation is the shape a plugin returns from IPlugin.navigation:
navigation: {
public: [{ title: "Blog", url: "/blog", priority: 10 }],
admin: {
Content: { title: "Content", priority: 20, items: [{ title: "Posts", url: "/blog" }] },
},
settings: { /* group map */ },
}PluginNavElement/SidebarMenuItemType:id?,title,icon?,url,roles?,permissions?,priority?,badge?,badgeVariant?, nesteditems?.PluginNavigationGroupDefinition:{ title?, priority?, items }.PluginNavigationGroupMap:Record<string, PluginNavElement[] | PluginNavigationGroupDefinition>.SidebarGroupType/SidebarMenuTypedescribe grouped sidebar structures.
Items without priority sort as 100.
NavigationService#
@Injectable() service constructed with @Inject(PluginRegistry) and @Inject(VEAP_CONFIG).
| Method | Behavior |
|---|---|
getPathPrefix() | The configured privatePath, default "/app". |
getNavigationGrouped(type) | Returns { groups, groupPriorities } for "admin" or "settings", filtered by the current user and de-duplicated by url. |
getVeapNavigationGrouped(type) | Same data with each url prefixed by getPathPrefix() and groups sorted by priority then name. |
getPublicNavigation() | Public items across plugins, filtered by user, sorted by priority then title. |
Filtering: an item with roles requires any match; with permissions it requires all matches; nested items are filtered recursively.
Module-level functions#
The navigation module also exports composition-bound helpers (they read the bound plugins context):
| Function | Equivalent |
|---|---|
getPathPrefix() | navigation.getPathPrefix() |
getPluginPathPrefix() | alias of getPathPrefix() |
getPluginNavigationGrouped(type) | navigation.getNavigationGrouped(type) |
getVeapPluginNavigationGrouped(type) | navigation.getVeapNavigationGrouped(type) |
getPluginNavigation(type = "public") | navigation.getPublicNavigation() |
getPluginBreadcrumbs(path, searchParams?) | See below |
From @veap/plugins/server, these are also re-exported as getPublicNavigation, getBreadcrumbs and getVeapModuleNavigationGrouped compatibility aliases.
Breadcrumbs#
getPluginBreadcrumbs(path, searchParams = {}) (exported as getBreadcrumbs from /server) walks each path segment, matches the route tree, and:
- uses the matched node's
breadcrumbvalue when it is an exact match (stringor a function returning a label /BreadcrumbItem/BreadcrumbItem[]), - otherwise falls back to the matching navigation item's
title.
It de-duplicates by href, keeps the last value for a repeated href, and drops items without a label. BreadcrumbItem is { label, href?, id? }; BreadcrumbValue is a string or a resolver function receiving PluginPageProps.
The module is marked "use server".
Payload/page types#
PluginPageProps:{ params, searchParams, context? }— the props virtual pages receive.VeapMiddlewareContext:{ params, searchParams, path, roles?, permissions?, ... }— the context passed through middleware and into pages.