import { FormFieldData } from "../Validator/interface"; /** * Class representing the Anomaly detection logic for checking data validity based on predefined rules. * This class contains methods for initializing, caching, and fetching anomaly parameters from an external API, * as well as checking for anomalies in individual concepts and bulk data. */ export declare class Anomaly { /** * Static cache for storing fetched anomaly parameters. * @type {any} - Stores the fetched anomaly parameters from the API. */ private static anomalyParamsCache; /** * Flag indicating if the anomaly parameters cache has been initialized. * @type {boolean} - `true` if the cache is initialized, `false` otherwise. */ private static cacheInitialized; /** * Timestamp indicating the last time the anomaly parameters were fetched. * @type {number} - Time in milliseconds. */ private static lastFetchedTime; /** * Cache expiry threshold, after which the data will be considered expired. * @type {number} - Cache expiry threshold in milliseconds (default is 10 minutes). */ private static cacheExpiryThreshold; /** * Constructor that initializes anomaly parameters if the cache is not yet initialized. * It ensures that the anomaly parameters are loaded and cached for use. */ constructor(); /** * Initializes the anomaly parameters by fetching them from the API. * This method is only run once on startup to ensure the cache is ready for use. * It will fetch the parameters from the API and store them in a static cache. * * @returns {Promise} - A promise that resolves once the parameters have been initialized. */ private static initializeAnomalyParameters; /** * Fetches the anomaly parameters. * It first checks if the parameters are cached and whether the cache is still valid (not expired). * If the cache is valid, it returns the cached data. If not, it fetches the data from the API. * * @returns {Promise} - A promise that resolves to the anomaly parameters. */ static getAnomalyParameters(): Promise; /** * Fetches anomaly parameters directly from the backend API. * This method is used internally by `getAnomalyParameters` to retrieve fresh data. * * @returns {Promise} - A promise that resolves to the fetched anomaly parameters. */ private static fetchAnomalyParameters; /** * Refreshes the anomaly parameters cache if the cache has expired. * If the cache expiry threshold has been surpassed, the method re-fetches the data from the API. * * @returns {Promise} - A promise that resolves when the cache has been refreshed. */ private static refreshCache; /** * Detects the data type of a given value based on predefined rules. * It checks the value against the `DATA_TYPES_RULES` to find the matching data type. * * @param {string} value - The value to check. * @returns {string | null} - The detected data type, or `null` if no match is found. */ detectDataType(value: string): string | null; /** * Checks whether a given concept and value pair contains an anomaly. * An anomaly is detected based on the concept's length and type rules. * * @param {string} typeConcept - The concept type (e.g., `the_name`). * @param {string} value - The value to check for anomalies. * @returns {Promise<{ valid: boolean, warnings: string[] }>} - A promise that resolves to an object containing: * - `valid`: A boolean indicating whether the value is valid according to the anomaly rules. * - `warnings`: An array of warning messages related to the value's anomalies. */ checkConceptAnomaly(typeConcept: string, value: string | null): Promise<{ valid: boolean; warnings: string[]; }>; /** * Checks anomalies for multiple concepts in bulk. * Iterates over a record of concept-value pairs and detects anomalies. * * @param {Record} instanceData - An object where each key is a concept type and each value is the corresponding data value. * @returns {Promise>} - A promise that resolves to an object where each key is a concept type * and the value is an object containing `valid` (boolean) and `warnings` (array of warning messages). */ static checkAnomalyInBulk(formData: Record): Promise>; /** * List all the exported functions of the package * @returns Keys of the Object which has exported functions */ static getExportedFunction(): string[]; private static getFunctionaAnomalyParameters; }