import * as react_jsx_runtime from 'react/jsx-runtime'; import * as react from 'react'; import { ReactNode, JSX as JSX$1, ComponentType, PropsWithChildren } from 'react'; import * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api'; import { I as IconElement, R as RouteRef, A as AnyRouteRefParams, S as SubRouteRef, E as ExternalRouteRef, F as FrontendFeature, a as IconComponent, b as AppNode, c as FrontendPlugin, d as ApiRef, e as ApiHolder, T as TypesToApiRefs, f as ApiFactory, g as AnyApiFactory } from './types/alpha.d-D3gnSOzm.js'; export { h as AnyApiRef, i as AppNodeEdges, j as AppNodeInstance, k as AppNodeSpec, l as AppTree, m as AppTreeApi, C as ConfigurableExtensionDataRef, n as CreateExtensionBlueprintOptions, o as CreateExtensionOptions, p as CreateFrontendModuleOptions, q as CreateFrontendPluginOptions, r as Extension, s as ExtensionAttachTo, t as ExtensionBlueprint, u as ExtensionBlueprintDefineParams, v as ExtensionBlueprintParameters, w as ExtensionBlueprintParams, x as ExtensionDataContainer, y as ExtensionDataRef, z as ExtensionDataValue, B as ExtensionDefinition, D as ExtensionDefinitionAttachTo, G as ExtensionDefinitionParameters, H as ExtensionFactoryMiddleware, J as ExtensionInput, K as FeatureFlagConfig, L as FrontendModule, M as FrontendPluginInfo, N as FrontendPluginInfoOptions, O as OverridableExtensionDefinition, P as OverridableFrontendPlugin, Q as PluginOptions, U as PluginWrapperApi, V as PluginWrapperBlueprint, W as PluginWrapperDefinition, X as PortableSchema, Y as appTreeApiRef, Z as createExtension, _ as createExtensionBlueprint, $ as createExtensionBlueprintParams, a0 as createExtensionDataRef, a1 as createExtensionInput, a2 as createExternalRouteRef, a3 as createFrontendModule, a4 as createFrontendPlugin, a5 as createRouteRef, a6 as createSubRouteRef, a7 as pluginWrapperApiRef } from './types/alpha.d-D3gnSOzm.js'; import { Observable, JsonValue, Expand, ExpandRecursive } from '@backstage/types'; import { Config } from '@backstage/config'; export { StandardSchemaV1 } from '@standard-schema/spec'; import '@backstage/filter-predicates'; import 'zod/v3'; /** * Analytics context envelope. * * @public */ interface AnalyticsContextValue { /** * The nearest known parent plugin where the event was captured. */ pluginId: string; /** * The nearest known parent extension where the event was captured. */ extensionId: string; [key: string]: string | boolean | number | undefined; } /** * Provides components in the child react tree an Analytics Context, ensuring * all analytics events captured within the context have relevant attributes. * * @remarks * * Analytics contexts are additive, meaning the context ultimately emitted with * an event is the combination of all contexts in the parent tree. * * @public */ declare const AnalyticsContext: (options: { attributes: Partial; children: ReactNode; }) => react_jsx_runtime.JSX.Element; /** @public */ declare const coreExtensionData: { title: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef; /** An icon element for the extension. Should be exactly 24x24 pixels. */ icon: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef; reactElement: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef; routePath: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef; routeRef: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef, "core.routing.ref", {}>; }; /** * React hook for constructing URLs to routes. * * @remarks * * See {@link https://backstage.io/docs/plugins/composability#routing-system} * * @param routeRef - The ref to route that should be converted to URL. * @returns A function that will in turn return the concrete URL of the `routeRef`, or `undefined` if the route is not available. * @public */ declare function useRouteRef(routeRef: RouteRef | SubRouteRef | ExternalRouteRef): RouteFunc | undefined; /** * React hook for retrieving dynamic params from the current URL. * @param _routeRef - Ref of the current route. * @public */ declare function useRouteRefParams(_routeRef: RouteRef | SubRouteRef): Params; /** @public */ interface CreateFrontendFeatureLoaderOptions { loader(deps: { config: ConfigApi; }): Iterable> | Promise>> | AsyncIterable; } /** @public */ interface FrontendFeatureLoader { readonly $$type: '@backstage/FrontendFeatureLoader'; } /** @public */ declare function createFrontendFeatureLoader(options: CreateFrontendFeatureLoaderOptions): FrontendFeatureLoader; /** * This file contains declarations for common interfaces of auth-related APIs. * The declarations should be used to signal which type of authentication and * authorization methods each separate auth provider supports. * * For example, a Google OAuth provider that supports OAuth 2 and OpenID Connect, * would be declared as follows: * * const googleAuthApiRef = createApiRef().with({ * id: 'core.auth.google', * pluginId: 'app', * }) */ /** * Information about the auth provider. * * @remarks * * This information is used both to connect the correct auth provider in the backend, as * well as displaying the provider to the user. * * @public */ type AuthProviderInfo = { /** * The ID of the auth provider. This should match with ID of the provider in the `@backstage/auth-backend`. */ id: string; /** * Title for the auth provider, for example "GitHub" */ title: string; /** * Icon for the auth provider. * * @remarks * * Accepts either an `IconElement` (e.g. ``) or an `IconComponent` * (e.g. `MyIcon`). Prefer passing `IconElement`. */ icon: IconComponent | IconElement; /** * Optional user friendly messaage to display for the auth provider. */ message?: string; }; /** * An array of scopes, or a scope string formatted according to the * auth provider, which is typically a space separated list. * * @remarks * * See the documentation for each auth provider for the list of scopes * supported by each provider. * * @public */ type OAuthScope = string | string[]; /** * Configuration of an authentication request. * * @public */ type AuthRequestOptions = { /** * If this is set to true, the user will not be prompted to log in, * and an empty response will be returned if there is no existing session. * * This can be used to perform a check whether the user is logged in, or if you don't * want to force a user to be logged in, but provide functionality if they already are. * * @defaultValue false */ optional?: boolean; /** * If this is set to true, the request will bypass the regular oauth login modal * and open the login popup directly. * * The method must be called synchronously from a user action for this to work in all browsers. * * @defaultValue false */ instantPopup?: boolean; }; /** * This API provides access to OAuth 2 credentials. It lets you request access tokens, * which can be used to act on behalf of the user when talking to APIs. * * @public */ type OAuthApi = { /** * Requests an OAuth 2 Access Token, optionally with a set of scopes. The access token allows * you to make requests on behalf of the user, and the copes may grant you broader access, depending * on the auth provider. * * Each auth provider has separate handling of scope, so you need to look at the documentation * for each one to know what scope you need to request. * * This method is cheap and should be called each time an access token is used. Do not for example * store the access token in React component state, as that could cause the token to expire. Instead * fetch a new access token for each request. * * Be sure to include all required scopes when requesting an access token. When testing your implementation * it is best to log out the Backstage session and then visit your plugin page directly, as * you might already have some required scopes in your existing session. Not requesting the correct * scopes can lead to 403 or other authorization errors, which can be tricky to debug. * * If the user has not yet granted access to the provider and the set of requested scopes, the user * will be prompted to log in. The returned promise will not resolve until the user has * successfully logged in. The returned promise can be rejected, but only if the user rejects the login request. */ getAccessToken(scope?: OAuthScope, options?: AuthRequestOptions): Promise; }; /** * This API provides access to OpenID Connect credentials. It lets you request ID tokens, * which can be passed to backend services to prove the user's identity. * * @public */ type OpenIdConnectApi = { /** * Requests an OpenID Connect ID Token. * * This method is cheap and should be called each time an ID token is used. Do not for example * store the id token in React component state, as that could cause the token to expire. Instead * fetch a new id token for each request. * * If the user has not yet logged in to Google inside Backstage, the user will be prompted * to log in. The returned promise will not resolve until the user has successfully logged in. * The returned promise can be rejected, but only if the user rejects the login request. */ getIdToken(options?: AuthRequestOptions): Promise; }; /** * This API provides access to profile information of the user from an auth provider. * * @public */ type ProfileInfoApi = { /** * Get profile information for the user as supplied by this auth provider. * * If the optional flag is not set, a session is guaranteed to be returned, while if * the optional flag is set, the session may be undefined. See {@link AuthRequestOptions} for more details. */ getProfile(options?: AuthRequestOptions): Promise; }; /** * This API provides access to the user's identity within Backstage. * * @remarks * * An auth provider that implements this interface can be used to sign-in to backstage. It is * not intended to be used directly from a plugin, but instead serves as a connection between * this authentication method and the app's {@link IdentityApi} * * @public */ type BackstageIdentityApi = { /** * Get the user's identity within Backstage. This should normally not be called directly, * use the {@link IdentityApi} instead. * * If the optional flag is not set, a session is guaranteed to be returned, while if * the optional flag is set, the session may be undefined. See {@link AuthRequestOptions} for more details. */ getBackstageIdentity(options?: AuthRequestOptions): Promise; }; /** * User identity information within Backstage. * * @public */ type BackstageUserIdentity = { /** * The type of identity that this structure represents. In the frontend app * this will currently always be 'user'. */ type: 'user'; /** * The entityRef of the user in the catalog. * For example User:default/sandra */ userEntityRef: string; /** * The user and group entities that the user claims ownership through */ ownershipEntityRefs: string[]; }; /** * Token and Identity response, with the users claims in the Identity. * * @public */ type BackstageIdentityResponse = { /** * The token used to authenticate the user within Backstage. */ token: string; /** * The time at which the token expires. If not set, it can be assumed that the token does not expire. */ expiresAt?: Date; /** * Identity information derived from the token. */ identity: BackstageUserIdentity; }; /** * Profile information of the user. * * @public */ type ProfileInfo = { /** * Email ID. */ email?: string; /** * Display name that can be presented to the user. */ displayName?: string; /** * URL to an avatar image of the user. */ picture?: string; }; /** * Session state values passed to subscribers of the SessionApi. * * @public */ declare const SessionState: { /** * User signed in. */ readonly SignedIn: "SignedIn"; /** * User not signed in. */ readonly SignedOut: "SignedOut"; }; /** * @public */ type SessionState = (typeof SessionState)[keyof typeof SessionState]; /** * @public */ declare namespace SessionState { type SignedIn = typeof SessionState.SignedIn; type SignedOut = typeof SessionState.SignedOut; } /** * The SessionApi provides basic controls for any auth provider that is tied to a persistent session. * * @public */ type SessionApi = { /** * Sign in with a minimum set of permissions. */ signIn(): Promise; /** * Sign out from the current session. This will reload the page. */ signOut(): Promise; /** * Observe the current state of the auth session. Emits the current state on subscription. */ sessionState$(): Observable; }; /** * Provides authentication towards Google APIs and identities. * * @public * @remarks * * See {@link https://developers.google.com/identity/protocols/googlescopes} for a full list of supported scopes. * * Note that the ID token payload is only guaranteed to contain the user's numerical Google ID, * email and expiration information. Do not rely on any other fields, as they might not be present. */ declare const googleAuthApiRef: _backstage_frontend_plugin_api.ApiRef & { readonly $$type: "@backstage/ApiRef"; }; /** * Provides authentication towards GitHub APIs. * * @public * @remarks * * See {@link https://developer.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/} * for a full list of supported scopes. */ declare const githubAuthApiRef: _backstage_frontend_plugin_api.ApiRef & { readonly $$type: "@backstage/ApiRef"; }; /** * Provides authentication towards Okta APIs. * * @public * @remarks * * See {@link https://developer.okta.com/docs/guides/implement-oauth-for-okta/scopes/} * for a full list of supported scopes. */ declare const oktaAuthApiRef: _backstage_frontend_plugin_api.ApiRef & { readonly $$type: "@backstage/ApiRef"; }; /** * Provides authentication towards GitLab APIs. * * @public * @remarks * * See {@link https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html#limiting-scopes-of-a-personal-access-token} * for a full list of supported scopes. */ declare const gitlabAuthApiRef: _backstage_frontend_plugin_api.ApiRef & { readonly $$type: "@backstage/ApiRef"; }; /** * Provides authentication towards Microsoft APIs and identities. * * @public * @remarks * * For more info and a full list of supported scopes, see: * - {@link https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-permissions-and-consent} * - {@link https://docs.microsoft.com/en-us/graph/permissions-reference} */ declare const microsoftAuthApiRef: _backstage_frontend_plugin_api.ApiRef & { readonly $$type: "@backstage/ApiRef"; }; /** * Provides authentication towards OneLogin APIs. * * @public */ declare const oneloginAuthApiRef: _backstage_frontend_plugin_api.ApiRef & { readonly $$type: "@backstage/ApiRef"; }; /** * Provides authentication towards Bitbucket APIs. * * @public * @remarks * * See {@link https://support.atlassian.com/bitbucket-cloud/docs/use-oauth-on-bitbucket-cloud/} * for a full list of supported scopes. */ declare const bitbucketAuthApiRef: _backstage_frontend_plugin_api.ApiRef & { readonly $$type: "@backstage/ApiRef"; }; /** * Provides authentication towards Bitbucket Server APIs. * * @public * @remarks * * See {@link https://confluence.atlassian.com/bitbucketserver/bitbucket-oauth-2-0-provider-api-1108483661.html#BitbucketOAuth2.0providerAPI-scopes} * for a full list of supported scopes. */ declare const bitbucketServerAuthApiRef: _backstage_frontend_plugin_api.ApiRef & { readonly $$type: "@backstage/ApiRef"; }; /** * Provides authentication towards Atlassian APIs. * * @public * @remarks * * See {@link https://developer.atlassian.com/cloud/jira/platform/scopes-for-connect-and-oauth-2-3LO-apps/} * for a full list of supported scopes. */ declare const atlassianAuthApiRef: _backstage_frontend_plugin_api.ApiRef & { readonly $$type: "@backstage/ApiRef"; }; /** * Provides authentication towards VMware Cloud APIs and identities. * * @public * @remarks * * For more info about VMware Cloud identity and access management: * - {@link https://docs.vmware.com/en/VMware-Cloud-services/services/Using-VMware-Cloud-Services/GUID-53D39337-D93A-4B84-BD18-DDF43C21479A.html} */ declare const vmwareCloudAuthApiRef: _backstage_frontend_plugin_api.ApiRef & { readonly $$type: "@backstage/ApiRef"; }; /** * Provides authentication towards OpenShift APIs and identities. * * @public * @remarks * * See {@link https://docs.redhat.com/en/documentation/openshift_container_platform/latest/html/authentication_and_authorization/configuring-oauth-clients} * on how to configure the OAuth clients and * {@link https://docs.redhat.com/en/documentation/openshift_container_platform/latest/html-single/authentication_and_authorization/index#tokens-scoping-about_configuring-internal-oauth} * for available scopes. */ declare const openshiftAuthApiRef: _backstage_frontend_plugin_api.ApiRef & { readonly $$type: "@backstage/ApiRef"; }; /** * Message handled by the {@link AlertApi}. * * @public * @deprecated Use {@link ToastApiMessage} from {@link ToastApi} instead. AlertApi will be removed in a future release. * * Migration guide: * - `message` becomes `title` * - `severity: 'error'` becomes `status: 'danger'` * - `severity: 'success' | 'info' | 'warning'` becomes `status: 'success' | 'info' | 'warning'` * - `display: 'transient'` becomes `timeout: 5000` (or custom milliseconds) * - `display: 'permanent'` means omitting `timeout` */ type AlertMessage = { message: string; severity?: 'success' | 'info' | 'warning' | 'error'; display?: 'permanent' | 'transient'; }; /** * The alert API is used to report alerts to the app, and display them to the user. * * @public * @deprecated Use {@link ToastApi} instead. AlertApi will be removed in a future release. * * ToastApi provides richer notification features including: * - Title and optional description * - Action links * - Custom icons * - Per-toast timeout control * - Programmatic dismiss via returned key * * @example * ```typescript * // Before (AlertApi) * alertApi.post({ message: 'Saved!', severity: 'success', display: 'transient' }); * * // After (ToastApi) * toastApi.post({ title: 'Saved!', status: 'success', timeout: 5000 }); * ``` */ type AlertApi = { /** * Post an alert for handling by the application. */ post(alert: AlertMessage): void; /** * Observe alerts posted by other parts of the application. */ alert$(): Observable; }; /** * The {@link ApiRef} of {@link AlertApi}. * * @public * @deprecated Use {@link toastApiRef} instead. AlertApi will be removed in a future release. */ declare const alertApiRef: _backstage_frontend_plugin_api.ApiRef & { readonly $$type: "@backstage/ApiRef"; }; /** @public */ type AppLanguageApi = { getAvailableLanguages(): { languages: string[]; }; setLanguage(language?: string): void; getLanguage(): { language: string; }; language$(): Observable<{ language: string; }>; }; /** * @public */ declare const appLanguageApiRef: _backstage_frontend_plugin_api.ApiRef & { readonly $$type: "@backstage/ApiRef"; }; /** * Describes a theme provided by the app. * * @public */ type AppTheme = { /** * ID used to remember theme selections. */ id: string; /** * Title of the theme */ title: string; /** * Theme variant */ variant: 'light' | 'dark'; /** * An Icon for the theme mode setting. */ icon?: React.ReactElement; Provider(props: { children: ReactNode; }): JSX.Element | null; }; /** * The AppThemeApi gives access to the current app theme, and allows switching * to other options that have been registered as a part of the App. * * @public */ type AppThemeApi = { /** * Get a list of available themes. */ getInstalledThemes(): AppTheme[]; /** * Observe the currently selected theme. A value of undefined means no specific theme has been selected. */ activeThemeId$(): Observable; /** * Get the current theme ID. Returns undefined if no specific theme is selected. */ getActiveThemeId(): string | undefined; /** * Set a specific theme to use in the app, overriding the default theme selection. * * Clear the selection by passing in undefined. */ setActiveThemeId(themeId?: string): void; }; /** * The {@link ApiRef} of {@link AppThemeApi}. * * @public */ declare const appThemeApiRef: _backstage_frontend_plugin_api.ApiRef & { readonly $$type: "@backstage/ApiRef"; }; /** @public */ interface ExtensionBoundaryProps { errorPresentation?: 'error-api' | 'error-display'; node: AppNode; children: ReactNode; } /** @public */ declare function ExtensionBoundary(props: ExtensionBoundaryProps): react_jsx_runtime.JSX.Element; /** @public */ declare namespace ExtensionBoundary { function lazy(appNode: AppNode, loader: () => Promise): JSX.Element; function lazyComponent(appNode: AppNode, loader: () => Promise<(props: TProps) => JSX.Element>): (props: TProps) => JSX.Element; } /** @public */ type SwappableComponentRef = { id: string; TProps: TInnerComponentProps; TExternalProps: TExternalComponentProps; $$type: '@backstage/SwappableComponentRef'; }; /** * Options for creating an SwappableComponent. * * @public */ type CreateSwappableComponentOptions = { id: string; loader?: (() => (props: TInnerComponentProps) => JSX.Element | null) | (() => Promise<(props: TInnerComponentProps) => JSX.Element | null>); transformProps?: (props: TExternalComponentProps) => TInnerComponentProps; }; /** * Creates a SwappableComponent that can be used to render the component, optionally overridden by the app. * * @public */ declare function createSwappableComponent(options: CreateSwappableComponentOptions): { (props: TExternalComponentProps): JSX.Element | null; ref: SwappableComponentRef; }; /** * React hook providing access to the current {@link AppNode}. * * @public * @remarks * * This hook will return the {@link AppNode} for the closest extension. This * relies on the extension using the {@link (ExtensionBoundary:function)} component in its * implementation, which is included by default for all common blueprints. * * If the current component is not inside an {@link (ExtensionBoundary:function)}, it will * return `undefined`. */ declare function useAppNode(): AppNode | undefined; /** @public */ type ProgressProps = {}; /** @public */ type NotFoundErrorPageProps = { children?: ReactNode; }; /** @public */ type ErrorDisplayProps = { plugin?: FrontendPlugin; error: Error; resetError: () => void; }; /** * @public */ declare const Progress: { (props: ProgressProps): JSX.Element | null; ref: _backstage_frontend_plugin_api.SwappableComponentRef; }; /** * @public */ declare const NotFoundErrorPage: { (props: NotFoundErrorPageProps): JSX.Element | null; ref: _backstage_frontend_plugin_api.SwappableComponentRef; }; /** * @public */ declare const ErrorDisplay: { (props: ErrorDisplayProps): JSX.Element | null; ref: _backstage_frontend_plugin_api.SwappableComponentRef; }; /** * Tab configuration for page navigation * @public */ interface PageLayoutTab { id: string; label: string; icon?: IconElement; href: string; } /** * @deprecated Use {@link PageLayoutTab} instead * @public */ type PageTab = PageLayoutTab; /** * Props for the PageLayout component * @public */ interface PageLayoutProps { title?: string; icon?: IconElement; noHeader?: boolean; titleLink?: string; headerActions?: Array; tabs?: PageLayoutTab[]; children?: ReactNode; } /** * Swappable component for laying out page content with header and navigation. * The default implementation uses plain HTML elements. * Apps can override this with a custom implementation (e.g., using \@backstage/ui). * * @public */ declare const PageLayout: { (props: PageLayoutProps): JSX.Element | null; ref: _backstage_frontend_plugin_api.SwappableComponentRef; }; /** * API for looking up components based on component refs. * * @public */ interface SwappableComponentsApi { getComponent(ref: SwappableComponentRef): (props: TInnerComponentProps) => JSX.Element | null; } /** * The `ApiRef` of {@link SwappableComponentsApi}. * * @public */ declare const swappableComponentsApiRef: _backstage_frontend_plugin_api.ApiRef & { readonly $$type: "@backstage/ApiRef"; }; /** * The Config API is used to provide a mechanism to access the * runtime configuration of the system. * * @public */ type ConfigApi = Config; /** * The {@link ApiRef} of {@link ConfigApi}. * * @public */ declare const configApiRef: _backstage_frontend_plugin_api.ApiRef & { readonly $$type: "@backstage/ApiRef"; }; /** * The discovery API is used to provide a mechanism for plugins to * discover the endpoint to use to talk to their backend counterpart. * * @remarks * * The purpose of the discovery API is to allow for many different deployment * setups and routing methods through a central configuration, instead * of letting each individual plugin manage that configuration. * * Implementations of the discovery API can be a simple as a URL pattern * using the pluginId, but could also have overrides for individual plugins, * or query a separate discovery service. * * @public */ type DiscoveryApi = { /** * Returns the HTTP base backend URL for a given plugin, without a trailing slash. * * This method must always be called just before making a request, as opposed to * fetching the URL when constructing an API client. That is to ensure that more * flexible routing patterns can be supported. * * For example, asking for the URL for `auth` may return something * like `https://backstage.example.com/api/auth` */ getBaseUrl(pluginId: string): Promise; }; /** * The {@link ApiRef} of {@link DiscoveryApi}. * * @public */ declare const discoveryApiRef: _backstage_frontend_plugin_api.ApiRef & { readonly $$type: "@backstage/ApiRef"; }; /** * Mirrors the JavaScript Error class, for the purpose of * providing documentation and optional fields. * * @public */ type ErrorApiError = { name: string; message: string; stack?: string; }; /** * Provides additional information about an error that was posted to the application. * * @public */ type ErrorApiErrorContext = { /** * If set to true, this error should not be displayed to the user. * * Hidden errors are typically not displayed in the UI, but the ErrorApi * implementation may still report them to error tracking services * or other utilities that care about all errors. * * @defaultValue false */ hidden?: boolean; }; /** * The error API is used to report errors to the app, and display them to the user. * * @remarks * * Plugins can use this API as a method of displaying errors to the user, but also * to report errors for collection by error reporting services. * * If an error can be displayed inline, e.g. as feedback in a form, that should be * preferred over relying on this API to display the error. The main use of this API * for displaying errors should be for asynchronous errors, such as a failing background process. * * Even if an error is displayed inline, it should still be reported through this API * if it would be useful to collect or log it for debugging purposes, but with * the hidden flag set. For example, an error arising from form field validation * should probably not be reported, while a failed REST call would be useful to report. * * @public */ type ErrorApi = { /** * Post an error for handling by the application. */ post(error: ErrorApiError, context?: ErrorApiErrorContext): void; /** * Observe errors posted by other parts of the application. */ error$(): Observable<{ error: ErrorApiError; context?: ErrorApiErrorContext; }>; }; /** * The {@link ApiRef} of {@link ErrorApi}. * * @public */ declare const errorApiRef: _backstage_frontend_plugin_api.ApiRef & { readonly $$type: "@backstage/ApiRef"; }; /** * Feature flag descriptor. * * @public */ type FeatureFlag = { name: string; pluginId: string; description?: string; }; /** * Enum representing the state of a feature flag (inactive/active). * * @public */ declare const FeatureFlagState: { /** * Feature flag inactive (disabled). */ readonly None: 0; /** * Feature flag active (enabled). */ readonly Active: 1; }; /** * @public */ type FeatureFlagState = (typeof FeatureFlagState)[keyof typeof FeatureFlagState]; /** * @public */ declare namespace FeatureFlagState { type None = typeof FeatureFlagState.None; type Active = typeof FeatureFlagState.Active; } /** * Options to use when saving feature flags. * * @public */ type FeatureFlagsSaveOptions = { /** * The new feature flag states to save. */ states: Record; /** * Whether the saves states should be merged into the existing ones, or replace them. * * Defaults to false. */ merge?: boolean; }; /** * The feature flags API is used to toggle functionality to users across plugins and Backstage. * * @remarks * * Plugins can use this API to register feature flags that they have available * for users to enable/disable, and this API will centralize the current user's * state of which feature flags they would like to enable. * * This is ideal for Backstage plugins, as well as your own App, to trial incomplete * or unstable upcoming features. Although there will be a common interface for users * to enable and disable feature flags, this API acts as another way to enable/disable. * * @public */ interface FeatureFlagsApi { /** * Registers a new feature flag. Once a feature flag has been registered it * can be toggled by users, and read back to enable or disable features. */ registerFlag(flag: FeatureFlag): void; /** * Get a list of all registered flags. */ getRegisteredFlags(): FeatureFlag[]; /** * Whether the feature flag with the given name is currently activated for the user. */ isActive(name: string): boolean; /** * Save the user's choice of feature flag states. */ save(options: FeatureFlagsSaveOptions): void; } /** * The {@link ApiRef} of {@link FeatureFlagsApi}. * * @public */ declare const featureFlagsApiRef: _backstage_frontend_plugin_api.ApiRef & { readonly $$type: "@backstage/ApiRef"; }; /** * A wrapper for the fetch API, that has additional behaviors such as the * ability to automatically inject auth information where necessary. * * @public */ type FetchApi = { /** * The `fetch` implementation. */ fetch: typeof fetch; }; /** * The {@link ApiRef} of {@link FetchApi}. * * @remarks * * This is a wrapper for the fetch API, that has additional behaviors such as * the ability to automatically inject auth information where necessary. * * Note that the default behavior of this API (unless overridden by your org), * is to require that the user is already signed in so that it has auth * information to inject. Therefore, using the default implementation of this * utility API e.g. on the `SignInPage` or similar, would cause issues. In * special circumstances like those, you can use the regular system `fetch` * instead. * * @public */ declare const fetchApiRef: _backstage_frontend_plugin_api.ApiRef & { readonly $$type: "@backstage/ApiRef"; }; /** * API for accessing app icons. * * @public */ interface IconsApi { /** * Look up an icon element by key. */ icon(key: string): IconElement | undefined; /** * @deprecated Use {@link IconsApi.icon} instead. */ getIcon(key: string): IconComponent | undefined; listIconKeys(): string[]; } /** * The `ApiRef` of {@link IconsApi}. * * @public */ declare const iconsApiRef: _backstage_frontend_plugin_api.ApiRef & { readonly $$type: "@backstage/ApiRef"; }; /** * The Identity API used to identify and get information about the signed in user. * * @public */ type IdentityApi = { /** * The profile of the signed in user. */ getProfileInfo(): Promise; /** * User identity information within Backstage. */ getBackstageIdentity(): Promise; /** * Provides credentials in the form of a token which proves the identity of the signed in user. * * The token will be undefined if the signed in user does not have a verified * identity, such as a demo user or mocked user for e2e tests. */ getCredentials(): Promise<{ token?: string; }>; /** * Sign out the current user */ signOut(): Promise; }; /** * The {@link ApiRef} of {@link IdentityApi}. * * @public */ declare const identityApiRef: _backstage_frontend_plugin_api.ApiRef & { readonly $$type: "@backstage/ApiRef"; }; /** * A handle for an open dialog that can be used to interact with it. * * @remarks * * Dialogs are opened using {@link DialogApi.open}. * * @public */ interface DialogApiDialog { /** * Closes the dialog with the provided result. * * @remarks * * Whether a result is required depends on the `TResult` type parameter * chosen when the dialog was opened. If the type includes `undefined`, * calling `close()` without a result is allowed. */ close(...args: undefined extends TResult ? [result?: TResult] : [result: TResult]): void; /** * Replaces the rendered dialog with the provided element or component. * * @remarks * * Just like the element or component passed to {@link DialogApi.open}, the * caller is responsible for providing the full dialog including all chrome. */ update(elementOrComponent: JSX.Element | ((props: { dialog: DialogApiDialog; }) => JSX.Element)): void; /** * Wait until the dialog is closed and return the result. */ result(): Promise; } /** * A Utility API for showing dialogs that render in the React tree and return a result. * * @public */ interface DialogApi { /** * Opens a dialog and returns a handle to it. * * @remarks * * The provided element or component is rendered as-is in the app's React tree. * It is the caller's responsibility to provide all dialog chrome, such as an * overlay, backdrop, and dialog surface. This makes the method agnostic to the * design library used for the dialog. * * @example * * ### Example with inline dialog element * ```tsx * const dialog = dialogApi.open( * !isOpen && dialog.close()}> * Are you sure? * This action cannot be undone. * * * * * * ); * const result = await dialog.result(); * ``` * * @example * * ### Example with a dialog component * ```tsx * function ConfirmDialog({ dialog }: { dialog: DialogApiDialog }) { * return ( * !isOpen && dialog.close()}> * Are you sure? * This action cannot be undone. * * * * * * ); * } * const result = await dialogApi.open(ConfirmDialog).result(); * ``` * * @param elementOrComponent - The element or component to render. If a component is provided, it will be provided with a `dialog` prop that contains the dialog handle. */ open(elementOrComponent: JSX.Element | ((props: { dialog: DialogApiDialog; }) => JSX.Element)): DialogApiDialog; /** * Opens a dialog with built-in dialog chrome and returns a handle to it. * * @deprecated Use {@link DialogApi.open} instead. The `open` method does not * render any dialog chrome, giving the caller full control over the dialog * presentation. This avoids focus trap conflicts across design libraries. * * @param elementOrComponent - The element or component to render in the dialog. If a component is provided, it will be provided with a `dialog` prop that contains the dialog handle. */ show(elementOrComponent: JSX.Element | ((props: { dialog: DialogApiDialog; }) => JSX.Element)): DialogApiDialog; /** * Opens a modal dialog with built-in dialog chrome and returns a handle to it. * * @deprecated Use {@link DialogApi.open} instead. The `open` method does not * render any dialog chrome, giving the caller full control over the dialog * presentation. This avoids focus trap conflicts across design libraries. * * @param elementOrComponent - The element or component to render in the dialog. If a component is provided, it will be provided with a `dialog` prop that contains the dialog handle. */ showModal(elementOrComponent: JSX.Element | ((props: { dialog: DialogApiDialog; }) => JSX.Element)): DialogApiDialog; } /** * The `ApiRef` of {@link DialogApi}. * * @public */ declare const dialogApiRef: _backstage_frontend_plugin_api.ApiRef & { readonly $$type: "@backstage/ApiRef"; }; /** * Describes how to handle auth requests. Both how to show them to the user, and what to do when * the user accesses the auth request. * * @public */ type OAuthRequesterOptions = { /** * Information about the auth provider, which will be forwarded to auth requests. */ provider: AuthProviderInfo; /** * Implementation of the auth flow, which will be called synchronously when * trigger() is called on an auth requests. */ onAuthRequest(scopes: Set): Promise; }; /** * Function used to trigger new auth requests for a set of scopes. * * @remarks * * The returned promise will resolve to the same value returned by the onAuthRequest in the * {@link OAuthRequesterOptions}. Or rejected, if the request is rejected. * * This function can be called multiple times before the promise resolves. All calls * will be merged into one request, and the scopes forwarded to the onAuthRequest will be the * union of all requested scopes. * * @public */ type OAuthRequester = (scopes: Set) => Promise; /** * An pending auth request for a single auth provider. The request will remain in this pending * state until either reject() or trigger() is called. * * @remarks * * Any new requests for the same provider are merged into the existing pending request, meaning * there will only ever be a single pending request for a given provider. * * @public */ type PendingOAuthRequest = { /** * Information about the auth provider, as given in the AuthRequesterOptions */ provider: AuthProviderInfo; /** * Rejects the request, causing all pending AuthRequester calls to fail with "RejectedError". */ reject(): void; /** * Trigger the auth request to continue the auth flow, by for example showing a popup. * * Synchronously calls onAuthRequest with all scope currently in the request. */ trigger(): Promise; }; /** * Provides helpers for implemented OAuth login flows within Backstage. * * @public */ type OAuthRequestApi = { /** * A utility for showing login popups or similar things, and merging together multiple requests for * different scopes into one request that includes all scopes. * * The passed in options provide information about the login provider, and how to handle auth requests. * * The returned AuthRequester function is used to request login with new scopes. These requests * are merged together and forwarded to the auth handler, as soon as a consumer of auth requests * triggers an auth flow. * * See AuthRequesterOptions, AuthRequester, and handleAuthRequests for more info. */ createAuthRequester(options: OAuthRequesterOptions): OAuthRequester; /** * Observers pending auth requests. The returned observable will emit all * current active auth request, at most one for each created auth requester. * * Each request has its own info about the login provider, forwarded from the auth requester options. * * Depending on user interaction, the request should either be rejected, or used to trigger the auth handler. * If the request is rejected, all pending AuthRequester calls will fail with a "RejectedError". * If a auth is triggered, and the auth handler resolves successfully, then all currently pending * AuthRequester calls will resolve to the value returned by the onAuthRequest call. */ authRequest$(): Observable; }; /** * The {@link ApiRef} of {@link OAuthRequestApi}. * * @public */ declare const oauthRequestApiRef: _backstage_frontend_plugin_api.ApiRef & { readonly $$type: "@backstage/ApiRef"; }; /** * TS magic for handling route parameters. * * @remarks * * The extra TS magic here is to require a single params argument if the RouteRef * had at least one param defined, but require 0 arguments if there are no params defined. * Without this we'd have to pass in empty object to all parameter-less RouteRefs * just to make TypeScript happy, or we would have to make the argument optional in * which case you might forget to pass it in when it is actually required. * * @public */ type RouteFunc = (...[params]: TParams extends undefined ? readonly [] : readonly [params: TParams]) => string; /** * @public */ interface RouteResolutionApi { resolve(anyRouteRef: RouteRef | SubRouteRef | ExternalRouteRef, options?: { /** * An absolute path to use as a starting point when resolving the route. * If no path is provided the route will be resolved from the root of the app. */ sourcePath?: string; }): RouteFunc | undefined; } /** * The `ApiRef` of {@link RouteResolutionApi}. * * @public */ declare const routeResolutionApiRef: _backstage_frontend_plugin_api.ApiRef & { readonly $$type: "@backstage/ApiRef"; }; /** * A snapshot in time of the current known value of a storage key. * * @public */ type StorageValueSnapshot = { key: string; presence: 'unknown' | 'absent'; value?: undefined; } | { key: string; presence: 'present'; value: TValue; }; /** * Provides a key-value persistence API. * * @public */ interface StorageApi { /** * Create a bucket to store data in. * * @param name - Namespace for the storage to be stored under, * will inherit previous namespaces too */ forBucket(name: string): StorageApi; /** * Remove persistent data. * * @param key - Unique key associated with the data. */ remove(key: string): Promise; /** * Save persistent data, and emit messages to anyone that is using * {@link StorageApi.observe$} for this key. * * @param key - Unique key associated with the data. * @param data - The data to be stored under the key. */ set(key: string, data: T): Promise; /** * Observe the value over time for a particular key in the current bucket. * * @remarks * * The observable will only emit values when the value changes in the underlying * storage, although multiple values with the same shape may be emitted in a row. * * If a {@link StorageApi.snapshot} of a key is retrieved and the presence is * `'unknown'`, then you are guaranteed to receive a snapshot with a known * presence, as long as you observe the key within the same tick. * * Since the emitted values are shared across all subscribers, it is important * not to mutate the returned values. The values may be frozen as a precaution. * * @param key - Unique key associated with the data */ observe$(key: string): Observable>; /** * Returns an immediate snapshot value for the given key, if possible. * * @remarks * * Combine with {@link StorageApi.observe$} to get notified of value changes. * * Note that this method is synchronous, and some underlying storages may be * unable to retrieve a value using this method - the result may or may not * consistently have a presence of 'unknown'. Use {@link StorageApi.observe$} * to be sure to receive an actual value eventually. */ snapshot(key: string): StorageValueSnapshot; } /** * The {@link ApiRef} of {@link StorageApi}. * * @public */ declare const storageApiRef: _backstage_frontend_plugin_api.ApiRef & { readonly $$type: "@backstage/ApiRef"; }; /** * Represents an event worth tracking in an analytics system that could inform * how users of a Backstage instance are using its features. * * @public */ type AnalyticsEvent = { /** * A string that identifies the event being tracked by the type of action the * event represents. Be careful not to encode extra metadata in this string * that should instead be placed in the Analytics Context or attributes. * Examples include: * * - view * - click * - filter * - search * - hover * - scroll */ action: string; /** * A string that uniquely identifies the object that the action is being * taken on. Examples include: * * - The path of the page viewed * - The url of the link clicked * - The value that was filtered by * - The text that was searched for */ subject: string; /** * An optional numeric value relevant to the event that could be aggregated * by analytics tools. Examples include: * * - The index or position of the clicked element in an ordered list * - The percentage of an element that has been scrolled through * - The amount of time that has elapsed since a fixed point * - A satisfaction score on a fixed scale */ value?: number; /** * Optional, additional attributes (representing dimensions or metrics) * specific to the event that could be forwarded on to analytics systems. */ attributes?: AnalyticsEventAttributes; /** * Contextual metadata relating to where the event was captured and by whom. * This could include information about the route, plugin, or extension in * which an event was captured. */ context: AnalyticsContextValue; }; /** * A structure allowing other arbitrary metadata to be provided by analytics * event emitters. * * @public */ type AnalyticsEventAttributes = { [attribute in string]: string | boolean | number; }; /** * Represents a tracker with methods that can be called to track events in a * configured analytics service. * * @public */ type AnalyticsTracker = { captureEvent: (action: string, subject: string, options?: { value?: number; attributes?: AnalyticsEventAttributes; }) => void; }; /** * Analytics implementations are used to track user behavior in a Backstage * instance. * * @remarks * * To instrument your App or Plugin, retrieve an analytics tracker using the * `useAnalytics()` hook. This will return a pre-configured `AnalyticsTracker` * with relevant methods for instrumentation. * * @public */ type AnalyticsImplementation = { /** * Primary event handler responsible for compiling and forwarding events to * an analytics system. */ captureEvent(event: AnalyticsEvent): void; }; /** * The Analytics API is used to track user behavior in a Backstage instance. * * @remarks * * To instrument your App or Plugin, retrieve an analytics tracker using the * useAnalytics() hook. This will return a pre-configured AnalyticsTracker * with relevant methods for instrumentation. * * @public */ type AnalyticsApi = { /** * Primary event handler responsible for compiling and forwarding events to * an analytics system. */ captureEvent(event: AnalyticsEvent): void; }; /** * The API reference of {@link AnalyticsApi}. * * @remarks * * To define a concrete Analytics Implementation, use * {@link AnalyticsImplementationBlueprint} instead. * * @public */ declare const analyticsApiRef: _backstage_frontend_plugin_api.ApiRef & { readonly $$type: "@backstage/ApiRef"; }; /** * React hook for retrieving {@link ApiHolder}, an API catalog. * * @public */ declare function useApiHolder(): ApiHolder; /** * React hook for retrieving APIs. * * @param apiRef - Reference of the API to use. * @public */ declare function useApi(apiRef: ApiRef): T; /** * Wrapper for giving component an API context. * * @param apis - APIs for the context. * @deprecated Use `withApis` from `@backstage/core-compat-api` instead. * @public */ declare function withApis(apis: TypesToApiRefs): (WrappedComponent: ComponentType) => { (props: PropsWithChildren>): react_jsx_runtime.JSX.Element; displayName: string; }; /** * API reference configuration - holds an ID of the referenced API. * * @public */ type ApiRefConfig = { id: string; }; /** * Creates a reference to an API. * * @remarks * * The `id` is a stable identifier for the API implementation. The frontend * system infers the owning plugin for an API from the `id`. When using the * builder form, you can instead provide a `pluginId` explicitly. The * recommended pattern is `plugin..*` (for example, * `plugin.catalog.entity-presentation`). This ensures that other plugins can't * mistakenly override your API implementation. * * The recommended way to create an API reference is: * * ```ts * const myApiRef = createApiRef().with({ * id: 'my-api', * pluginId: 'my-plugin', * }); * ``` * * The legacy way to create an API reference is: * * ```ts * const myApiRef = createApiRef({ id: 'plugin.my.api' }); * ``` * * @public */ /** * Creates a reference to an API. * * @deprecated Use `createApiRef().with(...)` instead. * @public */ declare function createApiRef(config: ApiRefConfig): ApiRef & { readonly $$type: '@backstage/ApiRef'; }; /** * Creates a reference to an API. * * @remarks * * Returns a builder with a `.with()` method for providing the API reference * configuration. * * @public */ declare function createApiRef(): { with(config: ApiRefConfig & { id: TId; pluginId?: string; }): ApiRef & { readonly $$type: '@backstage/ApiRef'; }; }; /** * Used to infer types for a standalone {@link ApiFactory} that isn't immediately passed * to another function. * * @remarks * * This function doesn't actually do anything, it's only used to infer types. * * @public */ declare function createApiFactory(factory: ApiFactory): ApiFactory; /** * Used to infer types for a standalone {@link ApiFactory} that isn't immediately passed * to another function. * * @param api - Ref of the API that will be produced by the factory. * @param instance - Implementation of the API to use. * @public */ declare function createApiFactory(api: ApiRef, instance: Impl): ApiFactory; /** * Link item for toast notifications. * * @public */ type ToastApiMessageLink = { /** Display text for the link */ label: string; /** URL the link points to */ href: string; }; /** * Message handled by the {@link ToastApi}. * * @public */ type ToastApiMessage = { /** Title of the toast (required) */ title: ReactNode; /** Optional description text */ description?: ReactNode; /** Status variant of the toast - defaults to 'success' */ status?: 'neutral' | 'info' | 'success' | 'warning' | 'danger'; /** Optional array of links to display */ links?: ToastApiMessageLink[]; /** Timeout in milliseconds before auto-dismiss. If not set, toast is permanent. */ timeout?: number; }; /** * Handle returned by {@link ToastApi.post} that allows programmatic control * of the posted toast. * * @public */ type ToastApiPostResult = { /** Dismiss the toast. */ close(): void; }; /** * The toast API is used to display toast notifications to the user. * * @remarks * This API provides richer notification capabilities than the AlertApi, * including title/description, links, and per-toast timeout control. * * @example * ```tsx * const toastApi = useApi(toastApiRef); * * // Full-featured toast * toastApi.post({ * title: 'Entity saved', * description: 'Your changes have been saved successfully.', * status: 'success', * timeout: 5000, * links: [{ label: 'View entity', href: '/catalog/default/component/my-service' }], * }); * * // Simple toast * toastApi.post({ title: 'Processing...', status: 'info' }); * * // Programmatic dismiss * const { close } = toastApi.post({ title: 'Uploading...', status: 'info' }); * // Later... * close(); * ``` * * @public */ type ToastApi = { /** * Post a toast notification for display to the user. * * @param toast - The toast message to display * @returns A handle with a `close()` method to programmatically dismiss the toast */ post(toast: ToastApiMessage): ToastApiPostResult; }; /** * The {@link ApiRef} of {@link ToastApi}. * * @public */ declare const toastApiRef: ApiRef; /** @public */ interface TranslationRef { $$type: '@backstage/TranslationRef'; id: TId; T: TMessages; } /** @ignore */ type AnyNestedMessages = { [key in string]: AnyNestedMessages | string; }; /** * Flattens a nested message declaration into a flat object with dot-separated keys. * * @ignore */ type FlattenedMessages = { [TKey in keyof TMessages]: (_: TMessages[TKey] extends string ? { [_ in TKey]: TMessages[TKey]; } : TMessages[TKey] extends AnyNestedMessages ? FlattenedMessages extends infer TNested ? { [TNestedKey in keyof TNested as `${TKey & string}.${TNestedKey & string}`]: TNested[TNestedKey]; } : never : never) => void; }[keyof TMessages] extends (_: infer TIntersection) => void ? { readonly [TExpandKey in keyof TIntersection]: TIntersection[TExpandKey]; } : never; /** @public */ interface TranslationRefOptions Promise<{ default: { [key in keyof FlattenedMessages]: string | null; }; }>; }> { id: TId; messages: TNestedMessages; translations?: TTranslations; } /** @public */ declare function createTranslationRef Promise<{ default: { [key in keyof FlattenedMessages]: string | null; }; }>; }>(config: TranslationRefOptions): TranslationRef>; /** * Represents a collection of messages to be provided for a given translation ref. * * @public * @remarks * * This collection of messages can either be used directly as an override for the * default messages, or it can be used to provide translations for a language by * by being referenced by a {@link TranslationResource}. */ interface TranslationMessages { $$type: '@backstage/TranslationMessages'; /** The ID of the translation ref that these messages are for */ id: TId; /** Whether or not these messages override all known messages */ full: TFull; /** The messages provided for the given translation ref */ messages: TMessages; } /** * Options for {@link createTranslationMessages}. * * @public */ interface TranslationMessagesOptions { ref: TranslationRef; full?: TFull; messages: false extends TFull ? { [key in keyof TMessages]?: string | null; } : { [key in keyof TMessages]: string | null; }; } /** * Creates a collection of messages for a given translation ref. * * @public */ declare function createTranslationMessages(options: TranslationMessagesOptions): TranslationMessages; /** @public */ interface TranslationResource { $$type: '@backstage/TranslationResource'; id: TId; } /** @public */ interface TranslationResourceOptions Promise<{ default: TranslationMessages | { [key in keyof TMessages]: string | null; }; }>; }> { ref: TranslationRef; translations: TTranslations; } /** @public */ declare function createTranslationResource Promise<{ default: TranslationMessages | { [key in keyof TMessages]: string | null; }; }>; }>(options: TranslationResourceOptions): TranslationResource; /** @public */ declare const useTranslationRef: (translationRef: TranslationRef) => { t: TranslationFunction; }; /** * Base translation options. * * @ignore */ interface BaseOptions { interpolation?: { /** Whether to HTML escape provided values, defaults to false */ escapeValue?: boolean; }; } /** * All pluralization suffixes supported by i18next * * @ignore */ type TranslationPlural = 'zero' | 'one' | 'two' | 'few' | 'many' | 'other'; /** * A mapping of i18n formatting types to their corresponding types and options. * @ignore */ type I18nextFormatMap = { number: { type: number; options: Intl.NumberFormatOptions; }; currency: { type: number; options: Intl.NumberFormatOptions; }; datetime: { type: Date; options: Intl.DateTimeFormatOptions; }; relativetime: { type: number; options: { range?: Intl.RelativeTimeFormatUnit; } & Intl.RelativeTimeFormatOptions; }; list: { type: string[]; options: Intl.ListFormatOptions; }; }; /** * Extracts all pluralized keys from the message map. * * @example * ``` * { foo: 'foo', bar_one: 'bar', bar_other: 'bars' } -> 'bar' * ``` * * @ignore */ type PluralKeys = { [Key in keyof TMessages]: Key extends `${infer K}_${TranslationPlural}` ? K : never; }[keyof TMessages]; /** * Collapses a message map into normalized keys with union values. * * @example * ``` * { foo_one: 'foo', foo_other: 'foos' } -> { foo: 'foo' | 'foos' } * ``` * * @ignore */ type CollapsedMessages = { [key in keyof TMessages as key extends `${infer K}_${TranslationPlural}` ? K : key]: TMessages[key]; }; /** * Trim away whitespace * * @ignore */ type Trim = T extends ` ${infer U}` ? Trim : T extends `${infer U} ` ? Trim : T; /** * Extracts the key and format from a replacement string. * * @example * ``` * 'foo, number' -> { foo: number }, 'foo' -> { foo: undefined } * ``` */ type ExtractFormat = Replacement extends `${infer Key},${infer FullFormat}` ? { [key in Trim]: Lowercase>; } : { [key in Trim]: undefined; }; /** * Expand the keys in a flat map to nested objects. * * @example * ``` * { 'a.b': 'foo', 'a.c': 'bar' } -> { a: { b: 'foo', c: 'bar' } * ``` * * @ignore */ type ExpandKeys = { [Key in keyof TMap as Key extends `${infer Prefix}.${string}` ? Prefix : Key]: Key extends `${string}.${infer Rest}` ? ExpandKeys<{ [key in Rest]: TMap[Key]; }> : TMap[Key]; }; /** * Extracts all option keys and their format from a message string. * * @example * ``` * 'foo {{bar}} {{baz, number}}' -> { 'bar': undefined, 'baz': 'number' } * ``` * * @ignore */ type ReplaceFormatsFromMessage = TMessage extends `${string}{{${infer Replacement}}}${infer Tail}` ? ExpandKeys> & ReplaceFormatsFromMessage : {}; /** * Generates the replace options structure * * @ignore */ type ReplaceOptionsFromFormats = { [Key in keyof TFormats]: TFormats[Key] extends keyof I18nextFormatMap ? I18nextFormatMap[TFormats[Key]]['type'] : TFormats[Key] extends {} ? Expand> : TValueType; }; /** * Generates the formatParams options structure * * @ignore */ type ReplaceFormatParamsFromFormats = { [Key in keyof TFormats]?: TFormats[Key] extends keyof I18nextFormatMap ? I18nextFormatMap[TFormats[Key]]['options'] : TFormats[Key] extends {} ? Expand> : undefined; }; /** * Extracts all nesting keys from a message string. * * @example * ``` * 'foo $t(bar) $t(baz)' -> 'bar' | 'baz' * ``` * * @ignore */ type NestingKeysFromMessage = TMessage extends `${string}$t(${infer Key})${infer Tail}` ? Trim | NestingKeysFromMessage : never; /** * Find all referenced keys, given a starting key and the full set of messages. * * This will only discover keys up to 3 levels deep. * * @example * ``` * <'x', { x: '$t(y) $t(z)', y: 'y', z: '$t(w)', w: 'w', foo: 'foo' }> -> 'x' | 'y' | 'z' | 'w' * ``` * * @ignore */ type NestedMessageKeys = TKey | NestedMessageKeys2, TMessages>; type NestedMessageKeys2 = TKey | NestedMessageKeys3, TMessages>; type NestedMessageKeys3 = TKey | NestingKeysFromMessage; /** * Converts a union type to an intersection type. * * @example * ``` * { foo: 'foo' } | { bar: 'bar' } -> { foo: 'foo' } & { bar: 'bar' } * ``` * * @ignore */ type UnionToIntersection = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never; /** * Collects different types of options into a single object * * @ignore */ type CollectOptions = TCount & (keyof Omit extends never ? {} : (Expand, 'count'>> | { replace: Expand, 'count'>>; }) & { formatParams?: Expand>; }); /** * Helper type to only require options argument if needed * * @ignore */ type OptionArgs = keyof TOptions extends never ? [options?: Expand] : [options: Expand]; /** * @ignore */ type TranslationFunctionOptions = OptionArgs>>, TValueType>>>; /** @public */ type TranslationFunction = CollapsedMessages extends infer IMessages extends { [key in string]: string; } ? { /** * A translation function that returns a string. */ (key: TKey, ...[args]: TranslationFunctionOptions, PluralKeys, IMessages, string>): IMessages[TKey]; /** * A translation function where at least one JSX.Element has been * provided as an interpolation value, and will therefore return a * JSX.Element. */ (key: TKey, ...[args]: TranslationFunctionOptions, PluralKeys, IMessages, string | JSX$1.Element>): JSX$1.Element; } : never; /** @public */ type TranslationSnapshot = { ready: false; } | { ready: true; t: TranslationFunction; }; /** @public */ type TranslationApi = { getTranslation(translationRef: TranslationRef): TranslationSnapshot; translation$(translationRef: TranslationRef): Observable>; }; /** * @public */ declare const translationApiRef: _backstage_frontend_plugin_api.ApiRef & { readonly $$type: "@backstage/ApiRef"; }; /** * API for retrieving plugin-scoped header actions. * * @remarks * * Header actions are provided via * {@link @backstage/frontend-plugin-api#PluginHeaderActionBlueprint} * and automatically scoped to the providing plugin. * * @public */ type PluginHeaderActionsApi = { /** * Returns the header actions for a given plugin. */ getPluginHeaderActions(pluginId: string): Array; }; /** * The `ApiRef` of {@link PluginHeaderActionsApi}. * * @public */ declare const pluginHeaderActionsApiRef: _backstage_frontend_plugin_api.ApiRef & { readonly $$type: "@backstage/ApiRef"; }; /** * Gets a pre-configured analytics tracker. * * @public */ declare function useAnalytics(): AnalyticsTracker; /** * @public * @deprecated Use `AnalyticsImplementationFactory` from `@backstage/plugin-app-react` instead. */ type AnalyticsImplementationFactory = { deps: TypesToApiRefs; factory(deps: Deps): AnalyticsImplementation; }; /** * Creates analytics implementations. * * @public * @deprecated Use `AnalyticsImplementationBlueprint` from `@backstage/plugin-app-react` instead. */ declare const AnalyticsImplementationBlueprint: _backstage_frontend_plugin_api.ExtensionBlueprint<{ kind: "analytics"; params: (params: AnalyticsImplementationFactory) => _backstage_frontend_plugin_api.ExtensionBlueprintParams>; output: _backstage_frontend_plugin_api.ExtensionDataRef, "core.analytics.factory", {}>; inputs: {}; config: {}; configInput: {}; dataRefs: { factory: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef, "core.analytics.factory", {}>; }; }>; /** * Creates utility API extensions. * * @public */ declare const ApiBlueprint: _backstage_frontend_plugin_api.ExtensionBlueprint<{ kind: "api"; params: (params: ApiFactory) => _backstage_frontend_plugin_api.ExtensionBlueprintParams; output: _backstage_frontend_plugin_api.ExtensionDataRef; inputs: {}; config: {}; configInput: {}; dataRefs: { factory: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef; }; }>; /** * Creates extensions that render a React element at the app root, outside of * the app layout. This is useful for example for shared popups and similar. * * @public */ declare const AppRootElementBlueprint: _backstage_frontend_plugin_api.ExtensionBlueprint<{ kind: "app-root-element"; params: { element: JSX.Element; }; output: _backstage_frontend_plugin_api.ExtensionDataRef; inputs: {}; config: {}; configInput: {}; dataRefs: never; }>; /** * Creates extensions that make up the items of the nav bar. * * @public * @deprecated Nav items are now automatically inferred from `PageBlueprint` * extensions based on their `title` and `icon` params. You can remove your * `NavItemBlueprint` usage and instead pass `title` and `icon` directly to * the `PageBlueprint`. */ declare const NavItemBlueprint: _backstage_frontend_plugin_api.ExtensionBlueprint<{ kind: "nav-item"; params: { title: string; icon: IconComponent; routeRef: RouteRef; }; output: _backstage_frontend_plugin_api.ExtensionDataRef<{ title: string; icon: IconComponent; routeRef: RouteRef; }, "core.nav-item.target", {}>; inputs: {}; config: { title: string | undefined; }; configInput: { title?: string | undefined; }; dataRefs: { target: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<{ title: string; icon: IconComponent; routeRef: RouteRef; }, "core.nav-item.target", {}>; }; }>; /** * Creates extensions that are routable React page components. * * @public */ declare const PageBlueprint: _backstage_frontend_plugin_api.ExtensionBlueprint<{ kind: "page"; params: { path: string; title?: string; icon?: IconElement; loader?: () => Promise; routeRef?: RouteRef; /** * Hide the default plugin page header, making the page fill up all available space. */ noHeader?: boolean; }; output: _backstage_frontend_plugin_api.ExtensionDataRef | _backstage_frontend_plugin_api.ExtensionDataRef, "core.routing.ref", { optional: true; }> | _backstage_frontend_plugin_api.ExtensionDataRef | _backstage_frontend_plugin_api.ExtensionDataRef | _backstage_frontend_plugin_api.ExtensionDataRef; inputs: { pages: _backstage_frontend_plugin_api.ExtensionInput<_backstage_frontend_plugin_api.ConfigurableExtensionDataRef | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef, "core.routing.ref", { optional: true; }> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef, { singleton: false; optional: false; internal: false; }>; }; config: { path: string | undefined; title: string | undefined; }; configInput: { path?: string | undefined; title?: string | undefined; }; dataRefs: never; }>; /** * Creates extensions that are sub-page React components attached to a parent page. * Sub-pages are rendered as tabs within the parent page's header. * * @public * @example * ```tsx * const overviewRouteRef = createRouteRef(); * * const mySubPage = SubPageBlueprint.make({ * attachTo: { id: 'page:my-plugin', input: 'pages' }, * name: 'overview', * params: { * path: 'overview', * title: 'Overview', * routeRef: overviewRouteRef, * loader: () => import('./components/Overview').then(m => ), * }, * }); * ``` */ declare const SubPageBlueprint: _backstage_frontend_plugin_api.ExtensionBlueprint<{ kind: "sub-page"; params: { /** * The path for this sub-page, relative to the parent page. Must **not** start with '/'. * * @example 'overview', 'settings', 'details' */ path: string; /** * The title displayed in the tab for this sub-page. */ title: string; /** * Optional icon for this sub-page, displayed in the tab. */ icon?: IconElement; /** * A function that returns a promise resolving to the React element to render. * This enables lazy loading of the sub-page content. */ loader: () => Promise; /** * Optional route reference for this sub-page. */ routeRef?: RouteRef; }; output: _backstage_frontend_plugin_api.ExtensionDataRef | _backstage_frontend_plugin_api.ExtensionDataRef, "core.routing.ref", { optional: true; }> | _backstage_frontend_plugin_api.ExtensionDataRef | _backstage_frontend_plugin_api.ExtensionDataRef | _backstage_frontend_plugin_api.ExtensionDataRef; inputs: {}; config: { path: string | undefined; title: string | undefined; }; configInput: { path?: string | undefined; title?: string | undefined; }; dataRefs: never; }>; /** * Creates extensions that provide plugin-scoped header actions. * * @remarks * * These actions are automatically scoped to the plugin that provides them * and will appear in the header of all pages belonging to that plugin. * * @public */ declare const PluginHeaderActionBlueprint: _backstage_frontend_plugin_api.ExtensionBlueprint<{ kind: "plugin-header-action"; params: { loader: () => Promise; }; output: _backstage_frontend_plugin_api.ExtensionDataRef; inputs: {}; config: {}; configInput: {}; dataRefs: never; }>; export { AnalyticsContext, AnalyticsImplementationBlueprint, AnyApiFactory, AnyRouteRefParams, ApiBlueprint, ApiFactory, ApiHolder, ApiRef, AppNode, AppRootElementBlueprint, ErrorDisplay, ExtensionBoundary, ExternalRouteRef, FeatureFlagState, FrontendFeature, FrontendPlugin, IconComponent, IconElement, NavItemBlueprint, NotFoundErrorPage, PageBlueprint, PageLayout, PluginHeaderActionBlueprint, Progress, RouteRef, SessionState, SubPageBlueprint, SubRouteRef, TypesToApiRefs, alertApiRef, analyticsApiRef, appLanguageApiRef, appThemeApiRef, atlassianAuthApiRef, bitbucketAuthApiRef, bitbucketServerAuthApiRef, configApiRef, coreExtensionData, createApiFactory, createApiRef, createFrontendFeatureLoader, createSwappableComponent, createTranslationMessages, createTranslationRef, createTranslationResource, dialogApiRef, discoveryApiRef, errorApiRef, featureFlagsApiRef, fetchApiRef, githubAuthApiRef, gitlabAuthApiRef, googleAuthApiRef, iconsApiRef, identityApiRef, microsoftAuthApiRef, oauthRequestApiRef, oktaAuthApiRef, oneloginAuthApiRef, openshiftAuthApiRef, pluginHeaderActionsApiRef, routeResolutionApiRef, storageApiRef, swappableComponentsApiRef, toastApiRef, translationApiRef, useAnalytics, useApi, useApiHolder, useAppNode, useRouteRef, useRouteRefParams, useTranslationRef, vmwareCloudAuthApiRef, withApis }; export type { AlertApi, AlertMessage, AnalyticsApi, AnalyticsContextValue, AnalyticsEvent, AnalyticsEventAttributes, AnalyticsImplementation, AnalyticsImplementationFactory, AnalyticsTracker, ApiRefConfig, AppLanguageApi, AppTheme, AppThemeApi, AuthProviderInfo, AuthRequestOptions, BackstageIdentityApi, BackstageIdentityResponse, BackstageUserIdentity, ConfigApi, CreateFrontendFeatureLoaderOptions, CreateSwappableComponentOptions, DialogApi, DialogApiDialog, DiscoveryApi, ErrorApi, ErrorApiError, ErrorApiErrorContext, ErrorDisplayProps, ExtensionBoundaryProps, FeatureFlag, FeatureFlagsApi, FeatureFlagsSaveOptions, FetchApi, FrontendFeatureLoader, IconsApi, IdentityApi, NotFoundErrorPageProps, OAuthApi, OAuthRequestApi, OAuthRequester, OAuthRequesterOptions, OAuthScope, OpenIdConnectApi, PageLayoutProps, PageLayoutTab, PageTab, PendingOAuthRequest, PluginHeaderActionsApi, ProfileInfo, ProfileInfoApi, ProgressProps, RouteFunc, RouteResolutionApi, SessionApi, StorageApi, StorageValueSnapshot, SwappableComponentRef, SwappableComponentsApi, ToastApi, ToastApiMessage, ToastApiMessageLink, ToastApiPostResult, TranslationApi, TranslationFunction, TranslationMessages, TranslationMessagesOptions, TranslationRef, TranslationRefOptions, TranslationResource, TranslationResourceOptions, TranslationSnapshot };