import type { ClusterInfo } from '../../store/reducers/cluster/cluster'; import type { PreparedTenant } from '../../store/reducers/tenants/types'; import type { ClusterLink, ClusterLinkWithTitle, DatabaseLink } from '../../types/additionalProps'; import type { MetaClusterLink } from '../../types/api/meta'; /** * Map of namespace prefixes to their source objects for dotted placeholder resolution. * Supports `cluster` and `database` namespaces for URL placeholder substitution. */ export interface SubstitutionNamespaces { cluster?: ClusterInfo; database?: PreparedTenant; } /** * Replaces raw `{param}` / `{prefix.field}` placeholders in a URL template. * * - Flat placeholders like `{balancer}` are resolved via `namespaces[source][balancer]`. * - Dotted placeholders like `{cluster.balancer}` are resolved via `namespaces[cluster][balancer]`. * - Multi-level dotted placeholders like `{cluster.settings.proxy}` are resolved by * traversing nested objects: `namespaces[cluster][settings][proxy]`. * * The first segment of a dotted key is always the namespace prefix. * Traversal stops if any intermediate value is not a plain object * (null, undefined, primitives, and arrays are not traversed). * Lowercase and kebab-case segments are normalised to PascalCase as a fallback * (see {@link resolveParam} for details). * Only string and number leaf values are used for substitution. * Substituted values are treated as URL component values and are encoded with * `encodeURIComponent(value)`, except when the value is a complete URL * (starts with `http://` or `https://`) at the very start of the template. * This allows placeholders like `{balancer}` to be used as full URL bases in * patterns like `{balancer}/path`, while still encoding them everywhere else, * including query strings like `?url={balancer}`. * Returns `undefined` if any placeholder remains unresolved after substitution. */ export declare function substituteUrlParams(template: string, source: string, namespaces?: SubstitutionNamespaces): string | undefined; /** * Builds the final list of cluster links by: * 1. Building legacy links from cores/logging fields in cluster info * 2. Processing dynamic links (type === 'cluster') with URL param substitution * (cluster info is used as the `cluster` namespace for placeholder resolution) * 3. Adding additional links (legacy + user-provided) only for contexts NOT already covered * * Links without both title and context are dropped. * Links whose URL cannot be fully resolved are dropped. */ export declare function resolveClusterLinks(clusterInfo: ClusterInfo, additionalLinks?: ClusterLink[]): ClusterLinkWithTitle[]; /** * Builds the final list of database links by: * 1. Processing dynamic links (type === 'database') with URL param substitution * 2. Adding additional (legacy) links only for contexts NOT already covered * * Uses both database info and cluster info for URL placeholder substitution: * - Flat placeholders like `{name}` resolve from `databaseInfo` (the `database` namespace). * - Dotted placeholders like `{cluster.name}` resolve from `clusterInfo`. * - Dotted placeholders like `{database.name}` resolve from `databaseInfo`. * * Links without a title are dropped. * Links whose URL cannot be fully resolved are dropped. */ export declare function resolveDatabaseLinks(dynamicLinks: MetaClusterLink[] | undefined, databaseInfo: PreparedTenant, clusterInfo?: ClusterInfo, additionalLinks?: DatabaseLink[]): ClusterLinkWithTitle[];