@techdocs/cli 1.9.2-next.2 → 1.9.2

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.
@@ -1 +1 @@
1
- <!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Backstage is an open source framework for building developer portals"/><link rel="manifest" href="/manifest.json" crossorigin="use-credentials"/><link rel="icon" href="/favicon.ico"/><link rel="shortcut icon" href="/favicon.ico"/><link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"/><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"/><link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"/><link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5"/><title>Techdocs Preview App</title><meta name="backstage-app-mode" content="public"><script defer="defer" src="/static/runtime.6d288c89.js"></script><script defer="defer" src="/static/module-material-ui.557c1930.js"></script><script defer="defer" src="/static/module-lodash.05581125.js"></script><script defer="defer" src="/static/module-date-fns.c633d602.js"></script><script defer="defer" src="/static/module-mui.f702282a.js"></script><script defer="defer" src="/static/module-material-table.00de7997.js"></script><script defer="defer" src="/static/module-react-dom.42a304d3.js"></script><script defer="defer" src="/static/module-zod.4f2eeb8c.js"></script><script defer="defer" src="/static/module-i18next.f50c1612.js"></script><script defer="defer" src="/static/module-react-beautiful-dnd.e9f14677.js"></script><script defer="defer" src="/static/module-remix-run.ae6d33c5.js"></script><script defer="defer" src="/static/vendor.6d288c89.js"></script><script defer="defer" src="/static/main.6d288c89.js"></script></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
1
+ <!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Backstage is an open source framework for building developer portals"/><link rel="manifest" href="/manifest.json" crossorigin="use-credentials"/><link rel="icon" href="/favicon.ico"/><link rel="shortcut icon" href="/favicon.ico"/><link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"/><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"/><link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"/><link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5"/><title>Techdocs Preview App</title><meta name="backstage-app-mode" content="public"><script defer="defer" src="/static/runtime.9fff8ae5.js"></script><script defer="defer" src="/static/module-material-ui.557c1930.js"></script><script defer="defer" src="/static/module-lodash.05581125.js"></script><script defer="defer" src="/static/module-date-fns.c633d602.js"></script><script defer="defer" src="/static/module-mui.f702282a.js"></script><script defer="defer" src="/static/module-material-table.00de7997.js"></script><script defer="defer" src="/static/module-react-dom.42a304d3.js"></script><script defer="defer" src="/static/module-zod.4f2eeb8c.js"></script><script defer="defer" src="/static/module-i18next.f50c1612.js"></script><script defer="defer" src="/static/module-react-beautiful-dnd.e9f14677.js"></script><script defer="defer" src="/static/module-remix-run.ae6d33c5.js"></script><script defer="defer" src="/static/vendor.9fff8ae5.js"></script><script defer="defer" src="/static/main.9fff8ae5.js"></script></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
@@ -42,7 +42,7 @@
42
42
  color="#5bbad5"
43
43
  />
44
44
  <title><%= config.getString('app.title') %></title>
45
- <meta name="backstage-app-mode" content="public"><meta name="backstage-public-path" content="<%= publicPath %>/"><script defer src="<%= publicPath %>/static/runtime.6d288c89.js"></script><script defer src="<%= publicPath %>/static/module-material-ui.557c1930.js"></script><script defer src="<%= publicPath %>/static/module-lodash.05581125.js"></script><script defer src="<%= publicPath %>/static/module-date-fns.c633d602.js"></script><script defer src="<%= publicPath %>/static/module-mui.f702282a.js"></script><script defer src="<%= publicPath %>/static/module-material-table.00de7997.js"></script><script defer src="<%= publicPath %>/static/module-react-dom.42a304d3.js"></script><script defer src="<%= publicPath %>/static/module-zod.4f2eeb8c.js"></script><script defer src="<%= publicPath %>/static/module-i18next.f50c1612.js"></script><script defer src="<%= publicPath %>/static/module-react-beautiful-dnd.e9f14677.js"></script><script defer src="<%= publicPath %>/static/module-remix-run.ae6d33c5.js"></script><script defer src="<%= publicPath %>/static/vendor.6d288c89.js"></script><script defer src="<%= publicPath %>/static/main.6d288c89.js"></script></head>
45
+ <meta name="backstage-app-mode" content="public"><meta name="backstage-public-path" content="<%= publicPath %>/"><script defer src="<%= publicPath %>/static/runtime.9fff8ae5.js"></script><script defer src="<%= publicPath %>/static/module-material-ui.557c1930.js"></script><script defer src="<%= publicPath %>/static/module-lodash.05581125.js"></script><script defer src="<%= publicPath %>/static/module-date-fns.c633d602.js"></script><script defer src="<%= publicPath %>/static/module-mui.f702282a.js"></script><script defer src="<%= publicPath %>/static/module-material-table.00de7997.js"></script><script defer src="<%= publicPath %>/static/module-react-dom.42a304d3.js"></script><script defer src="<%= publicPath %>/static/module-zod.4f2eeb8c.js"></script><script defer src="<%= publicPath %>/static/module-i18next.f50c1612.js"></script><script defer src="<%= publicPath %>/static/module-react-beautiful-dnd.e9f14677.js"></script><script defer src="<%= publicPath %>/static/module-remix-run.ae6d33c5.js"></script><script defer src="<%= publicPath %>/static/vendor.9fff8ae5.js"></script><script defer src="<%= publicPath %>/static/main.9fff8ae5.js"></script></head>
46
46
  <body>
