@backstage/plugin-catalog-react 0.8.1 → 0.9.0-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,34 @@
1
1
  # @backstage/plugin-catalog-react
2
2
 
3
+ ## 0.9.0-next.0
4
+
5
+ ### Minor Changes
6
+
7
+ - b0af81726d: **BREAKING**: Removed `reduceCatalogFilters` and `reduceEntityFilters` due to low external utility value.
8
+ - 7ffb2c73c9: **BREAKING**: Removed the deprecated `loadCatalogOwnerRefs` function. Usages of this function can be directly replaced with `ownershipEntityRefs` from `identityApi.getBackstageIdentity()`.
9
+
10
+ This also affects the `useEntityOwnership` hook in that it no longer uses `loadCatalogOwnerRefs`, meaning it will no longer load in additional relations and instead only rely on the `ownershipEntityRefs` from the `IdentityApi`.
11
+
12
+ - dd88d1e3ac: **BREAKING**: Removed `useEntityFromUrl`.
13
+ - 9844d4d2bd: **BREAKING**: Removed `useEntityCompoundName`, use `useRouteRefParams(entityRouteRef)` instead.
14
+ - 2b8c986ce0: **BREAKING**: Removed `useEntityListProvider` use `useEntityList` instead.
15
+ - f3a7a9de6d: **BREAKING**: Removed `useOwnedEntities` and moved its usage internally to the scaffolder-backend where it's used.
16
+
17
+ **BREAKING**: Removed `EntityTypeReturn` type which is now inlined.
18
+
19
+ - cf1ff5b438: **BREAKING**: Removed the `useEntityKinds` hook, use `catalogApi.getEntityFacets({ facets: ['kind'] })` instead.
20
+ - fc6290a76d: **BREAKING**: Removed the deprecated `useOwnUser` hook. Existing usage can be replaced with `identityApi.getBackstageIdentity()`, followed by a call to `catalogClient.getEntityByRef(identity.userEntityRef)`.
21
+
22
+ ### Patch Changes
23
+
24
+ - b1aacbf96a: Applied the fix for the `/alpha` entry point resolution that was part of the `v0.70.1` release of Backstage.
25
+ - 2986f8e09d: Fixed EntityOwnerPicker and OwnershipCard url filter issue with more than 21 owners
26
+ - f3a7a9de6d: Internalized usage of `useOwnedEntities` hook.
27
+ - Updated dependencies
28
+ - @backstage/core-components@0.9.1-next.0
29
+ - @backstage/catalog-model@0.13.0-next.0
30
+ - @backstage/catalog-client@0.9.0-next.0
31
+
3
32
  ## 0.8.1
4
33
 
5
34
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-catalog-react",
3
- "version": "0.8.1",
3
+ "version": "0.9.0-next.0",
4
4
  "main": "../dist/index.esm.js",
5
5
  "types": "../dist/index.alpha.d.ts"
6
6
  }
@@ -7,14 +7,12 @@
7
7
  /// <reference types="react" />
8
8
 
9
9
  import { ApiRef } from '@backstage/core-plugin-api';
10
- import { AsyncState } from 'react-use/lib/useAsync';
11
10
  import { CATALOG_FILTER_EXISTS } from '@backstage/catalog-client';
12
11
  import { CatalogApi } from '@backstage/catalog-client';
13
12
  import { ComponentEntity } from '@backstage/catalog-model';
14
13
  import { ComponentProps } from 'react';
15
14
  import { CompoundEntityRef } from '@backstage/catalog-model';
16
15
  import { Entity } from '@backstage/catalog-model';
17
- import { GetEntitiesResponse } from '@backstage/catalog-client';
18
16
  import { IconButton } from '@material-ui/core';
19
17
  import { LinkProps } from '@backstage/core-components';
20
18
  import { Observable } from '@backstage/types';
@@ -28,7 +26,6 @@ import { ScmIntegrationRegistry } from '@backstage/integration';
28
26
  import { StyleRules } from '@material-ui/core/styles/withStyles';
29
27
  import { SystemEntity } from '@backstage/catalog-model';
