@backstage/plugin-catalog-react 1.20.0-next.1 → 1.20.0-next.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # @backstage/plugin-catalog-react
2
2
 
3
+ ## 1.20.0-next.2
4
+
5
+ ### Minor Changes
6
+
7
+ - e4ddf22: **BREAKING ALPHA**: The `defaultPath`, `defaultTitle`, and `defaultGroup` params of `PageBlueprint` has been renamed to `path`, `title`, and `group`. The `convertLegacyEntityContentExtension` utility has also received the same change. This change does not affect the compatibility of extensions created with older versions of this blueprint.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+ - @backstage/frontend-plugin-api@0.11.0-next.1
13
+ - @backstage/frontend-test-utils@0.3.5-next.2
14
+ - @backstage/core-compat-api@0.5.0-next.2
15
+ - @backstage/core-components@0.17.5-next.1
16
+ - @backstage/catalog-client@1.11.0-next.0
17
+ - @backstage/catalog-model@1.7.5
18
+ - @backstage/core-plugin-api@1.10.9
19
+ - @backstage/errors@1.2.7
20
+ - @backstage/integration-react@1.2.9
21
+ - @backstage/types@1.2.1
22
+ - @backstage/version-bridge@1.0.11
23
+ - @backstage/plugin-catalog-common@1.1.5
24
+ - @backstage/plugin-permission-common@0.9.1
25
+ - @backstage/plugin-permission-react@0.4.36
26
+
3
27
  ## 1.20.0-next.1
4
28
 
5
29
  ### Minor Changes
@@ -29,24 +29,19 @@ const EntityContentBlueprint = createExtensionBlueprint({
29
29
  group: (z) => z.literal(false).or(z.string()).optional()
30
30
  }
31
31
  },
