A Chrome extension to fetch and view Salesforce object metadata directly from your browser.
This Chrome Extension background script is designed to interact with Salesforce APIs, focusing primarily on fetching metadata and data related to Salesforce objects. It listens for various actions triggered from the extension's content scripts and responds accordingly. Key functionalities include:
Authentication: It fetches Salesforce's session ID (SID) stored in cookies to authenticate API requests.
Data Retrieval: Uses the SID to fetch object metadata and actual data from Salesforce.
Multi-Domain Support: It can look for SID cookies across multiple Salesforce domains (salesforce.com and cloudforce.com).
Message Handling: Listens for messages such as 'CONTENT_SCRIPT_LOADED' and 'fetchMetadata' to perform specific tasks.
URL Monitoring: Monitors URL changes to refresh data when needed.
The script is well-organized, handling various edge cases and providing utility functions for sending success and error messages. It employs a mix of promises and callbacks for asynchronous operations. Overall, this script serves as a robust backbone for a Chrome Extension that aims to seamlessly interact with Salesforce.