@backstage/frontend-plugin-api 0.17.0-next.1 → 0.17.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,55 @@
1
1
  # @backstage/frontend-plugin-api
2
2
 
3
+ ## 0.17.1
4
+
5
+ ### Patch Changes
6
+
7
+ - f1cc622: Moved dependencies that are re-exported in the public API from `devDependencies` to `dependencies`. These were incorrectly demoted in #33936 because the source code only uses type imports, but the types still appear in the published API surface and need to be resolvable by consumers at build time.
8
+
9
+ ## 0.17.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 44d77e9: **BREAKING**: Removed the deprecated `NavItemBlueprint`. Navigation items are now discovered from `PageBlueprint` extensions based on their `title` and `icon` params.
14
+
15
+ If you were still using `NavItemBlueprint`, migrate by moving `title` and `icon` to your `PageBlueprint` instead:
16
+
17
+ ```diff
18
+ -const navItem = NavItemBlueprint.make({
19
+ - params: { title: 'Example', icon: ExampleIcon, routeRef },
20
+ -});
21
+ const page = PageBlueprint.make({
22
+ params: {
23
+ + title: 'Example',
24
+ + icon: <ExampleIcon fontSize="inherit" />,
25
+ routeRef,
26
+ path: '/example',
27
+ loader: () => import('./Page').then(m => <m.Page />),
28
+ },
29
+ });
30
+ ```
31
+
32
+ `PageBlueprint` expects an `IconElement` rather than a Material UI `IconComponent`, so this is also a good time to switch to [Remix Icon](https://remixicon.com/) if you were using Material UI icons only for the nav item:
33
+
34
+ ```diff
35
+ -import ExampleIcon from '@material-ui/icons/Extension';
36
+ +import { RiPuzzleLine } from '@remixicon/react';
37
+ ...
38
+ - icon: ExampleIcon,
39
+ + icon: <RiPuzzleLine />,
40
+ ```
41
+
42
+ - 8738203: **BREAKING**: Removed the deprecated property form of `PortableSchema.schema`. The `schema` member is now a plain method that must be called as `schema()` — direct property access like `schema.type` or `schema.properties` is no longer supported.
43
+
44
+ ### Patch Changes
45
+
46
+ - ab1cdbb: Removed a handful of internal imports that referenced the package by its own name. Value imports were switched to relative paths, and type-only imports to `import type`. These self-referential imports could trigger circular initialization errors in bundled ESM and when the package was loaded via `jest.requireActual` — most visibly `Cannot access '_AppRootElementBlueprintesm' before initialization` from `@backstage/frontend-plugin-api`. There are no user-facing API changes.
47
+ - cad156e: Replaced old config schema values from existing extensions and blueprints.
48
+ - 72a552f: Updated error messages and deprecation warnings to clarify that the `zod/v4` subpath export from the Zod v3 package is not supported by `configSchema`, since it does not include JSON Schema conversion. The `zod` dependency has been bumped to `^4.0.0`.
49
+ - Updated dependencies
50
+ - @backstage/errors@1.3.1
51
+ - @backstage/filter-predicates@0.1.3
52
+
3
53
  ## 0.17.0-next.1
4
54
 
5
55
  ### Patch Changes
package/dist/alpha.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { A as AnyRouteRefParams, e as ApiHolder, d as ApiRef, b as AppNode, i as AppNodeEdges, j as AppNodeInstance, k as AppNodeSpec, l as AppTree, C as ConfigurableExtensionDataRef, 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, J as ExtensionInput, E as ExternalRouteRef, c as FrontendPlugin, M as FrontendPluginInfo, I as IconElement, O as OverridableExtensionDefinition, U as PluginWrapperApi, V as PluginWrapperBlueprint, W as PluginWrapperDefinition, X as PortableSchema, R as RouteRef, S as SubRouteRef, $ as createExtensionBlueprintParams, a7 as pluginWrapperApiRef } from './types/alpha.d-CP8HTsBe.js';
1
+ export { A as AnyRouteRefParams, e as ApiHolder, d as ApiRef, b as AppNode, i as AppNodeEdges, j as AppNodeInstance, k as AppNodeSpec, l as AppTree, C as ConfigurableExtensionDataRef, 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, J as ExtensionInput, E as ExternalRouteRef, c as FrontendPlugin, M as FrontendPluginInfo, I as IconElement, O as OverridableExtensionDefinition, U as PluginWrapperApi, V as PluginWrapperBlueprint, W as PluginWrapperDefinition, X as PortableSchema, R as RouteRef, S as SubRouteRef, $ as createExtensionBlueprintParams, a7 as pluginWrapperApiRef } from './types/alpha.d-CLuwPPzU.js';
2
2
  export { StandardSchemaV1 } from '@standard-schema/spec';
3
3
  import '@backstage/frontend-plugin-api';
4
4
  import 'react';
@@ -1 +1 @@
1
- {"version":3,"file":"auth.esm.js","sources":["../../../src/apis/definitions/auth.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/* We want to maintain the same information as an enum, so we disable the redeclaration warning */\n/* eslint-disable @typescript-eslint/no-redeclare */\n\nimport { createApiRef } from '../system';\nimport { IconComponent, IconElement } from '../../icons/types';\nimport { Observable } from '@backstage/types';\n\n/**\n * This file contains declarations for common interfaces of auth-related APIs.\n * The declarations should be used to signal which type of authentication and\n * authorization methods each separate auth provider supports.\n *\n * For example, a Google OAuth provider that supports OAuth 2 and OpenID Connect,\n * would be declared as follows:\n *\n * const googleAuthApiRef = createApiRef<OAuthApi & OpenIDConnectApi>().with({\n * id: 'core.auth.google',\n * pluginId: 'app',\n * })\n */\n\n/**\n * Information about the auth provider.\n *\n * @remarks\n *\n * This information is used both to connect the correct auth provider in the backend, as\n * well as displaying the provider to the user.\n *\n * @public\n */\nexport type AuthProviderInfo = {\n /**\n * The ID of the auth provider. This should match with ID of the provider in the `@backstage/auth-backend`.\n */\n id: string;\n\n /**\n * Title for the auth provider, for example \"GitHub\"\n */\n title: string;\n\n /**\n * Icon for the auth provider.\n *\n * @remarks\n *\n * Accepts either an `IconElement` (e.g. `<MyIcon />`) or an `IconComponent`\n * (e.g. `MyIcon`). Prefer passing `IconElement`.\n */\n icon: IconComponent | IconElement;\n\n /**\n * Optional user friendly messaage to display for the auth provider.\n */\n message?: string;\n};\n\n/**\n * An array of scopes, or a scope string formatted according to the\n * auth provider, which is typically a space separated list.\n *\n * @remarks\n *\n * See the documentation for each auth provider for the list of scopes\n * supported by each provider.\n *\n * @public\n */\nexport type OAuthScope = string | string[];\n\n/**\n * Configuration of an authentication request.\n *\n * @public\n */\nexport type AuthRequestOptions = {\n /**\n * If this is set to true, the user will not be prompted to log in,\n * and an empty response will be returned if there is no existing session.\n *\n * This can be used to perform a check whether the user is logged in, or if you don't\n * want to force a user to be logged in, but provide functionality if they already are.\n *\n * @defaultValue false\n */\n optional?: boolean;\n\n /**\n * If this is set to true, the request will bypass the regular oauth login modal\n * and open the login popup directly.\n *\n * The method must be called synchronously from a user action for this to work in all browsers.\n *\n * @defaultValue false\n */\n instantPopup?: boolean;\n};\n\n/**\n * This API provides access to OAuth 2 credentials. It lets you request access tokens,\n * which can be used to act on behalf of the user when talking to APIs.\n *\n * @public\n */\nexport type OAuthApi = {\n /**\n * Requests an OAuth 2 Access Token, optionally with a set of scopes. The access token allows\n * you to make requests on behalf of the user, and the copes may grant you broader access, depending\n * on the auth provider.\n *\n * Each auth provider has separate handling of scope, so you need to look at the documentation\n * for each one to know what scope you need to request.\n *\n * This method is cheap and should be called each time an access token is used. Do not for example\n * store the access token in React component state, as that could cause the token to expire. Instead\n * fetch a new access token for each request.\n *\n * Be sure to include all required scopes when requesting an access token. When testing your implementation\n * it is best to log out the Backstage session and then visit your plugin page directly, as\n * you might already have some required scopes in your existing session. Not requesting the correct\n * scopes can lead to 403 or other authorization errors, which can be tricky to debug.\n *\n * If the user has not yet granted access to the provider and the set of requested scopes, the user\n * will be prompted to log in. The returned promise will not resolve until the user has\n * successfully logged in. The returned promise can be rejected, but only if the user rejects the login request.\n */\n getAccessToken(\n scope?: OAuthScope,\n options?: AuthRequestOptions,\n ): Promise<string>;\n};\n\n/**\n * This API provides access to OpenID Connect credentials. It lets you request ID tokens,\n * which can be passed to backend services to prove the user's identity.\n *\n * @public\n */\nexport type OpenIdConnectApi = {\n /**\n * Requests an OpenID Connect ID Token.\n *\n * This method is cheap and should be called each time an ID token is used. Do not for example\n * store the id token in React component state, as that could cause the token to expire. Instead\n * fetch a new id token for each request.\n *\n * If the user has not yet logged in to Google inside Backstage, the user will be prompted\n * to log in. The returned promise will not resolve until the user has successfully logged in.\n * The returned promise can be rejected, but only if the user rejects the login request.\n */\n getIdToken(options?: AuthRequestOptions): Promise<string>;\n};\n\n/**\n * This API provides access to profile information of the user from an auth provider.\n *\n * @public\n */\nexport type ProfileInfoApi = {\n /**\n * Get profile information for the user as supplied by this auth provider.\n *\n * If the optional flag is not set, a session is guaranteed to be returned, while if\n * the optional flag is set, the session may be undefined. See {@link AuthRequestOptions} for more details.\n */\n getProfile(options?: AuthRequestOptions): Promise<ProfileInfo | undefined>;\n};\n\n/**\n * This API provides access to the user's identity within Backstage.\n *\n * @remarks\n *\n * An auth provider that implements this interface can be used to sign-in to backstage. It is\n * not intended to be used directly from a plugin, but instead serves as a connection between\n * this authentication method and the app's {@link IdentityApi}\n *\n * @public\n */\nexport type BackstageIdentityApi = {\n /**\n * Get the user's identity within Backstage. This should normally not be called directly,\n * use the {@link IdentityApi} instead.\n *\n * If the optional flag is not set, a session is guaranteed to be returned, while if\n * the optional flag is set, the session may be undefined. See {@link AuthRequestOptions} for more details.\n */\n getBackstageIdentity(\n options?: AuthRequestOptions,\n ): Promise<BackstageIdentityResponse | undefined>;\n};\n\n/**\n * User identity information within Backstage.\n *\n * @public\n */\nexport type BackstageUserIdentity = {\n /**\n * The type of identity that this structure represents. In the frontend app\n * this will currently always be 'user'.\n */\n type: 'user';\n\n /**\n * The entityRef of the user in the catalog.\n * For example User:default/sandra\n */\n userEntityRef: string;\n\n /**\n * The user and group entities that the user claims ownership through\n */\n ownershipEntityRefs: string[];\n};\n\n/**\n * Token and Identity response, with the users claims in the Identity.\n *\n * @public\n */\nexport type BackstageIdentityResponse = {\n /**\n * The token used to authenticate the user within Backstage.\n */\n token: string;\n\n /**\n * The time at which the token expires. If not set, it can be assumed that the token does not expire.\n */\n expiresAt?: Date;\n\n /**\n * Identity information derived from the token.\n */\n identity: BackstageUserIdentity;\n};\n\n/**\n * Profile information of the user.\n *\n * @public\n */\nexport type ProfileInfo = {\n /**\n * Email ID.\n */\n email?: string;\n\n /**\n * Display name that can be presented to the user.\n */\n displayName?: string;\n\n /**\n * URL to an avatar image of the user.\n */\n picture?: string;\n};\n\n/**\n * Session state values passed to subscribers of the SessionApi.\n *\n * @public\n */\nexport const SessionState = {\n /**\n * User signed in.\n */\n SignedIn: 'SignedIn',\n /**\n * User not signed in.\n */\n SignedOut: 'SignedOut',\n} as const;\n\n/**\n * @public\n */\nexport type SessionState = (typeof SessionState)[keyof typeof SessionState];\n\n/**\n * @public\n */\nexport namespace SessionState {\n export type SignedIn = typeof SessionState.SignedIn;\n export type SignedOut = typeof SessionState.SignedOut;\n}\n\n/**\n * The SessionApi provides basic controls for any auth provider that is tied to a persistent session.\n *\n * @public\n */\nexport type SessionApi = {\n /**\n * Sign in with a minimum set of permissions.\n */\n signIn(): Promise<void>;\n\n /**\n * Sign out from the current session. This will reload the page.\n */\n signOut(): Promise<void>;\n\n /**\n * Observe the current state of the auth session. Emits the current state on subscription.\n */\n sessionState$(): Observable<SessionState>;\n};\n\n/**\n * Provides authentication towards Google APIs and identities.\n *\n * @public\n * @remarks\n *\n * See {@link https://developers.google.com/identity/protocols/googlescopes} for a full list of supported scopes.\n *\n * Note that the ID token payload is only guaranteed to contain the user's numerical Google ID,\n * email and expiration information. Do not rely on any other fields, as they might not be present.\n */\nexport const googleAuthApiRef = createApiRef<\n OAuthApi &\n OpenIdConnectApi &\n ProfileInfoApi &\n BackstageIdentityApi &\n SessionApi\n>().with({\n id: 'core.auth.google',\n pluginId: 'app',\n});\n\n/**\n * Provides authentication towards GitHub APIs.\n *\n * @public\n * @remarks\n *\n * See {@link https://developer.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/}\n * for a full list of supported scopes.\n */\nexport const githubAuthApiRef = createApiRef<\n OAuthApi & ProfileInfoApi & BackstageIdentityApi & SessionApi\n>().with({\n id: 'core.auth.github',\n pluginId: 'app',\n});\n\n/**\n * Provides authentication towards Okta APIs.\n *\n * @public\n * @remarks\n *\n * See {@link https://developer.okta.com/docs/guides/implement-oauth-for-okta/scopes/}\n * for a full list of supported scopes.\n */\nexport const oktaAuthApiRef = createApiRef<\n OAuthApi &\n OpenIdConnectApi &\n ProfileInfoApi &\n BackstageIdentityApi &\n SessionApi\n>().with({\n id: 'core.auth.okta',\n pluginId: 'app',\n});\n\n/**\n * Provides authentication towards GitLab APIs.\n *\n * @public\n * @remarks\n *\n * See {@link https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html#limiting-scopes-of-a-personal-access-token}\n * for a full list of supported scopes.\n */\nexport const gitlabAuthApiRef = createApiRef<\n OAuthApi &\n OpenIdConnectApi &\n ProfileInfoApi &\n BackstageIdentityApi &\n SessionApi\n>().with({\n id: 'core.auth.gitlab',\n pluginId: 'app',\n});\n\n/**\n * Provides authentication towards Microsoft APIs and identities.\n *\n * @public\n * @remarks\n *\n * For more info and a full list of supported scopes, see:\n * - {@link https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-permissions-and-consent}\n * - {@link https://docs.microsoft.com/en-us/graph/permissions-reference}\n */\nexport const microsoftAuthApiRef = createApiRef<\n OAuthApi &\n OpenIdConnectApi &\n ProfileInfoApi &\n BackstageIdentityApi &\n SessionApi\n>().with({\n id: 'core.auth.microsoft',\n pluginId: 'app',\n});\n\n/**\n * Provides authentication towards OneLogin APIs.\n *\n * @public\n */\nexport const oneloginAuthApiRef = createApiRef<\n OAuthApi &\n OpenIdConnectApi &\n ProfileInfoApi &\n BackstageIdentityApi &\n SessionApi\n>().with({\n id: 'core.auth.onelogin',\n pluginId: 'app',\n});\n\n/**\n * Provides authentication towards Bitbucket APIs.\n *\n * @public\n * @remarks\n *\n * See {@link https://support.atlassian.com/bitbucket-cloud/docs/use-oauth-on-bitbucket-cloud/}\n * for a full list of supported scopes.\n */\nexport const bitbucketAuthApiRef = createApiRef<\n OAuthApi & ProfileInfoApi & BackstageIdentityApi & SessionApi\n>().with({\n id: 'core.auth.bitbucket',\n pluginId: 'app',\n});\n\n/**\n * Provides authentication towards Bitbucket Server APIs.\n *\n * @public\n * @remarks\n *\n * See {@link https://confluence.atlassian.com/bitbucketserver/bitbucket-oauth-2-0-provider-api-1108483661.html#BitbucketOAuth2.0providerAPI-scopes}\n * for a full list of supported scopes.\n */\nexport const bitbucketServerAuthApiRef = createApiRef<\n OAuthApi & ProfileInfoApi & BackstageIdentityApi & SessionApi\n>().with({\n id: 'core.auth.bitbucket-server',\n pluginId: 'app',\n});\n\n/**\n * Provides authentication towards Atlassian APIs.\n *\n * @public\n * @remarks\n *\n * See {@link https://developer.atlassian.com/cloud/jira/platform/scopes-for-connect-and-oauth-2-3LO-apps/}\n * for a full list of supported scopes.\n */\nexport const atlassianAuthApiRef = createApiRef<\n OAuthApi & ProfileInfoApi & BackstageIdentityApi & SessionApi\n>().with({\n id: 'core.auth.atlassian',\n pluginId: 'app',\n});\n\n/**\n * Provides authentication towards VMware Cloud APIs and identities.\n *\n * @public\n * @remarks\n *\n * For more info about VMware Cloud identity and access management:\n * - {@link https://docs.vmware.com/en/VMware-Cloud-services/services/Using-VMware-Cloud-Services/GUID-53D39337-D93A-4B84-BD18-DDF43C21479A.html}\n */\nexport const vmwareCloudAuthApiRef = createApiRef<\n OAuthApi &\n OpenIdConnectApi &\n ProfileInfoApi &\n BackstageIdentityApi &\n SessionApi\n>().with({\n id: 'core.auth.vmware-cloud',\n pluginId: 'app',\n});\n\n/**\n * Provides authentication towards OpenShift APIs and identities.\n *\n * @public\n * @remarks\n *\n * See {@link https://docs.redhat.com/en/documentation/openshift_container_platform/latest/html/authentication_and_authorization/configuring-oauth-clients}\n * on how to configure the OAuth clients and\n * {@link https://docs.redhat.com/en/documentation/openshift_container_platform/latest/html-single/authentication_and_authorization/index#tokens-scoping-about_configuring-internal-oauth}\n * for available scopes.\n */\nexport const openshiftAuthApiRef = createApiRef<\n OAuthApi & ProfileInfoApi & BackstageIdentityApi & SessionApi\n>().with({\n id: 'core.auth.openshift',\n pluginId: 'app',\n});\n"],"names":[],"mappings":";;;;;AAyRO,MAAM,YAAA,GAAe;AAAA;AAAA;AAAA;AAAA,EAI1B,QAAA,EAAU,UAAA;AAAA;AAAA;AAAA;AAAA,EAIV,SAAA,EAAW;AACb;AAgDO,MAAM,gBAAA,GAAmB,YAAA,EAM9B,CAAE,IAAA,CAAK;AAAA,EACP,EAAA,EAAI,kBAAA;AAAA,EACJ,QAAA,EAAU;AACZ,CAAC;AAWM,MAAM,gBAAA,GAAmB,YAAA,EAE9B,CAAE,IAAA,CAAK;AAAA,EACP,EAAA,EAAI,kBAAA;AAAA,EACJ,QAAA,EAAU;AACZ,CAAC;AAWM,MAAM,cAAA,GAAiB,YAAA,EAM5B,CAAE,IAAA,CAAK;AAAA,EACP,EAAA,EAAI,gBAAA;AAAA,EACJ,QAAA,EAAU;AACZ,CAAC;AAWM,MAAM,gBAAA,GAAmB,YAAA,EAM9B,CAAE,IAAA,CAAK;AAAA,EACP,EAAA,EAAI,kBAAA;AAAA,EACJ,QAAA,EAAU;AACZ,CAAC;AAYM,MAAM,mBAAA,GAAsB,YAAA,EAMjC,CAAE,IAAA,CAAK;AAAA,EACP,EAAA,EAAI,qBAAA;AAAA,EACJ,QAAA,EAAU;AACZ,CAAC;AAOM,MAAM,kBAAA,GAAqB,YAAA,EAMhC,CAAE,IAAA,CAAK;AAAA,EACP,EAAA,EAAI,oBAAA;AAAA,EACJ,QAAA,EAAU;AACZ,CAAC;AAWM,MAAM,mBAAA,GAAsB,YAAA,EAEjC,CAAE,IAAA,CAAK;AAAA,EACP,EAAA,EAAI,qBAAA;AAAA,EACJ,QAAA,EAAU;AACZ,CAAC;AAWM,MAAM,yBAAA,GAA4B,YAAA,EAEvC,CAAE,IAAA,CAAK;AAAA,EACP,EAAA,EAAI,4BAAA;AAAA,EACJ,QAAA,EAAU;AACZ,CAAC;AAWM,MAAM,mBAAA,GAAsB,YAAA,EAEjC,CAAE,IAAA,CAAK;AAAA,EACP,EAAA,EAAI,qBAAA;AAAA,EACJ,QAAA,EAAU;AACZ,CAAC;AAWM,MAAM,qBAAA,GAAwB,YAAA,EAMnC,CAAE,IAAA,CAAK;AAAA,EACP,EAAA,EAAI,wBAAA;AAAA,EACJ,QAAA,EAAU;AACZ,CAAC;AAaM,MAAM,mBAAA,GAAsB,YAAA,EAEjC,CAAE,IAAA,CAAK;AAAA,EACP,EAAA,EAAI,qBAAA;AAAA,EACJ,QAAA,EAAU;AACZ,CAAC;;;;"}
1
+ {"version":3,"file":"auth.esm.js","sources":["../../../src/apis/definitions/auth.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/* We want to maintain the same information as an enum, so we disable the redeclaration warning */\n/* eslint-disable @typescript-eslint/no-redeclare */\n\nimport { createApiRef } from '../system';\nimport { IconComponent, IconElement } from '../../icons/types';\nimport { Observable } from '@backstage/types';\n\n/**\n * This file contains declarations for common interfaces of auth-related APIs.\n * The declarations should be used to signal which type of authentication and\n * authorization methods each separate auth provider supports.\n *\n * For example, a Google OAuth provider that supports OAuth 2 and OpenID Connect,\n * would be declared as follows:\n *\n * const googleAuthApiRef = createApiRef<OAuthApi & OpenIDConnectApi>().with({\n * id: 'core.auth.google',\n * pluginId: 'app',\n * })\n */\n\n/**\n * Information about the auth provider.\n *\n * @remarks\n *\n * This information is used both to connect the correct auth provider in the backend, as\n * well as displaying the provider to the user.\n *\n * @public\n */\nexport type AuthProviderInfo = {\n /**\n * The ID of the auth provider. This should match with ID of the provider in the `@backstage/auth-backend`.\n */\n id: string;\n\n /**\n * Title for the auth provider, for example \"GitHub\"\n */\n title: string;\n\n /**\n * Icon for the auth provider.\n *\n * @remarks\n *\n * Accepts either an `IconElement` (e.g. `<MyIcon />`) or an `IconComponent`\n * (e.g. `MyIcon`). Prefer passing `IconElement`.\n */\n icon: IconComponent | IconElement;\n\n /**\n * Optional user friendly message to display for the auth provider.\n */\n message?: string;\n};\n\n/**\n * An array of scopes, or a scope string formatted according to the\n * auth provider, which is typically a space separated list.\n *\n * @remarks\n *\n * See the documentation for each auth provider for the list of scopes\n * supported by each provider.\n *\n * @public\n */\nexport type OAuthScope = string | string[];\n\n/**\n * Configuration of an authentication request.\n *\n * @public\n */\nexport type AuthRequestOptions = {\n /**\n * If this is set to true, the user will not be prompted to log in,\n * and an empty response will be returned if there is no existing session.\n *\n * This can be used to perform a check whether the user is logged in, or if you don't\n * want to force a user to be logged in, but provide functionality if they already are.\n *\n * @defaultValue false\n */\n optional?: boolean;\n\n /**\n * If this is set to true, the request will bypass the regular oauth login modal\n * and open the login popup directly.\n *\n * The method must be called synchronously from a user action for this to work in all browsers.\n *\n * @defaultValue false\n */\n instantPopup?: boolean;\n};\n\n/**\n * This API provides access to OAuth 2 credentials. It lets you request access tokens,\n * which can be used to act on behalf of the user when talking to APIs.\n *\n * @public\n */\nexport type OAuthApi = {\n /**\n * Requests an OAuth 2 Access Token, optionally with a set of scopes. The access token allows\n * you to make requests on behalf of the user, and the copes may grant you broader access, depending\n * on the auth provider.\n *\n * Each auth provider has separate handling of scope, so you need to look at the documentation\n * for each one to know what scope you need to request.\n *\n * This method is cheap and should be called each time an access token is used. Do not for example\n * store the access token in React component state, as that could cause the token to expire. Instead\n * fetch a new access token for each request.\n *\n * Be sure to include all required scopes when requesting an access token. When testing your implementation\n * it is best to log out the Backstage session and then visit your plugin page directly, as\n * you might already have some required scopes in your existing session. Not requesting the correct\n * scopes can lead to 403 or other authorization errors, which can be tricky to debug.\n *\n * If the user has not yet granted access to the provider and the set of requested scopes, the user\n * will be prompted to log in. The returned promise will not resolve until the user has\n * successfully logged in. The returned promise can be rejected, but only if the user rejects the login request.\n */\n getAccessToken(\n scope?: OAuthScope,\n options?: AuthRequestOptions,\n ): Promise<string>;\n};\n\n/**\n * This API provides access to OpenID Connect credentials. It lets you request ID tokens,\n * which can be passed to backend services to prove the user's identity.\n *\n * @public\n */\nexport type OpenIdConnectApi = {\n /**\n * Requests an OpenID Connect ID Token.\n *\n * This method is cheap and should be called each time an ID token is used. Do not for example\n * store the id token in React component state, as that could cause the token to expire. Instead\n * fetch a new id token for each request.\n *\n * If the user has not yet logged in to Google inside Backstage, the user will be prompted\n * to log in. The returned promise will not resolve until the user has successfully logged in.\n * The returned promise can be rejected, but only if the user rejects the login request.\n */\n getIdToken(options?: AuthRequestOptions): Promise<string>;\n};\n\n/**\n * This API provides access to profile information of the user from an auth provider.\n *\n * @public\n */\nexport type ProfileInfoApi = {\n /**\n * Get profile information for the user as supplied by this auth provider.\n *\n * If the optional flag is not set, a session is guaranteed to be returned, while if\n * the optional flag is set, the session may be undefined. See {@link AuthRequestOptions} for more details.\n */\n getProfile(options?: AuthRequestOptions): Promise<ProfileInfo | undefined>;\n};\n\n/**\n * This API provides access to the user's identity within Backstage.\n *\n * @remarks\n *\n * An auth provider that implements this interface can be used to sign-in to backstage. It is\n * not intended to be used directly from a plugin, but instead serves as a connection between\n * this authentication method and the app's {@link IdentityApi}\n *\n * @public\n */\nexport type BackstageIdentityApi = {\n /**\n * Get the user's identity within Backstage. This should normally not be called directly,\n * use the {@link IdentityApi} instead.\n *\n * If the optional flag is not set, a session is guaranteed to be returned, while if\n * the optional flag is set, the session may be undefined. See {@link AuthRequestOptions} for more details.\n */\n getBackstageIdentity(\n options?: AuthRequestOptions,\n ): Promise<BackstageIdentityResponse | undefined>;\n};\n\n/**\n * User identity information within Backstage.\n *\n * @public\n */\nexport type BackstageUserIdentity = {\n /**\n * The type of identity that this structure represents. In the frontend app\n * this will currently always be 'user'.\n */\n type: 'user';\n\n /**\n * The entityRef of the user in the catalog.\n * For example User:default/sandra\n */\n userEntityRef: string;\n\n /**\n * The user and group entities that the user claims ownership through\n */\n ownershipEntityRefs: string[];\n};\n\n/**\n * Token and Identity response, with the users claims in the Identity.\n *\n * @public\n */\nexport type BackstageIdentityResponse = {\n /**\n * The token used to authenticate the user within Backstage.\n */\n token: string;\n\n /**\n * The time at which the token expires. If not set, it can be assumed that the token does not expire.\n */\n expiresAt?: Date;\n\n /**\n * Identity information derived from the token.\n */\n identity: BackstageUserIdentity;\n};\n\n/**\n * Profile information of the user.\n *\n * @public\n */\nexport type ProfileInfo = {\n /**\n * Email ID.\n */\n email?: string;\n\n /**\n * Display name that can be presented to the user.\n */\n displayName?: string;\n\n /**\n * URL to an avatar image of the user.\n */\n picture?: string;\n};\n\n/**\n * Session state values passed to subscribers of the SessionApi.\n *\n * @public\n */\nexport const SessionState = {\n /**\n * User signed in.\n */\n SignedIn: 'SignedIn',\n /**\n * User not signed in.\n */\n SignedOut: 'SignedOut',\n} as const;\n\n/**\n * @public\n */\nexport type SessionState = (typeof SessionState)[keyof typeof SessionState];\n\n/**\n * @public\n */\nexport namespace SessionState {\n export type SignedIn = typeof SessionState.SignedIn;\n export type SignedOut = typeof SessionState.SignedOut;\n}\n\n/**\n * The SessionApi provides basic controls for any auth provider that is tied to a persistent session.\n *\n * @public\n */\nexport type SessionApi = {\n /**\n * Sign in with a minimum set of permissions.\n */\n signIn(): Promise<void>;\n\n /**\n * Sign out from the current session. This will reload the page.\n */\n signOut(): Promise<void>;\n\n /**\n * Observe the current state of the auth session. Emits the current state on subscription.\n */\n sessionState$(): Observable<SessionState>;\n};\n\n/**\n * Provides authentication towards Google APIs and identities.\n *\n * @public\n * @remarks\n *\n * See {@link https://developers.google.com/identity/protocols/googlescopes} for a full list of supported scopes.\n *\n * Note that the ID token payload is only guaranteed to contain the user's numerical Google ID,\n * email and expiration information. Do not rely on any other fields, as they might not be present.\n */\nexport const googleAuthApiRef = createApiRef<\n OAuthApi &\n OpenIdConnectApi &\n ProfileInfoApi &\n BackstageIdentityApi &\n SessionApi\n>().with({\n id: 'core.auth.google',\n pluginId: 'app',\n});\n\n/**\n * Provides authentication towards GitHub APIs.\n *\n * @public\n * @remarks\n *\n * See {@link https://developer.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/}\n * for a full list of supported scopes.\n */\nexport const githubAuthApiRef = createApiRef<\n OAuthApi & ProfileInfoApi & BackstageIdentityApi & SessionApi\n>().with({\n id: 'core.auth.github',\n pluginId: 'app',\n});\n\n/**\n * Provides authentication towards Okta APIs.\n *\n * @public\n * @remarks\n *\n * See {@link https://developer.okta.com/docs/guides/implement-oauth-for-okta/scopes/}\n * for a full list of supported scopes.\n */\nexport const oktaAuthApiRef = createApiRef<\n OAuthApi &\n OpenIdConnectApi &\n ProfileInfoApi &\n BackstageIdentityApi &\n SessionApi\n>().with({\n id: 'core.auth.okta',\n pluginId: 'app',\n});\n\n/**\n * Provides authentication towards GitLab APIs.\n *\n * @public\n * @remarks\n *\n * See {@link https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html#limiting-scopes-of-a-personal-access-token}\n * for a full list of supported scopes.\n */\nexport const gitlabAuthApiRef = createApiRef<\n OAuthApi &\n OpenIdConnectApi &\n ProfileInfoApi &\n BackstageIdentityApi &\n SessionApi\n>().with({\n id: 'core.auth.gitlab',\n pluginId: 'app',\n});\n\n/**\n * Provides authentication towards Microsoft APIs and identities.\n *\n * @public\n * @remarks\n *\n * For more info and a full list of supported scopes, see:\n * - {@link https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-permissions-and-consent}\n * - {@link https://docs.microsoft.com/en-us/graph/permissions-reference}\n */\nexport const microsoftAuthApiRef = createApiRef<\n OAuthApi &\n OpenIdConnectApi &\n ProfileInfoApi &\n BackstageIdentityApi &\n SessionApi\n>().with({\n id: 'core.auth.microsoft',\n pluginId: 'app',\n});\n\n/**\n * Provides authentication towards OneLogin APIs.\n *\n * @public\n */\nexport const oneloginAuthApiRef = createApiRef<\n OAuthApi &\n OpenIdConnectApi &\n ProfileInfoApi &\n BackstageIdentityApi &\n SessionApi\n>().with({\n id: 'core.auth.onelogin',\n pluginId: 'app',\n});\n\n/**\n * Provides authentication towards Bitbucket APIs.\n *\n * @public\n * @remarks\n *\n * See {@link https://support.atlassian.com/bitbucket-cloud/docs/use-oauth-on-bitbucket-cloud/}\n * for a full list of supported scopes.\n */\nexport const bitbucketAuthApiRef = createApiRef<\n OAuthApi & ProfileInfoApi & BackstageIdentityApi & SessionApi\n>().with({\n id: 'core.auth.bitbucket',\n pluginId: 'app',\n});\n\n/**\n * Provides authentication towards Bitbucket Server APIs.\n *\n * @public\n * @remarks\n *\n * See {@link https://confluence.atlassian.com/bitbucketserver/bitbucket-oauth-2-0-provider-api-1108483661.html#BitbucketOAuth2.0providerAPI-scopes}\n * for a full list of supported scopes.\n */\nexport const bitbucketServerAuthApiRef = createApiRef<\n OAuthApi & ProfileInfoApi & BackstageIdentityApi & SessionApi\n>().with({\n id: 'core.auth.bitbucket-server',\n pluginId: 'app',\n});\n\n/**\n * Provides authentication towards Atlassian APIs.\n *\n * @public\n * @remarks\n *\n * See {@link https://developer.atlassian.com/cloud/jira/platform/scopes-for-connect-and-oauth-2-3LO-apps/}\n * for a full list of supported scopes.\n */\nexport const atlassianAuthApiRef = createApiRef<\n OAuthApi & ProfileInfoApi & BackstageIdentityApi & SessionApi\n>().with({\n id: 'core.auth.atlassian',\n pluginId: 'app',\n});\n\n/**\n * Provides authentication towards VMware Cloud APIs and identities.\n *\n * @public\n * @remarks\n *\n * For more info about VMware Cloud identity and access management:\n * - {@link https://docs.vmware.com/en/VMware-Cloud-services/services/Using-VMware-Cloud-Services/GUID-53D39337-D93A-4B84-BD18-DDF43C21479A.html}\n */\nexport const vmwareCloudAuthApiRef = createApiRef<\n OAuthApi &\n OpenIdConnectApi &\n ProfileInfoApi &\n BackstageIdentityApi &\n SessionApi\n>().with({\n id: 'core.auth.vmware-cloud',\n pluginId: 'app',\n});\n\n/**\n * Provides authentication towards OpenShift APIs and identities.\n *\n * @public\n * @remarks\n *\n * See {@link https://docs.redhat.com/en/documentation/openshift_container_platform/latest/html/authentication_and_authorization/configuring-oauth-clients}\n * on how to configure the OAuth clients and\n * {@link https://docs.redhat.com/en/documentation/openshift_container_platform/latest/html-single/authentication_and_authorization/index#tokens-scoping-about_configuring-internal-oauth}\n * for available scopes.\n */\nexport const openshiftAuthApiRef = createApiRef<\n OAuthApi & ProfileInfoApi & BackstageIdentityApi & SessionApi\n>().with({\n id: 'core.auth.openshift',\n pluginId: 'app',\n});\n"],"names":[],"mappings":";;;;;AAyRO,MAAM,YAAA,GAAe;AAAA;AAAA;AAAA;AAAA,EAI1B,QAAA,EAAU,UAAA;AAAA;AAAA;AAAA;AAAA,EAIV,SAAA,EAAW;AACb;AAgDO,MAAM,gBAAA,GAAmB,YAAA,EAM9B,CAAE,IAAA,CAAK;AAAA,EACP,EAAA,EAAI,kBAAA;AAAA,EACJ,QAAA,EAAU;AACZ,CAAC;AAWM,MAAM,gBAAA,GAAmB,YAAA,EAE9B,CAAE,IAAA,CAAK;AAAA,EACP,EAAA,EAAI,kBAAA;AAAA,EACJ,QAAA,EAAU;AACZ,CAAC;AAWM,MAAM,cAAA,GAAiB,YAAA,EAM5B,CAAE,IAAA,CAAK;AAAA,EACP,EAAA,EAAI,gBAAA;AAAA,EACJ,QAAA,EAAU;AACZ,CAAC;AAWM,MAAM,gBAAA,GAAmB,YAAA,EAM9B,CAAE,IAAA,CAAK;AAAA,EACP,EAAA,EAAI,kBAAA;AAAA,EACJ,QAAA,EAAU;AACZ,CAAC;AAYM,MAAM,mBAAA,GAAsB,YAAA,EAMjC,CAAE,IAAA,CAAK;AAAA,EACP,EAAA,EAAI,qBAAA;AAAA,EACJ,QAAA,EAAU;AACZ,CAAC;AAOM,MAAM,kBAAA,GAAqB,YAAA,EAMhC,CAAE,IAAA,CAAK;AAAA,EACP,EAAA,EAAI,oBAAA;AAAA,EACJ,QAAA,EAAU;AACZ,CAAC;AAWM,MAAM,mBAAA,GAAsB,YAAA,EAEjC,CAAE,IAAA,CAAK;AAAA,EACP,EAAA,EAAI,qBAAA;AAAA,EACJ,QAAA,EAAU;AACZ,CAAC;AAWM,MAAM,yBAAA,GAA4B,YAAA,EAEvC,CAAE,IAAA,CAAK;AAAA,EACP,EAAA,EAAI,4BAAA;AAAA,EACJ,QAAA,EAAU;AACZ,CAAC;AAWM,MAAM,mBAAA,GAAsB,YAAA,EAEjC,CAAE,IAAA,CAAK;AAAA,EACP,EAAA,EAAI,qBAAA;AAAA,EACJ,QAAA,EAAU;AACZ,CAAC;AAWM,MAAM,qBAAA,GAAwB,YAAA,EAMnC,CAAE,IAAA,CAAK;AAAA,EACP,EAAA,EAAI,wBAAA;AAAA,EACJ,QAAA,EAAU;AACZ,CAAC;AAaM,MAAM,mBAAA,GAAsB,YAAA,EAEjC,CAAE,IAAA,CAAK;AAAA,EACP,EAAA,EAAI,qBAAA;AAAA,EACJ,QAAA,EAAU;AACZ,CAAC;;;;"}
package/dist/index.d.ts CHANGED
@@ -2,8 +2,8 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as react from 'react';
3
3
  import { ReactNode, JSX as JSX$1, ComponentType, PropsWithChildren } from 'react';
4
4
  import * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api';
5
- 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-CP8HTsBe.js';
6
- 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-CP8HTsBe.js';
5
+ 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-CLuwPPzU.js';
6
+ 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-CLuwPPzU.js';
7
7
  import { Observable, JsonValue, Expand, ExpandRecursive } from '@backstage/types';
8
8
  import { Config } from '@backstage/config';
9
9
  export { StandardSchemaV1 } from '@standard-schema/spec';
@@ -134,7 +134,7 @@ type AuthProviderInfo = {
134
134
  */
135
135
  icon: IconComponent | IconElement;
136
136
  /**
137
- * Optional user friendly messaage to display for the auth provider.
137
+ * Optional user friendly message to display for the auth provider.
138
138
  */
139
139
  message?: string;
140
140
  };
@@ -2246,43 +2246,6 @@ declare const AppRootElementBlueprint: _backstage_frontend_plugin_api.ExtensionB
2246
2246
  dataRefs: never;
2247
2247
  }>;
