/** * MJR (Metales y Joyas - Precious Metals and Jewelry) Alerts Resource * * Extends MexAlertsResource with MJR-specific behavior: * - Accepts flattened CreateMJRAlertInput (MJR fields at root level) * - Returns MexMJRAlert models */ import type { AlertClientItemFilter, AlertItemFilter, AlertItemSort, AlertSort, AlertTransactionItemFilter, AtomicBatchResult, ClientSort, CreateAlertInput, CreateAlertItemInput, CreateMJRAlertInput, CreateMJRAlertItemInput, GenerateResult, ListOptions, MJRAlertClientItemFilter, MJRAlertFilter, MJRAlertItemFilter, MJRAlertSort, MJRAlertTransactionItemFilter, MJRClientSort, MJRTransactionSort, MjrAlertDefaultsInput, PaginatedResponse, PartialBatchResult, TransactionSort, UpdateAlertInput, UpdateAlertItemInput, UpdateMJRAlertInput, UpdateMJRAlertItemInput, UpsertMJRAlertInput, UpsertResult, ValidationResult } from "@artu-ai/shared"; import { ReportType } from "@artu-ai/shared"; import { type AlertClientItemData, type AlertData, type AlertItemData, type AlertTransactionItemData, MexMJRAlert, MexMJRAlertClientItem, MexMJRAlertItem, MexMJRAlertTransactionItem } from "../../../../models"; import { AlertItemsResource } from "../../../alert-items"; import { AVAlertsResource } from "../alerts"; /** * MJR (Metales y Joyas) scoped alerts resource. * * @example * ```typescript * const mjrSdk = new ComplianceSDK({ * apiKey, * scope: "MX", * actividadVulnerable: CodigoActividad.MJR, * }); * * // Create with fully flattened input * const alert = await mjrSdk.alerts.create({ * mesReportado: "202401", * }); * * // Returns MexMJRAlert * console.log(alert.mesReportado); * ``` */ export declare class MJRAlertsResource extends AVAlertsResource { create(data: CreateMJRAlertInput): 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: UpdateMJRAlertInput): Promise; /** * Lists MJR alerts with optional filtering. * * Accepts flattened MJR filter (future MJR-specific alert fields at root level). */ list(options?: ListOptions & { crossScope?: boolean; }): Promise>; /** * Iterates over MJR alerts. * * Accepts flattened MJR filter (future MJR-specific alert fields at root level). */ iterate(options?: { filter?: MJRAlertFilter; sort?: MJRAlertSort; pageSize?: number; crossScope?: boolean; }): AsyncGenerator; /** * Counts MJR alerts matching the given filter. * * @param filter - Optional filter criteria (with MJR fields at root level) * @returns The count of matching alerts */ count(filter?: MJRAlertFilter, options?: { crossScope?: boolean; }): Promise; createMany(alerts: CreateMJRAlertInput[], options?: { atomic?: true; }): Promise>; createMany(alerts: CreateMJRAlertInput[], options: { atomic: false; }): Promise>; updateMany(updates: { id: string; data: UpdateMJRAlertInput; }[], options?: { atomic?: true; }): Promise>; updateMany(updates: { id: string; data: UpdateMJRAlertInput; }[], options: { atomic: false; }): Promise>; /** * Creates or updates a MJR alert by externalId. * * @param data - Alert upsert data with MJR fields at root level (must include externalId) * @returns The created or updated alert with action indicator */ upsertByExternalId(data: UpsertMJRAlertInput): Promise>; /** * Creates or updates multiple MJR 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: UpsertMJRAlertInput[], options?: { atomic?: true; }): Promise>>; upsertManyByExternalId(alerts: UpsertMJRAlertInput[], options: { atomic: false; }): Promise>>; addItem(alertId: string, data: CreateMJRAlertItemInput): Promise; getItem(alertId: string, itemId: string): Promise; updateItem(alertId: string, itemId: string, data: UpdateMJRAlertItemInput): Promise; listItems(alertId: string, options?: ListOptions): Promise>; /** * Transforms a flattened MJRAlertItemFilter to nested AlertItemFilter format. */ protected applyScopeToItemFilter(filter?: MJRAlertItemFilter): AlertItemFilter | undefined; addItems(alertId: string, items: CreateMJRAlertItemInput[]): Promise<{ added: number; items: MexMJRAlertItem[]; }>; /** * Lists transactions linked to an alert with MJR-scoped filters/sorts. */ listTransactionItems(alertId: string, options?: ListOptions): Promise>; /** * Lists unique clients related to an alert with MJR-scoped filters/sorts. */ listClients(alertId: string, options?: ListOptions): Promise>; protected applyTransactionScopeToFilter(filter?: MJRAlertTransactionItemFilter): AlertTransactionItemFilter | undefined; protected applyClientScopeToFilter(filter?: MJRAlertClientItemFilter): AlertClientItemFilter | undefined; private buildAlertItemFilter; protected createItemsResource(): AlertItemsResource | undefined; } | undefined; alertType?: "100" | "9999" | "2901" | "2902" | "2903" | "2904" | "2905" | "2906" | "2907" | "2908" | "2909" | "2910" | "2911" | "2912" | "2913" | "2914" | "2915" | "2916" | "2917" | "2918" | "2919" | "2920" | "2921" | "2922" | "2923" | "2924" | "2925" | { eq?: "100" | "9999" | "2901" | "2902" | "2903" | "2904" | "2905" | "2906" | "2907" | "2908" | "2909" | "2910" | "2911" | "2912" | "2913" | "2914" | "2915" | "2916" | "2917" | "2918" | "2919" | "2920" | "2921" | "2922" | "2923" | "2924" | "2925" | undefined; in?: ("100" | "9999" | "2901" | "2902" | "2903" | "2904" | "2905" | "2906" | "2907" | "2908" | "2909" | "2910" | "2911" | "2912" | "2913" | "2914" | "2915" | "2916" | "2917" | "2918" | "2919" | "2920" | "2921" | "2922" | "2923" | "2924" | "2925")[] | undefined; nin?: ("100" | "9999" | "2901" | "2902" | "2903" | "2904" | "2905" | "2906" | "2907" | "2908" | "2909" | "2910" | "2911" | "2912" | "2913" | "2914" | "2915" | "2916" | "2917" | "2918" | "2919" | "2920" | "2921" | "2922" | "2923" | "2924" | "2925")[] | undefined; } | undefined; alertDescription?: string | { eq?: string | undefined; contains?: string | undefined; startsWith?: string | undefined; endsWith?: string | undefined; in?: string[] | undefined; nin?: string[] | undefined; } | undefined; }>; /** * Validates a MJR alert. * * Uses MJR-scoped validation input (scope and activity are implicit). * * @param alertId - The alert ID to validate * @param defaults - MJR alert defaults including rfc, alertType, etc. * * @example * ```typescript * const result = await mjrSdk.alerts.validateReport(alert.id, { * rfc: "ABC200101XXX", * alertType: "100", * }); * ``` */ validateReport(alertId: string, defaults?: MjrAlertDefaultsInput): Promise; /** * Generates XML for a MJR alert. * * Uses the same input as validateReport. * * @param alertId - The alert ID to generate XML for * @param defaults - MJR alert defaults including rfc, alertType, etc. */ generateReport(alertId: string, defaults?: MjrAlertDefaultsInput): Promise; /** * Transforms a flattened MJRTransactionSort to nested TransactionSort format. */ protected applyTransactionScopeToSort(sort?: MJRTransactionSort): TransactionSort | undefined; /** * Transforms a flattened MJRClientSort to nested ClientSort format. */ protected applyClientScopeToSort(sort?: MJRClientSort): ClientSort | undefined; protected transformToNested(data: CreateMJRAlertInput): CreateAlertInput; /** * Transforms flattened MJR alert update to nested API format. * * NOTE: Always includes `actividadVulnerable: { MJR: {} }` even if no * MJR-specific fields are provided. This ensures that records touched via * the MJR SDK can be filtered by `activityCodes: { in: ["MJR"] }`. */ protected transformUpdateToNested(data: UpdateMJRAlertInput): UpdateAlertInput; protected instantiate(data: AlertData): MexMJRAlert; /** Materializes a raw payload into a {@link MexMJRAlert} (return type narrowed via the `instantiate` override). */ materialize(data: AlertData): MexMJRAlert; protected instantiateItem(data: AlertItemData): MexMJRAlertItem; protected instantiateTransactionItem(data: AlertTransactionItemData): MexMJRAlertTransactionItem; protected instantiateClientItem(data: AlertClientItemData): MexMJRAlertClientItem; protected transformItemToNested(data: CreateMJRAlertItemInput): CreateAlertItemInput; protected transformItemUpdateToNested(data: UpdateMJRAlertItemInput): UpdateAlertItemInput; /** * Transforms a flattened MJRAlertSort to nested AlertSort format. * * Maps flattened field names to their full API paths using MJR-specific field mapping. */ protected applyScopeToSort(sort?: MJRAlertSort): AlertSort | undefined; /** * Transforms MJR defaults to nested API format for validate/generate. */ protected transformMjrDefaultsToNested(alertId: string, defaults?: MjrAlertDefaultsInput): { alertId: string; reportType: ReportType; defaults?: unknown; }; }