/** * JYS (Juegos y Sorteos) Alerts Resource * * Extends MexAlertsResource with JYS-specific behavior: * - Accepts flattened CreateJYSAlertInput (JYS fields at root level) * - Returns MexJYSAlert models */ import type { AlertClientItemFilter, AlertItemFilter, AlertItemSort, AlertSort, AlertTransactionItemFilter, AtomicBatchResult, ClientSort, CreateAlertInput, CreateAlertItemInput, CreateJYSAlertInput, CreateJYSAlertItemInput, GenerateResult, JYSAlertClientItemFilter, JYSAlertFilter, JYSAlertItemFilter, JYSAlertSort, JYSAlertTransactionItemFilter, JYSClientSort, JYSTransactionSort, JysAlertDefaultsInput, ListOptions, PaginatedResponse, PartialBatchResult, TransactionSort, UpdateAlertInput, UpdateAlertItemInput, UpdateJYSAlertInput, UpdateJYSAlertItemInput, UpsertJYSAlertInput, UpsertResult, ValidationResult } from "@artu-ai/shared"; import { ReportType } from "@artu-ai/shared"; import { type AlertClientItemData, type AlertData, type AlertItemData, type AlertTransactionItemData, MexJYSAlert, MexJYSAlertClientItem, MexJYSAlertItem, MexJYSAlertTransactionItem } from "../../../../models"; import { AlertItemsResource } from "../../../alert-items"; import { AVAlertsResource } from "../alerts"; /** * JYS (Juegos y Sorteos) scoped alerts resource. * * @example * ```typescript * const jysSdk = new ComplianceSDK({ * apiKey, * scope: "MX", * actividadVulnerable: CodigoActividad.JYS, * }); * * // Create with fully flattened input * const alert = await jysSdk.alerts.create({ * mesReportado: "202401", * }); * * // Returns MexJYSAlert * console.log(alert.mesReportado); * ``` */ export declare class JYSAlertsResource extends AVAlertsResource { create(data: CreateJYSAlertInput): 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: UpdateJYSAlertInput): Promise; /** * Lists JYS alerts with optional filtering. * * Accepts flattened JYS filter (future JYS-specific alert fields at root level). */ list(options?: ListOptions & { crossScope?: boolean; }): Promise>; /** * Iterates over JYS alerts. * * Accepts flattened JYS filter (future JYS-specific alert fields at root level). */ iterate(options?: { filter?: JYSAlertFilter; sort?: JYSAlertSort; pageSize?: number; crossScope?: boolean; }): AsyncGenerator; /** * Counts JYS alerts matching the given filter. * * @param filter - Optional filter criteria (with JYS fields at root level) * @returns The count of matching alerts */ count(filter?: JYSAlertFilter, options?: { crossScope?: boolean; }): Promise; createMany(alerts: CreateJYSAlertInput[], options?: { atomic?: true; }): Promise>; createMany(alerts: CreateJYSAlertInput[], options: { atomic: false; }): Promise>; updateMany(updates: { id: string; data: UpdateJYSAlertInput; }[], options?: { atomic?: true; }): Promise>; updateMany(updates: { id: string; data: UpdateJYSAlertInput; }[], options: { atomic: false; }): Promise>; /** * Creates or updates a JYS alert by externalId. * * @param data - Alert upsert data with JYS fields at root level (must include externalId) * @returns The created or updated alert with action indicator */ upsertByExternalId(data: UpsertJYSAlertInput): Promise>; /** * Creates or updates multiple JYS 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: UpsertJYSAlertInput[], options?: { atomic?: true; }): Promise>>; upsertManyByExternalId(alerts: UpsertJYSAlertInput[], options: { atomic: false; }): Promise>>; addItem(alertId: string, data: CreateJYSAlertItemInput): Promise; getItem(alertId: string, itemId: string): Promise; updateItem(alertId: string, itemId: string, data: UpdateJYSAlertItemInput): Promise; listItems(alertId: string, options?: ListOptions): Promise>; /** * Transforms a flattened JYSAlertItemFilter to nested AlertItemFilter format. */ protected applyScopeToItemFilter(filter?: JYSAlertItemFilter): AlertItemFilter | undefined; addItems(alertId: string, items: CreateJYSAlertItemInput[]): Promise<{ added: number; items: MexJYSAlertItem[]; }>; /** * Lists transactions linked to an alert with JYS-scoped filters/sorts. */ listTransactionItems(alertId: string, options?: ListOptions): Promise>; /** * Lists unique clients related to an alert with JYS-scoped filters/sorts. */ listClients(alertId: string, options?: ListOptions): Promise>; protected applyTransactionScopeToFilter(filter?: JYSAlertTransactionItemFilter): AlertTransactionItemFilter | undefined; protected applyClientScopeToFilter(filter?: JYSAlertClientItemFilter): AlertClientItemFilter | undefined; private buildAlertItemFilter; protected createItemsResource(): AlertItemsResource | undefined; } | undefined; alertType?: "100" | "9999" | "2101" | "2102" | "2103" | "2104" | "2105" | "2106" | "2107" | "2108" | "2109" | "2110" | "2111" | "2112" | "2113" | "2114" | "2115" | "2116" | "2117" | "2118" | "2119" | "2120" | "2121" | "2122" | "2123" | "2124" | "2125" | "2126" | "2127" | { eq?: "100" | "9999" | "2101" | "2102" | "2103" | "2104" | "2105" | "2106" | "2107" | "2108" | "2109" | "2110" | "2111" | "2112" | "2113" | "2114" | "2115" | "2116" | "2117" | "2118" | "2119" | "2120" | "2121" | "2122" | "2123" | "2124" | "2125" | "2126" | "2127" | undefined; in?: ("100" | "9999" | "2101" | "2102" | "2103" | "2104" | "2105" | "2106" | "2107" | "2108" | "2109" | "2110" | "2111" | "2112" | "2113" | "2114" | "2115" | "2116" | "2117" | "2118" | "2119" | "2120" | "2121" | "2122" | "2123" | "2124" | "2125" | "2126" | "2127")[] | undefined; nin?: ("100" | "9999" | "2101" | "2102" | "2103" | "2104" | "2105" | "2106" | "2107" | "2108" | "2109" | "2110" | "2111" | "2112" | "2113" | "2114" | "2115" | "2116" | "2117" | "2118" | "2119" | "2120" | "2121" | "2122" | "2123" | "2124" | "2125" | "2126" | "2127")[] | 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 JYS alert. * * Uses JYS-scoped validation input (scope and activity are implicit). * * @param alertId - The alert ID to validate * @param defaults - JYS alert defaults including rfc, alertType, etc. * * @example * ```typescript * const result = await jysSdk.alerts.validateReport(alert.id, { * rfc: "ABC200101XXX", * alertType: "100", * }); * ``` */ validateReport(alertId: string, defaults?: JysAlertDefaultsInput): Promise; /** * Generates XML for a JYS alert. * * Uses the same input as validateReport. * * @param alertId - The alert ID to generate XML for * @param defaults - JYS alert defaults including rfc, alertType, etc. */ generateReport(alertId: string, defaults?: JysAlertDefaultsInput): Promise; /** * Transforms a flattened JYSAlertSort to nested AlertSort format. * * Maps flattened field names to their full API paths. */ protected applyScopeToSort(sort?: JYSAlertSort): AlertSort | undefined; /** * Transforms a flattened JYSTransactionSort to nested TransactionSort format. */ protected applyTransactionScopeToSort(sort?: JYSTransactionSort): TransactionSort | undefined; /** * Transforms a flattened JYSClientSort to nested ClientSort format. */ protected applyClientScopeToSort(sort?: JYSClientSort): ClientSort | undefined; protected transformToNested(data: CreateJYSAlertInput): CreateAlertInput; /** * Transforms JYS update input to nested API format. * * NOTE: Always includes `actividadVulnerable: { JYS: {} }` even if no * JYS-specific fields are provided. This ensures that records touched via * the JYS SDK can be filtered by `activityCodes: { in: ["JYS"] }`. */ protected transformUpdateToNested(data: UpdateJYSAlertInput): UpdateAlertInput; protected instantiate(data: AlertData): MexJYSAlert; /** Materializes a raw payload into a {@link MexJYSAlert} (return type narrowed via the `instantiate` override). */ materialize(data: AlertData): MexJYSAlert; protected instantiateItem(data: AlertItemData): MexJYSAlertItem; protected instantiateTransactionItem(data: AlertTransactionItemData): MexJYSAlertTransactionItem; protected instantiateClientItem(data: AlertClientItemData): MexJYSAlertClientItem; protected transformItemToNested(data: CreateJYSAlertItemInput): CreateAlertItemInput; protected transformItemUpdateToNested(data: UpdateJYSAlertItemInput): UpdateAlertItemInput; /** * Transforms JYS defaults to nested API format for validate/generate. */ protected transformJysDefaultsToNested(alertId: string, defaults?: JysAlertDefaultsInput): { alertId: string; reportType: ReportType; defaults?: unknown; }; }