Entity
    Preparing search index...

    Class EntityConstructionUtils<TFields, TIDField, TViewerContext, TEntity, TPrivacyPolicy, TSelectedFields>

    Common entity loader utilities for entity construction and authorization. Methods are exposed publicly since in rare cases they may need to be called manually.

    Type Parameters

    Index

    Constructors

    Properties

    metricsAdapter: IEntityMetricsAdapter

    Methods

    • Construct and authorize entities from field objects array, returning error results for entities that fail to construct or fail to authorize.

      Parameters

      • fieldObjects: readonly Readonly<TFields>[]

        array of field objects

      Returns Promise<readonly Result<TEntity>[]>

    • Construct and authorize entities from fields map, returning error results for entities that fail to construct or fail to authorize.

      Type Parameters

      • K

      Parameters

      • map: ReadonlyMap<K, readonly Readonly<TFields>[]>

        map from an arbitrary key type to an array of entity field objects

      Returns Promise<ReadonlyMap<K, readonly Result<TEntity>[]>>

    • Validate that field values are valid according to the field's validation function.

      Type Parameters

      • N extends string | number | symbol

      Parameters

      • fieldName: N

        field name to validate

      • fieldValues: readonly TFields[N][]

        field values to validate

      Returns void

      EntityInvalidFieldValueError when a field value is invalid