import { QueryPayload, CRMQueryPayload, UpsertCRMObjectsPayload, CRMSmartObjectValidationRulesPayload, CRMSmartObjectMetadataPayload, CRMSmartObjectLayoutPayload, CRMSmartDeleteObjectsPayload, CRMCreatePayload, CRMUpsertPayload, CRMDescribePayload, CRMLayoutPayload } from '../../payload.types'; export declare function query(payload: QueryPayload): Promise; export declare function crmQuery(payload: CRMQueryPayload): Promise; /** * Executes a CRM query with automatic iOS/SmartStore adaptation. * * On iOS devices with the 'sfdc_offline_enabled' LaunchDarkly flag enabled, * this function automatically converts SOQL queries to SmartStore Smart SQL format * and uses the local SmartStore for offline data access. * On other platforms or when the flag is disabled, it uses the standard CRM query API. * * @param {CRMQueryPayload} payload - The query payload containing the SOQL query string. * @returns {Promise} - Promise resolving with query results. * * @example * // Works on all platforms - automatically adapts for iOS with sfdc_offline_enabled LD flag * const result = await crmQueryAdaptive({ query: 'SELECT Id, Name FROM Account WHERE Active = true' }) */ export declare function crmQueryAdaptive(payload: CRMQueryPayload): Promise; /** * Executes a SmartStore query against local CRM data (iOS only). * Uses Salesforce Mobile SDK SmartStore query syntax. * Validates that the query uses SmartStore syntax before execution. * * @param {CRMQueryPayload} payload - The query payload containing the SmartStore query string. * @returns {Promise>} - Promise resolving with an array of query results from SmartStore. * @throws {Error} - Throws an error if the query is not a valid SmartStore query. * * @example * // iOS only method to execute a SmartStore query. * api.crmSmartQuery({ query: 'SELECT {Account:Id}, {Account:Name} FROM {Account} ORDER BY {Account:Name} LIMIT 10' }) */ export declare function crmSmartQuery(payload: CRMQueryPayload): Promise>; /** * Retrieves metadata for a CRM smart object (iOS only). * Fetches object metadata from the Salesforce Mobile SDK cache. * * @param {CRMSmartObjectMetadataPayload} payload - The payload containing the object name. * @returns {Promise} - Promise resolving with the object metadata. * @throws {Error} - Throws an error if the object name is not provided. * * @example * // iOS only method to retrieve CRM object metadata. * api.crmSmartObjectMetadata({ object: 'Account' }) */ export declare function crmSmartObjectMetadata(payload: CRMSmartObjectMetadataPayload): Promise; /** * Upserts CRM objects into local CRM data (iOS only). * Uses Salesforce Mobile SDK SmartStore to insert or update records. * Each object in the payload specifies a table name, the objects to upsert, and an optional external ID path. * * **Important**: Always provide `external_id_path` when performing updates to ensure records are * matched correctly. Without it, the operation may create duplicate records instead of updating existing ones. * * **Note**: When creating new records, you must provide an explicit identifier field (e.g., `Id`) * in each record object passed from the frontend. The backend does not auto-generate IDs. * * @param {UpsertCRMObjectsPayload} payload - The upsert payload containing an array of UpsertCRMObject items. * @returns {Promise} - Promise resolving with the result of the upsert operation. * @throws {Error} - Throws an error if the payload is invalid. * * @example * // iOS only method to upsert CRM objects. * * // Updating existing records - always include external_id_path * api.crmSmartUpsertObjects({ * objects: [ * { * table_name: 'Account', * objects: [{ Id: '001xx000003DGbQAAW', Name: 'Acme Corp Updated' }], * external_id_path: 'Id' // Required for updates to match existing records * } * ] * }) * * // Creating new records - explicit ID required in each record * api.crmSmartUpsertObjects({ * objects: [ * { * table_name: 'Account', * objects: [ * { Id: '001xx000003NEW001', Name: 'New Company' }, // Explicit ID required * { Id: '001xx000003NEW002', Name: 'Another Company' } * ] * } * ] * }) */ export declare function crmSmartUpsertObjects(payload: UpsertCRMObjectsPayload): Promise; /** * Retrieves validation rules for a CRM smart object (iOS only). * This method fetches the validation rules configured for a specific CRM object type * from the local SmartStore cache. * * @param {CRMSmartObjectValidationRulesPayload} payload - The payload containing the object name. * @returns {Promise} - Promise resolving with the validation rules for the specified object. * * @example * // iOS only method to get validation rules for an Account object. * api.crmSmartObjectValidationRules({ object: 'Account' }) * * @example * // Get validation rules for a Contact object. * api.crmSmartObjectValidationRules({ object: 'Contact' }) */ export declare function crmSmartObjectValidationRules(payload: CRMSmartObjectValidationRulesPayload): Promise; /** * Retrieves layout information for a CRM smart object (iOS only). * Fetches object layout metadata from the Salesforce Mobile SDK cache. * * @param {CRMSmartObjectLayoutPayload} payload - The payload containing the object name and optional layout parameters. * @returns {Promise} - Promise resolving with the object layout metadata. * @throws {Error} - Throws an error if the object name is not provided. * * @example * // iOS only method to retrieve CRM object layout. * api.crmSmartObjectLayout({ object: 'Account' }) * * @example * // Get layout with specific form factor and mode. * api.crmSmartObjectLayout({ object: 'Account', form_factor: 'Large', mode: 'Edit' }) */ export declare function crmSmartObjectLayout(payload: CRMSmartObjectLayoutPayload): Promise; /** * Deletes CRM objects from local CRM data (iOS only). * Uses Salesforce Mobile SDK SmartStore to delete records. * Each object in the payload specifies a table name and an array of IDs to delete. * * @param {CRMSmartDeleteObjectsPayload} payload - The delete payload containing an array of CRMDeleteObject items. * @returns {Promise} - Promise resolving with the result of the delete operation. * @throws {Error} - Throws an error if the payload is invalid. * * @example * // iOS only method to delete CRM objects. * api.crmSmartDeleteObjects({ * objects: [ * { * table_name: 'Account', * ids: ['001xx000003DGbQAAW', '001xx000003DGbRABW'] * }, * { * table_name: 'Contact', * ids: ['003xx000004TmiQAAS'] * } * ] * }) */ export declare function crmSmartDeleteObjects(payload: CRMSmartDeleteObjectsPayload): Promise; /** * Creates new records in CRM (Web only). * Uses Salesforce REST API to create records. * * @param {CRMCreatePayload} payload - The create payload containing sobject type and records. * @returns {Promise} - Promise resolving with the result of the create operation. * @throws {Error} - Throws an error if the payload is invalid. * * @example * // Web only method to create CRM records. * api.crmCreate({ * sobject: 'Order__c', * records: [ * { Account__c: '001xx000003DGbQAAW', Order_Date__c: '2024-01-15' }, * { Account__c: '001xx000003DGbRABW', Order_Date__c: '2024-01-16' } * ] * }) */ export declare function crmCreate(payload: CRMCreatePayload): Promise; /** * Upserts records in CRM (Web only). * Uses Salesforce REST API to insert or update records based on external ID. * If a record with matching external ID exists, it will be updated; otherwise, a new record is created. * * @param {CRMUpsertPayload} payload - The upsert payload containing sobject type, records, and external ID field. * @returns {Promise} - Promise resolving with the result of the upsert operation. * @throws {Error} - Throws an error if the payload is invalid. * * @example * // Web only method to upsert CRM records. * api.crmUpsert({ * sobject: 'Order__c', * records: [ * { External_Id__c: 'ORD-001', Account__c: '001xx000003DGbQAAW', Status__c: 'Submitted' }, * { External_Id__c: 'ORD-002', Account__c: '001xx000003DGbRABW', Status__c: 'Draft' } * ], * external_id_field: 'External_Id__c' * }) */ export declare function crmUpsert(payload: CRMUpsertPayload): Promise; /** * Retrieves metadata/describe for a CRM object (Web only). * Uses Salesforce REST API to fetch object metadata including fields and picklist values. * * @param {CRMDescribePayload} payload - The describe payload containing the sobject name. * @returns {Promise} - Promise resolving with the object metadata including fields and picklist values. * @throws {Error} - Throws an error if the payload is invalid. * * @example * // Web only method to get CRM object metadata. * api.crmDescribe({ sobject: 'Account' }) * .then(metadata => { * // Access fields * console.log(metadata.fields) * // Access picklist values for a specific field * const industryField = metadata.fields.find(f => f.name === 'Industry') * console.log(industryField.picklistValues) * }) */ export declare function crmDescribe(payload: CRMDescribePayload): Promise; /** * Retrieves layout information for a CRM object (Web only). * Uses Salesforce REST API to fetch object layout including sections, fields arrangement, and form factors. * * @param {CRMLayoutPayload} payload - The layout payload containing the sobject name and optional layout parameters. * @returns {Promise} - Promise resolving with the object layout information. * @throws {Error} - Throws an error if the payload is invalid. * * @example * // Web only method to get CRM object layout. * api.crmLayout({ sobject: 'Account' }) * .then(layout => { * // Access layout sections * console.log(layout.editLayoutSections) * }) * * @example * // Get layout with specific form factor, mode, and record type. * api.crmLayout({ * sobject: 'Account', * form_factor: 'Large', * mode: 'Edit', * record_type_id: '012xx0000004ABC' * }) */ export declare function crmLayout(payload: CRMLayoutPayload): Promise;