export declare const escapeSoqlString: (input: string) => string; export declare const convertToSosl: (soqlQuery: string, searchString: string, searchInField?: string) => string | null; export interface AccountSortPriority { field: string; order: string[]; } /** * Parse `code_json_account_sort_priority` (JSON string or object) → validated * { field, order }. Returns null on malformed JSON, blank field, or empty * order — callers treat null as "no tiering". */ export declare const parseSortPriority: (raw: unknown) => AccountSortPriority | null; /** * Build ordered SOQL WHERE conditions from a priority `order` list. Each entry * becomes a tier in order: a value → `field = ''`; "*" → a single * `field NOT IN ()` rest tier at that position. If "*" is * absent, the rest tier is appended last (unlisted rows are never dropped). * Returns [] when field is empty or there are no real (non-"*") values. */ export declare const buildSortTierConditions: (field: string, order: string[]) => string[]; /** * AND an extra boolean condition into a SOQL query's WHERE clause, before any * ORDER BY / LIMIT tail. Adds a WHERE if the query has none. Wraps in parens. */ export declare const addAndCondition: (query: string, condition: string) => string; /** * Ensure `field` is part of a SOQL SELECT clause so its value comes back on each * record and can be used for client-side tier sorting. No-op when the field is * already selected, the query has no SELECT…FROM, or the field isn't a plain * SOQL identifier. Matching is exact (trimmed, case-insensitive) per segment. * Mirrors the SELECT-injection approach of `ensureNameFieldsInQuery`. */ export declare const ensureFieldInSelect: (query: string, field: string) => string; /** * Tier index of a record for client-side priority sorting, matching * `buildSortTierConditions` semantics: a listed value → its position; an * unlisted value → the "*" position if present, else after all listed tiers. */ export declare const getSortTierIndex: (record: Record, field: string, order: string[]) => number; /** * Stable-sort records into priority tiers (see `getSortTierIndex`). Records keep * their incoming order within a tier; returns the input unchanged when field or * order are empty. Use to re-order a merged list (e.g. name matches + accounts * pulled in via contact matches) so brand priority holds across the whole list. */ export declare const sortRecordsByTier: >(records: T[], field: string, order: string[]) => T[]; /** Flatten tier arrays in order, dedupe by `idKey` (first wins), optional cap. */ export declare const mergeTieredRecords: >(tiers: T[][], limit?: number, idKey?: string) => T[];