Skip to main content
Version: Next

@backstage/core-plugin-api

Home > @backstage/core-plugin-api

Core API used by Backstage plugins

Enumerations

Enumeration

Description

FeatureFlagState

Enum representing the state of a feature flag (inactive/active).

SessionState

Session state values passed to subscribers of the SessionApi.

Functions

Function

Description

AnalyticsContext(options)

Provides components in the child react tree an Analytics Context, ensuring all analytics events captured within the context have relevant attributes.

attachComponentData(component, type, data)

Stores data related to a component in a global store.

createApiFactory(factory)

Used to infer types for a standalone ApiFactory that isn't immediately passed to another function.

createApiFactory(api, instance)

Used to infer types for a standalone ApiFactory that isn't immediately passed to another function.

createApiRef(config)

Creates a reference to an API.

createComponentExtension(options)

Plain React component extension.

createExternalRouteRef(options)

Creates a route descriptor, to be later bound to a concrete route by the app. Used to implement cross-plugin route references.

createPlugin(config)

Creates Backstage Plugin from config.

createReactExtension(options)

Used by createComponentExtension() and createRoutableExtension().

createRoutableExtension(options)

Extension for components that can have its own URL route (top-level pages, tabs etc.).

createRouteRef(config)

Create a RouteRef from a route descriptor.

createSubRouteRef(config)

Create a SubRouteRef from a route descriptor.

getComponentData(node, type)

Retrieves data attached to a component.

useAnalytics()

Gets a pre-configured analytics tracker.

useApi(apiRef)

React hook for retrieving APIs.

useApiHolder()

React hook for retrieving ApiHolder, an API catalog.

useApp()

React hook providing AppContext.

useElementFilter(node, filterFn, dependencies)

useElementFilter is a utility that helps you narrow down and retrieve data from a React element tree, typically operating on the children property passed in to a component.

useRouteRef(routeRef)

React hook for constructing URLs to routes.

useRouteRef(routeRef)

React hook for constructing URLs to routes.

useRouteRefParams(_routeRef)

React hook for retrieving dynamic params from the current URL.

withApis(apis)

Wrapper for giving component an API context.

Interfaces

Interface

Description

ElementCollection

A querying interface tailored to traversing a set of selected React elements and extracting data.

FeatureFlagsApi

The feature flags API is used to toggle functionality to users across plugins and Backstage.

StorageApi

Provides a key-value persistence API.

Variables

Variable

Description

alertApiRef

The ApiRef of AlertApi.

analyticsApiRef

The ApiRef of AnalyticsApi.

appThemeApiRef

The ApiRef of AppThemeApi.

atlassianAuthApiRef

Provides authentication towards Atlassian APIs.

bitbucketAuthApiRef

Provides authentication towards Bitbucket APIs.

bitbucketServerAuthApiRef

Provides authentication towards Bitbucket Server APIs.

configApiRef

The ApiRef of ConfigApi.

discoveryApiRef

The ApiRef of DiscoveryApi.

errorApiRef

The ApiRef of ErrorApi.

featureFlagsApiRef

The ApiRef of FeatureFlagsApi.

fetchApiRef

The ApiRef of FetchApi.

githubAuthApiRef

Provides authentication towards GitHub APIs.

gitlabAuthApiRef

Provides authentication towards GitLab APIs.

googleAuthApiRef

Provides authentication towards Google APIs and identities.

identityApiRef

The ApiRef of IdentityApi.

microsoftAuthApiRef

Provides authentication towards Microsoft APIs and identities.

oauthRequestApiRef

The ApiRef of OAuthRequestApi.

oktaAuthApiRef

Provides authentication towards Okta APIs.

oneloginAuthApiRef

Provides authentication towards OneLogin APIs.

storageApiRef

The ApiRef of StorageApi.

vmwareCloudAuthApiRef

Provides authentication towards VMware Cloud APIs and identities.

Type Aliases

Type Alias

Description

AlertApi

The alert API is used to report alerts to the app, and display them to the user.

AlertMessage

Message handled by the AlertApi.

AnalyticsApi

The Analytics API is used to track user behavior in a Backstage instance.

AnalyticsContextValue

Analytics context envelope.

AnalyticsEvent

Represents an event worth tracking in an analytics system that could inform how users of a Backstage instance are using its features.

AnalyticsEventAttributes

