The metadata provider used to create entity instances. On the client
side this is typically new Metadata(); on the server side it is the active
IMetadataProvider (e.g. Metadata.Provider).
The MemberJunction entity name, e.g. 'MJ: Conversation Details'.
Must match a registered entity exactly (case-insensitive, trimmed).
Plain objects whose keys map to entity field names. Each object is
passed to entity.LoadFromData() which populates the entity without marking
fields as dirty (i.e. the entity starts in a "clean" / not-new state).
OptionalcontextUser: UserInfoOptional user context for server-side operations. Required on the server where multiple users are served concurrently; can be omitted on the client where user context is already established.
A parallel-resolved array of typed entity objects in the same order as
the input items array.
import { Metadata, TransformSimpleObjectToEntityObject } from '@memberjunction/core';
const md = new Metadata();
const rawRows = queryResult.Results as SomeRawType[];
const entities = await TransformSimpleObjectToEntityObject<MyEntity>(
md, 'My Entity Name', rawRows, contextUser
);
// entities is MyEntity[] — fully usable with .Save(), .Load(), etc.
Converts an array of plain JavaScript objects into fully-hydrated
BaseEntitysubclass instances, usingPromise.allfor parallel creation.This is the canonical way to batch-convert raw data (e.g. from a custom stored procedure, RunQuery result, or any non-RunView data source) into typed entity objects that support
.Save(),.Load(), dirty-tracking, and all otherBaseEntitycapabilities.Items that are already
BaseEntityinstances (detected viainstanceofor duck-typing the.Save()method) are returned as-is, making this function safe to call on mixed arrays.Performance note: All entity creations run in parallel via
Promise.all. For large arrays (500+ items), consider chunking to avoid memory pressure.