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

Function makeEntity

apps/hash-api/src/seed-data/seed-crm-data.ts:1187–1206  ·  view source on GitHub ↗
(
    entityTypeId: string,
    properties: PropRecord,
    outgoingLinks: LinkSpec[] = [],
    draft = false,
  )

Source from the content-addressed store, hash-verified

1185 };
1186
1187 const makeEntity = (
1188 entityTypeId: string,
1189 properties: PropRecord,
1190 outgoingLinks: LinkSpec[] = [],
1191 draft = false,
1192 ) =>
1193 // Entities are owned by the example-org web and created as the org owner,
1194 // so all members of the org can see them.
1195 createEntity(memberContext, memberAuthentication, {
1196 webId: entityWebId,
1197 entityTypeIds: [entityTypeId] as never,
1198 properties: { value: properties },
1199 draft,
1200 outgoingLinks: outgoingLinks.map((spec) => ({
1201 webId: entityWebId,
1202 entityTypeIds: [spec.linkTypeId] as never,
1203 properties: { value: spec.properties ?? {} },
1204 linkData: { rightEntityId: spec.rightEntityId },
1205 })),
1206 });
1207
1208 /** Runs an async mapper over items with bounded concurrency. */
1209 const batchMap = async <T, R>(

Callers 1

seedCrmDataFunction · 0.85

Calls 2

createEntityFunction · 0.90
mapMethod · 0.45

Tested by

no test coverage detected