import type { IRestApiAdapter } from '../adapters/rest/rest-api-adapter.js'; import type { ServiceResult } from '../models/service-result.js'; /** * Classification type for a contact point field. */ export type ContactPointType = 'email' | 'phone' | 'name' | 'social' | 'url' | 'other'; /** * Represents a field identified as a contact point. */ export type ContactPointField = { /** API name of the field */ fieldName: string; /** User-friendly label */ fieldLabel: string; /** Salesforce field type (string, email, phone, textarea, etc.) */ fieldType: string; /** Classified contact point type */ contactPointType: ContactPointType; /** Classification confidence level */ confidence: 'high' | 'medium' | 'low'; /** Reason for classification */ reason: string; }; /** * Result of analyzing an object's fields for contact points. */ export type ContactPointAnalysis = { /** API name of the analyzed object */ objectName: string; /** Total number of fields on the object */ totalFields: number; /** Fields identified as contact points */ contactPointFields: ContactPointField[]; /** Number of contact point fields found */ contactPointCount: number; }; /** * Configuration for ContactPointService. */ export type IContactPointServiceConfig = { /** REST API adapter for describing objects */ restApiAdapter: IRestApiAdapter; /** Optional logger for debug output */ logger?: Console; }; /** * Service for analyzing Salesforce object fields to identify contact points. * * Contact points are fields that likely contain personal or contact information * such as email addresses, phone numbers, names, and social media identifiers. * This service uses field metadata (type and name) to classify fields with * high, medium, or low confidence. * * @example * ```typescript * const service = new ContactPointService({ restApiAdapter }); * const result = await service.analyzeContactPoints('Contact'); * if (result.success) { * result.data.contactPointFields.forEach(f => console.log(f.fieldName, f.contactPointType)); * } * ``` */ export declare class ContactPointService { private readonly restApiAdapter; private readonly logger?; constructor(config: IContactPointServiceConfig); /** * Checks whether a field is a system field that should be excluded from analysis. * * @param fieldName - The API name of the field * @returns true if the field is a system field */ private static isSystemField; /** * Attempts to classify a field by its Salesforce field type (high confidence). * * @param field - The field metadata to classify * @returns ContactPointField if classified, or undefined if no match */ private static classifyByFieldType; /** * Attempts to classify a field by its name using heuristic patterns (medium/low confidence). * * @param field - The field metadata to classify * @returns ContactPointField if classified, or undefined if no match */ private static classifyByFieldName; /** * Classifies a single field as a contact point, if applicable. * * Applies classification in priority order: * 1. Skip system fields * 2. High confidence: field type matching (email, phone, url) * 3. Medium/Low confidence: field name heuristics * * @param field - The field metadata to classify * @returns ContactPointField if classified, or undefined if not a contact point */ private static classifyField; /** * Analyzes a Salesforce object's fields to identify contact point fields. * * Uses the REST API describe endpoint to retrieve field metadata, then * classifies each field based on its type and name to identify fields * that likely contain personal or contact information. * * @param objectName - The Salesforce object API name (e.g., 'Contact', 'Account') * @returns ServiceResult containing the ContactPointAnalysis */ analyzeContactPoints(objectName: string): Promise>; }