2248
2248
 
2249
- /**
2250
- * Creates extensions that make up the items of the nav bar.
2251
- *
2252
- * @public
2253
- * @deprecated Nav items are now automatically inferred from `PageBlueprint`
2254
- * extensions based on their `title` and `icon` params. You can remove your
2255
- * `NavItemBlueprint` usage and instead pass `title` and `icon` directly to
2256
- * the `PageBlueprint`.
2257
- */
2258
- declare const NavItemBlueprint: _backstage_frontend_plugin_api.ExtensionBlueprint<{
2259
- kind: "nav-item";
2260
- params: {
2261
- title: string;
2262
- icon: IconComponent;
2263
- routeRef: RouteRef<undefined>;
2264
- };
2265
- output: _backstage_frontend_plugin_api.ExtensionDataRef<{
2266
- title: string;
2267
- icon: IconComponent;
2268
- routeRef: RouteRef<undefined>;
2269
- }, "core.nav-item.target", {}>;
2270
- inputs: {};
2271
- config: {
2272
- title: string | undefined;
2273
- };
2274
- configInput: {
2275
- title?: string | undefined;
2276
- };
2277
- dataRefs: {
2278
- target: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<{
2279
- title: string;
2280
- icon: IconComponent;
2281
- routeRef: RouteRef<undefined>;
2282
- }, "core.nav-item.target", {}>;
2283
- };
2284
- }>;
2285
-
2286
2249
  /**
2287
2250
  * Creates extensions that are routable React page components.
2288
2251
  *
@@ -2419,5 +2382,5 @@ declare const PluginHeaderActionBlueprint: _backstage_frontend_plugin_api.Extens
2419
2382
  dataRefs: never;
2420
2383
  }>;
2421
2384
 
2422
- 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 };
2385
+ export { AnalyticsContext, AnalyticsImplementationBlueprint, AnyApiFactory, AnyRouteRefParams, ApiBlueprint, ApiFactory, ApiHolder, ApiRef, AppNode, AppRootElementBlueprint, ErrorDisplay, ExtensionBoundary, ExternalRouteRef, FeatureFlagState, FrontendFeature, FrontendPlugin, IconComponent, IconElement, 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 };
2423
2386
  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 };
package/dist/index.esm.js CHANGED
@@ -28,7 +28,6 @@ export { createApiFactory } from './apis/system/helpers.esm.js';
28
28
  export { AnalyticsImplementationBlueprint } from './blueprints/AnalyticsImplementationBlueprint.esm.js';
29
29
  export { ApiBlueprint } from './blueprints/ApiBlueprint.esm.js';
30
30
  export { AppRootElementBlueprint } from './blueprints/AppRootElementBlueprint.esm.js';
31
- export { NavItemBlueprint } from './blueprints/NavItemBlueprint.esm.js';
32
31
  export { PageBlueprint } from './blueprints/PageBlueprint.esm.js';
33
32
  export { SubPageBlueprint } from './blueprints/SubPageBlueprint.esm.js';
34
33
  export { PluginHeaderActionBlueprint } from './blueprints/PluginHeaderActionBlueprint.esm.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -696,8 +696,8 @@ type FrontendFeature = (Omit<FrontendPlugin, 'pluginId'> & {
696
696
  * @remarks
697
697
  *
698
698
  * This function is primarily intended to enable the use of inferred type
699
- * parameters for blueprint params, but it can also be used to transoform the
700
- * params before they are handed ot the blueprint.
699
+ * parameters for blueprint params, but it can also be used to transform the
700
+ * params before they are handed to the blueprint.
701
701
  *
702
702
  * The function must return an object created with
703
703
  * {@link createExtensionBlueprintParams}.
@@ -1 +1 @@
1
- {"version":3,"file":"createExtensionBlueprint.esm.js","sources":["../../src/wiring/createExtensionBlueprint.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ApiHolder, AppNode } from '../apis';\nimport { Expand } from '@backstage/types';\nimport { OpaqueType } from '@internal/opaque';\nimport {\n ExtensionDefinitionAttachTo,\n OverridableExtensionDefinition,\n ResolvedExtensionInputs,\n VerifyExtensionFactoryOutput,\n createExtension,\n ctxParamsSymbol,\n VerifyExtensionAttachTo,\n} from './createExtension';\nimport type { z } from 'zod/v3';\nimport { ExtensionInput } from './createExtensionInput';\nimport { type StandardSchemaV1 } from '@standard-schema/spec';\nimport { ExtensionDataRef, ExtensionDataValue } from './createExtensionDataRef';\nimport { createExtensionDataContainer } from '@internal/frontend';\nimport {\n ResolvedInputValueOverrides,\n resolveInputOverrides,\n} from './resolveInputOverrides';\nimport { ExtensionDataContainer } from './types';\nimport { PageBlueprint } from '../blueprints/PageBlueprint';\nimport { FilterPredicate } from '@backstage/filter-predicates';\nimport { warnConfigSchemaPropDeprecation } from '../schema/createPortableSchema';\nimport { describeParentCallSite } from '../routing/describeParentCallSite';\n\n/**\n * A function used to define a parameter mapping function in order to facilitate\n * advanced parameter typing for extension blueprints.\n *\n * @remarks\n *\n * This function is primarily intended to enable the use of inferred type\n * parameters for blueprint params, but it can also be used to transoform the\n * params before they are handed ot the blueprint.\n *\n * The function must return an object created with\n * {@link createExtensionBlueprintParams}.\n *\n * @public\n */\nexport type ExtensionBlueprintDefineParams<\n TParams extends object = object,\n TInput = any,\n> = (params: TInput) => ExtensionBlueprintParams<TParams>;\n\n/**\n * An opaque type that represents a set of parameters to be passed to a blueprint.\n *\n * @remarks\n *\n * Created with {@link createExtensionBlueprintParams}.\n *\n * @public\n */\nexport type ExtensionBlueprintParams<T extends object = object> = {\n $$type: '@backstage/BlueprintParams';\n T: T;\n};\n\nconst OpaqueBlueprintParams = OpaqueType.create<{\n public: ExtensionBlueprintParams;\n versions: {\n version: 'v1';\n params: object;\n };\n}>({\n type: '@backstage/BlueprintParams',\n versions: ['v1'],\n});\n\n/**\n * Wraps a plain blueprint parameter object in an opaque {@link ExtensionBlueprintParams} object.\n *\n * This is used in the definition of the `defineParams` option of {@link ExtensionBlueprint}.\n *\n * @public\n * @param params - The plain blueprint parameter object to wrap.\n * @returns The wrapped blueprint parameter object.\n */\nexport function createExtensionBlueprintParams<T extends object = object>(\n params: T,\n): ExtensionBlueprintParams<T> {\n return OpaqueBlueprintParams.createInstance('v1', { T: null as any, params });\n}\n\n/**\n * @public\n */\nexport type CreateExtensionBlueprintOptions<\n TKind extends string,\n TParams extends object | ExtensionBlueprintDefineParams,\n UOutput extends ExtensionDataRef,\n TInputs extends { [inputName in string]: ExtensionInput },\n TConfigSchema extends { [key in string]: (zImpl: typeof z) => z.ZodType },\n UFactoryOutput extends ExtensionDataValue<any, any>,\n TDataRefs extends { [name in string]: ExtensionDataRef },\n UParentInputs extends ExtensionDataRef,\n TNewConfigSchema extends { [key in string]: StandardSchemaV1 } = {},\n> = {\n kind: TKind;\n attachTo: ExtensionDefinitionAttachTo<UParentInputs> &\n VerifyExtensionAttachTo<UOutput, UParentInputs>;\n disabled?: boolean;\n if?: FilterPredicate;\n inputs?: TInputs;\n output: Array<UOutput>;\n configSchema?: TNewConfigSchema;\n /**\n * @deprecated Use {@link CreateExtensionBlueprintOptions.configSchema} instead.\n */\n config?: {\n /**\n * @deprecated Use {@link CreateExtensionBlueprintOptions.configSchema} instead.\n */\n schema: TConfigSchema;\n };\n /**\n * This option is used to further refine the blueprint params. When this\n * option is used, the blueprint will require params to be passed in callback\n * form. This function can both transform the params before they are handed to\n * the blueprint factory, but importantly it also allows you to define\n * inferred type parameters for your blueprint params.\n *\n * @example\n * Blueprint definition with inferred type parameters:\n * ```ts\n * const ExampleBlueprint = createExtensionBlueprint({\n * kind: 'example',\n * attachTo: { id: 'example', input: 'example' },\n * output: [exampleComponentDataRef, exampleFetcherDataRef],\n * defineParams<T>(params: {\n * component(props: ExampleProps<T>): JSX.Element | null\n * fetcher(options: FetchOptions): Promise<FetchResult<T>>\n * }) {\n * return createExtensionBlueprintParams(params);\n * },\n * *factory(params) {\n * yield exampleComponentDataRef(params.component)\n * yield exampleFetcherDataRef(params.fetcher)\n * },\n * });\n * ```\n *\n * @example\n * Usage of the above example blueprint:\n * ```ts\n * const example = ExampleBlueprint.make({\n * params: defineParams => defineParams({\n * component: ...,\n * fetcher: ...,\n * }),\n * });\n * ```\n */\n defineParams?: TParams extends ExtensionBlueprintDefineParams\n ? TParams\n : 'The defineParams option must be a function if provided, see the docs for details';\n factory(\n params: TParams extends ExtensionBlueprintDefineParams\n ? ReturnType<TParams>['T']\n : TParams,\n context: {\n node: AppNode;\n apis: ApiHolder;\n config: {\n [key in keyof TNewConfigSchema]: StandardSchemaV1.InferOutput<\n TNewConfigSchema[key]\n >;\n } & {\n [key in keyof TConfigSchema]: z.infer<\n ReturnType<((...args: any[]) => any) & TConfigSchema[key]>\n >;\n };\n inputs: Expand<ResolvedExtensionInputs<TInputs>>;\n },\n ): Iterable<UFactoryOutput>;\n\n dataRefs?: TDataRefs;\n} & VerifyExtensionFactoryOutput<UOutput, UFactoryOutput>;\n\n/** @public */\nexport type ExtensionBlueprintParameters = {\n kind: string;\n params?: object | ExtensionBlueprintDefineParams;\n configInput?: { [K in string]: any };\n config?: { [K in string]: any };\n output?: ExtensionDataRef;\n inputs?: { [KName in string]: ExtensionInput };\n dataRefs?: { [name in string]: ExtensionDataRef };\n};\n\n/** @ignore */\ntype ParamsFactory<TDefiner extends ExtensionBlueprintDefineParams> = (\n defineParams: TDefiner,\n) => ReturnType<TDefiner>;\n\n/**\n * Represents any form of params input that can be passed to a blueprint.\n * This also includes the invalid form of passing a plain params object to a blueprint that uses a definition callback.\n *\n * @ignore\n */\ntype AnyParamsInput<TParams extends object | ExtensionBlueprintDefineParams> =\n TParams extends ExtensionBlueprintDefineParams<infer IParams>\n ? IParams | ParamsFactory<TParams>\n : TParams | ParamsFactory<ExtensionBlueprintDefineParams<TParams, TParams>>;\n\n/**\n * @public\n */\nexport interface ExtensionBlueprint<\n T extends ExtensionBlueprintParameters = ExtensionBlueprintParameters,\n> {\n dataRefs: T['dataRefs'];\n\n make<\n TName extends string | undefined,\n TParamsInput extends AnyParamsInput<NonNullable<T['params']>>,\n UParentInputs extends ExtensionDataRef,\n >(args: {\n name?: TName;\n attachTo?: ExtensionDefinitionAttachTo<UParentInputs> &\n VerifyExtensionAttachTo<NonNullable<T['output']>, UParentInputs>;\n disabled?: boolean;\n if?: FilterPredicate;\n params: TParamsInput extends ExtensionBlueprintDefineParams\n ? TParamsInput\n : T['params'] extends ExtensionBlueprintDefineParams\n ? 'Error: This blueprint uses advanced parameter types and requires you to pass parameters as using the following callback syntax: `<blueprint>.make({ params: defineParams => defineParams(<params>) })`'\n : T['params'];\n }): OverridableExtensionDefinition<{\n kind: T['kind'];\n name: string | undefined extends TName ? undefined : TName;\n config: T['config'];\n configInput: T['configInput'];\n output: T['output'];\n inputs: T['inputs'];\n params: T['params'];\n }>;\n\n /**\n * Creates a new extension from the blueprint.\n *\n * You must either pass `params` directly, or define a `factory` that can\n * optionally call the original factory with the same params.\n */\n makeWithOverrides<\n TName extends string | undefined,\n UFactoryOutput extends ExtensionDataValue<any, any>,\n UNewOutput extends ExtensionDataRef,\n UParentInputs extends ExtensionDataRef,\n TExtraInputs extends { [inputName in string]: ExtensionInput } = {},\n TNewExtensionConfigSchema extends {\n [key in string]: StandardSchemaV1;\n } = {},\n >(args: {\n name?: TName;\n attachTo?: ExtensionDefinitionAttachTo<UParentInputs> &\n VerifyExtensionAttachTo<\n ExtensionDataRef extends UNewOutput\n ? NonNullable<T['output']>\n : UNewOutput,\n UParentInputs\n >;\n disabled?: boolean;\n if?: FilterPredicate;\n inputs?: TExtraInputs & {\n [KName in keyof T['inputs']]?: `Error: Input '${KName &\n string}' is already defined in parent definition`;\n };\n output?: Array<UNewOutput>;\n config?: never;\n configSchema?: TNewExtensionConfigSchema & {\n [KName in keyof T['config']]?: `Error: Config key '${KName &\n string}' is already defined in parent schema`;\n };\n factory(\n originalFactory: <\n TParamsInput extends AnyParamsInput<NonNullable<T['params']>>,\n >(\n params: TParamsInput extends ExtensionBlueprintDefineParams\n ? TParamsInput\n : T['params'] extends ExtensionBlueprintDefineParams\n ? 'Error: This blueprint uses advanced parameter types and requires you to pass parameters as using the following callback syntax: `originalFactory(defineParams => defineParams(<params>))`'\n : T['params'],\n context?: {\n config?: T['config'];\n inputs?: ResolvedInputValueOverrides<NonNullable<T['inputs']>>;\n },\n ) => ExtensionDataContainer<NonNullable<T['output']>>,\n context: {\n node: AppNode;\n apis: ApiHolder;\n config: T['config'] & {\n [key in keyof TNewExtensionConfigSchema]: StandardSchemaV1.InferOutput<\n TNewExtensionConfigSchema[key]\n >;\n };\n inputs: Expand<ResolvedExtensionInputs<T['inputs'] & TExtraInputs>>;\n },\n ): Iterable<UFactoryOutput> &\n VerifyExtensionFactoryOutput<\n ExtensionDataRef extends UNewOutput\n ? NonNullable<T['output']>\n : UNewOutput,\n UFactoryOutput\n >;\n }): OverridableExtensionDefinition<{\n config: Expand<\n {\n [key in keyof TNewExtensionConfigSchema]: StandardSchemaV1.InferOutput<\n TNewExtensionConfigSchema[key]\n >;\n } & T['config']\n >;\n configInput: Expand<\n {\n [key in keyof TNewExtensionConfigSchema]?: StandardSchemaV1.InferInput<\n TNewExtensionConfigSchema[key]\n >;\n } & T['configInput']\n >;\n output: ExtensionDataRef extends UNewOutput ? T['output'] : UNewOutput;\n inputs: Expand<T['inputs'] & TExtraInputs>;\n kind: T['kind'];\n name: string | undefined extends TName ? undefined : TName;\n params: T['params'];\n }>;\n\n /**\n * @deprecated Use the `configSchema` option instead of `config.schema`.\n */\n makeWithOverrides<\n TName extends string | undefined,\n TExtensionConfigSchema extends {\n [key in string]: (zImpl: typeof z) => z.ZodType;\n },\n UFactoryOutput extends ExtensionDataValue<any, any>,\n UNewOutput extends ExtensionDataRef,\n UParentInputs extends ExtensionDataRef,\n TExtraInputs extends { [inputName in string]: ExtensionInput } = {},\n >(args: {\n name?: TName;\n attachTo?: ExtensionDefinitionAttachTo<UParentInputs> &\n VerifyExtensionAttachTo<\n ExtensionDataRef extends UNewOutput\n ? NonNullable<T['output']>\n : UNewOutput,\n UParentInputs\n >;\n disabled?: boolean;\n if?: FilterPredicate;\n inputs?: TExtraInputs & {\n [KName in keyof T['inputs']]?: `Error: Input '${KName &\n string}' is already defined in parent definition`;\n };\n output?: Array<UNewOutput>;\n configSchema?: never;\n config?: {\n schema: TExtensionConfigSchema & {\n [KName in keyof T['config']]?: `Error: Config key '${KName &\n string}' is already defined in parent schema`;\n };\n };\n factory(\n originalFactory: <\n TParamsInput extends AnyParamsInput<NonNullable<T['params']>>,\n >(\n params: TParamsInput extends ExtensionBlueprintDefineParams\n ? TParamsInput\n : T['params'] extends ExtensionBlueprintDefineParams\n ? 'Error: This blueprint uses advanced parameter types and requires you to pass parameters as using the following callback syntax: `originalFactory(defineParams => defineParams(<params>))`'\n : T['params'],\n context?: {\n config?: T['config'];\n inputs?: ResolvedInputValueOverrides<NonNullable<T['inputs']>>;\n },\n ) => ExtensionDataContainer<NonNullable<T['output']>>,\n context: {\n node: AppNode;\n apis: ApiHolder;\n config: T['config'] & {\n [key in keyof TExtensionConfigSchema]: z.infer<\n ReturnType<((...args: any[]) => any) & TExtensionConfigSchema[key]>\n >;\n };\n inputs: Expand<ResolvedExtensionInputs<T['inputs'] & TExtraInputs>>;\n },\n ): Iterable<UFactoryOutput> &\n VerifyExtensionFactoryOutput<\n ExtensionDataRef extends UNewOutput\n ? NonNullable<T['output']>\n : UNewOutput,\n UFactoryOutput\n >;\n }): OverridableExtensionDefinition<{\n config: Expand<\n (string extends keyof TExtensionConfigSchema\n ? {}\n : {\n [key in keyof TExtensionConfigSchema]: z.infer<\n ReturnType<\n ((...args: any[]) => any) & TExtensionConfigSchema[key]\n >\n >;\n }) &\n T['config']\n >;\n configInput: Expand<\n (string extends keyof TExtensionConfigSchema\n ? {}\n : z.input<\n z.ZodObject<{\n [key in keyof TExtensionConfigSchema]: ReturnType<\n ((...args: any[]) => any) & TExtensionConfigSchema[key]\n >;\n }>\n >) &\n T['configInput']\n >;\n output: ExtensionDataRef extends UNewOutput ? T['output'] : UNewOutput;\n inputs: Expand<T['inputs'] & TExtraInputs>;\n kind: T['kind'];\n name: string | undefined extends TName ? undefined : TName;\n params: T['params'];\n }>;\n}\n\nfunction unwrapParamsFactory<TParams extends object>(\n // Allow `Function` because `typeof <object> === 'function'` allows it, but in practice this should always be a param factory\n params: ParamsFactory<ExtensionBlueprintDefineParams> | Function,\n defineParams: ExtensionBlueprintDefineParams,\n kind: string,\n): TParams {\n const paramDefinition = (\n params as ParamsFactory<ExtensionBlueprintDefineParams>\n )(defineParams);\n try {\n return OpaqueBlueprintParams.toInternal(paramDefinition).params as TParams;\n } catch (e) {\n throw new TypeError(\n `Invalid invocation of blueprint with kind '${kind}', the parameter definition callback function did not return a valid parameter definition object; Caused by: ${e.message}`,\n );\n }\n}\n\nfunction unwrapParams<TParams extends object>(\n params: object | ParamsFactory<ExtensionBlueprintDefineParams> | string,\n ctx: { node: AppNode; [ctxParamsSymbol]?: any },\n defineParams: ExtensionBlueprintDefineParams | undefined,\n kind: string,\n): TParams {\n const overrideParams = ctx[ctxParamsSymbol] as\n | object\n | ParamsFactory<ExtensionBlueprintDefineParams>\n | undefined;\n\n if (defineParams) {\n if (overrideParams) {\n if (typeof overrideParams !== 'function') {\n throw new TypeError(\n `Invalid extension override of blueprint with kind '${kind}', the override params were passed as a plain object, but this blueprint requires them to be passed in callback form`,\n );\n }\n return unwrapParamsFactory(overrideParams, defineParams, kind);\n }\n\n if (typeof params !== 'function') {\n throw new TypeError(\n `Invalid invocation of blueprint with kind '${kind}', the parameters where passed as a plain object, but this blueprint requires them to be passed in callback form`,\n );\n }\n return unwrapParamsFactory(params, defineParams, kind);\n }\n\n const base =\n typeof params === 'function'\n ? unwrapParamsFactory<TParams>(\n params,\n createExtensionBlueprintParams,\n kind,\n )\n : (params as TParams);\n const overrides =\n typeof overrideParams === 'function'\n ? unwrapParamsFactory<TParams>(\n overrideParams,\n createExtensionBlueprintParams,\n kind,\n )\n : (overrideParams as Partial<TParams>);\n\n return {\n ...base,\n ...overrides,\n };\n}\n\n/**\n * Creates a new extension blueprint that encapsulates the creation of\n * extensions of particular kinds.\n *\n * @remarks\n *\n * For details on how blueprints work, see the\n * {@link https://backstage.io/docs/frontend-system/architecture/extension-blueprints | documentation for extension blueprints}\n * in the frontend system documentation.\n *\n * Extension blueprints make it much easier for users to create new extensions\n * for your plugin. Rather than letting them use `createExtension`\n * directly, you can define a set of parameters and default factory for your\n * blueprint, removing a lot of the boilerplate and complexity that is otherwise\n * needed to create an extension.\n *\n * Each blueprint has its own `kind` that helps identify and group the\n * extensions that have been created with it. For example the\n * {@link PageBlueprint} has the kind `'page'`, and extensions created with it\n * will be given the ID `'page:<plugin-id>[/<name>]'`. Blueprints should always\n * be exported as `<PascalCaseKind>Blueprint`.\n *\n * When creating a blueprint the type of the parameters are inferred from the\n * `factory` function that you provide. The exception to that is when you need\n * your blueprint to include inferred type parameters, in which case you need to\n * use the `defineParams` option. See the documentation for the `defineParams`\n * option for more details on how that works.\n *\n * @example\n * ```tsx\n * // In your plugin library\n * export const GreetingBlueprint = createExtensionBlueprint({\n * kind: 'greeting',\n * attachTo: { id: 'example', input: 'greetings' },\n * output: [coreExtensionData.reactElement],\n * factory(params: { greeting: string }) {\n * return [coreExtensionData.reactElement(<h1>{params.greeting}</h1>)];\n * },\n * });\n *\n * // Someone using your blueprint in their plugin\n * const exampleGreeting = GreetingBlueprint.make({\n * params: {\n * greeting: 'Hello, world!',\n * },\n * });\n * ```\n * @public\n */\nexport function createExtensionBlueprint<\n TParams extends object | ExtensionBlueprintDefineParams,\n UOutput extends ExtensionDataRef,\n TInputs extends { [inputName in string]: ExtensionInput },\n UFactoryOutput extends ExtensionDataValue<any, any>,\n TKind extends string,\n UParentInputs extends ExtensionDataRef,\n TDataRefs extends { [name in string]: ExtensionDataRef } = never,\n TNewConfigSchema extends { [key in string]: StandardSchemaV1 } = {},\n>(\n options: {\n kind: TKind;\n attachTo: ExtensionDefinitionAttachTo<UParentInputs> &\n VerifyExtensionAttachTo<UOutput, UParentInputs>;\n disabled?: boolean;\n if?: FilterPredicate;\n inputs?: TInputs;\n output: Array<UOutput>;\n config?: never;\n configSchema?: TNewConfigSchema;\n defineParams?: TParams extends ExtensionBlueprintDefineParams\n ? TParams\n : 'The defineParams option must be a function if provided, see the docs for details';\n factory(\n params: TParams extends ExtensionBlueprintDefineParams\n ? ReturnType<TParams>['T']\n : TParams,\n context: {\n node: AppNode;\n apis: ApiHolder;\n config: {\n [key in keyof TNewConfigSchema]: StandardSchemaV1.InferOutput<\n TNewConfigSchema[key]\n >;\n };\n inputs: Expand<ResolvedExtensionInputs<TInputs>>;\n },\n ): Iterable<UFactoryOutput>;\n dataRefs?: TDataRefs;\n } & VerifyExtensionFactoryOutput<UOutput, UFactoryOutput>,\n): ExtensionBlueprint<{\n kind: TKind;\n params: TParams;\n output: UOutput extends ExtensionDataRef<\n infer IData,\n infer IId,\n infer IConfig\n >\n ? ExtensionDataRef<IData, IId, IConfig>\n : never;\n inputs: string extends keyof TInputs ? {} : TInputs;\n config: {\n [key in keyof TNewConfigSchema]: StandardSchemaV1.InferOutput<\n TNewConfigSchema[key]\n >;\n };\n configInput: {\n [key in keyof TNewConfigSchema]?: StandardSchemaV1.InferInput<\n TNewConfigSchema[key]\n >;\n };\n dataRefs: TDataRefs;\n}>;\n\n/**\n * @deprecated Use the top-level `configSchema` option instead of `config.schema`.\n * @public\n */\nexport function createExtensionBlueprint<\n TParams extends object | ExtensionBlueprintDefineParams,\n UOutput extends ExtensionDataRef,\n TInputs extends { [inputName in string]: ExtensionInput },\n TConfigSchema extends { [key in string]: (zImpl: typeof z) => z.ZodType },\n UFactoryOutput extends ExtensionDataValue<any, any>,\n TKind extends string,\n UParentInputs extends ExtensionDataRef,\n TDataRefs extends { [name in string]: ExtensionDataRef } = never,\n>(\n options: {\n kind: TKind;\n attachTo: ExtensionDefinitionAttachTo<UParentInputs> &\n VerifyExtensionAttachTo<UOutput, UParentInputs>;\n disabled?: boolean;\n if?: FilterPredicate;\n inputs?: TInputs;\n output: Array<UOutput>;\n configSchema?: never;\n config?: {\n schema: TConfigSchema;\n };\n defineParams?: TParams extends ExtensionBlueprintDefineParams\n ? TParams\n : 'The defineParams option must be a function if provided, see the docs for details';\n factory(\n params: TParams extends ExtensionBlueprintDefineParams\n ? ReturnType<TParams>['T']\n : TParams,\n context: {\n node: AppNode;\n apis: ApiHolder;\n config: {\n [key in keyof TConfigSchema]: z.infer<\n ReturnType<((...args: any[]) => any) & TConfigSchema[key]>\n >;\n };\n inputs: Expand<ResolvedExtensionInputs<TInputs>>;\n },\n ): Iterable<UFactoryOutput>;\n dataRefs?: TDataRefs;\n } & VerifyExtensionFactoryOutput<UOutput, UFactoryOutput>,\n): ExtensionBlueprint<{\n kind: TKind;\n params: TParams;\n output: UOutput extends ExtensionDataRef<\n infer IData,\n infer IId,\n infer IConfig\n >\n ? ExtensionDataRef<IData, IId, IConfig>\n : never;\n inputs: string extends keyof TInputs ? {} : TInputs;\n config: string extends keyof TConfigSchema\n ? {}\n : {\n [key in keyof TConfigSchema]: z.infer<\n ReturnType<((...args: any[]) => any) & TConfigSchema[key]>\n >;\n };\n configInput: string extends keyof TConfigSchema\n ? {}\n : z.input<\n z.ZodObject<{\n [key in keyof TConfigSchema]: ReturnType<\n ((...args: any[]) => any) & TConfigSchema[key]\n >;\n }>\n >;\n dataRefs: TDataRefs;\n}>;\n\n/** @internal */\nexport function createExtensionBlueprint(options: any): any {\n const defineParams = options.defineParams as\n | ExtensionBlueprintDefineParams\n | undefined;\n\n return {\n dataRefs: options.dataRefs,\n make(args) {\n return createExtension({\n kind: options.kind,\n name: args.name,\n attachTo: (args.attachTo ??\n options.attachTo) as ExtensionDefinitionAttachTo,\n disabled: args.disabled ?? options.disabled,\n if: args.if ?? options.if,\n inputs: options.inputs,\n output: options.output as ExtensionDataRef[],\n config: options.config,\n configSchema: options.configSchema as any,\n factory: ctx =>\n options.factory(\n unwrapParams(args.params, ctx, defineParams, options.kind),\n ctx as any,\n ) as Iterable<ExtensionDataValue<any, any>>,\n }) as OverridableExtensionDefinition;\n },\n makeWithOverrides(args: any) {\n if (args.config?.schema) {\n warnConfigSchemaPropDeprecation(describeParentCallSite());\n }\n return createExtension({\n kind: options.kind,\n name: args.name,\n attachTo: (args.attachTo ??\n options.attachTo) as ExtensionDefinitionAttachTo,\n disabled: args.disabled ?? options.disabled,\n if: args.if ?? options.if,\n inputs: { ...args.inputs, ...options.inputs },\n output: (args.output ?? options.output) as ExtensionDataRef[],\n config:\n options.config?.schema || args.config?.schema\n ? {\n schema: {\n ...options.config?.schema,\n ...args.config?.schema,\n },\n }\n : undefined,\n configSchema:\n options.configSchema || args.configSchema\n ? {\n ...options.configSchema,\n ...args.configSchema,\n }\n : (undefined as any),\n factory: ctx => {\n const { node, config, inputs, apis } = ctx;\n return args.factory(\n (innerParams: any, innerContext: any) => {\n return createExtensionDataContainer<any>(\n options.factory(\n unwrapParams(innerParams, ctx, defineParams, options.kind),\n {\n apis,\n node,\n config: (innerContext?.config ?? config) as any,\n inputs: resolveInputOverrides(\n options.inputs,\n inputs,\n innerContext?.inputs,\n ) as any,\n },\n ) as Iterable<any>,\n 'original blueprint factory',\n options.output,\n );\n },\n {\n apis,\n node,\n config: config as any,\n inputs: inputs as any,\n },\n ) as Iterable<ExtensionDataValue<any, any>>;\n },\n }) as OverridableExtensionDefinition;\n },\n } as ExtensionBlueprint<any>;\n}\n"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"createExtensionBlueprint.esm.js","sources":["../../src/wiring/createExtensionBlueprint.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ApiHolder, AppNode } from '../apis';\nimport { Expand } from '@backstage/types';\nimport { OpaqueType } from '@internal/opaque';\nimport {\n ExtensionDefinitionAttachTo,\n OverridableExtensionDefinition,\n ResolvedExtensionInputs,\n VerifyExtensionFactoryOutput,\n createExtension,\n ctxParamsSymbol,\n VerifyExtensionAttachTo,\n} from './createExtension';\nimport type { z } from 'zod/v3';\nimport { ExtensionInput } from './createExtensionInput';\nimport { type StandardSchemaV1 } from '@standard-schema/spec';\nimport { ExtensionDataRef, ExtensionDataValue } from './createExtensionDataRef';\nimport { createExtensionDataContainer } from '@internal/frontend';\nimport {\n ResolvedInputValueOverrides,\n resolveInputOverrides,\n} from './resolveInputOverrides';\nimport { ExtensionDataContainer } from './types';\nimport { PageBlueprint } from '../blueprints/PageBlueprint';\nimport { FilterPredicate } from '@backstage/filter-predicates';\nimport { warnConfigSchemaPropDeprecation } from '../schema/createPortableSchema';\nimport { describeParentCallSite } from '../routing/describeParentCallSite';\n\n/**\n * A function used to define a parameter mapping function in order to facilitate\n * advanced parameter typing for extension blueprints.\n *\n * @remarks\n *\n * This function is primarily intended to enable the use of inferred type\n * parameters for blueprint params, but it can also be used to transform the\n * params before they are handed to the blueprint.\n *\n * The function must return an object created with\n * {@link createExtensionBlueprintParams}.\n *\n * @public\n */\nexport type ExtensionBlueprintDefineParams<\n TParams extends object = object,\n TInput = any,\n> = (params: TInput) => ExtensionBlueprintParams<TParams>;\n\n/**\n * An opaque type that represents a set of parameters to be passed to a blueprint.\n *\n * @remarks\n *\n * Created with {@link createExtensionBlueprintParams}.\n *\n * @public\n */\nexport type ExtensionBlueprintParams<T extends object = object> = {\n $$type: '@backstage/BlueprintParams';\n T: T;\n};\n\nconst OpaqueBlueprintParams = OpaqueType.create<{\n public: ExtensionBlueprintParams;\n versions: {\n version: 'v1';\n params: object;\n };\n}>({\n type: '@backstage/BlueprintParams',\n versions: ['v1'],\n});\n\n/**\n * Wraps a plain blueprint parameter object in an opaque {@link ExtensionBlueprintParams} object.\n *\n * This is used in the definition of the `defineParams` option of {@link ExtensionBlueprint}.\n *\n * @public\n * @param params - The plain blueprint parameter object to wrap.\n * @returns The wrapped blueprint parameter object.\n */\nexport function createExtensionBlueprintParams<T extends object = object>(\n params: T,\n): ExtensionBlueprintParams<T> {\n return OpaqueBlueprintParams.createInstance('v1', { T: null as any, params });\n}\n\n/**\n * @public\n */\nexport type CreateExtensionBlueprintOptions<\n TKind extends string,\n TParams extends object | ExtensionBlueprintDefineParams,\n UOutput extends ExtensionDataRef,\n TInputs extends { [inputName in string]: ExtensionInput },\n TConfigSchema extends { [key in string]: (zImpl: typeof z) => z.ZodType },\n UFactoryOutput extends ExtensionDataValue<any, any>,\n TDataRefs extends { [name in string]: ExtensionDataRef },\n UParentInputs extends ExtensionDataRef,\n TNewConfigSchema extends { [key in string]: StandardSchemaV1 } = {},\n> = {\n kind: TKind;\n attachTo: ExtensionDefinitionAttachTo<UParentInputs> &\n VerifyExtensionAttachTo<UOutput, UParentInputs>;\n disabled?: boolean;\n if?: FilterPredicate;\n inputs?: TInputs;\n output: Array<UOutput>;\n configSchema?: TNewConfigSchema;\n /**\n * @deprecated Use {@link CreateExtensionBlueprintOptions.configSchema} instead.\n */\n config?: {\n /**\n * @deprecated Use {@link CreateExtensionBlueprintOptions.configSchema} instead.\n */\n schema: TConfigSchema;\n };\n /**\n * This option is used to further refine the blueprint params. When this\n * option is used, the blueprint will require params to be passed in callback\n * form. This function can both transform the params before they are handed to\n * the blueprint factory, but importantly it also allows you to define\n * inferred type parameters for your blueprint params.\n *\n * @example\n * Blueprint definition with inferred type parameters:\n * ```ts\n * const ExampleBlueprint = createExtensionBlueprint({\n * kind: 'example',\n * attachTo: { id: 'example', input: 'example' },\n * output: [exampleComponentDataRef, exampleFetcherDataRef],\n * defineParams<T>(params: {\n * component(props: ExampleProps<T>): JSX.Element | null\n * fetcher(options: FetchOptions): Promise<FetchResult<T>>\n * }) {\n * return createExtensionBlueprintParams(params);\n * },\n * *factory(params) {\n * yield exampleComponentDataRef(params.component)\n * yield exampleFetcherDataRef(params.fetcher)\n * },\n * });\n * ```\n *\n * @example\n * Usage of the above example blueprint:\n * ```ts\n * const example = ExampleBlueprint.make({\n * params: defineParams => defineParams({\n * component: ...,\n * fetcher: ...,\n * }),\n * });\n * ```\n */\n defineParams?: TParams extends ExtensionBlueprintDefineParams\n ? TParams\n : 'The defineParams option must be a function if provided, see the docs for details';\n factory(\n params: TParams extends ExtensionBlueprintDefineParams\n ? ReturnType<TParams>['T']\n : TParams,\n context: {\n node: AppNode;\n apis: ApiHolder;\n config: {\n [key in keyof TNewConfigSchema]: StandardSchemaV1.InferOutput<\n TNewConfigSchema[key]\n >;\n } & {\n [key in keyof TConfigSchema]: z.infer<\n ReturnType<((...args: any[]) => any) & TConfigSchema[key]>\n >;\n };\n inputs: Expand<ResolvedExtensionInputs<TInputs>>;\n },\n ): Iterable<UFactoryOutput>;\n\n dataRefs?: TDataRefs;\n} & VerifyExtensionFactoryOutput<UOutput, UFactoryOutput>;\n\n/** @public */\nexport type ExtensionBlueprintParameters = {\n kind: string;\n params?: object | ExtensionBlueprintDefineParams;\n configInput?: { [K in string]: any };\n config?: { [K in string]: any };\n output?: ExtensionDataRef;\n inputs?: { [KName in string]: ExtensionInput };\n dataRefs?: { [name in string]: ExtensionDataRef };\n};\n\n/** @ignore */\ntype ParamsFactory<TDefiner extends ExtensionBlueprintDefineParams> = (\n defineParams: TDefiner,\n) => ReturnType<TDefiner>;\n\n/**\n * Represents any form of params input that can be passed to a blueprint.\n * This also includes the invalid form of passing a plain params object to a blueprint that uses a definition callback.\n *\n * @ignore\n */\ntype AnyParamsInput<TParams extends object | ExtensionBlueprintDefineParams> =\n TParams extends ExtensionBlueprintDefineParams<infer IParams>\n ? IParams | ParamsFactory<TParams>\n : TParams | ParamsFactory<ExtensionBlueprintDefineParams<TParams, TParams>>;\n\n/**\n * @public\n */\nexport interface ExtensionBlueprint<\n T extends ExtensionBlueprintParameters = ExtensionBlueprintParameters,\n> {\n dataRefs: T['dataRefs'];\n\n make<\n TName extends string | undefined,\n TParamsInput extends AnyParamsInput<NonNullable<T['params']>>,\n UParentInputs extends ExtensionDataRef,\n >(args: {\n name?: TName;\n attachTo?: ExtensionDefinitionAttachTo<UParentInputs> &\n VerifyExtensionAttachTo<NonNullable<T['output']>, UParentInputs>;\n disabled?: boolean;\n if?: FilterPredicate;\n params: TParamsInput extends ExtensionBlueprintDefineParams\n ? TParamsInput\n : T['params'] extends ExtensionBlueprintDefineParams\n ? 'Error: This blueprint uses advanced parameter types and requires you to pass parameters as using the following callback syntax: `<blueprint>.make({ params: defineParams => defineParams(<params>) })`'\n : T['params'];\n }): OverridableExtensionDefinition<{\n kind: T['kind'];\n name: string | undefined extends TName ? undefined : TName;\n config: T['config'];\n configInput: T['configInput'];\n output: T['output'];\n inputs: T['inputs'];\n params: T['params'];\n }>;\n\n /**\n * Creates a new extension from the blueprint.\n *\n * You must either pass `params` directly, or define a `factory` that can\n * optionally call the original factory with the same params.\n */\n makeWithOverrides<\n TName extends string | undefined,\n UFactoryOutput extends ExtensionDataValue<any, any>,\n UNewOutput extends ExtensionDataRef,\n UParentInputs extends ExtensionDataRef,\n TExtraInputs extends { [inputName in string]: ExtensionInput } = {},\n TNewExtensionConfigSchema extends {\n [key in string]: StandardSchemaV1;\n } = {},\n >(args: {\n name?: TName;\n attachTo?: ExtensionDefinitionAttachTo<UParentInputs> &\n VerifyExtensionAttachTo<\n ExtensionDataRef extends UNewOutput\n ? NonNullable<T['output']>\n : UNewOutput,\n UParentInputs\n >;\n disabled?: boolean;\n if?: FilterPredicate;\n inputs?: TExtraInputs & {\n [KName in keyof T['inputs']]?: `Error: Input '${KName &\n string}' is already defined in parent definition`;\n };\n output?: Array<UNewOutput>;\n config?: never;\n configSchema?: TNewExtensionConfigSchema & {\n [KName in keyof T['config']]?: `Error: Config key '${KName &\n string}' is already defined in parent schema`;\n };\n factory(\n originalFactory: <\n TParamsInput extends AnyParamsInput<NonNullable<T['params']>>,\n >(\n params: TParamsInput extends ExtensionBlueprintDefineParams\n ? TParamsInput\n : T['params'] extends ExtensionBlueprintDefineParams\n ? 'Error: This blueprint uses advanced parameter types and requires you to pass parameters as using the following callback syntax: `originalFactory(defineParams => defineParams(<params>))`'\n : T['params'],\n context?: {\n config?: T['config'];\n inputs?: ResolvedInputValueOverrides<NonNullable<T['inputs']>>;\n },\n ) => ExtensionDataContainer<NonNullable<T['output']>>,\n context: {\n node: AppNode;\n apis: ApiHolder;\n config: T['config'] & {\n [key in keyof TNewExtensionConfigSchema]: StandardSchemaV1.InferOutput<\n TNewExtensionConfigSchema[key]\n >;\n };\n inputs: Expand<ResolvedExtensionInputs<T['inputs'] & TExtraInputs>>;\n },\n ): Iterable<UFactoryOutput> &\n VerifyExtensionFactoryOutput<\n ExtensionDataRef extends UNewOutput\n ? NonNullable<T['output']>\n : UNewOutput,\n UFactoryOutput\n >;\n }): OverridableExtensionDefinition<{\n config: Expand<\n {\n [key in keyof TNewExtensionConfigSchema]: StandardSchemaV1.InferOutput<\n TNewExtensionConfigSchema[key]\n >;\n } & T['config']\n >;\n configInput: Expand<\n {\n [key in keyof TNewExtensionConfigSchema]?: StandardSchemaV1.InferInput<\n TNewExtensionConfigSchema[key]\n >;\n } & T['configInput']\n >;\n output: ExtensionDataRef extends UNewOutput ? T['output'] : UNewOutput;\n inputs: Expand<T['inputs'] & TExtraInputs>;\n kind: T['kind'];\n name: string | undefined extends TName ? undefined : TName;\n params: T['params'];\n }>;\n\n /**\n * @deprecated Use the `configSchema` option instead of `config.schema`.\n */\n makeWithOverrides<\n TName extends string | undefined,\n TExtensionConfigSchema extends {\n [key in string]: (zImpl: typeof z) => z.ZodType;\n },\n UFactoryOutput extends ExtensionDataValue<any, any>,\n UNewOutput extends ExtensionDataRef,\n UParentInputs extends ExtensionDataRef,\n TExtraInputs extends { [inputName in string]: ExtensionInput } = {},\n >(args: {\n name?: TName;\n attachTo?: ExtensionDefinitionAttachTo<UParentInputs> &\n VerifyExtensionAttachTo<\n ExtensionDataRef extends UNewOutput\n ? NonNullable<T['output']>\n : UNewOutput,\n UParentInputs\n >;\n disabled?: boolean;\n if?: FilterPredicate;\n inputs?: TExtraInputs & {\n [KName in keyof T['inputs']]?: `Error: Input '${KName &\n string}' is already defined in parent definition`;\n };\n output?: Array<UNewOutput>;\n configSchema?: never;\n config?: {\n schema: TExtensionConfigSchema & {\n [KName in keyof T['config']]?: `Error: Config key '${KName &\n string}' is already defined in parent schema`;\n };\n };\n factory(\n originalFactory: <\n TParamsInput extends AnyParamsInput<NonNullable<T['params']>>,\n >(\n params: TParamsInput extends ExtensionBlueprintDefineParams\n ? TParamsInput\n : T['params'] extends ExtensionBlueprintDefineParams\n ? 'Error: This blueprint uses advanced parameter types and requires you to pass parameters as using the following callback syntax: `originalFactory(defineParams => defineParams(<params>))`'\n : T['params'],\n context?: {\n config?: T['config'];\n inputs?: ResolvedInputValueOverrides<NonNullable<T['inputs']>>;\n },\n ) => ExtensionDataContainer<NonNullable<T['output']>>,\n context: {\n node: AppNode;\n apis: ApiHolder;\n config: T['config'] & {\n [key in keyof TExtensionConfigSchema]: z.infer<\n ReturnType<((...args: any[]) => any) & TExtensionConfigSchema[key]>\n >;\n };\n inputs: Expand<ResolvedExtensionInputs<T['inputs'] & TExtraInputs>>;\n },\n ): Iterable<UFactoryOutput> &\n VerifyExtensionFactoryOutput<\n ExtensionDataRef extends UNewOutput\n ? NonNullable<T['output']>\n : UNewOutput,\n UFactoryOutput\n >;\n }): OverridableExtensionDefinition<{\n config: Expand<\n (string extends keyof TExtensionConfigSchema\n ? {}\n : {\n [key in keyof TExtensionConfigSchema]: z.infer<\n ReturnType<\n ((...args: any[]) => any) & TExtensionConfigSchema[key]\n >\n >;\n }) &\n T['config']\n >;\n configInput: Expand<\n (string extends keyof TExtensionConfigSchema\n ? {}\n : z.input<\n z.ZodObject<{\n [key in keyof TExtensionConfigSchema]: ReturnType<\n ((...args: any[]) => any) & TExtensionConfigSchema[key]\n >;\n }>\n >) &\n T['configInput']\n >;\n output: ExtensionDataRef extends UNewOutput ? T['output'] : UNewOutput;\n inputs: Expand<T['inputs'] & TExtraInputs>;\n kind: T['kind'];\n name: string | undefined extends TName ? undefined : TName;\n params: T['params'];\n }>;\n}\n\nfunction unwrapParamsFactory<TParams extends object>(\n // Allow `Function` because `typeof <object> === 'function'` allows it, but in practice this should always be a param factory\n params: ParamsFactory<ExtensionBlueprintDefineParams> | Function,\n defineParams: ExtensionBlueprintDefineParams,\n kind: string,\n): TParams {\n const paramDefinition = (\n params as ParamsFactory<ExtensionBlueprintDefineParams>\n )(defineParams);\n try {\n return OpaqueBlueprintParams.toInternal(paramDefinition).params as TParams;\n } catch (e) {\n throw new TypeError(\n `Invalid invocation of blueprint with kind '${kind}', the parameter definition callback function did not return a valid parameter definition object; Caused by: ${e.message}`,\n );\n }\n}\n\nfunction unwrapParams<TParams extends object>(\n params: object | ParamsFactory<ExtensionBlueprintDefineParams> | string,\n ctx: { node: AppNode; [ctxParamsSymbol]?: any },\n defineParams: ExtensionBlueprintDefineParams | undefined,\n kind: string,\n): TParams {\n const overrideParams = ctx[ctxParamsSymbol] as\n | object\n | ParamsFactory<ExtensionBlueprintDefineParams>\n | undefined;\n\n if (defineParams) {\n if (overrideParams) {\n if (typeof overrideParams !== 'function') {\n throw new TypeError(\n `Invalid extension override of blueprint with kind '${kind}', the override params were passed as a plain object, but this blueprint requires them to be passed in callback form`,\n );\n }\n return unwrapParamsFactory(overrideParams, defineParams, kind);\n }\n\n if (typeof params !== 'function') {\n throw new TypeError(\n `Invalid invocation of blueprint with kind '${kind}', the parameters where passed as a plain object, but this blueprint requires them to be passed in callback form`,\n );\n }\n return unwrapParamsFactory(params, defineParams, kind);\n }\n\n const base =\n typeof params === 'function'\n ? unwrapParamsFactory<TParams>(\n params,\n createExtensionBlueprintParams,\n kind,\n )\n : (params as TParams);\n const overrides =\n typeof overrideParams === 'function'\n ? unwrapParamsFactory<TParams>(\n overrideParams,\n createExtensionBlueprintParams,\n kind,\n )\n : (overrideParams as Partial<TParams>);\n\n return {\n ...base,\n ...overrides,\n };\n}\n\n/**\n * Creates a new extension blueprint that encapsulates the creation of\n * extensions of particular kinds.\n *\n * @remarks\n *\n * For details on how blueprints work, see the\n * {@link https://backstage.io/docs/frontend-system/architecture/extension-blueprints | documentation for extension blueprints}\n * in the frontend system documentation.\n *\n * Extension blueprints make it much easier for users to create new extensions\n * for your plugin. Rather than letting them use `createExtension`\n * directly, you can define a set of parameters and default factory for your\n * blueprint, removing a lot of the boilerplate and complexity that is otherwise\n * needed to create an extension.\n *\n * Each blueprint has its own `kind` that helps identify and group the\n * extensions that have been created with it. For example the\n * {@link PageBlueprint} has the kind `'page'`, and extensions created with it\n * will be given the ID `'page:<plugin-id>[/<name>]'`. Blueprints should always\n * be exported as `<PascalCaseKind>Blueprint`.\n *\n * When creating a blueprint the type of the parameters are inferred from the\n * `factory` function that you provide. The exception to that is when you need\n * your blueprint to include inferred type parameters, in which case you need to\n * use the `defineParams` option. See the documentation for the `defineParams`\n * option for more details on how that works.\n *\n * @example\n * ```tsx\n * // In your plugin library\n * export const GreetingBlueprint = createExtensionBlueprint({\n * kind: 'greeting',\n * attachTo: { id: 'example', input: 'greetings' },\n * output: [coreExtensionData.reactElement],\n * factory(params: { greeting: string }) {\n * return [coreExtensionData.reactElement(<h1>{params.greeting}</h1>)];\n * },\n * });\n *\n * // Someone using your blueprint in their plugin\n * const exampleGreeting = GreetingBlueprint.make({\n * params: {\n * greeting: 'Hello, world!',\n * },\n * });\n * ```\n * @public\n */\nexport function createExtensionBlueprint<\n TParams extends object | ExtensionBlueprintDefineParams,\n UOutput extends ExtensionDataRef,\n TInputs extends { [inputName in string]: ExtensionInput },\n UFactoryOutput extends ExtensionDataValue<any, any>,\n TKind extends string,\n UParentInputs extends ExtensionDataRef,\n TDataRefs extends { [name in string]: ExtensionDataRef } = never,\n TNewConfigSchema extends { [key in string]: StandardSchemaV1 } = {},\n>(\n options: {\n kind: TKind;\n attachTo: ExtensionDefinitionAttachTo<UParentInputs> &\n VerifyExtensionAttachTo<UOutput, UParentInputs>;\n disabled?: boolean;\n if?: FilterPredicate;\n inputs?: TInputs;\n output: Array<UOutput>;\n config?: never;\n configSchema?: TNewConfigSchema;\n defineParams?: TParams extends ExtensionBlueprintDefineParams\n ? TParams\n : 'The defineParams option must be a function if provided, see the docs for details';\n factory(\n params: TParams extends ExtensionBlueprintDefineParams\n ? ReturnType<TParams>['T']\n : TParams,\n context: {\n node: AppNode;\n apis: ApiHolder;\n config: {\n [key in keyof TNewConfigSchema]: StandardSchemaV1.InferOutput<\n TNewConfigSchema[key]\n >;\n };\n inputs: Expand<ResolvedExtensionInputs<TInputs>>;\n },\n ): Iterable<UFactoryOutput>;\n dataRefs?: TDataRefs;\n } & VerifyExtensionFactoryOutput<UOutput, UFactoryOutput>,\n): ExtensionBlueprint<{\n kind: TKind;\n params: TParams;\n output: UOutput extends ExtensionDataRef<\n infer IData,\n infer IId,\n infer IConfig\n >\n ? ExtensionDataRef<IData, IId, IConfig>\n : never;\n inputs: string extends keyof TInputs ? {} : TInputs;\n config: {\n [key in keyof TNewConfigSchema]: StandardSchemaV1.InferOutput<\n TNewConfigSchema[key]\n >;\n };\n configInput: {\n [key in keyof TNewConfigSchema]?: StandardSchemaV1.InferInput<\n TNewConfigSchema[key]\n >;\n };\n dataRefs: TDataRefs;\n}>;\n\n/**\n * @deprecated Use the top-level `configSchema` option instead of `config.schema`.\n * @public\n */\nexport function createExtensionBlueprint<\n TParams extends object | ExtensionBlueprintDefineParams,\n UOutput extends ExtensionDataRef,\n TInputs extends { [inputName in string]: ExtensionInput },\n TConfigSchema extends { [key in string]: (zImpl: typeof z) => z.ZodType },\n UFactoryOutput extends ExtensionDataValue<any, any>,\n TKind extends string,\n UParentInputs extends ExtensionDataRef,\n TDataRefs extends { [name in string]: ExtensionDataRef } = never,\n>(\n options: {\n kind: TKind;\n attachTo: ExtensionDefinitionAttachTo<UParentInputs> &\n VerifyExtensionAttachTo<UOutput, UParentInputs>;\n disabled?: boolean;\n if?: FilterPredicate;\n inputs?: TInputs;\n output: Array<UOutput>;\n configSchema?: never;\n config?: {\n schema: TConfigSchema;\n };\n defineParams?: TParams extends ExtensionBlueprintDefineParams\n ? TParams\n : 'The defineParams option must be a function if provided, see the docs for details';\n factory(\n params: TParams extends ExtensionBlueprintDefineParams\n ? ReturnType<TParams>['T']\n : TParams,\n context: {\n node: AppNode;\n apis: ApiHolder;\n config: {\n [key in keyof TConfigSchema]: z.infer<\n ReturnType<((...args: any[]) => any) & TConfigSchema[key]>\n >;\n };\n inputs: Expand<ResolvedExtensionInputs<TInputs>>;\n },\n ): Iterable<UFactoryOutput>;\n dataRefs?: TDataRefs;\n } & VerifyExtensionFactoryOutput<UOutput, UFactoryOutput>,\n): ExtensionBlueprint<{\n kind: TKind;\n params: TParams;\n output: UOutput extends ExtensionDataRef<\n infer IData,\n infer IId,\n infer IConfig\n >\n ? ExtensionDataRef<IData, IId, IConfig>\n : never;\n inputs: string extends keyof TInputs ? {} : TInputs;\n config: string extends keyof TConfigSchema\n ? {}\n : {\n [key in keyof TConfigSchema]: z.infer<\n ReturnType<((...args: any[]) => any) & TConfigSchema[key]>\n >;\n };\n configInput: string extends keyof TConfigSchema\n ? {}\n : z.input<\n z.ZodObject<{\n [key in keyof TConfigSchema]: ReturnType<\n ((...args: any[]) => any) & TConfigSchema[key]\n >;\n }>\n >;\n dataRefs: TDataRefs;\n}>;\n\n/** @internal */\nexport function createExtensionBlueprint(options: any): any {\n const defineParams = options.defineParams as\n | ExtensionBlueprintDefineParams\n | undefined;\n\n return {\n dataRefs: options.dataRefs,\n make(args) {\n return createExtension({\n kind: options.kind,\n name: args.name,\n attachTo: (args.attachTo ??\n options.attachTo) as ExtensionDefinitionAttachTo,\n disabled: args.disabled ?? options.disabled,\n if: args.if ?? options.if,\n inputs: options.inputs,\n output: options.output as ExtensionDataRef[],\n config: options.config,\n configSchema: options.configSchema as any,\n factory: ctx =>\n options.factory(\n unwrapParams(args.params, ctx, defineParams, options.kind),\n ctx as any,\n ) as Iterable<ExtensionDataValue<any, any>>,\n }) as OverridableExtensionDefinition;\n },\n makeWithOverrides(args: any) {\n if (args.config?.schema) {\n warnConfigSchemaPropDeprecation(describeParentCallSite());\n }\n return createExtension({\n kind: options.kind,\n name: args.name,\n attachTo: (args.attachTo ??\n options.attachTo) as ExtensionDefinitionAttachTo,\n disabled: args.disabled ?? options.disabled,\n if: args.if ?? options.if,\n inputs: { ...args.inputs, ...options.inputs },\n output: (args.output ?? options.output) as ExtensionDataRef[],\n config:\n options.config?.schema || args.config?.schema\n ? {\n schema: {\n ...options.config?.schema,\n ...args.config?.schema,\n },\n }\n : undefined,\n configSchema:\n options.configSchema || args.configSchema\n ? {\n ...options.configSchema,\n ...args.configSchema,\n }\n : (undefined as any),\n factory: ctx => {\n const { node, config, inputs, apis } = ctx;\n return args.factory(\n (innerParams: any, innerContext: any) => {\n return createExtensionDataContainer<any>(\n options.factory(\n unwrapParams(innerParams, ctx, defineParams, options.kind),\n {\n apis,\n node,\n config: (innerContext?.config ?? config) as any,\n inputs: resolveInputOverrides(\n options.inputs,\n inputs,\n innerContext?.inputs,\n ) as any,\n },\n ) as Iterable<any>,\n 'original blueprint factory',\n options.output,\n );\n },\n {\n apis,\n node,\n config: config as any,\n inputs: inputs as any,\n },\n ) as Iterable<ExtensionDataValue<any, any>>;\n },\n }) as OverridableExtensionDefinition;\n },\n } as ExtensionBlueprint<any>;\n}\n"],"names":[],"mappings":"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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/frontend-plugin-api",
3
- "version": "0.17.0-next.1",
3
+ "version": "0.17.1",
4
4
  "backstage": {
5
5
  "role": "web-library"
6
6
  },
@@ -52,20 +52,20 @@
52
52
  "test": "backstage-cli package test"
53
53
  },
