MCPcopy Create free account
hub / github.com/hashintel/hash / constructMinimalOrg

Function constructMinimalOrg

apps/hash-frontend/src/lib/user-and-org.ts:54–74  ·  view source on GitHub ↗
(params: {
  orgEntity: Entity<Organization>;
})

Source from the content-addressed store, hash-verified

52import type { VerifiableIdentityAddress } from "@ory/client";
53
54export const constructMinimalOrg = (params: {
55 orgEntity: Entity<Organization>;
56}): MinimalOrg => {
57 const { orgEntity } = params;
58
59 const { organizationName, pinnedEntityTypeBaseUrl, ...simpleProperties } =
60 simplifyProperties(orgEntity.properties);
61
62 return {
63 kind: "org",
64 entity: orgEntity,
65 webId: extractWebIdFromEntityId(orgEntity.metadata.recordId.entityId),
66 name: organizationName,
67 ...(pinnedEntityTypeBaseUrl !== undefined
68 ? {
69 pinnedEntityTypeBaseUrls: pinnedEntityTypeBaseUrl as BaseUrl[],
70 }
71 : {}),
72 ...simpleProperties,
73 };
74};
75
76export type MinimalUser = {
77 kind: "user";

Callers 2

useOrgsFunction · 0.90
constructOrgFunction · 0.85

Calls 2

simplifyPropertiesFunction · 0.90
extractWebIdFromEntityIdFunction · 0.90

Tested by

no test coverage detected