/** * Mexico Alerts Resource * * Extends AlertsResource with Mexico-specific behavior: * - Accepts flattened CreateMexAlertInput (MX fields at root level) * - Transforms flattened filters to nested format * - Returns MexAlert models */ import type { AlertClientItemFilter, AlertFilter, AlertItemFilter, AlertSort, AlertTransactionItemFilter, AtomicBatchResult, ClientSort, CreateAlertInput, CreateAlertItemInput, CreateMexAlertInput, CreateMexAlertItemInput, GenerateReportInput, GenerateResult, ListOptions, MexAlertDefaultsInput, MexAlertFilter, MexAlertSort, MexClientFilter, MexClientSort, MexTransactionFilter, MexTransactionSort, PaginatedResponse, PartialBatchResult, ReportType, TransactionSort, UpdateAlertInput, UpdateAlertItemInput, UpdateMexAlertInput, UpdateMexAlertItemInput, UpsertMexAlertInput, UpsertResult, ValidateReportInput, ValidationResult } from "@artu-ai/shared"; import { type AlertClientItemData, type AlertData, type AlertItemData, type AlertTransactionItemData, MexAlert, MexAlertClientItem, MexAlertTransactionItem } from "../../models"; import { MexAlertItem } from "../../models/mx"; import { type AlertItemSort, AlertsResource } from "../alerts"; /** * Mexico-scoped alerts resource. * * Provides the same operations as AlertsResource but with: * - Flattened input types (MX fields at root level) * - Automatic scope scoping * - MexAlert model return type * * @example * ```typescript * // Using the Mexico SDK entry point * import { ComplianceSDK } from "@artu-ai/compliance-sdk/mx"; * * const mexSdk = new ComplianceSDK({ * apiKey, * environment: "test", * }); * * // Create with flattened input * const alert = await mexSdk.alerts.create({ * actividadVulnerable: { * AVI: { mesReportado: "202401" }, * }, * }); * * // List alerts * const { data } = await mexSdk.alerts.list(); * // data is MexAlert[] * ``` */ export declare class MexAlertsResource extends AlertsResource { /** * Creates a new Mexico alert with flattened input. */ create(data: CreateMexAlertInput): Promise; /** * Retrieves a alert by ID. */ retrieve(id: string, opts?: { crossScope?: boolean; }): Promise; retrieveByMetadata(key: string, value: string, opts?: { crossScope?: boolean; }): Promise; retrieveByExternalId(externalId: string, opts?: { crossScope?: boolean; }): Promise; /** * Updates a Mexico alert with flattened input. */ update(id: string, data: UpdateMexAlertInput): Promise; /** * Lists Mexico alerts with optional filtering. * * Accepts flattened MX filter (future MX-specific alert fields at root level). */ list(options?: ListOptions & { crossScope?: boolean; }): Promise>; /** * Counts Mexico alerts matching the given filter. * * @param filter - Optional filter criteria (with MX fields at root level) * @returns The count of matching alerts */ count(filter?: MexAlertFilter, options?: { crossScope?: boolean; }): Promise; /** * Iterates over Mexico alerts. * * Accepts flattened MX filter (future MX-specific alert fields at root level). */ iterate(options?: { filter?: MexAlertFilter; sort?: TSort; pageSize?: number; crossScope?: boolean; }): AsyncGenerator; createMany(alerts: CreateMexAlertInput[], options?: { atomic?: true; }): Promise>; createMany(alerts: CreateMexAlertInput[], options: { atomic: false; }): Promise>; updateMany(updates: { id: string; data: UpdateMexAlertInput; }[], options?: { atomic?: true; }): Promise>; updateMany(updates: { id: string; data: UpdateMexAlertInput; }[], options: { atomic: false; }): Promise>; /** * Creates or updates a Mexico alert by externalId. * * @param data - Alert upsert data with MX fields at root level (must include externalId) * @returns The created or updated alert with action indicator */ upsertByExternalId(data: UpsertMexAlertInput): Promise>; /** * Creates or updates multiple Mexico 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: UpsertMexAlertInput[], options?: { atomic?: true; }): Promise>>; upsertManyByExternalId(alerts: UpsertMexAlertInput[], options: { atomic: false; }): Promise>>; /** * Adds an item to a alert with flattened Mexico input. */ addItem(alertId: string, data: CreateMexAlertItemInput): Promise; /** * Gets a specific alert item. */ getItem(alertId: string, itemId: string): Promise; /** * Updates a alert item with flattened Mexico input. */ updateItem(alertId: string, itemId: string, data: UpdateMexAlertItemInput): Promise; /** * Lists items in a alert with filtering, sorting, and pagination. */ listItems(alertId: string, options?: ListOptions): Promise>; /** * Adds multiple items to a alert with flattened Mexico input. */ addItems(alertId: string, items: CreateMexAlertItemInput[]): Promise<{ added: number; items: MexAlertItem[]; }>; /** * Validates a Mexico alert. * * Uses Mexico-scoped validation input (scope is implicit). * * @param alertId - The alert ID to validate * @param defaults - Mexico alert defaults including activity-specific settings * * @example * ```typescript * const result = await mexSdk.alerts.validateReport(alert.id, { * actividadVulnerable: { * rfc: "ABC200101XXX", * AVI: { * platformDomain: "https://example.com", * alertType: "100", * }, * }, * }); * ``` */ validateReport(alertId: string, reportType: ReportType, defaults?: TDefaults): Promise; /** * Generates XML for a Mexico alert. * * Uses the same input as validateReport since generation requires * the same transformation and defaults. * * @param alertId - The alert ID to generate XML for * @param reportType - The report type (e.g., "mex.actividad-vulnerable.avi") * @param defaults - Mexico alert defaults including activity-specific settings (optional) * * @example * ```typescript * const result = await mexSdk.alerts.generateReport( * alert.id, * ReportType.MexActividadVulnerableAVI, * { * actividadVulnerable: { * rfc: "ABC200101XXX", * AVI: { * platformDomain: "https://example.com", * alertType: "100", * }, * }, * }, * ); * console.log(result.xml); * ``` */ generateReport(alertId: string, reportType: ReportType, defaults?: TDefaults): Promise; /** * Lists transactions linked to an alert with Mexico-scoped filters/sorts. */ listTransactionItems(alertId: string, options?: ListOptions): Promise>; /** * Lists unique clients related to an alert with Mexico-scoped filters/sorts. */ listClients(alertId: string, options?: ListOptions): Promise>; /** * Transforms a flattened MexAlertFilter to nested AlertFilter format. * * Currently MexAlertFilter has the same fields as the base filter. * * Note: This method only transforms filters, it does not automatically add * scope scoping. Use explicit filters if you need to scope by scope. */ protected applyScopeToFilter(filter?: MexAlertFilter): AlertFilter | undefined; /** * Transforms a flattened MexAlertSort to nested AlertSort format. * * Maps flattened field names to their full API paths. * * Note: Uses unknown parameter to allow derived classes to override with their own sort types. */ protected applyScopeToSort(sort?: TSort): AlertSort | undefined; /** * Transforms a flattened MexTransactionFilter to nested TransactionFilter format. * * Currently MexTransactionFilter has the same fields as the base filter. * Also passes through the optional alertItem filter. */ protected applyTransactionScopeToFilter(filter?: MexTransactionFilter & { alertItem?: AlertItemFilter; }): AlertTransactionItemFilter | undefined; /** * Transforms a flattened MexTransactionSort to nested TransactionSort format. * * Maps flattened field names to their full API paths. */ protected applyTransactionScopeToSort(sort?: MexTransactionSort): TransactionSort | undefined; /** * Transforms a flattened MexClientFilter to nested ClientFilter format. * * Extracts MX-specific fields (rfc, curp, actividadEconomica, giroMercantil, * actividadVulnerable) from root level and nests them under scopeData.MX. * Also passes through the optional alertItem filter. */ protected applyClientScopeToFilter(filter?: MexClientFilter & { alertItem?: AlertItemFilter; }): AlertClientItemFilter | undefined; /** * Transforms a flattened MexClientSort to nested ClientSort format. * * Maps flattened field names to their full API paths. */ protected applyClientScopeToSort(sort?: MexClientSort): ClientSort | undefined; /** * Transforms flattened MX input to nested API format. * * NOTE: Always includes `scopeData: { MX: {} }` even if no MX-specific * fields are provided. This ensures that records created via the Mexico SDK * can be filtered by `availableJurisdictions: { in: ["MX"] }`. */ protected transformToNested(data: CreateMexAlertInput): CreateAlertInput; /** * Transforms flattened MX update input to nested API format. * * NOTE: Always includes `scopeData: { MX: {} }` even if no MX-specific * fields are provided. This ensures that records touched via the Mexico SDK * can be filtered by `availableJurisdictions: { in: ["MX"] }`. */ protected transformUpdateToNested(data: UpdateMexAlertInput): UpdateAlertInput; /** * Instantiates a MexAlert model. */ protected instantiate(data: AlertData): MexAlert; /** Materializes a raw payload into a {@link MexAlert} (return type narrowed via the `instantiate` override). */ materialize(data: AlertData): MexAlert; /** * Instantiates a MexAlertItem model. */ protected instantiateItem(data: AlertItemData): MexAlertItem; protected instantiateTransactionItem(data: AlertTransactionItemData): MexAlertTransactionItem; protected instantiateClientItem(data: AlertClientItemData): MexAlertClientItem; /** * Transforms flattened MX alert item input to nested API format. */ protected transformItemToNested(data: CreateMexAlertItemInput): CreateAlertItemInput; /** * Transforms flattened MX alert item update input to nested API format. */ protected transformItemUpdateToNested(data: UpdateMexAlertItemInput): UpdateAlertItemInput; /** * Transforms flattened MX validate input to nested API format. */ protected transformValidateToNested(alertId: string, reportType: ReportType, defaults?: MexAlertDefaultsInput): ValidateReportInput; /** * Transforms flattened MX generate input to nested API format. */ protected transformGenerateToNested(alertId: string, reportType: ReportType, defaults?: MexAlertDefaultsInput): GenerateReportInput; }