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

Function createEntity

apps/plugin-browser/src/shared/create-entity.ts:15–29  ·  view source on GitHub ↗
(params: {
  entityTypeIds: T["entityTypeIds"];
  properties: T["propertiesWithMetadata"];
  linkData?: LinkData;
})

Source from the content-addressed store, hash-verified

13} from "@blockprotocol/type-system";
14
15export const createEntity = <T extends TypeIdsAndPropertiesForEntity>(params: {
16 entityTypeIds: T["entityTypeIds"];
17 properties: T["propertiesWithMetadata"];
18 linkData?: LinkData;
19}): Promise<HashEntity<T>> =>
20 queryGraphQlApi<CreateEntityMutation, CreateEntityMutationVariables>(
21 createEntityMutation,
22 {
23 entityTypeIds: params.entityTypeIds,
24 properties: params.properties,
25 linkData: params.linkData,
26 },
27 ).then(({ data }) => {
28 return new HashEntity<T>(data.createEntity);
29 });

Callers 5

createQuickNoteFunction · 0.90
getUserFunction · 0.90
entity.test.tsFile · 0.90
block.test.tsFile · 0.90

Calls 2

queryGraphQlApiFunction · 0.90
thenMethod · 0.80

Tested by

no test coverage detected