@backstage/plugin-app 0.2.0-next.2 → 0.2.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 +36 -0
- package/dist/alpha/appModulePublicSignIn.esm.js.map +1 -1
- package/dist/apis/DefaultDialogApi.esm.js.map +1 -1
- package/dist/apis/SwappableComponentsApi/DefaultSwappableComponentsApi.esm.js.map +1 -1
- package/dist/defaultApis.esm.js +3 -3
- package/dist/defaultApis.esm.js.map +1 -1
- package/dist/extensions/AnalyticsApi.esm.js.map +1 -1
- package/dist/extensions/App.esm.js +1 -1
- package/dist/extensions/App.esm.js.map +1 -1
- package/dist/extensions/AppLanguageApi.esm.js.map +1 -1
- package/dist/extensions/AppLayout.esm.js +1 -1
- package/dist/extensions/AppLayout.esm.js.map +1 -1
- package/dist/extensions/AppNav.esm.js +1 -1
- package/dist/extensions/AppNav.esm.js.map +1 -1
- package/dist/extensions/AppRoot.esm.js +1 -1
- package/dist/extensions/AppRoot.esm.js.map +1 -1
- package/dist/extensions/AppRoutes.esm.js +1 -1
- package/dist/extensions/AppRoutes.esm.js.map +1 -1
- package/dist/extensions/AppThemeApi.esm.js +1 -1
- package/dist/extensions/AppThemeApi.esm.js.map +1 -1
- package/dist/extensions/DefaultSignInPage.esm.js.map +1 -1
- package/dist/extensions/DialogDisplay.esm.js.map +1 -1
- package/dist/extensions/FeatureFlagsApi.esm.js.map +1 -1
- package/dist/extensions/IconsApi.esm.js +1 -1
- package/dist/extensions/IconsApi.esm.js.map +1 -1
- package/dist/extensions/LegacyComponentsApi.esm.js.map +1 -1
- package/dist/extensions/SwappableComponentsApi.esm.js +1 -1
- package/dist/extensions/SwappableComponentsApi.esm.js.map +1 -1
- package/dist/extensions/TranslationsApi.esm.js +1 -1
- package/dist/extensions/TranslationsApi.esm.js.map +1 -1
- package/dist/extensions/components.esm.js +4 -4
- package/dist/extensions/components.esm.js.map +1 -1
- package/dist/extensions/elements.esm.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/packages/app-defaults/src/defaults/apis.esm.js +2 -2
- package/dist/packages/app-defaults/src/defaults/apis.esm.js.map +1 -1
- package/dist/packages/app-defaults/src/defaults/icons.esm.js.map +1 -1
- package/dist/packages/core-app-api/src/apis/implementations/AlertApi/AlertApiForwarder.esm.js.map +1 -1
- package/dist/packages/core-app-api/src/apis/implementations/AppLanguageApi/AppLanguageSelector.esm.js.map +1 -1
- package/dist/packages/core-app-api/src/apis/implementations/AppThemeApi/AppThemeSelector.esm.js.map +1 -1
- package/dist/packages/core-app-api/src/apis/implementations/DiscoveryApi/UrlPatternDiscovery.esm.js.map +1 -1
- package/dist/packages/core-app-api/src/apis/implementations/ErrorApi/ErrorAlerter.esm.js.map +1 -1
- package/dist/packages/core-app-api/src/apis/implementations/ErrorApi/ErrorApiForwarder.esm.js.map +1 -1
- package/dist/packages/core-app-api/src/apis/implementations/ErrorApi/UnhandledErrorForwarder.esm.js.map +1 -1
- package/dist/packages/core-app-api/src/apis/implementations/FeatureFlagsApi/LocalStorageFeatureFlags.esm.js.map +1 -1
- package/dist/packages/core-app-api/src/apis/implementations/FetchApi/FetchMiddlewares.esm.js.map +1 -1
- package/dist/packages/core-app-api/src/apis/implementations/FetchApi/IdentityAuthInjectorFetchMiddleware.esm.js.map +1 -1
- package/dist/packages/core-app-api/src/apis/implementations/FetchApi/PluginProtocolResolverFetchMiddleware.esm.js.map +1 -1
- package/dist/packages/core-app-api/src/apis/implementations/FetchApi/createFetchApi.esm.js.map +1 -1
- package/dist/packages/core-app-api/src/apis/implementations/OAuthRequestApi/OAuthPendingRequests.esm.js.map +1 -1
- package/dist/packages/core-app-api/src/apis/implementations/OAuthRequestApi/OAuthRequestManager.esm.js.map +1 -1
- package/dist/packages/core-app-api/src/apis/implementations/StorageApi/WebStorage.esm.js.map +1 -1
- package/dist/packages/core-app-api/src/apis/implementations/TranslationApi/I18nextTranslationApi.esm.js.map +1 -1
- package/dist/packages/core-app-api/src/apis/implementations/auth/atlassian/AtlassianAuth.esm.js.map +1 -1
- package/dist/packages/core-app-api/src/apis/implementations/auth/bitbucket/BitbucketAuth.esm.js.map +1 -1
- package/dist/packages/core-app-api/src/apis/implementations/auth/bitbucketServer/BitbucketServerAuth.esm.js.map +1 -1
- package/dist/packages/core-app-api/src/apis/implementations/auth/github/GithubAuth.esm.js.map +1 -1
- package/dist/packages/core-app-api/src/apis/implementations/auth/gitlab/GitlabAuth.esm.js.map +1 -1
- package/dist/packages/core-app-api/src/apis/implementations/auth/google/GoogleAuth.esm.js.map +1 -1
- package/dist/packages/core-app-api/src/apis/implementations/auth/microsoft/MicrosoftAuth.esm.js.map +1 -1
- package/dist/packages/core-app-api/src/apis/implementations/auth/oauth2/OAuth2.esm.js.map +1 -1
- package/dist/packages/core-app-api/src/apis/implementations/auth/okta/OktaAuth.esm.js.map +1 -1
- package/dist/packages/core-app-api/src/apis/implementations/auth/onelogin/OneLoginAuth.esm.js.map +1 -1
- package/dist/packages/core-app-api/src/apis/implementations/auth/saml/types.esm.js.map +1 -1
- package/dist/packages/core-app-api/src/apis/implementations/auth/vmwareCloud/VMwareCloudAuth.esm.js.map +1 -1
- package/dist/packages/core-app-api/src/apis/system/ApiAggregator.esm.js.map +1 -1
- package/dist/packages/core-app-api/src/apis/system/ApiProvider.esm.js.map +1 -1
- package/dist/packages/core-app-api/src/app/AppRouter.esm.js.map +1 -1
- package/dist/packages/core-app-api/src/app/AppThemeProvider.esm.js.map +1 -1
- package/dist/packages/core-app-api/src/app/InternalAppContext.esm.js.map +1 -1
- package/dist/packages/core-app-api/src/app/isProtectedApp.esm.js.map +1 -1
- package/dist/packages/core-app-api/src/app/isReactRouterBeta.esm.js.map +1 -1
- package/dist/packages/core-app-api/src/lib/AuthConnector/DefaultAuthConnector.esm.js.map +1 -1
- package/dist/packages/core-app-api/src/lib/AuthSessionManager/RefreshingAuthSessionManager.esm.js.map +1 -1
- package/dist/packages/core-app-api/src/lib/AuthSessionManager/SessionStateTracker.esm.js.map +1 -1
- package/dist/packages/core-app-api/src/lib/AuthSessionManager/common.esm.js.map +1 -1
- package/dist/packages/core-app-api/src/lib/loginPopup.esm.js.map +1 -1
- package/dist/packages/core-app-api/src/lib/subjects.esm.js.map +1 -1
- package/dist/packages/core-app-api/src/routing/FeatureFlagged.esm.js.map +1 -1
- package/dist/packages/core-app-api/src/routing/FlatRoutes.esm.js.map +1 -1
- package/dist/packages/core-app-api/src/routing/RouteTracker.esm.js.map +1 -1
- package/dist/packages/core-plugin-api/src/translation/TranslationRef.esm.js.map +1 -1
- package/dist/packages/core-plugin-api/src/translation/TranslationResource.esm.js.map +1 -1
- package/dist/packages/frontend-app-api/src/apis/implementations/IconsApi/DefaultIconsApi.esm.js.map +1 -1
- package/dist/packages/frontend-app-api/src/routing/RouteTracker.esm.js.map +1 -1
- package/dist/packages/frontend-app-api/src/routing/getBasePath.esm.js.map +1 -1
- package/dist/packages/frontend-internal/src/wiring/InternalExtensionDefinition.esm.js.map +1 -1
- package/dist/packages/frontend-internal/src/wiring/InternalFrontendPlugin.esm.js.map +1 -1
- package/dist/packages/frontend-internal/src/wiring/InternalSwappableComponentRef.esm.js.map +1 -1
- package/dist/packages/opaque-internal/src/OpaqueType.esm.js.map +1 -1
- package/dist/plugin.esm.js.map +1 -1
- package/dist/plugins/app/package.json.esm.js +1 -1
- package/package.json +14 -14
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconsApi.esm.js","sources":["../../src/extensions/IconsApi.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n createExtensionInput,\n IconBundleBlueprint,\n ApiBlueprint,\n iconsApiRef,\n} from '@backstage/frontend-plugin-api';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { DefaultIconsApi } from '../../../../packages/frontend-app-api/src/apis/implementations/IconsApi';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { icons as defaultIcons } from '../../../../packages/app-defaults/src/defaults';\n\n/**\n * Contains the shareable icons installed into the app.\n */\nexport const IconsApi = ApiBlueprint.makeWithOverrides({\n name: 'icons',\n inputs: {\n icons: createExtensionInput([IconBundleBlueprint.dataRefs.icons], {\n replaces: [{ id: 'app', input: 'icons' }],\n }),\n },\n factory: (originalFactory, { inputs }) => {\n return originalFactory(defineParams =>\n defineParams({\n api: iconsApiRef,\n deps: {},\n factory: () =>\n new DefaultIconsApi(\n inputs.icons\n .map(i => i.get(IconBundleBlueprint.dataRefs.icons))\n .reduce((acc, bundle) => ({ ...acc, ...bundle }), defaultIcons),\n ),\n }),\n );\n },\n});\n"],"names":["defaultIcons"],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"IconsApi.esm.js","sources":["../../src/extensions/IconsApi.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n createExtensionInput,\n IconBundleBlueprint,\n ApiBlueprint,\n iconsApiRef,\n} from '@backstage/frontend-plugin-api';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { DefaultIconsApi } from '../../../../packages/frontend-app-api/src/apis/implementations/IconsApi';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { icons as defaultIcons } from '../../../../packages/app-defaults/src/defaults';\n\n/**\n * Contains the shareable icons installed into the app.\n */\nexport const IconsApi = ApiBlueprint.makeWithOverrides({\n name: 'icons',\n inputs: {\n icons: createExtensionInput([IconBundleBlueprint.dataRefs.icons], {\n replaces: [{ id: 'app', input: 'icons' }],\n }),\n },\n factory: (originalFactory, { inputs }) => {\n return originalFactory(defineParams =>\n defineParams({\n api: iconsApiRef,\n deps: {},\n factory: () =>\n new DefaultIconsApi(\n inputs.icons\n .map(i => i.get(IconBundleBlueprint.dataRefs.icons))\n .reduce((acc, bundle) => ({ ...acc, ...bundle }), defaultIcons),\n ),\n }),\n );\n },\n});\n"],"names":["defaultIcons"],"mappings":";;;;;;;;;;;;AA8BO,MAAM,QAAA,GAAW,aAAa,iBAAA,CAAkB;AAAA,EACrD,IAAA,EAAM,OAAA;AAAA,EACN,MAAA,EAAQ;AAAA,IACN,OAAO,oBAAA,CAAqB,CAAC,mBAAA,CAAoB,QAAA,CAAS,KAAK,CAAA,EAAG;AAAA,MAChE,UAAU,CAAC,EAAE,IAAI,KAAA,EAAO,KAAA,EAAO,SAAS;AAAA,KACzC;AAAA,GACH;AAAA,EACA,OAAA,EAAS,CAAC,eAAA,EAAiB,EAAE,QAAO,KAAM;AACxC,IAAA,OAAO,eAAA;AAAA,MAAgB,kBACrB,YAAA,CAAa;AAAA,QACX,GAAA,EAAK,WAAA;AAAA,QACL,MAAM,EAAC;AAAA,QACP,OAAA,EAAS,MACP,IAAI,eAAA;AAAA,UACF,MAAA,CAAO,MACJ,GAAA,CAAI,CAAA,CAAA,KAAK,EAAE,GAAA,CAAI,mBAAA,CAAoB,SAAS,KAAK,CAAC,EAClD,MAAA,CAAO,CAAC,KAAK,MAAA,MAAY,EAAE,GAAG,GAAA,EAAK,GAAG,MAAA,EAAO,CAAA,EAAIA,KAAY;AAAA;AAClE,OACH;AAAA,KACH;AAAA,EACF;AACF,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LegacyComponentsApi.esm.js","sources":["../../src/extensions/LegacyComponentsApi.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n ApiBlueprint,\n createApiRef,\n ErrorDisplay,\n NotFoundErrorPage,\n Progress,\n} from '@backstage/frontend-plugin-api';\nimport { ComponentType } from 'react';\n\n/**\n * This is the old component API that has been replaced by the new SwappableComponentsApi.\n *\n * This backwards compatibility implementation exists to avoid breaking older plugins.\n *\n * This was added for the 1.42 release, and can be removed in the future.\n *\n * @internal\n */\nexport const LegacyComponentsApi = ApiBlueprint.make({\n name: 'components',\n params: defineParams =>\n defineParams({\n api: createApiRef<{\n getComponent(ref: { id: string }): ComponentType<any>;\n }>({ id: 'core.components' }),\n deps: {},\n factory: () => ({\n getComponent(ref) {\n if (ref.id === 'core.components.progress') {\n return Progress;\n }\n if (ref.id === 'core.components.notFoundErrorPage') {\n return NotFoundErrorPage;\n }\n if (ref.id === 'core.components.errorBoundaryFallback') {\n return ErrorDisplay;\n }\n throw new Error(`No implementation found for component ref ${ref}`);\n },\n }),\n }),\n});\n"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"LegacyComponentsApi.esm.js","sources":["../../src/extensions/LegacyComponentsApi.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n ApiBlueprint,\n createApiRef,\n ErrorDisplay,\n NotFoundErrorPage,\n Progress,\n} from '@backstage/frontend-plugin-api';\nimport { ComponentType } from 'react';\n\n/**\n * This is the old component API that has been replaced by the new SwappableComponentsApi.\n *\n * This backwards compatibility implementation exists to avoid breaking older plugins.\n *\n * This was added for the 1.42 release, and can be removed in the future.\n *\n * @internal\n */\nexport const LegacyComponentsApi = ApiBlueprint.make({\n name: 'components',\n params: defineParams =>\n defineParams({\n api: createApiRef<{\n getComponent(ref: { id: string }): ComponentType<any>;\n }>({ id: 'core.components' }),\n deps: {},\n factory: () => ({\n getComponent(ref) {\n if (ref.id === 'core.components.progress') {\n return Progress;\n }\n if (ref.id === 'core.components.notFoundErrorPage') {\n return NotFoundErrorPage;\n }\n if (ref.id === 'core.components.errorBoundaryFallback') {\n return ErrorDisplay;\n }\n throw new Error(`No implementation found for component ref ${ref}`);\n },\n }),\n }),\n});\n"],"names":[],"mappings":";;AAkCO,MAAM,mBAAA,GAAsB,aAAa,IAAA,CAAK;AAAA,EACnD,IAAA,EAAM,YAAA;AAAA,EACN,MAAA,EAAQ,kBACN,YAAA,CAAa;AAAA,IACX,GAAA,EAAK,YAAA,CAEF,EAAE,EAAA,EAAI,mBAAmB,CAAA;AAAA,IAC5B,MAAM,EAAC;AAAA,IACP,SAAS,OAAO;AAAA,MACd,aAAa,GAAA,EAAK;AAChB,QAAA,IAAI,GAAA,CAAI,OAAO,0BAAA,EAA4B;AACzC,UAAA,OAAO,QAAA;AAAA,QACT;AACA,QAAA,IAAI,GAAA,CAAI,OAAO,mCAAA,EAAqC;AAClD,UAAA,OAAO,iBAAA;AAAA,QACT;AACA,QAAA,IAAI,GAAA,CAAI,OAAO,uCAAA,EAAyC;AACtD,UAAA,OAAO,YAAA;AAAA,QACT;AACA,QAAA,MAAM,IAAI,KAAA,CAAM,CAAA,0CAAA,EAA6C,GAAG,CAAA,CAAE,CAAA;AAAA,MACpE;AAAA,KACF;AAAA,GACD;AACL,CAAC;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ApiBlueprint, createExtensionInput,
|
|
1
|
+
import { ApiBlueprint, createExtensionInput, swappableComponentsApiRef, SwappableComponentBlueprint } from '@backstage/frontend-plugin-api';
|
|
2
2
|
import { DefaultSwappableComponentsApi } from '../apis/SwappableComponentsApi/DefaultSwappableComponentsApi.esm.js';
|
|
3
3
|
|
|
4
4
|
const SwappableComponentsApi = ApiBlueprint.makeWithOverrides({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SwappableComponentsApi.esm.js","sources":["../../src/extensions/SwappableComponentsApi.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n SwappableComponentBlueprint,\n createExtensionInput,\n ApiBlueprint,\n swappableComponentsApiRef,\n} from '@backstage/frontend-plugin-api';\nimport { DefaultSwappableComponentsApi } from '../apis/SwappableComponentsApi';\n\n/**\n * Contains the shareable components installed into the app.\n */\nexport const SwappableComponentsApi = ApiBlueprint.makeWithOverrides({\n name: 'swappable-components',\n inputs: {\n components: createExtensionInput([\n SwappableComponentBlueprint.dataRefs.component,\n ]),\n },\n factory: (originalFactory, { inputs }) => {\n return originalFactory(defineParams =>\n defineParams({\n api: swappableComponentsApiRef,\n deps: {},\n factory: () => {\n const nonAppExtensions = inputs.components.filter(\n i => i.node.spec.plugin?.id !== 'app',\n );\n\n if (nonAppExtensions.length > 0) {\n // eslint-disable-next-line no-console\n console.warn(\n `SwappableComponents should only be installed as an extension in the app plugin. You can either use appPlugin.override(), or provide a module for the app-plugin with the extension there instead. Invalid extensions: ${nonAppExtensions\n .map(i => i.node.spec.id)\n .join(', ')}`,\n );\n }\n\n const appExtensions = inputs.components.filter(\n i => i.node.spec.plugin?.id === 'app',\n );\n\n return DefaultSwappableComponentsApi.fromComponents(\n appExtensions.map(i =>\n i.get(SwappableComponentBlueprint.dataRefs.component),\n ),\n );\n },\n }),\n );\n },\n});\n"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"SwappableComponentsApi.esm.js","sources":["../../src/extensions/SwappableComponentsApi.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n SwappableComponentBlueprint,\n createExtensionInput,\n ApiBlueprint,\n swappableComponentsApiRef,\n} from '@backstage/frontend-plugin-api';\nimport { DefaultSwappableComponentsApi } from '../apis/SwappableComponentsApi';\n\n/**\n * Contains the shareable components installed into the app.\n */\nexport const SwappableComponentsApi = ApiBlueprint.makeWithOverrides({\n name: 'swappable-components',\n inputs: {\n components: createExtensionInput([\n SwappableComponentBlueprint.dataRefs.component,\n ]),\n },\n factory: (originalFactory, { inputs }) => {\n return originalFactory(defineParams =>\n defineParams({\n api: swappableComponentsApiRef,\n deps: {},\n factory: () => {\n const nonAppExtensions = inputs.components.filter(\n i => i.node.spec.plugin?.id !== 'app',\n );\n\n if (nonAppExtensions.length > 0) {\n // eslint-disable-next-line no-console\n console.warn(\n `SwappableComponents should only be installed as an extension in the app plugin. You can either use appPlugin.override(), or provide a module for the app-plugin with the extension there instead. Invalid extensions: ${nonAppExtensions\n .map(i => i.node.spec.id)\n .join(', ')}`,\n );\n }\n\n const appExtensions = inputs.components.filter(\n i => i.node.spec.plugin?.id === 'app',\n );\n\n return DefaultSwappableComponentsApi.fromComponents(\n appExtensions.map(i =>\n i.get(SwappableComponentBlueprint.dataRefs.component),\n ),\n );\n },\n }),\n );\n },\n});\n"],"names":[],"mappings":";;;AA2BO,MAAM,sBAAA,GAAyB,aAAa,iBAAA,CAAkB;AAAA,EACnE,IAAA,EAAM,sBAAA;AAAA,EACN,MAAA,EAAQ;AAAA,IACN,YAAY,oBAAA,CAAqB;AAAA,MAC/B,4BAA4B,QAAA,CAAS;AAAA,KACtC;AAAA,GACH;AAAA,EACA,OAAA,EAAS,CAAC,eAAA,EAAiB,EAAE,QAAO,KAAM;AACxC,IAAA,OAAO,eAAA;AAAA,MAAgB,kBACrB,YAAA,CAAa;AAAA,QACX,GAAA,EAAK,yBAAA;AAAA,QACL,MAAM,EAAC;AAAA,QACP,SAAS,MAAM;AACb,UAAA,MAAM,gBAAA,GAAmB,OAAO,UAAA,CAAW,MAAA;AAAA,YACzC,CAAA,CAAA,KAAK,CAAA,CAAE,IAAA,CAAK,IAAA,CAAK,QAAQ,EAAA,KAAO;AAAA,WAClC;AAEA,UAAA,IAAI,gBAAA,CAAiB,SAAS,CAAA,EAAG;AAE/B,YAAA,OAAA,CAAQ,IAAA;AAAA,cACN,CAAA,sNAAA,EAAyN,gBAAA,CACtN,GAAA,CAAI,CAAA,CAAA,KAAK,CAAA,CAAE,IAAA,CAAK,IAAA,CAAK,EAAE,CAAA,CACvB,IAAA,CAAK,IAAI,CAAC,CAAA;AAAA,aACf;AAAA,UACF;AAEA,UAAA,MAAM,aAAA,GAAgB,OAAO,UAAA,CAAW,MAAA;AAAA,YACtC,CAAA,CAAA,KAAK,CAAA,CAAE,IAAA,CAAK,IAAA,CAAK,QAAQ,EAAA,KAAO;AAAA,WAClC;AAEA,UAAA,OAAO,6BAAA,CAA8B,cAAA;AAAA,YACnC,aAAA,CAAc,GAAA;AAAA,cAAI,CAAA,CAAA,KAChB,CAAA,CAAE,GAAA,CAAI,2BAAA,CAA4B,SAAS,SAAS;AAAA;AACtD,WACF;AAAA,QACF;AAAA,OACD;AAAA,KACH;AAAA,EACF;AACF,CAAC;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ApiBlueprint, createExtensionInput, TranslationBlueprint } from '@backstage/frontend-plugin-api';
|
|
2
|
-
import {
|
|
2
|
+
import { appLanguageApiRef, translationApiRef } from '@backstage/core-plugin-api/alpha';
|
|
3
3
|
import { I18nextTranslationApi } from '../packages/core-app-api/src/apis/implementations/TranslationApi/I18nextTranslationApi.esm.js';
|
|
4
4
|
|
|
5
5
|
const TranslationsApi = ApiBlueprint.makeWithOverrides({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TranslationsApi.esm.js","sources":["../../src/extensions/TranslationsApi.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n ApiBlueprint,\n TranslationBlueprint,\n createExtensionInput,\n} from '@backstage/frontend-plugin-api';\nimport {\n appLanguageApiRef,\n translationApiRef,\n} from '@backstage/core-plugin-api/alpha';\n\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { I18nextTranslationApi } from '../../../../packages/core-app-api/src/apis/implementations/TranslationApi/I18nextTranslationApi';\n\n/**\n * Contains translations that are installed in the app.\n */\nexport const TranslationsApi = ApiBlueprint.makeWithOverrides({\n name: 'translations',\n inputs: {\n translations: createExtensionInput(\n [TranslationBlueprint.dataRefs.translation],\n { replaces: [{ id: 'app', input: 'translations' }] },\n ),\n },\n factory: (originalFactory, { inputs }) => {\n return originalFactory(defineParams =>\n defineParams({\n api: translationApiRef,\n deps: { languageApi: appLanguageApiRef },\n factory: ({ languageApi }) =>\n I18nextTranslationApi.create({\n languageApi,\n resources: inputs.translations.map(i =>\n i.get(TranslationBlueprint.dataRefs.translation),\n ),\n }),\n }),\n );\n },\n});\n"],"names":[],"mappings":";;;;AA+
|
|
1
|
+
{"version":3,"file":"TranslationsApi.esm.js","sources":["../../src/extensions/TranslationsApi.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n ApiBlueprint,\n TranslationBlueprint,\n createExtensionInput,\n} from '@backstage/frontend-plugin-api';\nimport {\n appLanguageApiRef,\n translationApiRef,\n} from '@backstage/core-plugin-api/alpha';\n\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { I18nextTranslationApi } from '../../../../packages/core-app-api/src/apis/implementations/TranslationApi/I18nextTranslationApi';\n\n/**\n * Contains translations that are installed in the app.\n */\nexport const TranslationsApi = ApiBlueprint.makeWithOverrides({\n name: 'translations',\n inputs: {\n translations: createExtensionInput(\n [TranslationBlueprint.dataRefs.translation],\n { replaces: [{ id: 'app', input: 'translations' }] },\n ),\n },\n factory: (originalFactory, { inputs }) => {\n return originalFactory(defineParams =>\n defineParams({\n api: translationApiRef,\n deps: { languageApi: appLanguageApiRef },\n factory: ({ languageApi }) =>\n I18nextTranslationApi.create({\n languageApi,\n resources: inputs.translations.map(i =>\n i.get(TranslationBlueprint.dataRefs.translation),\n ),\n }),\n }),\n );\n },\n});\n"],"names":[],"mappings":";;;;AA+BO,MAAM,eAAA,GAAkB,aAAa,iBAAA,CAAkB;AAAA,EAC5D,IAAA,EAAM,cAAA;AAAA,EACN,MAAA,EAAQ;AAAA,IACN,YAAA,EAAc,oBAAA;AAAA,MACZ,CAAC,oBAAA,CAAqB,QAAA,CAAS,WAAW,CAAA;AAAA,MAC1C,EAAE,UAAU,CAAC,EAAE,IAAI,KAAA,EAAO,KAAA,EAAO,cAAA,EAAgB,CAAA;AAAE;AACrD,GACF;AAAA,EACA,OAAA,EAAS,CAAC,eAAA,EAAiB,EAAE,QAAO,KAAM;AACxC,IAAA,OAAO,eAAA;AAAA,MAAgB,kBACrB,YAAA,CAAa;AAAA,QACX,GAAA,EAAK,iBAAA;AAAA,QACL,IAAA,EAAM,EAAE,WAAA,EAAa,iBAAA,EAAkB;AAAA,QACvC,SAAS,CAAC,EAAE,WAAA,EAAY,KACtB,sBAAsB,MAAA,CAAO;AAAA,UAC3B,WAAA;AAAA,UACA,SAAA,EAAW,OAAO,YAAA,CAAa,GAAA;AAAA,YAAI,CAAA,CAAA,KACjC,CAAA,CAAE,GAAA,CAAI,oBAAA,CAAqB,SAAS,WAAW;AAAA;AACjD,SACD;AAAA,OACJ;AAAA,KACH;AAAA,EACF;AACF,CAAC;;;;"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { SwappableComponentBlueprint, Progress as Progress$
|
|
3
|
-
import { Progress as Progress$
|
|
2
|
+
import { SwappableComponentBlueprint, Progress as Progress$2, NotFoundErrorPage as NotFoundErrorPage$1, ErrorDisplay as ErrorDisplay$1 } from '@backstage/frontend-plugin-api';
|
|
3
|
+
import { Progress as Progress$1, ErrorPage, ErrorPanel } from '@backstage/core-components';
|
|
4
4
|
import Button from '@material-ui/core/Button';
|
|
5
5
|
|
|
6
6
|
const Progress = SwappableComponentBlueprint.make({
|
|
7
7
|
name: "core-progress",
|
|
8
8
|
params: (define) => define({
|
|
9
|
-
component: Progress$
|
|
10
|
-
loader: () => Progress$
|
|
9
|
+
component: Progress$2,
|
|
10
|
+
loader: () => Progress$1
|
|
11
11
|
})
|
|
12
12
|
});
|
|
13
13
|
const NotFoundErrorPage = SwappableComponentBlueprint.make({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.esm.js","sources":["../../src/extensions/components.tsx"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n NotFoundErrorPage as SwappableNotFoundErrorPage,\n Progress as SwappableProgress,\n ErrorDisplay as SwappableErrorDisplay,\n SwappableComponentBlueprint,\n} from '@backstage/frontend-plugin-api';\n\nimport {\n ErrorPage,\n ErrorPanel,\n Progress as ProgressComponent,\n} from '@backstage/core-components';\nimport Button from '@material-ui/core/Button';\n\nexport const Progress = SwappableComponentBlueprint.make({\n name: 'core-progress',\n params: define =>\n define({\n component: SwappableProgress,\n loader: () => ProgressComponent,\n }),\n});\n\nexport const NotFoundErrorPage = SwappableComponentBlueprint.make({\n name: 'core-not-found-error-page',\n params: define =>\n define({\n component: SwappableNotFoundErrorPage,\n loader: () => () =>\n <ErrorPage status=\"404\" statusMessage=\"PAGE NOT FOUND\" />,\n }),\n});\n\nexport const ErrorDisplay = SwappableComponentBlueprint.make({\n name: 'core-error-display',\n params: define =>\n define({\n component: SwappableErrorDisplay,\n loader: () => props => {\n const { plugin, error, resetError } = props;\n const title = `Error in ${plugin?.id}`;\n return (\n <ErrorPanel title={title} error={error} defaultExpanded>\n <Button variant=\"outlined\" onClick={resetError}>\n Retry\n </Button>\n </ErrorPanel>\n );\n },\n }),\n});\n"],"names":["SwappableProgress","ProgressComponent","SwappableNotFoundErrorPage","SwappableErrorDisplay"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"components.esm.js","sources":["../../src/extensions/components.tsx"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n NotFoundErrorPage as SwappableNotFoundErrorPage,\n Progress as SwappableProgress,\n ErrorDisplay as SwappableErrorDisplay,\n SwappableComponentBlueprint,\n} from '@backstage/frontend-plugin-api';\n\nimport {\n ErrorPage,\n ErrorPanel,\n Progress as ProgressComponent,\n} from '@backstage/core-components';\nimport Button from '@material-ui/core/Button';\n\nexport const Progress = SwappableComponentBlueprint.make({\n name: 'core-progress',\n params: define =>\n define({\n component: SwappableProgress,\n loader: () => ProgressComponent,\n }),\n});\n\nexport const NotFoundErrorPage = SwappableComponentBlueprint.make({\n name: 'core-not-found-error-page',\n params: define =>\n define({\n component: SwappableNotFoundErrorPage,\n loader: () => () =>\n <ErrorPage status=\"404\" statusMessage=\"PAGE NOT FOUND\" />,\n }),\n});\n\nexport const ErrorDisplay = SwappableComponentBlueprint.make({\n name: 'core-error-display',\n params: define =>\n define({\n component: SwappableErrorDisplay,\n loader: () => props => {\n const { plugin, error, resetError } = props;\n const title = `Error in ${plugin?.id}`;\n return (\n <ErrorPanel title={title} error={error} defaultExpanded>\n <Button variant=\"outlined\" onClick={resetError}>\n Retry\n </Button>\n </ErrorPanel>\n );\n },\n }),\n});\n"],"names":["SwappableProgress","ProgressComponent","SwappableNotFoundErrorPage","SwappableErrorDisplay"],"mappings":";;;;;AA6BO,MAAM,QAAA,GAAW,4BAA4B,IAAA,CAAK;AAAA,EACvD,IAAA,EAAM,eAAA;AAAA,EACN,MAAA,EAAQ,YACN,MAAA,CAAO;AAAA,IACL,SAAA,EAAWA,UAAA;AAAA,IACX,QAAQ,MAAMC;AAAA,GACf;AACL,CAAC;AAEM,MAAM,iBAAA,GAAoB,4BAA4B,IAAA,CAAK;AAAA,EAChE,IAAA,EAAM,2BAAA;AAAA,EACN,MAAA,EAAQ,YACN,MAAA,CAAO;AAAA,IACL,SAAA,EAAWC,mBAAA;AAAA,IACX,MAAA,EAAQ,MAAM,sBACZ,GAAA,CAAC,aAAU,MAAA,EAAO,KAAA,EAAM,eAAc,gBAAA,EAAiB;AAAA,GAC1D;AACL,CAAC;AAEM,MAAM,YAAA,GAAe,4BAA4B,IAAA,CAAK;AAAA,EAC3D,IAAA,EAAM,oBAAA;AAAA,EACN,MAAA,EAAQ,YACN,MAAA,CAAO;AAAA,IACL,SAAA,EAAWC,cAAA;AAAA,IACX,MAAA,EAAQ,MAAM,CAAA,KAAA,KAAS;AACrB,MAAA,MAAM,EAAE,MAAA,EAAQ,KAAA,EAAO,UAAA,EAAW,GAAI,KAAA;AACtC,MAAA,MAAM,KAAA,GAAQ,CAAA,SAAA,EAAY,MAAA,EAAQ,EAAE,CAAA,CAAA;AACpC,MAAA,uBACE,GAAA,CAAC,UAAA,EAAA,EAAW,KAAA,EAAc,KAAA,EAAc,eAAA,EAAe,IAAA,EACrD,QAAA,kBAAA,GAAA,CAAC,MAAA,EAAA,EAAO,OAAA,EAAQ,UAAA,EAAW,OAAA,EAAS,UAAA,EAAY,mBAEhD,CAAA,EACF,CAAA;AAAA,IAEJ;AAAA,GACD;AACL,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"elements.esm.js","sources":["../../src/extensions/elements.tsx"],"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 { AlertDisplay, OAuthRequestDialog } from '@backstage/core-components';\nimport { AppRootElementBlueprint } from '@backstage/frontend-plugin-api';\n\nexport const oauthRequestDialogAppRootElement = AppRootElementBlueprint.make({\n name: 'oauth-request-dialog',\n params: {\n element: <OAuthRequestDialog />,\n },\n});\n\nexport const alertDisplayAppRootElement =\n AppRootElementBlueprint.makeWithOverrides({\n name: 'alert-display',\n config: {\n schema: {\n transientTimeoutMs: z => z.number().default(5000),\n anchorOrigin: z =>\n z\n .object({\n vertical: z.enum(['top', 'bottom']).default('top'),\n horizontal: z.enum(['left', 'center', 'right']).default('center'),\n })\n .default({}),\n },\n },\n factory: (originalFactory, { config }) => {\n return originalFactory({\n element: <AlertDisplay {...config} />,\n });\n },\n });\n"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"elements.esm.js","sources":["../../src/extensions/elements.tsx"],"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 { AlertDisplay, OAuthRequestDialog } from '@backstage/core-components';\nimport { AppRootElementBlueprint } from '@backstage/frontend-plugin-api';\n\nexport const oauthRequestDialogAppRootElement = AppRootElementBlueprint.make({\n name: 'oauth-request-dialog',\n params: {\n element: <OAuthRequestDialog />,\n },\n});\n\nexport const alertDisplayAppRootElement =\n AppRootElementBlueprint.makeWithOverrides({\n name: 'alert-display',\n config: {\n schema: {\n transientTimeoutMs: z => z.number().default(5000),\n anchorOrigin: z =>\n z\n .object({\n vertical: z.enum(['top', 'bottom']).default('top'),\n horizontal: z.enum(['left', 'center', 'right']).default('center'),\n })\n .default({}),\n },\n },\n factory: (originalFactory, { config }) => {\n return originalFactory({\n element: <AlertDisplay {...config} />,\n });\n },\n });\n"],"names":[],"mappings":";;;;AAmBO,MAAM,gCAAA,GAAmC,wBAAwB,IAAA,CAAK;AAAA,EAC3E,IAAA,EAAM,sBAAA;AAAA,EACN,MAAA,EAAQ;AAAA,IACN,OAAA,sBAAU,kBAAA,EAAA,EAAmB;AAAA;AAEjC,CAAC;AAEM,MAAM,0BAAA,GACX,wBAAwB,iBAAA,CAAkB;AAAA,EACxC,IAAA,EAAM,eAAA;AAAA,EACN,MAAA,EAAQ;AAAA,IACN,MAAA,EAAQ;AAAA,MACN,oBAAoB,CAAA,CAAA,KAAK,CAAA,CAAE,MAAA,EAAO,CAAE,QAAQ,GAAI,CAAA;AAAA,MAChD,YAAA,EAAc,CAAA,CAAA,KACZ,CAAA,CACG,MAAA,CAAO;AAAA,QACN,QAAA,EAAU,EAAE,IAAA,CAAK,CAAC,OAAO,QAAQ,CAAC,CAAA,CAAE,OAAA,CAAQ,KAAK,CAAA;AAAA,QACjD,UAAA,EAAY,CAAA,CAAE,IAAA,CAAK,CAAC,MAAA,EAAQ,UAAU,OAAO,CAAC,CAAA,CAAE,OAAA,CAAQ,QAAQ;AAAA,OACjE,CAAA,CACA,OAAA,CAAQ,EAAE;AAAA;AACjB,GACF;AAAA,EACA,OAAA,EAAS,CAAC,eAAA,EAAiB,EAAE,QAAO,KAAM;AACxC,IAAA,OAAO,eAAA,CAAgB;AAAA,MACrB,OAAA,kBAAS,GAAA,CAAC,YAAA,EAAA,EAAc,GAAG,MAAA,EAAQ;AAAA,KACpC,CAAA;AAAA,EACH;AACF,CAAC;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api'
|
|
|
3
3
|
import * as react from 'react';
|
|
4
4
|
|
|
5
5
|
/** @public */
|
|
6
|
-
declare const appPlugin: _backstage_frontend_plugin_api.
|
|
6
|
+
declare const appPlugin: _backstage_frontend_plugin_api.OverridableFrontendPlugin<{}, {}, {
|
|
7
7
|
app: _backstage_frontend_plugin_api.ExtensionDefinition<{
|
|
8
8
|
config: {};
|
|
9
9
|
configInput: {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FrontendHostDiscovery, AlertApiForwarder, NoOpAnalyticsApi, ErrorAlerter, ErrorApiForwarder, UnhandledErrorForwarder, WebStorage, createFetchApi, FetchMiddlewares, OAuthRequestManager, GoogleAuth, MicrosoftAuth, GithubAuth, OktaAuth, GitlabAuth, OneLoginAuth, BitbucketAuth, BitbucketServerAuth, AtlassianAuth, VMwareCloudAuth } from '@backstage/core-app-api';
|
|
2
|
-
import { createApiFactory,
|
|
3
|
-
import {
|
|
2
|
+
import { createApiFactory, configApiRef, discoveryApiRef, alertApiRef, analyticsApiRef, errorApiRef, storageApiRef, identityApiRef, fetchApiRef, oauthRequestApiRef, googleAuthApiRef, microsoftAuthApiRef, githubAuthApiRef, oktaAuthApiRef, gitlabAuthApiRef, oneloginAuthApiRef, bitbucketAuthApiRef, bitbucketServerAuthApiRef, atlassianAuthApiRef, vmwareCloudAuthApiRef } from '@backstage/core-plugin-api';
|
|
3
|
+
import { IdentityPermissionApi, permissionApiRef } from '@backstage/plugin-permission-react';
|
|
4
4
|
|
|
5
5
|
[
|
|
6
6
|
createApiFactory({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apis.esm.js","sources":["../../../../../../../packages/app-defaults/src/defaults/apis.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 {\n AlertApiForwarder,\n NoOpAnalyticsApi,\n ErrorApiForwarder,\n ErrorAlerter,\n GoogleAuth,\n GithubAuth,\n OktaAuth,\n GitlabAuth,\n MicrosoftAuth,\n BitbucketAuth,\n BitbucketServerAuth,\n OAuthRequestManager,\n WebStorage,\n OneLoginAuth,\n UnhandledErrorForwarder,\n AtlassianAuth,\n createFetchApi,\n FetchMiddlewares,\n VMwareCloudAuth,\n FrontendHostDiscovery,\n} from '@backstage/core-app-api';\n\nimport {\n createApiFactory,\n alertApiRef,\n analyticsApiRef,\n errorApiRef,\n discoveryApiRef,\n fetchApiRef,\n identityApiRef,\n oauthRequestApiRef,\n googleAuthApiRef,\n githubAuthApiRef,\n oktaAuthApiRef,\n gitlabAuthApiRef,\n microsoftAuthApiRef,\n storageApiRef,\n configApiRef,\n oneloginAuthApiRef,\n bitbucketAuthApiRef,\n bitbucketServerAuthApiRef,\n atlassianAuthApiRef,\n vmwareCloudAuthApiRef,\n} from '@backstage/core-plugin-api';\nimport {\n permissionApiRef,\n IdentityPermissionApi,\n} from '@backstage/plugin-permission-react';\n\nexport const apis = [\n createApiFactory({\n api: discoveryApiRef,\n deps: { configApi: configApiRef },\n factory: ({ configApi }) => FrontendHostDiscovery.fromConfig(configApi),\n }),\n createApiFactory({\n api: alertApiRef,\n deps: {},\n factory: () => new AlertApiForwarder(),\n }),\n createApiFactory({\n api: analyticsApiRef,\n deps: {},\n factory: () => new NoOpAnalyticsApi(),\n }),\n createApiFactory({\n api: errorApiRef,\n deps: { alertApi: alertApiRef },\n factory: ({ alertApi }) => {\n const errorApi = new ErrorAlerter(alertApi, new ErrorApiForwarder());\n UnhandledErrorForwarder.forward(errorApi, { hidden: false });\n return errorApi;\n },\n }),\n createApiFactory({\n api: storageApiRef,\n deps: { errorApi: errorApiRef },\n factory: ({ errorApi }) => WebStorage.create({ errorApi }),\n }),\n createApiFactory({\n api: fetchApiRef,\n deps: {\n configApi: configApiRef,\n identityApi: identityApiRef,\n discoveryApi: discoveryApiRef,\n },\n factory: ({ configApi, identityApi, discoveryApi }) => {\n return createFetchApi({\n middleware: [\n FetchMiddlewares.resolvePluginProtocol({\n discoveryApi,\n }),\n FetchMiddlewares.injectIdentityAuth({\n identityApi,\n config: configApi,\n }),\n ],\n });\n },\n }),\n createApiFactory({\n api: oauthRequestApiRef,\n deps: {},\n factory: () => new OAuthRequestManager(),\n }),\n createApiFactory({\n api: googleAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) =>\n GoogleAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n environment: configApi.getOptionalString('auth.environment'),\n }),\n }),\n createApiFactory({\n api: microsoftAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) =>\n MicrosoftAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n environment: configApi.getOptionalString('auth.environment'),\n }),\n }),\n createApiFactory({\n api: githubAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) =>\n GithubAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n defaultScopes: ['read:user'],\n environment: configApi.getOptionalString('auth.environment'),\n }),\n }),\n createApiFactory({\n api: oktaAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) =>\n OktaAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n environment: configApi.getOptionalString('auth.environment'),\n }),\n }),\n createApiFactory({\n api: gitlabAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) =>\n GitlabAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n environment: configApi.getOptionalString('auth.environment'),\n }),\n }),\n createApiFactory({\n api: oneloginAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) =>\n OneLoginAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n environment: configApi.getOptionalString('auth.environment'),\n }),\n }),\n createApiFactory({\n api: bitbucketAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) =>\n BitbucketAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n defaultScopes: ['account'],\n environment: configApi.getOptionalString('auth.environment'),\n }),\n }),\n createApiFactory({\n api: bitbucketServerAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) =>\n BitbucketServerAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n defaultScopes: ['REPO_READ'],\n environment: configApi.getOptionalString('auth.environment'),\n }),\n }),\n createApiFactory({\n api: atlassianAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) => {\n return AtlassianAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n environment: configApi.getOptionalString('auth.environment'),\n });\n },\n }),\n createApiFactory({\n api: vmwareCloudAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) => {\n return VMwareCloudAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n environment: configApi.getOptionalString('auth.environment'),\n });\n },\n }),\n createApiFactory({\n api: permissionApiRef,\n deps: {\n discovery: discoveryApiRef,\n identity: identityApiRef,\n config: configApiRef,\n },\n factory: ({ config, discovery, identity }) =>\n IdentityPermissionApi.create({ config, discovery, identity }),\n }),\n];\n"],"names":[],"mappings":";;;;AAkEoB;AAAA,EAClB,gBAAiB,CAAA;AAAA,IACf,GAAK,EAAA,eAAA;AAAA,IACL,IAAA,EAAM,EAAE,SAAA,EAAW,YAAa,EAAA;AAAA,IAChC,SAAS,CAAC,EAAE,WAAgB,KAAA,qBAAA,CAAsB,WAAW,SAAS;AAAA,GACvE,CAAA;AAAA,EACD,gBAAiB,CAAA;AAAA,IACf,GAAK,EAAA,WAAA;AAAA,IACL,MAAM,EAAC;AAAA,IACP,OAAA,EAAS,MAAM,IAAI,iBAAkB;AAAA,GACtC,CAAA;AAAA,EACD,gBAAiB,CAAA;AAAA,IACf,GAAK,EAAA,eAAA;AAAA,IACL,MAAM,EAAC;AAAA,IACP,OAAA,EAAS,MAAM,IAAI,gBAAiB;AAAA,GACrC,CAAA;AAAA,EACD,gBAAiB,CAAA;AAAA,IACf,GAAK,EAAA,WAAA;AAAA,IACL,IAAA,EAAM,EAAE,QAAA,EAAU,WAAY,EAAA;AAAA,IAC9B,OAAS,EAAA,C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EAAA,qBAAA;AAAA,IACL,IAAM,EAAA;AAAA,MACJ,YAAc,EAAA,eAAA;AAAA,MACd,eAAiB,EAAA,kBAAA;AAAA,MACjB,SAAW,EAAA;AAAA,KACb;AAAA,IACA,SAAS,CAAC,EAAE,YAAc,EAAA,eAAA,EAAiB,WAAgB,KAAA;AACzD,MAAA,OAAO,gBAAgB,MAAO,CAAA;AAAA,QAC5B,SAAA;AAAA,QACA,YAAA;AAAA,QACA,eAAA;AAAA,QACA,WAAA,EAAa,SAAU,CAAA,iBAAA,CAAkB,kBAAkB;AAAA,OAC5D,CAAA;AAAA;AACH,GACD,CAAA;AAAA,EACD,gBAAiB,CAAA;AAAA,IACf,GAAK,EAAA,gBAAA;AAAA,IACL,IAAM,EAAA;AAAA,MACJ,SAAW,EAAA,eAAA;AAAA,MACX,QAAU,EAAA,cAAA;AAAA,MACV,MAAQ,EAAA;AAAA,KACV;AAAA,IACA,OAAS,EAAA,CAAC,EAAE,MAAA,EAAQ,SAAW,EAAA,QAAA,EAC7B,KAAA,qBAAA,CAAsB,MAAO,CAAA,EAAE,MAAQ,EAAA,SAAA,EAAW,UAAU;AAAA,GAC/D;AACH"}
|
|
1
|
+
{"version":3,"file":"apis.esm.js","sources":["../../../../../../../packages/app-defaults/src/defaults/apis.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 {\n AlertApiForwarder,\n NoOpAnalyticsApi,\n ErrorApiForwarder,\n ErrorAlerter,\n GoogleAuth,\n GithubAuth,\n OktaAuth,\n GitlabAuth,\n MicrosoftAuth,\n BitbucketAuth,\n BitbucketServerAuth,\n OAuthRequestManager,\n WebStorage,\n OneLoginAuth,\n UnhandledErrorForwarder,\n AtlassianAuth,\n createFetchApi,\n FetchMiddlewares,\n VMwareCloudAuth,\n FrontendHostDiscovery,\n} from '@backstage/core-app-api';\n\nimport {\n createApiFactory,\n alertApiRef,\n analyticsApiRef,\n errorApiRef,\n discoveryApiRef,\n fetchApiRef,\n identityApiRef,\n oauthRequestApiRef,\n googleAuthApiRef,\n githubAuthApiRef,\n oktaAuthApiRef,\n gitlabAuthApiRef,\n microsoftAuthApiRef,\n storageApiRef,\n configApiRef,\n oneloginAuthApiRef,\n bitbucketAuthApiRef,\n bitbucketServerAuthApiRef,\n atlassianAuthApiRef,\n vmwareCloudAuthApiRef,\n} from '@backstage/core-plugin-api';\nimport {\n permissionApiRef,\n IdentityPermissionApi,\n} from '@backstage/plugin-permission-react';\n\nexport const apis = [\n createApiFactory({\n api: discoveryApiRef,\n deps: { configApi: configApiRef },\n factory: ({ configApi }) => FrontendHostDiscovery.fromConfig(configApi),\n }),\n createApiFactory({\n api: alertApiRef,\n deps: {},\n factory: () => new AlertApiForwarder(),\n }),\n createApiFactory({\n api: analyticsApiRef,\n deps: {},\n factory: () => new NoOpAnalyticsApi(),\n }),\n createApiFactory({\n api: errorApiRef,\n deps: { alertApi: alertApiRef },\n factory: ({ alertApi }) => {\n const errorApi = new ErrorAlerter(alertApi, new ErrorApiForwarder());\n UnhandledErrorForwarder.forward(errorApi, { hidden: false });\n return errorApi;\n },\n }),\n createApiFactory({\n api: storageApiRef,\n deps: { errorApi: errorApiRef },\n factory: ({ errorApi }) => WebStorage.create({ errorApi }),\n }),\n createApiFactory({\n api: fetchApiRef,\n deps: {\n configApi: configApiRef,\n identityApi: identityApiRef,\n discoveryApi: discoveryApiRef,\n },\n factory: ({ configApi, identityApi, discoveryApi }) => {\n return createFetchApi({\n middleware: [\n FetchMiddlewares.resolvePluginProtocol({\n discoveryApi,\n }),\n FetchMiddlewares.injectIdentityAuth({\n identityApi,\n config: configApi,\n }),\n ],\n });\n },\n }),\n createApiFactory({\n api: oauthRequestApiRef,\n deps: {},\n factory: () => new OAuthRequestManager(),\n }),\n createApiFactory({\n api: googleAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) =>\n GoogleAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n environment: configApi.getOptionalString('auth.environment'),\n }),\n }),\n createApiFactory({\n api: microsoftAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) =>\n MicrosoftAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n environment: configApi.getOptionalString('auth.environment'),\n }),\n }),\n createApiFactory({\n api: githubAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) =>\n GithubAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n defaultScopes: ['read:user'],\n environment: configApi.getOptionalString('auth.environment'),\n }),\n }),\n createApiFactory({\n api: oktaAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) =>\n OktaAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n environment: configApi.getOptionalString('auth.environment'),\n }),\n }),\n createApiFactory({\n api: gitlabAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) =>\n GitlabAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n environment: configApi.getOptionalString('auth.environment'),\n }),\n }),\n createApiFactory({\n api: oneloginAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) =>\n OneLoginAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n environment: configApi.getOptionalString('auth.environment'),\n }),\n }),\n createApiFactory({\n api: bitbucketAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) =>\n BitbucketAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n defaultScopes: ['account'],\n environment: configApi.getOptionalString('auth.environment'),\n }),\n }),\n createApiFactory({\n api: bitbucketServerAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) =>\n BitbucketServerAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n defaultScopes: ['REPO_READ'],\n environment: configApi.getOptionalString('auth.environment'),\n }),\n }),\n createApiFactory({\n api: atlassianAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) => {\n return AtlassianAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n environment: configApi.getOptionalString('auth.environment'),\n });\n },\n }),\n createApiFactory({\n api: vmwareCloudAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) => {\n return VMwareCloudAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n environment: configApi.getOptionalString('auth.environment'),\n });\n },\n }),\n createApiFactory({\n api: permissionApiRef,\n deps: {\n discovery: discoveryApiRef,\n identity: identityApiRef,\n config: configApiRef,\n },\n factory: ({ config, discovery, identity }) =>\n IdentityPermissionApi.create({ config, discovery, identity }),\n }),\n];\n"],"names":[],"mappings":";;;;AAkEoB;AAAA,EAClB,gBAAA,CAAiB;AAAA,IACf,GAAA,EAAK,eAAA;AAAA,IACL,IAAA,EAAM,EAAE,SAAA,EAAW,YAAA,EAAa;AAAA,IAChC,SAAS,CAAC,EAAE,WAAU,KAAM,qBAAA,CAAsB,WAAW,SAAS;AAAA,GACvE,CAAA;AAAA,EACD,gBAAA,CAAiB;AAAA,IACf,GAAA,EAAK,WAAA;AAAA,IACL,MAAM,EAAC;AAAA,IACP,OAAA,EAAS,MAAM,IAAI,iBAAA;AAAkB,GACtC,CAAA;AAAA,EACD,gBAAA,CAAiB;AAAA,IACf,GAAA,EAAK,eAAA;AAAA,IACL,MAAM,EAAC;AAAA,IACP,OAAA,EAAS,MAAM,IAAI,gBAAA;AAAiB,GACrC,CAAA;AAAA,EACD,gBAAA,CAAiB;AAAA,IACf,GAAA,EAAK,WAAA;AAAA,IACL,IAAA,EAAM,EAAE,QAAA,EAAU,WAAA,EAAY;AAAA,IAC9B,OAAA,EAAS,CAAC,EAAE,QAAA,EAAS,KAAM;AACzB,MAAA,MAAM,WAAW,IAAI,YAAA,CAAa,QAAA,EAAU,IAAI,mBAAmB,CAAA;AACnE,MAAA,uBAAA,CAAwB,OAAA,CAAQ,QAAA,EAAU,EAAE,MAAA,EAAQ,OAAO,CAAA;AAC3D,MAAA,OAAO,QAAA;AAAA,IACT;AAAA,GACD,CAAA;AAAA,EACD,gBAAA,CAAiB;AAAA,IACf,GAAA,EAAK,aAAA;AAAA,IACL,IAAA,EAAM,EAAE,QAAA,EAAU,WAAA,EAAY;AAAA,IAC9B,OAAA,EAAS,CAAC,EAAE,QAAA,OAAe,UAAA,CAAW,MAAA,CAAO,EAAE,QAAA,EAAU;AAAA,GAC1D,CAAA;AAAA,EACD,gBAAA,CAAiB;AAAA,IACf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A,MACJ,SAAA,EAAW,eAAA;AAAA,MACX,QAAA,EAAU,cAAA;AAAA,MACV,MAAA,EAAQ;AAAA,KACV;AAAA,IACA,OAAA,EAAS,CAAC,EAAE,MAAA,EAAQ,SAAA,EAAW,QAAA,EAAS,KACtC,qBAAA,CAAsB,MAAA,CAAO,EAAE,MAAA,EAAQ,SAAA,EAAW,UAAU;AAAA,GAC/D;AACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icons.esm.js","sources":["../../../../../../../packages/app-defaults/src/defaults/icons.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 { IconComponent } from '@backstage/core-plugin-api';\nimport MuiApartmentIcon from '@material-ui/icons/Apartment';\nimport MuiBrokenImageIcon from '@material-ui/icons/BrokenImage';\nimport MuiCategoryIcon from '@material-ui/icons/Category';\nimport MuiCreateNewFolderIcon from '@material-ui/icons/CreateNewFolder';\nimport MuiSubjectIcon from '@material-ui/icons/Subject';\nimport MuiSearchIcon from '@material-ui/icons/Search';\nimport MuiChatIcon from '@material-ui/icons/Chat';\nimport MuiDashboardIcon from '@material-ui/icons/Dashboard';\nimport MuiDocsIcon from '@material-ui/icons/Description';\nimport MuiEmailIcon from '@material-ui/icons/Email';\nimport MuiExtensionIcon from '@material-ui/icons/Extension';\nimport MuiGitHubIcon from '@material-ui/icons/GitHub';\nimport MuiHelpIcon from '@material-ui/icons/Help';\nimport MuiLocationOnIcon from '@material-ui/icons/LocationOn';\nimport MuiMemoryIcon from '@material-ui/icons/Memory';\nimport MuiMenuBookIcon from '@material-ui/icons/MenuBook';\nimport MuiPeopleIcon from '@material-ui/icons/People';\nimport MuiPersonIcon from '@material-ui/icons/Person';\nimport MuiWarningIcon from '@material-ui/icons/Warning';\nimport MuiStorageIcon from '@material-ui/icons/Storage';\nimport MuiFeaturedPlayListIcon from '@material-ui/icons/FeaturedPlayList';\nimport Star from '@material-ui/icons/Star';\nimport StarBorder from '@material-ui/icons/StarBorder';\nimport OpenInNew from '@material-ui/icons/OpenInNew';\n\nexport const icons = {\n brokenImage: MuiBrokenImageIcon as IconComponent,\n // To be confirmed: see https://github.com/backstage/backstage/issues/4970\n catalog: MuiMenuBookIcon as IconComponent,\n scaffolder: MuiCreateNewFolderIcon as IconComponent,\n techdocs: MuiSubjectIcon as IconComponent,\n search: MuiSearchIcon as IconComponent,\n chat: MuiChatIcon as IconComponent,\n dashboard: MuiDashboardIcon as IconComponent,\n docs: MuiDocsIcon as IconComponent,\n email: MuiEmailIcon as IconComponent,\n github: MuiGitHubIcon as IconComponent,\n group: MuiPeopleIcon as IconComponent,\n help: MuiHelpIcon as IconComponent,\n 'kind:api': MuiExtensionIcon as IconComponent,\n 'kind:component': MuiMemoryIcon as IconComponent,\n 'kind:domain': MuiApartmentIcon as IconComponent,\n 'kind:group': MuiPeopleIcon as IconComponent,\n 'kind:location': MuiLocationOnIcon as IconComponent,\n 'kind:system': MuiCategoryIcon as IconComponent,\n 'kind:user': MuiPersonIcon as IconComponent,\n 'kind:resource': MuiStorageIcon as IconComponent,\n 'kind:template': MuiFeaturedPlayListIcon as IconComponent,\n user: MuiPersonIcon as IconComponent,\n warning: MuiWarningIcon as IconComponent,\n star: Star as IconComponent,\n unstarred: StarBorder as IconComponent,\n externalLink: OpenInNew as IconComponent,\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA0CO,MAAM,
|
|
1
|
+
{"version":3,"file":"icons.esm.js","sources":["../../../../../../../packages/app-defaults/src/defaults/icons.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 { IconComponent } from '@backstage/core-plugin-api';\nimport MuiApartmentIcon from '@material-ui/icons/Apartment';\nimport MuiBrokenImageIcon from '@material-ui/icons/BrokenImage';\nimport MuiCategoryIcon from '@material-ui/icons/Category';\nimport MuiCreateNewFolderIcon from '@material-ui/icons/CreateNewFolder';\nimport MuiSubjectIcon from '@material-ui/icons/Subject';\nimport MuiSearchIcon from '@material-ui/icons/Search';\nimport MuiChatIcon from '@material-ui/icons/Chat';\nimport MuiDashboardIcon from '@material-ui/icons/Dashboard';\nimport MuiDocsIcon from '@material-ui/icons/Description';\nimport MuiEmailIcon from '@material-ui/icons/Email';\nimport MuiExtensionIcon from '@material-ui/icons/Extension';\nimport MuiGitHubIcon from '@material-ui/icons/GitHub';\nimport MuiHelpIcon from '@material-ui/icons/Help';\nimport MuiLocationOnIcon from '@material-ui/icons/LocationOn';\nimport MuiMemoryIcon from '@material-ui/icons/Memory';\nimport MuiMenuBookIcon from '@material-ui/icons/MenuBook';\nimport MuiPeopleIcon from '@material-ui/icons/People';\nimport MuiPersonIcon from '@material-ui/icons/Person';\nimport MuiWarningIcon from '@material-ui/icons/Warning';\nimport MuiStorageIcon from '@material-ui/icons/Storage';\nimport MuiFeaturedPlayListIcon from '@material-ui/icons/FeaturedPlayList';\nimport Star from '@material-ui/icons/Star';\nimport StarBorder from '@material-ui/icons/StarBorder';\nimport OpenInNew from '@material-ui/icons/OpenInNew';\n\nexport const icons = {\n brokenImage: MuiBrokenImageIcon as IconComponent,\n // To be confirmed: see https://github.com/backstage/backstage/issues/4970\n catalog: MuiMenuBookIcon as IconComponent,\n scaffolder: MuiCreateNewFolderIcon as IconComponent,\n techdocs: MuiSubjectIcon as IconComponent,\n search: MuiSearchIcon as IconComponent,\n chat: MuiChatIcon as IconComponent,\n dashboard: MuiDashboardIcon as IconComponent,\n docs: MuiDocsIcon as IconComponent,\n email: MuiEmailIcon as IconComponent,\n github: MuiGitHubIcon as IconComponent,\n group: MuiPeopleIcon as IconComponent,\n help: MuiHelpIcon as IconComponent,\n 'kind:api': MuiExtensionIcon as IconComponent,\n 'kind:component': MuiMemoryIcon as IconComponent,\n 'kind:domain': MuiApartmentIcon as IconComponent,\n 'kind:group': MuiPeopleIcon as IconComponent,\n 'kind:location': MuiLocationOnIcon as IconComponent,\n 'kind:system': MuiCategoryIcon as IconComponent,\n 'kind:user': MuiPersonIcon as IconComponent,\n 'kind:resource': MuiStorageIcon as IconComponent,\n 'kind:template': MuiFeaturedPlayListIcon as IconComponent,\n user: MuiPersonIcon as IconComponent,\n warning: MuiWarningIcon as IconComponent,\n star: Star as IconComponent,\n unstarred: StarBorder as IconComponent,\n externalLink: OpenInNew as IconComponent,\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA0CO,MAAM,KAAA,GAAQ;AAAA,EACnB,WAAA,EAAa,kBAAA;AAAA;AAAA,EAEb,OAAA,EAAS,eAAA;AAAA,EACT,UAAA,EAAY,sBAAA;AAAA,EACZ,QAAA,EAAU,cAAA;AAAA,EACV,MAAA,EAAQ,aAAA;AAAA,EACR,IAAA,EAAM,WAAA;AAAA,EACN,SAAA,EAAW,gBAAA;AAAA,EACX,IAAA,EAAM,WAAA;AAAA,EACN,KAAA,EAAO,YAAA;AAAA,EACP,MAAA,EAAQ,aAAA;AAAA,EACR,KAAA,EAAO,aAAA;AAAA,EACP,IAAA,EAAM,WAAA;AAAA,EACN,UAAA,EAAY,gBAAA;AAAA,EACZ,gBAAA,EAAkB,aAAA;AAAA,EAClB,aAAA,EAAe,gBAAA;AAAA,EACf,YAAA,EAAc,aAAA;AAAA,EACd,eAAA,EAAiB,iBAAA;AAAA,EACjB,aAAA,EAAe,eAAA;AAAA,EACf,WAAA,EAAa,aAAA;AAAA,EACb,eAAA,EAAiB,cAAA;AAAA,EACjB,eAAA,EAAiB,uBAAA;AAAA,EACjB,IAAA,EAAM,aAAA;AAAA,EACN,OAAA,EAAS,cAAA;AAAA,EACT,IAAA,EAAM,IAAA;AAAA,EACN,SAAA,EAAW,UAAA;AAAA,EACX,YAAA,EAAc;AAChB;;;;"}
|
package/dist/packages/core-app-api/src/apis/implementations/AlertApi/AlertApiForwarder.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AlertApiForwarder.esm.js","sources":["../../../../../../../../../packages/core-app-api/src/apis/implementations/AlertApi/AlertApiForwarder.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 { AlertApi, AlertMessage } from '@backstage/core-plugin-api';\nimport { Observable } from '@backstage/types';\nimport { PublishSubject } from '../../../lib/subjects';\n\n/**\n * Base implementation for the AlertApi that simply forwards alerts to consumers.\n *\n * @public\n */\nexport class AlertApiForwarder implements AlertApi {\n private readonly subject = new PublishSubject<AlertMessage>();\n\n post(alert: AlertMessage) {\n this.subject.next(alert);\n }\n\n alert$(): Observable<AlertMessage> {\n return this.subject;\n }\n}\n"],"names":[],"mappings":";;AAyBO,MAAM,
|
|
1
|
+
{"version":3,"file":"AlertApiForwarder.esm.js","sources":["../../../../../../../../../packages/core-app-api/src/apis/implementations/AlertApi/AlertApiForwarder.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 { AlertApi, AlertMessage } from '@backstage/core-plugin-api';\nimport { Observable } from '@backstage/types';\nimport { PublishSubject } from '../../../lib/subjects';\n\n/**\n * Base implementation for the AlertApi that simply forwards alerts to consumers.\n *\n * @public\n */\nexport class AlertApiForwarder implements AlertApi {\n private readonly subject = new PublishSubject<AlertMessage>();\n\n post(alert: AlertMessage) {\n this.subject.next(alert);\n }\n\n alert$(): Observable<AlertMessage> {\n return this.subject;\n }\n}\n"],"names":[],"mappings":";;AAyBO,MAAM,iBAAA,CAAsC;AAAA,EAChC,OAAA,GAAU,IAAI,cAAA,EAA6B;AAAA,EAE5D,KAAK,KAAA,EAAqB;AACxB,IAAA,IAAA,CAAK,OAAA,CAAQ,KAAK,KAAK,CAAA;AAAA,EACzB;AAAA,EAEA,MAAA,GAAmC;AACjC,IAAA,OAAO,IAAA,CAAK,OAAA;AAAA,EACd;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppLanguageSelector.esm.js","sources":["../../../../../../../../../packages/core-app-api/src/apis/implementations/AppLanguageApi/AppLanguageSelector.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\n// Internal import to avoid code duplication, this will lead to duplication in build output\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { AppLanguageApi } from '@backstage/core-plugin-api/alpha';\nimport { Observable } from '@backstage/types';\nimport { BehaviorSubject } from '../../../lib';\n\nconst STORAGE_KEY = 'language';\nexport const DEFAULT_LANGUAGE = 'en';\n\n/** @alpha */\nexport interface AppLanguageSelectorOptions {\n defaultLanguage?: string;\n availableLanguages?: string[];\n}\n\n/**\n * Exposes the available languages in the app and allows for switching of the active language.\n *\n * @alpha\n */\nexport class AppLanguageSelector implements AppLanguageApi {\n static create(options?: AppLanguageSelectorOptions) {\n const languages = options?.availableLanguages ?? [DEFAULT_LANGUAGE];\n if (languages.length !== new Set(languages).size) {\n throw new Error(\n `Supported languages may not contain duplicates, got '${languages.join(\n \"', '\",\n )}'`,\n );\n }\n if (!languages.includes(DEFAULT_LANGUAGE)) {\n throw new Error(`Supported languages must include '${DEFAULT_LANGUAGE}'`);\n }\n\n const initialLanguage = options?.defaultLanguage ?? DEFAULT_LANGUAGE;\n if (!languages.includes(initialLanguage)) {\n throw new Error(\n `Initial language must be one of the supported languages, got '${initialLanguage}'`,\n );\n }\n\n return new AppLanguageSelector(languages, initialLanguage);\n }\n\n static createWithStorage(options?: AppLanguageSelectorOptions) {\n const selector = AppLanguageSelector.create(options);\n\n if (!window.localStorage) {\n return selector;\n }\n\n const storedLanguage = window.localStorage.getItem(STORAGE_KEY);\n const { languages } = selector.getAvailableLanguages();\n if (storedLanguage && languages.includes(storedLanguage)) {\n selector.setLanguage(storedLanguage);\n }\n\n selector.language$().subscribe(({ language }) => {\n if (language !== window.localStorage.getItem(STORAGE_KEY)) {\n window.localStorage.setItem(STORAGE_KEY, language);\n }\n });\n\n window.addEventListener('storage', event => {\n if (event.key === STORAGE_KEY) {\n const language = localStorage.getItem(STORAGE_KEY) ?? undefined;\n if (language) {\n selector.setLanguage(language);\n }\n }\n });\n\n return selector;\n }\n\n #languages: string[];\n #language: string;\n #subject: BehaviorSubject<{ language: string }>;\n\n private constructor(languages: string[], initialLanguage: string) {\n this.#languages = languages;\n this.#language = initialLanguage;\n this.#subject = new BehaviorSubject<{ language: string }>({\n language: this.#language,\n });\n }\n\n getAvailableLanguages(): { languages: string[] } {\n return { languages: this.#languages.slice() };\n }\n\n setLanguage(language?: string | undefined): void {\n const lng = language ?? DEFAULT_LANGUAGE;\n if (lng === this.#language) {\n return;\n }\n if (lng && !this.#languages.includes(lng)) {\n throw new Error(\n `Failed to change language to '${lng}', available languages are '${this.#languages.join(\n \"', '\",\n )}'`,\n );\n }\n this.#language = lng;\n this.#subject.next({ language: lng });\n }\n\n getLanguage(): { language: string } {\n return { language: this.#language };\n }\n\n language$(): Observable<{ language: string }> {\n return this.#subject;\n }\n}\n"],"names":[],"mappings":";;;AAsBA,MAAM,
|
|
1
|
+
{"version":3,"file":"AppLanguageSelector.esm.js","sources":["../../../../../../../../../packages/core-app-api/src/apis/implementations/AppLanguageApi/AppLanguageSelector.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\n// Internal import to avoid code duplication, this will lead to duplication in build output\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { AppLanguageApi } from '@backstage/core-plugin-api/alpha';\nimport { Observable } from '@backstage/types';\nimport { BehaviorSubject } from '../../../lib';\n\nconst STORAGE_KEY = 'language';\nexport const DEFAULT_LANGUAGE = 'en';\n\n/** @alpha */\nexport interface AppLanguageSelectorOptions {\n defaultLanguage?: string;\n availableLanguages?: string[];\n}\n\n/**\n * Exposes the available languages in the app and allows for switching of the active language.\n *\n * @alpha\n */\nexport class AppLanguageSelector implements AppLanguageApi {\n static create(options?: AppLanguageSelectorOptions) {\n const languages = options?.availableLanguages ?? [DEFAULT_LANGUAGE];\n if (languages.length !== new Set(languages).size) {\n throw new Error(\n `Supported languages may not contain duplicates, got '${languages.join(\n \"', '\",\n )}'`,\n );\n }\n if (!languages.includes(DEFAULT_LANGUAGE)) {\n throw new Error(`Supported languages must include '${DEFAULT_LANGUAGE}'`);\n }\n\n const initialLanguage = options?.defaultLanguage ?? DEFAULT_LANGUAGE;\n if (!languages.includes(initialLanguage)) {\n throw new Error(\n `Initial language must be one of the supported languages, got '${initialLanguage}'`,\n );\n }\n\n return new AppLanguageSelector(languages, initialLanguage);\n }\n\n static createWithStorage(options?: AppLanguageSelectorOptions) {\n const selector = AppLanguageSelector.create(options);\n\n if (!window.localStorage) {\n return selector;\n }\n\n const storedLanguage = window.localStorage.getItem(STORAGE_KEY);\n const { languages } = selector.getAvailableLanguages();\n if (storedLanguage && languages.includes(storedLanguage)) {\n selector.setLanguage(storedLanguage);\n }\n\n selector.language$().subscribe(({ language }) => {\n if (language !== window.localStorage.getItem(STORAGE_KEY)) {\n window.localStorage.setItem(STORAGE_KEY, language);\n }\n });\n\n window.addEventListener('storage', event => {\n if (event.key === STORAGE_KEY) {\n const language = localStorage.getItem(STORAGE_KEY) ?? undefined;\n if (language) {\n selector.setLanguage(language);\n }\n }\n });\n\n return selector;\n }\n\n #languages: string[];\n #language: string;\n #subject: BehaviorSubject<{ language: string }>;\n\n private constructor(languages: string[], initialLanguage: string) {\n this.#languages = languages;\n this.#language = initialLanguage;\n this.#subject = new BehaviorSubject<{ language: string }>({\n language: this.#language,\n });\n }\n\n getAvailableLanguages(): { languages: string[] } {\n return { languages: this.#languages.slice() };\n }\n\n setLanguage(language?: string | undefined): void {\n const lng = language ?? DEFAULT_LANGUAGE;\n if (lng === this.#language) {\n return;\n }\n if (lng && !this.#languages.includes(lng)) {\n throw new Error(\n `Failed to change language to '${lng}', available languages are '${this.#languages.join(\n \"', '\",\n )}'`,\n );\n }\n this.#language = lng;\n this.#subject.next({ language: lng });\n }\n\n getLanguage(): { language: string } {\n return { language: this.#language };\n }\n\n language$(): Observable<{ language: string }> {\n return this.#subject;\n }\n}\n"],"names":[],"mappings":";;;AAsBA,MAAM,WAAA,GAAc,UAAA;AACb,MAAM,gBAAA,GAAmB;AAazB,MAAM,mBAAA,CAA8C;AAAA,EACzD,OAAO,OAAO,OAAA,EAAsC;AAClD,IAAA,MAAM,SAAA,GAAY,OAAA,EAAS,kBAAA,IAAsB,CAAC,gBAAgB,CAAA;AAClE,IAAA,IAAI,UAAU,MAAA,KAAW,IAAI,GAAA,CAAI,SAAS,EAAE,IAAA,EAAM;AAChD,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,wDAAwD,SAAA,CAAU,IAAA;AAAA,UAChE;AAAA,SACD,CAAA,CAAA;AAAA,OACH;AAAA,IACF;AACA,IAAA,IAAI,CAAC,SAAA,CAAU,QAAA,CAAS,gBAAgB,CAAA,EAAG;AACzC,MAAA,MAAM,IAAI,KAAA,CAAM,CAAA,kCAAA,EAAqC,gBAAgB,CAAA,CAAA,CAAG,CAAA;AAAA,IAC1E;AAEA,IAAA,MAAM,eAAA,GAAkB,SAAS,eAAA,IAAmB,gBAAA;AACpD,IAAA,IAAI,CAAC,SAAA,CAAU,QAAA,CAAS,eAAe,CAAA,EAAG;AACxC,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,iEAAiE,eAAe,CAAA,CAAA;AAAA,OAClF;AAAA,IACF;AAEA,IAAA,OAAO,IAAI,mBAAA,CAAoB,SAAA,EAAW,eAAe,CAAA;AAAA,EAC3D;AAAA,EAEA,OAAO,kBAAkB,OAAA,EAAsC;AAC7D,IAAA,MAAM,QAAA,GAAW,mBAAA,CAAoB,MAAA,CAAO,OAAO,CAAA;AAEnD,IAAA,IAAI,CAAC,OAAO,YAAA,EAAc;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EA,qBAAA,GAAiD;AAC/C,IAAA,OAAO,EAAE,SAAA,EAAW,IAAA,CAAK,UAAA,CAAW,OAAM,EAAE;AAAA,EAC9C;AAAA,EAEA,YAAY,QAAA,EAAqC;AAC/C,IAAA,MAAM,MAAM,QAAA,IAAY,gBAAA;AACxB,IAAA,IAAI,GAAA,KAAQ,KAAK,SAAA,EAAW;AAC1B,MAAA;AAAA,IACF;AACA,IAAA,IAAI,OAAO,CAAC,IAAA,CAAK,UAAA,CAAW,QAAA,CAAS,GAAG,CAAA,EAAG;AACzC,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,CAAA,8BAAA,EAAiC,GAAG,CAAA,4BAAA,EAA+B,IAAA,CAAK,UAAA,CAAW,IAAA;AAAA,UACjF;AAAA,SACD,CAAA,CAAA;AAAA,OACH;AAAA,IACF;AACA,IAAA,IAAA,CAAK,SAAA,GAAY,GAAA;AACjB,IAAA,IAAA,CAAK,QAAA,CAAS,IAAA,CAAK,EAAE,QAAA,EAAU,KAAK,CAAA;AAAA,EACtC;AAAA,EAEA,WAAA,GAAoC;AAClC,IAAA,OAAO,EAAE,QAAA,EAAU,IAAA,CAAK,SAAA,EAAU;AAAA,EACpC;AAAA,EAEA,SAAA,GAA8C;AAC5C,IAAA,OAAO,IAAA,CAAK,QAAA;AAAA,EACd;AACF;;;;"}
|
package/dist/packages/core-app-api/src/apis/implementations/AppThemeApi/AppThemeSelector.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppThemeSelector.esm.js","sources":["../../../../../../../../../packages/core-app-api/src/apis/implementations/AppThemeApi/AppThemeSelector.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 { AppThemeApi, AppTheme } from '@backstage/core-plugin-api';\nimport { Observable } from '@backstage/types';\nimport { BehaviorSubject } from '../../../lib/subjects';\n\nconst STORAGE_KEY = 'theme';\n\n/**\n * Exposes the themes installed in the app, and permits switching the currently\n * active theme.\n *\n * @public\n */\nexport class AppThemeSelector implements AppThemeApi {\n static createWithStorage(themes: AppTheme[]) {\n const selector = new AppThemeSelector(themes);\n\n if (!window.localStorage) {\n return selector;\n }\n\n const initialThemeId =\n window.localStorage.getItem(STORAGE_KEY) ?? undefined;\n\n selector.setActiveThemeId(initialThemeId);\n\n selector.activeThemeId$().subscribe(themeId => {\n if (themeId) {\n window.localStorage.setItem(STORAGE_KEY, themeId);\n } else {\n window.localStorage.removeItem(STORAGE_KEY);\n }\n });\n\n window.addEventListener('storage', event => {\n if (event.key === STORAGE_KEY) {\n const themeId = localStorage.getItem(STORAGE_KEY) ?? undefined;\n selector.setActiveThemeId(themeId);\n }\n });\n\n return selector;\n }\n\n private activeThemeId: string | undefined;\n private readonly subject = new BehaviorSubject<string | undefined>(undefined);\n\n constructor(private readonly themes: AppTheme[]) {}\n\n getInstalledThemes(): AppTheme[] {\n return this.themes.slice();\n }\n\n activeThemeId$(): Observable<string | undefined> {\n return this.subject;\n }\n\n getActiveThemeId(): string | undefined {\n return this.activeThemeId;\n }\n\n setActiveThemeId(themeId?: string): void {\n this.activeThemeId = themeId;\n this.subject.next(themeId);\n }\n}\n"],"names":[],"mappings":";;AAoBA,MAAM,
|
|
1
|
+
{"version":3,"file":"AppThemeSelector.esm.js","sources":["../../../../../../../../../packages/core-app-api/src/apis/implementations/AppThemeApi/AppThemeSelector.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 { AppThemeApi, AppTheme } from '@backstage/core-plugin-api';\nimport { Observable } from '@backstage/types';\nimport { BehaviorSubject } from '../../../lib/subjects';\n\nconst STORAGE_KEY = 'theme';\n\n/**\n * Exposes the themes installed in the app, and permits switching the currently\n * active theme.\n *\n * @public\n */\nexport class AppThemeSelector implements AppThemeApi {\n static createWithStorage(themes: AppTheme[]) {\n const selector = new AppThemeSelector(themes);\n\n if (!window.localStorage) {\n return selector;\n }\n\n const initialThemeId =\n window.localStorage.getItem(STORAGE_KEY) ?? undefined;\n\n selector.setActiveThemeId(initialThemeId);\n\n selector.activeThemeId$().subscribe(themeId => {\n if (themeId) {\n window.localStorage.setItem(STORAGE_KEY, themeId);\n } else {\n window.localStorage.removeItem(STORAGE_KEY);\n }\n });\n\n window.addEventListener('storage', event => {\n if (event.key === STORAGE_KEY) {\n const themeId = localStorage.getItem(STORAGE_KEY) ?? undefined;\n selector.setActiveThemeId(themeId);\n }\n });\n\n return selector;\n }\n\n private activeThemeId: string | undefined;\n private readonly subject = new BehaviorSubject<string | undefined>(undefined);\n\n constructor(private readonly themes: AppTheme[]) {}\n\n getInstalledThemes(): AppTheme[] {\n return this.themes.slice();\n }\n\n activeThemeId$(): Observable<string | undefined> {\n return this.subject;\n }\n\n getActiveThemeId(): string | undefined {\n return this.activeThemeId;\n }\n\n setActiveThemeId(themeId?: string): void {\n this.activeThemeId = themeId;\n this.subject.next(themeId);\n }\n}\n"],"names":[],"mappings":";;AAoBA,MAAM,WAAA,GAAc,OAAA;AAQb,MAAM,gBAAA,CAAwC;AAAA,EAkCnD,YAA6B,MAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,MAAA,GAAA,MAAA;AAAA,EAAqB;AAAA,EAjClD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,OAAA,EAAwB;AACvC,IAAA,IAAA,CAAK,aAAA,GAAgB,OAAA;AACrB,IAAA,IAAA,CAAK,OAAA,CAAQ,KAAK,OAAO,CAAA;AAAA,EAC3B;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UrlPatternDiscovery.esm.js","sources":["../../../../../../../../../packages/core-app-api/src/apis/implementations/DiscoveryApi/UrlPatternDiscovery.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 { DiscoveryApi } from '@backstage/core-plugin-api';\n\nconst ERROR_PREFIX = 'Invalid discovery URL pattern,';\n\n/**\n * UrlPatternDiscovery is a lightweight DiscoveryApi implementation.\n * It uses a single template string to construct URLs for each plugin.\n *\n * @public\n */\nexport class UrlPatternDiscovery implements DiscoveryApi {\n /**\n * Creates a new UrlPatternDiscovery given a template. The only\n * interpolation done for the template is to replace instances of `{{pluginId}}`\n * with the ID of the plugin being requested.\n *\n * Example pattern: `http://localhost:7007/api/{{ pluginId }}`\n */\n static compile(pattern: string): UrlPatternDiscovery {\n const parts = pattern.split(/\\{\\{\\s*pluginId\\s*\\}\\}/);\n const urlStr = parts.join('pluginId');\n\n let url;\n try {\n url = new URL(urlStr);\n } catch {\n throw new Error(`${ERROR_PREFIX} URL '${urlStr}' is invalid`);\n }\n if (url.hash) {\n throw new Error(`${ERROR_PREFIX} URL must not have a hash`);\n }\n if (url.search) {\n throw new Error(`${ERROR_PREFIX} URL must not have a query`);\n }\n if (urlStr.endsWith('/')) {\n throw new Error(`${ERROR_PREFIX} URL must not end with a slash`);\n }\n\n return new UrlPatternDiscovery(parts);\n }\n\n private constructor(private readonly parts: string[]) {}\n\n async getBaseUrl(pluginId: string): Promise<string> {\n return this.parts.join(encodeURIComponent(pluginId));\n }\n}\n"],"names":[],"mappings":"AAkBA,MAAM,
|
|
1
|
+
{"version":3,"file":"UrlPatternDiscovery.esm.js","sources":["../../../../../../../../../packages/core-app-api/src/apis/implementations/DiscoveryApi/UrlPatternDiscovery.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 { DiscoveryApi } from '@backstage/core-plugin-api';\n\nconst ERROR_PREFIX = 'Invalid discovery URL pattern,';\n\n/**\n * UrlPatternDiscovery is a lightweight DiscoveryApi implementation.\n * It uses a single template string to construct URLs for each plugin.\n *\n * @public\n */\nexport class UrlPatternDiscovery implements DiscoveryApi {\n /**\n * Creates a new UrlPatternDiscovery given a template. The only\n * interpolation done for the template is to replace instances of `{{pluginId}}`\n * with the ID of the plugin being requested.\n *\n * Example pattern: `http://localhost:7007/api/{{ pluginId }}`\n */\n static compile(pattern: string): UrlPatternDiscovery {\n const parts = pattern.split(/\\{\\{\\s*pluginId\\s*\\}\\}/);\n const urlStr = parts.join('pluginId');\n\n let url;\n try {\n url = new URL(urlStr);\n } catch {\n throw new Error(`${ERROR_PREFIX} URL '${urlStr}' is invalid`);\n }\n if (url.hash) {\n throw new Error(`${ERROR_PREFIX} URL must not have a hash`);\n }\n if (url.search) {\n throw new Error(`${ERROR_PREFIX} URL must not have a query`);\n }\n if (urlStr.endsWith('/')) {\n throw new Error(`${ERROR_PREFIX} URL must not end with a slash`);\n }\n\n return new UrlPatternDiscovery(parts);\n }\n\n private constructor(private readonly parts: string[]) {}\n\n async getBaseUrl(pluginId: string): Promise<string> {\n return this.parts.join(encodeURIComponent(pluginId));\n }\n}\n"],"names":[],"mappings":"AAkBA,MAAM,YAAA,GAAe,gCAAA;AAQd,MAAM,mBAAA,CAA4C;AAAA,EA+B/C,YAA6B,KAAA,EAAiB;AAAjB,IAAA,IAAA,CAAA,KAAA,GAAA,KAAA;AAAA,EAAkB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAvBvD,OAAO,QAAQ,OAAA,EAAsC;AACnD,IAAA,MAAM,KAAA,GAAQ,OAAA,CAAQ,KAAA,CAAM,wBAAwB,CAAA;AACpD,IAAA,MAAM,MAAA,GAAS,KAAA,CAAM,IAAA,CAAK,UAAU,CAAA;AAEpC,IAAA,IAAI,GAAA;AACJ,IAAA,IAAI;AACF,MAAA,GAAA,GAAM,IAAI,IAAI,MAAM,CAAA;AAAA,IACtB,CAAA,CAAA,MAAQ;AACN,MAAA,MAAM,IAAI,KAAA,CAAM,CAAA,EAAG,YAAY,CAAA,MAAA,EAAS,MAAM,CAAA,YAAA,CAAc,CAAA;AAAA,IAC9D;AACA,IAAA,IAAI,IAAI,IAAA,EAAM;AACZ,MAAA,MAAM,IAAI,KAAA,CAAM,CAAA,EAAG,YAAY,CAAA,yBAAA,CAA2B,CAAA;AAAA,IAC5D;AACA,IAAA,IAAI,IAAI,MAAA,EAAQ;AACd,MAAA,MAAM,IAAI,KAAA,CAAM,CAAA,EAAG,YAAY,CAAA,0BAAA,CAA4B,CAAA;AAAA,IAC7D;AACA,IAAA,IAAI,MAAA,CAAO,QAAA,CAAS,GAAG,CAAA,EAAG;AACxB,MAAA,MAAM,IAAI,KAAA,CAAM,CAAA,EAAG,YAAY,CAAA,8BAAA,CAAgC,CAAA;AAAA,IACjE;AAEA,IAAA,OAAO,IAAI,oBAAoB,KAAK,CAAA;AAAA,EACtC;AAAA,EAIA,MAAM,WAAW,QAAA,EAAmC;AAClD,IAAA,OAAO,IAAA,CAAK,KAAA,CAAM,IAAA,CAAK,kBAAA,CAAmB,QAAQ,CAAC,CAAA;AAAA,EACrD;AACF;;;;"}
|
package/dist/packages/core-app-api/src/apis/implementations/ErrorApi/ErrorAlerter.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorAlerter.esm.js","sources":["../../../../../../../../../packages/core-app-api/src/apis/implementations/ErrorApi/ErrorAlerter.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 {\n ErrorApi,\n ErrorApiError,\n ErrorApiErrorContext,\n AlertApi,\n} from '@backstage/core-plugin-api';\n\n/**\n * Decorates an ErrorApi by also forwarding error messages\n * to the alertApi with an 'error' severity.\n *\n * @public\n */\nexport class ErrorAlerter implements ErrorApi {\n constructor(\n private readonly alertApi: AlertApi,\n private readonly errorApi: ErrorApi,\n ) {}\n\n post(error: ErrorApiError, context?: ErrorApiErrorContext) {\n if (!context?.hidden) {\n this.alertApi.post({ message: error.message, severity: 'error' });\n }\n\n return this.errorApi.post(error, context);\n }\n\n error$() {\n return this.errorApi.error$();\n }\n}\n"],"names":[],"mappings":"AA4BO,MAAM,
|
|
1
|
+
{"version":3,"file":"ErrorAlerter.esm.js","sources":["../../../../../../../../../packages/core-app-api/src/apis/implementations/ErrorApi/ErrorAlerter.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 {\n ErrorApi,\n ErrorApiError,\n ErrorApiErrorContext,\n AlertApi,\n} from '@backstage/core-plugin-api';\n\n/**\n * Decorates an ErrorApi by also forwarding error messages\n * to the alertApi with an 'error' severity.\n *\n * @public\n */\nexport class ErrorAlerter implements ErrorApi {\n constructor(\n private readonly alertApi: AlertApi,\n private readonly errorApi: ErrorApi,\n ) {}\n\n post(error: ErrorApiError, context?: ErrorApiErrorContext) {\n if (!context?.hidden) {\n this.alertApi.post({ message: error.message, severity: 'error' });\n }\n\n return this.errorApi.post(error, context);\n }\n\n error$() {\n return this.errorApi.error$();\n }\n}\n"],"names":[],"mappings":"AA4BO,MAAM,YAAA,CAAiC;AAAA,EAC5C,WAAA,CACmB,UACA,QAAA,EACjB;AAFiB,IAAA,IAAA,CAAA,QAAA,GAAA,QAAA;AACA,IAAA,IAAA,CAAA,QAAA,GAAA,QAAA;AAAA,EAChB;AAAA,EAEH,IAAA,CAAK,OAAsB,OAAA,EAAgC;AACzD,IAAA,IAAI,CAAC,SAAS,MAAA,EAAQ;AACpB,MAAA,IAAA,CAAK,QAAA,CAAS,KAAK,EAAE,OAAA,EAAS,MAAM,OAAA,EAAS,QAAA,EAAU,SAAS,CAAA;AAAA,IAClE;AAEA,IAAA,OAAO,IAAA,CAAK,QAAA,CAAS,IAAA,CAAK,KAAA,EAAO,OAAO,CAAA;AAAA,EAC1C;AAAA,EAEA,MAAA,GAAS;AACP,IAAA,OAAO,IAAA,CAAK,SAAS,MAAA,EAAO;AAAA,EAC9B;AACF;;;;"}
|
package/dist/packages/core-app-api/src/apis/implementations/ErrorApi/ErrorApiForwarder.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorApiForwarder.esm.js","sources":["../../../../../../../../../packages/core-app-api/src/apis/implementations/ErrorApi/ErrorApiForwarder.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 {\n ErrorApi,\n ErrorApiError,\n ErrorApiErrorContext,\n} from '@backstage/core-plugin-api';\nimport { Observable } from '@backstage/types';\nimport { PublishSubject } from '../../../lib/subjects';\n\n/**\n * Base implementation for the ErrorApi that simply forwards errors to consumers.\n *\n * @public\n */\nexport class ErrorApiForwarder implements ErrorApi {\n private readonly subject = new PublishSubject<{\n error: Error;\n context?: ErrorApiErrorContext;\n }>();\n\n post(error: ErrorApiError, context?: ErrorApiErrorContext) {\n this.subject.next({ error, context });\n }\n\n error$(): Observable<{ error: Error; context?: ErrorApiErrorContext }> {\n return this.subject;\n }\n}\n"],"names":[],"mappings":";;AA6BO,MAAM,
|
|
1
|
+
{"version":3,"file":"ErrorApiForwarder.esm.js","sources":["../../../../../../../../../packages/core-app-api/src/apis/implementations/ErrorApi/ErrorApiForwarder.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 {\n ErrorApi,\n ErrorApiError,\n ErrorApiErrorContext,\n} from '@backstage/core-plugin-api';\nimport { Observable } from '@backstage/types';\nimport { PublishSubject } from '../../../lib/subjects';\n\n/**\n * Base implementation for the ErrorApi that simply forwards errors to consumers.\n *\n * @public\n */\nexport class ErrorApiForwarder implements ErrorApi {\n private readonly subject = new PublishSubject<{\n error: Error;\n context?: ErrorApiErrorContext;\n }>();\n\n post(error: ErrorApiError, context?: ErrorApiErrorContext) {\n this.subject.next({ error, context });\n }\n\n error$(): Observable<{ error: Error; context?: ErrorApiErrorContext }> {\n return this.subject;\n }\n}\n"],"names":[],"mappings":";;AA6BO,MAAM,iBAAA,CAAsC;AAAA,EAChC,OAAA,GAAU,IAAI,cAAA,EAG5B;AAAA,EAEH,IAAA,CAAK,OAAsB,OAAA,EAAgC;AACzD,IAAA,IAAA,CAAK,OAAA,CAAQ,IAAA,CAAK,EAAE,KAAA,EAAO,SAAS,CAAA;AAAA,EACtC;AAAA,EAEA,MAAA,GAAuE;AACrE,IAAA,OAAO,IAAA,CAAK,OAAA;AAAA,EACd;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnhandledErrorForwarder.esm.js","sources":["../../../../../../../../../packages/core-app-api/src/apis/implementations/ErrorApi/UnhandledErrorForwarder.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 {\n ErrorApi,\n ErrorApiError,\n ErrorApiErrorContext,\n} from '@backstage/core-plugin-api';\n\n/**\n * Utility class that helps with error forwarding.\n *\n * @public\n */\nexport class UnhandledErrorForwarder {\n /**\n * Add event listener, such that unhandled errors can be forwarded using an given `ErrorApi` instance\n */\n static forward(errorApi: ErrorApi, errorContext: ErrorApiErrorContext) {\n window.addEventListener(\n 'unhandledrejection',\n (e: PromiseRejectionEvent) => {\n errorApi.post(e.reason as ErrorApiError, errorContext);\n },\n );\n }\n}\n"],"names":[],"mappings":"AA2BO,MAAM,
|
|
1
|
+
{"version":3,"file":"UnhandledErrorForwarder.esm.js","sources":["../../../../../../../../../packages/core-app-api/src/apis/implementations/ErrorApi/UnhandledErrorForwarder.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 {\n ErrorApi,\n ErrorApiError,\n ErrorApiErrorContext,\n} from '@backstage/core-plugin-api';\n\n/**\n * Utility class that helps with error forwarding.\n *\n * @public\n */\nexport class UnhandledErrorForwarder {\n /**\n * Add event listener, such that unhandled errors can be forwarded using an given `ErrorApi` instance\n */\n static forward(errorApi: ErrorApi, errorContext: ErrorApiErrorContext) {\n window.addEventListener(\n 'unhandledrejection',\n (e: PromiseRejectionEvent) => {\n errorApi.post(e.reason as ErrorApiError, errorContext);\n },\n );\n }\n}\n"],"names":[],"mappings":"AA2BO,MAAM,uBAAA,CAAwB;AAAA;AAAA;AAAA;AAAA,EAInC,OAAO,OAAA,CAAQ,QAAA,EAAoB,YAAA,EAAoC;AACrE,IAAA,MAAA,CAAO,gBAAA;AAAA,MACL,oBAAA;AAAA,MACA,CAAC,CAAA,KAA6B;AAC5B,QAAA,QAAA,CAAS,IAAA,CAAK,CAAA,CAAE,MAAA,EAAyB,YAAY,CAAA;AAAA,MACvD;AAAA,KACF;AAAA,EACF;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocalStorageFeatureFlags.esm.js","sources":["../../../../../../../../../packages/core-app-api/src/apis/implementations/FeatureFlagsApi/LocalStorageFeatureFlags.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 {\n FeatureFlagState,\n FeatureFlagsApi,\n FeatureFlag,\n FeatureFlagsSaveOptions,\n} from '@backstage/core-plugin-api';\n\nexport function validateFlagName(name: string): void {\n if (name.length < 3) {\n throw new Error(\n `The '${name}' feature flag must have a minimum length of three characters.`,\n );\n }\n\n if (name.length > 150) {\n throw new Error(\n `The '${name}' feature flag must not exceed 150 characters.`,\n );\n }\n\n if (!name.match(/^[a-z]+[a-z0-9-]+$/)) {\n throw new Error(\n `The '${name}' feature flag must start with a lowercase letter and only contain lowercase letters, numbers and hyphens. ` +\n 'Examples: feature-flag-one, alpha, release-2020',\n );\n }\n}\n\n/**\n * A feature flags implementation that stores the flags in the browser's local\n * storage.\n *\n * @public\n */\nexport class LocalStorageFeatureFlags implements FeatureFlagsApi {\n private registeredFeatureFlags: FeatureFlag[] = [];\n private flags?: Map<string, FeatureFlagState>;\n\n registerFlag(flag: FeatureFlag) {\n validateFlagName(flag.name);\n this.registeredFeatureFlags.push(flag);\n }\n\n getRegisteredFlags(): FeatureFlag[] {\n return this.registeredFeatureFlags.slice();\n }\n\n isActive(name: string): boolean {\n if (!this.flags) {\n this.flags = this.load();\n }\n return this.flags.get(name) === FeatureFlagState.Active;\n }\n\n save(options: FeatureFlagsSaveOptions): void {\n if (!this.flags) {\n this.flags = this.load();\n }\n if (!options.merge) {\n this.flags.clear();\n }\n for (const [name, state] of Object.entries(options.states)) {\n this.flags.set(name, state);\n }\n\n const enabled = Array.from(this.flags.entries()).filter(\n ([, state]) => state === FeatureFlagState.Active,\n );\n window.localStorage.setItem(\n 'featureFlags',\n JSON.stringify(Object.fromEntries(enabled)),\n );\n }\n\n private load(): Map<string, FeatureFlagState> {\n try {\n const jsonStr = window.localStorage.getItem('featureFlags');\n if (!jsonStr) {\n return new Map();\n }\n const json = JSON.parse(jsonStr) as unknown;\n if (typeof json !== 'object' || json === null || Array.isArray(json)) {\n return new Map();\n }\n\n const entries = Object.entries(json).filter(([name, value]) => {\n validateFlagName(name);\n return value === FeatureFlagState.Active;\n });\n\n return new Map(entries);\n } catch {\n return new Map();\n }\n }\n}\n"],"names":[],"mappings":";;AAuBO,SAAS,iBAAiB,
|
|
1
|
+
{"version":3,"file":"LocalStorageFeatureFlags.esm.js","sources":["../../../../../../../../../packages/core-app-api/src/apis/implementations/FeatureFlagsApi/LocalStorageFeatureFlags.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 {\n FeatureFlagState,\n FeatureFlagsApi,\n FeatureFlag,\n FeatureFlagsSaveOptions,\n} from '@backstage/core-plugin-api';\n\nexport function validateFlagName(name: string): void {\n if (name.length < 3) {\n throw new Error(\n `The '${name}' feature flag must have a minimum length of three characters.`,\n );\n }\n\n if (name.length > 150) {\n throw new Error(\n `The '${name}' feature flag must not exceed 150 characters.`,\n );\n }\n\n if (!name.match(/^[a-z]+[a-z0-9-]+$/)) {\n throw new Error(\n `The '${name}' feature flag must start with a lowercase letter and only contain lowercase letters, numbers and hyphens. ` +\n 'Examples: feature-flag-one, alpha, release-2020',\n );\n }\n}\n\n/**\n * A feature flags implementation that stores the flags in the browser's local\n * storage.\n *\n * @public\n */\nexport class LocalStorageFeatureFlags implements FeatureFlagsApi {\n private registeredFeatureFlags: FeatureFlag[] = [];\n private flags?: Map<string, FeatureFlagState>;\n\n registerFlag(flag: FeatureFlag) {\n validateFlagName(flag.name);\n this.registeredFeatureFlags.push(flag);\n }\n\n getRegisteredFlags(): FeatureFlag[] {\n return this.registeredFeatureFlags.slice();\n }\n\n isActive(name: string): boolean {\n if (!this.flags) {\n this.flags = this.load();\n }\n return this.flags.get(name) === FeatureFlagState.Active;\n }\n\n save(options: FeatureFlagsSaveOptions): void {\n if (!this.flags) {\n this.flags = this.load();\n }\n if (!options.merge) {\n this.flags.clear();\n }\n for (const [name, state] of Object.entries(options.states)) {\n this.flags.set(name, state);\n }\n\n const enabled = Array.from(this.flags.entries()).filter(\n ([, state]) => state === FeatureFlagState.Active,\n );\n window.localStorage.setItem(\n 'featureFlags',\n JSON.stringify(Object.fromEntries(enabled)),\n );\n }\n\n private load(): Map<string, FeatureFlagState> {\n try {\n const jsonStr = window.localStorage.getItem('featureFlags');\n if (!jsonStr) {\n return new Map();\n }\n const json = JSON.parse(jsonStr) as unknown;\n if (typeof json !== 'object' || json === null || Array.isArray(json)) {\n return new Map();\n }\n\n const entries = Object.entries(json).filter(([name, value]) => {\n validateFlagName(name);\n return value === FeatureFlagState.Active;\n });\n\n return new Map(entries);\n } catch {\n return new Map();\n }\n }\n}\n"],"names":[],"mappings":";;AAuBO,SAAS,iBAAiB,IAAA,EAAoB;AACnD,EAAA,IAAI,IAAA,CAAK,SAAS,CAAA,EAAG;AACnB,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,QAAQ,IAAI,CAAA,8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m.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FetchMiddlewares.esm.js","sources":["../../../../../../../../../packages/core-app-api/src/apis/implementations/FetchApi/FetchMiddlewares.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 { Config } from '@backstage/config';\nimport { DiscoveryApi, IdentityApi } from '@backstage/core-plugin-api';\nimport { IdentityAuthInjectorFetchMiddleware } from './IdentityAuthInjectorFetchMiddleware';\nimport { PluginProtocolResolverFetchMiddleware } from './PluginProtocolResolverFetchMiddleware';\nimport { FetchMiddleware } from './types';\n\n/**\n * A collection of common middlewares for the FetchApi.\n *\n * @public\n */\nexport class FetchMiddlewares {\n /**\n * Handles translation from `plugin://` URLs to concrete http(s) URLs based on\n * the discovery API.\n *\n * @remarks\n *\n * If the request is for `plugin://catalog/entities?filter=x=y`, the discovery\n * API will be queried for `'catalog'`. If it returned\n * `https://backstage.example.net/api/catalog`, the resulting query would be\n * `https://backstage.example.net/api/catalog/entities?filter=x=y`.\n *\n * If the incoming URL protocol was not `plugin`, the request is just passed\n * through verbatim to the underlying implementation.\n */\n static resolvePluginProtocol(options: {\n discoveryApi: DiscoveryApi;\n }): FetchMiddleware {\n return new PluginProtocolResolverFetchMiddleware(options.discoveryApi);\n }\n\n /**\n * Injects a Backstage token header when the user is signed in.\n *\n * @remarks\n *\n * Per default, an `Authorization: Bearer <token>` is generated. This can be\n * customized using the `header` option.\n *\n * The header injection only happens on allowlisted URLs. Per default, if the\n * `config` option is passed in, the `backend.baseUrl` is allowlisted, unless\n * the `urlPrefixAllowlist` or `allowUrl` options are passed in, in which case\n * they take precedence. If you pass in neither config nor an\n * allowlist/callback, the middleware will have no effect since effectively no\n * request will match the (nonexistent) rules.\n */\n static injectIdentityAuth(options: {\n identityApi: IdentityApi;\n config?: Config;\n urlPrefixAllowlist?: string[];\n allowUrl?: (url: string) => boolean;\n header?: {\n name: string;\n value: (backstageToken: string) => string;\n };\n }): FetchMiddleware {\n return IdentityAuthInjectorFetchMiddleware.create(options);\n }\n\n private constructor() {}\n}\n"],"names":[],"mappings":";;;AA2BO,MAAM,
|
|
1
|
+
{"version":3,"file":"FetchMiddlewares.esm.js","sources":["../../../../../../../../../packages/core-app-api/src/apis/implementations/FetchApi/FetchMiddlewares.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 { Config } from '@backstage/config';\nimport { DiscoveryApi, IdentityApi } from '@backstage/core-plugin-api';\nimport { IdentityAuthInjectorFetchMiddleware } from './IdentityAuthInjectorFetchMiddleware';\nimport { PluginProtocolResolverFetchMiddleware } from './PluginProtocolResolverFetchMiddleware';\nimport { FetchMiddleware } from './types';\n\n/**\n * A collection of common middlewares for the FetchApi.\n *\n * @public\n */\nexport class FetchMiddlewares {\n /**\n * Handles translation from `plugin://` URLs to concrete http(s) URLs based on\n * the discovery API.\n *\n * @remarks\n *\n * If the request is for `plugin://catalog/entities?filter=x=y`, the discovery\n * API will be queried for `'catalog'`. If it returned\n * `https://backstage.example.net/api/catalog`, the resulting query would be\n * `https://backstage.example.net/api/catalog/entities?filter=x=y`.\n *\n * If the incoming URL protocol was not `plugin`, the request is just passed\n * through verbatim to the underlying implementation.\n */\n static resolvePluginProtocol(options: {\n discoveryApi: DiscoveryApi;\n }): FetchMiddleware {\n return new PluginProtocolResolverFetchMiddleware(options.discoveryApi);\n }\n\n /**\n * Injects a Backstage token header when the user is signed in.\n *\n * @remarks\n *\n * Per default, an `Authorization: Bearer <token>` is generated. This can be\n * customized using the `header` option.\n *\n * The header injection only happens on allowlisted URLs. Per default, if the\n * `config` option is passed in, the `backend.baseUrl` is allowlisted, unless\n * the `urlPrefixAllowlist` or `allowUrl` options are passed in, in which case\n * they take precedence. If you pass in neither config nor an\n * allowlist/callback, the middleware will have no effect since effectively no\n * request will match the (nonexistent) rules.\n */\n static injectIdentityAuth(options: {\n identityApi: IdentityApi;\n config?: Config;\n urlPrefixAllowlist?: string[];\n allowUrl?: (url: string) => boolean;\n header?: {\n name: string;\n value: (backstageToken: string) => string;\n };\n }): FetchMiddleware {\n return IdentityAuthInjectorFetchMiddleware.create(options);\n }\n\n private constructor() {}\n}\n"],"names":[],"mappings":";;;AA2BO,MAAM,gBAAA,CAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAe5B,OAAO,sBAAsB,OAAA,EAET;AAClB,IAAA,OAAO,IAAI,qCAAA,CAAsC,OAAA,CAAQ,YAAY,CAAA;AAAA,EACvE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAiBA,OAAO,mBAAmB,OAAA,EASN;AAClB,IAAA,OAAO,mCAAA,CAAoC,OAAO,OAAO,CAAA;AAAA,EAC3D;AAAA,EAEQ,WAAA,GAAc;AAAA,EAAC;AACzB;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IdentityAuthInjectorFetchMiddleware.esm.js","sources":["../../../../../../../../../packages/core-app-api/src/apis/implementations/FetchApi/IdentityAuthInjectorFetchMiddleware.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 { Config } from '@backstage/config';\nimport { IdentityApi } from '@backstage/core-plugin-api';\nimport { FetchMiddleware } from './types';\n\n/**\n * A fetch middleware, which injects a Backstage token header when the user is\n * signed in.\n */\nexport class IdentityAuthInjectorFetchMiddleware implements FetchMiddleware {\n static create(options: {\n identityApi: IdentityApi;\n config?: Config;\n urlPrefixAllowlist?: string[];\n allowUrl?: (url: string) => boolean;\n header?: {\n name: string;\n value: (backstageToken: string) => string;\n };\n }): IdentityAuthInjectorFetchMiddleware {\n const matcher = buildMatcher(options);\n const headerName = options.header?.name || 'authorization';\n const headerValue = options.header?.value || (token => `Bearer ${token}`);\n\n return new IdentityAuthInjectorFetchMiddleware(\n options.identityApi,\n matcher,\n headerName,\n headerValue,\n );\n }\n\n /**\n * Returns an array of plugin URL prefixes derived from the static `discovery`\n * configuration, to be used as `urlPrefixAllowlist` option of {@link create}.\n */\n static getDiscoveryUrlPrefixes(config: Config): string[] {\n const endpointConfigs =\n config.getOptionalConfigArray('discovery.endpoints') || [];\n return endpointConfigs.flatMap(c => {\n const target =\n typeof c.get('target') === 'object'\n ? c.getString('target.external')\n : c.getString('target');\n const plugins = c.getStringArray('plugins');\n return plugins.map(pluginId =>\n target.replace(/\\{\\{\\s*pluginId\\s*\\}\\}/g, pluginId),\n );\n });\n }\n\n constructor(\n public readonly identityApi: IdentityApi,\n public readonly allowUrl: (url: string) => boolean,\n public readonly headerName: string,\n public readonly headerValue: (pluginId: string) => string,\n ) {}\n\n apply(next: typeof fetch): typeof fetch {\n return async (input, init) => {\n // Skip this middleware if the header already exists, or if the URL\n // doesn't match any of the allowlist items, or if there was no token.\n // NOTE(freben): The \"as any\" casts here and below are because of subtle\n // undici type differences that happened in a node types bump. Those are\n // immaterial to the code at hand at runtime, as the global fetch and\n // Request are always taken from the same place.\n const request = new Request(input as any, init);\n const { token } = await this.identityApi.getCredentials();\n if (\n request.headers.get(this.headerName) ||\n typeof token !== 'string' ||\n !token ||\n !this.allowUrl(request.url)\n ) {\n return next(input as any, init);\n }\n\n request.headers.set(this.headerName, this.headerValue(token));\n return next(request);\n };\n }\n}\n\nfunction buildMatcher(options: {\n config?: Config;\n urlPrefixAllowlist?: string[];\n allowUrl?: (url: string) => boolean;\n}): (url: string) => boolean {\n if (options.allowUrl) {\n return options.allowUrl;\n } else if (options.urlPrefixAllowlist) {\n return buildPrefixMatcher(options.urlPrefixAllowlist);\n } else if (options.config) {\n return buildPrefixMatcher([\n options.config.getString('backend.baseUrl'),\n ...IdentityAuthInjectorFetchMiddleware.getDiscoveryUrlPrefixes(\n options.config,\n ),\n ]);\n }\n return () => false;\n}\n\nfunction buildPrefixMatcher(prefixes: string[]): (url: string) => boolean {\n const trimmedPrefixes = prefixes.map(prefix => prefix.replace(/\\/$/, ''));\n return url =>\n trimmedPrefixes.some(\n prefix => url === prefix || url.startsWith(`${prefix}/`),\n );\n}\n"],"names":[],"mappings":"AAwBO,MAAM,
|
|
1
|
+
{"version":3,"file":"IdentityAuthInjectorFetchMiddleware.esm.js","sources":["../../../../../../../../../packages/core-app-api/src/apis/implementations/FetchApi/IdentityAuthInjectorFetchMiddleware.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 { Config } from '@backstage/config';\nimport { IdentityApi } from '@backstage/core-plugin-api';\nimport { FetchMiddleware } from './types';\n\n/**\n * A fetch middleware, which injects a Backstage token header when the user is\n * signed in.\n */\nexport class IdentityAuthInjectorFetchMiddleware implements FetchMiddleware {\n static create(options: {\n identityApi: IdentityApi;\n config?: Config;\n urlPrefixAllowlist?: string[];\n allowUrl?: (url: string) => boolean;\n header?: {\n name: string;\n value: (backstageToken: string) => string;\n };\n }): IdentityAuthInjectorFetchMiddleware {\n const matcher = buildMatcher(options);\n const headerName = options.header?.name || 'authorization';\n const headerValue = options.header?.value || (token => `Bearer ${token}`);\n\n return new IdentityAuthInjectorFetchMiddleware(\n options.identityApi,\n matcher,\n headerName,\n headerValue,\n );\n }\n\n /**\n * Returns an array of plugin URL prefixes derived from the static `discovery`\n * configuration, to be used as `urlPrefixAllowlist` option of {@link create}.\n */\n static getDiscoveryUrlPrefixes(config: Config): string[] {\n const endpointConfigs =\n config.getOptionalConfigArray('discovery.endpoints') || [];\n return endpointConfigs.flatMap(c => {\n const target =\n typeof c.get('target') === 'object'\n ? c.getString('target.external')\n : c.getString('target');\n const plugins = c.getStringArray('plugins');\n return plugins.map(pluginId =>\n target.replace(/\\{\\{\\s*pluginId\\s*\\}\\}/g, pluginId),\n );\n });\n }\n\n constructor(\n public readonly identityApi: IdentityApi,\n public readonly allowUrl: (url: string) => boolean,\n public readonly headerName: string,\n public readonly headerValue: (pluginId: string) => string,\n ) {}\n\n apply(next: typeof fetch): typeof fetch {\n return async (input, init) => {\n // Skip this middleware if the header already exists, or if the URL\n // doesn't match any of the allowlist items, or if there was no token.\n // NOTE(freben): The \"as any\" casts here and below are because of subtle\n // undici type differences that happened in a node types bump. Those are\n // immaterial to the code at hand at runtime, as the global fetch and\n // Request are always taken from the same place.\n const request = new Request(input as any, init);\n const { token } = await this.identityApi.getCredentials();\n if (\n request.headers.get(this.headerName) ||\n typeof token !== 'string' ||\n !token ||\n !this.allowUrl(request.url)\n ) {\n return next(input as any, init);\n }\n\n request.headers.set(this.headerName, this.headerValue(token));\n return next(request);\n };\n }\n}\n\nfunction buildMatcher(options: {\n config?: Config;\n urlPrefixAllowlist?: string[];\n allowUrl?: (url: string) => boolean;\n}): (url: string) => boolean {\n if (options.allowUrl) {\n return options.allowUrl;\n } else if (options.urlPrefixAllowlist) {\n return buildPrefixMatcher(options.urlPrefixAllowlist);\n } else if (options.config) {\n return buildPrefixMatcher([\n options.config.getString('backend.baseUrl'),\n ...IdentityAuthInjectorFetchMiddleware.getDiscoveryUrlPrefixes(\n options.config,\n ),\n ]);\n }\n return () => false;\n}\n\nfunction buildPrefixMatcher(prefixes: string[]): (url: string) => boolean {\n const trimmedPrefixes = prefixes.map(prefix => prefix.replace(/\\/$/, ''));\n return url =>\n trimmedPrefixes.some(\n prefix => url === prefix || url.startsWith(`${prefix}/`),\n );\n}\n"],"names":[],"mappings":"AAwBO,MAAM,mCAAA,CAA+D;AAAA,EA0C1E,WAAA,CACkB,WAAA,EACA,QAAA,EACA,UAAA,EACA,WAAA,EAChB;AAJgB,IAAA,IAAA,CAAA,WAAA,GAAA,WAAA;AACA,IAAA,IAAA,CAAA,QAAA,GAAA,QAAA;AACA,IAAA,IAAA,CAAA,UAAA,GAAA,UAAA;AACA,IAAA,IAAA,CAAA,WAAA,GAAA,WAAA;AAAA,EACf;AAAA,EA9CH,OAAO,OAAO,OAAA,EAS0B;AACtC,IAAA,MAAM,OAAA,GAAU,aAAa,OAAO,CAAA;AACpC,IAAA,MAAM,UAAA,GAAa,OAAA,CAAQ,MAAA,EAAQ,IAAA,IAAQ,eAAA;AAC3C,IAAA,MAAM,cAAc,OAAA,CAAQ,MAAA,EAAQ,KAAA,KAAU,CAAA,KAAA,KAAS,UAAU,KAAK,CAAA,CAAA,CAAA;AAEtE,IAAA,OAAO,IAAI,mCAAA;AAAA,MACT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AAK,CAAC,CAAA;AAC5D,MAAA,OAAO,KAAK,OAAO,CAAA;AAAA,IACrB,CAAA;AAAA,EACF;AACF;AAEA,SAAS,aAAa,OAAA,EAIO;AAC3B,EAAA,IAAI,QAAQ,QAAA,EAAU;AACpB,IAAA,OAAO,OAAA,CAAQ,QAAA;AAAA,EACjB,CAAA,MAAA,IAAW,QAAQ,kBAAA,EAAoB;AACrC,IAAA,OAAO,kBAAA,CAAmB,QAAQ,kBAAkB,CAAA;AAAA,EACtD,CAAA,MAAA,IAAW,QAAQ,MAAA,EAAQ;AACzB,IAAA,OAAO,kBAAA,CAAmB;AAAA,MACxB,OAAA,CAAQ,MAAA,CAAO,SAAA,CAAU,iBAAiB,CAAA;AAAA,MAC1C,GAAG,mCAAA,CAAoC,uBAAA;AAAA,QACrC,OAAA,CAAQ;AAAA;AACV,KACD,CAAA;AAAA,EACH;AACA,EAAA,OAAO,MAAM,KAAA;AACf;AAEA,SAAS,mBAAmB,QAAA,EAA8C;AACxE,EAAA,MAAM,eAAA,GAAkB,SAAS,GAAA,CAAI,CAAA,MAAA,KAAU,OAAO,OAAA,CAAQ,KAAA,EAAO,EAAE,CAAC,CAAA;AACxE,EAAA,OAAO,SACL,eAAA,CAAgB,IAAA;AAAA,IACd,YAAU,GAAA,KAAQ,MAAA,IAAU,IAAI,UAAA,CAAW,CAAA,EAAG,MAAM,CAAA,CAAA,CAAG;AAAA,GACzD;AACJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PluginProtocolResolverFetchMiddleware.esm.js","sources":["../../../../../../../../../packages/core-app-api/src/apis/implementations/FetchApi/PluginProtocolResolverFetchMiddleware.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 { DiscoveryApi } from '@backstage/core-plugin-api';\nimport { FetchMiddleware } from './types';\n\nfunction join(left: string, right: string): string {\n if (!right || right === '/') {\n return left;\n }\n\n return `${left.replace(/\\/$/, '')}/${right.replace(/^\\//, '')}`;\n}\n\n/**\n * Handles translation from plugin://some-plugin-id/<path> to concrete http(s)\n * URLs.\n */\nexport class PluginProtocolResolverFetchMiddleware implements FetchMiddleware {\n constructor(private readonly discoveryApi: DiscoveryApi) {}\n\n apply(next: typeof fetch): typeof fetch {\n return async (input, init) => {\n // NOTE(freben): The \"as any\" casts here and below are because of subtle\n // undici type differences that happened in a node types bump. Those are\n // immaterial to the code at hand at runtime, as the global fetch and\n // Request are always taken from the same place.\n const request = new Request(input as any, init);\n const prefix = 'plugin://';\n\n if (!request.url.startsWith(prefix)) {\n return next(input as any, init);\n }\n\n // Switch to a known protocol, since browser URL parsing misbehaves wildly\n // on foreign protocols\n const { hostname, pathname, search, hash, username, password } = new URL(\n `http://${request.url.substring(prefix.length)}`,\n );\n\n let base = await this.discoveryApi.getBaseUrl(hostname);\n if (username || password) {\n const baseUrl = new URL(base);\n const authority = `${username}${password ? `:${password}` : ''}@`;\n base = `${baseUrl.protocol}//${authority}${baseUrl.host}${baseUrl.pathname}`;\n }\n\n const target = `${join(base, pathname)}${search}${hash}`;\n return next(\n target,\n typeof input === 'string' || isUrl(input) ? init : (input as any),\n );\n };\n }\n}\n\nfunction isUrl(a: unknown): a is URL {\n return typeof a === 'object' && a?.constructor === URL;\n}\n"],"names":[],"mappings":"AAmBA,SAAS,IAAA,CAAK,MAAc,
|
|
1
|
+
{"version":3,"file":"PluginProtocolResolverFetchMiddleware.esm.js","sources":["../../../../../../../../../packages/core-app-api/src/apis/implementations/FetchApi/PluginProtocolResolverFetchMiddleware.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 { DiscoveryApi } from '@backstage/core-plugin-api';\nimport { FetchMiddleware } from './types';\n\nfunction join(left: string, right: string): string {\n if (!right || right === '/') {\n return left;\n }\n\n return `${left.replace(/\\/$/, '')}/${right.replace(/^\\//, '')}`;\n}\n\n/**\n * Handles translation from plugin://some-plugin-id/<path> to concrete http(s)\n * URLs.\n */\nexport class PluginProtocolResolverFetchMiddleware implements FetchMiddleware {\n constructor(private readonly discoveryApi: DiscoveryApi) {}\n\n apply(next: typeof fetch): typeof fetch {\n return async (input, init) => {\n // NOTE(freben): The \"as any\" casts here and below are because of subtle\n // undici type differences that happened in a node types bump. Those are\n // immaterial to the code at hand at runtime, as the global fetch and\n // Request are always taken from the same place.\n const request = new Request(input as any, init);\n const prefix = 'plugin://';\n\n if (!request.url.startsWith(prefix)) {\n return next(input as any, init);\n }\n\n // Switch to a known protocol, since browser URL parsing misbehaves wildly\n // on foreign protocols\n const { hostname, pathname, search, hash, username, password } = new URL(\n `http://${request.url.substring(prefix.length)}`,\n );\n\n let base = await this.discoveryApi.getBaseUrl(hostname);\n if (username || password) {\n const baseUrl = new URL(base);\n const authority = `${username}${password ? `:${password}` : ''}@`;\n base = `${baseUrl.protocol}//${authority}${baseUrl.host}${baseUrl.pathname}`;\n }\n\n const target = `${join(base, pathname)}${search}${hash}`;\n return next(\n target,\n typeof input === 'string' || isUrl(input) ? init : (input as any),\n );\n };\n }\n}\n\nfunction isUrl(a: unknown): a is URL {\n return typeof a === 'object' && a?.constructor === URL;\n}\n"],"names":[],"mappings":"AAmBA,SAAS,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QAAA,IAAA,GAAO,CAAA,EAAG,OAAA,CAAQ,QAAQ,CAAA,EAAA,EAAK,SAAS,GAAG,OAAA,CAAQ,IAAI,CAAA,EAAG,OAAA,CAAQ,QAAQ,CAAA,CAAA;AAAA,MAC5E;AAEA,MAAA,MAAM,MAAA,GAAS,GAAG,IAAA,CAAK,IAAA,EAAM,QAAQ,CAAC,CAAA,EAAG,MAAM,CAAA,EAAG,IAAI,CAAA,CAAA;AACtD,MAAA,OAAO,IAAA;AAAA,QACL,MAAA;AAAA,QACA,OAAO,KAAA,KAAU,QAAA,IAAY,KAAA,CAAM,KAAK,IAAI,IAAA,GAAQ;AAAA,OACtD;AAAA,IACF,CAAA;AAAA,EACF;AACF;AAEA,SAAS,MAAM,CAAA,EAAsB;AACnC,EAAA,OAAO,OAAO,CAAA,KAAM,QAAA,IAAY,CAAA,EAAG,WAAA,KAAgB,GAAA;AACrD;;;;"}
|
package/dist/packages/core-app-api/src/apis/implementations/FetchApi/createFetchApi.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createFetchApi.esm.js","sources":["../../../../../../../../../packages/core-app-api/src/apis/implementations/FetchApi/createFetchApi.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 { FetchApi } from '@backstage/core-plugin-api';\nimport { FetchMiddleware } from './types';\n\n/**\n * Builds a fetch API, based on the builtin fetch wrapped by a set of optional\n * middleware implementations that add behaviors.\n *\n * @remarks\n *\n * The middleware are applied in reverse order, i.e. the last one will be\n * \"closest\" to the base implementation. Passing in `[M1, M2, M3]` effectively\n * leads to `M1(M2(M3(baseImplementation)))`.\n *\n * @public\n */\nexport function createFetchApi(options: {\n baseImplementation?: typeof fetch | undefined;\n middleware?: FetchMiddleware | FetchMiddleware[] | undefined;\n}): FetchApi {\n let result = options.baseImplementation || global.fetch;\n\n const middleware = [options.middleware ?? []].flat().reverse();\n for (const m of middleware) {\n result = m.apply(result);\n }\n\n return {\n fetch: result,\n };\n}\n"],"names":[],"mappings":"AA+BO,SAAS,eAAe,
|
|
1
|
+
{"version":3,"file":"createFetchApi.esm.js","sources":["../../../../../../../../../packages/core-app-api/src/apis/implementations/FetchApi/createFetchApi.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 { FetchApi } from '@backstage/core-plugin-api';\nimport { FetchMiddleware } from './types';\n\n/**\n * Builds a fetch API, based on the builtin fetch wrapped by a set of optional\n * middleware implementations that add behaviors.\n *\n * @remarks\n *\n * The middleware are applied in reverse order, i.e. the last one will be\n * \"closest\" to the base implementation. Passing in `[M1, M2, M3]` effectively\n * leads to `M1(M2(M3(baseImplementation)))`.\n *\n * @public\n */\nexport function createFetchApi(options: {\n baseImplementation?: typeof fetch | undefined;\n middleware?: FetchMiddleware | FetchMiddleware[] | undefined;\n}): FetchApi {\n let result = options.baseImplementation || global.fetch;\n\n const middleware = [options.middleware ?? []].flat().reverse();\n for (const m of middleware) {\n result = m.apply(result);\n }\n\n return {\n fetch: result,\n };\n}\n"],"names":[],"mappings":"AA+BO,SAAS,eAAe,OAAA,EAGlB;AACX,EAAA,IAAI,MAAA,GAAS,OAAA,CAAQ,kBAAA,IAAsB,MAAA,CAAO,KAAA;AAElD,EAAA,MAAM,UAAA,GAAa,CAAC,OAAA,CAAQ,UAAA,IAAc,EAAE,CAAA,CAAE,IAAA,EAAK,CAAE,OAAA,EAAQ;AAC7D,EAAA,KAAA,MAAW,KAAK,UAAA,EAAY;AAC1B,IAAA,MAAA,GAAS,CAAA,CAAE,MAAM,MAAM,CAAA;AAAA,EACzB;AAEA,EAAA,OAAO;AAAA,IACL,KAAA,EAAO;AAAA,GACT;AACF;;;;"}
|