32
- *factory({
33
- loader,
34
- defaultPath,
35
- defaultTitle,
36
- defaultGroup,
37
- filter,
38
- routeRef
39
- }, { node, config }) {
40
- const path = config.path ?? defaultPath;
41
- const title = config.title ?? defaultTitle;
42
- const group = config.group ?? defaultGroup;
43
- yield coreExtensionData.reactElement(ExtensionBoundary.lazy(node, loader));
32
+ *factory(params, { node, config }) {
33
+ const path = config.path ?? params.path;
34
+ const title = config.title ?? params.title;
35
+ const group = config.group ?? params.group;
36
+ yield coreExtensionData.reactElement(
37
+ ExtensionBoundary.lazy(node, params.loader)
38
+ );
44
39
  yield coreExtensionData.routePath(path);
45
40
  yield entityContentTitleDataRef(title);
46
- if (routeRef) {
47
- yield coreExtensionData.routeRef(routeRef);
41
+ if (params.routeRef) {
42
+ yield coreExtensionData.routeRef(params.routeRef);
48
43
  }
49
- yield* resolveEntityFilterData(filter, config, node);
44
+ yield* resolveEntityFilterData(params.filter, config, node);
50
45
  if (group) {
51
46
  yield entityContentGroupDataRef(group);
52
47
  }
@@ -1 +1 @@
1
- {"version":3,"file":"EntityContentBlueprint.esm.js","sources":["../../../src/alpha/blueprints/EntityContentBlueprint.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 coreExtensionData,\n createExtensionBlueprint,\n ExtensionBoundary,\n RouteRef,\n} from '@backstage/frontend-plugin-api';\nimport {\n entityContentTitleDataRef,\n entityFilterFunctionDataRef,\n entityFilterExpressionDataRef,\n entityContentGroupDataRef,\n defaultEntityContentGroups,\n} from './extensionData';\nimport { EntityPredicate } from '../predicates/types';\nimport { resolveEntityFilterData } from './resolveEntityFilterData';\nimport { createEntityPredicateSchema } from '../predicates/createEntityPredicateSchema';\nimport { Entity } from '@backstage/catalog-model';\n\n/**\n * @alpha\n * Creates an EntityContent extension.\n */\nexport const EntityContentBlueprint = createExtensionBlueprint({\n kind: 'entity-content',\n attachTo: { id: 'page:catalog/entity', input: 'contents' },\n output: [\n coreExtensionData.reactElement,\n coreExtensionData.routePath,\n entityContentTitleDataRef,\n coreExtensionData.routeRef.optional(),\n entityFilterFunctionDataRef.optional(),\n entityFilterExpressionDataRef.optional(),\n entityContentGroupDataRef.optional(),\n ],\n dataRefs: {\n title: entityContentTitleDataRef,\n filterFunction: entityFilterFunctionDataRef,\n filterExpression: entityFilterExpressionDataRef,\n group: entityContentGroupDataRef,\n },\n config: {\n schema: {\n path: z => z.string().optional(),\n title: z => z.string().optional(),\n filter: z =>\n z.union([z.string(), createEntityPredicateSchema(z)]).optional(),\n group: z => z.literal(false).or(z.string()).optional(),\n },\n },\n *factory(\n {\n loader,\n defaultPath,\n defaultTitle,\n defaultGroup,\n filter,\n routeRef,\n }: {\n loader: () => Promise<JSX.Element>;\n defaultPath: string;\n defaultTitle: string;\n defaultGroup?: keyof typeof defaultEntityContentGroups | (string & {});\n routeRef?: RouteRef;\n filter?: string | EntityPredicate | ((entity: Entity) => boolean);\n },\n { node, config },\n ) {\n const path = config.path ?? defaultPath;\n const title = config.title ?? defaultTitle;\n const group = config.group ?? defaultGroup;\n\n yield coreExtensionData.reactElement(ExtensionBoundary.lazy(node, loader));\n\n yield coreExtensionData.routePath(path);\n\n yield entityContentTitleDataRef(title);\n\n if (routeRef) {\n yield coreExtensionData.routeRef(routeRef);\n }\n\n yield* resolveEntityFilterData(filter, config, node);\n\n if (group) {\n yield entityContentGroupDataRef(group);\n }\n },\n});\n"],"names":[],"mappings":";;;;;AAsCO,MAAM,yBAAyB,wBAAyB,CAAA;AAAA,EAC7D,IAAM,EAAA,gBAAA;AAAA,EACN,QAAU,EAAA,EAAE,EAAI,EAAA,qBAAA,EAAuB,OAAO,UAAW,EAAA;AAAA,EACzD,MAAQ,EAAA;AAAA,IACN,iBAAkB,CAAA,YAAA;AAAA,IAClB,iBAAkB,CAAA,SAAA;AAAA,IAClB,yBAAA;AAAA,IACA,iBAAA,CAAkB,SAAS,QAAS,EAAA;AAAA,IACpC,4BAA4B,QAAS,EAA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AEtC,IAAA,MAAM,0BAA0B,KAAK,CAAA;AAErC,IAAA,IAAI,QAAU,EAAA;AACZ,MAAM,MAAA,iBAAA,CAAkB,SAAS,QAAQ,CAAA;AAAA;AAG3C,IAAO,OAAA,uBAAA,CAAwB,MAAQ,EAAA,MAAA,EAAQ,IAAI,CAAA;AAEnD,IAAA,IAAI,KAAO,EAAA;AACT,MAAA,MAAM,0BAA0B,KAAK,CAAA;AAAA;AACvC;AAEJ,CAAC;;;;"}
1
+ {"version":3,"file":"EntityContentBlueprint.esm.js","sources":["../../../src/alpha/blueprints/EntityContentBlueprint.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 coreExtensionData,\n createExtensionBlueprint,\n ExtensionBoundary,\n RouteRef,\n} from '@backstage/frontend-plugin-api';\nimport {\n entityContentTitleDataRef,\n entityFilterFunctionDataRef,\n entityFilterExpressionDataRef,\n entityContentGroupDataRef,\n defaultEntityContentGroups,\n} from './extensionData';\nimport { EntityPredicate } from '../predicates/types';\nimport { resolveEntityFilterData } from './resolveEntityFilterData';\nimport { createEntityPredicateSchema } from '../predicates/createEntityPredicateSchema';\nimport { Entity } from '@backstage/catalog-model';\n\n/**\n * @alpha\n * Creates an EntityContent extension.\n */\nexport const EntityContentBlueprint = createExtensionBlueprint({\n kind: 'entity-content',\n attachTo: { id: 'page:catalog/entity', input: 'contents' },\n output: [\n coreExtensionData.reactElement,\n coreExtensionData.routePath,\n entityContentTitleDataRef,\n coreExtensionData.routeRef.optional(),\n entityFilterFunctionDataRef.optional(),\n entityFilterExpressionDataRef.optional(),\n entityContentGroupDataRef.optional(),\n ],\n dataRefs: {\n title: entityContentTitleDataRef,\n filterFunction: entityFilterFunctionDataRef,\n filterExpression: entityFilterExpressionDataRef,\n group: entityContentGroupDataRef,\n },\n config: {\n schema: {\n path: z => z.string().optional(),\n title: z => z.string().optional(),\n filter: z =>\n z.union([z.string(), createEntityPredicateSchema(z)]).optional(),\n group: z => z.literal(false).or(z.string()).optional(),\n },\n },\n *factory(\n params: {\n /**\n * @deprecated Use the `path` param instead.\n */\n defaultPath?: [Error: `Use the 'path' param instead`];\n path: string;\n /**\n * @deprecated Use the `path` param instead.\n */\n defaultTitle?: [Error: `Use the 'title' param instead`];\n title: string;\n /**\n * @deprecated Use the `path` param instead.\n */\n defaultGroup?: [Error: `Use the 'group' param instead`];\n group?: keyof typeof defaultEntityContentGroups | (string & {});\n loader: () => Promise<JSX.Element>;\n routeRef?: RouteRef;\n filter?: string | EntityPredicate | ((entity: Entity) => boolean);\n },\n { node, config },\n ) {\n const path = config.path ?? params.path;\n const title = config.title ?? params.title;\n const group = config.group ?? params.group;\n\n yield coreExtensionData.reactElement(\n ExtensionBoundary.lazy(node, params.loader),\n );\n\n yield coreExtensionData.routePath(path);\n\n yield entityContentTitleDataRef(title);\n\n if (params.routeRef) {\n yield coreExtensionData.routeRef(params.routeRef);\n }\n\n yield* resolveEntityFilterData(params.filter, config, node);\n\n if (group) {\n yield entityContentGroupDataRef(group);\n }\n },\n});\n"],"names":[],"mappings":";;;;;AAsCO,MAAM,yBAAyB,wBAAyB,CAAA;AAAA,EAC7D,IAAM,EAAA,gBAAA;AAAA,EACN,QAAU,EAAA,EAAE,EAAI,EAAA,qBAAA,EAAuB,OAAO,UAAW,EAAA;AAAA,EACzD,MAAQ,EAAA;AAAA,IACN,iBAAkB,CAAA,YAAA;AAAA,IAClB,iBAAkB,CAAA,SAAA;AAAA,IAClB,yBAAA;AAAA,IACA,iBAAA,CAAkB,SAAS,QAAS,EAAA;AAAA,IACpC,4BAA4B,Q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A0B,KAAK,CAAA;AAErC,IAAA,IAAI,OAAO,QAAU,EAAA;AACnB,MAAM,MAAA,iBAAA,CAAkB,QAAS,CAAA,MAAA,CAAO,QAAQ,CAAA;AAAA;AAGlD,IAAA,OAAO,uBAAwB,CAAA,MAAA,CAAO,MAAQ,EAAA,MAAA,EAAQ,IAAI,CAAA;AAE1D,IAAA,IAAI,KAAO,EAAA;AACT,MAAA,MAAM,0BAA0B,KAAK,CAAA;AAAA;AACvC;AAEJ,CAAC;;;;"}
@@ -31,8 +31,8 @@ function convertLegacyEntityContentExtension(LegacyExtension, overrides) {
31
31
  name: overrides?.name ?? name,
32
32
  params: {
33
33
  filter: overrides?.filter,
34
- defaultPath: overrides?.defaultPath ?? `/${kebabCase(infix)}`,
35
- defaultTitle: overrides?.defaultTitle ?? startCase(infix),
34
+ path: overrides?.path ?? `/${kebabCase(infix)}`,
35
+ title: overrides?.title ?? startCase(infix),
36
36
  routeRef: mountPoint && convertLegacyRouteRef(mountPoint),
37
37
  loader: async () => compatWrapper(element)
38
38
  }
@@ -1 +1 @@
1
- {"version":3,"file":"convertLegacyEntityContentExtension.esm.js","sources":["../../../src/alpha/converters/convertLegacyEntityContentExtension.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 */\n\nimport {\n compatWrapper,\n convertLegacyRouteRef,\n} from '@backstage/core-compat-api';\nimport {\n BackstagePlugin,\n getComponentData,\n RouteRef as LegacyRouteRef,\n} from '@backstage/core-plugin-api';\nimport { ExtensionDefinition } from '@backstage/frontend-plugin-api';\nimport kebabCase from 'lodash/kebabCase';\nimport startCase from 'lodash/startCase';\nimport { ComponentType } from 'react';\nimport { EntityContentBlueprint } from '../blueprints/EntityContentBlueprint';\nimport { EntityPredicate } from '../predicates/types';\nimport { Entity } from '@backstage/catalog-model';\n\n/** @alpha */\nexport function convertLegacyEntityContentExtension(\n LegacyExtension: ComponentType<{}>,\n overrides?: {\n name?: string;\n filter?: string | EntityPredicate | ((entity: Entity) => boolean);\n defaultPath?: string;\n defaultTitle?: string;\n },\n): ExtensionDefinition {\n const element = <LegacyExtension />;\n\n const extName = getComponentData<string>(element, 'core.extensionName');\n if (!extName) {\n throw new Error('Extension has no name');\n }\n\n const mountPoint = getComponentData<LegacyRouteRef>(\n element,\n 'core.mountPoint',\n );\n\n const plugin = getComponentData<BackstagePlugin>(element, 'core.plugin');\n const pluginId = plugin?.getId();\n\n const match = extName.match(/^Entity(.*)Content$/);\n const infix = match?.[1] ?? extName;\n\n let name: string | undefined = infix;\n if (\n pluginId &&\n name\n .toLocaleLowerCase('en-US')\n .startsWith(pluginId.toLocaleLowerCase('en-US'))\n ) {\n name = name.slice(pluginId.length);\n if (!name) {\n name = undefined;\n }\n }\n name = name && kebabCase(name);\n\n return EntityContentBlueprint.make({\n name: overrides?.name ?? name,\n params: {\n filter: overrides?.filter,\n defaultPath: overrides?.defaultPath ?? `/${kebabCase(infix)}`,\n defaultTitle: overrides?.defaultTitle ?? startCase(infix),\n routeRef: mountPoint && convertLegacyRouteRef(mountPoint),\n loader: async () => compatWrapper(element),\n },\n });\n}\n"],"names":[],"mappings":";;;;;;;AAkCgB,SAAA,mCAAA,CACd,iBACA,SAMqB,EAAA;AACrB,EAAM,MAAA,OAAA,uBAAW,eAAgB,EAAA,EAAA,CAAA;AAEjC,EAAM,MAAA,OAAA,GAAU,gBAAyB,CAAA,OAAA,EAAS,oBAAoB,CAAA;AACtE,EAAA,IAAI,CAAC,OAAS,EAAA;AACZ,IAAM,MAAA,IAAI,MAAM,uBAAuB,CAAA;AAAA;AAGzC,EAAA,MAAM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ntityContentExtension.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 */\n\nimport {\n compatWrapper,\n convertLegacyRouteRef,\n} from '@backstage/core-compat-api';\nimport {\n BackstagePlugin,\n getComponentData,\n RouteRef as LegacyRouteRef,\n} from '@backstage/core-plugin-api';\nimport { ExtensionDefinition } from '@backstage/frontend-plugin-api';\nimport kebabCase from 'lodash/kebabCase';\nimport startCase from 'lodash/startCase';\nimport { ComponentType } from 'react';\nimport { EntityContentBlueprint } from '../blueprints/EntityContentBlueprint';\nimport { EntityPredicate } from '../predicates/types';\nimport { Entity } from '@backstage/catalog-model';\n\n/** @alpha */\nexport function convertLegacyEntityContentExtension(\n LegacyExtension: ComponentType<{}>,\n overrides?: {\n name?: string;\n filter?: string | EntityPredicate | ((entity: Entity) => boolean);\n path?: string;\n title?: string;\n\n /**\n * @deprecated Use the `path` param instead.\n */\n defaultPath?: [Error: `Use the 'path' override instead`];\n\n /**\n * @deprecated Use the `path` param instead.\n */\n defaultTitle?: [Error: `Use the 'title' override instead`];\n },\n): ExtensionDefinition {\n const element = <LegacyExtension />;\n\n const extName = getComponentData<string>(element, 'core.extensionName');\n if (!extName) {\n throw new Error('Extension has no name');\n }\n\n const mountPoint = getComponentData<LegacyRouteRef>(\n element,\n 'core.mountPoint',\n );\n\n const plugin = getComponentData<BackstagePlugin>(element, 'core.plugin');\n const pluginId = plugin?.getId();\n\n const match = extName.match(/^Entity(.*)Content$/);\n const infix = match?.[1] ?? extName;\n\n let name: string | undefined = infix;\n if (\n pluginId &&\n name\n .toLocaleLowerCase('en-US')\n .startsWith(pluginId.toLocaleLowerCase('en-US'))\n ) {\n name = name.slice(pluginId.length);\n if (!name) {\n name = undefined;\n }\n }\n name = name && kebabCase(name);\n\n return EntityContentBlueprint.make({\n name: overrides?.name ?? name,\n params: {\n filter: overrides?.filter,\n path: overrides?.path ?? `/${kebabCase(infix)}`,\n title: overrides?.title ?? startCase(infix),\n routeRef: mountPoint && convertLegacyRouteRef(mountPoint),\n loader: async () => compatWrapper(element),\n },\n });\n}\n"],"names":[],"mappings":";;;;;;;AAkCgB,SAAA,mCAAA,CACd,iBACA,SAgBqB,EAAA;AACrB,EAAM,MAAA,OAAA,uBAAW,eAAgB,EAAA,EAAA,CAAA;AAEjC,EAAM,MAAA,OAAA,GAAU,gBAAyB,CAAA,OAAA,EAAS,oBAAoB,CAAA;AACtE,EAAA,IAAI,CAAC,OAAS,EAAA;AACZ,IAAM,MAAA,IAAI,MAAM,uBAAuB,CAAA;AAAA;AAGzC,EAAA,MAAM,UAAa,GAAA,gBAAA;AAAA,IACjB,OAAA;AAAA,IACA;AAAA,GACF;AAEA,EAAM,MAAA,MAAA,GAAS,gBAAkC,CAAA,OAAA,EAAS,aAAa,CAAA;AACvE,EAAM,MAAA,QAAA,GAAW,QAAQ,KAAM,EAAA;AAE/B,EAAM,MAAA,KAAA,GAAQ,OAAQ,CAAA,KAAA,CAAM,qBAAqB,CAAA;AACjD,EAAM,MAAA,KAAA,GAAQ,KAAQ,GAAA,CAAC,CAAK,IAAA,OAAA;AAE5B,EAAA,IAAI,IAA2B,GAAA,KAAA;AAC/B,EACE,IAAA,QAAA,IACA,IACG,CAAA,iBAAA,CAAkB,OAAO,CAAA,CACzB,WAAW,QAAS,CAAA,iBAAA,CAAkB,OAAO,CAAC,CACjD,EAAA;AACA,IAAO,IAAA,GAAA,IAAA,CAAK,KAAM,CAAA,QAAA,CAAS,MAAM,CAAA;AACjC,IAAA,IAAI,CAAC,IAAM,EAAA;AACT,MAAO,IAAA,GAAA,KAAA,CAAA;AAAA;AACT;AAEF,EAAO,IAAA,GAAA,IAAA,IAAQ,UAAU,IAAI,CAAA;AAE7B,EAAA,OAAO,uBAAuB,IAAK,CAAA;AAAA,IACjC,IAAA,EAAM,WAAW,IAAQ,IAAA,IAAA;AAAA,IACzB,MAAQ,EAAA;AAAA,MACN,QAAQ,SAAW,EAAA,MAAA;AAAA,MACnB,MAAM,SAAW,EAAA,IAAA,IAAQ,CAAI,CAAA,EAAA,SAAA,CAAU,KAAK,CAAC,CAAA,CAAA;AAAA,MAC7C,KAAO,EAAA,SAAA,EAAW,KAAS,IAAA,SAAA,CAAU,KAAK,CAAA;AAAA,MAC1C,QAAA,EAAU,UAAc,IAAA,qBAAA,CAAsB,UAAU,CAAA;AAAA,MACxD,MAAA,EAAQ,YAAY,aAAA,CAAc,OAAO;AAAA;AAC3C,GACD,CAAA;AACH;;;;"}
package/dist/alpha.d.ts CHANGED
@@ -25,11 +25,10 @@ declare function isOwnerOf(owner: Entity, entity: Entity): boolean;
25
25
  */
26
26
  declare const CatalogFilterBlueprint: _backstage_frontend_plugin_api.ExtensionBlueprint<{
27
27
  kind: "catalog-filter";
28
- name: undefined;
29
28
  params: {
30
29
  loader: () => Promise<JSX.Element>;
31
30
  };
32
- output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<react.JSX.Element, "core.reactElement", {}>;
31
+ output: _backstage_frontend_plugin_api.ExtensionDataRef<react.JSX.Element, "core.reactElement", {}>;
33
32
  inputs: {};
34
33
  config: {};
35
34
  configInput: {};
@@ -88,17 +87,16 @@ declare function entityPredicateToFilterFunction<T extends JsonValue>(entityPred
88
87
  */
89
88
  declare const EntityCardBlueprint: _backstage_frontend_plugin_api.ExtensionBlueprint<{
90
89
  kind: "entity-card";
91
- name: undefined;
92
90
  params: {
93
91
  loader: () => Promise<JSX.Element>;
94
92
  filter?: string | EntityPredicate | ((entity: Entity) => boolean);
95
93
  type?: EntityCardType;
96
94
  };
97
- output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: Entity) => boolean, "catalog.entity-filter-function", {
95
+ output: _backstage_frontend_plugin_api.ExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ExtensionDataRef<(entity: Entity) => boolean, "catalog.entity-filter-function", {
98
96
  optional: true;
99
- }> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
97
+ }> | _backstage_frontend_plugin_api.ExtensionDataRef<string, "catalog.entity-filter-expression", {
100
98
  optional: true;
101
- }> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<EntityCardType, "catalog.entity-card-type", {
99
+ }> | _backstage_frontend_plugin_api.ExtensionDataRef<EntityCardType, "catalog.entity-card-type", {
102
100
  optional: true;
103
101
  }>;
104
102
  inputs: {};
@@ -123,22 +121,33 @@ declare const EntityCardBlueprint: _backstage_frontend_plugin_api.ExtensionBluep
123
121
  */
124
122
  declare const EntityContentBlueprint: _backstage_frontend_plugin_api.ExtensionBlueprint<{
125
123
  kind: "entity-content";
126
- name: undefined;
127
124
  params: {
125
+ /**
126
+ * @deprecated Use the `path` param instead.
127
+ */
128
+ defaultPath?: [Error: `Use the 'path' param instead`];
129
+ path: string;
130
+ /**
131
+ * @deprecated Use the `path` param instead.
132
+ */
133
+ defaultTitle?: [Error: `Use the 'title' param instead`];
134
+ title: string;
135
+ /**
136
+ * @deprecated Use the `path` param instead.
137
+ */
138
+ defaultGroup?: [Error: `Use the 'group' param instead`];
139
+ group?: keyof typeof defaultEntityContentGroups | (string & {});
128
140
  loader: () => Promise<JSX.Element>;
129
- defaultPath: string;
130
- defaultTitle: string;
131
- defaultGroup?: keyof typeof defaultEntityContentGroups | (string & {});
132
141
  routeRef?: RouteRef;
133
142
  filter?: string | EntityPredicate | ((entity: Entity) => boolean);
134
143
  };
135
- output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "core.routing.path", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<RouteRef<_backstage_frontend_plugin_api.AnyRouteRefParams>, "core.routing.ref", {
144
+ output: _backstage_frontend_plugin_api.ExtensionDataRef<string, "core.routing.path", {}> | _backstage_frontend_plugin_api.ExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ExtensionDataRef<RouteRef<_backstage_frontend_plugin_api.AnyRouteRefParams>, "core.routing.ref", {
136
145
  optional: true;
137
- }> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-content-title", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: Entity) => boolean, "catalog.entity-filter-function", {
146
+ }> | _backstage_frontend_plugin_api.ExtensionDataRef<(entity: Entity) => boolean, "catalog.entity-filter-function", {
138
147
  optional: true;
139
- }> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
148
+ }> | _backstage_frontend_plugin_api.ExtensionDataRef<string, "catalog.entity-filter-expression", {
140
149
  optional: true;
141
- }> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-content-group", {
150
+ }> | _backstage_frontend_plugin_api.ExtensionDataRef<string, "catalog.entity-content-title", {}> | _backstage_frontend_plugin_api.ExtensionDataRef<string, "catalog.entity-content-group", {
142
151
  optional: true;
143
152
  }>;
144
153
  inputs: {};
@@ -172,16 +181,15 @@ interface EntityContentLayoutProps {
172
181
  /** @alpha */
173
182
  declare const EntityContentLayoutBlueprint: _backstage_frontend_plugin_api.ExtensionBlueprint<{
174
183
  kind: "entity-content-layout";
175
- name: undefined;
176
184
  params: {
177
185
  filter?: string | EntityPredicate | ((entity: Entity) => boolean);
178
186
  loader: () => Promise<(props: EntityContentLayoutProps) => JSX$1.Element>;
179
187
  };
180
- output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: Entity) => boolean, "catalog.entity-filter-function", {
188
+ output: _backstage_frontend_plugin_api.ExtensionDataRef<(entity: Entity) => boolean, "catalog.entity-filter-function", {
181
189
  optional: true;
182
- }> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
190
+ }> | _backstage_frontend_plugin_api.ExtensionDataRef<string, "catalog.entity-filter-expression", {
183
191
  optional: true;
184
- }> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(props: EntityContentLayoutProps) => React.JSX.Element, "catalog.entity-content-layout.component", {}>;
192
+ }> | _backstage_frontend_plugin_api.ExtensionDataRef<(props: EntityContentLayoutProps) => React.JSX.Element, "catalog.entity-content-layout.component", {}>;
185
193
  inputs: {};
186
194
  config: {
187
195
  type: string | undefined;
@@ -201,16 +209,15 @@ declare const EntityContentLayoutBlueprint: _backstage_frontend_plugin_api.Exten
201
209
  /** @alpha */
202
210
  declare const EntityHeaderBlueprint: _backstage_frontend_plugin_api.ExtensionBlueprint<{
203
211
  kind: "entity-header";
204
- name: undefined;
205
212
  params: {
206
213
  loader: () => Promise<JSX.Element>;
207
214
  filter?: EntityPredicate | ((entity: Entity) => boolean);
208
215
  };
209
- output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: Entity) => boolean, "catalog.entity-filter-function", {
216
+ output: _backstage_frontend_plugin_api.ExtensionDataRef<(entity: Entity) => boolean, "catalog.entity-filter-function", {
210
217
  optional: true;
211
- }> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
218
+ }> | _backstage_frontend_plugin_api.ExtensionDataRef<string, "catalog.entity-filter-expression", {
212
219
  optional: true;
213
- }> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<react.JSX.Element, "core.reactElement", {
220
+ }> | _backstage_frontend_plugin_api.ExtensionDataRef<react.JSX.Element, "core.reactElement", {
214
221
  optional: true;
215
222
  }>;
216
223
  inputs: {};
@@ -245,9 +252,8 @@ type EntityContextMenuItemParams = {
245
252
  /** @alpha */
246
253
  declare const EntityContextMenuItemBlueprint: _backstage_frontend_plugin_api.ExtensionBlueprint<{
247
254
  kind: "entity-context-menu-item";
248
- name: undefined;
249
255
  params: EntityContextMenuItemParams;
250
- output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<JSX$1.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: Entity) => boolean, "catalog.entity-filter-function", {
256
+ output: _backstage_frontend_plugin_api.ExtensionDataRef<JSX$1.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ExtensionDataRef<(entity: Entity) => boolean, "catalog.entity-filter-function", {
251
257
  optional: true;
252
258
  }>;
253
259
  inputs: {};
@@ -265,16 +271,15 @@ declare const EntityContextMenuItemBlueprint: _backstage_frontend_plugin_api.Ext
265
271
  /** @alpha */
266
272
  declare const EntityIconLinkBlueprint: _backstage_frontend_plugin_api.ExtensionBlueprint<{
267
273
  kind: "entity-icon-link";
268
- name: undefined;
269
274
  params: {
270
275
  useProps: () => Omit<IconLinkVerticalProps, "color">;
271
276
  filter?: EntityPredicate | ((entity: Entity) => boolean);
272
277
  };
273
- output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: Entity) => boolean, "catalog.entity-filter-function", {
278
+ output: _backstage_frontend_plugin_api.ExtensionDataRef<(entity: Entity) => boolean, "catalog.entity-filter-function", {
274
279
  optional: true;
275
- }> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
280
+ }> | _backstage_frontend_plugin_api.ExtensionDataRef<string, "catalog.entity-filter-expression", {
276
281
  optional: true;
277
- }> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<() => IconLinkVerticalProps, "entity-icon-link-props", {}>;
282
+ }> | _backstage_frontend_plugin_api.ExtensionDataRef<() => IconLinkVerticalProps, "entity-icon-link-props", {}>;
278
283
  inputs: {};
279
284
  config: {
280
285
  label: string | undefined;
@@ -304,8 +309,16 @@ declare function convertLegacyEntityCardExtension(LegacyExtension: ComponentType
304
309
  declare function convertLegacyEntityContentExtension(LegacyExtension: ComponentType<{}>, overrides?: {
305
310
  name?: string;
306
311
  filter?: string | EntityPredicate | ((entity: Entity) => boolean);
307
- defaultPath?: string;
308
- defaultTitle?: string;
312
+ path?: string;
313
+ title?: string;
314
+ /**
315
+ * @deprecated Use the `path` param instead.
316
+ */
317
+ defaultPath?: [Error: `Use the 'path' override instead`];
318
+ /**
319
+ * @deprecated Use the `path` param instead.
320
+ */
321
+ defaultTitle?: [Error: `Use the 'title' override instead`];
309
322
  }): ExtensionDefinition;
310
323
 
311
324
  /** @alpha */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-catalog-react",
3
- "version": "1.20.0-next.1",
3
+ "version": "1.20.0-next.2",
4
4
  "description": "A frontend library that helps other Backstage plugins interact with the catalog",
5
5
  "backstage": {
6
6
  "role": "web-library",
@@ -75,12 +75,12 @@
75
75
  "dependencies": {
76
76
  "@backstage/catalog-client": "1.11.0-next.0",
77
77
  "@backstage/catalog-model": "1.7.5",
78
- "@backstage/core-compat-api": "0.4.5-next.1",
79
- "@backstage/core-components": "0.17.5-next.0",
78
+ "@backstage/core-compat-api": "0.5.0-next.2",
79
+ "@backstage/core-components": "0.17.5-next.1",
80
80
  "@backstage/core-plugin-api": "1.10.9",
81
81
  "@backstage/errors": "1.2.7",
82
- "@backstage/frontend-plugin-api": "0.11.0-next.0",
83
- "@backstage/frontend-test-utils": "0.3.5-next.1",
82
+ "@backstage/frontend-plugin-api": "0.11.0-next.1",
83
+ "@backstage/frontend-test-utils": "0.3.5-next.2",
84
84
  "@backstage/integration-react": "1.2.9",
85
85
  "@backstage/plugin-catalog-common": "1.1.5",
86
86
  "@backstage/plugin-permission-common": "0.9.1",
@@ -100,7 +100,7 @@
100
100
  "zen-observable": "^0.10.0"
101
101
  },
102
102
  "devDependencies": {
103
- "@backstage/cli": "0.33.2-next.0",
103
+ "@backstage/cli": "0.34.0-next.1",
104
104
  "@backstage/core-app-api": "1.18.0",
105
105
  "@backstage/plugin-catalog-common": "1.1.5",
106
106
  "@backstage/plugin-scaffolder-common": "1.7.0-next.0",