47
47
  <noscript>You need to enable JavaScript to run this app.</noscript>
48
48
  <div id="root"></div>
@@ -1,3 +1,3 @@
1
1
  "use strict";(()=>{(self.webpackChunktechdocs_cli_embedded_app=self.webpackChunktechdocs_cli_embedded_app||[]).push([[4516],{70048:(P,s,t)=>{t.d(s,{K:()=>a});var i=t(18690);function a(c){return(0,i.g)()}},99538:(P,s,t)=>{t.d(s,{T7:()=>v,TY:()=>g,tN:()=>h});var i=t(31085),a=t(6820),c=t(25862),E=t(43836),y=t(10602);const f=(0,E.tK)("entity-context"),v=n=>{const{children:e,entity:o,loading:d,error:r,refresh:l}=n,u={entity:o,loading:d,error:r,refresh:l};return(0,i.jsx)(f.Provider,{value:(0,y.B)({1:u}),children:(0,i.jsx)(c.Ig,{attributes:{...o?{entityRef:(0,a.U2)(o)}:void 0},children:e})})},m=n=>_jsx(v,{entity:n.entity,loading:!n.entity,error:void 0,refresh:void 0,children:n.children});function h(){const n=(0,E.qO)("entity-context");if(!n)throw new Error("Entity context is not available");const e=n.atVersion(1);if(!e)throw new Error("EntityContext v1 not available");if(!e.entity)throw new Error("useEntity hook is being called outside of an EntityLayout where the entity has not been loaded. If this is intentional, please use useAsyncEntity instead.");return{entity:e.entity}}function g(){const n=(0,E.qO)("entity-context");if(!n)throw new Error("Entity context is not available");const e=n.atVersion(1);if(!e)throw new Error("EntityContext v1 not available");const{entity:o,loading:d,error:r,refresh:l}=e;return{entity:o,loading:d,error:r,refresh:l}}},54516:(P,s,t)=>{t.r(s),t.d(s,{CatalogEntityPage:()=>e});var i=t(31085),a=t(18690),c=t(99538),E=t(70048),y=t(72427),f=t(39837),v=t(29207),m=t(7341),h=t(14041),g=t(28966);const n=()=>{const{kind:o,namespace:d,name:r}=(0,E.K)(v.s),l=(0,a.Zp)(),u=(0,y.gf)(f.m),A=(0,y.gf)(m.v),{value:x,error:O,loading:R,retry:C}=(0,g.A)(()=>A.getEntityByRef({kind:o,namespace:d,name:r}),[A,o,d,r]);return(0,h.useEffect)(()=>{r||(u.post(new Error("No name provided!")),l("/"))},[u,l,O,R,x,r]),{entity:x,loading:R,error:O,refresh:C}};function e(){return(0,i.jsx)(c.T7,{...n(),children:(0,i.jsx)(a.sv,{})})}}}]);})();
2
2
 