54
54
  "dependencies": {
55
- "@backstage/errors": "1.3.1-next.0",
56
- "@backstage/filter-predicates": "0.1.3-next.0",
57
- "@backstage/types": "1.2.2",
58
- "@backstage/version-bridge": "1.0.12",
55
+ "@backstage/config": "^1.3.8",
56
+ "@backstage/errors": "^1.3.1",
57
+ "@backstage/filter-predicates": "^0.1.3",
58
+ "@backstage/types": "^1.2.2",
59
+ "@backstage/version-bridge": "^1.0.12",
59
60
  "@standard-schema/spec": "^1.1.0",
60
61
  "zod": "^4.0.0",
61
62
  "zod-to-json-schema": "^3.25.1"
62
63
  },
63
64
  "devDependencies": {
64
- "@backstage/cli": "0.36.2-next.1",
65
- "@backstage/config": "1.3.8-next.0",
66
- "@backstage/frontend-app-api": "0.16.3-next.1",
67
- "@backstage/frontend-test-utils": "0.5.3-next.1",
68
- "@backstage/test-utils": "1.7.18-next.0",
65
+ "@backstage/cli": "^0.36.2",
66
+ "@backstage/frontend-app-api": "^0.16.3",
67
+ "@backstage/frontend-test-utils": "^0.6.0",
68
+ "@backstage/test-utils": "^1.7.18",
69
69
  "@testing-library/jest-dom": "^6.0.0",
70
70
  "@testing-library/react": "^16.0.0",
71
71
  "@types/react": "^18.0.0",
@@ -1,33 +0,0 @@
1
- import { z } from 'zod/v4';
2
- import '../wiring/coreExtensionData.esm.js';
3
- import 'zod/v3';
4
- import 'zod-to-json-schema';
5
- import { createExtensionDataRef } from '../wiring/createExtensionDataRef.esm.js';
6
- import { createExtensionBlueprint } from '../wiring/createExtensionBlueprint.esm.js';
7
-
8
- const targetDataRef = createExtensionDataRef().with({ id: "core.nav-item.target" });
9
- const NavItemBlueprint = createExtensionBlueprint({
10
- kind: "nav-item",
11
- attachTo: { id: "app/nav", input: "items" },
12
- output: [targetDataRef],
13
- dataRefs: {
14
- target: targetDataRef
15
- },
16
- factory: ({
17
- icon,
18
- routeRef,
19
- title
20
- }, { config }) => [
21
- targetDataRef({
22
- title: config.title ?? title,
23
- icon,
24
- routeRef
25
- })
26
- ],
27
- configSchema: {
28
- title: z.string().optional()
29
- }
30
- });
31
-
32
- export { NavItemBlueprint };
33
- //# sourceMappingURL=NavItemBlueprint.esm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NavItemBlueprint.esm.js","sources":["../../src/blueprints/NavItemBlueprint.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { z } from 'zod/v4';\nimport { IconComponent } from '../icons/types';\nimport { RouteRef } from '../routing';\nimport { createExtensionBlueprint, createExtensionDataRef } from '../wiring';\n\n// TODO(Rugvip): Should this be broken apart into separate refs? title/icon/routeRef\nconst targetDataRef = createExtensionDataRef<{\n title: string;\n icon: IconComponent;\n routeRef: RouteRef<undefined>;\n}>().with({ id: 'core.nav-item.target' });\n\n/**\n * Creates extensions that make up the items of the nav bar.\n *\n * @public\n * @deprecated Nav items are now automatically inferred from `PageBlueprint`\n * extensions based on their `title` and `icon` params. You can remove your\n * `NavItemBlueprint` usage and instead pass `title` and `icon` directly to\n * the `PageBlueprint`.\n */\nexport const NavItemBlueprint = createExtensionBlueprint({\n kind: 'nav-item',\n attachTo: { id: 'app/nav', input: 'items' },\n output: [targetDataRef],\n dataRefs: {\n target: targetDataRef,\n },\n factory: (\n {\n icon,\n routeRef,\n title,\n }: {\n title: string;\n icon: IconComponent;\n routeRef: RouteRef<undefined>;\n },\n { config },\n ) => [\n targetDataRef({\n title: config.title ?? title,\n icon,\n routeRef,\n }),\n ],\n configSchema: {\n title: z.string().optional(),\n },\n});\n"],"names":[],"mappings":";;;;;;;AAsBA,MAAM,gBAAgB,sBAAA,EAInB,CAAE,KAAK,EAAE,EAAA,EAAI,wBAAwB,CAAA;AAWjC,MAAM,mBAAmB,wBAAA,CAAyB;AAAA,EACvD,IAAA,EAAM,UAAA;AAAA,EACN,QAAA,EAAU,EAAE,EAAA,EAAI,SAAA,EAAW,OAAO,OAAA,EAAQ;AAAA,EAC1C,MAAA,EAAQ,CAAC,aAAa,CAAA;AAAA,EACtB,QAAA,EAAU;AAAA,IACR,MAAA,EAAQ;AAAA,GACV;AAAA,EACA,SAAS,CACP;AAAA,IACE,IAAA;AAAA,IACA,QAAA;AAAA,IACA;AAAA,GACF,EAKA,EAAE,MAAA,EAAO,KACN;AAAA,IACH,aAAA,CAAc;AAAA,MACZ,KAAA,EAAO,OAAO,KAAA,IAAS,KAAA;AAAA,MACvB,IAAA;AAAA,MACA;AAAA,KACD;AAAA,GACH;AAAA,EACA,YAAA,EAAc;AAAA,IACZ,KAAA,EAAO,CAAA,CAAE,MAAA,EAAO,CAAE,QAAA;AAAS;AAE/B,CAAC;;;;"}