30
28
  import { TableColumn } from '@backstage/core-components';
31
- import { UserEntity } from '@backstage/catalog-model';
32
29
 
33
30
  /**
34
31
  * Provides a loaded entity to be picked up by the `useEntity` hook.
@@ -428,17 +425,6 @@ export declare interface EntityTypePickerProps {
428
425
  hidden?: boolean;
429
426
  }
430
427
 
431
- /** @public
432
- * @deprecated type inlined with {@link useEntityTypeFilter}.
433
- */
434
- export declare type EntityTypeReturn = {
435
- loading: boolean;
436
- error?: Error;
437
- availableTypes: string[];
438
- selectedTypes: string[];
439
- setSelectedTypes: (types: string[]) => void;
440
- };
441
-
442
428
  /**
443
429
  * IconButton for showing if a current entity is starred and adding/removing it from the favorite entities
444
430
  * @param props - MaterialUI IconButton props extended by required `entity` prop
@@ -516,20 +502,6 @@ export declare function InspectEntityDialog(props: {
516
502
  */
517
503
  export declare function isOwnerOf(owner: Entity, entity: Entity): boolean;
518
504
 
519
- /**
520
- * Takes the relevant parts of the User entity corresponding to the Backstage
521
- * identity, and translates them into a list of entity refs on string form that
522
- * represent the user's ownership connections.
523
- *
524
- * @public
525
- *
526
- * @param catalogApi - The Catalog API implementation
527
- * @param identityOwnerRefs - List of identity owner refs as strings
528
- * @returns OwnerRefs as a string array
529
- * @deprecated Use `ownershipEntityRefs` from `identityApi.getBackstageIdentity()` instead.
530
- */
531
- export declare function loadCatalogOwnerRefs(catalogApi: CatalogApi, identityOwnerRefs: string[]): Promise<string[]>;
532
-
533
505
  /** @public */
