@backstage/core-plugin-api 1.10.9 → 1.11.1-next.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 +18 -0
- package/dist/alpha.d.ts +1 -1
- package/dist/analytics/AnalyticsContext.esm.js.map +1 -1
- package/dist/analytics/Tracker.esm.js.map +1 -1
- package/dist/analytics/useAnalytics.esm.js.map +1 -1
- package/dist/apis/definitions/AlertApi.esm.js.map +1 -1
- package/dist/apis/definitions/AnalyticsApi.esm.js.map +1 -1
- package/dist/apis/definitions/AppLanguageApi.esm.js.map +1 -1
- package/dist/apis/definitions/AppThemeApi.esm.js.map +1 -1
- package/dist/apis/definitions/ConfigApi.esm.js.map +1 -1
- package/dist/apis/definitions/DiscoveryApi.esm.js.map +1 -1
- package/dist/apis/definitions/ErrorApi.esm.js.map +1 -1
- package/dist/apis/definitions/FeatureFlagsApi.esm.js.map +1 -1
- package/dist/apis/definitions/FetchApi.esm.js.map +1 -1
- package/dist/apis/definitions/IdentityApi.esm.js.map +1 -1
- package/dist/apis/definitions/OAuthRequestApi.esm.js.map +1 -1
- package/dist/apis/definitions/StorageApi.esm.js.map +1 -1
- package/dist/apis/definitions/TranslationApi.esm.js.map +1 -1
- package/dist/apis/definitions/auth.esm.js +4 -1
- package/dist/apis/definitions/auth.esm.js.map +1 -1
- package/dist/apis/system/ApiRef.esm.js.map +1 -1
- package/dist/apis/system/helpers.esm.js.map +1 -1
- package/dist/apis/system/useApi.esm.js.map +1 -1
- package/dist/app/useApp.esm.js.map +1 -1
- package/dist/extensions/PluginErrorBoundary.esm.js.map +1 -1
- package/dist/extensions/componentData.esm.js.map +1 -1
- package/dist/extensions/extensions.esm.js +1 -1
- package/dist/extensions/extensions.esm.js.map +1 -1
- package/dist/extensions/useElementFilter.esm.js.map +1 -1
- package/dist/index.d.ts +14 -2
- package/dist/index.esm.js +1 -1
- package/dist/plugin/Plugin.esm.js.map +1 -1
- package/dist/routing/ExternalRouteRef.esm.js.map +1 -1
- package/dist/routing/RouteRef.esm.js.map +1 -1
- package/dist/routing/SubRouteRef.esm.js.map +1 -1
- package/dist/routing/types.esm.js.map +1 -1
- package/dist/routing/useRouteRef.esm.js.map +1 -1
- package/dist/routing/useRouteRefParams.esm.js.map +1 -1
- package/dist/translation/TranslationMessages.esm.js.map +1 -1
- package/dist/translation/TranslationRef.esm.js.map +1 -1
- package/dist/translation/TranslationResource.esm.js.map +1 -1
- package/dist/translation/useTranslationRef.esm.js.map +1 -1
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @backstage/core-plugin-api
|
|
2
2
|
|
|
3
|
+
## 1.11.1-next.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
- @backstage/config@1.3.4-next.0
|
|
9
|
+
|
|
10
|
+
## 1.11.0
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- 5114627: Make `openshiftAuthApiRef` available in `@backstage/core-plugin-api`.
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
- @backstage/types@1.2.2
|
|
20
|
+
|
|
3
21
|
## 1.10.9
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/dist/alpha.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TranslationRef as TranslationRef$1, TranslationMessages as TranslationMessages$1 } from '@backstage/core-plugin-api/alpha';
|
|
2
2
|
import { ApiRef } from '@backstage/core-plugin-api';
|
|
3
|
-
import {
|
|
3
|
+
import { Expand, ExpandRecursive, Observable } from '@backstage/types';
|
|
4
4
|
import { JSX } from 'react';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnalyticsContext.esm.js","sources":["../../src/analytics/AnalyticsContext.tsx"],"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 {\n createVersionedContext,\n createVersionedValueMap,\n} from '@backstage/version-bridge';\nimport { ComponentType, ReactNode, useContext } from 'react';\nimport { AnalyticsContextValue } from './types';\n\nconst AnalyticsReactContext = createVersionedContext<{\n 1: AnalyticsContextValue;\n}>('analytics-context');\n\n/**\n * A \"private\" (to this package) hook that enables context inheritance and a\n * way to read Analytics Context values at event capture-time.\n *\n * @internal\n */\nexport const useAnalyticsContext = (): AnalyticsContextValue => {\n const theContext = useContext(AnalyticsReactContext);\n\n // Provide a default value if no value exists.\n if (theContext === undefined) {\n return {\n routeRef: 'unknown',\n pluginId: 'root',\n extension: 'App',\n };\n }\n\n // This should probably never happen, but check for it.\n const theValue = theContext.atVersion(1);\n if (theValue === undefined) {\n throw new Error('No context found for version 1.');\n }\n\n return theValue;\n};\n\n/**\n * Provides components in the child react tree an Analytics Context, ensuring\n * all analytics events captured within the context have relevant attributes.\n *\n * @remarks\n *\n * Analytics contexts are additive, meaning the context ultimately emitted with\n * an event is the combination of all contexts in the parent tree.\n *\n * @public\n */\nexport const AnalyticsContext = (options: {\n attributes: Partial<AnalyticsContextValue>;\n children: ReactNode;\n}) => {\n const { attributes, children } = options;\n\n const parentValues = useAnalyticsContext();\n const combinedValue = {\n ...parentValues,\n ...attributes,\n };\n\n const versionedCombinedValue = createVersionedValueMap({ 1: combinedValue });\n return (\n <AnalyticsReactContext.Provider value={versionedCombinedValue}>\n {children}\n </AnalyticsReactContext.Provider>\n );\n};\n\n/**\n * Returns an HOC wrapping the provided component in an Analytics context with\n * the given values.\n *\n * @param Component - Component to be wrapped with analytics context attributes\n * @param values - Analytics context key/value pairs.\n * @internal\n */\nexport function withAnalyticsContext<TProps extends {}>(\n Component: ComponentType<TProps>,\n values: AnalyticsContextValue,\n) {\n const ComponentWithAnalyticsContext = (props: TProps) => {\n return (\n <AnalyticsContext attributes={values}>\n <Component {...props} />\n </AnalyticsContext>\n );\n };\n ComponentWithAnalyticsContext.displayName = `WithAnalyticsContext(${\n Component.displayName || Component.name || 'Component'\n })`;\n return ComponentWithAnalyticsContext;\n}\n"],"names":[],"mappings":";;;;AAuBA,MAAM,qBAAA,GAAwB,uBAE3B,mBAAmB,CAAA;AAQf,MAAM,sBAAsB,MAA6B;AAC9D,
|
|
1
|
+
{"version":3,"file":"AnalyticsContext.esm.js","sources":["../../src/analytics/AnalyticsContext.tsx"],"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 {\n createVersionedContext,\n createVersionedValueMap,\n} from '@backstage/version-bridge';\nimport { ComponentType, ReactNode, useContext } from 'react';\nimport { AnalyticsContextValue } from './types';\n\nconst AnalyticsReactContext = createVersionedContext<{\n 1: AnalyticsContextValue;\n}>('analytics-context');\n\n/**\n * A \"private\" (to this package) hook that enables context inheritance and a\n * way to read Analytics Context values at event capture-time.\n *\n * @internal\n */\nexport const useAnalyticsContext = (): AnalyticsContextValue => {\n const theContext = useContext(AnalyticsReactContext);\n\n // Provide a default value if no value exists.\n if (theContext === undefined) {\n return {\n routeRef: 'unknown',\n pluginId: 'root',\n extension: 'App',\n };\n }\n\n // This should probably never happen, but check for it.\n const theValue = theContext.atVersion(1);\n if (theValue === undefined) {\n throw new Error('No context found for version 1.');\n }\n\n return theValue;\n};\n\n/**\n * Provides components in the child react tree an Analytics Context, ensuring\n * all analytics events captured within the context have relevant attributes.\n *\n * @remarks\n *\n * Analytics contexts are additive, meaning the context ultimately emitted with\n * an event is the combination of all contexts in the parent tree.\n *\n * @public\n */\nexport const AnalyticsContext = (options: {\n attributes: Partial<AnalyticsContextValue>;\n children: ReactNode;\n}) => {\n const { attributes, children } = options;\n\n const parentValues = useAnalyticsContext();\n const combinedValue = {\n ...parentValues,\n ...attributes,\n };\n\n const versionedCombinedValue = createVersionedValueMap({ 1: combinedValue });\n return (\n <AnalyticsReactContext.Provider value={versionedCombinedValue}>\n {children}\n </AnalyticsReactContext.Provider>\n );\n};\n\n/**\n * Returns an HOC wrapping the provided component in an Analytics context with\n * the given values.\n *\n * @param Component - Component to be wrapped with analytics context attributes\n * @param values - Analytics context key/value pairs.\n * @internal\n */\nexport function withAnalyticsContext<TProps extends {}>(\n Component: ComponentType<TProps>,\n values: AnalyticsContextValue,\n) {\n const ComponentWithAnalyticsContext = (props: TProps) => {\n return (\n <AnalyticsContext attributes={values}>\n <Component {...props} />\n </AnalyticsContext>\n );\n };\n ComponentWithAnalyticsContext.displayName = `WithAnalyticsContext(${\n Component.displayName || Component.name || 'Component'\n })`;\n return ComponentWithAnalyticsContext;\n}\n"],"names":[],"mappings":";;;;AAuBA,MAAM,qBAAA,GAAwB,uBAE3B,mBAAmB,CAAA;AAQf,MAAM,sBAAsB,MAA6B;AAC9D,EAAA,MAAM,UAAA,GAAa,WAAW,qBAAqB,CAAA;AAGnD,EAAA,IAAI,eAAe,MAAA,EAAW;AAC5B,IAAA,OAAO;AAAA,MACL,QAAA,EAAU,SAAA;AAAA,MACV,QAAA,EAAU,MAAA;AAAA,MACV,SAAA,EAAW;AAAA,KACb;AAAA,EACF;AAGA,EAAA,MAAM,QAAA,GAAW,UAAA,CAAW,SAAA,CAAU,CAAC,CAAA;AACvC,EAAA,IAAI,aAAa,MAAA,EAAW;AAC1B,IAAA,MAAM,IAAI,MAAM,iCAAiC,CAAA;AAAA,EACnD;AAEA,EAAA,OAAO,QAAA;AACT;AAaO,MAAM,gBAAA,GAAmB,CAAC,OAAA,KAG3B;AACJ,EAAA,MAAM,EAAE,UAAA,EAAY,QAAA,EAAS,GAAI,OAAA;AAEjC,EAAA,MAAM,eAAe,mBAAA,EAAoB;AACzC,EAAA,MAAM,aAAA,GAAgB;AAAA,IACpB,GAAG,YAAA;AAAA,IACH,GAAG;AAAA,GACL;AAEA,EAAA,MAAM,sBAAA,GAAyB,uBAAA,CAAwB,EAAE,CAAA,EAAG,eAAe,CAAA;AAC3E,EAAA,2BACG,qBAAA,CAAsB,QAAA,EAAtB,EAA+B,KAAA,EAAO,wBACpC,QAAA,EACH,CAAA;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tracker.esm.js","sources":["../../src/analytics/Tracker.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 { getOrCreateGlobalSingleton } from '@backstage/version-bridge';\nimport {\n AnalyticsApi,\n AnalyticsEventAttributes,\n AnalyticsTracker,\n} from '../apis';\nimport { AnalyticsContextValue } from './types';\n\ntype TempGlobalEvents = {\n /**\n * Stores the most recent \"gathered\" mountpoint navigation.\n */\n mostRecentGatheredNavigation?: {\n action: string;\n subject: string;\n value?: number;\n attributes?: AnalyticsEventAttributes;\n context: AnalyticsContextValue;\n };\n /**\n * Stores the most recent routable extension render.\n */\n mostRecentRoutableExtensionRender?: {\n context: AnalyticsContextValue;\n };\n /**\n * Tracks whether or not a beforeunload event listener has already been\n * registered.\n */\n beforeUnloadRegistered: boolean;\n};\n\n/**\n * Temporary global store for select event data. Used to make `navigate` events\n * more accurate when gathered mountpoints are used.\n */\nconst globalEvents = getOrCreateGlobalSingleton<TempGlobalEvents>(\n 'core-plugin-api:analytics-tracker-events',\n () => ({\n mostRecentGatheredNavigation: undefined,\n mostRecentRoutableExtensionRender: undefined,\n beforeUnloadRegistered: false,\n }),\n);\n\n/**\n * Internal-only event representing when a routable extension is rendered.\n */\nexport const routableExtensionRenderedEvent = '_ROUTABLE-EXTENSION-RENDERED';\n\nexport class Tracker implements AnalyticsTracker {\n constructor(\n private readonly analyticsApi: AnalyticsApi,\n private context: AnalyticsContextValue = {\n routeRef: 'unknown',\n pluginId: 'root',\n extension: 'App',\n },\n ) {\n // Only register a single beforeunload event across all trackers.\n if (!globalEvents.beforeUnloadRegistered) {\n // Before the page unloads, attempt to capture any deferred navigation\n // events that haven't yet been captured.\n addEventListener(\n 'beforeunload',\n () => {\n if (globalEvents.mostRecentGatheredNavigation) {\n this.analyticsApi.captureEvent({\n ...globalEvents.mostRecentGatheredNavigation,\n ...globalEvents.mostRecentRoutableExtensionRender,\n });\n globalEvents.mostRecentGatheredNavigation = undefined;\n globalEvents.mostRecentRoutableExtensionRender = undefined;\n }\n },\n { once: true, passive: true },\n );\n\n // Prevent duplicate handlers from being registered.\n globalEvents.beforeUnloadRegistered = true;\n }\n }\n\n setContext(context: AnalyticsContextValue) {\n this.context = context;\n }\n\n captureEvent(\n action: string,\n subject: string,\n {\n value,\n attributes,\n }: { value?: number; attributes?: AnalyticsEventAttributes } = {},\n ) {\n // Never pass internal \"_routeNodeType\" context value.\n const { _routeNodeType, ...context } = this.context;\n\n // Never fire the special \"_routable-extension-rendered\" internal event.\n if (action === routableExtensionRenderedEvent) {\n // But keep track of it if we're delaying a `navigate` event for a\n // a gathered route node type.\n if (globalEvents.mostRecentGatheredNavigation) {\n globalEvents.mostRecentRoutableExtensionRender = {\n context: {\n ...context,\n extension: 'App',\n },\n };\n }\n return;\n }\n\n // If we are about to fire a real event, and we have an un-fired gathered\n // mountpoint navigation on the global store, we need to fire the navigate\n // event first, so this real event happens accurately after the navigation.\n if (globalEvents.mostRecentGatheredNavigation) {\n try {\n this.analyticsApi.captureEvent({\n ...globalEvents.mostRecentGatheredNavigation,\n ...globalEvents.mostRecentRoutableExtensionRender,\n });\n } catch (e) {\n // eslint-disable-next-line no-console\n console.warn('Error during analytics event capture. %o', e);\n }\n\n // Clear the global stores.\n globalEvents.mostRecentGatheredNavigation = undefined;\n globalEvents.mostRecentRoutableExtensionRender = undefined;\n }\n\n // Never directly fire a navigation event on a gathered route with default\n // contextual details.\n if (\n action === 'navigate' &&\n _routeNodeType === 'gathered' &&\n context.pluginId === 'root'\n ) {\n // Instead, set it on the global store.\n globalEvents.mostRecentGatheredNavigation = {\n action,\n subject,\n value,\n attributes,\n context,\n };\n return;\n }\n\n try {\n this.analyticsApi.captureEvent({\n action,\n subject,\n value,\n attributes,\n context,\n });\n } catch (e) {\n // eslint-disable-next-line no-console\n console.warn('Error during analytics event capture. %o', e);\n }\n }\n}\n"],"names":[],"mappings":";;AAoDA,MAAM,
|
|
1
|
+
{"version":3,"file":"Tracker.esm.js","sources":["../../src/analytics/Tracker.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 { getOrCreateGlobalSingleton } from '@backstage/version-bridge';\nimport {\n AnalyticsApi,\n AnalyticsEventAttributes,\n AnalyticsTracker,\n} from '../apis';\nimport { AnalyticsContextValue } from './types';\n\ntype TempGlobalEvents = {\n /**\n * Stores the most recent \"gathered\" mountpoint navigation.\n */\n mostRecentGatheredNavigation?: {\n action: string;\n subject: string;\n value?: number;\n attributes?: AnalyticsEventAttributes;\n context: AnalyticsContextValue;\n };\n /**\n * Stores the most recent routable extension render.\n */\n mostRecentRoutableExtensionRender?: {\n context: AnalyticsContextValue;\n };\n /**\n * Tracks whether or not a beforeunload event listener has already been\n * registered.\n */\n beforeUnloadRegistered: boolean;\n};\n\n/**\n * Temporary global store for select event data. Used to make `navigate` events\n * more accurate when gathered mountpoints are used.\n */\nconst globalEvents = getOrCreateGlobalSingleton<TempGlobalEvents>(\n 'core-plugin-api:analytics-tracker-events',\n () => ({\n mostRecentGatheredNavigation: undefined,\n mostRecentRoutableExtensionRender: undefined,\n beforeUnloadRegistered: false,\n }),\n);\n\n/**\n * Internal-only event representing when a routable extension is rendered.\n */\nexport const routableExtensionRenderedEvent = '_ROUTABLE-EXTENSION-RENDERED';\n\nexport class Tracker implements AnalyticsTracker {\n constructor(\n private readonly analyticsApi: AnalyticsApi,\n private context: AnalyticsContextValue = {\n routeRef: 'unknown',\n pluginId: 'root',\n extension: 'App',\n },\n ) {\n // Only register a single beforeunload event across all trackers.\n if (!globalEvents.beforeUnloadRegistered) {\n // Before the page unloads, attempt to capture any deferred navigation\n // events that haven't yet been captured.\n addEventListener(\n 'beforeunload',\n () => {\n if (globalEvents.mostRecentGatheredNavigation) {\n this.analyticsApi.captureEvent({\n ...globalEvents.mostRecentGatheredNavigation,\n ...globalEvents.mostRecentRoutableExtensionRender,\n });\n globalEvents.mostRecentGatheredNavigation = undefined;\n globalEvents.mostRecentRoutableExtensionRender = undefined;\n }\n },\n { once: true, passive: true },\n );\n\n // Prevent duplicate handlers from being registered.\n globalEvents.beforeUnloadRegistered = true;\n }\n }\n\n setContext(context: AnalyticsContextValue) {\n this.context = context;\n }\n\n captureEvent(\n action: string,\n subject: string,\n {\n value,\n attributes,\n }: { value?: number; attributes?: AnalyticsEventAttributes } = {},\n ) {\n // Never pass internal \"_routeNodeType\" context value.\n const { _routeNodeType, ...context } = this.context;\n\n // Never fire the special \"_routable-extension-rendered\" internal event.\n if (action === routableExtensionRenderedEvent) {\n // But keep track of it if we're delaying a `navigate` event for a\n // a gathered route node type.\n if (globalEvents.mostRecentGatheredNavigation) {\n globalEvents.mostRecentRoutableExtensionRender = {\n context: {\n ...context,\n extension: 'App',\n },\n };\n }\n return;\n }\n\n // If we are about to fire a real event, and we have an un-fired gathered\n // mountpoint navigation on the global store, we need to fire the navigate\n // event first, so this real event happens accurately after the navigation.\n if (globalEvents.mostRecentGatheredNavigation) {\n try {\n this.analyticsApi.captureEvent({\n ...globalEvents.mostRecentGatheredNavigation,\n ...globalEvents.mostRecentRoutableExtensionRender,\n });\n } catch (e) {\n // eslint-disable-next-line no-console\n console.warn('Error during analytics event capture. %o', e);\n }\n\n // Clear the global stores.\n globalEvents.mostRecentGatheredNavigation = undefined;\n globalEvents.mostRecentRoutableExtensionRender = undefined;\n }\n\n // Never directly fire a navigation event on a gathered route with default\n // contextual details.\n if (\n action === 'navigate' &&\n _routeNodeType === 'gathered' &&\n context.pluginId === 'root'\n ) {\n // Instead, set it on the global store.\n globalEvents.mostRecentGatheredNavigation = {\n action,\n subject,\n value,\n attributes,\n context,\n };\n return;\n }\n\n try {\n this.analyticsApi.captureEvent({\n action,\n subject,\n value,\n attributes,\n context,\n });\n } catch (e) {\n // eslint-disable-next-line no-console\n console.warn('Error during analytics event capture. %o', e);\n }\n }\n}\n"],"names":[],"mappings":";;AAoDA,MAAM,YAAA,GAAe,0BAAA;AAAA,EACnB,0CAAA;AAAA,EACA,OAAO;AAAA,IACL,4BAAA,EAA8B,MAAA;AAAA,IAC9B,iCAAA,EAAmC,MAAA;AAAA,IACnC,sBAAA,EAAwB;AAAA,GAC1B;AACF,CAAA;AAKO,MAAM,8BAAA,GAAiC;AAEvC,MAAM,OAAA,CAAoC;AAAA,EAC/C,WAAA,CACmB,cACT,OAAA,GAAiC;AAAA,IACvC,QAAA,EAAU,SAAA;AAAA,IACV,QAAA,EAAU,MAAA;AAAA,IACV,SAAA,EAAW;AAAA,GACb,EACA;AANiB,IAAA,IAAA,CAAA,YAAA,GAAA,YAAA;AACT,IAAA,IAAA,CAAA,OAAA,GAAA,OAAA;AAOR,IAAA,IAAI,CAAC,aAAa,sBAAA,EAAwB;AAGxC,MAAA,gBAAA;AAAA,QACE,cAAA;AAAA,QACA,MAAM;AACJ,UAAA,IAAI,aAAa,4BAAA,EAA8B;AAC7C,YAAA,IAAA,CAAK,aAAa,YAAA,CAAa;AAAA,cAC7B,GAAG,YAAA,CAAa,4BAAA;AAAA,cAChB,GAAG,YAAA,CAAa;AAAA,aACjB,CAAA;AACD,YAAA,YAAA,CAAa,4BAAA,GAA+B,MAAA;AAC5C,YAAA,YAAA,CAAa,iCAAA,GAAoC,MAAA;AAAA,UACnD;AAAA,QACF,CAAA;AAAA,QACA,EAAE,IAAA,EAAM,IAAA,EAAM,OAAA,EAAS,IAAA;AAAK,OAC9B;AAGA,MAAA,YAAA,CAAa,sBAAA,GAAyB,IAAA;AAAA,IACxC;AAAA,EACF;AAAA,EAEA,WAAW,OAAA,EAAgC;AACzC,IAAA,IAAA,CAAK,OAAA,GAAU,OAAA;AAAA,EACjB;AAAA,EAEA,YAAA,CACE,QACA,OAAA,EACA;AAAA,IACE,KAAA;AAAA,IACA;AAAA,GACF,GAA+D,EAAC,EAChE;AAEA,IAAA,MAAM,EAAE,cAAA,EAAgB,GAAG,OAAA,KAAY,IAAA,CAAK,OAAA;AAG5C,IAAA,IAAI,WAAW,8BAAA,EAAgC;AAG7C,MAAA,IAAI,aAAa,4BAAA,EAA8B;AAC7C,QAAA,YAAA,CAAa,iCAAA,GAAoC;AAAA,UAC/C,OAAA,EAAS;AAAA,YACP,GAAG,OAAA;AAAA,YACH,SAAA,EAAW;AAAA;AACb,SACF;AAAA,MACF;AACA,MAAA;AAAA,IACF;AAKA,IAAA,IAAI,aAAa,4BAAA,EAA8B;AAC7C,MAAA,IAAI;AACF,QAAA,IAAA,CAAK,aAAa,YAAA,CAAa;AAAA,UAC7B,GAAG,YAAA,CAAa,4BAAA;AAAA,UAChB,GAAG,YAAA,CAAa;AAAA,SACjB,CAAA;AAAA,MACH,SAAS,CAAA,EAAG;AAEV,QAAA,OAAA,CAAQ,IAAA,CAAK,4CAA4C,CAAC,CAAA;AAAA,MAC5D;AAGA,MAAA,YAAA,CAAa,4BAAA,GAA+B,MAAA;AAC5C,MAAA,YAAA,CAAa,iCAAA,GAAoC,MAAA;AAAA,IACnD;AAIA,IAAA,IACE,WAAW,UAAA,IACX,cAAA,KAAmB,UAAA,IACnB,OAAA,CAAQ,aAAa,MAAA,EACrB;AAEA,MAAA,YAAA,CAAa,4BAAA,GAA+B;AAAA,QAC1C,MAAA;AAAA,QACA,OAAA;AAAA,QACA,KAAA;AAAA,QACA,UAAA;AAAA,QACA;AAAA,OACF;AACA,MAAA;AAAA,IACF;AAEA,IAAA,IAAI;AACF,MAAA,IAAA,CAAK,aAAa,YAAA,CAAa;AAAA,QAC7B,MAAA;AAAA,QACA,OAAA;AAAA,QACA,KAAA;AAAA,QACA,UAAA;AAAA,QACA;AAAA,OACD,CAAA;AAAA,IACH,SAAS,CAAA,EAAG;AAEV,MAAA,OAAA,CAAQ,IAAA,CAAK,4CAA4C,CAAC,CAAA;AAAA,IAC5D;AAAA,EACF;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAnalytics.esm.js","sources":["../../src/analytics/useAnalytics.tsx"],"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 { useAnalyticsContext } from './AnalyticsContext';\nimport {\n analyticsApiRef,\n AnalyticsTracker,\n AnalyticsApi,\n useApi,\n} from '../apis';\nimport { useRef } from 'react';\nimport { Tracker } from './Tracker';\n\nfunction useAnalyticsApi(): AnalyticsApi {\n try {\n return useApi(analyticsApiRef);\n } catch {\n return { captureEvent: () => {} };\n }\n}\n\n/**\n * Gets a pre-configured analytics tracker.\n *\n * @public\n */\nexport function useAnalytics(): AnalyticsTracker {\n const trackerRef = useRef<Tracker | null>(null);\n const context = useAnalyticsContext();\n // Our goal is to make this API truly optional for any/all consuming code\n // (including tests). This hook runs last to ensure hook order is, as much as\n // possible, maintained.\n const analyticsApi = useAnalyticsApi();\n\n function getTracker(): Tracker {\n if (trackerRef.current === null) {\n trackerRef.current = new Tracker(analyticsApi);\n }\n return trackerRef.current;\n }\n\n const tracker = getTracker();\n // this is not ideal, but it allows to memoize the tracker\n // without explicitly set the context as dependency.\n tracker.setContext(context);\n\n return tracker;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AA0BA,SAAS,
|
|
1
|
+
{"version":3,"file":"useAnalytics.esm.js","sources":["../../src/analytics/useAnalytics.tsx"],"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 { useAnalyticsContext } from './AnalyticsContext';\nimport {\n analyticsApiRef,\n AnalyticsTracker,\n AnalyticsApi,\n useApi,\n} from '../apis';\nimport { useRef } from 'react';\nimport { Tracker } from './Tracker';\n\nfunction useAnalyticsApi(): AnalyticsApi {\n try {\n return useApi(analyticsApiRef);\n } catch {\n return { captureEvent: () => {} };\n }\n}\n\n/**\n * Gets a pre-configured analytics tracker.\n *\n * @public\n */\nexport function useAnalytics(): AnalyticsTracker {\n const trackerRef = useRef<Tracker | null>(null);\n const context = useAnalyticsContext();\n // Our goal is to make this API truly optional for any/all consuming code\n // (including tests). This hook runs last to ensure hook order is, as much as\n // possible, maintained.\n const analyticsApi = useAnalyticsApi();\n\n function getTracker(): Tracker {\n if (trackerRef.current === null) {\n trackerRef.current = new Tracker(analyticsApi);\n }\n return trackerRef.current;\n }\n\n const tracker = getTracker();\n // this is not ideal, but it allows to memoize the tracker\n // without explicitly set the context as dependency.\n tracker.setContext(context);\n\n return tracker;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AA0BA,SAAS,eAAA,GAAgC;AACvC,EAAA,IAAI;AACF,IAAA,OAAO,OAAO,eAAe,CAAA;AAAA,EAC/B,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,EAAE,cAAc,MAAM;AAAA,IAAC,CAAA,EAAE;AAAA,EAClC;AACF;AAOO,SAAS,YAAA,GAAiC;AAC/C,EAAA,MAAM,UAAA,GAAa,OAAuB,IAAI,CAAA;AAC9C,EAAA,MAAM,UAAU,mBAAA,EAAoB;AAIpC,EAAA,MAAM,eAAe,eAAA,EAAgB;AAErC,EAAA,SAAS,UAAA,GAAsB;AAC7B,IAAA,IAAI,UAAA,CAAW,YAAY,IAAA,EAAM;AAC/B,MAAA,UAAA,CAAW,OAAA,GAAU,IAAI,OAAA,CAAQ,YAAY,CAAA;AAAA,IAC/C;AACA,IAAA,OAAO,UAAA,CAAW,OAAA;AAAA,EACpB;AAEA,EAAA,MAAM,UAAU,UAAA,EAAW;AAG3B,EAAA,OAAA,CAAQ,WAAW,OAAO,CAAA;AAE1B,EAAA,OAAO,OAAA;AACT;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AlertApi.esm.js","sources":["../../../src/apis/definitions/AlertApi.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, ApiRef } from '../system';\nimport { Observable } from '@backstage/types';\n\n/**\n * Message handled by the {@link AlertApi}.\n *\n * @public\n */\nexport type AlertMessage = {\n message: string;\n // Severity will default to success since that is what material ui defaults the value to.\n severity?: 'success' | 'info' | 'warning' | 'error';\n display?: 'permanent' | 'transient';\n};\n\n/**\n * The alert API is used to report alerts to the app, and display them to the user.\n *\n * @public\n */\nexport type AlertApi = {\n /**\n * Post an alert for handling by the application.\n */\n post(alert: AlertMessage): void;\n\n /**\n * Observe alerts posted by other parts of the application.\n */\n alert$(): Observable<AlertMessage>;\n};\n\n/**\n * The {@link ApiRef} of {@link AlertApi}.\n *\n * @public\n */\nexport const alertApiRef: ApiRef<AlertApi> = createApiRef({\n id: 'core.alert',\n});\n"],"names":[],"mappings":";;;;;AAqDO,MAAM,cAAgC,
|
|
1
|
+
{"version":3,"file":"AlertApi.esm.js","sources":["../../../src/apis/definitions/AlertApi.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, ApiRef } from '../system';\nimport { Observable } from '@backstage/types';\n\n/**\n * Message handled by the {@link AlertApi}.\n *\n * @public\n */\nexport type AlertMessage = {\n message: string;\n // Severity will default to success since that is what material ui defaults the value to.\n severity?: 'success' | 'info' | 'warning' | 'error';\n display?: 'permanent' | 'transient';\n};\n\n/**\n * The alert API is used to report alerts to the app, and display them to the user.\n *\n * @public\n */\nexport type AlertApi = {\n /**\n * Post an alert for handling by the application.\n */\n post(alert: AlertMessage): void;\n\n /**\n * Observe alerts posted by other parts of the application.\n */\n alert$(): Observable<AlertMessage>;\n};\n\n/**\n * The {@link ApiRef} of {@link AlertApi}.\n *\n * @public\n */\nexport const alertApiRef: ApiRef<AlertApi> = createApiRef({\n id: 'core.alert',\n});\n"],"names":[],"mappings":";;;;;AAqDO,MAAM,cAAgC,YAAA,CAAa;AAAA,EACxD,EAAA,EAAI;AACN,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnalyticsApi.esm.js","sources":["../../../src/apis/definitions/AnalyticsApi.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 { ApiRef, createApiRef } from '../system';\nimport { AnalyticsContextValue } from '../../analytics/types';\n\n/**\n * Represents an event worth tracking in an analytics system that could inform\n * how users of a Backstage instance are using its features.\n *\n * @public\n */\nexport type AnalyticsEvent = {\n /**\n * A string that identifies the event being tracked by the type of action the\n * event represents. Be careful not to encode extra metadata in this string\n * that should instead be placed in the Analytics Context or attributes.\n * Examples include:\n *\n * - view\n * - click\n * - filter\n * - search\n * - hover\n * - scroll\n */\n action: string;\n\n /**\n * A string that uniquely identifies the object that the action is being\n * taken on. Examples include:\n *\n * - The path of the page viewed\n * - The url of the link clicked\n * - The value that was filtered by\n * - The text that was searched for\n */\n subject: string;\n\n /**\n * An optional numeric value relevant to the event that could be aggregated\n * by analytics tools. Examples include:\n *\n * - The index or position of the clicked element in an ordered list\n * - The percentage of an element that has been scrolled through\n * - The amount of time that has elapsed since a fixed point\n * - A satisfaction score on a fixed scale\n */\n value?: number;\n\n /**\n * Optional, additional attributes (representing dimensions or metrics)\n * specific to the event that could be forwarded on to analytics systems.\n */\n attributes?: AnalyticsEventAttributes;\n\n /**\n * Contextual metadata relating to where the event was captured and by whom.\n * This could include information about the route, plugin, or extension in\n * which an event was captured.\n */\n context: AnalyticsContextValue;\n};\n\n/**\n * A structure allowing other arbitrary metadata to be provided by analytics\n * event emitters.\n *\n * @public\n */\nexport type AnalyticsEventAttributes = {\n [attribute in string]: string | boolean | number;\n};\n\n/**\n * Represents a tracker with methods that can be called to track events in a\n * configured analytics service.\n *\n * @public\n */\nexport type AnalyticsTracker = {\n captureEvent: (\n action: string,\n subject: string,\n options?: {\n value?: number;\n attributes?: AnalyticsEventAttributes;\n },\n ) => void;\n};\n\n/**\n * The Analytics API is used to track user behavior in a Backstage instance.\n *\n * @remarks\n *\n * To instrument your App or Plugin, retrieve an analytics tracker using the\n * useAnalytics() hook. This will return a pre-configured AnalyticsTracker\n * with relevant methods for instrumentation.\n *\n * @public\n */\nexport type AnalyticsApi = {\n /**\n * Primary event handler responsible for compiling and forwarding events to\n * an analytics system.\n */\n captureEvent(event: AnalyticsEvent): void;\n};\n\n/**\n * The {@link ApiRef} of {@link AnalyticsApi}.\n *\n * @public\n */\nexport const analyticsApiRef: ApiRef<AnalyticsApi> = createApiRef({\n id: 'core.analytics',\n});\n"],"names":[],"mappings":";;;;;AAgIO,MAAM,kBAAwC,
|
|
1
|
+
{"version":3,"file":"AnalyticsApi.esm.js","sources":["../../../src/apis/definitions/AnalyticsApi.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 { ApiRef, createApiRef } from '../system';\nimport { AnalyticsContextValue } from '../../analytics/types';\n\n/**\n * Represents an event worth tracking in an analytics system that could inform\n * how users of a Backstage instance are using its features.\n *\n * @public\n */\nexport type AnalyticsEvent = {\n /**\n * A string that identifies the event being tracked by the type of action the\n * event represents. Be careful not to encode extra metadata in this string\n * that should instead be placed in the Analytics Context or attributes.\n * Examples include:\n *\n * - view\n * - click\n * - filter\n * - search\n * - hover\n * - scroll\n */\n action: string;\n\n /**\n * A string that uniquely identifies the object that the action is being\n * taken on. Examples include:\n *\n * - The path of the page viewed\n * - The url of the link clicked\n * - The value that was filtered by\n * - The text that was searched for\n */\n subject: string;\n\n /**\n * An optional numeric value relevant to the event that could be aggregated\n * by analytics tools. Examples include:\n *\n * - The index or position of the clicked element in an ordered list\n * - The percentage of an element that has been scrolled through\n * - The amount of time that has elapsed since a fixed point\n * - A satisfaction score on a fixed scale\n */\n value?: number;\n\n /**\n * Optional, additional attributes (representing dimensions or metrics)\n * specific to the event that could be forwarded on to analytics systems.\n */\n attributes?: AnalyticsEventAttributes;\n\n /**\n * Contextual metadata relating to where the event was captured and by whom.\n * This could include information about the route, plugin, or extension in\n * which an event was captured.\n */\n context: AnalyticsContextValue;\n};\n\n/**\n * A structure allowing other arbitrary metadata to be provided by analytics\n * event emitters.\n *\n * @public\n */\nexport type AnalyticsEventAttributes = {\n [attribute in string]: string | boolean | number;\n};\n\n/**\n * Represents a tracker with methods that can be called to track events in a\n * configured analytics service.\n *\n * @public\n */\nexport type AnalyticsTracker = {\n captureEvent: (\n action: string,\n subject: string,\n options?: {\n value?: number;\n attributes?: AnalyticsEventAttributes;\n },\n ) => void;\n};\n\n/**\n * The Analytics API is used to track user behavior in a Backstage instance.\n *\n * @remarks\n *\n * To instrument your App or Plugin, retrieve an analytics tracker using the\n * useAnalytics() hook. This will return a pre-configured AnalyticsTracker\n * with relevant methods for instrumentation.\n *\n * @public\n */\nexport type AnalyticsApi = {\n /**\n * Primary event handler responsible for compiling and forwarding events to\n * an analytics system.\n */\n captureEvent(event: AnalyticsEvent): void;\n};\n\n/**\n * The {@link ApiRef} of {@link AnalyticsApi}.\n *\n * @public\n */\nexport const analyticsApiRef: ApiRef<AnalyticsApi> = createApiRef({\n id: 'core.analytics',\n});\n"],"names":[],"mappings":";;;;;AAgIO,MAAM,kBAAwC,YAAA,CAAa;AAAA,EAChE,EAAA,EAAI;AACN,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppLanguageApi.esm.js","sources":["../../../src/apis/definitions/AppLanguageApi.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 '@backstage/core-plugin-api';\nimport { Observable } from '@backstage/types';\n\n/** @alpha */\nexport type AppLanguageApi = {\n getAvailableLanguages(): { languages: string[] };\n\n setLanguage(language?: string): void;\n\n getLanguage(): { language: string };\n\n language$(): Observable<{ language: string }>;\n};\n\n/**\n * @alpha\n */\nexport const appLanguageApiRef: ApiRef<AppLanguageApi> = createApiRef({\n id: 'core.applanguage',\n});\n"],"names":[],"mappings":";;AAiCO,MAAM,oBAA4C,
|
|
1
|
+
{"version":3,"file":"AppLanguageApi.esm.js","sources":["../../../src/apis/definitions/AppLanguageApi.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 '@backstage/core-plugin-api';\nimport { Observable } from '@backstage/types';\n\n/** @alpha */\nexport type AppLanguageApi = {\n getAvailableLanguages(): { languages: string[] };\n\n setLanguage(language?: string): void;\n\n getLanguage(): { language: string };\n\n language$(): Observable<{ language: string }>;\n};\n\n/**\n * @alpha\n */\nexport const appLanguageApiRef: ApiRef<AppLanguageApi> = createApiRef({\n id: 'core.applanguage',\n});\n"],"names":[],"mappings":";;AAiCO,MAAM,oBAA4C,YAAA,CAAa;AAAA,EACpE,EAAA,EAAI;AACN,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppThemeApi.esm.js","sources":["../../../src/apis/definitions/AppThemeApi.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 { ReactNode } from 'react';\nimport { ApiRef, createApiRef } from '../system';\nimport { Observable } from '@backstage/types';\n\n/**\n * Describes a theme provided by the app.\n *\n * @public\n */\nexport type AppTheme = {\n /**\n * ID used to remember theme selections.\n */\n id: string;\n\n /**\n * Title of the theme\n */\n title: string;\n\n /**\n * Theme variant\n */\n variant: 'light' | 'dark';\n\n /**\n * An Icon for the theme mode setting.\n */\n icon?: React.ReactElement;\n\n Provider(props: { children: ReactNode }): JSX.Element | null;\n};\n\n/**\n * The AppThemeApi gives access to the current app theme, and allows switching\n * to other options that have been registered as a part of the App.\n *\n * @public\n */\nexport type AppThemeApi = {\n /**\n * Get a list of available themes.\n */\n getInstalledThemes(): AppTheme[];\n\n /**\n * Observe the currently selected theme. A value of undefined means no specific theme has been selected.\n */\n activeThemeId$(): Observable<string | undefined>;\n\n /**\n * Get the current theme ID. Returns undefined if no specific theme is selected.\n */\n getActiveThemeId(): string | undefined;\n\n /**\n * Set a specific theme to use in the app, overriding the default theme selection.\n *\n * Clear the selection by passing in undefined.\n */\n setActiveThemeId(themeId?: string): void;\n};\n\n/**\n * The {@link ApiRef} of {@link AppThemeApi}.\n *\n * @public\n */\nexport const appThemeApiRef: ApiRef<AppThemeApi> = createApiRef({\n id: 'core.apptheme',\n});\n"],"names":[],"mappings":";;;;;AAoFO,MAAM,iBAAsC,
|
|
1
|
+
{"version":3,"file":"AppThemeApi.esm.js","sources":["../../../src/apis/definitions/AppThemeApi.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 { ReactNode } from 'react';\nimport { ApiRef, createApiRef } from '../system';\nimport { Observable } from '@backstage/types';\n\n/**\n * Describes a theme provided by the app.\n *\n * @public\n */\nexport type AppTheme = {\n /**\n * ID used to remember theme selections.\n */\n id: string;\n\n /**\n * Title of the theme\n */\n title: string;\n\n /**\n * Theme variant\n */\n variant: 'light' | 'dark';\n\n /**\n * An Icon for the theme mode setting.\n */\n icon?: React.ReactElement;\n\n Provider(props: { children: ReactNode }): JSX.Element | null;\n};\n\n/**\n * The AppThemeApi gives access to the current app theme, and allows switching\n * to other options that have been registered as a part of the App.\n *\n * @public\n */\nexport type AppThemeApi = {\n /**\n * Get a list of available themes.\n */\n getInstalledThemes(): AppTheme[];\n\n /**\n * Observe the currently selected theme. A value of undefined means no specific theme has been selected.\n */\n activeThemeId$(): Observable<string | undefined>;\n\n /**\n * Get the current theme ID. Returns undefined if no specific theme is selected.\n */\n getActiveThemeId(): string | undefined;\n\n /**\n * Set a specific theme to use in the app, overriding the default theme selection.\n *\n * Clear the selection by passing in undefined.\n */\n setActiveThemeId(themeId?: string): void;\n};\n\n/**\n * The {@link ApiRef} of {@link AppThemeApi}.\n *\n * @public\n */\nexport const appThemeApiRef: ApiRef<AppThemeApi> = createApiRef({\n id: 'core.apptheme',\n});\n"],"names":[],"mappings":";;;;;AAoFO,MAAM,iBAAsC,YAAA,CAAa;AAAA,EAC9D,EAAA,EAAI;AACN,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigApi.esm.js","sources":["../../../src/apis/definitions/ConfigApi.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 { ApiRef, createApiRef } from '../system';\nimport { Config } from '@backstage/config';\n\n/**\n * The Config API is used to provide a mechanism to access the\n * runtime configuration of the system.\n *\n * @public\n */\nexport type ConfigApi = Config;\n\n/**\n * The {@link ApiRef} of {@link ConfigApi}.\n *\n * @public\n */\nexport const configApiRef: ApiRef<ConfigApi> = createApiRef({\n id: 'core.config',\n});\n"],"names":[],"mappings":";;;;;AA+BO,MAAM,eAAkC,
|
|
1
|
+
{"version":3,"file":"ConfigApi.esm.js","sources":["../../../src/apis/definitions/ConfigApi.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 { ApiRef, createApiRef } from '../system';\nimport { Config } from '@backstage/config';\n\n/**\n * The Config API is used to provide a mechanism to access the\n * runtime configuration of the system.\n *\n * @public\n */\nexport type ConfigApi = Config;\n\n/**\n * The {@link ApiRef} of {@link ConfigApi}.\n *\n * @public\n */\nexport const configApiRef: ApiRef<ConfigApi> = createApiRef({\n id: 'core.config',\n});\n"],"names":[],"mappings":";;;;;AA+BO,MAAM,eAAkC,YAAA,CAAa;AAAA,EAC1D,EAAA,EAAI;AACN,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DiscoveryApi.esm.js","sources":["../../../src/apis/definitions/DiscoveryApi.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 { ApiRef, createApiRef } from '../system';\n\n/**\n * The discovery API is used to provide a mechanism for plugins to\n * discover the endpoint to use to talk to their backend counterpart.\n *\n * @remarks\n *\n * The purpose of the discovery API is to allow for many different deployment\n * setups and routing methods through a central configuration, instead\n * of letting each individual plugin manage that configuration.\n *\n * Implementations of the discovery API can be a simple as a URL pattern\n * using the pluginId, but could also have overrides for individual plugins,\n * or query a separate discovery service.\n *\n * @public\n */\nexport type DiscoveryApi = {\n /**\n * Returns the HTTP base backend URL for a given plugin, without a trailing slash.\n *\n * This method must always be called just before making a request, as opposed to\n * fetching the URL when constructing an API client. That is to ensure that more\n * flexible routing patterns can be supported.\n *\n * For example, asking for the URL for `auth` may return something\n * like `https://backstage.example.com/api/auth`\n */\n getBaseUrl(pluginId: string): Promise<string>;\n};\n\n/**\n * The {@link ApiRef} of {@link DiscoveryApi}.\n *\n * @public\n */\nexport const discoveryApiRef: ApiRef<DiscoveryApi> = createApiRef({\n id: 'core.discovery',\n});\n"],"names":[],"mappings":";;;;;AAoDO,MAAM,kBAAwC,
|
|
1
|
+
{"version":3,"file":"DiscoveryApi.esm.js","sources":["../../../src/apis/definitions/DiscoveryApi.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 { ApiRef, createApiRef } from '../system';\n\n/**\n * The discovery API is used to provide a mechanism for plugins to\n * discover the endpoint to use to talk to their backend counterpart.\n *\n * @remarks\n *\n * The purpose of the discovery API is to allow for many different deployment\n * setups and routing methods through a central configuration, instead\n * of letting each individual plugin manage that configuration.\n *\n * Implementations of the discovery API can be a simple as a URL pattern\n * using the pluginId, but could also have overrides for individual plugins,\n * or query a separate discovery service.\n *\n * @public\n */\nexport type DiscoveryApi = {\n /**\n * Returns the HTTP base backend URL for a given plugin, without a trailing slash.\n *\n * This method must always be called just before making a request, as opposed to\n * fetching the URL when constructing an API client. That is to ensure that more\n * flexible routing patterns can be supported.\n *\n * For example, asking for the URL for `auth` may return something\n * like `https://backstage.example.com/api/auth`\n */\n getBaseUrl(pluginId: string): Promise<string>;\n};\n\n/**\n * The {@link ApiRef} of {@link DiscoveryApi}.\n *\n * @public\n */\nexport const discoveryApiRef: ApiRef<DiscoveryApi> = createApiRef({\n id: 'core.discovery',\n});\n"],"names":[],"mappings":";;;;;AAoDO,MAAM,kBAAwC,YAAA,CAAa;AAAA,EAChE,EAAA,EAAI;AACN,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorApi.esm.js","sources":["../../../src/apis/definitions/ErrorApi.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 { ApiRef, createApiRef } from '../system';\nimport { Observable } from '@backstage/types';\n\n/**\n * Mirrors the JavaScript Error class, for the purpose of\n * providing documentation and optional fields.\n *\n * @public\n */\nexport type ErrorApiError = {\n name: string;\n message: string;\n stack?: string;\n};\n\n/**\n * Provides additional information about an error that was posted to the application.\n *\n * @public\n */\nexport type ErrorApiErrorContext = {\n /**\n * If set to true, this error should not be displayed to the user.\n *\n * Hidden errors are typically not displayed in the UI, but the ErrorApi\n * implementation may still report them to error tracking services\n * or other utilities that care about all errors.\n *\n * @defaultValue false\n */\n hidden?: boolean;\n};\n\n/**\n * The error API is used to report errors to the app, and display them to the user.\n *\n * @remarks\n *\n * Plugins can use this API as a method of displaying errors to the user, but also\n * to report errors for collection by error reporting services.\n *\n * If an error can be displayed inline, e.g. as feedback in a form, that should be\n * preferred over relying on this API to display the error. The main use of this API\n * for displaying errors should be for asynchronous errors, such as a failing background process.\n *\n * Even if an error is displayed inline, it should still be reported through this API\n * if it would be useful to collect or log it for debugging purposes, but with\n * the hidden flag set. For example, an error arising from form field validation\n * should probably not be reported, while a failed REST call would be useful to report.\n *\n * @public\n */\nexport type ErrorApi = {\n /**\n * Post an error for handling by the application.\n */\n post(error: ErrorApiError, context?: ErrorApiErrorContext): void;\n\n /**\n * Observe errors posted by other parts of the application.\n */\n error$(): Observable<{\n error: ErrorApiError;\n context?: ErrorApiErrorContext;\n }>;\n};\n\n/**\n * The {@link ApiRef} of {@link ErrorApi}.\n *\n * @public\n */\nexport const errorApiRef: ApiRef<ErrorApi> = createApiRef({\n id: 'core.error',\n});\n"],"names":[],"mappings":";;;;;AAwFO,MAAM,cAAgC,
|
|
1
|
+
{"version":3,"file":"ErrorApi.esm.js","sources":["../../../src/apis/definitions/ErrorApi.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 { ApiRef, createApiRef } from '../system';\nimport { Observable } from '@backstage/types';\n\n/**\n * Mirrors the JavaScript Error class, for the purpose of\n * providing documentation and optional fields.\n *\n * @public\n */\nexport type ErrorApiError = {\n name: string;\n message: string;\n stack?: string;\n};\n\n/**\n * Provides additional information about an error that was posted to the application.\n *\n * @public\n */\nexport type ErrorApiErrorContext = {\n /**\n * If set to true, this error should not be displayed to the user.\n *\n * Hidden errors are typically not displayed in the UI, but the ErrorApi\n * implementation may still report them to error tracking services\n * or other utilities that care about all errors.\n *\n * @defaultValue false\n */\n hidden?: boolean;\n};\n\n/**\n * The error API is used to report errors to the app, and display them to the user.\n *\n * @remarks\n *\n * Plugins can use this API as a method of displaying errors to the user, but also\n * to report errors for collection by error reporting services.\n *\n * If an error can be displayed inline, e.g. as feedback in a form, that should be\n * preferred over relying on this API to display the error. The main use of this API\n * for displaying errors should be for asynchronous errors, such as a failing background process.\n *\n * Even if an error is displayed inline, it should still be reported through this API\n * if it would be useful to collect or log it for debugging purposes, but with\n * the hidden flag set. For example, an error arising from form field validation\n * should probably not be reported, while a failed REST call would be useful to report.\n *\n * @public\n */\nexport type ErrorApi = {\n /**\n * Post an error for handling by the application.\n */\n post(error: ErrorApiError, context?: ErrorApiErrorContext): void;\n\n /**\n * Observe errors posted by other parts of the application.\n */\n error$(): Observable<{\n error: ErrorApiError;\n context?: ErrorApiErrorContext;\n }>;\n};\n\n/**\n * The {@link ApiRef} of {@link ErrorApi}.\n *\n * @public\n */\nexport const errorApiRef: ApiRef<ErrorApi> = createApiRef({\n id: 'core.error',\n});\n"],"names":[],"mappings":";;;;;AAwFO,MAAM,cAAgC,YAAA,CAAa;AAAA,EACxD,EAAA,EAAI;AACN,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FeatureFlagsApi.esm.js","sources":["../../../src/apis/definitions/FeatureFlagsApi.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 { ApiRef, createApiRef } from '../system';\n\n/**\n * Feature flag descriptor.\n *\n * @public\n */\nexport type FeatureFlag = {\n name: string;\n pluginId: string;\n description?: string;\n};\n\n/**\n * Enum representing the state of a feature flag (inactive/active).\n *\n * @public\n */\nexport enum FeatureFlagState {\n /**\n * Feature flag inactive (disabled).\n */\n None = 0,\n /**\n * Feature flag active (enabled).\n */\n Active = 1,\n}\n\n/**\n * Options to use when saving feature flags.\n *\n * @public\n */\nexport type FeatureFlagsSaveOptions = {\n /**\n * The new feature flag states to save.\n */\n states: Record<string, FeatureFlagState>;\n\n /**\n * Whether the saves states should be merged into the existing ones, or replace them.\n *\n * Defaults to false.\n */\n merge?: boolean;\n};\n\n/**\n * The feature flags API is used to toggle functionality to users across plugins and Backstage.\n *\n * @remarks\n *\n * Plugins can use this API to register feature flags that they have available\n * for users to enable/disable, and this API will centralize the current user's\n * state of which feature flags they would like to enable.\n *\n * This is ideal for Backstage plugins, as well as your own App, to trial incomplete\n * or unstable upcoming features. Although there will be a common interface for users\n * to enable and disable feature flags, this API acts as another way to enable/disable.\n *\n * @public\n */\nexport interface FeatureFlagsApi {\n /**\n * Registers a new feature flag. Once a feature flag has been registered it\n * can be toggled by users, and read back to enable or disable features.\n */\n registerFlag(flag: FeatureFlag): void;\n\n /**\n * Get a list of all registered flags.\n */\n getRegisteredFlags(): FeatureFlag[];\n\n /**\n * Whether the feature flag with the given name is currently activated for the user.\n */\n isActive(name: string): boolean;\n\n /**\n * Save the user's choice of feature flag states.\n */\n save(options: FeatureFlagsSaveOptions): void;\n}\n\n/**\n * The {@link ApiRef} of {@link FeatureFlagsApi}.\n *\n * @public\n */\nexport const featureFlagsApiRef: ApiRef<FeatureFlagsApi> = createApiRef({\n id: 'core.featureflags',\n});\n"],"names":["FeatureFlagState"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"FeatureFlagsApi.esm.js","sources":["../../../src/apis/definitions/FeatureFlagsApi.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 { ApiRef, createApiRef } from '../system';\n\n/**\n * Feature flag descriptor.\n *\n * @public\n */\nexport type FeatureFlag = {\n name: string;\n pluginId: string;\n description?: string;\n};\n\n/**\n * Enum representing the state of a feature flag (inactive/active).\n *\n * @public\n */\nexport enum FeatureFlagState {\n /**\n * Feature flag inactive (disabled).\n */\n None = 0,\n /**\n * Feature flag active (enabled).\n */\n Active = 1,\n}\n\n/**\n * Options to use when saving feature flags.\n *\n * @public\n */\nexport type FeatureFlagsSaveOptions = {\n /**\n * The new feature flag states to save.\n */\n states: Record<string, FeatureFlagState>;\n\n /**\n * Whether the saves states should be merged into the existing ones, or replace them.\n *\n * Defaults to false.\n */\n merge?: boolean;\n};\n\n/**\n * The feature flags API is used to toggle functionality to users across plugins and Backstage.\n *\n * @remarks\n *\n * Plugins can use this API to register feature flags that they have available\n * for users to enable/disable, and this API will centralize the current user's\n * state of which feature flags they would like to enable.\n *\n * This is ideal for Backstage plugins, as well as your own App, to trial incomplete\n * or unstable upcoming features. Although there will be a common interface for users\n * to enable and disable feature flags, this API acts as another way to enable/disable.\n *\n * @public\n */\nexport interface FeatureFlagsApi {\n /**\n * Registers a new feature flag. Once a feature flag has been registered it\n * can be toggled by users, and read back to enable or disable features.\n */\n registerFlag(flag: FeatureFlag): void;\n\n /**\n * Get a list of all registered flags.\n */\n getRegisteredFlags(): FeatureFlag[];\n\n /**\n * Whether the feature flag with the given name is currently activated for the user.\n */\n isActive(name: string): boolean;\n\n /**\n * Save the user's choice of feature flag states.\n */\n save(options: FeatureFlagsSaveOptions): void;\n}\n\n/**\n * The {@link ApiRef} of {@link FeatureFlagsApi}.\n *\n * @public\n */\nexport const featureFlagsApiRef: ApiRef<FeatureFlagsApi> = createApiRef({\n id: 'core.featureflags',\n});\n"],"names":["FeatureFlagState"],"mappings":";;;;;AAkCO,IAAK,gBAAA,qBAAAA,iBAAAA,KAAL;AAIL,EAAAA,iBAAAA,CAAAA,iBAAAA,CAAA,UAAO,CAAA,CAAA,GAAP,MAAA;AAIA,EAAAA,iBAAAA,CAAAA,iBAAAA,CAAA,YAAS,CAAA,CAAA,GAAT,QAAA;AARU,EAAA,OAAAA,iBAAAA;AAAA,CAAA,EAAA,gBAAA,IAAA,EAAA;AAyEL,MAAM,qBAA8C,YAAA,CAAa;AAAA,EACtE,EAAA,EAAI;AACN,CAAC;;;;"}
|
|
@@ -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 { ApiRef, 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: ApiRef<FetchApi> = createApiRef({\n id: 'core.fetch',\n});\n"],"names":[],"mappings":";;;;;AAgDO,MAAM,cAAgC,
|
|
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 { ApiRef, 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: ApiRef<FetchApi> = createApiRef({\n id: 'core.fetch',\n});\n"],"names":[],"mappings":";;;;;AAgDO,MAAM,cAAgC,YAAA,CAAa;AAAA,EACxD,EAAA,EAAI;AACN,CAAC;;;;"}
|
|
@@ -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 { ApiRef, 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: ApiRef<IdentityApi> = createApiRef({\n id: 'core.identity',\n});\n"],"names":[],"mappings":";;;;;AAqDO,MAAM,iBAAsC,
|
|
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 { ApiRef, 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: ApiRef<IdentityApi> = createApiRef({\n id: 'core.identity',\n});\n"],"names":[],"mappings":";;;;;AAqDO,MAAM,iBAAsC,YAAA,CAAa;AAAA,EAC9D,EAAA,EAAI;AACN,CAAC;;;;"}
|
|
@@ -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 { ApiRef, 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: ApiRef<OAuthRequestApi> = createApiRef({\n id: 'core.oauthrequest',\n});\n"],"names":[],"mappings":";;;;;AAgIO,MAAM,qBAA8C,
|
|
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 { ApiRef, 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: ApiRef<OAuthRequestApi> = createApiRef({\n id: 'core.oauthrequest',\n});\n"],"names":[],"mappings":";;;;;AAgIO,MAAM,qBAA8C,YAAA,CAAa;AAAA,EACtE,EAAA,EAAI;AACN,CAAC;;;;"}
|
|
@@ -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 { ApiRef, 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: ApiRef<StorageApi> = createApiRef({\n id: 'core.storage',\n});\n"],"names":[],"mappings":";;;;;AA2GO,MAAM,gBAAoC,
|
|
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 { ApiRef, 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: ApiRef<StorageApi> = createApiRef({\n id: 'core.storage',\n});\n"],"names":[],"mappings":";;;;;AA2GO,MAAM,gBAAoC,YAAA,CAAa;AAAA,EAC5D,EAAA,EAAI;AACN,CAAC;;;;"}
|
|
@@ -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 '@backstage/core-plugin-api';\nimport { Expand, ExpandRecursive, Observable } from '@backstage/types';\nimport { TranslationRef } from '../../translation/TranslationRef';\nimport { JSX } from 'react';\n\n/**\n * Base translation options.\n *\n * @alpha\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/** @alpha */\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/** @alpha */\nexport type TranslationSnapshot<TMessages extends { [key in string]: string }> =\n { ready: false } | { ready: true; t: TranslationFunction<TMessages> };\n\n/** @alpha */\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 * @alpha\n */\nexport const translationApiRef: ApiRef<TranslationApi> = createApiRef({\n id: 'core.translation',\n});\n"],"names":[],"mappings":";;AAwWO,MAAM,oBAA4C,YAAa,CAAA;AAAA,EACpE,EAAI,EAAA;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 { ApiRef, createApiRef } from '@backstage/core-plugin-api';\nimport { Expand, ExpandRecursive, Observable } from '@backstage/types';\nimport { TranslationRef } from '../../translation/TranslationRef';\nimport { JSX } from 'react';\n\n/**\n * Base translation options.\n *\n * @alpha\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/** @alpha */\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/** @alpha */\nexport type TranslationSnapshot<TMessages extends { [key in string]: string }> =\n { ready: false } | { ready: true; t: TranslationFunction<TMessages> };\n\n/** @alpha */\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 * @alpha\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;;;;"}
|
|
@@ -38,6 +38,9 @@ const atlassianAuthApiRef = createApiRef({
|
|
|
38
38
|
const vmwareCloudAuthApiRef = createApiRef({
|
|
39
39
|
id: "core.auth.vmware-cloud"
|
|
40
40
|
});
|
|
41
|
+
const openshiftAuthApiRef = createApiRef({
|
|
42
|
+
id: "core.auth.openshift"
|
|
43
|
+
});
|
|
41
44
|
|
|
42
|
-
export { SessionState, atlassianAuthApiRef, bitbucketAuthApiRef, bitbucketServerAuthApiRef, githubAuthApiRef, gitlabAuthApiRef, googleAuthApiRef, microsoftAuthApiRef, oktaAuthApiRef, oneloginAuthApiRef, vmwareCloudAuthApiRef };
|
|
45
|
+
export { SessionState, atlassianAuthApiRef, bitbucketAuthApiRef, bitbucketServerAuthApiRef, githubAuthApiRef, gitlabAuthApiRef, googleAuthApiRef, microsoftAuthApiRef, oktaAuthApiRef, oneloginAuthApiRef, openshiftAuthApiRef, vmwareCloudAuthApiRef };
|
|
43
46
|
//# sourceMappingURL=auth.esm.js.map
|
|
@@ -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\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 enum SessionState {\n /**\n * User signed in.\n */\n SignedIn = 'SignedIn',\n /**\n * User not signed in.\n */\n SignedOut = '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"],"names":["SessionState"],"mappings":";;;;;AA+QY,IAAA,YAAA,qBAAAA,aAAL,KAAA;AAIL,EAAAA,cAAA,UAAW,CAAA,GAAA,UAAA;AAIX,EAAAA,cAAA,WAAY,CAAA,GAAA,WAAA;AARF,EAAAA,OAAAA,aAAAA;AAAA,CAAA,EAAA,YAAA,IAAA,EAAA;AA4CL,MAAM,mBAMT,YAAa,CAAA;AAAA,EACf,EAAI,EAAA;AACN,CAAC;AAWM,MAAM,mBAET,YAAa,CAAA;AAAA,EACf,EAAI,EAAA;AACN,CAAC;AAWM,MAAM,iBAMT,YAAa,CAAA;AAAA,EACf,EAAI,EAAA;AACN,CAAC;AAWM,MAAM,mBAMT,YAAa,CAAA;AAAA,EACf,EAAI,EAAA;AACN,CAAC;AAYM,MAAM,sBAMT,YAAa,CAAA;AAAA,EACf,EAAI,EAAA;AACN,CAAC;AAOM,MAAM,qBAMT,YAAa,CAAA;AAAA,EACf,EAAI,EAAA;AACN,CAAC;AAWM,MAAM,sBAET,YAAa,CAAA;AAAA,EACf,EAAI,EAAA;AACN,CAAC;AAWM,MAAM,4BAET,YAAa,CAAA;AAAA,EACf,EAAI,EAAA;AACN,CAAC;AAWM,MAAM,sBAET,YAAa,CAAA;AAAA,EACf,EAAI,EAAA;AACN,CAAC;AAWM,MAAM,wBAMT,YAAa,CAAA;AAAA,EACf,EAAI,EAAA;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\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 enum SessionState {\n /**\n * User signed in.\n */\n SignedIn = 'SignedIn',\n /**\n * User not signed in.\n */\n SignedOut = '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":["SessionState"],"mappings":";;;;;AA+QO,IAAK,YAAA,qBAAAA,aAAAA,KAAL;AAIL,EAAAA,cAAA,UAAA,CAAA,GAAW,UAAA;AAIX,EAAAA,cAAA,WAAA,CAAA,GAAY,WAAA;AARF,EAAA,OAAAA,aAAAA;AAAA,CAAA,EAAA,YAAA,IAAA,EAAA;AA4CL,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 +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\nclass ApiRefImpl<T> implements ApiRef<T> {\n constructor(private readonly config: ApiRefConfig) {\n const valid = config.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 '${config.id}'`,\n );\n }\n }\n\n get id(): string {\n return this.config.id;\n }\n\n // Utility for getting type of an api, using `typeof apiRef.T`\n get T(): T {\n throw new Error(`tried to read ApiRef.T of ${this}`);\n }\n\n toString() {\n return `apiRef{${this.config.id}}`;\n }\n}\n\n/**\n * Creates a reference to an API.\n *\n * @param config - The descriptor of the API to reference.\n * @returns An API reference.\n * @public\n */\nexport function createApiRef<T>(config: ApiRefConfig): ApiRef<T> {\n return new ApiRefImpl<T>(config);\n}\n"],"names":[],"mappings":"AA2BA,MAAM,
|
|
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\nclass ApiRefImpl<T> implements ApiRef<T> {\n constructor(private readonly config: ApiRefConfig) {\n const valid = config.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 '${config.id}'`,\n );\n }\n }\n\n get id(): string {\n return this.config.id;\n }\n\n // Utility for getting type of an api, using `typeof apiRef.T`\n get T(): T {\n throw new Error(`tried to read ApiRef.T of ${this}`);\n }\n\n toString() {\n return `apiRef{${this.config.id}}`;\n }\n}\n\n/**\n * Creates a reference to an API.\n *\n * @param config - The descriptor of the API to reference.\n * @returns An API reference.\n * @public\n */\nexport function createApiRef<T>(config: ApiRefConfig): ApiRef<T> {\n return new ApiRefImpl<T>(config);\n}\n"],"names":[],"mappings":"AA2BA,MAAM,UAAA,CAAmC;AAAA,EACvC,YAA6B,MAAA,EAAsB;AAAtB,IAAA,IAAA,CAAA,MAAA,GAAA,MAAA;AAC3B,IAAA,MAAM,QAAQ,MAAA,CAAO,EAAA,CAClB,MAAM,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,IAAA,IAAI,CAAC,KAAA,EAAO;AACV,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,CAAA,sFAAA,EAAyF,OAAO,EAAE,CAAA,CAAA;AAAA,OACpG;AAAA,IACF;AAAA,EACF;AAAA,EAEA,IAAI,EAAA,GAAa;AACf,IAAA,OAAO,KAAK,MAAA,CAAO,EAAA;AAAA,EACrB;AAAA;AAAA,EAGA,IAAI,CAAA,GAAO;AACT,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,0BAAA,EAA6B,IAAI,CAAA,CAAE,CAAA;AAAA,EACrD;AAAA,EAEA,QAAA,GAAW;AACT,IAAA,OAAO,CAAA,OAAA,EAAU,IAAA,CAAK,MAAA,CAAO,EAAE,CAAA,CAAA,CAAA;AAAA,EACjC;AACF;AASO,SAAS,aAAgB,MAAA,EAAiC;AAC/D,EAAA,OAAO,IAAI,WAAc,MAAM,CAAA;AACjC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.esm.js","sources":["../../../src/apis/system/helpers.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 { ApiRef, ApiFactory, TypesToApiRefs } from './types';\n\n/**\n * Used to infer types for a standalone {@link ApiFactory} that isn't immediately passed\n * to another function.\n *\n * @remarks\n *\n * This function doesn't actually do anything, it's only used to infer types.\n *\n * @public\n */\nexport function createApiFactory<\n Api,\n Impl extends Api,\n Deps extends { [name in string]: unknown },\n>(factory: ApiFactory<Api, Impl, Deps>): ApiFactory<Api, Impl, Deps>;\n/**\n * Used to infer types for a standalone {@link ApiFactory} that isn't immediately passed\n * to another function.\n *\n * @param api - Ref of the API that will be produced by the factory.\n * @param instance - Implementation of the API to use.\n * @public\n */\nexport function createApiFactory<Api, Impl extends Api>(\n api: ApiRef<Api>,\n instance: Impl,\n): ApiFactory<Api, Impl, {}>;\n/**\n * Used to infer types for a standalone {@link ApiFactory} that isn't immediately passed\n * to another function.\n *\n * @remarks\n *\n * Creates factory from {@link ApiRef} or returns the factory itself if provided.\n *\n * @param factory - Existing factory or {@link ApiRef}.\n * @param instance - The instance to be returned by the factory.\n * @public\n */\nexport function createApiFactory<\n Api,\n Impl extends Api,\n Deps extends { [name in string]: unknown },\n>(\n factory: ApiFactory<Api, Impl, Deps> | ApiRef<Api>,\n instance?: Impl,\n): ApiFactory<Api, Impl, Deps> {\n if ('id' in factory) {\n return {\n api: factory,\n deps: {} as TypesToApiRefs<Deps>,\n factory: () => instance!,\n };\n }\n return factory;\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"helpers.esm.js","sources":["../../../src/apis/system/helpers.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 { ApiRef, ApiFactory, TypesToApiRefs } from './types';\n\n/**\n * Used to infer types for a standalone {@link ApiFactory} that isn't immediately passed\n * to another function.\n *\n * @remarks\n *\n * This function doesn't actually do anything, it's only used to infer types.\n *\n * @public\n */\nexport function createApiFactory<\n Api,\n Impl extends Api,\n Deps extends { [name in string]: unknown },\n>(factory: ApiFactory<Api, Impl, Deps>): ApiFactory<Api, Impl, Deps>;\n/**\n * Used to infer types for a standalone {@link ApiFactory} that isn't immediately passed\n * to another function.\n *\n * @param api - Ref of the API that will be produced by the factory.\n * @param instance - Implementation of the API to use.\n * @public\n */\nexport function createApiFactory<Api, Impl extends Api>(\n api: ApiRef<Api>,\n instance: Impl,\n): ApiFactory<Api, Impl, {}>;\n/**\n * Used to infer types for a standalone {@link ApiFactory} that isn't immediately passed\n * to another function.\n *\n * @remarks\n *\n * Creates factory from {@link ApiRef} or returns the factory itself if provided.\n *\n * @param factory - Existing factory or {@link ApiRef}.\n * @param instance - The instance to be returned by the factory.\n * @public\n */\nexport function createApiFactory<\n Api,\n Impl extends Api,\n Deps extends { [name in string]: unknown },\n>(\n factory: ApiFactory<Api, Impl, Deps> | ApiRef<Api>,\n instance?: Impl,\n): ApiFactory<Api, Impl, Deps> {\n if ('id' in factory) {\n return {\n api: factory,\n deps: {} as TypesToApiRefs<Deps>,\n factory: () => instance!,\n };\n }\n return factory;\n}\n"],"names":[],"mappings":"AAyDO,SAAS,gBAAA,CAKd,SACA,QAAA,EAC6B;AAC7B,EAAA,IAAI,QAAQ,OAAA,EAAS;AACnB,IAAA,OAAO;AAAA,MACL,GAAA,EAAK,OAAA;AAAA,MACL,MAAM,EAAC;AAAA,MACP,SAAS,MAAM;AAAA,KACjB;AAAA,EACF;AACA,EAAA,OAAO,OAAA;AACT;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useApi.esm.js","sources":["../../../src/apis/system/useApi.tsx"],"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 { ComponentType, PropsWithChildren } from 'react';\nimport { ApiRef, ApiHolder, TypesToApiRefs } from './types';\nimport { useVersionedContext } from '@backstage/version-bridge';\nimport { NotImplementedError } from '@backstage/errors';\n\n/**\n * React hook for retrieving {@link ApiHolder}, an API catalog.\n *\n * @public\n */\nexport function useApiHolder(): ApiHolder {\n const versionedHolder = useVersionedContext<{ 1: ApiHolder }>('api-context');\n if (!versionedHolder) {\n throw new NotImplementedError('API context is not available');\n }\n\n const apiHolder = versionedHolder.atVersion(1);\n if (!apiHolder) {\n throw new NotImplementedError('ApiContext v1 not available');\n }\n return apiHolder;\n}\n\n/**\n * React hook for retrieving APIs.\n *\n * @param apiRef - Reference of the API to use.\n * @public\n */\nexport function useApi<T>(apiRef: ApiRef<T>): T {\n const apiHolder = useApiHolder();\n\n const api = apiHolder.get(apiRef);\n if (!api) {\n throw new NotImplementedError(`No implementation available for ${apiRef}`);\n }\n return api;\n}\n\n/**\n * Wrapper for giving component an API context.\n *\n * @param apis - APIs for the context.\n * @public\n */\nexport function withApis<T extends {}>(apis: TypesToApiRefs<T>) {\n return function withApisWrapper<TProps extends T>(\n WrappedComponent: ComponentType<TProps>,\n ) {\n const Hoc = (props: PropsWithChildren<Omit<TProps, keyof T>>) => {\n const apiHolder = useApiHolder();\n\n const impls = {} as T;\n\n for (const key in apis) {\n if (apis.hasOwnProperty(key)) {\n const ref = apis[key];\n\n const api = apiHolder.get(ref);\n if (!api) {\n throw new NotImplementedError(\n `No implementation available for ${ref}`,\n );\n }\n impls[key] = api;\n }\n }\n\n return <WrappedComponent {...(props as TProps)} {...impls} />;\n };\n const displayName =\n WrappedComponent.displayName || WrappedComponent.name || 'Component';\n\n Hoc.displayName = `withApis(${displayName})`;\n\n return Hoc;\n };\n}\n"],"names":[],"mappings":";;;;AA0BO,SAAS,
|
|
1
|
+
{"version":3,"file":"useApi.esm.js","sources":["../../../src/apis/system/useApi.tsx"],"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 { ComponentType, PropsWithChildren } from 'react';\nimport { ApiRef, ApiHolder, TypesToApiRefs } from './types';\nimport { useVersionedContext } from '@backstage/version-bridge';\nimport { NotImplementedError } from '@backstage/errors';\n\n/**\n * React hook for retrieving {@link ApiHolder}, an API catalog.\n *\n * @public\n */\nexport function useApiHolder(): ApiHolder {\n const versionedHolder = useVersionedContext<{ 1: ApiHolder }>('api-context');\n if (!versionedHolder) {\n throw new NotImplementedError('API context is not available');\n }\n\n const apiHolder = versionedHolder.atVersion(1);\n if (!apiHolder) {\n throw new NotImplementedError('ApiContext v1 not available');\n }\n return apiHolder;\n}\n\n/**\n * React hook for retrieving APIs.\n *\n * @param apiRef - Reference of the API to use.\n * @public\n */\nexport function useApi<T>(apiRef: ApiRef<T>): T {\n const apiHolder = useApiHolder();\n\n const api = apiHolder.get(apiRef);\n if (!api) {\n throw new NotImplementedError(`No implementation available for ${apiRef}`);\n }\n return api;\n}\n\n/**\n * Wrapper for giving component an API context.\n *\n * @param apis - APIs for the context.\n * @public\n */\nexport function withApis<T extends {}>(apis: TypesToApiRefs<T>) {\n return function withApisWrapper<TProps extends T>(\n WrappedComponent: ComponentType<TProps>,\n ) {\n const Hoc = (props: PropsWithChildren<Omit<TProps, keyof T>>) => {\n const apiHolder = useApiHolder();\n\n const impls = {} as T;\n\n for (const key in apis) {\n if (apis.hasOwnProperty(key)) {\n const ref = apis[key];\n\n const api = apiHolder.get(ref);\n if (!api) {\n throw new NotImplementedError(\n `No implementation available for ${ref}`,\n );\n }\n impls[key] = api;\n }\n }\n\n return <WrappedComponent {...(props as TProps)} {...impls} />;\n };\n const displayName =\n WrappedComponent.displayName || WrappedComponent.name || 'Component';\n\n Hoc.displayName = `withApis(${displayName})`;\n\n return Hoc;\n };\n}\n"],"names":[],"mappings":";;;;AA0BO,SAAS,YAAA,GAA0B;AACxC,EAAA,MAAM,eAAA,GAAkB,oBAAsC,aAAa,CAAA;AAC3E,EAAA,IAAI,CAAC,eAAA,EAAiB;AACpB,IAAA,MAAM,IAAI,oBAAoB,8BAA8B,CAAA;AAAA,EAC9D;AAEA,EAAA,MAAM,SAAA,GAAY,eAAA,CAAgB,SAAA,CAAU,CAAC,CAAA;AAC7C,EAAA,IAAI,CAAC,SAAA,EAAW;AACd,IAAA,MAAM,IAAI,oBAAoB,6BAA6B,CAAA;AAAA,EAC7D;AACA,EAAA,OAAO,SAAA;AACT;AAQO,SAAS,OAAU,MAAA,EAAsB;AAC9C,EAAA,MAAM,YAAY,YAAA,EAAa;AAE/B,EAAA,MAAM,GAAA,GAAM,SAAA,CAAU,GAAA,CAAI,MAAM,CAAA;AAChC,EAAA,IAAI,CAAC,GAAA,EAAK;AACR,IAAA,MAAM,IAAI,mBAAA,CAAoB,CAAA,gCAAA,EAAmC,MAAM,CAAA,CAAE,CAAA;AAAA,EAC3E;AACA,EAAA,OAAO,GAAA;AACT;AAQO,SAAS,SAAuB,IAAA,EAAyB;AAC9D,EAAA,OAAO,SAAS,gBACd,gBAAA,EACA;AACA,IAAA,MAAM,GAAA,GAAM,CAAC,KAAA,KAAoD;AAC/D,MAAA,MAAM,YAAY,YAAA,EAAa;AAE/B,MAAA,MAAM,QAAQ,EAAC;AAEf,MAAA,KAAA,MAAW,OAAO,IAAA,EAAM;AACtB,QAAA,IAAI,IAAA,CAAK,cAAA,CAAe,GAAG,CAAA,EAAG;AAC5B,UAAA,MAAM,GAAA,GAAM,KAAK,GAAG,CAAA;AAEpB,UAAA,MAAM,GAAA,GAAM,SAAA,CAAU,GAAA,CAAI,GAAG,CAAA;AAC7B,UAAA,IAAI,CAAC,GAAA,EAAK;AACR,YAAA,MAAM,IAAI,mBAAA;AAAA,cACR,mCAAmC,GAAG,CAAA;AAAA,aACxC;AAAA,UACF;AACA,UAAA,KAAA,CAAM,GAAG,CAAA,GAAI,GAAA;AAAA,QACf;AAAA,MACF;AAEA,MAAA,uBAAO,GAAA,CAAC,gBAAA,EAAA,EAAkB,GAAI,KAAA,EAAmB,GAAG,KAAA,EAAO,CAAA;AAAA,IAC7D,CAAA;AACA,IAAA,MAAM,WAAA,GACJ,gBAAA,CAAiB,WAAA,IAAe,gBAAA,CAAiB,IAAA,IAAQ,WAAA;AAE3D,IAAA,GAAA,CAAI,WAAA,GAAc,YAAY,WAAW,CAAA,CAAA,CAAA;AAEzC,IAAA,OAAO,GAAA;AAAA,EACT,CAAA;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useApp.esm.js","sources":["../../src/app/useApp.tsx"],"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 { useVersionedContext } from '@backstage/version-bridge';\nimport { AppContext as AppContextV1 } from './types';\n\n/**\n * React hook providing {@link AppContext}.\n *\n * @public\n */\nexport const useApp = (): AppContextV1 => {\n const versionedContext = useVersionedContext<{ 1: AppContextV1 }>(\n 'app-context',\n );\n if (!versionedContext) {\n throw new Error('App context is not available');\n }\n\n const appContext = versionedContext.atVersion(1);\n if (!appContext) {\n throw new Error('AppContext v1 not available');\n }\n return appContext;\n};\n"],"names":[],"mappings":";;AAwBO,MAAM,SAAS,MAAoB;AACxC,EAAA,MAAM,
|
|
1
|
+
{"version":3,"file":"useApp.esm.js","sources":["../../src/app/useApp.tsx"],"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 { useVersionedContext } from '@backstage/version-bridge';\nimport { AppContext as AppContextV1 } from './types';\n\n/**\n * React hook providing {@link AppContext}.\n *\n * @public\n */\nexport const useApp = (): AppContextV1 => {\n const versionedContext = useVersionedContext<{ 1: AppContextV1 }>(\n 'app-context',\n );\n if (!versionedContext) {\n throw new Error('App context is not available');\n }\n\n const appContext = versionedContext.atVersion(1);\n if (!appContext) {\n throw new Error('AppContext v1 not available');\n }\n return appContext;\n};\n"],"names":[],"mappings":";;AAwBO,MAAM,SAAS,MAAoB;AACxC,EAAA,MAAM,gBAAA,GAAmB,mBAAA;AAAA,IACvB;AAAA,GACF;AACA,EAAA,IAAI,CAAC,gBAAA,EAAkB;AACrB,IAAA,MAAM,IAAI,MAAM,8BAA8B,CAAA;AAAA,EAChD;AAEA,EAAA,MAAM,UAAA,GAAa,gBAAA,CAAiB,SAAA,CAAU,CAAC,CAAA;AAC/C,EAAA,IAAI,CAAC,UAAA,EAAY;AACf,IAAA,MAAM,IAAI,MAAM,6BAA6B,CAAA;AAAA,EAC/C;AACA,EAAA,OAAO,UAAA;AACT;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PluginErrorBoundary.esm.js","sources":["../../src/extensions/PluginErrorBoundary.tsx"],"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 { PropsWithChildren, Component } from 'react';\nimport { AppContext } from '../app/types';\nimport { BackstagePlugin } from '../plugin';\n\ntype Props = PropsWithChildren<{\n app: AppContext;\n plugin: BackstagePlugin;\n}>;\n\ntype State = { error: Error | undefined };\n\nexport class PluginErrorBoundary extends Component<Props, State> {\n static getDerivedStateFromError(error: Error) {\n return { error };\n }\n\n state: State = { error: undefined };\n\n handleErrorReset = () => {\n this.setState({ error: undefined });\n };\n\n render() {\n const { error } = this.state;\n const { app, plugin } = this.props;\n const { ErrorBoundaryFallback } = app.getComponents();\n\n if (error) {\n return (\n <ErrorBoundaryFallback\n error={error}\n resetError={this.handleErrorReset}\n plugin={plugin}\n />\n );\n }\n\n return this.props.children;\n }\n}\n"],"names":[],"mappings":";;;AA2BO,MAAM,4BAA4B,
|
|
1
|
+
{"version":3,"file":"PluginErrorBoundary.esm.js","sources":["../../src/extensions/PluginErrorBoundary.tsx"],"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 { PropsWithChildren, Component } from 'react';\nimport { AppContext } from '../app/types';\nimport { BackstagePlugin } from '../plugin';\n\ntype Props = PropsWithChildren<{\n app: AppContext;\n plugin: BackstagePlugin;\n}>;\n\ntype State = { error: Error | undefined };\n\nexport class PluginErrorBoundary extends Component<Props, State> {\n static getDerivedStateFromError(error: Error) {\n return { error };\n }\n\n state: State = { error: undefined };\n\n handleErrorReset = () => {\n this.setState({ error: undefined });\n };\n\n render() {\n const { error } = this.state;\n const { app, plugin } = this.props;\n const { ErrorBoundaryFallback } = app.getComponents();\n\n if (error) {\n return (\n <ErrorBoundaryFallback\n error={error}\n resetError={this.handleErrorReset}\n plugin={plugin}\n />\n );\n }\n\n return this.props.children;\n }\n}\n"],"names":[],"mappings":";;;AA2BO,MAAM,4BAA4B,SAAA,CAAwB;AAAA,EAC/D,OAAO,yBAAyB,KAAA,EAAc;AAC5C,IAAA,OAAO,EAAE,KAAA,EAAM;AAAA,EACjB;AAAA,EAEA,KAAA,GAAe,EAAE,KAAA,EAAO,MAAA,EAAU;AAAA,EAElC,mBAAmB,MAAM;AACvB,IAAA,IAAA,CAAK,QAAA,CAAS,EAAE,KAAA,EAAO,MAAA,EAAW,CAAA;AAAA,EACpC,CAAA;AAAA,EAEA,MAAA,GAAS;AACP,IAAA,MAAM,EAAE,KAAA,EAAM,GAAI,IAAA,CAAK,KAAA;AACvB,IAAA,MAAM,EAAE,GAAA,EAAK,MAAA,EAAO,GAAI,IAAA,CAAK,KAAA;AAC7B,IAAA,MAAM,EAAE,qBAAA,EAAsB,GAAI,GAAA,CAAI,aAAA,EAAc;AAEpD,IAAA,IAAI,KAAA,EAAO;AACT,MAAA,uBACE,GAAA;AAAA,QAAC,qBAAA;AAAA,QAAA;AAAA,UACC,KAAA;AAAA,UACA,YAAY,IAAA,CAAK,gBAAA;AAAA,UACjB;AAAA;AAAA,OACF;AAAA,IAEJ;AAEA,IAAA,OAAO,KAAK,KAAA,CAAM,QAAA;AAAA,EACpB;AACF;;;;"}
|