Class EntityLoaderUtils<TFields, TID, TViewerContext, TEntity, TPrivacyPolicy, TSelectedFields>

Entity loader utilities for things like invalidation, entity construction, and authorization. Methods are exposed publicly since in rare cases they may need to be called manually.

Type Parameters

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>[]>>

  • Invalidate all caches for an entity. One potential use case would be to keep the entity framework in sync with changes made to data outside of the framework.

    Parameters

    • entity: TEntity

      entity to be invalidated

    Returns Promise<void>

  • Invalidate all caches for an entity's fields. Exposed primarily for internal use by EntityMutator.

    Parameters

    • objectFields: Readonly<TFields>

      entity data object to be invalidated

    Returns Promise<void>