A structure allowing other arbitrary metadata to be provided by analytics event emitters.

AnalyticsTracker

Represents a tracker with methods that can be called to track events in a configured analytics service.

AnyApiFactory

Catch-all ApiFactory type.

AnyApiRef

Catch-all ApiRef type.

AnyExternalRoutes

Catch-all type for ExternalRouteRefs.

AnyParams

AnyRouteRefParams

Catch-all type for route params.

AnyRoutes

Catch-all route type.

ApiFactory

Describes type returning API implementations.

ApiHolder

Provides lookup of APIs through their ApiRefs.

ApiRef

API reference.

ApiRefConfig

API reference configuration - holds an ID of the referenced API.

AppComponents

A set of replaceable core components that are part of every Backstage app.

AppContext

The central context providing runtime app specific state that plugin views want to consume.

AppTheme

Describes a theme provided by the app.

AppThemeApi

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.

AuthProviderInfo

Information about the auth provider.

AuthRequestOptions

Configuration of an authentication request.

BackstageIdentityApi

This API provides access to the user's identity within Backstage.

BackstageIdentityResponse

Token and Identity response, with the users claims in the Identity.

BackstagePlugin

Plugin type.

BackstageUserIdentity

User identity information within Backstage.

BootErrorPageProps

Props for the BootErrorPage component of AppComponents.

CommonAnalyticsContext

Common analytics context attributes.

ComponentLoader

Lazy or synchronous retrieving of extension components.

ConfigApi

The Config API is used to provide a mechanism to access the runtime configuration of the system.

DiscoveryApi

The discovery API is used to provide a mechanism for plugins to discover the endpoint to use to talk to their backend counterpart.

ErrorApi

The error API is used to report errors to the app, and display them to the user.

ErrorApiError

Mirrors the JavaScript Error class, for the purpose of providing documentation and optional fields.

ErrorApiErrorContext

Provides additional information about an error that was posted to the application.

ErrorBoundaryFallbackProps

Props for the fallback error boundary.

Extension

Plugin extension type.

ExternalRouteRef

Route descriptor, to be later bound to a concrete route by the app. Used to implement cross-plugin route references.

FeatureFlag

Feature flag descriptor.

FeatureFlagsHooks

Interface for registering feature flags hooks.

FeatureFlagsSaveOptions

Options to use when saving feature flags.

FetchApi

A wrapper for the fetch API, that has additional behaviors such as the ability to automatically inject auth information where necessary.

IconComponent

IconComponent is the common icon type used throughout Backstage when working with and rendering generic icons, including the app system icons.

IdentityApi

The Identity API used to identify and get information about the signed in user.

MakeSubRouteRef

Creates a SubRouteRef type given the desired parameters and parent route parameters. The parameters types are merged together while ensuring that there is no overlap between the two.

MergeParams

Merges a param object type with an optional params type into a params object.

OAuthApi

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.

OAuthRequestApi

Provides helpers for implemented OAuth login flows within Backstage.

OAuthRequester

Function used to trigger new auth requests for a set of scopes.

OAuthRequesterOptions

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.

OAuthScope

An array of scopes, or a scope string formatted according to the auth provider, which is typically a space separated list.

OpenIdConnectApi

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.

OptionalParams

Optional route params.

ParamKeys

Type describing the key type of a route parameter mapping.

ParamNames

Used in PathParams type declaration.

ParamPart

Used in PathParams type declaration.

PathParams

This utility type helps us infer a Param object type from a string path For example, /foo/:bar/:baz inferred to { bar: string, baz: string }

PendingOAuthRequest

An pending auth request for a single auth provider. The request will remain in this pending state until either reject() or trigger() is called.

PluginConfig

Plugin descriptor type.

PluginFeatureFlagConfig

Plugin feature flag configuration.

ProfileInfo

Profile information of the user.

ProfileInfoApi

This API provides access to profile information of the user from an auth provider.

RouteFunc

TS magic for handling route parameters.

RouteRef

Absolute route reference.

SessionApi

The SessionApi provides basic controls for any auth provider that is tied to a persistent session.

SignInPageProps

Props for the SignInPage component of AppComponents.

StorageValueSnapshot

A snapshot in time of the current known value of a storage key.

SubRouteRef

Descriptor of a route relative to an absolute RouteRef.

TypesToApiRefs

Wraps a type with API properties into a type holding their respective ApiRefs.