3
- //# sourceMappingURL=4516.29ea7597.chunk.js.map
3
+ //# sourceMappingURL=4516.a9b528f6.chunk.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"static/4516.29ea7597.chunk.js","mappings":"6KAwBO,SAASA,EACdC,EAAiD,CAEjD,SAAOC,EAAAA,GAAU,CACnB,C,gHCOA,MAAMC,KAAmBC,EAAAA,IACvB,gBAAgB,EAqBLC,EAAuBC,GAAAA,CAClC,KAAM,CA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AAMgB,EAAmB,KAC9B,KAAM,CAAEC,KAAAA,EAAMC,UAAAA,EAAWC,KAAAA,CAAK,KAAI9B,EAAAA,GAAkB+B,EAAAA,CAAcA,EAC5DC,KAAWC,EAAAA,IAAY,EACvBC,KAAWC,EAAAA,IAAOC,EAAAA,CAAWA,EAC7BC,KAAaF,EAAAA,IAAOG,EAAAA,CAAaA,EAEjC,CACJ1B,MAAOJ,EACPE,MAAAA,EACAD,QAAAA,EACA8B,MAAO5B,CAAO,KACZ6B,EAAAA,GACF,IAAMH,EAAWI,eAAe,CAAEb,KAAAA,EAAMC,UAAAA,EAAWC,KAAAA,CAAK,CAAC,EACzD,CAACO,EAAYT,EAAMC,EAAWC,C,CAAK,EAGrCY,SAAAA,EAAAA,WAAU,KACHZ,IACHI,EAASS,KAAK,IAAInB,MAAM,mBAAmB,CAAC,EAC5CQ,EAAS,GAAG,EAEhB,EAAG,CAACE,EAAUF,EAAUtB,EAAOD,EAASD,EAAQsB,C,CAAK,EAE9C,CAAEtB,OAAAA,EAAQC,QAAAA,EAASC,MAAAA,EAAOC,QAAAA,CAAQ,CAC3C,ECjCO,SAASiC,GAAoB,CAClC,SACE,OAACvC,EAAAA,GAAmBA,CAAE,GAAGsB,EAAiB,E,YACxC,OAACkB,EAAAA,GAAMA,CAAAA,CAAAA,C,EAGb,C","sources":["webpack://techdocs-cli-embedded-app/../core-plugin-api/src/routing/useRouteRefParams.ts","webpack://techdocs-cli-embedded-app/../../plugins/catalog-react/src/hooks/useEntity.tsx","webpack://techdocs-cli-embedded-app/../../plugins/catalog/src/components/CatalogEntityPage/useEntityFromUrl.ts","webpack://techdocs-cli-embedded-app/../../plugins/catalog/src/components/CatalogEntityPage/CatalogEntityPage.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useParams } from 'react-router-dom';\nimport { RouteRef, AnyParams, SubRouteRef } from './types';\n\n/**\n * React hook for retrieving dynamic params from the current URL.\n * @param _routeRef - Ref of the current route.\n * @public\n */\nexport function useRouteRefParams<Params extends AnyParams>(\n _routeRef: RouteRef<Params> | SubRouteRef<Params>,\n): Params {\n return useParams() as Params;\n}\n","/*\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 { Entity, stringifyEntityRef } from '@backstage/catalog-model';\nimport { AnalyticsContext } from '@backstage/core-plugin-api';\nimport {\n createVersionedContext,\n createVersionedValueMap,\n useVersionedContext,\n} from '@backstage/version-bridge';\nimport { ReactNode } from 'react';\n\n/** @public */\nexport type EntityLoadingStatus<TEntity extends Entity = Entity> = {\n entity?: TEntity;\n loading: boolean;\n error?: Error;\n refresh?: VoidFunction;\n};\n\n// This context has support for multiple concurrent versions of this package.\n// It is currently used in parallel with the old context in order to provide\n// a smooth transition, but will eventually be the only context we use.\nconst NewEntityContext = createVersionedContext<{ 1: EntityLoadingStatus }>(\n 'entity-context',\n);\n\n/**\n * Properties for the AsyncEntityProvider component.\n *\n * @public\n */\nexport interface AsyncEntityProviderProps {\n children: ReactNode;\n entity?: Entity;\n loading: boolean;\n error?: Error;\n refresh?: VoidFunction;\n}\n\n/**\n * Provides a loaded entity to be picked up by the `useEntity` hook.\n *\n * @public\n */\nexport const AsyncEntityProvider = (props: AsyncEntityProviderProps) => {\n const { children, entity, loading, error, refresh } = props;\n const value = { entity, loading, error, refresh };\n // We provide both the old and the new context, since\n // consumers might be doing things like `useContext(EntityContext)`\n return (\n <NewEntityContext.Provider value={createVersionedValueMap({ 1: value })}>\n <AnalyticsContext\n attributes={{\n ...(entity ? { entityRef: stringifyEntityRef(entity) } : undefined),\n }}\n >\n {children}\n </AnalyticsContext>\n </NewEntityContext.Provider>\n );\n};\n\n/**\n * Properties for the EntityProvider component.\n *\n * @public\n */\nexport interface EntityProviderProps {\n children: ReactNode;\n entity?: Entity;\n}\n\n/**\n * Provides an entity to be picked up by the `useEntity` hook.\n *\n * @public\n */\nexport const EntityProvider = (props: EntityProviderProps) => (\n <AsyncEntityProvider\n entity={props.entity}\n loading={!Boolean(props.entity)}\n error={undefined}\n refresh={undefined}\n children={props.children}\n />\n);\n\n/**\n * Grab the current entity from the context, throws if the entity has not yet been loaded\n * or is not available.\n *\n * @public\n */\nexport function useEntity<TEntity extends Entity = Entity>(): {\n entity: TEntity;\n} {\n const versionedHolder = useVersionedContext<{ 1: EntityLoadingStatus }>(\n 'entity-context',\n );\n\n if (!versionedHolder) {\n throw new Error('Entity context is not available');\n }\n\n const value = versionedHolder.atVersion(1);\n if (!value) {\n throw new Error('EntityContext v1 not available');\n }\n\n if (!value.entity) {\n throw new Error(\n 'useEntity hook is being called outside of an EntityLayout where the entity has not been loaded. If this is intentional, please use useAsyncEntity instead.',\n );\n }\n\n return { entity: value.entity as TEntity };\n}\n\n/**\n * Grab the current entity from the context, provides loading state and errors, and the ability to refresh.\n *\n * @public\n */\nexport function useAsyncEntity<\n TEntity extends Entity = Entity,\n>(): EntityLoadingStatus<TEntity> {\n const versionedHolder = useVersionedContext<{ 1: EntityLoadingStatus }>(\n 'entity-context',\n );\n\n if (!versionedHolder) {\n throw new Error('Entity context is not available');\n }\n const value = versionedHolder.atVersion(1);\n if (!value) {\n throw new Error('EntityContext v1 not available');\n }\n\n const { entity, loading, error, refresh } = value;\n return { entity: entity as TEntity, loading, error, refresh };\n}\n","/*\n * Copyright 2022 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 errorApiRef,\n useApi,\n useRouteRefParams,\n} from '@backstage/core-plugin-api';\nimport {\n catalogApiRef,\n EntityLoadingStatus,\n entityRouteRef,\n} from '@backstage/plugin-catalog-react';\nimport { useEffect } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport useAsyncRetry from 'react-use/esm/useAsyncRetry';\n\nexport const useEntityFromUrl = (): EntityLoadingStatus => {\n const { kind, namespace, name } = useRouteRefParams(entityRouteRef);\n const navigate = useNavigate();\n const errorApi = useApi(errorApiRef);\n const catalogApi = useApi(catalogApiRef);\n\n const {\n value: entity,\n error,\n loading,\n retry: refresh,\n } = useAsyncRetry(\n () => catalogApi.getEntityByRef({ kind, namespace, name }),\n [catalogApi, kind, namespace, name],\n );\n\n useEffect(() => {\n if (!name) {\n errorApi.post(new Error('No name provided!'));\n navigate('/');\n }\n }, [errorApi, navigate, error, loading, entity, name]);\n\n return { entity, loading, error, refresh };\n};\n","/*\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 { Outlet } from 'react-router-dom';\nimport { AsyncEntityProvider } from '@backstage/plugin-catalog-react';\nimport { useEntityFromUrl } from './useEntityFromUrl';\n\n/** @public */\nexport function CatalogEntityPage() {\n return (\n <AsyncEntityProvider {...useEntityFromUrl()}>\n <Outlet />\n </AsyncEntityProvider>\n );\n}\n"],"names":["useRouteRefParams","_routeRef","useParams","NewEntityContext","createVersionedContext","AsyncEntityProvider","props","children","entity","loading","error","refresh","value","Provider","createVersionedValueMap","AnalyticsContext","attributes","entityRef","stringifyEntityRef","undefined","EntityProvider","useEntity","versionedHolder","useVersionedContext","Error","atVersion","useAsyncEntity","useEntityFromUrl","kind","namespace","name","entityRouteRef","navigate","useNavigate","errorApi","useApi","errorApiRef","catalogApi","catalogApiRef","retry","useAsyncRetry","getEntityByRef","useEffect","post","CatalogEntityPage","Outlet"],"sourceRoot":""}
1
+ {"version":3,"file":"static/4516.a9b528f6.chunk.js","mappings":"6KAwBO,SAASA,EACdC,EAAiD,CAEjD,SAAOC,EAAAA,GAAU,CACnB,C,gHCOA,MAAMC,KAAmBC,EAAAA,IACvB,gBAAgB,EAqBLC,EAAuBC,GAAAA,CAClC,KAAM,CAAEC,SAAAA,EAAUC,OAAAA,EAAQC,QAAAA,EAASC,MAAAA,EAAOC,QAAAA,CAAQ,EAAIL,EAChDM,EAAQ,CAAEJ,OAAAA,EAAQC,QAAAA,EAASC,MAAAA,EAAOC,QAAAA,CAAQ,EAGhD,SACE,OAACR,EAAiBU,SAAQ,CAACD,SAAOE,EAAAA,GAAwB,CAAE,EAAGF,CAAM,CAAC,E,YACpE,OAACG,EAAAA,GAAgBA,CACfC,WAAY,CACV,GAAIR,EAAS,CAAES,aAAWC,EAAAA,IAAmBV,CAAM,CAAE,EAAIW,MAC3D,E,SAECZ,C,IAIT,EAiBaa,EAAkBd,GAC7B,KAACD,EAAAA,CACCG,OAAQF,EAAME,OACdC,QAAS,CAASH,EAAME,OACxBE,MAAOS,OACPR,QAASQ,OACTZ,SAAUD,EAAMC,Q,GAUb,SAASc,GAA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Q,EAAS,GAAG,EAEhB,EAAG,CAACE,EAAUF,EAAUtB,EAAOD,EAASD,EAAQsB,C,CAAK,EAE9C,CAAEtB,OAAAA,EAAQC,QAAAA,EAASC,MAAAA,EAAOC,QAAAA,CAAQ,CAC3C,ECjCO,SAASiC,GAAoB,CAClC,SACE,OAACvC,EAAAA,GAAmBA,CAAE,GAAGsB,EAAiB,E,YACxC,OAACkB,EAAAA,GAAMA,CAAAA,CAAAA,C,EAGb,C","sources":["webpack://techdocs-cli-embedded-app/../core-plugin-api/src/routing/useRouteRefParams.ts","webpack://techdocs-cli-embedded-app/../../plugins/catalog-react/src/hooks/useEntity.tsx","webpack://techdocs-cli-embedded-app/../../plugins/catalog/src/components/CatalogEntityPage/useEntityFromUrl.ts","webpack://techdocs-cli-embedded-app/../../plugins/catalog/src/components/CatalogEntityPage/CatalogEntityPage.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useParams } from 'react-router-dom';\nimport { RouteRef, AnyParams, SubRouteRef } from './types';\n\n/**\n * React hook for retrieving dynamic params from the current URL.\n * @param _routeRef - Ref of the current route.\n * @public\n */\nexport function useRouteRefParams<Params extends AnyParams>(\n _routeRef: RouteRef<Params> | SubRouteRef<Params>,\n): Params {\n return useParams() as Params;\n}\n","/*\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 { Entity, stringifyEntityRef } from '@backstage/catalog-model';\nimport { AnalyticsContext } from '@backstage/core-plugin-api';\nimport {\n createVersionedContext,\n createVersionedValueMap,\n useVersionedContext,\n} from '@backstage/version-bridge';\nimport { ReactNode } from 'react';\n\n/** @public */\nexport type EntityLoadingStatus<TEntity extends Entity = Entity> = {\n entity?: TEntity;\n loading: boolean;\n error?: Error;\n refresh?: VoidFunction;\n};\n\n// This context has support for multiple concurrent versions of this package.\n// It is currently used in parallel with the old context in order to provide\n// a smooth transition, but will eventually be the only context we use.\nconst NewEntityContext = createVersionedContext<{ 1: EntityLoadingStatus }>(\n 'entity-context',\n);\n\n/**\n * Properties for the AsyncEntityProvider component.\n *\n * @public\n */\nexport interface AsyncEntityProviderProps {\n children: ReactNode;\n entity?: Entity;\n loading: boolean;\n error?: Error;\n refresh?: VoidFunction;\n}\n\n/**\n * Provides a loaded entity to be picked up by the `useEntity` hook.\n *\n * @public\n */\nexport const AsyncEntityProvider = (props: AsyncEntityProviderProps) => {\n const { children, entity, loading, error, refresh } = props;\n const value = { entity, loading, error, refresh };\n // We provide both the old and the new context, since\n // consumers might be doing things like `useContext(EntityContext)`\n return (\n <NewEntityContext.Provider value={createVersionedValueMap({ 1: value })}>\n <AnalyticsContext\n attributes={{\n ...(entity ? { entityRef: stringifyEntityRef(entity) } : undefined),\n }}\n >\n {children}\n </AnalyticsContext>\n </NewEntityContext.Provider>\n );\n};\n\n/**\n * Properties for the EntityProvider component.\n *\n * @public\n */\nexport interface EntityProviderProps {\n children: ReactNode;\n entity?: Entity;\n}\n\n/**\n * Provides an entity to be picked up by the `useEntity` hook.\n *\n * @public\n */\nexport const EntityProvider = (props: EntityProviderProps) => (\n <AsyncEntityProvider\n entity={props.entity}\n loading={!Boolean(props.entity)}\n error={undefined}\n refresh={undefined}\n children={props.children}\n />\n);\n\n/**\n * Grab the current entity from the context, throws if the entity has not yet been loaded\n * or is not available.\n *\n * @public\n */\nexport function useEntity<TEntity extends Entity = Entity>(): {\n entity: TEntity;\n} {\n const versionedHolder = useVersionedContext<{ 1: EntityLoadingStatus }>(\n 'entity-context',\n );\n\n if (!versionedHolder) {\n throw new Error('Entity context is not available');\n }\n\n const value = versionedHolder.atVersion(1);\n if (!value) {\n throw new Error('EntityContext v1 not available');\n }\n\n if (!value.entity) {\n throw new Error(\n 'useEntity hook is being called outside of an EntityLayout where the entity has not been loaded. If this is intentional, please use useAsyncEntity instead.',\n );\n }\n\n return { entity: value.entity as TEntity };\n}\n\n/**\n * Grab the current entity from the context, provides loading state and errors, and the ability to refresh.\n *\n * @public\n */\nexport function useAsyncEntity<\n TEntity extends Entity = Entity,\n>(): EntityLoadingStatus<TEntity> {\n const versionedHolder = useVersionedContext<{ 1: EntityLoadingStatus }>(\n 'entity-context',\n );\n\n if (!versionedHolder) {\n throw new Error('Entity context is not available');\n }\n const value = versionedHolder.atVersion(1);\n if (!value) {\n throw new Error('EntityContext v1 not available');\n }\n\n const { entity, loading, error, refresh } = value;\n return { entity: entity as TEntity, loading, error, refresh };\n}\n","/*\n * Copyright 2022 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 errorApiRef,\n useApi,\n useRouteRefParams,\n} from '@backstage/core-plugin-api';\nimport {\n catalogApiRef,\n EntityLoadingStatus,\n entityRouteRef,\n} from '@backstage/plugin-catalog-react';\nimport { useEffect } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport useAsyncRetry from 'react-use/esm/useAsyncRetry';\n\nexport const useEntityFromUrl = (): EntityLoadingStatus => {\n const { kind, namespace, name } = useRouteRefParams(entityRouteRef);\n const navigate = useNavigate();\n const errorApi = useApi(errorApiRef);\n const catalogApi = useApi(catalogApiRef);\n\n const {\n value: entity,\n error,\n loading,\n retry: refresh,\n } = useAsyncRetry(\n () => catalogApi.getEntityByRef({ kind, namespace, name }),\n [catalogApi, kind, namespace, name],\n );\n\n useEffect(() => {\n if (!name) {\n errorApi.post(new Error('No name provided!'));\n navigate('/');\n }\n }, [errorApi, navigate, error, loading, entity, name]);\n\n return { entity, loading, error, refresh };\n};\n","/*\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 { Outlet } from 'react-router-dom';\nimport { AsyncEntityProvider } from '@backstage/plugin-catalog-react';\nimport { useEntityFromUrl } from './useEntityFromUrl';\n\n/** @public */\nexport function CatalogEntityPage() {\n return (\n <AsyncEntityProvider {...useEntityFromUrl()}>\n <Outlet />\n </AsyncEntityProvider>\n );\n}\n"],"names":["useRouteRefParams","_routeRef","useParams","NewEntityContext","createVersionedContext","AsyncEntityProvider","props","children","entity","loading","error","refresh","value","Provider","createVersionedValueMap","AnalyticsContext","attributes","entityRef","stringifyEntityRef","undefined","EntityProvider","useEntity","versionedHolder","useVersionedContext","Error","atVersion","useAsyncEntity","useEntityFromUrl","kind","namespace","name","entityRouteRef","navigate","useNavigate","errorApi","useApi","errorApiRef","catalogApi","catalogApiRef","retry","useAsyncRetry","getEntityByRef","useEffect","post","CatalogEntityPage","Outlet"],"sourceRoot":""}