534
506
  export declare const MockEntityListContextProvider: ({ children, value, }: React_2.PropsWithChildren<{
535
507
  value?: Partial<EntityListContextProps<DefaultEntityFilters>> | undefined;
@@ -548,18 +520,6 @@ export declare class MockStarredEntitiesApi implements StarredEntitiesApi {
548
520
  starredEntitie$(): Observable<Set<string>>;
549
521
  }
550
522
 
551
- /**
552
- * @public
553
- * @deprecated will be made private.
554
- */
555
- export declare function reduceCatalogFilters(filters: EntityFilter[]): Record<string, string | symbol | (string | symbol)[]>;
556
-
557
- /**
558
- * @public
559
- * @deprecated will be made private.
560
- */
561
- export declare function reduceEntityFilters(filters: EntityFilter[]): (entity: Entity) => boolean;
562
-
563
523
  /**
564
524
  * An API to store and retrieve starred entities
565
525
  *
@@ -619,46 +579,12 @@ export declare function useEntity<TEntity extends Entity = Entity>(): {
619
579
  refresh?: VoidFunction;
620
580
  };
621
581
 
622
- /**
623
- * Grabs entity kind, namespace, and name from the location
624
- * @public
625
- * @deprecated use {@link @backstage/core-plugin-api#useRouteRefParams} instead
626
- */
627
- export declare const useEntityCompoundName: () => {
628
- kind: string;
629
- namespace: string;
630
- name: string;
631
- };
632
-
633
- /** @public
634
- * @deprecated will be deleted shortly due to low external usage, re-implement if needed.
635
- */
636
- export declare const useEntityFromUrl: () => EntityLoadingStatus;
637
-
638
- /**
639
- * Retrieve a list of unique entity kinds present in the catalog
640
- * @public
641
- * @deprecated and will be removed due to low utility value.
642
- */
643
- export declare function useEntityKinds(): {
644
- error: Error | undefined;
645
- loading: boolean;
646
- kinds: string[] | undefined;
647
- };
648
-
649
582
  /**
650
583
  * Hook for interacting with the entity list context provided by the {@link EntityListProvider}.
651
584
  * @public
652
585
  */
653
586
  export declare function useEntityList<EntityFilters extends DefaultEntityFilters = DefaultEntityFilters>(): EntityListContextProps<EntityFilters>;
654
587
 
655
- /**
656
- * Hook for interacting with the entity list context provided by the {@link EntityListProvider}.
657
- * @public
658
- * @deprecated use {@link useEntityList} instead.
659
- */
660
- export declare function useEntityListProvider<EntityFilters extends DefaultEntityFilters = DefaultEntityFilters>(): EntityListContextProps<EntityFilters>;
661
-
662
588
  /**
663
589
  * Returns a function that checks whether the currently signed-in user is an
664
590
  * owner of a given entity. When the hook is initially mounted, the loading
@@ -704,28 +630,6 @@ export declare function useEntityTypeFilter(): {
704
630
  setSelectedTypes: (types: string[]) => void;
705
631
  };
706
632
 
707
- /**
708
- * Takes the relevant parts of the Backstage identity, and translates them into
709
- * a list of entities which are owned by the user. Takes an optional parameter
710
- * to filter the entities based on allowedKinds
711
- *
712
- * @public
713
- *
714
- * @param allowedKinds - Array of allowed kinds to filter the entities
715
- * @deprecated Use `ownershipEntityRefs` from `identityApi.getBackstageIdentity()` instead.
716
- */
717
- export declare function useOwnedEntities(allowedKinds?: string[]): {
718
- loading: boolean;
719
- ownedEntities: GetEntitiesResponse | undefined;
720
- };
721
-
722
- /**
723
- * Get the catalog User entity (if any) that matches the logged-in user.
724
- * @public
725
- * @deprecated due to low external usage.
726
- */
727
- export declare function useOwnUser(): AsyncState<UserEntity | undefined>;
728
-
729
633
  /** @public */
730
634
  export declare function useRelatedEntities(entity: Entity, relationFilter: {
731
635
  type?: string;
@@ -7,14 +7,12 @@
7
7
  /// <reference types="react" />
8
8
 
9
9
  import { ApiRef } from '@backstage/core-plugin-api';
10
- import { AsyncState } from 'react-use/lib/useAsync';
11
10
  import { CATALOG_FILTER_EXISTS } from '@backstage/catalog-client';
12
11
  import { CatalogApi } from '@backstage/catalog-client';
13
12
  import { ComponentEntity } from '@backstage/catalog-model';
14
13
  import { ComponentProps } from 'react';
15
14
  import { CompoundEntityRef } from '@backstage/catalog-model';
16
15
  import { Entity } from '@backstage/catalog-model';
17
- import { GetEntitiesResponse } from '@backstage/catalog-client';
18
16
  import { IconButton } from '@material-ui/core';
19
17
  import { LinkProps } from '@backstage/core-components';
20
18
  import { Observable } from '@backstage/types';
@@ -28,7 +26,6 @@ import { ScmIntegrationRegistry } from '@backstage/integration';
28
26
  import { StyleRules } from '@material-ui/core/styles/withStyles';
29
27
  import { SystemEntity } from '@backstage/catalog-model';
30
28
  import { TableColumn } from '@backstage/core-components';
31
- import { UserEntity } from '@backstage/catalog-model';
32
29
 
33
30
  /**
34
31
  * Provides a loaded entity to be picked up by the `useEntity` hook.
@@ -428,17 +425,6 @@ export declare interface EntityTypePickerProps {
428
425
  hidden?: boolean;
429
426
  }
430
427
 
431
- /** @public
432
- * @deprecated type inlined with {@link useEntityTypeFilter}.
433
- */
434
- export declare type EntityTypeReturn = {
435
- loading: boolean;
436
- error?: Error;
437
- availableTypes: string[];
438
- selectedTypes: string[];
439
- setSelectedTypes: (types: string[]) => void;
440
- };
441
-
442
428
  /**
443
429
  * IconButton for showing if a current entity is starred and adding/removing it from the favorite entities
444
430
  * @param props - MaterialUI IconButton props extended by required `entity` prop
@@ -507,20 +493,6 @@ export declare function InspectEntityDialog(props: {
507
493
 
508
494
  /* Excluded from this release type: isOwnerOf */
509
495
 
510
- /**
511
- * Takes the relevant parts of the User entity corresponding to the Backstage
512
- * identity, and translates them into a list of entity refs on string form that
513
- * represent the user's ownership connections.
514
- *
515
- * @public
516
- *
517
- * @param catalogApi - The Catalog API implementation
518
- * @param identityOwnerRefs - List of identity owner refs as strings
519
- * @returns OwnerRefs as a string array
520
- * @deprecated Use `ownershipEntityRefs` from `identityApi.getBackstageIdentity()` instead.
521
- */
522
- export declare function loadCatalogOwnerRefs(catalogApi: CatalogApi, identityOwnerRefs: string[]): Promise<string[]>;
523
-
524
496
  /** @public */
525
497
  export declare const MockEntityListContextProvider: ({ children, value, }: React_2.PropsWithChildren<{
526
498
  value?: Partial<EntityListContextProps<DefaultEntityFilters>> | undefined;
@@ -539,18 +511,6 @@ export declare class MockStarredEntitiesApi implements StarredEntitiesApi {
539
511
  starredEntitie$(): Observable<Set<string>>;
540
512
  }
541
513
 
542
- /**
543
- * @public
544
- * @deprecated will be made private.
545
- */
546
- export declare function reduceCatalogFilters(filters: EntityFilter[]): Record<string, string | symbol | (string | symbol)[]>;
547
-
548
- /**
549
- * @public
550
- * @deprecated will be made private.
551
- */
552
- export declare function reduceEntityFilters(filters: EntityFilter[]): (entity: Entity) => boolean;
553
-
554
514
  /**
555
515
  * An API to store and retrieve starred entities
556
516
  *
@@ -610,46 +570,12 @@ export declare function useEntity<TEntity extends Entity = Entity>(): {
610
570
  refresh?: VoidFunction;
611
571
  };
612
572
 
613
- /**
614
- * Grabs entity kind, namespace, and name from the location
615
- * @public
616
- * @deprecated use {@link @backstage/core-plugin-api#useRouteRefParams} instead
617
- */
618
- export declare const useEntityCompoundName: () => {
619
- kind: string;
620
- namespace: string;
621
- name: string;
622
- };
623
-
624
- /** @public
625
- * @deprecated will be deleted shortly due to low external usage, re-implement if needed.
626
- */
627
- export declare const useEntityFromUrl: () => EntityLoadingStatus;
628
-
629
- /**
630
- * Retrieve a list of unique entity kinds present in the catalog
631
- * @public
632
- * @deprecated and will be removed due to low utility value.
633
- */
634
- export declare function useEntityKinds(): {
635
- error: Error | undefined;
636
- loading: boolean;
637
- kinds: string[] | undefined;
638
- };
639
-
640
573
  /**
641
574
  * Hook for interacting with the entity list context provided by the {@link EntityListProvider}.
642
575
  * @public
643
576
  */
644
577
  export declare function useEntityList<EntityFilters extends DefaultEntityFilters = DefaultEntityFilters>(): EntityListContextProps<EntityFilters>;
645
578
 
646
- /**
647
- * Hook for interacting with the entity list context provided by the {@link EntityListProvider}.
648
- * @public
649
- * @deprecated use {@link useEntityList} instead.
650
- */
651
- export declare function useEntityListProvider<EntityFilters extends DefaultEntityFilters = DefaultEntityFilters>(): EntityListContextProps<EntityFilters>;
652
-
653
579
  /**
654
580
  * Returns a function that checks whether the currently signed-in user is an
655
581
  * owner of a given entity. When the hook is initially mounted, the loading
@@ -680,28 +606,6 @@ export declare function useEntityTypeFilter(): {
680
606
  setSelectedTypes: (types: string[]) => void;
681
607
  };
682
608
 
683
- /**
684
- * Takes the relevant parts of the Backstage identity, and translates them into
685
- * a list of entities which are owned by the user. Takes an optional parameter
686
- * to filter the entities based on allowedKinds
687
- *
688
- * @public
689
- *
690
- * @param allowedKinds - Array of allowed kinds to filter the entities
691
- * @deprecated Use `ownershipEntityRefs` from `identityApi.getBackstageIdentity()` instead.
692
- */
693
- export declare function useOwnedEntities(allowedKinds?: string[]): {
694
- loading: boolean;
695
- ownedEntities: GetEntitiesResponse | undefined;
696
- };
697
-
698
- /**
699
- * Get the catalog User entity (if any) that matches the logged-in user.
700
- * @public
701
- * @deprecated due to low external usage.
702
- */
703
- export declare function useOwnUser(): AsyncState<UserEntity | undefined>;
704
-
705
609
  /** @public */
706
610
  export declare function useRelatedEntities(entity: Entity, relationFilter: {
707
611
  type?: string;
package/dist/index.d.ts CHANGED
@@ -7,14 +7,12 @@
7
7
  /// <reference types="react" />
8
8
 
9
9
  import { ApiRef } from '@backstage/core-plugin-api';
10
- import { AsyncState } from 'react-use/lib/useAsync';
11
10
  import { CATALOG_FILTER_EXISTS } from '@backstage/catalog-client';
12
11
  import { CatalogApi } from '@backstage/catalog-client';
13
12
  import { ComponentEntity } from '@backstage/catalog-model';
14
13
  import { ComponentProps } from 'react';
15
14
  import { CompoundEntityRef } from '@backstage/catalog-model';
16
15
  import { Entity } from '@backstage/catalog-model';
17
- import { GetEntitiesResponse } from '@backstage/catalog-client';
18
16
  import { IconButton } from '@material-ui/core';
19
17
  import { LinkProps } from '@backstage/core-components';
20
18
  import { Observable } from '@backstage/types';
@@ -28,7 +26,6 @@ import { ScmIntegrationRegistry } from '@backstage/integration';
28
26
  import { StyleRules } from '@material-ui/core/styles/withStyles';
29
27
  import { SystemEntity } from '@backstage/catalog-model';
30
28
  import { TableColumn } from '@backstage/core-components';
31
- import { UserEntity } from '@backstage/catalog-model';
32
29
 
33
30
  /**
34
31
  * Provides a loaded entity to be picked up by the `useEntity` hook.
@@ -428,17 +425,6 @@ export declare interface EntityTypePickerProps {
428
425
  hidden?: boolean;
429
426
  }
430
427
 
431
- /** @public
432
- * @deprecated type inlined with {@link useEntityTypeFilter}.
433
- */
434
- export declare type EntityTypeReturn = {
435
- loading: boolean;
436
- error?: Error;
437
- availableTypes: string[];
438
- selectedTypes: string[];
439
- setSelectedTypes: (types: string[]) => void;
440
- };
441
-
442
428
  /**
443
429
  * IconButton for showing if a current entity is starred and adding/removing it from the favorite entities
444
430
  * @param props - MaterialUI IconButton props extended by required `entity` prop
@@ -507,20 +493,6 @@ export declare function InspectEntityDialog(props: {
507
493
 
508
494
  /* Excluded from this release type: isOwnerOf */
509
495
 
510
- /**
511
- * Takes the relevant parts of the User entity corresponding to the Backstage
512
- * identity, and translates them into a list of entity refs on string form that
513
- * represent the user's ownership connections.
514
- *
515
- * @public
516
- *
517
- * @param catalogApi - The Catalog API implementation
518
- * @param identityOwnerRefs - List of identity owner refs as strings
519
- * @returns OwnerRefs as a string array
520
- * @deprecated Use `ownershipEntityRefs` from `identityApi.getBackstageIdentity()` instead.
521
- */
522
- export declare function loadCatalogOwnerRefs(catalogApi: CatalogApi, identityOwnerRefs: string[]): Promise<string[]>;
523
-
524
496
  /** @public */
525
497
  export declare const MockEntityListContextProvider: ({ children, value, }: React_2.PropsWithChildren<{
526
498
  value?: Partial<EntityListContextProps<DefaultEntityFilters>> | undefined;
@@ -539,18 +511,6 @@ export declare class MockStarredEntitiesApi implements StarredEntitiesApi {
539
511
  starredEntitie$(): Observable<Set<string>>;
540
512
  }
541
513
 
542
- /**
543
- * @public
544
- * @deprecated will be made private.
545
- */
546
- export declare function reduceCatalogFilters(filters: EntityFilter[]): Record<string, string | symbol | (string | symbol)[]>;
547
-
548
- /**
549
- * @public
550
- * @deprecated will be made private.
551
- */
552
- export declare function reduceEntityFilters(filters: EntityFilter[]): (entity: Entity) => boolean;
553
-
554
514
  /**
555
515
  * An API to store and retrieve starred entities
556
516
  *
@@ -610,46 +570,12 @@ export declare function useEntity<TEntity extends Entity = Entity>(): {
610
570
  refresh?: VoidFunction;
611
571
  };
612
572
 
613
- /**
614
- * Grabs entity kind, namespace, and name from the location
615
- * @public
616
- * @deprecated use {@link @backstage/core-plugin-api#useRouteRefParams} instead
617
- */
618
- export declare const useEntityCompoundName: () => {
619
- kind: string;
620
- namespace: string;
621
- name: string;
622
- };
623
-
624
- /** @public
625
- * @deprecated will be deleted shortly due to low external usage, re-implement if needed.
626
- */
627
- export declare const useEntityFromUrl: () => EntityLoadingStatus;
628
-
629
- /**
630
- * Retrieve a list of unique entity kinds present in the catalog
631
- * @public
632
- * @deprecated and will be removed due to low utility value.
633
- */
634
- export declare function useEntityKinds(): {
635
- error: Error | undefined;
636
- loading: boolean;
637
- kinds: string[] | undefined;
638
- };
639
-
640
573
  /**
641
574
  * Hook for interacting with the entity list context provided by the {@link EntityListProvider}.
642
575
  * @public
643
576
  */
644
577
  export declare function useEntityList<EntityFilters extends DefaultEntityFilters = DefaultEntityFilters>(): EntityListContextProps<EntityFilters>;
645
578
 
646
- /**
647
- * Hook for interacting with the entity list context provided by the {@link EntityListProvider}.
648
- * @public
649
- * @deprecated use {@link useEntityList} instead.
650
- */
651
- export declare function useEntityListProvider<EntityFilters extends DefaultEntityFilters = DefaultEntityFilters>(): EntityListContextProps<EntityFilters>;
652
-
653
579
  /**
654
580
  * Returns a function that checks whether the currently signed-in user is an
655
581
  * owner of a given entity. When the hook is initially mounted, the loading
@@ -680,28 +606,6 @@ export declare function useEntityTypeFilter(): {
680
606
  setSelectedTypes: (types: string[]) => void;
681
607
  };
682
608
 
683
- /**
684
- * Takes the relevant parts of the Backstage identity, and translates them into
685
- * a list of entities which are owned by the user. Takes an optional parameter
686
- * to filter the entities based on allowedKinds
687
- *
688
- * @public
689
- *
690
- * @param allowedKinds - Array of allowed kinds to filter the entities
691
- * @deprecated Use `ownershipEntityRefs` from `identityApi.getBackstageIdentity()` instead.
692
- */
693
- export declare function useOwnedEntities(allowedKinds?: string[]): {
694
- loading: boolean;
695
- ownedEntities: GetEntitiesResponse | undefined;
696
- };
697
-
698
- /**
699
- * Get the catalog User entity (if any) that matches the logged-in user.
700
- * @public
701
- * @deprecated due to low external usage.
702
- */
703
- export declare function useOwnUser(): AsyncState<UserEntity | undefined>;
704
-
705
609
  /** @public */
706
610
  export declare function useRelatedEntities(entity: Entity, relationFilter: {
707
611
  type?: string;