import { ConfigService } from '@nestjs/config'; import { EntityMap } from '../../../../classes'; import { Account, User } from '../../../../models'; import { AuthenticationModuleOptions } from '../../../authentication'; import { BaseHttpService } from '../../base-http.service'; import { FetchAccountOptionsDtoV1 } from './fetch-account-options.dto.v1.type'; /** * AccountsService * * Service client responsible for interacting with the Accounts microservice. * Extends `BaseHttpService` to inherit: * - Environment-sensitive URL resolution (internal vs. external). * - Secure inter-service authentication. * - Structured logging for traceability of outbound requests. * * Why this pattern? * - Ensures all outbound calls follow a unified configuration and logging structure. * - Promotes strong typing and maintainable HTTP logic. * - Makes service interactions predictable and debuggable across environments. */ export declare class AccountsService extends BaseHttpService { /** * Constructs an Accounts service client instance. * * @param {AuthenticationModuleOptions} authenticationOptions - Injected authentication configuration. * @param {ConfigService} configService - NestJS ConfigService for environment detection. */ constructor(authenticationOptions: AuthenticationModuleOptions, configService: ConfigService); /** * Retrieves a single account entry by its MongoDB identifier. * * This method gracefully handles downstream failures by logging * and returning `undefined` instead of throwing. * * @param {string} accountId - Unique MongoDB identifier of the account. * @param {FetchAccountOptionsDtoV1} [options] - Optional query parameters for filtering or projection. * @returns {Promise} Resolves to an Account or `undefined` on failure. */ fetchAccountV1(accountId: string, options?: FetchAccountOptionsDtoV1): Promise; /** * Retrieves a collection of account entries. * * Useful for batch lookups or paginated listings. * Returns an empty array if the downstream service call fails. * * @param {FetchAccountOptionsDtoV1} [options] - Optional filter options for narrowing results. * @returns {Promise} Resolves to a list of accounts, or an empty array if none found. */ fetchAccountCollectionV1(options?: FetchAccountOptionsDtoV1): Promise; /** * Fetches accounts for multiple groups of account IDs and returns a mapped result. * * This is particularly useful when aggregating accounts related to different entities * (e.g., post authors, commenters, likedBy lists). * * The function ensures: * - Each unique account is fetched only once. * - The result is returned as an `EntityMap` for O(1) lookups. * * @param {string[][]} accountIdGroups - Nested arrays of account IDs. * @returns {Promise>} Map of accountId → Account entity. */ fetchAccountMapV1(accountIdGroups: string[][]): Promise>; /** * Retrieves a single user entry by its MongoDB identifier. * * This method gracefully handles downstream failures by logging * and returning `undefined` instead of throwing. * * @param {string} userId - Unique MongoDB identifier of the user. * @param {FetchAccountOptionsDtoV1} [options] - Optional query parameters for filtering or projection. * @returns {Promise} Resolves to an User or `undefined` on failure. */ fetchUserV1(userId: string, options?: FetchAccountOptionsDtoV1): Promise; /** * Retrieves a collection of user entries. * * Useful for batch lookups or paginated listings. * Returns an empty array if the downstream service call fails. * * @param {FetchAccountOptionsDtoV1} [options] - Optional filter options for narrowing results. * @returns {Promise} Resolves to a list of users, or an empty array if none found. */ fetchUserCollectionV1(options?: FetchAccountOptionsDtoV1): Promise; /** * Fetches users for multiple groups of user IDs and returns a mapped result. * * This is particularly useful when aggregating users related to different entities * (e.g., post authors, commenters, likedBy lists). * * The function ensures: * - Each unique user is fetched only once. * - The result is returned as an `EntityMap` for O(1) lookups. * * @param {string[][]} userIdGroups - Nested arrays of user IDs. * @returns {Promise>} Map of userId → User entity. */ fetchUserMapV1(userIdGroups: string[][]): Promise>; }