/** * AVI (Activos Virtuales) Alerts Resource * * Extends MexAlertsResource with AVI-specific behavior: * - Accepts flattened CreateAVIAlertInput (AVI fields at root level) * - Returns MexAVIAlert models */ import type { AlertClientItemFilter, AlertItemFilter, AlertItemSort, AlertSort, AlertTransactionItemFilter, AtomicBatchResult, AVIAlertClientItemFilter, AVIAlertFilter, AVIAlertItemFilter, AVIAlertSort, AVIAlertTransactionItemFilter, AVIClientSort, AVITransactionSort, AviAlertDefaultsInput, ClientSort, CreateAlertInput, CreateAlertItemInput, CreateAVIAlertInput, CreateAVIAlertItemInput, GenerateResult, ListOptions, PaginatedResponse, PartialBatchResult, TransactionSort, UpdateAlertInput, UpdateAlertItemInput, UpdateAVIAlertInput, UpdateAVIAlertItemInput, UpsertAVIAlertInput, UpsertResult, ValidationResult } from "@artu-ai/shared"; import { ReportType } from "@artu-ai/shared"; import { type AlertClientItemData, type AlertData, type AlertItemData, type AlertTransactionItemData, MexAVIAlert, MexAVIAlertClientItem, MexAVIAlertItem, MexAVIAlertTransactionItem } from "../../../../models"; import { AlertItemsResource } from "../../../alert-items"; import { AVAlertsResource } from "../alerts"; /** * AVI (Activos Virtuales) scoped alerts resource. * * @example * ```typescript * const aviSdk = new ComplianceSDK({ * apiKey, * scope: "MX", * actividadVulnerable: CodigoActividad.AVI, * }); * * // Create with fully flattened input * const alert = await aviSdk.alerts.create({ * mesReportado: "202401", * }); * * // Returns MexAVIAlert * console.log(alert.mesReportado); * ``` */ export declare class AVIAlertsResource extends AVAlertsResource { create(data: CreateAVIAlertInput): Promise; retrieve(id: string, opts?: { crossScope?: boolean; }): Promise; retrieveByMetadata(key: string, value: string, opts?: { crossScope?: boolean; }): Promise; retrieveByExternalId(externalId: string, opts?: { crossScope?: boolean; }): Promise; update(id: string, data: UpdateAVIAlertInput): Promise; /** * Lists AVI alerts with optional filtering. * * Accepts flattened AVI filter (future AVI-specific alert fields at root level). */ list(options?: ListOptions & { crossScope?: boolean; }): Promise>; /** * Iterates over AVI alerts. * * Accepts flattened AVI filter (future AVI-specific alert fields at root level). */ iterate(options?: { filter?: AVIAlertFilter; sort?: AVIAlertSort; pageSize?: number; crossScope?: boolean; }): AsyncGenerator; /** * Counts AVI alerts matching the given filter. * * @param filter - Optional filter criteria (with AVI fields at root level) * @returns The count of matching alerts */ count(filter?: AVIAlertFilter, options?: { crossScope?: boolean; }): Promise; createMany(alerts: CreateAVIAlertInput[], options?: { atomic?: true; }): Promise>; createMany(alerts: CreateAVIAlertInput[], options: { atomic: false; }): Promise>; updateMany(updates: { id: string; data: UpdateAVIAlertInput; }[], options?: { atomic?: true; }): Promise>; updateMany(updates: { id: string; data: UpdateAVIAlertInput; }[], options: { atomic: false; }): Promise>; /** * Creates or updates an AVI alert by externalId. * * @param data - Alert upsert data with AVI fields at root level (must include externalId) * @returns The created or updated alert with action indicator */ upsertByExternalId(data: UpsertAVIAlertInput): Promise>; /** * Creates or updates multiple AVI alerts by externalId. * * @param alerts - Array of alert 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(alerts: UpsertAVIAlertInput[], options?: { atomic?: true; }): Promise>>; upsertManyByExternalId(alerts: UpsertAVIAlertInput[], options: { atomic: false; }): Promise>>; addItem(alertId: string, data: CreateAVIAlertItemInput): Promise; getItem(alertId: string, itemId: string): Promise; updateItem(alertId: string, itemId: string, data: UpdateAVIAlertItemInput): Promise; listItems(alertId: string, options?: ListOptions): Promise>; /** * Transforms a flattened AVIAlertItemFilter to nested AlertItemFilter format. */ protected applyScopeToItemFilter(filter?: AVIAlertItemFilter): AlertItemFilter | undefined; addItems(alertId: string, items: CreateAVIAlertItemInput[]): Promise<{ added: number; items: MexAVIAlertItem[]; }>; /** * Lists transactions linked to an alert with AVI-scoped filters/sorts. */ listTransactionItems(alertId: string, options?: ListOptions): Promise>; /** * Lists unique clients related to an alert with AVI-scoped filters/sorts. */ listClients(alertId: string, options?: ListOptions): Promise>; protected createItemsResource(): AlertItemsResource | undefined; } | undefined; alertType?: "100" | "9999" | "4101" | "4102" | "4103" | "4104" | "4105" | "4106" | "4107" | "4108" | "4109" | "4110" | "4111" | "4112" | "4113" | "4114" | "4115" | "4116" | "4117" | "4118" | "4119" | "4120" | "4121" | "4122" | { eq?: "100" | "9999" | "4101" | "4102" | "4103" | "4104" | "4105" | "4106" | "4107" | "4108" | "4109" | "4110" | "4111" | "4112" | "4113" | "4114" | "4115" | "4116" | "4117" | "4118" | "4119" | "4120" | "4121" | "4122" | undefined; in?: ("100" | "9999" | "4101" | "4102" | "4103" | "4104" | "4105" | "4106" | "4107" | "4108" | "4109" | "4110" | "4111" | "4112" | "4113" | "4114" | "4115" | "4116" | "4117" | "4118" | "4119" | "4120" | "4121" | "4122")[] | undefined; nin?: ("100" | "9999" | "4101" | "4102" | "4103" | "4104" | "4105" | "4106" | "4107" | "4108" | "4109" | "4110" | "4111" | "4112" | "4113" | "4114" | "4115" | "4116" | "4117" | "4118" | "4119" | "4120" | "4121" | "4122")[] | undefined; } | undefined; alertDescription?: string | { eq?: string | undefined; contains?: string | undefined; startsWith?: string | undefined; endsWith?: string | undefined; in?: string[] | undefined; nin?: string[] | undefined; } | undefined; }>; /** * Validates an AVI alert. * * Uses AVI-scoped validation input (scope and activity are implicit). * * @param alertId - The alert ID to validate * @param defaults - AVI alert defaults including rfc, platformDomain, alertType, etc. * * @example * ```typescript * const result = await aviSdk.alerts.validateReport(alert.id, { * rfc: "ABC200101XXX", * platformDomain: "https://example.com", * alertType: "100", * }); * ``` */ validateReport(alertId: string, defaults?: AviAlertDefaultsInput): Promise; /** * Generates XML for an AVI alert. * * Uses the same input as validateReport. * * @param alertId - The alert ID to generate XML for * @param defaults - AVI alert defaults including rfc, platformDomain, alertType, etc. * * @example * ```typescript * const result = await aviSdk.alerts.generateReport(alert.id, { * rfc: "ABC200101XXX", * platformDomain: "https://example.com", * alertType: "100", * }); * console.log(result.xml); * ``` */ generateReport(alertId: string, defaults?: AviAlertDefaultsInput): Promise; /** * Transforms a flattened AVIAlertSort to nested AlertSort format. * * Maps flattened field names to their full API paths. */ protected applyScopeToSort(sort?: AVIAlertSort): AlertSort | undefined; /** * Transforms a flattened AVITransactionSort to nested TransactionSort format. */ protected applyTransactionScopeToSort(sort?: AVITransactionSort): TransactionSort | undefined; /** * Transforms a flattened AVIAlertTransactionItemFilter to nested AlertTransactionItemFilter. * * Extracts flattened alert item fields (alertItemHasErrors, alertItemAlertType, * alertItemAlertDescription) and nests them into the alertItem filter. */ protected applyTransactionScopeToFilter(filter?: AVIAlertTransactionItemFilter): AlertTransactionItemFilter | undefined; /** * Transforms a flattened AVIAlertClientItemFilter to nested AlertClientItemFilter. * * Extracts flattened alert item fields and nests them into the alertItem filter, * then delegates to parent for username and MX field nesting. */ protected applyClientScopeToFilter(filter?: AVIAlertClientItemFilter): AlertClientItemFilter | undefined; /** * Transforms a flattened AVIClientSort to nested ClientSort format. */ protected applyClientScopeToSort(sort?: AVIClientSort): ClientSort | undefined; /** * Builds a nested AlertItemFilter from the existing nested filter and * flattened alert item fields (alertItemHasErrors, alertType, alertDescription). */ private buildAlertItemFilter; protected transformToNested(data: CreateAVIAlertInput): CreateAlertInput; /** * Transforms 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: UpdateAVIAlertInput): UpdateAlertInput; protected instantiate(data: AlertData): MexAVIAlert; /** Materializes a raw payload into a {@link MexAVIAlert} (return type narrowed via the `instantiate` override). */ materialize(data: AlertData): MexAVIAlert; protected instantiateItem(data: AlertItemData): MexAVIAlertItem; protected instantiateTransactionItem(data: AlertTransactionItemData): MexAVIAlertTransactionItem; protected instantiateClientItem(data: AlertClientItemData): MexAVIAlertClientItem; protected transformItemToNested(data: CreateAVIAlertItemInput): CreateAlertItemInput; protected transformItemUpdateToNested(data: UpdateAVIAlertItemInput): UpdateAlertItemInput; /** * Transforms AVI defaults to nested API format for validate/generate. */ protected transformAviDefaultsToNested(alertId: string, defaults?: AviAlertDefaultsInput): { alertId: string; reportType: ReportType; defaults?: unknown; }; }