@backstage/frontend-plugin-api 0.14.2-next.0 → 0.15.0
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 +144 -0
- package/dist/alpha.d.ts +6 -71
- package/dist/alpha.esm.js +4 -0
- package/dist/alpha.esm.js.map +1 -1
- package/dist/analytics/useAnalytics.esm.js +2 -0
- package/dist/analytics/useAnalytics.esm.js.map +1 -1
- package/dist/apis/definitions/AlertApi.esm.js +3 -2
- package/dist/apis/definitions/AlertApi.esm.js.map +1 -1
- package/dist/apis/definitions/AnalyticsApi.esm.js +3 -2
- package/dist/apis/definitions/AnalyticsApi.esm.js.map +1 -1
- package/dist/apis/definitions/AppLanguageApi.esm.js +3 -2
- package/dist/apis/definitions/AppLanguageApi.esm.js.map +1 -1
- package/dist/apis/definitions/AppThemeApi.esm.js +3 -2
- package/dist/apis/definitions/AppThemeApi.esm.js.map +1 -1
- package/dist/apis/definitions/AppTreeApi.esm.js +4 -1
- package/dist/apis/definitions/AppTreeApi.esm.js.map +1 -1
- package/dist/apis/definitions/ConfigApi.esm.js +3 -2
- package/dist/apis/definitions/ConfigApi.esm.js.map +1 -1
- package/dist/apis/definitions/DialogApi.esm.js +3 -2
- package/dist/apis/definitions/DialogApi.esm.js.map +1 -1
- package/dist/apis/definitions/DiscoveryApi.esm.js +3 -2
- package/dist/apis/definitions/DiscoveryApi.esm.js.map +1 -1
- package/dist/apis/definitions/ErrorApi.esm.js +3 -2
- package/dist/apis/definitions/ErrorApi.esm.js.map +1 -1
- package/dist/apis/definitions/FeatureFlagsApi.esm.js +3 -2
- package/dist/apis/definitions/FeatureFlagsApi.esm.js.map +1 -1
- package/dist/apis/definitions/FetchApi.esm.js +3 -2
- package/dist/apis/definitions/FetchApi.esm.js.map +1 -1
- package/dist/apis/definitions/IconsApi.esm.js +3 -2
- package/dist/apis/definitions/IconsApi.esm.js.map +1 -1
- package/dist/apis/definitions/IdentityApi.esm.js +3 -2
- package/dist/apis/definitions/IdentityApi.esm.js.map +1 -1
- package/dist/apis/definitions/OAuthRequestApi.esm.js +3 -2
- package/dist/apis/definitions/OAuthRequestApi.esm.js.map +1 -1
- package/dist/apis/definitions/PluginHeaderActionsApi.esm.js +3 -2
- package/dist/apis/definitions/PluginHeaderActionsApi.esm.js.map +1 -1
- package/dist/apis/definitions/PluginWrapperApi.esm.js +7 -3
- package/dist/apis/definitions/PluginWrapperApi.esm.js.map +1 -1
- package/dist/apis/definitions/RouteResolutionApi.esm.js +3 -2
- package/dist/apis/definitions/RouteResolutionApi.esm.js.map +1 -1
- package/dist/apis/definitions/StorageApi.esm.js +3 -2
- package/dist/apis/definitions/StorageApi.esm.js.map +1 -1
- package/dist/apis/definitions/SwappableComponentsApi.esm.js +3 -2
- package/dist/apis/definitions/SwappableComponentsApi.esm.js.map +1 -1
- package/dist/apis/definitions/ToastApi.esm.js +11 -0
- package/dist/apis/definitions/ToastApi.esm.js.map +1 -0
- package/dist/apis/definitions/TranslationApi.esm.js +3 -2
- package/dist/apis/definitions/TranslationApi.esm.js.map +1 -1
- package/dist/apis/definitions/auth.esm.js +33 -22
- package/dist/apis/definitions/auth.esm.js.map +1 -1
- package/dist/apis/system/ApiRef.esm.js +28 -20
- package/dist/apis/system/ApiRef.esm.js.map +1 -1
- package/dist/apis/system/useApi.esm.js +2 -1
- package/dist/apis/system/useApi.esm.js.map +1 -1
- package/dist/blueprints/AnalyticsImplementationBlueprint.esm.js +1 -1
- package/dist/blueprints/AnalyticsImplementationBlueprint.esm.js.map +1 -1
- package/dist/blueprints/ApiBlueprint.esm.js +1 -1
- package/dist/blueprints/AppRootElementBlueprint.esm.js +1 -1
- package/dist/blueprints/NavItemBlueprint.esm.js +1 -1
- package/dist/blueprints/NavItemBlueprint.esm.js.map +1 -1
- package/dist/blueprints/PageBlueprint.esm.js +17 -6
- package/dist/blueprints/PageBlueprint.esm.js.map +1 -1
- package/dist/blueprints/PluginHeaderActionBlueprint.esm.js +3 -1
- package/dist/blueprints/PluginHeaderActionBlueprint.esm.js.map +1 -1
- package/dist/blueprints/PluginWrapperBlueprint.esm.js +4 -2
- package/dist/blueprints/PluginWrapperBlueprint.esm.js.map +1 -1
- package/dist/blueprints/SubPageBlueprint.esm.js +3 -1
- package/dist/blueprints/SubPageBlueprint.esm.js.map +1 -1
- package/dist/components/ExtensionBoundary.esm.js +3 -2
- package/dist/components/ExtensionBoundary.esm.js.map +1 -1
- package/dist/components/PageLayout.esm.js.map +1 -1
- package/dist/components/createSwappableComponent.esm.js +2 -0
- package/dist/components/createSwappableComponent.esm.js.map +1 -1
- package/dist/frontend-internal/src/apis/OpaqueApiRef.esm.js +9 -0
- package/dist/frontend-internal/src/apis/OpaqueApiRef.esm.js.map +1 -0
- package/dist/frontend-internal/src/wiring/InternalExtensionDefinition.esm.js.map +1 -1
- package/dist/frontend-internal/src/wiring/InternalFrontendPlugin.esm.js.map +1 -1
- package/dist/index.d.ts +380 -1457
- package/dist/index.esm.js +3 -0
- package/dist/index.esm.js.map +1 -1
- package/dist/routing/useRouteRef.esm.js +2 -0
- package/dist/routing/useRouteRef.esm.js.map +1 -1
- package/dist/schema/createSchemaFromZod.esm.js +1 -1
- package/dist/schema/createSchemaFromZod.esm.js.map +1 -1
- package/dist/translation/useTranslationRef.esm.js +2 -0
- package/dist/translation/useTranslationRef.esm.js.map +1 -1
- package/dist/types/alpha.d-DzeiOzxk.d.ts +1425 -0
- package/dist/wiring/createExtension.esm.js +6 -0
- package/dist/wiring/createExtension.esm.js.map +1 -1
- package/dist/wiring/createExtensionBlueprint.esm.js +2 -0
- package/dist/wiring/createExtensionBlueprint.esm.js.map +1 -1
- package/dist/wiring/createExtensionDataRef.esm.js.map +1 -1
- package/dist/wiring/createFrontendModule.esm.js +1 -0
- package/dist/wiring/createFrontendModule.esm.js.map +1 -1
- package/dist/wiring/createFrontendPlugin.esm.js +6 -0
- package/dist/wiring/createFrontendPlugin.esm.js.map +1 -1
- package/dist/wiring/resolveExtensionDefinition.esm.js.map +1 -1
- package/dist/wiring/resolveInputOverrides.esm.js.map +1 -1
- package/package.json +11 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FetchApi.esm.js","sources":["../../../src/apis/definitions/FetchApi.ts"],"sourcesContent":["/*\n * Copyright 2021 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 {
|
|
1
|
+
{"version":3,"file":"FetchApi.esm.js","sources":["../../../src/apis/definitions/FetchApi.ts"],"sourcesContent":["/*\n * Copyright 2021 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 { createApiRef } from '../system';\n\n/**\n * A wrapper for the fetch API, that has additional behaviors such as the\n * ability to automatically inject auth information where necessary.\n *\n * @public\n */\nexport type FetchApi = {\n /**\n * The `fetch` implementation.\n */\n fetch: typeof fetch;\n};\n\n/**\n * The {@link ApiRef} of {@link FetchApi}.\n *\n * @remarks\n *\n * This is a wrapper for the fetch API, that has additional behaviors such as\n * the ability to automatically inject auth information where necessary.\n *\n * Note that the default behavior of this API (unless overridden by your org),\n * is to require that the user is already signed in so that it has auth\n * information to inject. Therefore, using the default implementation of this\n * utility API e.g. on the `SignInPage` or similar, would cause issues. In\n * special circumstances like those, you can use the regular system `fetch`\n * instead.\n *\n * @public\n */\nexport const fetchApiRef = createApiRef<FetchApi>().with({\n id: 'core.fetch',\n pluginId: 'app',\n});\n"],"names":[],"mappings":";;;;;AAgDO,MAAM,WAAA,GAAc,YAAA,EAAuB,CAAE,IAAA,CAAK;AAAA,EACvD,EAAA,EAAI,YAAA;AAAA,EACJ,QAAA,EAAU;AACZ,CAAC;;;;"}
|
|
@@ -3,8 +3,9 @@ import '@backstage/version-bridge';
|
|
|
3
3
|
import '@backstage/errors';
|
|
4
4
|
import { createApiRef } from '../system/ApiRef.esm.js';
|
|
5
5
|
|
|
6
|
-
const iconsApiRef = createApiRef({
|
|
7
|
-
id: "core.icons"
|
|
6
|
+
const iconsApiRef = createApiRef().with({
|
|
7
|
+
id: "core.icons",
|
|
8
|
+
pluginId: "app"
|
|
8
9
|
});
|
|
9
10
|
|
|
10
11
|
export { iconsApiRef };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconsApi.esm.js","sources":["../../../src/apis/definitions/IconsApi.ts"],"sourcesContent":["/*\n * Copyright 2023 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 { createApiRef } from '../system';\nimport { IconComponent, IconElement } from '../../icons';\n\n/**\n * API for accessing app icons.\n *\n * @public\n */\nexport interface IconsApi {\n /**\n * Look up an icon element by key.\n */\n icon(key: string): IconElement | undefined;\n\n /**\n * @deprecated Use {@link IconsApi.icon} instead.\n */\n getIcon(key: string): IconComponent | undefined;\n\n listIconKeys(): string[];\n}\n\n/**\n * The `ApiRef` of {@link IconsApi}.\n *\n * @public\n */\nexport const iconsApiRef = createApiRef<IconsApi>({\n id: 'core.icons',\n});\n"],"names":[],"mappings":";;;;;AA2CO,MAAM,
|
|
1
|
+
{"version":3,"file":"IconsApi.esm.js","sources":["../../../src/apis/definitions/IconsApi.ts"],"sourcesContent":["/*\n * Copyright 2023 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 { createApiRef } from '../system';\nimport { IconComponent, IconElement } from '../../icons';\n\n/**\n * API for accessing app icons.\n *\n * @public\n */\nexport interface IconsApi {\n /**\n * Look up an icon element by key.\n */\n icon(key: string): IconElement | undefined;\n\n /**\n * @deprecated Use {@link IconsApi.icon} instead.\n */\n getIcon(key: string): IconComponent | undefined;\n\n listIconKeys(): string[];\n}\n\n/**\n * The `ApiRef` of {@link IconsApi}.\n *\n * @public\n */\nexport const iconsApiRef = createApiRef<IconsApi>().with({\n id: 'core.icons',\n pluginId: 'app',\n});\n"],"names":[],"mappings":";;;;;AA2CO,MAAM,WAAA,GAAc,YAAA,EAAuB,CAAE,IAAA,CAAK;AAAA,EACvD,EAAA,EAAI,YAAA;AAAA,EACJ,QAAA,EAAU;AACZ,CAAC;;;;"}
|
|
@@ -3,8 +3,9 @@ import '@backstage/version-bridge';
|
|
|
3
3
|
import '@backstage/errors';
|
|
4
4
|
import { createApiRef } from '../system/ApiRef.esm.js';
|
|
5
5
|
|
|
6
|
-
const identityApiRef = createApiRef({
|
|
7
|
-
id: "core.identity"
|
|
6
|
+
const identityApiRef = createApiRef().with({
|
|
7
|
+
id: "core.identity",
|
|
8
|
+
pluginId: "app"
|
|
8
9
|
});
|
|
9
10
|
|
|
10
11
|
export { identityApiRef };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IdentityApi.esm.js","sources":["../../../src/apis/definitions/IdentityApi.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 */\nimport {
|
|
1
|
+
{"version":3,"file":"IdentityApi.esm.js","sources":["../../../src/apis/definitions/IdentityApi.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 */\nimport { createApiRef } from '../system';\nimport { BackstageUserIdentity, ProfileInfo } from './auth';\n\n/**\n * The Identity API used to identify and get information about the signed in user.\n *\n * @public\n */\nexport type IdentityApi = {\n /**\n * The profile of the signed in user.\n */\n getProfileInfo(): Promise<ProfileInfo>;\n\n /**\n * User identity information within Backstage.\n */\n getBackstageIdentity(): Promise<BackstageUserIdentity>;\n\n /**\n * Provides credentials in the form of a token which proves the identity of the signed in user.\n *\n * The token will be undefined if the signed in user does not have a verified\n * identity, such as a demo user or mocked user for e2e tests.\n */\n getCredentials(): Promise<{ token?: string }>;\n\n /**\n * Sign out the current user\n */\n signOut(): Promise<void>;\n};\n\n/**\n * The {@link ApiRef} of {@link IdentityApi}.\n *\n * @public\n */\nexport const identityApiRef = createApiRef<IdentityApi>().with({\n id: 'core.identity',\n pluginId: 'app',\n});\n"],"names":[],"mappings":";;;;;AAqDO,MAAM,cAAA,GAAiB,YAAA,EAA0B,CAAE,IAAA,CAAK;AAAA,EAC7D,EAAA,EAAI,eAAA;AAAA,EACJ,QAAA,EAAU;AACZ,CAAC;;;;"}
|
|
@@ -3,8 +3,9 @@ import '@backstage/version-bridge';
|
|
|
3
3
|
import '@backstage/errors';
|
|
4
4
|
import { createApiRef } from '../system/ApiRef.esm.js';
|
|
5
5
|
|
|
6
|
-
const oauthRequestApiRef = createApiRef({
|
|
7
|
-
id: "core.oauthrequest"
|
|
6
|
+
const oauthRequestApiRef = createApiRef().with({
|
|
7
|
+
id: "core.oauthrequest",
|
|
8
|
+
pluginId: "app"
|
|
8
9
|
});
|
|
9
10
|
|
|
10
11
|
export { oauthRequestApiRef };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OAuthRequestApi.esm.js","sources":["../../../src/apis/definitions/OAuthRequestApi.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\nimport { Observable } from '@backstage/types';\nimport {
|
|
1
|
+
{"version":3,"file":"OAuthRequestApi.esm.js","sources":["../../../src/apis/definitions/OAuthRequestApi.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\nimport { Observable } from '@backstage/types';\nimport { createApiRef } from '../system';\nimport { AuthProviderInfo } from './auth';\n\n/**\n * Describes how to handle auth requests. Both how to show them to the user, and what to do when\n * the user accesses the auth request.\n *\n * @public\n */\nexport type OAuthRequesterOptions<TOAuthResponse> = {\n /**\n * Information about the auth provider, which will be forwarded to auth requests.\n */\n provider: AuthProviderInfo;\n\n /**\n * Implementation of the auth flow, which will be called synchronously when\n * trigger() is called on an auth requests.\n */\n onAuthRequest(scopes: Set<string>): Promise<TOAuthResponse>;\n};\n\n/**\n * Function used to trigger new auth requests for a set of scopes.\n *\n * @remarks\n *\n * The returned promise will resolve to the same value returned by the onAuthRequest in the\n * {@link OAuthRequesterOptions}. Or rejected, if the request is rejected.\n *\n * This function can be called multiple times before the promise resolves. All calls\n * will be merged into one request, and the scopes forwarded to the onAuthRequest will be the\n * union of all requested scopes.\n *\n * @public\n */\nexport type OAuthRequester<TAuthResponse> = (\n scopes: Set<string>,\n) => Promise<TAuthResponse>;\n\n/**\n * An pending auth request for a single auth provider. The request will remain in this pending\n * state until either reject() or trigger() is called.\n *\n * @remarks\n *\n * Any new requests for the same provider are merged into the existing pending request, meaning\n * there will only ever be a single pending request for a given provider.\n *\n * @public\n */\nexport type PendingOAuthRequest = {\n /**\n * Information about the auth provider, as given in the AuthRequesterOptions\n */\n provider: AuthProviderInfo;\n\n /**\n * Rejects the request, causing all pending AuthRequester calls to fail with \"RejectedError\".\n */\n reject(): void;\n\n /**\n * Trigger the auth request to continue the auth flow, by for example showing a popup.\n *\n * Synchronously calls onAuthRequest with all scope currently in the request.\n */\n trigger(): Promise<void>;\n};\n\n/**\n * Provides helpers for implemented OAuth login flows within Backstage.\n *\n * @public\n */\nexport type OAuthRequestApi = {\n /**\n * A utility for showing login popups or similar things, and merging together multiple requests for\n * different scopes into one request that includes all scopes.\n *\n * The passed in options provide information about the login provider, and how to handle auth requests.\n *\n * The returned AuthRequester function is used to request login with new scopes. These requests\n * are merged together and forwarded to the auth handler, as soon as a consumer of auth requests\n * triggers an auth flow.\n *\n * See AuthRequesterOptions, AuthRequester, and handleAuthRequests for more info.\n */\n createAuthRequester<OAuthResponse>(\n options: OAuthRequesterOptions<OAuthResponse>,\n ): OAuthRequester<OAuthResponse>;\n\n /**\n * Observers pending auth requests. The returned observable will emit all\n * current active auth request, at most one for each created auth requester.\n *\n * Each request has its own info about the login provider, forwarded from the auth requester options.\n *\n * Depending on user interaction, the request should either be rejected, or used to trigger the auth handler.\n * If the request is rejected, all pending AuthRequester calls will fail with a \"RejectedError\".\n * If a auth is triggered, and the auth handler resolves successfully, then all currently pending\n * AuthRequester calls will resolve to the value returned by the onAuthRequest call.\n */\n authRequest$(): Observable<PendingOAuthRequest[]>;\n};\n\n/**\n * The {@link ApiRef} of {@link OAuthRequestApi}.\n *\n * @public\n */\nexport const oauthRequestApiRef = createApiRef<OAuthRequestApi>().with({\n id: 'core.oauthrequest',\n pluginId: 'app',\n});\n"],"names":[],"mappings":";;;;;AAgIO,MAAM,kBAAA,GAAqB,YAAA,EAA8B,CAAE,IAAA,CAAK;AAAA,EACrE,EAAA,EAAI,mBAAA;AAAA,EACJ,QAAA,EAAU;AACZ,CAAC;;;;"}
|
|
@@ -3,8 +3,9 @@ import '@backstage/version-bridge';
|
|
|
3
3
|
import '@backstage/errors';
|
|
4
4
|
import { createApiRef } from '../system/ApiRef.esm.js';
|
|
5
5
|
|
|
6
|
-
const pluginHeaderActionsApiRef = createApiRef({
|
|
7
|
-
id: "core.plugin-header-actions"
|
|
6
|
+
const pluginHeaderActionsApiRef = createApiRef().with({
|
|
7
|
+
id: "core.plugin-header-actions",
|
|
8
|
+
pluginId: "app"
|
|
8
9
|
});
|
|
9
10
|
|
|
10
11
|
export { pluginHeaderActionsApiRef };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PluginHeaderActionsApi.esm.js","sources":["../../../src/apis/definitions/PluginHeaderActionsApi.ts"],"sourcesContent":["/*\n * Copyright 2026 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 { JSX } from 'react';\nimport { createApiRef } from '../system';\n\n/**\n * API for retrieving plugin-scoped header actions.\n *\n * @remarks\n *\n * Header actions are provided via\n * {@link @backstage/frontend-plugin-api#PluginHeaderActionBlueprint}\n * and automatically scoped to the providing plugin.\n *\n * @public\n */\nexport type PluginHeaderActionsApi = {\n /**\n * Returns the header actions for a given plugin.\n */\n getPluginHeaderActions(pluginId: string): Array<JSX.Element | null>;\n};\n\n/**\n * The `ApiRef` of {@link PluginHeaderActionsApi}.\n *\n * @public\n */\nexport const pluginHeaderActionsApiRef
|
|
1
|
+
{"version":3,"file":"PluginHeaderActionsApi.esm.js","sources":["../../../src/apis/definitions/PluginHeaderActionsApi.ts"],"sourcesContent":["/*\n * Copyright 2026 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 { JSX } from 'react';\nimport { createApiRef } from '../system';\n\n/**\n * API for retrieving plugin-scoped header actions.\n *\n * @remarks\n *\n * Header actions are provided via\n * {@link @backstage/frontend-plugin-api#PluginHeaderActionBlueprint}\n * and automatically scoped to the providing plugin.\n *\n * @public\n */\nexport type PluginHeaderActionsApi = {\n /**\n * Returns the header actions for a given plugin.\n */\n getPluginHeaderActions(pluginId: string): Array<JSX.Element | null>;\n};\n\n/**\n * The `ApiRef` of {@link PluginHeaderActionsApi}.\n *\n * @public\n */\nexport const pluginHeaderActionsApiRef =\n createApiRef<PluginHeaderActionsApi>().with({\n id: 'core.plugin-header-actions',\n pluginId: 'app',\n });\n"],"names":[],"mappings":";;;;;AA0CO,MAAM,yBAAA,GACX,YAAA,EAAqC,CAAE,IAAA,CAAK;AAAA,EAC1C,EAAA,EAAI,4BAAA;AAAA,EACJ,QAAA,EAAU;AACZ,CAAC;;;;"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import 'react/jsx-runtime';
|
|
2
|
+
import '@backstage/version-bridge';
|
|
3
|
+
import '@backstage/errors';
|
|
4
|
+
import { createApiRef } from '../system/ApiRef.esm.js';
|
|
2
5
|
|
|
3
|
-
const pluginWrapperApiRef = createApiRef({
|
|
4
|
-
id: "core.plugin-wrapper
|
|
6
|
+
const pluginWrapperApiRef = createApiRef().with({
|
|
7
|
+
id: "core.plugin-wrapper",
|
|
8
|
+
pluginId: "app"
|
|
5
9
|
});
|
|
6
10
|
|
|
7
11
|
export { pluginWrapperApiRef };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PluginWrapperApi.esm.js","sources":["../../../src/apis/definitions/PluginWrapperApi.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 { ComponentType, ReactNode } from 'react';\nimport { createApiRef } from '
|
|
1
|
+
{"version":3,"file":"PluginWrapperApi.esm.js","sources":["../../../src/apis/definitions/PluginWrapperApi.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 { ComponentType, ReactNode } from 'react';\nimport { createApiRef } from '../system';\n\n/**\n * The Plugin Wrapper API allows plugins to wrap their extensions with\n * providers. This API is only intended for internal use by the Backstage\n * frontend system. To provide contexts to plugin components, use\n * `ExtensionBoundary` instead.\n *\n * @public\n */\nexport type PluginWrapperApi = {\n /**\n * Returns the root wrapper that manages the global plugin state across\n * plugin wrapper instances.\n */\n getRootWrapper(): ComponentType<{ children: ReactNode }>;\n\n /**\n * Returns a wrapper component for a specific plugin, or undefined if no\n * wrappers exist. Do not use this API directly, instead use\n * `ExtensionBoundary` to wrap your plugin components if needed.\n */\n getPluginWrapper(\n pluginId: string,\n ): ComponentType<{ children: ReactNode }> | undefined;\n};\n\n/**\n * The API reference of {@link PluginWrapperApi}.\n *\n * @public\n */\nexport const pluginWrapperApiRef = createApiRef<PluginWrapperApi>().with({\n id: 'core.plugin-wrapper',\n pluginId: 'app',\n});\n"],"names":[],"mappings":";;;;;AAiDO,MAAM,mBAAA,GAAsB,YAAA,EAA+B,CAAE,IAAA,CAAK;AAAA,EACvE,EAAA,EAAI,qBAAA;AAAA,EACJ,QAAA,EAAU;AACZ,CAAC;;;;"}
|
|
@@ -3,8 +3,9 @@ import '@backstage/version-bridge';
|
|
|
3
3
|
import '@backstage/errors';
|
|
4
4
|
import { createApiRef } from '../system/ApiRef.esm.js';
|
|
5
5
|
|
|
6
|
-
const routeResolutionApiRef = createApiRef({
|
|
7
|
-
id: "core.route-resolution"
|
|
6
|
+
const routeResolutionApiRef = createApiRef().with({
|
|
7
|
+
id: "core.route-resolution",
|
|
8
|
+
pluginId: "app"
|
|
8
9
|
});
|
|
9
10
|
|
|
10
11
|
export { routeResolutionApiRef };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RouteResolutionApi.esm.js","sources":["../../../src/apis/definitions/RouteResolutionApi.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 {\n AnyRouteRefParams,\n RouteRef,\n SubRouteRef,\n ExternalRouteRef,\n} from '../../routing';\nimport { createApiRef } from '../system';\n\n/**\n * TS magic for handling route parameters.\n *\n * @remarks\n *\n * The extra TS magic here is to require a single params argument if the RouteRef\n * had at least one param defined, but require 0 arguments if there are no params defined.\n * Without this we'd have to pass in empty object to all parameter-less RouteRefs\n * just to make TypeScript happy, or we would have to make the argument optional in\n * which case you might forget to pass it in when it is actually required.\n *\n * @public\n */\nexport type RouteFunc<TParams extends AnyRouteRefParams> = (\n ...[params]: TParams extends undefined\n ? readonly []\n : readonly [params: TParams]\n) => string;\n\n/**\n * @public\n */\nexport interface RouteResolutionApi {\n resolve<TParams extends AnyRouteRefParams>(\n anyRouteRef:\n | RouteRef<TParams>\n | SubRouteRef<TParams>\n | ExternalRouteRef<TParams>,\n options?: {\n /**\n * An absolute path to use as a starting point when resolving the route.\n * If no path is provided the route will be resolved from the root of the app.\n */\n sourcePath?: string;\n },\n ): RouteFunc<TParams> | undefined;\n}\n\n/**\n * The `ApiRef` of {@link RouteResolutionApi}.\n *\n * @public\n */\nexport const routeResolutionApiRef = createApiRef<RouteResolutionApi>({\n id: 'core.route-resolution',\n});\n"],"names":[],"mappings":";;;;;AAmEO,MAAM,
|
|
1
|
+
{"version":3,"file":"RouteResolutionApi.esm.js","sources":["../../../src/apis/definitions/RouteResolutionApi.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 {\n AnyRouteRefParams,\n RouteRef,\n SubRouteRef,\n ExternalRouteRef,\n} from '../../routing';\nimport { createApiRef } from '../system';\n\n/**\n * TS magic for handling route parameters.\n *\n * @remarks\n *\n * The extra TS magic here is to require a single params argument if the RouteRef\n * had at least one param defined, but require 0 arguments if there are no params defined.\n * Without this we'd have to pass in empty object to all parameter-less RouteRefs\n * just to make TypeScript happy, or we would have to make the argument optional in\n * which case you might forget to pass it in when it is actually required.\n *\n * @public\n */\nexport type RouteFunc<TParams extends AnyRouteRefParams> = (\n ...[params]: TParams extends undefined\n ? readonly []\n : readonly [params: TParams]\n) => string;\n\n/**\n * @public\n */\nexport interface RouteResolutionApi {\n resolve<TParams extends AnyRouteRefParams>(\n anyRouteRef:\n | RouteRef<TParams>\n | SubRouteRef<TParams>\n | ExternalRouteRef<TParams>,\n options?: {\n /**\n * An absolute path to use as a starting point when resolving the route.\n * If no path is provided the route will be resolved from the root of the app.\n */\n sourcePath?: string;\n },\n ): RouteFunc<TParams> | undefined;\n}\n\n/**\n * The `ApiRef` of {@link RouteResolutionApi}.\n *\n * @public\n */\nexport const routeResolutionApiRef = createApiRef<RouteResolutionApi>().with({\n id: 'core.route-resolution',\n pluginId: 'app',\n});\n"],"names":[],"mappings":";;;;;AAmEO,MAAM,qBAAA,GAAwB,YAAA,EAAiC,CAAE,IAAA,CAAK;AAAA,EAC3E,EAAA,EAAI,uBAAA;AAAA,EACJ,QAAA,EAAU;AACZ,CAAC;;;;"}
|
|
@@ -3,8 +3,9 @@ import '@backstage/version-bridge';
|
|
|
3
3
|
import '@backstage/errors';
|
|
4
4
|
import { createApiRef } from '../system/ApiRef.esm.js';
|
|
5
5
|
|
|
6
|
-
const storageApiRef = createApiRef({
|
|
7
|
-
id: "core.storage"
|
|
6
|
+
const storageApiRef = createApiRef().with({
|
|
7
|
+
id: "core.storage",
|
|
8
|
+
pluginId: "app"
|
|
8
9
|
});
|
|
9
10
|
|
|
10
11
|
export { storageApiRef };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StorageApi.esm.js","sources":["../../../src/apis/definitions/StorageApi.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\nimport {
|
|
1
|
+
{"version":3,"file":"StorageApi.esm.js","sources":["../../../src/apis/definitions/StorageApi.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\nimport { createApiRef } from '../system';\nimport { JsonValue, Observable } from '@backstage/types';\n\n/**\n * A snapshot in time of the current known value of a storage key.\n *\n * @public\n */\nexport type StorageValueSnapshot<TValue extends JsonValue> =\n | {\n key: string;\n presence: 'unknown' | 'absent';\n value?: undefined;\n }\n | {\n key: string;\n presence: 'present';\n value: TValue;\n };\n\n/**\n * Provides a key-value persistence API.\n *\n * @public\n */\nexport interface StorageApi {\n /**\n * Create a bucket to store data in.\n *\n * @param name - Namespace for the storage to be stored under,\n * will inherit previous namespaces too\n */\n forBucket(name: string): StorageApi;\n\n /**\n * Remove persistent data.\n *\n * @param key - Unique key associated with the data.\n */\n remove(key: string): Promise<void>;\n\n /**\n * Save persistent data, and emit messages to anyone that is using\n * {@link StorageApi.observe$} for this key.\n *\n * @param key - Unique key associated with the data.\n * @param data - The data to be stored under the key.\n */\n set<T extends JsonValue>(key: string, data: T): Promise<void>;\n\n /**\n * Observe the value over time for a particular key in the current bucket.\n *\n * @remarks\n *\n * The observable will only emit values when the value changes in the underlying\n * storage, although multiple values with the same shape may be emitted in a row.\n *\n * If a {@link StorageApi.snapshot} of a key is retrieved and the presence is\n * `'unknown'`, then you are guaranteed to receive a snapshot with a known\n * presence, as long as you observe the key within the same tick.\n *\n * Since the emitted values are shared across all subscribers, it is important\n * not to mutate the returned values. The values may be frozen as a precaution.\n *\n * @param key - Unique key associated with the data\n */\n observe$<T extends JsonValue>(\n key: string,\n ): Observable<StorageValueSnapshot<T>>;\n\n /**\n * Returns an immediate snapshot value for the given key, if possible.\n *\n * @remarks\n *\n * Combine with {@link StorageApi.observe$} to get notified of value changes.\n *\n * Note that this method is synchronous, and some underlying storages may be\n * unable to retrieve a value using this method - the result may or may not\n * consistently have a presence of 'unknown'. Use {@link StorageApi.observe$}\n * to be sure to receive an actual value eventually.\n */\n snapshot<T extends JsonValue>(key: string): StorageValueSnapshot<T>;\n}\n\n/**\n * The {@link ApiRef} of {@link StorageApi}.\n *\n * @public\n */\nexport const storageApiRef = createApiRef<StorageApi>().with({\n id: 'core.storage',\n pluginId: 'app',\n});\n"],"names":[],"mappings":";;;;;AA2GO,MAAM,aAAA,GAAgB,YAAA,EAAyB,CAAE,IAAA,CAAK;AAAA,EAC3D,EAAA,EAAI,cAAA;AAAA,EACJ,QAAA,EAAU;AACZ,CAAC;;;;"}
|
|
@@ -3,8 +3,9 @@ import '@backstage/version-bridge';
|
|
|
3
3
|
import '@backstage/errors';
|
|
4
4
|
import { createApiRef } from '../system/ApiRef.esm.js';
|
|
5
5
|
|
|
6
|
-
const swappableComponentsApiRef = createApiRef({
|
|
7
|
-
id: "core.swappable-components"
|
|
6
|
+
const swappableComponentsApiRef = createApiRef().with({
|
|
7
|
+
id: "core.swappable-components",
|
|
8
|
+
pluginId: "app"
|
|
8
9
|
});
|
|
9
10
|
|
|
10
11
|
export { swappableComponentsApiRef };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SwappableComponentsApi.esm.js","sources":["../../../src/apis/definitions/SwappableComponentsApi.ts"],"sourcesContent":["/*\n * Copyright 2023 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 { SwappableComponentRef } from '../../components';\nimport { createApiRef } from '../system';\n\n/**\n * API for looking up components based on component refs.\n *\n * @public\n */\nexport interface SwappableComponentsApi {\n getComponent<\n TInnerComponentProps extends {},\n TExternalComponentProps extends {} = TInnerComponentProps,\n >(\n ref: SwappableComponentRef<TInnerComponentProps, TExternalComponentProps>,\n ): (props: TInnerComponentProps) => JSX.Element | null;\n}\n\n/**\n * The `ApiRef` of {@link SwappableComponentsApi}.\n *\n * @public\n */\nexport const swappableComponentsApiRef
|
|
1
|
+
{"version":3,"file":"SwappableComponentsApi.esm.js","sources":["../../../src/apis/definitions/SwappableComponentsApi.ts"],"sourcesContent":["/*\n * Copyright 2023 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 { SwappableComponentRef } from '../../components';\nimport { createApiRef } from '../system';\n\n/**\n * API for looking up components based on component refs.\n *\n * @public\n */\nexport interface SwappableComponentsApi {\n getComponent<\n TInnerComponentProps extends {},\n TExternalComponentProps extends {} = TInnerComponentProps,\n >(\n ref: SwappableComponentRef<TInnerComponentProps, TExternalComponentProps>,\n ): (props: TInnerComponentProps) => JSX.Element | null;\n}\n\n/**\n * The `ApiRef` of {@link SwappableComponentsApi}.\n *\n * @public\n */\nexport const swappableComponentsApiRef =\n createApiRef<SwappableComponentsApi>().with({\n id: 'core.swappable-components',\n pluginId: 'app',\n });\n"],"names":[],"mappings":";;;;;AAsCO,MAAM,yBAAA,GACX,YAAA,EAAqC,CAAE,IAAA,CAAK;AAAA,EAC1C,EAAA,EAAI,2BAAA;AAAA,EACJ,QAAA,EAAU;AACZ,CAAC;;;;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import 'react/jsx-runtime';
|
|
2
|
+
import '@backstage/version-bridge';
|
|
3
|
+
import '@backstage/errors';
|
|
4
|
+
import { createApiRef } from '../system/ApiRef.esm.js';
|
|
5
|
+
|
|
6
|
+
const toastApiRef = createApiRef({
|
|
7
|
+
id: "core.toast"
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export { toastApiRef };
|
|
11
|
+
//# sourceMappingURL=ToastApi.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastApi.esm.js","sources":["../../../src/apis/definitions/ToastApi.ts"],"sourcesContent":["/*\n * Copyright 2025 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 { createApiRef, ApiRef } from '../system';\nimport { ReactNode } from 'react';\n\n/**\n * Link item for toast notifications.\n *\n * @public\n */\nexport type ToastApiMessageLink = {\n /** Display text for the link */\n label: string;\n /** URL the link points to */\n href: string;\n};\n\n/**\n * Message handled by the {@link ToastApi}.\n *\n * @public\n */\nexport type ToastApiMessage = {\n /** Title of the toast (required) */\n title: ReactNode;\n /** Optional description text */\n description?: ReactNode;\n /** Status variant of the toast - defaults to 'success' */\n status?: 'neutral' | 'info' | 'success' | 'warning' | 'danger';\n /** Optional array of links to display */\n links?: ToastApiMessageLink[];\n /** Timeout in milliseconds before auto-dismiss. If not set, toast is permanent. */\n timeout?: number;\n};\n\n/**\n * Handle returned by {@link ToastApi.post} that allows programmatic control\n * of the posted toast.\n *\n * @public\n */\nexport type ToastApiPostResult = {\n /** Dismiss the toast. */\n close(): void;\n};\n\n/**\n * The toast API is used to display toast notifications to the user.\n *\n * @remarks\n * This API provides richer notification capabilities than the AlertApi,\n * including title/description, links, and per-toast timeout control.\n *\n * @example\n * ```tsx\n * const toastApi = useApi(toastApiRef);\n *\n * // Full-featured toast\n * toastApi.post({\n * title: 'Entity saved',\n * description: 'Your changes have been saved successfully.',\n * status: 'success',\n * timeout: 5000,\n * links: [{ label: 'View entity', href: '/catalog/default/component/my-service' }],\n * });\n *\n * // Simple toast\n * toastApi.post({ title: 'Processing...', status: 'info' });\n *\n * // Programmatic dismiss\n * const { close } = toastApi.post({ title: 'Uploading...', status: 'info' });\n * // Later...\n * close();\n * ```\n *\n * @public\n */\nexport type ToastApi = {\n /**\n * Post a toast notification for display to the user.\n *\n * @param toast - The toast message to display\n * @returns A handle with a `close()` method to programmatically dismiss the toast\n */\n post(toast: ToastApiMessage): ToastApiPostResult;\n};\n\n/**\n * The {@link ApiRef} of {@link ToastApi}.\n *\n * @public\n */\nexport const toastApiRef: ApiRef<ToastApi> = createApiRef({\n id: 'core.toast',\n});\n"],"names":[],"mappings":";;;;;AA0GO,MAAM,cAAgC,YAAA,CAAa;AAAA,EACxD,EAAA,EAAI;AACN,CAAC;;;;"}
|
|
@@ -3,8 +3,9 @@ import '@backstage/version-bridge';
|
|
|
3
3
|
import '@backstage/errors';
|
|
4
4
|
import { createApiRef } from '../system/ApiRef.esm.js';
|
|
5
5
|
|
|
6
|
-
const translationApiRef = createApiRef({
|
|
7
|
-
id: "core.translation"
|
|
6
|
+
const translationApiRef = createApiRef().with({
|
|
7
|
+
id: "core.translation",
|
|
8
|
+
pluginId: "app"
|
|
8
9
|
});
|
|
9
10
|
|
|
10
11
|
export { translationApiRef };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TranslationApi.esm.js","sources":["../../../src/apis/definitions/TranslationApi.ts"],"sourcesContent":["/*\n * Copyright 2023 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 { ApiRef, createApiRef } from '../system';\nimport { Expand, ExpandRecursive, Observable } from '@backstage/types';\nimport { TranslationRef } from '../../translation';\nimport { JSX } from 'react';\n\n/**\n * Base translation options.\n *\n * @ignore\n */\ninterface BaseOptions {\n interpolation?: {\n /** Whether to HTML escape provided values, defaults to false */\n escapeValue?: boolean;\n };\n}\n\n/**\n * All pluralization suffixes supported by i18next\n *\n * @ignore\n */\ntype TranslationPlural = 'zero' | 'one' | 'two' | 'few' | 'many' | 'other';\n\n/**\n * A mapping of i18n formatting types to their corresponding types and options.\n * @ignore\n */\ntype I18nextFormatMap = {\n number: {\n type: number;\n options: Intl.NumberFormatOptions;\n };\n currency: {\n type: number;\n options: Intl.NumberFormatOptions;\n };\n datetime: {\n type: Date;\n options: Intl.DateTimeFormatOptions;\n };\n relativetime: {\n type: number;\n options: {\n range?: Intl.RelativeTimeFormatUnit;\n } & Intl.RelativeTimeFormatOptions;\n };\n list: {\n type: string[];\n options: Intl.ListFormatOptions;\n };\n};\n\n/**\n * Extracts all pluralized keys from the message map.\n *\n * @example\n * ```\n * { foo: 'foo', bar_one: 'bar', bar_other: 'bars' } -> 'bar'\n * ```\n *\n * @ignore\n */\ntype PluralKeys<TMessages extends { [key in string]: string }> = {\n [Key in keyof TMessages]: Key extends `${infer K}_${TranslationPlural}`\n ? K\n : never;\n}[keyof TMessages];\n\n/**\n * Collapses a message map into normalized keys with union values.\n *\n * @example\n * ```\n * { foo_one: 'foo', foo_other: 'foos' } -> { foo: 'foo' | 'foos' }\n * ```\n *\n * @ignore\n */\ntype CollapsedMessages<TMessages extends { [key in string]: string }> = {\n [key in keyof TMessages as key extends `${infer K}_${TranslationPlural}`\n ? K\n : key]: TMessages[key];\n};\n\n/**\n * Trim away whitespace\n *\n * @ignore\n */\ntype Trim<T> = T extends ` ${infer U}`\n ? Trim<U>\n : T extends `${infer U} `\n ? Trim<U>\n : T;\n\n/**\n * Extracts the key and format from a replacement string.\n *\n * @example\n * ```\n * 'foo, number' -> { foo: number }, 'foo' -> { foo: undefined }\n * ```\n */\ntype ExtractFormat<Replacement extends string> =\n Replacement extends `${infer Key},${infer FullFormat}`\n ? {\n [key in Trim<Key>]: Lowercase<\n Trim<\n FullFormat extends `${infer Format}(${string})${string}`\n ? Format\n : FullFormat\n >\n >;\n }\n : { [key in Trim<Replacement>]: undefined };\n\n/**\n * Expand the keys in a flat map to nested objects.\n *\n * @example\n * ```\n * { 'a.b': 'foo', 'a.c': 'bar' } -> { a: { b: 'foo', c: 'bar' }\n * ```\n *\n * @ignore\n */\ntype ExpandKeys<TMap extends {}> = {\n [Key in keyof TMap as Key extends `${infer Prefix}.${string}`\n ? Prefix\n : Key]: Key extends `${string}.${infer Rest}`\n ? ExpandKeys<{ [key in Rest]: TMap[Key] }>\n : TMap[Key];\n};\n\n/**\n * Extracts all option keys and their format from a message string.\n *\n * @example\n * ```\n * 'foo {{bar}} {{baz, number}}' -> { 'bar': undefined, 'baz': 'number' }\n * ```\n *\n * @ignore\n */\ntype ReplaceFormatsFromMessage<TMessage> =\n TMessage extends `${string}{{${infer Replacement}}}${infer Tail}` // no formatting, e.g. {{foo}}\n ? ExpandKeys<ExtractFormat<Replacement>> & ReplaceFormatsFromMessage<Tail>\n : {};\n\n/**\n * Generates the replace options structure\n *\n * @ignore\n */\ntype ReplaceOptionsFromFormats<TFormats extends {}, TValueType> = {\n [Key in keyof TFormats]: TFormats[Key] extends keyof I18nextFormatMap\n ? I18nextFormatMap[TFormats[Key]]['type']\n : TFormats[Key] extends {}\n ? Expand<ReplaceOptionsFromFormats<TFormats[Key], TValueType>>\n : TValueType;\n};\n\n/**\n * Generates the formatParams options structure\n *\n * @ignore\n */\ntype ReplaceFormatParamsFromFormats<TFormats extends {}> = {\n [Key in keyof TFormats]?: TFormats[Key] extends keyof I18nextFormatMap\n ? I18nextFormatMap[TFormats[Key]]['options']\n : TFormats[Key] extends {}\n ? Expand<ReplaceFormatParamsFromFormats<TFormats[Key]>>\n : undefined;\n};\n\n/**\n * Extracts all nesting keys from a message string.\n *\n * @example\n * ```\n * 'foo $t(bar) $t(baz)' -> 'bar' | 'baz'\n * ```\n *\n * @ignore\n */\ntype NestingKeysFromMessage<TMessage extends string> =\n TMessage extends `${string}$t(${infer Key})${infer Tail}` // nesting options are not supported\n ? Trim<Key> | NestingKeysFromMessage<Tail>\n : never;\n\n/**\n * Find all referenced keys, given a starting key and the full set of messages.\n *\n * This will only discover keys up to 3 levels deep.\n *\n * @example\n * ```\n * <'x', { x: '$t(y) $t(z)', y: 'y', z: '$t(w)', w: 'w', foo: 'foo' }> -> 'x' | 'y' | 'z' | 'w'\n * ```\n *\n * @ignore\n */\ntype NestedMessageKeys<\n TKey extends keyof TMessages,\n TMessages extends { [key in string]: string },\n> =\n | TKey\n | NestedMessageKeys2<NestingKeysFromMessage<TMessages[TKey]>, TMessages>;\n// Can't recursively reference ourself, so instead we got this beauty\ntype NestedMessageKeys2<\n TKey extends keyof TMessages,\n TMessages extends { [key in string]: string },\n> =\n | TKey\n | NestedMessageKeys3<NestingKeysFromMessage<TMessages[TKey]>, TMessages>;\n// Only support 3 levels of nesting\ntype NestedMessageKeys3<\n TKey extends keyof TMessages,\n TMessages extends { [key in string]: string },\n> = TKey | NestingKeysFromMessage<TMessages[TKey]>;\n\n/**\n * Converts a union type to an intersection type.\n *\n * @example\n * ```\n * { foo: 'foo' } | { bar: 'bar' } -> { foo: 'foo' } & { bar: 'bar' }\n * ```\n *\n * @ignore\n */\ntype UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (\n k: infer I,\n) => void\n ? I\n : never;\n\n/**\n * Collects different types of options into a single object\n *\n * @ignore\n */\ntype CollectOptions<\n TCount extends { count?: number },\n TFormats extends {},\n TValueType,\n> = TCount &\n // count is special, omit it from the replacements\n (keyof Omit<TFormats, 'count'> extends never\n ? {}\n : (\n | Expand<Omit<ReplaceOptionsFromFormats<TFormats, TValueType>, 'count'>>\n | {\n replace: Expand<\n Omit<ReplaceOptionsFromFormats<TFormats, TValueType>, 'count'>\n >;\n }\n ) & {\n formatParams?: Expand<ReplaceFormatParamsFromFormats<TFormats>>;\n });\n\n/**\n * Helper type to only require options argument if needed\n *\n * @ignore\n */\ntype OptionArgs<TOptions extends {}> = keyof TOptions extends never\n ? [options?: Expand<BaseOptions>]\n : [options: Expand<BaseOptions & TOptions>];\n\n/**\n * @ignore\n */\ntype TranslationFunctionOptions<\n TKeys extends keyof TMessages, // All normalized message keys to be considered, i.e. included nested ones\n TPluralKeys extends keyof TMessages, // All keys in the message map that are pluralized\n TMessages extends { [key in string]: string }, // Collapsed message map with normalized keys and union values\n TValueType,\n> = OptionArgs<\n Expand<\n CollectOptions<\n TKeys & TPluralKeys extends never ? {} : { count: number },\n ExpandRecursive<\n UnionToIntersection<ReplaceFormatsFromMessage<TMessages[TKeys]>>\n >,\n TValueType\n >\n >\n>;\n\n/** @public */\nexport type TranslationFunction<TMessages extends { [key in string]: string }> =\n CollapsedMessages<TMessages> extends infer IMessages extends {\n [key in string]: string;\n }\n ? {\n /**\n * A translation function that returns a string.\n */\n <TKey extends keyof IMessages>(\n key: TKey,\n ...[args]: TranslationFunctionOptions<\n NestedMessageKeys<TKey, IMessages>,\n PluralKeys<TMessages>,\n IMessages,\n string\n >\n ): IMessages[TKey];\n /**\n * A translation function where at least one JSX.Element has been\n * provided as an interpolation value, and will therefore return a\n * JSX.Element.\n */\n <TKey extends keyof IMessages>(\n key: TKey,\n ...[args]: TranslationFunctionOptions<\n NestedMessageKeys<TKey, IMessages>,\n PluralKeys<TMessages>,\n IMessages,\n string | JSX.Element\n >\n ): JSX.Element;\n }\n : never;\n\n/** @public */\nexport type TranslationSnapshot<TMessages extends { [key in string]: string }> =\n { ready: false } | { ready: true; t: TranslationFunction<TMessages> };\n\n/** @public */\nexport type TranslationApi = {\n getTranslation<TMessages extends { [key in string]: string }>(\n translationRef: TranslationRef<string, TMessages>,\n ): TranslationSnapshot<TMessages>;\n\n translation$<TMessages extends { [key in string]: string }>(\n translationRef: TranslationRef<string, TMessages>,\n ): Observable<TranslationSnapshot<TMessages>>;\n};\n\n/**\n * @public\n */\nexport const translationApiRef: ApiRef<TranslationApi> = createApiRef({\n id: 'core.translation',\n});\n"],"names":[],"mappings":";;;;;AAwWO,MAAM,oBAA4C,YAAA,CAAa;AAAA,EACpE,EAAA,EAAI;AACN,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"TranslationApi.esm.js","sources":["../../../src/apis/definitions/TranslationApi.ts"],"sourcesContent":["/*\n * Copyright 2023 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 { createApiRef } from '../system';\nimport { Expand, ExpandRecursive, Observable } from '@backstage/types';\nimport { TranslationRef } from '../../translation';\nimport { JSX } from 'react';\n\n/**\n * Base translation options.\n *\n * @ignore\n */\ninterface BaseOptions {\n interpolation?: {\n /** Whether to HTML escape provided values, defaults to false */\n escapeValue?: boolean;\n };\n}\n\n/**\n * All pluralization suffixes supported by i18next\n *\n * @ignore\n */\ntype TranslationPlural = 'zero' | 'one' | 'two' | 'few' | 'many' | 'other';\n\n/**\n * A mapping of i18n formatting types to their corresponding types and options.\n * @ignore\n */\ntype I18nextFormatMap = {\n number: {\n type: number;\n options: Intl.NumberFormatOptions;\n };\n currency: {\n type: number;\n options: Intl.NumberFormatOptions;\n };\n datetime: {\n type: Date;\n options: Intl.DateTimeFormatOptions;\n };\n relativetime: {\n type: number;\n options: {\n range?: Intl.RelativeTimeFormatUnit;\n } & Intl.RelativeTimeFormatOptions;\n };\n list: {\n type: string[];\n options: Intl.ListFormatOptions;\n };\n};\n\n/**\n * Extracts all pluralized keys from the message map.\n *\n * @example\n * ```\n * { foo: 'foo', bar_one: 'bar', bar_other: 'bars' } -> 'bar'\n * ```\n *\n * @ignore\n */\ntype PluralKeys<TMessages extends { [key in string]: string }> = {\n [Key in keyof TMessages]: Key extends `${infer K}_${TranslationPlural}`\n ? K\n : never;\n}[keyof TMessages];\n\n/**\n * Collapses a message map into normalized keys with union values.\n *\n * @example\n * ```\n * { foo_one: 'foo', foo_other: 'foos' } -> { foo: 'foo' | 'foos' }\n * ```\n *\n * @ignore\n */\ntype CollapsedMessages<TMessages extends { [key in string]: string }> = {\n [key in keyof TMessages as key extends `${infer K}_${TranslationPlural}`\n ? K\n : key]: TMessages[key];\n};\n\n/**\n * Trim away whitespace\n *\n * @ignore\n */\ntype Trim<T> = T extends ` ${infer U}`\n ? Trim<U>\n : T extends `${infer U} `\n ? Trim<U>\n : T;\n\n/**\n * Extracts the key and format from a replacement string.\n *\n * @example\n * ```\n * 'foo, number' -> { foo: number }, 'foo' -> { foo: undefined }\n * ```\n */\ntype ExtractFormat<Replacement extends string> =\n Replacement extends `${infer Key},${infer FullFormat}`\n ? {\n [key in Trim<Key>]: Lowercase<\n Trim<\n FullFormat extends `${infer Format}(${string})${string}`\n ? Format\n : FullFormat\n >\n >;\n }\n : { [key in Trim<Replacement>]: undefined };\n\n/**\n * Expand the keys in a flat map to nested objects.\n *\n * @example\n * ```\n * { 'a.b': 'foo', 'a.c': 'bar' } -> { a: { b: 'foo', c: 'bar' }\n * ```\n *\n * @ignore\n */\ntype ExpandKeys<TMap extends {}> = {\n [Key in keyof TMap as Key extends `${infer Prefix}.${string}`\n ? Prefix\n : Key]: Key extends `${string}.${infer Rest}`\n ? ExpandKeys<{ [key in Rest]: TMap[Key] }>\n : TMap[Key];\n};\n\n/**\n * Extracts all option keys and their format from a message string.\n *\n * @example\n * ```\n * 'foo {{bar}} {{baz, number}}' -> { 'bar': undefined, 'baz': 'number' }\n * ```\n *\n * @ignore\n */\ntype ReplaceFormatsFromMessage<TMessage> =\n TMessage extends `${string}{{${infer Replacement}}}${infer Tail}` // no formatting, e.g. {{foo}}\n ? ExpandKeys<ExtractFormat<Replacement>> & ReplaceFormatsFromMessage<Tail>\n : {};\n\n/**\n * Generates the replace options structure\n *\n * @ignore\n */\ntype ReplaceOptionsFromFormats<TFormats extends {}, TValueType> = {\n [Key in keyof TFormats]: TFormats[Key] extends keyof I18nextFormatMap\n ? I18nextFormatMap[TFormats[Key]]['type']\n : TFormats[Key] extends {}\n ? Expand<ReplaceOptionsFromFormats<TFormats[Key], TValueType>>\n : TValueType;\n};\n\n/**\n * Generates the formatParams options structure\n *\n * @ignore\n */\ntype ReplaceFormatParamsFromFormats<TFormats extends {}> = {\n [Key in keyof TFormats]?: TFormats[Key] extends keyof I18nextFormatMap\n ? I18nextFormatMap[TFormats[Key]]['options']\n : TFormats[Key] extends {}\n ? Expand<ReplaceFormatParamsFromFormats<TFormats[Key]>>\n : undefined;\n};\n\n/**\n * Extracts all nesting keys from a message string.\n *\n * @example\n * ```\n * 'foo $t(bar) $t(baz)' -> 'bar' | 'baz'\n * ```\n *\n * @ignore\n */\ntype NestingKeysFromMessage<TMessage extends string> =\n TMessage extends `${string}$t(${infer Key})${infer Tail}` // nesting options are not supported\n ? Trim<Key> | NestingKeysFromMessage<Tail>\n : never;\n\n/**\n * Find all referenced keys, given a starting key and the full set of messages.\n *\n * This will only discover keys up to 3 levels deep.\n *\n * @example\n * ```\n * <'x', { x: '$t(y) $t(z)', y: 'y', z: '$t(w)', w: 'w', foo: 'foo' }> -> 'x' | 'y' | 'z' | 'w'\n * ```\n *\n * @ignore\n */\ntype NestedMessageKeys<\n TKey extends keyof TMessages,\n TMessages extends { [key in string]: string },\n> =\n | TKey\n | NestedMessageKeys2<NestingKeysFromMessage<TMessages[TKey]>, TMessages>;\n// Can't recursively reference ourself, so instead we got this beauty\ntype NestedMessageKeys2<\n TKey extends keyof TMessages,\n TMessages extends { [key in string]: string },\n> =\n | TKey\n | NestedMessageKeys3<NestingKeysFromMessage<TMessages[TKey]>, TMessages>;\n// Only support 3 levels of nesting\ntype NestedMessageKeys3<\n TKey extends keyof TMessages,\n TMessages extends { [key in string]: string },\n> = TKey | NestingKeysFromMessage<TMessages[TKey]>;\n\n/**\n * Converts a union type to an intersection type.\n *\n * @example\n * ```\n * { foo: 'foo' } | { bar: 'bar' } -> { foo: 'foo' } & { bar: 'bar' }\n * ```\n *\n * @ignore\n */\ntype UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (\n k: infer I,\n) => void\n ? I\n : never;\n\n/**\n * Collects different types of options into a single object\n *\n * @ignore\n */\ntype CollectOptions<\n TCount extends { count?: number },\n TFormats extends {},\n TValueType,\n> = TCount &\n // count is special, omit it from the replacements\n (keyof Omit<TFormats, 'count'> extends never\n ? {}\n : (\n | Expand<Omit<ReplaceOptionsFromFormats<TFormats, TValueType>, 'count'>>\n | {\n replace: Expand<\n Omit<ReplaceOptionsFromFormats<TFormats, TValueType>, 'count'>\n >;\n }\n ) & {\n formatParams?: Expand<ReplaceFormatParamsFromFormats<TFormats>>;\n });\n\n/**\n * Helper type to only require options argument if needed\n *\n * @ignore\n */\ntype OptionArgs<TOptions extends {}> = keyof TOptions extends never\n ? [options?: Expand<BaseOptions>]\n : [options: Expand<BaseOptions & TOptions>];\n\n/**\n * @ignore\n */\ntype TranslationFunctionOptions<\n TKeys extends keyof TMessages, // All normalized message keys to be considered, i.e. included nested ones\n TPluralKeys extends keyof TMessages, // All keys in the message map that are pluralized\n TMessages extends { [key in string]: string }, // Collapsed message map with normalized keys and union values\n TValueType,\n> = OptionArgs<\n Expand<\n CollectOptions<\n TKeys & TPluralKeys extends never ? {} : { count: number },\n ExpandRecursive<\n UnionToIntersection<ReplaceFormatsFromMessage<TMessages[TKeys]>>\n >,\n TValueType\n >\n >\n>;\n\n/** @public */\nexport type TranslationFunction<TMessages extends { [key in string]: string }> =\n CollapsedMessages<TMessages> extends infer IMessages extends {\n [key in string]: string;\n }\n ? {\n /**\n * A translation function that returns a string.\n */\n <TKey extends keyof IMessages>(\n key: TKey,\n ...[args]: TranslationFunctionOptions<\n NestedMessageKeys<TKey, IMessages>,\n PluralKeys<TMessages>,\n IMessages,\n string\n >\n ): IMessages[TKey];\n /**\n * A translation function where at least one JSX.Element has been\n * provided as an interpolation value, and will therefore return a\n * JSX.Element.\n */\n <TKey extends keyof IMessages>(\n key: TKey,\n ...[args]: TranslationFunctionOptions<\n NestedMessageKeys<TKey, IMessages>,\n PluralKeys<TMessages>,\n IMessages,\n string | JSX.Element\n >\n ): JSX.Element;\n }\n : never;\n\n/** @public */\nexport type TranslationSnapshot<TMessages extends { [key in string]: string }> =\n { ready: false } | { ready: true; t: TranslationFunction<TMessages> };\n\n/** @public */\nexport type TranslationApi = {\n getTranslation<TMessages extends { [key in string]: string }>(\n translationRef: TranslationRef<string, TMessages>,\n ): TranslationSnapshot<TMessages>;\n\n translation$<TMessages extends { [key in string]: string }>(\n translationRef: TranslationRef<string, TMessages>,\n ): Observable<TranslationSnapshot<TMessages>>;\n};\n\n/**\n * @public\n */\nexport const translationApiRef = createApiRef<TranslationApi>().with({\n id: 'core.translation',\n pluginId: 'app',\n});\n"],"names":[],"mappings":";;;;;AAwWO,MAAM,iBAAA,GAAoB,YAAA,EAA6B,CAAE,IAAA,CAAK;AAAA,EACnE,EAAA,EAAI,kBAAA;AAAA,EACJ,QAAA,EAAU;AACZ,CAAC;;;;"}
|
|
@@ -13,38 +13,49 @@ const SessionState = {
|
|
|
13
13
|
*/
|
|
14
14
|
SignedOut: "SignedOut"
|
|
15
15
|
};
|
|
16
|
-
const googleAuthApiRef = createApiRef({
|
|
17
|
-
id: "core.auth.google"
|
|
16
|
+
const googleAuthApiRef = createApiRef().with({
|
|
17
|
+
id: "core.auth.google",
|
|
18
|
+
pluginId: "app"
|
|
18
19
|
});
|
|
19
|
-
const githubAuthApiRef = createApiRef({
|
|
20
|
-
id: "core.auth.github"
|
|
20
|
+
const githubAuthApiRef = createApiRef().with({
|
|
21
|
+
id: "core.auth.github",
|
|
22
|
+
pluginId: "app"
|
|
21
23
|
});
|
|
22
|
-
const oktaAuthApiRef = createApiRef({
|
|
23
|
-
id: "core.auth.okta"
|
|
24
|
+
const oktaAuthApiRef = createApiRef().with({
|
|
25
|
+
id: "core.auth.okta",
|
|
26
|
+
pluginId: "app"
|
|
24
27
|
});
|
|
25
|
-
const gitlabAuthApiRef = createApiRef({
|
|
26
|
-
id: "core.auth.gitlab"
|
|
28
|
+
const gitlabAuthApiRef = createApiRef().with({
|
|
29
|
+
id: "core.auth.gitlab",
|
|
30
|
+
pluginId: "app"
|
|
27
31
|
});
|
|
28
|
-
const microsoftAuthApiRef = createApiRef({
|
|
29
|
-
id: "core.auth.microsoft"
|
|
32
|
+
const microsoftAuthApiRef = createApiRef().with({
|
|
33
|
+
id: "core.auth.microsoft",
|
|
34
|
+
pluginId: "app"
|
|
30
35
|
});
|
|
31
|
-
const oneloginAuthApiRef = createApiRef({
|
|
32
|
-
id: "core.auth.onelogin"
|
|
36
|
+
const oneloginAuthApiRef = createApiRef().with({
|
|
37
|
+
id: "core.auth.onelogin",
|
|
38
|
+
pluginId: "app"
|
|
33
39
|
});
|
|
34
|
-
const bitbucketAuthApiRef = createApiRef({
|
|
35
|
-
id: "core.auth.bitbucket"
|
|
40
|
+
const bitbucketAuthApiRef = createApiRef().with({
|
|
41
|
+
id: "core.auth.bitbucket",
|
|
42
|
+
pluginId: "app"
|
|
36
43
|
});
|
|
37
|
-
const bitbucketServerAuthApiRef = createApiRef({
|
|
38
|
-
id: "core.auth.bitbucket-server"
|
|
44
|
+
const bitbucketServerAuthApiRef = createApiRef().with({
|
|
45
|
+
id: "core.auth.bitbucket-server",
|
|
46
|
+
pluginId: "app"
|
|
39
47
|
});
|
|
40
|
-
const atlassianAuthApiRef = createApiRef({
|
|
41
|
-
id: "core.auth.atlassian"
|
|
48
|
+
const atlassianAuthApiRef = createApiRef().with({
|
|
49
|
+
id: "core.auth.atlassian",
|
|
50
|
+
pluginId: "app"
|
|
42
51
|
});
|
|
43
|
-
const vmwareCloudAuthApiRef = createApiRef({
|
|
44
|
-
id: "core.auth.vmware-cloud"
|
|
52
|
+
const vmwareCloudAuthApiRef = createApiRef().with({
|
|
53
|
+
id: "core.auth.vmware-cloud",
|
|
54
|
+
pluginId: "app"
|
|
45
55
|
});
|
|
46
|
-
const openshiftAuthApiRef = createApiRef({
|
|
47
|
-
id: "core.auth.openshift"
|
|
56
|
+
const openshiftAuthApiRef = createApiRef().with({
|
|
57
|
+
id: "core.auth.openshift",
|
|
58
|
+
pluginId: "app"
|
|
48
59
|
});
|
|
49
60
|
|
|
50
61
|
export { SessionState, atlassianAuthApiRef, bitbucketAuthApiRef, bitbucketServerAuthApiRef, githubAuthApiRef, gitlabAuthApiRef, googleAuthApiRef, microsoftAuthApiRef, oktaAuthApiRef, oneloginAuthApiRef, openshiftAuthApiRef, vmwareCloudAuthApiRef };
|
|
@@ -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 { ApiRef, createApiRef } from '../system';\nimport { IconComponent } 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>({ ... })\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 icon: IconComponent;\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: ApiRef<\n OAuthApi &\n OpenIdConnectApi &\n ProfileInfoApi &\n BackstageIdentityApi &\n SessionApi\n> = createApiRef({\n id: 'core.auth.google',\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: ApiRef<\n OAuthApi & ProfileInfoApi & BackstageIdentityApi & SessionApi\n> = createApiRef({\n id: 'core.auth.github',\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: ApiRef<\n OAuthApi &\n OpenIdConnectApi &\n ProfileInfoApi &\n BackstageIdentityApi &\n SessionApi\n> = createApiRef({\n id: 'core.auth.okta',\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: ApiRef<\n OAuthApi &\n OpenIdConnectApi &\n ProfileInfoApi &\n BackstageIdentityApi &\n SessionApi\n> = createApiRef({\n id: 'core.auth.gitlab',\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: ApiRef<\n OAuthApi &\n OpenIdConnectApi &\n ProfileInfoApi &\n BackstageIdentityApi &\n SessionApi\n> = createApiRef({\n id: 'core.auth.microsoft',\n});\n\n/**\n * Provides authentication towards OneLogin APIs.\n *\n * @public\n */\nexport const oneloginAuthApiRef: ApiRef<\n OAuthApi &\n OpenIdConnectApi &\n ProfileInfoApi &\n BackstageIdentityApi &\n SessionApi\n> = createApiRef({\n id: 'core.auth.onelogin',\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: ApiRef<\n OAuthApi & ProfileInfoApi & BackstageIdentityApi & SessionApi\n> = createApiRef({\n id: 'core.auth.bitbucket',\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: ApiRef<\n OAuthApi & ProfileInfoApi & BackstageIdentityApi & SessionApi\n> = createApiRef({\n id: 'core.auth.bitbucket-server',\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: ApiRef<\n OAuthApi & ProfileInfoApi & BackstageIdentityApi & SessionApi\n> = createApiRef({\n id: 'core.auth.atlassian',\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: ApiRef<\n OAuthApi &\n OpenIdConnectApi &\n ProfileInfoApi &\n BackstageIdentityApi &\n SessionApi\n> = createApiRef({\n id: 'core.auth.vmware-cloud',\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: ApiRef<\n OAuthApi & ProfileInfoApi & BackstageIdentityApi & SessionApi\n> = createApiRef({\n id: 'core.auth.openshift',\n});\n"],"names":[],"mappings":";;;;;AAiRO,MAAM,YAAA,GAAe;AAAA;AAAA;AAAA;AAAA,EAI1B,QAAA,EAAU,UAAA;AAAA;AAAA;AAAA;AAAA,EAIV,SAAA,EAAW;AACb;AAgDO,MAAM,mBAMT,YAAA,CAAa;AAAA,EACf,EAAA,EAAI;AACN,CAAC;AAWM,MAAM,mBAET,YAAA,CAAa;AAAA,EACf,EAAA,EAAI;AACN,CAAC;AAWM,MAAM,iBAMT,YAAA,CAAa;AAAA,EACf,EAAA,EAAI;AACN,CAAC;AAWM,MAAM,mBAMT,YAAA,CAAa;AAAA,EACf,EAAA,EAAI;AACN,CAAC;AAYM,MAAM,sBAMT,YAAA,CAAa;AAAA,EACf,EAAA,EAAI;AACN,CAAC;AAOM,MAAM,qBAMT,YAAA,CAAa;AAAA,EACf,EAAA,EAAI;AACN,CAAC;AAWM,MAAM,sBAET,YAAA,CAAa;AAAA,EACf,EAAA,EAAI;AACN,CAAC;AAWM,MAAM,4BAET,YAAA,CAAa;AAAA,EACf,EAAA,EAAI;AACN,CAAC;AAWM,MAAM,sBAET,YAAA,CAAa;AAAA,EACf,EAAA,EAAI;AACN,CAAC;AAWM,MAAM,wBAMT,YAAA,CAAa;AAAA,EACf,EAAA,EAAI;AACN,CAAC;AAaM,MAAM,sBAET,YAAA,CAAa;AAAA,EACf,EAAA,EAAI;AACN,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 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,26 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
get id() {
|
|
12
|
-
return this.config.id;
|
|
13
|
-
}
|
|
14
|
-
// Utility for getting type of an api, using `typeof apiRef.T`
|
|
15
|
-
get T() {
|
|
16
|
-
throw new Error(`tried to read ApiRef.T of ${this}`);
|
|
17
|
-
}
|
|
18
|
-
toString() {
|
|
19
|
-
return `apiRef{${this.config.id}}`;
|
|
1
|
+
import { OpaqueApiRef } from '../../frontend-internal/src/apis/OpaqueApiRef.esm.js';
|
|
2
|
+
|
|
3
|
+
function validateId(id) {
|
|
4
|
+
const valid = id.split(".").flatMap((part) => part.split("-")).every((part) => part.match(/^[a-z][a-z0-9]*$/));
|
|
5
|
+
if (!valid) {
|
|
6
|
+
throw new Error(
|
|
7
|
+
`API id must only contain period separated lowercase alphanum tokens with dashes, got '${id}'`
|
|
8
|
+
);
|
|
20
9
|
}
|
|
21
10
|
}
|
|
11
|
+
function makeApiRef(config) {
|
|
12
|
+
return OpaqueApiRef.createInstance("v1", {
|
|
13
|
+
id: config.id,
|
|
14
|
+
...config.pluginId ? { pluginId: config.pluginId } : {},
|
|
15
|
+
T: null,
|
|
16
|
+
toString() {
|
|
17
|
+
return `apiRef{${config.id}}`;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
22
21
|
function createApiRef(config) {
|
|
23
|
-
|
|
22
|
+
if (config) {
|
|
23
|
+
validateId(config.id);
|
|
24
|
+
return makeApiRef(config);
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
with(withConfig) {
|
|
28
|
+
validateId(withConfig.id);
|
|
29
|
+
return makeApiRef(withConfig);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
24
32
|
}
|
|
25
33
|
|
|
26
34
|
export { createApiRef };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApiRef.esm.js","sources":["../../../src/apis/system/ApiRef.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\nimport type { ApiRef } from './types';\n\n/**\n * API reference configuration - holds an ID of the referenced API.\n *\n * @public\n */\nexport type ApiRefConfig = {\n id: string;\n};\n\
|
|
1
|
+
{"version":3,"file":"ApiRef.esm.js","sources":["../../../src/apis/system/ApiRef.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\nimport { OpaqueApiRef } from '@internal/frontend';\nimport type { ApiRef } from './types';\n\n/**\n * API reference configuration - holds an ID of the referenced API.\n *\n * @public\n */\nexport type ApiRefConfig = {\n id: string;\n};\n\ntype ApiRefBuilderConfig<TId extends string> = {\n id: TId;\n pluginId?: string;\n};\n\nfunction validateId(id: string): void {\n const valid = id\n .split('.')\n .flatMap(part => part.split('-'))\n .every(part => part.match(/^[a-z][a-z0-9]*$/));\n if (!valid) {\n throw new Error(\n `API id must only contain period separated lowercase alphanum tokens with dashes, got '${id}'`,\n );\n }\n}\n\nfunction makeApiRef<T, TId extends string>(\n config: ApiRefBuilderConfig<TId>,\n): ApiRef<T, TId> & { readonly $$type: '@backstage/ApiRef' } {\n return OpaqueApiRef.createInstance('v1', {\n id: config.id,\n ...(config.pluginId ? { pluginId: config.pluginId } : {}),\n T: null as unknown as T,\n toString() {\n return `apiRef{${config.id}}`;\n },\n }) as ApiRef<T, TId> & { readonly $$type: '@backstage/ApiRef' };\n}\n\n/**\n * Creates a reference to an API.\n *\n * @remarks\n *\n * The `id` is a stable identifier for the API implementation. The frontend\n * system infers the owning plugin for an API from the `id`. When using the\n * builder form, you can instead provide a `pluginId` explicitly. The\n * recommended pattern is `plugin.<plugin-id>.*` (for example,\n * `plugin.catalog.entity-presentation`). This ensures that other plugins can't\n * mistakenly override your API implementation.\n *\n * The recommended way to create an API reference is:\n *\n * ```ts\n * const myApiRef = createApiRef<MyApi>().with({\n * id: 'my-api',\n * pluginId: 'my-plugin',\n * });\n * ```\n *\n * The legacy way to create an API reference is:\n *\n * ```ts\n * const myApiRef = createApiRef<MyApi>({ id: 'plugin.my.api' });\n * ```\n *\n * @public\n */\n/**\n * Creates a reference to an API.\n *\n * @deprecated Use `createApiRef<T>().with(...)` instead.\n * @public\n */\nexport function createApiRef<T>(\n config: ApiRefConfig,\n): ApiRef<T> & { readonly $$type: '@backstage/ApiRef' };\n/**\n * Creates a reference to an API.\n *\n * @remarks\n *\n * Returns a builder with a `.with()` method for providing the API reference\n * configuration.\n *\n * @public\n */\nexport function createApiRef<T>(): {\n with<const TId extends string>(\n config: ApiRefConfig & { id: TId; pluginId?: string },\n ): ApiRef<T, TId> & {\n readonly $$type: '@backstage/ApiRef';\n };\n};\nexport function createApiRef<T>(config?: ApiRefConfig):\n | (ApiRef<T> & { readonly $$type: '@backstage/ApiRef' })\n | {\n with<const TId extends string>(\n config: ApiRefConfig & { id: TId; pluginId?: string },\n ): ApiRef<T, TId> & {\n readonly $$type: '@backstage/ApiRef';\n };\n } {\n if (config) {\n validateId(config.id);\n return makeApiRef<T, string>(config);\n }\n return {\n with<const TId extends string>(\n withConfig: ApiRefConfig & { id: TId; pluginId?: string },\n ): ApiRef<T, TId> & { readonly $$type: '@backstage/ApiRef' } {\n validateId(withConfig.id);\n return makeApiRef<T, TId>(withConfig);\n },\n };\n}\n"],"names":[],"mappings":";;AAiCA,SAAS,WAAW,EAAA,EAAkB;AACpC,EAAA,MAAM,QAAQ,EAAA,CACX,KAAA,CAAM,GAAG,CAAA,CACT,QAAQ,CAAA,IAAA,KAAQ,IAAA,CAAK,KAAA,CAAM,GAAG,CAAC,CAAA,CAC/B,KAAA,CAAM,UAAQ,IAAA,CAAK,KAAA,CAAM,kBAAkB,CAAC,CAAA;AAC/C,EAAA,IAAI,CAAC,KAAA,EAAO;AACV,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,yFAAyF,EAAE,CAAA,CAAA;AAAA,KAC7F;AAAA,EACF;AACF;AAEA,SAAS,WACP,MAAA,EAC2D;AAC3D,EAAA,OAAO,YAAA,CAAa,eAAe,IAAA,EAAM;AAAA,IACvC,IAAI,MAAA,CAAO,EAAA;AAAA,IACX,GAAI,OAAO,QAAA,GAAW,EAAE,UAAU,MAAA,CAAO,QAAA,KAAa,EAAC;AAAA,IACvD,CAAA,EAAG,IAAA;AAAA,IACH,QAAA,GAAW;AACT,MAAA,OAAO,CAAA,OAAA,EAAU,OAAO,EAAE,CAAA,CAAA,CAAA;AAAA,IAC5B;AAAA,GACD,CAAA;AACH;AAyDO,SAAS,aAAgB,MAAA,EAQ1B;AACJ,EAAA,IAAI,MAAA,EAAQ;AACV,IAAA,UAAA,CAAW,OAAO,EAAE,CAAA;AACpB,IAAA,OAAO,WAAsB,MAAM,CAAA;AAAA,EACrC;AACA,EAAA,OAAO;AAAA,IACL,KACE,UAAA,EAC2D;AAC3D,MAAA,UAAA,CAAW,WAAW,EAAE,CAAA;AACxB,MAAA,OAAO,WAAmB,UAAU,CAAA;AAAA,IACtC;AAAA,GACF;AACF;;;;"}
|
|
@@ -2,10 +2,11 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
2
2
|
import { useVersionedContext } from '@backstage/version-bridge';
|
|
3
3
|
import { NotImplementedError } from '@backstage/errors';
|
|
4
4
|
|
|
5
|
+
const emptyApiHolder = Object.freeze({ get: () => void 0 });
|
|
5
6
|
function useApiHolder() {
|
|
6
7
|
const versionedHolder = useVersionedContext("api-context");
|
|
7
8
|
if (!versionedHolder) {
|
|
8
|
-
|
|
9
|
+
return emptyApiHolder;
|
|
9
10
|
}
|
|
10
11
|
const apiHolder = versionedHolder.atVersion(1);
|
|
11
12
|
if (!apiHolder) {
|