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

Enforcing entity loader. All normal loads are batched, cached, and authorized against the entity's EntityPrivacyPolicy. All loads through this loader will throw if the load is not successful.

Type Parameters

Constructors

Methods

  • Enforcing version of entity loader method by the same name.

    Type Parameters

    • N extends string | number | symbol

    Parameters

    • uniqueFieldName: N
    • fieldValue: NonNullable<TFields[N]>

    Returns Promise<null | TEntity>

    EntityNotAuthorizedError when viewer is not authorized to view the returned entity

    when multiple entities are found matching the condition

  • Enforcing version of entity loader method by the same name.

    Parameters

    Returns Promise<null | TEntity>

    EntityNotAuthorizedError when viewer is not authorized to view the returned entity

    when multiple entities are found matching the condition

  • Enforcing version of entity loader method by the same name.

    Type Parameters

    • N extends string | number | symbol

    Parameters

    • fieldName: N
    • fieldValue: NonNullable<TFields[N]>

    Returns Promise<readonly TEntity[]>

    EntityNotAuthorizedError when viewer is not authorized to view one or more of the returned entities

  • Enforcing version of entity loader method by the same name.

    Type Parameters

    • N extends string | number | symbol

    Parameters

    • fieldName: N
    • fieldValues: readonly NonNullable<TFields[N]>[]

    Returns Promise<ReadonlyMap<NonNullable<TFields[N]>, readonly TEntity[]>>

    EntityNotAuthorizedError when viewer is not authorized to view one or more of the returned entities

  • Enforcing version of entity loader method by the same name.

    Parameters

    • ids: readonly TID[]

    Returns Promise<ReadonlyMap<TID, TEntity>>

    EntityNotAuthorizedError when viewer is not authorized to view one or more of the returned entities

  • Enforcing version of entity loader method by the same name.

    Parameters

    • ids: readonly TID[]

    Returns Promise<ReadonlyMap<TID, null | TEntity>>

    EntityNotAuthorizedError when viewer is not authorized to view one or more of the returned entities