@backstage/plugin-catalog-react 0.0.0-nightly-20220313021839 → 0.0.0-nightly-20220316022902

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,17 +1,36 @@
1
1
  # @backstage/plugin-catalog-react
2
2
 
3
- ## 0.0.0-nightly-20220313021839
3
+ ## 0.0.0-nightly-20220316022902
4
+
5
+ ### Major Changes
6
+
7
+ - b58c70c223: This package has been promoted to v1.0! To understand how this change affects the package, please check out our [versioning policy](https://backstage.io/docs/overview/versioning-policy).
8
+
9
+ ### Minor Changes
10
+
11
+ - f7fb7295e6: **BREAKING**: Removed the deprecated `favoriteEntityTooltip` and `favoriteEntityIcon` functions.
12
+ - 4cd92028b8: **BREAKING**: The following deprecated annotation reading helper functions were removed:
13
+
14
+ - `getEntityMetadataViewUrl`, use `entity.metadata.annotations?.[ANNOTATION_VIEW_URL]` instead.
15
+ - `getEntityMetadataEditUrl`, use `entity.metadata.annotations?.[ANNOTATION_EDIT_URL]` instead.
16
+
17
+ - 1f2757bb07: **BREAKING**: The `useEntity` hook no longer returns loading or error states, and will throw an error if the entity is not immediately available. In practice this means that `useEntity` can only be used in contexts where the entity is guaranteed to have been loaded, for example inside an `EntityLayout`. To access the loading state of the entity, use `useAsyncEntity` instead.
18
+ - 0f3520d499: **BREAKING**: Removed the deprecated `formatEntityRefTitle`, use `humanizeEntityRef` instead.
4
19
 
5
20
  ### Patch Changes
6
21
 
7
22
  - a422d7ce5e: chore(deps): bump `@testing-library/react` from 11.2.6 to 12.1.3
8
23
  - Updated dependencies
9
- - @backstage/core-components@0.0.0-nightly-20220313021839
10
- - @backstage/core-plugin-api@0.0.0-nightly-20220313021839
11
- - @backstage/version-bridge@0.0.0-nightly-20220313021839
12
- - @backstage/plugin-permission-react@0.0.0-nightly-20220313021839
13
- - @backstage/catalog-model@0.0.0-nightly-20220313021839
14
- - @backstage/catalog-client@0.0.0-nightly-20220313021839
24
+ - @backstage/core-components@0.0.0-nightly-20220316022902
25
+ - @backstage/core-plugin-api@0.0.0-nightly-20220316022902
26
+ - @backstage/version-bridge@0.0.0-nightly-20220316022902
27
+ - @backstage/plugin-permission-react@0.0.0-nightly-20220316022902
28
+ - @backstage/catalog-model@0.0.0-nightly-20220316022902
29
+ - @backstage/integration@0.0.0-nightly-20220316022902
30
+ - @backstage/catalog-client@0.0.0-nightly-20220316022902
31
+ - @backstage/errors@0.0.0-nightly-20220316022902
32
+ - @backstage/types@0.0.0-nightly-20220316022902
33
+ - @backstage/plugin-permission-common@0.0.0-nightly-20220316022902
15
34
 
16
35
  ## 0.9.0
17
36
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-catalog-react",
3
- "version": "0.0.0-nightly-20220313021839",
3
+ "version": "0.0.0-nightly-20220316022902",
4
4
  "main": "../dist/index.esm.js",
5
5
  "types": "../dist/index.alpha.d.ts"
6
6
  }
