UNPKG

@rockship/apollo-io-mcp

Version:

A powerful Model Context Protocol (MCP) server implementation for seamless Apollo.io API integration, enabling AI assistants to interact with Apollo.io data

110 lines 3.72 kB
const exclude = (obj, keys) => { return Object.fromEntries(Object.entries(obj).filter(([key]) => !keys.includes(key))); }; export const mappingDataContact = (data) => { try { return data?.length > 0 ? data.map((contact) => { const { id, first_name, last_name, name, linkedin_url, title, contact_stage_id, owner_id, creator_id, person_id, organization_name, source, original_source, organization_id, headline, photo_url, present_raw_address, linkedin_uid, salesforce_id, crm_owner_id, created_at, updated_at, account_id, crm_id, email, email_from_customer, source_display_name, sanitized_phone, state, city, country, hubspot_vid, hubspot_owner_id, account, contact_emails, organization, time_zone, phone_numbers, } = contact; return { id, first_name, last_name, name, linkedin_url, title, contact_stage_id, owner_id, creator_id, person_id, organization_name, source, original_source, organization_id, headline, photo_url, present_raw_address, linkedin_uid, salesforce_id, crm_owner_id, created_at, updated_at, account_id, crm_id, email, email_from_customer, source_display_name, sanitized_phone, state, city, country, account, hubspot_vid, hubspot_owner_id, contact_emails, organization, time_zone, phone_numbers, }; }) : []; } catch (error) { return []; } }; const mappingDataOrganization = (data) => { return data?.length > 0 ? data : []; }; export const contactSearchMappingResponse = (response) => { const { contacts, people, ...rest } = response; const data = exclude(rest, [ "breadcrumbs", "partial_results_only", "has_join", "disable_eu_prospecting", "num_fetch_result", "partial_results_limit", ]); return { ...data, contacts: mappingDataContact(contacts), }; }; export const peopleSearchMappingResponse = (response) => { const { contacts, people, ...rest } = response; const data = exclude(rest, [ "breadcrumbs", "model_ids", "partial_results_only", "has_join", "disable_eu_prospecting", "num_fetch_result", "derived_params", "partial_results_limit", ]); return { ...data, contacts: mappingDataContact(contacts), people: mappingDataContact(people), }; }; export const organizationSearchMappingResponse = (response) => { const { organizations, accounts, ...rest } = response; const data = exclude(rest, [ "breadcrumbs", "model_ids", "partial_results_only", "has_join", "disable_eu_prospecting", "num_fetch_result", "derived_params", "partial_results_limit", ]); return { ...data, accounts: mappingDataOrganization(accounts), organizations: mappingDataOrganization(organizations), }; }; //# sourceMappingURL=mapping-response.js.map