import type { Biomarker, ExportData, HealthResult, SexDetails } from "./types.js"; /** Parse a .env file into a key-value map. Handles KEY=VALUE, quoted values, and comments. */ export declare function parseDotenv(content: string): Record; /** Get an env var, falling back to .env files when not in process.env. * This handles MCP plugin processes that spawn without direnv. * Only falls back to .env files if the var is completely absent from process.env. */ export declare function getEnvVar(name: string): string | undefined; export declare const FILE_MODE = 384; export declare const DIR_MODE = 448; /** Write a file with restrictive permissions (owner-only). * Explicitly chmod after write to enforce permissions on pre-existing files. */ export declare function writeSecure(filePath: string, data: string): Promise; /** Check if an error is a file-not-found (ENOENT) */ export declare function isFileNotFound(err: unknown): boolean; /** Validate a date string matches YYYY-MM-DD format, throw if invalid */ export declare function validateDate(date: string): string; export declare const BASE_URL = "https://member-app-mid.functionhealth.com/api/v1"; export declare const FIREBASE_REFRESH_URL = "https://securetoken.googleapis.com/v1/token?key=AIzaSyBiXl12YtUHgxIYdtF0em_KEBodFtGElSE"; export declare const DEFAULT_HEADERS: Record; export declare function formatLocalDate(date: Date): string; export declare function today(): string; /** Fuzzy match a query against a biomarker name. Case-insensitive substring match. */ export declare function fuzzyMatch(query: string, target: string): boolean; /** Extract biomarker name from a result object (handles multiple field naming conventions). * Optionally accepts an ID-to-name map for fallback resolution via biomarkerId. */ export declare function getResultName(r: Record, idToName?: Map): string | null; /** Validate a date string is a real YYYY-MM-DD date */ export declare function isValidDateString(s: string): boolean; /** Parse an integer with NaN guard — returns the fallback if the value isn't a valid number */ export declare function safeParseInt(value: unknown, fallback: number): number; /** Derive the export date from result data, with configurable fallback */ export declare function deriveExportDate(data: { results: HealthResult[]; }, fallback?: string): string; /** Build a map of biomarker name (lowercase) -> category names from export data. * Biomarkers in multiple categories get comma-separated names. */ export declare function buildCategoryMap(data: { categories: Array<{ categoryName: string; biomarkers: Array<{ name: string; }>; }>; }): Map; /** Resolve sex-appropriate SexDetails for a biomarker based on user's biologicalSex */ export declare function resolveSexFilter(userSex?: string): string; /** Pick the best SexDetails entry for the given sex filter */ export declare function resolveSexDetails(bm: Biomarker, sexFilter: string): SexDetails | undefined; /** Sort comparator for dateOfService descending (latest first) */ export declare function byDateDesc(a: HealthResult, b: HealthResult): number; /** Filter results matching a biomarker name (fuzzy) and return sorted by date descending */ export declare function findMatchingResults(results: HealthResult[], name: string): HealthResult[]; export declare const SYNC_COOLDOWN_MS = 3600000; /** Extract display value from a result (prefers displayResult over calculatedResult) */ export declare function getResultValue(r: HealthResult): string; /** Build a set of lowercase biomarker names that are out of range */ export declare function buildOutOfRangeSet(results: HealthResult[]): Set; /** Filter results by biomarker name, category, and status */ export declare function filterResults(results: HealthResult[], opts: { biomarker?: string; category?: string; status?: string; }, categoryLookup?: Map): HealthResult[]; /** Group export data by test round (requisitionId). Results sharing a requisitionId * are merged into a single round keyed by the earliest dateOfService. * Results with empty requisitionId are assigned to a round only if there is exactly * one round with results sharing the same dateOfService; otherwise isolated. * Returns an array of [dateKey, roundData] tuples (not a Map) to preserve rounds * that happen to share the same earliest date. */ export declare function groupByRound(data: ExportData): Array<[string, ExportData]>; /** Extract the requisitionId for a group of results (returns empty string if mixed/missing) */ export declare function extractRequisitionId(results: HealthResult[]): string; /** Get unique visit dates from results, sorted ascending */ export declare function extractVisitDates(results: HealthResult[]): string[]; /** Delay for rate limiting */ export declare function delay(ms: number): Promise;