(
params: {
includePermissions?: boolean;
includeAvatar?: boolean;
includeMembersOfOrg?: boolean;
traversalPaths?: TraversalPath[];
} & (
| { shortname?: string }
| { accountOrAccountGroupId?: ActorEntityUuid | ActorGroupEntityUuid }
),
)
| 26 | import type { TraversalPath } from "@rust/hash-graph-store/types"; |
| 27 | |
| 28 | export const useUserOrOrg = ( |
| 29 | params: { |
| 30 | includePermissions?: boolean; |
| 31 | includeAvatar?: boolean; |
| 32 | includeMembersOfOrg?: boolean; |
| 33 | traversalPaths?: TraversalPath[]; |
| 34 | } & ( |
| 35 | | { shortname?: string } |
| 36 | | { accountOrAccountGroupId?: ActorEntityUuid | ActorGroupEntityUuid } |
| 37 | ), |
| 38 | ) => { |
| 39 | const { data, loading, refetch } = useQuery< |
| 40 | QueryEntitySubgraphQuery, |
| 41 | QueryEntitySubgraphQueryVariables |
| 42 | >(queryEntitySubgraphQuery, { |
| 43 | variables: { |
| 44 | request: { |
| 45 | filter: { |
| 46 | all: [ |
| 47 | ...("shortname" in params |
| 48 | ? [ |
| 49 | { |
| 50 | equal: [ |
| 51 | { |
| 52 | path: [ |
| 53 | "properties", |
| 54 | systemPropertyTypes.shortname.propertyTypeBaseUrl, |
| 55 | ], |
| 56 | }, |
| 57 | { parameter: params.shortname }, |
| 58 | ], |
| 59 | }, |
| 60 | ] |
| 61 | : "accountOrAccountGroupId" in params |
| 62 | ? [ |
| 63 | { |
| 64 | equal: [ |
| 65 | { path: ["uuid"] }, |
| 66 | { parameter: params.accountOrAccountGroupId }, |
| 67 | ], |
| 68 | }, |
| 69 | ] |
| 70 | : []), |
| 71 | { |
| 72 | any: [ |
| 73 | { |
| 74 | equal: [ |
| 75 | { path: ["type", "baseUrl"] }, |
| 76 | { parameter: systemEntityTypes.user.entityTypeBaseUrl }, |
| 77 | ], |
| 78 | }, |
| 79 | { |
| 80 | equal: [ |
| 81 | { path: ["type", "baseUrl"] }, |
| 82 | { |
| 83 | parameter: |
| 84 | systemEntityTypes.organization.entityTypeBaseUrl, |
| 85 | }, |
no test coverage detected