@@ -432,37 +432,11 @@ export declare interface EntityTypePickerProps {
432
432
  */
433
433
  export declare const FavoriteEntity: (props: FavoriteEntityProps) => JSX.Element;
434
434
 
435
- /**
436
- * @public
437
- * @deprecated due to low utility value.
438
- */
439
- export declare const favoriteEntityIcon: (isStarred: boolean) => JSX.Element;
440
-
441
435
  /** @public */
442
436
  export declare type FavoriteEntityProps = ComponentProps<typeof IconButton> & {
443
437
  entity: Entity;
444
438
  };
445
439
 
446
- /**
447
- * @public
448
- * @deprecated due to low utility value.
449
- */
450
- export declare const favoriteEntityTooltip: (isStarred: boolean) => "Remove from favorites" | "Add to favorites";
451
-
452
- /** @public @deprecated please use {@link humanizeEntityRef} instead */
453
- export declare const formatEntityRefTitle: typeof humanizeEntityRef;
454
-
455
- /**
456
- * @public
457
- * @deprecated use entity.metadata.annotations?.[ANNOTATION_EDIT_URL] instead.
458
- */
459
- export declare function getEntityMetadataEditUrl(entity: Entity): string | undefined;
460
-
461
- /**
462
- * @public
463
- * @deprecated use entity.metadata.annotations?.[ANNOTATION_VIEW_URL] instead. */
464
- export declare function getEntityMetadataViewUrl(entity: Entity): string | undefined;
465
-
466
440
  /**
467
441
  * Get the related entity references.
468
442
  *
@@ -571,12 +545,6 @@ export declare function useAsyncEntity<TEntity extends Entity = Entity>(): Entit
571
545
  */
572
546
  export declare function useEntity<TEntity extends Entity = Entity>(): {
573
547
  entity: TEntity;
574
- /** @deprecated use {@link useAsyncEntity} instead */
575
- loading: boolean;
576
- /** @deprecated use {@link useAsyncEntity} instead */
577
- error?: Error;
578
- /** @deprecated use {@link useAsyncEntity} instead */
579
- refresh?: VoidFunction;
580
548
  };
581
549
 
582
550
  /**
@@ -432,37 +432,11 @@ export declare interface EntityTypePickerProps {
432
432
  */
433
433
  export declare const FavoriteEntity: (props: FavoriteEntityProps) => JSX.Element;
434
434
 
435
- /**
436
- * @public
437
- * @deprecated due to low utility value.
438
- */
439
- export declare const favoriteEntityIcon: (isStarred: boolean) => JSX.Element;
440
-
441
435
  /** @public */
442
436
  export declare type FavoriteEntityProps = ComponentProps<typeof IconButton> & {
443
437
  entity: Entity;
444
438
  };
445
439
 
446
- /**
447
- * @public
448
- * @deprecated due to low utility value.
449
- */
450
- export declare const favoriteEntityTooltip: (isStarred: boolean) => "Remove from favorites" | "Add to favorites";
451
-
452
- /** @public @deprecated please use {@link humanizeEntityRef} instead */
453
- export declare const formatEntityRefTitle: typeof humanizeEntityRef;
454
-
455
- /**
456
- * @public
457
- * @deprecated use entity.metadata.annotations?.[ANNOTATION_EDIT_URL] instead.
458
- */
459
- export declare function getEntityMetadataEditUrl(entity: Entity): string | undefined;
460
-
461
- /**
462
- * @public
463
- * @deprecated use entity.metadata.annotations?.[ANNOTATION_VIEW_URL] instead. */
464
- export declare function getEntityMetadataViewUrl(entity: Entity): string | undefined;
465
-
466
440
  /**
467
441
  * Get the related entity references.
468
442
  *
@@ -562,12 +536,6 @@ export declare function useAsyncEntity<TEntity extends Entity = Entity>(): Entit
562
536
  */
563
537
  export declare function useEntity<TEntity extends Entity = Entity>(): {
564
538
  entity: TEntity;
565
- /** @deprecated use {@link useAsyncEntity} instead */
566
- loading: boolean;
567
- /** @deprecated use {@link useAsyncEntity} instead */
568
- error?: Error;
569
- /** @deprecated use {@link useAsyncEntity} instead */
570
- refresh?: VoidFunction;
571
539
  };
572
540
 
573
541
  /**
package/dist/index.d.ts CHANGED
@@ -432,37 +432,11 @@ export declare interface EntityTypePickerProps {
432
432
  */
433
433
  export declare const FavoriteEntity: (props: FavoriteEntityProps) => JSX.Element;
434
434
 
435
- /**
436
- * @public
437
- * @deprecated due to low utility value.
438
- */
439
- export declare const favoriteEntityIcon: (isStarred: boolean) => JSX.Element;
440
-
441
435
  /** @public */
442
436
  export declare type FavoriteEntityProps = ComponentProps<typeof IconButton> & {
443
437
  entity: Entity;
444
438
  };
445
439
 
446
- /**
447
- * @public
448
- * @deprecated due to low utility value.
449
- */
450
- export declare const favoriteEntityTooltip: (isStarred: boolean) => "Remove from favorites" | "Add to favorites";
451
-
452
- /** @public @deprecated please use {@link humanizeEntityRef} instead */
453
- export declare const formatEntityRefTitle: typeof humanizeEntityRef;
454
-
455
- /**
456
- * @public
457
- * @deprecated use entity.metadata.annotations?.[ANNOTATION_EDIT_URL] instead.
458
- */
459
- export declare function getEntityMetadataEditUrl(entity: Entity): string | undefined;
460
-
461
- /**
462
- * @public
463
- * @deprecated use entity.metadata.annotations?.[ANNOTATION_VIEW_URL] instead. */
464
- export declare function getEntityMetadataViewUrl(entity: Entity): string | undefined;
465
-
466
440
  /**
467
441
  * Get the related entity references.
468
442
  *
@@ -562,12 +536,6 @@ export declare function useAsyncEntity<TEntity extends Entity = Entity>(): Entit
562
536
  */
563
537
  export declare function useEntity<TEntity extends Entity = Entity>(): {
564
538
  entity: TEntity;
565
- /** @deprecated use {@link useAsyncEntity} instead */
566
- loading: boolean;
567
- /** @deprecated use {@link useAsyncEntity} instead */
568
- error?: Error;
569
- /** @deprecated use {@link useAsyncEntity} instead */
570
- refresh?: VoidFunction;
571
539
  };
572
540
 
573
541
  /**
package/dist/index.esm.js CHANGED
@@ -10,7 +10,7 @@ import { useLocation, useNavigate } from 'react-router';
10
10
  import useAsyncFn from 'react-use/lib/useAsyncFn';
11
11
  import useDebounce from 'react-use/lib/useDebounce';
12
12
  import useMountedState from 'react-use/lib/useMountedState';
13
- import { ANNOTATION_VIEW_URL, ANNOTATION_EDIT_URL, parseEntityRef, ANNOTATION_SOURCE_LOCATION, parseLocationRef, RELATION_MEMBER_OF, getCompoundEntityRef, stringifyEntityRef, RELATION_OWNED_BY, DEFAULT_NAMESPACE, RELATION_PART_OF, ANNOTATION_LOCATION, ANNOTATION_ORIGIN_LOCATION } from '@backstage/catalog-model';
13
+ import { parseEntityRef, ANNOTATION_SOURCE_LOCATION, parseLocationRef, RELATION_MEMBER_OF, getCompoundEntityRef, stringifyEntityRef, RELATION_OWNED_BY, DEFAULT_NAMESPACE, RELATION_PART_OF, ANNOTATION_LOCATION, ANNOTATION_ORIGIN_LOCATION } from '@backstage/catalog-model';
14
14
  import useAsync from 'react-use/lib/useAsync';
15
15
  import isEqual$1 from 'lodash/isEqual';
16
16
  import sortBy from 'lodash/sortBy';
@@ -99,10 +99,9 @@ function useEntity() {
99
99
  throw new Error("EntityContext v1 not available");
100
100
  }
101
101
  if (!value.entity) {
102
- console.warn("DEPRECATION: useEntity hook is being called outside of an EntityLayout where the entity has not been loaded. If this is intentional, please use useAsyncEntity instead. This warning will be replaced with an error in future releases.");
102
+ 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.");
103
103
  }
104
- const { entity, loading, error, refresh } = value;
105
- return { entity, loading, error, refresh };
104
+ return { entity: value.entity };
106
105
  }
107
106
  function useAsyncEntity() {
108
107
  const versionedHolder = useVersionedContext("entity-context");
@@ -129,15 +128,6 @@ function reduceEntityFilters(filters) {
129
128
  return (entity) => filters.every((filter) => !filter.filterEntity || filter.filterEntity(entity));
130
129
  }
131
130
 
132
- function getEntityMetadataViewUrl(entity) {
133
- var _a;
134
- return (_a = entity.metadata.annotations) == null ? void 0 : _a[ANNOTATION_VIEW_URL];
135
- }
136
- function getEntityMetadataEditUrl(entity) {
137
- var _a;
138
- return (_a = entity.metadata.annotations) == null ? void 0 : _a[ANNOTATION_EDIT_URL];
139
- }
140
-
141
131
  function getEntityRelations(entity, relationType, filter) {
142
132
  var _a;
143
133
  let entityNames = ((_a = entity == null ? void 0 : entity.relations) == null ? void 0 : _a.filter((r) => r.type === relationType).map((r) => parseEntityRef(r.targetRef))) || [];
@@ -278,7 +268,6 @@ function entityRouteParams(entity) {
278
268
  };
279
269
  }
280
270
 
281
- const formatEntityRefTitle = humanizeEntityRef;
282
271
  function humanizeEntityRef(entityRef, opts) {
283
272
  const defaultKind = opts == null ? void 0 : opts.defaultKind;
284
273
  let kind;
@@ -609,7 +598,11 @@ function useEntityOwnership() {
609
598
  }
610
599
 
611
600
  function useEntityPermission(permission) {
612
- const { entity, loading: loadingEntity, error: entityError } = useEntity();
601
+ const {
602
+ entity,
603
+ loading: loadingEntity,
604
+ error: entityError
605
+ } = useAsyncEntity();
613
606
  const {
614
607
  allowed,
615
608
  loading: loadingPermission,
@@ -1083,8 +1076,6 @@ const YellowStar = withStyles({
1083
1076
  color: "#f3ba37"
1084
1077
  }
1085
1078
  })(Star);
1086
- const favoriteEntityTooltip = (isStarred) => isStarred ? "Remove from favorites" : "Add to favorites";
1087
- const favoriteEntityIcon = (isStarred) => isStarred ? /* @__PURE__ */ React.createElement(YellowStar, null) : /* @__PURE__ */ React.createElement(StarBorder, null);
1088
1079
  const FavoriteEntity = (props) => {
1089
1080
  const { toggleStarredEntity, isStarredEntity } = useStarredEntity(props.entity);
1090
1081
  return /* @__PURE__ */ React.createElement(IconButton, {
@@ -2022,5 +2013,5 @@ const MockEntityListContextProvider = ({
2022
2013
  }, children);
2023
2014
  };
2024
2015
 
2025
- export { AsyncEntityProvider, EntityKindFilter, EntityKindPicker, EntityLifecycleFilter, EntityLifecyclePicker, EntityListContext, EntityListProvider, EntityOwnerFilter, EntityOwnerPicker, EntityProvider, EntityRefLink, EntityRefLinks, EntitySearchBar, EntityTable, EntityTagFilter, EntityTagPicker, EntityTextFilter, EntityTypeFilter, EntityTypePicker, FavoriteEntity, InspectEntityDialog, MockEntityListContextProvider, MockStarredEntitiesApi, UnregisterEntityDialog, UserListFilter, UserListPicker, catalogApiRef, columnFactories, entityRouteParams, entityRouteRef, favoriteEntityIcon, favoriteEntityTooltip, formatEntityRefTitle, getEntityMetadataEditUrl, getEntityMetadataViewUrl, getEntityRelations, getEntitySourceLocation, humanizeEntityRef, isOwnerOf, starredEntitiesApiRef, useAsyncEntity, useEntity, useEntityList, useEntityOwnership, useEntityPermission, useEntityTypeFilter, useRelatedEntities, useStarredEntities, useStarredEntity };
2016
+ export { AsyncEntityProvider, EntityKindFilter, EntityKindPicker, EntityLifecycleFilter, EntityLifecyclePicker, EntityListContext, EntityListProvider, EntityOwnerFilter, EntityOwnerPicker, EntityProvider, EntityRefLink, EntityRefLinks, EntitySearchBar, EntityTable, EntityTagFilter, EntityTagPicker, EntityTextFilter, EntityTypeFilter, EntityTypePicker, FavoriteEntity, InspectEntityDialog, MockEntityListContextProvider, MockStarredEntitiesApi, UnregisterEntityDialog, UserListFilter, UserListPicker, catalogApiRef, columnFactories, entityRouteParams, entityRouteRef, getEntityRelations, getEntitySourceLocation, humanizeEntityRef, isOwnerOf, starredEntitiesApiRef, useAsyncEntity, useEntity, useEntityList, useEntityOwnership, useEntityPermission, useEntityTypeFilter, useRelatedEntities, useStarredEntities, useStarredEntity };
2026
2017
  //# sourceMappingURL=index.esm.js.map