/** * AVI (Activos Virtuales) Clients Resource * * Extends MexClientsResource with AVI-specific behavior: * - Accepts flattened CreateAVIClientInput (AVI fields at root level) * - Returns MexAVIClient models */ import type { AtomicBatchResult, AVIClientFilter, AVIClientSort, ClientFilter, ClientRelationshipType, ClientSort, CreateAVIClientInput, CreateBankAccountInput, CreateClientInput, CreateContactMethodInput, CreateMexAddressInput, LinkedClient as LinkedClientInput, ListOptions, PaginatedResponse, PartialBatchResult, SyncCreateDocumentInput, SyncItem, SyncResult, SyncUpdateDocumentInput, UpdateAVIClientInput, UpdateBankAccountInput, UpdateClientInput, UpdateContactMethodInput, UpdateMexAddressInput, UpsertAVIClientInput, UpsertResult } from "@artu-ai/shared"; import { type ClientData, ContactMethod, Document, LinkedClient, MexAddress, MexAVIClient, MexBankAccount } from "../../../../models"; import { type ClientIncludeMap } from "../../../clients"; import type { RelatedPartyParent, RelatedPartySubresource } from "../../../related-parties/base"; import { AVClientsResource } from "../clients"; /** * AVI (Activos Virtuales) scoped clients resource. * * Provides the same operations as MexClientsResource but with: * - Flattened input types (AVI fields at root level) * - MexAVIClient model return type * * @example * ```typescript * const aviSdk = new ComplianceSDK({ * apiKey, * environment: "test", * scope: "MX", * actividadVulnerable: CodigoActividad.AVI, * }); * * // Create with fully flattened input * const client = await aviSdk.clients.create({ * type: ClientType.Person, * name: "Juan García", * rfc: "GAJL850101ABC", // MX field * username: "JGARCIA", // AVI field at root! * }); * * // Returns MexAVIClient * console.log(client.username); * ``` */ export declare class AVIClientsResource extends AVClientsResource { readonly legalRepresentatives: RelatedPartySubresource; readonly controllingBeneficiaries: RelatedPartySubresource; protected relatedPartyParent(): RelatedPartyParent; /** * Creates a new AVI client with fully flattened input. */ create(data: CreateAVIClientInput): Promise; /** * Retrieves a client by ID. */ retrieve(id: string, options?: { include?: ClientIncludeMap; crossScope?: boolean; }): Promise; /** * Retrieves an AVI client by externalId. */ retrieveByExternalId(externalId: string, opts?: { crossScope?: boolean; }): Promise; /** * Updates an AVI client with flattened input. */ update(id: string, data: UpdateAVIClientInput): Promise; /** * Lists AVI clients with optional filtering. * * Accepts fully flattened AVI filter (MX and AVI fields at root level) * and automatically transforms to nested format before calling the API. * * @example * ```typescript * const { data } = await aviSdk.clients.list({ * filter: { * name: { contains: "García" }, * rfc: { startsWith: "GAJL" }, // MX field at root * username: { contains: "jgarcia" }, // AVI field at root! * }, * }); * ``` */ list(options?: ListOptions & { includePrimaryContacts?: boolean; includeNonPrimary?: boolean; crossScope?: boolean; }): Promise>; /** * Iterates over AVI clients. * * Accepts fully flattened AVI filter (MX and AVI fields at root level) * and automatically transforms to nested format before calling the API. */ iterate(options?: { filter?: AVIClientFilter; sort?: AVIClientSort; pageSize?: number; crossScope?: boolean; }): AsyncGenerator; /** * Counts AVI clients matching the given filter. * * @param filter - Optional filter criteria (with AVI fields at root level) * @returns The count of matching clients */ count(filter?: AVIClientFilter, options?: { includeNonPrimary?: boolean; crossScope?: boolean; }): Promise; /** * Creates multiple AVI clients with flattened input. */ createMany(clients: CreateAVIClientInput[], options?: { atomic?: true; }): Promise>; createMany(clients: CreateAVIClientInput[], options: { atomic: false; }): Promise>; /** * Updates multiple AVI clients. */ updateMany(updates: { id: string; data: UpdateAVIClientInput; }[], options?: { atomic?: true; }): Promise>; updateMany(updates: { id: string; data: UpdateAVIClientInput; }[], options: { atomic: false; }): Promise>; /** * Creates or updates an AVI client by externalId. * * @param data - Client upsert data with AVI fields at root level (must include externalId) * @returns The created or updated client with action indicator */ upsertByExternalId(data: UpsertAVIClientInput): Promise>; /** * Creates or updates multiple AVI clients by externalId. * * @param clients - Array of client upsert data (each must include externalId) * @param options - Batch options (atomic: true by default) * @returns Atomic result with data array, or partial result with succeeded/failed */ upsertManyByExternalId(clients: UpsertAVIClientInput[], options?: { atomic?: true; }): Promise>>; upsertManyByExternalId(clients: UpsertAVIClientInput[], options: { atomic: false; }): Promise>>; linkClient(parentClientId: string, childClientId: string, relationshipType: ClientRelationshipType, metadata?: Record): Promise; unlinkClient(parentClientId: string, childClientId: string, relationshipType: ClientRelationshipType): Promise; listLinkedClients(parentClientId: string, relationshipType?: ClientRelationshipType): Promise; setLinkedClients(parentClientId: string, linkedClients: LinkedClientInput[]): Promise; syncAll(clientId: undefined, data: { client: CreateAVIClientInput; addresses?: SyncItem[]; contactMethods?: SyncItem[]; bankAccounts?: SyncItem[]; documents?: SyncItem[]; linkedClients?: LinkedClientInput[]; }, options?: { replaceMode?: boolean; }): Promise<{ client: MexAVIClient; addresses: SyncResult; contactMethods: SyncResult; bankAccounts: SyncResult; documents: SyncResult; }>; syncAll(clientId: string, data: { client?: UpdateAVIClientInput; addresses?: SyncItem[]; contactMethods?: SyncItem[]; bankAccounts?: SyncItem[]; documents?: SyncItem[]; linkedClients?: LinkedClientInput[]; }, options: { replaceMode: true; }): Promise<{ client: MexAVIClient; addresses: SyncResult; contactMethods: SyncResult; bankAccounts: SyncResult; documents: SyncResult; }>; syncAll(clientId: string, data: { client?: UpdateAVIClientInput; addresses?: SyncItem[]; contactMethods?: SyncItem[]; bankAccounts?: SyncItem[]; documents?: SyncItem[]; linkedClients?: LinkedClientInput[]; }, options?: { replaceMode?: boolean; }): Promise<{ client: MexAVIClient; addresses: SyncResult; contactMethods: SyncResult; bankAccounts: SyncResult; documents: SyncResult; }>; /** * Transforms a flattened AVIClientFilter to nested ClientFilter format. * * Extracts AVI-specific fields (username) from root level and nests them * under scopeData.MX.actividadVulnerable.AVI. * * Note: This method only transforms filters, it does not automatically add * scope or activity scoping. Use explicit filters if needed. */ protected applyScopeToFilter(filter?: AVIClientFilter): ClientFilter | undefined; /** * Transforms a flattened AVIClientSort to nested ClientSort format. * * Maps flattened field names (username, rfc, curp) to their full API paths. */ protected applyScopeToSort(sort?: AVIClientSort): ClientSort | undefined; /** * Transforms flattened AVI input to nested API format. */ protected transformToNested(data: CreateAVIClientInput): CreateClientInput; /** * Transforms flattened AVI update input to nested API format. * * NOTE: Always includes `actividadVulnerable: { AVI: {} }` even if no * AVI-specific fields are provided. This ensures that records touched via * the AVI SDK can be filtered by `activityCodes: { in: ["AVI"] }`. */ protected transformUpdateToNested(data: UpdateAVIClientInput): UpdateClientInput; /** * Instantiates a MexAVIClient model. */ protected instantiate(data: ClientData): MexAVIClient; /** Materializes a raw payload into a {@link MexAVIClient} (return type narrowed via the `instantiate` override). */ materialize(data: ClientData): MexAVIClient; }