/** * SmartStore Smart SQL Query Utilities * * This module provides utilities for converting SOQL queries to SmartStore Smart SQL format * for offline data access on iOS devices using Salesforce Mobile SDK. */ /** * Finds the main FROM clause in a query, ignoring any FROM clauses inside subqueries. * Returns the object name and the query with subqueries removed, so callers can reuse * the cleaned query and avoid parsing twice. */ export declare function findMainFromClause(query: string): { primaryObject: string | null; cleanQuery: string; }; /** * Comprehensive SOQL to SmartStore Smart Query converter * * Converts standard SOQL queries to SmartStore Smart SQL format for offline use on iOS. * Handles SELECT, FROM, WHERE, ORDER BY, GROUP BY, HAVING, LIMIT, OFFSET, * aggregate functions, and relationship fields. * * SmartStore stores denormalized data, so relationship fields are accessed directly * within the soup using the full relationship path (e.g., Child_Account_vod__r.Name). * * NOTE: SOQL subqueries (e.g., SELECT ... (SELECT ... FROM EventRelations) FROM Event) * are NOT supported by SmartStore. The subqueries will be removed and the data * should be fetched separately if needed. * * @param soqlQuery - The SOQL query string to convert * @returns The converted SmartStore Smart SQL query string * * @example * // Simple query * convertSoqlToSmartQuery('SELECT Id, Name FROM Account WHERE Active = true') * // Returns: SELECT {Account:Id}, {Account:Name} FROM {Account} WHERE {Account:Active} = true * * @example * // With relationship fields (denormalized access - no joins needed) * convertSoqlToSmartQuery('SELECT Id, Child_Account_vod__r.Name FROM Child_Account_vod__c') * // Returns: SELECT {Child_Account_vod__c:Id}, {Child_Account_vod__c:Child_Account_vod__r.Name} FROM {Child_Account_vod__c} * * @example * // With aggregate functions * convertSoqlToSmartQuery('SELECT COUNT(Id), Industry FROM Account GROUP BY Industry') * // Returns: SELECT COUNT({Account:Id}), {Account:Industry} FROM {Account} GROUP BY {Account:Industry} * * @example * // With ORDER BY and LIMIT * convertSoqlToSmartQuery('SELECT Id, Name FROM Contact ORDER BY LastName ASC, FirstName DESC LIMIT 100') * // Returns: SELECT {Contact:Id}, {Contact:Name} FROM {Contact} ORDER BY {Contact:LastName} ASC, {Contact:FirstName} DESC LIMIT 100 */ export declare function convertSoqlToSmartQuery(soqlQuery: string): string;