UNPKG

smartlead-mcp-server

Version:

MCP server for Smartlead campaign management integration. Features include creating campaigns, updating campaign settings, and managing campaign sequences.

163 lines 5.51 kB
// Type guards for params validation export function isListLeadsParams(args) { if (typeof args !== 'object' || args === null) { return false; } const params = args; // Optional campaign_id must be a number if present if (params.campaign_id !== undefined && typeof params.campaign_id !== 'number') { return false; } // Optional status must be a string if present if (params.status !== undefined && typeof params.status !== 'string') { return false; } // Optional limit must be a number if present if (params.limit !== undefined && typeof params.limit !== 'number') { return false; } // Optional offset must be a number if present if (params.offset !== undefined && typeof params.offset !== 'number') { return false; } // Optional search must be a string if present if (params.search !== undefined && typeof params.search !== 'string') { return false; } // Optional start_date must be a string if present if (params.start_date !== undefined && typeof params.start_date !== 'string') { return false; } // Optional end_date must be a string if present if (params.end_date !== undefined && typeof params.end_date !== 'string') { return false; } return true; } export function isGetLeadParams(args) { return (typeof args === 'object' && args !== null && 'lead_id' in args && typeof args.lead_id === 'number'); } export function isAddLeadToCampaignParams(args) { if (typeof args !== 'object' || args === null || !('campaign_id' in args) || !('email' in args) || typeof args.campaign_id !== 'number' || typeof args.email !== 'string') { return false; } const params = args; // Optional fields validation if (params.first_name !== undefined && typeof params.first_name !== 'string') { return false; } if (params.last_name !== undefined && typeof params.last_name !== 'string') { return false; } if (params.company !== undefined && typeof params.company !== 'string') { return false; } if (params.title !== undefined && typeof params.title !== 'string') { return false; } if (params.phone !== undefined && typeof params.phone !== 'string') { return false; } if (params.custom_fields !== undefined && (typeof params.custom_fields !== 'object' || params.custom_fields === null)) { return false; } return true; } export function isUpdateLeadParams(args) { if (typeof args !== 'object' || args === null || !('lead_id' in args) || typeof args.lead_id !== 'number') { return false; } const params = args; // Optional fields validation if (params.email !== undefined && typeof params.email !== 'string') { return false; } if (params.first_name !== undefined && typeof params.first_name !== 'string') { return false; } if (params.last_name !== undefined && typeof params.last_name !== 'string') { return false; } if (params.company !== undefined && typeof params.company !== 'string') { return false; } if (params.title !== undefined && typeof params.title !== 'string') { return false; } if (params.phone !== undefined && typeof params.phone !== 'string') { return false; } if (params.custom_fields !== undefined && (typeof params.custom_fields !== 'object' || params.custom_fields === null)) { return false; } return true; } export function isUpdateLeadStatusParams(args) { return (typeof args === 'object' && args !== null && 'lead_id' in args && 'status' in args && typeof args.lead_id === 'number' && typeof args.status === 'string'); } export function isBulkImportLeadsParams(args) { if (typeof args !== 'object' || args === null || !('campaign_id' in args) || !('leads' in args) || typeof args.campaign_id !== 'number' || !Array.isArray(args.leads)) { return false; } const params = args; // Validate each lead in the leads array for (const lead of params.leads) { if (typeof lead !== 'object' || lead === null || !('email' in lead) || typeof lead.email !== 'string') { return false; } // Optional fields validation if (lead.first_name !== undefined && typeof lead.first_name !== 'string') { return false; } if (lead.last_name !== undefined && typeof lead.last_name !== 'string') { return false; } if (lead.company !== undefined && typeof lead.company !== 'string') { return false; } if (lead.title !== undefined && typeof lead.title !== 'string') { return false; } if (lead.phone !== undefined && typeof lead.phone !== 'string') { return false; } if (lead.custom_fields !== undefined && (typeof lead.custom_fields !== 'object' || lead.custom_fields === null)) { return false; } } return true; } export function isDeleteLeadParams(args) { return (typeof args === 'object' && args !== null && 'lead_id' in args && typeof args.lead_id === 'number'); } //# sourceMappingURL=lead.js.map