import type { Result } from '@expo/results'; import type { IEntityClass } from './Entity.ts'; import type { EntityCompositeField, EntityCompositeFieldValue, EntityConfiguration } from './EntityConfiguration.ts'; import type { EntityConstructionUtils } from './EntityConstructionUtils.ts'; import type { EntityPrivacyPolicy } from './EntityPrivacyPolicy.ts'; import type { EntityQueryContext } from './EntityQueryContext.ts'; import type { ReadonlyEntity } from './ReadonlyEntity.ts'; import type { ViewerContext } from './ViewerContext.ts'; import type { EntityDataManager } from './internal/EntityDataManager.ts'; /** * Authorization-result-based entity loader. All normal loads are batched, * cached, and authorized against the entity's EntityPrivacyPolicy. All loads through this * loader are are results (or null for some loader methods), where an unsuccessful result * means an authorization error or entity construction error occurred. Other errors are thrown. */ export declare class AuthorizationResultBasedEntityLoader, TIDField extends keyof NonNullable>, TViewerContext extends ViewerContext, TEntity extends ReadonlyEntity, TPrivacyPolicy extends EntityPrivacyPolicy, TSelectedFields extends keyof TFields> { private readonly queryContext; private readonly entityConfiguration; private readonly entityClass; private readonly dataManager; private readonly constructionUtils; constructor(queryContext: EntityQueryContext, entityConfiguration: EntityConfiguration, entityClass: IEntityClass, dataManager: EntityDataManager, constructionUtils: EntityConstructionUtils); /** * Authorization-result-based version of the EnforcingEntityLoader method by the same name. * @returns map from fieldValue to entity results that match the query for that fieldValue, * where result errors can be UnauthorizedError */ loadManyByFieldEqualingManyAsync>(fieldName: N, fieldValues: readonly NonNullable[]): Promise, readonly Result[]>>; /** * Authorization-result-based version of the EnforcingEntityLoader method by the same name. * @returns map from compositeField to entity results that match the query for that compositeField, * where result errors can be UnauthorizedError */ loadManyByCompositeFieldEqualingManyAsync>>(compositeField: N, compositeFieldValues: readonly EntityCompositeFieldValue, N>[]): Promise, readonly Result[]>>; /** * Authorization-result-based version of the EnforcingEntityLoader method by the same name. * @returns array of entity results that match the query for fieldValue, where result error can be UnauthorizedError */ loadManyByFieldEqualingAsync>(fieldName: N, fieldValue: NonNullable): Promise[]>; /** * Load one entity where fieldName equals fieldValue, or null if no entity exists matching the condition. * Not cached or coalesced, and not guaranteed to be deterministic if multiple entities match the condition. * * Only used when evaluating EntityEdgeDeletionAuthorizationInferenceBehavior.ONE_IMPLIES_ALL. * * @param fieldName - entity field being queried * @param fieldValue - fieldName field value being queried * @returns entity result matching the query for fieldValue. Returns null if no entity matches the query. * @throws EntityNotAuthorizedError when viewer is not authorized to view the returned entity * * @internal */ private loadOneByFieldEqualingAsync; /** * Authorization-result-based version of the EnforcingEntityLoader method by the same name. * @returns array of entity results that match the query for compositeFieldValue, where result error can be UnauthorizedError */ loadManyByCompositeFieldEqualingAsync>>(compositeField: N, compositeFieldValue: EntityCompositeFieldValue, N>): Promise[]>; /** * Authorization-result-based version of the EnforcingEntityLoader method by the same name. * @returns entity result where uniqueFieldName equals fieldValue, or null if no entity matches the condition. * @throws when multiple entities match the condition */ loadByFieldEqualingAsync>(uniqueFieldName: N, fieldValue: NonNullable): Promise | null>; /** * Authorization-result-based version of the EnforcingEntityLoader method by the same name. * @returns entity result where uniqueFieldName equals fieldValue, where result error can be UnauthorizedError. */ loadByCompositeFieldEqualingAsync>>(compositeField: N, compositeFieldValue: EntityCompositeFieldValue, N>): Promise | null>; /** * Authorization-result-based version of the EnforcingEntityLoader method by the same name. * @returns entity result for matching ID, where result error can be UnauthorizedError or EntityNotFoundError. */ loadByIDAsync(id: TFields[TIDField]): Promise>; /** * Authorization-result-based version of the EnforcingEntityLoader method by the same name. * @returns entity result for matching ID, or null if no entity exists for ID. */ loadByIDNullableAsync(id: TFields[TIDField]): Promise | null>; /** * Authorization-result-based version of the EnforcingEntityLoader method by the same name. * @returns map from ID to corresponding entity result, where result error can be UnauthorizedError or EntityNotFoundError. */ loadManyByIDsAsync(ids: readonly TFields[TIDField][]): Promise>>; /** * Authorization-result-based version of the EnforcingEntityLoader method by the same name. * @returns map from ID to nullable corresponding entity result, where result error can be UnauthorizedError. */ loadManyByIDsNullableAsync(ids: readonly TFields[TIDField][]): Promise | null>>; private validateFieldAndValuesAndConvertToHolders; private validateFieldAndValueAndConvertToHolders; private validateCompositeFieldAndValuesAndConvertToHolders; private constructAndAuthorizeEntitiesFromCompositeFieldValueHolderMapAsync; }