linkedin-secret-sauce 0.4.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/enrichment/auth/index.d.ts +4 -0
- package/dist/enrichment/auth/index.js +12 -0
- package/dist/enrichment/auth/smartlead-auth.d.ts +50 -0
- package/dist/enrichment/auth/smartlead-auth.js +156 -0
- package/dist/enrichment/index.d.ts +44 -0
- package/dist/enrichment/index.js +244 -0
- package/dist/enrichment/orchestrator.d.ts +31 -0
- package/dist/enrichment/orchestrator.js +218 -0
- package/dist/enrichment/providers/apollo.d.ts +11 -0
- package/dist/enrichment/providers/apollo.js +136 -0
- package/dist/enrichment/providers/construct.d.ts +11 -0
- package/dist/enrichment/providers/construct.js +107 -0
- package/dist/enrichment/providers/dropcontact.d.ts +16 -0
- package/dist/enrichment/providers/dropcontact.js +37 -0
- package/dist/enrichment/providers/hunter.d.ts +11 -0
- package/dist/enrichment/providers/hunter.js +162 -0
- package/dist/enrichment/providers/index.d.ts +9 -0
- package/dist/enrichment/providers/index.js +18 -0
- package/dist/enrichment/providers/ldd.d.ts +11 -0
- package/dist/enrichment/providers/ldd.js +110 -0
- package/dist/enrichment/providers/smartprospect.d.ts +19 -0
- package/dist/enrichment/providers/smartprospect.js +333 -0
- package/dist/enrichment/types.d.ts +343 -0
- package/dist/enrichment/types.js +31 -0
- package/dist/enrichment/utils/disposable-domains.d.ts +24 -0
- package/dist/enrichment/utils/disposable-domains.js +1011 -0
- package/dist/enrichment/utils/index.d.ts +6 -0
- package/dist/enrichment/utils/index.js +22 -0
- package/dist/enrichment/utils/personal-domains.d.ts +31 -0
- package/dist/enrichment/utils/personal-domains.js +95 -0
- package/dist/enrichment/utils/validation.d.ts +42 -0
- package/dist/enrichment/utils/validation.js +130 -0
- package/dist/enrichment/verification/index.d.ts +4 -0
- package/dist/enrichment/verification/index.js +8 -0
- package/dist/enrichment/verification/mx.d.ts +16 -0
- package/dist/enrichment/verification/mx.js +168 -0
- package/dist/index.d.ts +18 -14
- package/dist/index.js +26 -1
- package/package.json +15 -16
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Email Enrichment Types
|
|
3
|
+
*
|
|
4
|
+
* Core types for the email enrichment module. These types are designed to be
|
|
5
|
+
* stateless - consumers pass their own API keys and configuration.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Canonical email result returned by enrichment operations
|
|
9
|
+
*/
|
|
10
|
+
export interface CanonicalEmail {
|
|
11
|
+
/** The found business email, or null if not found */
|
|
12
|
+
business_email: string | null;
|
|
13
|
+
/** Which provider found the email */
|
|
14
|
+
business_email_source: string | null;
|
|
15
|
+
/** Whether the email was verified */
|
|
16
|
+
business_email_verified: boolean;
|
|
17
|
+
/** Confidence score (0-100) */
|
|
18
|
+
business_email_confidence?: number;
|
|
19
|
+
/** ISO timestamp of when the check was performed */
|
|
20
|
+
last_checked_at: string;
|
|
21
|
+
/** Status for debugging */
|
|
22
|
+
status?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Raw result from a provider before normalization
|
|
26
|
+
*/
|
|
27
|
+
export interface ProviderResult {
|
|
28
|
+
email?: string | null;
|
|
29
|
+
verified?: boolean;
|
|
30
|
+
score?: number;
|
|
31
|
+
confidence?: number;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Provider function signature
|
|
35
|
+
*/
|
|
36
|
+
export type ProviderFunc = (candidate: EnrichmentCandidate) => Promise<ProviderResult | null>;
|
|
37
|
+
/**
|
|
38
|
+
* Input candidate for enrichment - flexible to accept various naming conventions
|
|
39
|
+
*/
|
|
40
|
+
export interface EnrichmentCandidate {
|
|
41
|
+
firstName?: string;
|
|
42
|
+
first_name?: string;
|
|
43
|
+
first?: string;
|
|
44
|
+
lastName?: string;
|
|
45
|
+
last_name?: string;
|
|
46
|
+
last?: string;
|
|
47
|
+
name?: string;
|
|
48
|
+
fullName?: string;
|
|
49
|
+
full_name?: string;
|
|
50
|
+
company?: string;
|
|
51
|
+
currentCompany?: string;
|
|
52
|
+
organization?: string;
|
|
53
|
+
org?: string;
|
|
54
|
+
domain?: string;
|
|
55
|
+
companyDomain?: string;
|
|
56
|
+
company_domain?: string;
|
|
57
|
+
linkedinUsername?: string;
|
|
58
|
+
linkedin_username?: string;
|
|
59
|
+
linkedinUrl?: string;
|
|
60
|
+
linkedin_url?: string;
|
|
61
|
+
linkedinId?: string;
|
|
62
|
+
linkedin_id?: string;
|
|
63
|
+
title?: string;
|
|
64
|
+
currentRole?: string;
|
|
65
|
+
current_role?: string;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Hunter.io provider configuration
|
|
69
|
+
*/
|
|
70
|
+
export interface HunterConfig {
|
|
71
|
+
apiKey: string;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Apollo.io provider configuration
|
|
75
|
+
*/
|
|
76
|
+
export interface ApolloConfig {
|
|
77
|
+
apiKey: string;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* SmartProspect/Smartlead provider configuration
|
|
81
|
+
*
|
|
82
|
+
* Supports two auth methods:
|
|
83
|
+
* 1. Direct token: Pass `apiToken` directly
|
|
84
|
+
* 2. Credentials: Pass `email` and `password` for auto-login with token caching
|
|
85
|
+
*/
|
|
86
|
+
export interface SmartProspectConfig {
|
|
87
|
+
/** Direct API/JWT token (if you already have one) */
|
|
88
|
+
apiToken?: string;
|
|
89
|
+
/** SmartLead account email (for credentials-based auth) */
|
|
90
|
+
email?: string;
|
|
91
|
+
/** SmartLead account password (for credentials-based auth) */
|
|
92
|
+
password?: string;
|
|
93
|
+
/** API URL override (default: https://prospect-api.smartlead.ai/api/search-email-leads) */
|
|
94
|
+
apiUrl?: string;
|
|
95
|
+
/** Login URL override (default: https://server.smartlead.ai/api/auth/login) */
|
|
96
|
+
loginUrl?: string;
|
|
97
|
+
/** Pre-fetch token on client creation (default: true) - ensures token is ready for first request */
|
|
98
|
+
eagerInit?: boolean;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* LinkedIn Data Dump provider configuration
|
|
102
|
+
*/
|
|
103
|
+
export interface LddConfig {
|
|
104
|
+
apiUrl: string;
|
|
105
|
+
apiToken: string;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Dropcontact provider configuration
|
|
109
|
+
*/
|
|
110
|
+
export interface DropcontactConfig {
|
|
111
|
+
apiKey: string;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Email construction provider configuration (no API key needed)
|
|
115
|
+
*/
|
|
116
|
+
export interface ConstructConfig {
|
|
117
|
+
/** Maximum email pattern attempts (default: 8) */
|
|
118
|
+
maxAttempts?: number;
|
|
119
|
+
/** Timeout for MX verification in ms (default: 5000) */
|
|
120
|
+
timeoutMs?: number;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* All provider configurations
|
|
124
|
+
*/
|
|
125
|
+
export interface ProvidersConfig {
|
|
126
|
+
construct?: ConstructConfig;
|
|
127
|
+
ldd?: LddConfig;
|
|
128
|
+
smartprospect?: SmartProspectConfig;
|
|
129
|
+
hunter?: HunterConfig;
|
|
130
|
+
apollo?: ApolloConfig;
|
|
131
|
+
dropcontact?: DropcontactConfig;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Options for enrichment operations
|
|
135
|
+
*/
|
|
136
|
+
export interface EnrichmentOptions {
|
|
137
|
+
/** Maximum cost per email enrichment in USD (default: Infinity) */
|
|
138
|
+
maxCostPerEmail?: number;
|
|
139
|
+
/** Minimum confidence threshold 0-100 (default: 0) */
|
|
140
|
+
confidenceThreshold?: number;
|
|
141
|
+
/** Provider order (default: ['construct', 'ldd', 'smartprospect', 'hunter', 'apollo', 'dropcontact']) */
|
|
142
|
+
providerOrder?: ProviderName[];
|
|
143
|
+
/** Retry delay in ms on transient errors (default: 200) */
|
|
144
|
+
retryMs?: number;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Options for batch enrichment
|
|
148
|
+
*/
|
|
149
|
+
export interface BatchEnrichmentOptions extends EnrichmentOptions {
|
|
150
|
+
/** Batch size for parallel processing (default: 50) */
|
|
151
|
+
batchSize?: number;
|
|
152
|
+
/** Delay between batches in ms (default: 200) */
|
|
153
|
+
delayMs?: number;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Cache adapter interface - consumers provide their own caching implementation
|
|
157
|
+
*/
|
|
158
|
+
export interface CacheAdapter {
|
|
159
|
+
/** Get cached result for an email */
|
|
160
|
+
get: (email: string) => Promise<CanonicalEmail | null>;
|
|
161
|
+
/** Set cached result for an email */
|
|
162
|
+
set: (email: string, result: CanonicalEmail, ttlMs?: number) => Promise<void>;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Cost callback - called when a provider incurs a cost
|
|
166
|
+
*/
|
|
167
|
+
export type CostCallback = (provider: string, costUsd: number) => void | Promise<void>;
|
|
168
|
+
/**
|
|
169
|
+
* Logger interface - consumers can provide their own logger
|
|
170
|
+
*/
|
|
171
|
+
export interface EnrichmentLogger {
|
|
172
|
+
debug?: (message: string, context?: Record<string, unknown>) => void;
|
|
173
|
+
info?: (message: string, context?: Record<string, unknown>) => void;
|
|
174
|
+
warn?: (message: string, context?: Record<string, unknown>) => void;
|
|
175
|
+
error?: (message: string, context?: Record<string, unknown>) => void;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Configuration for createEnrichmentClient
|
|
179
|
+
*/
|
|
180
|
+
export interface EnrichmentClientConfig {
|
|
181
|
+
/** Provider API keys and configuration */
|
|
182
|
+
providers: ProvidersConfig;
|
|
183
|
+
/** Enrichment options */
|
|
184
|
+
options?: EnrichmentOptions;
|
|
185
|
+
/** Optional cache adapter */
|
|
186
|
+
cache?: CacheAdapter;
|
|
187
|
+
/** Optional cost tracking callback */
|
|
188
|
+
onCost?: CostCallback;
|
|
189
|
+
/** Optional logger */
|
|
190
|
+
logger?: EnrichmentLogger;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Enrichment client interface
|
|
194
|
+
*/
|
|
195
|
+
export interface EnrichmentClient {
|
|
196
|
+
/** Enrich a single candidate */
|
|
197
|
+
enrich: (candidate: EnrichmentCandidate) => Promise<CanonicalEmail>;
|
|
198
|
+
/** Enrich multiple candidates in batches */
|
|
199
|
+
enrichBatch: (candidates: EnrichmentCandidate[], options?: BatchEnrichmentOptions) => Promise<Array<{
|
|
200
|
+
candidate: EnrichmentCandidate;
|
|
201
|
+
} & CanonicalEmail>>;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Available provider names
|
|
205
|
+
*/
|
|
206
|
+
export type ProviderName = "construct" | "ldd" | "smartprospect" | "hunter" | "apollo" | "dropcontact";
|
|
207
|
+
/**
|
|
208
|
+
* Default provider order
|
|
209
|
+
*/
|
|
210
|
+
export declare const DEFAULT_PROVIDER_ORDER: ProviderName[];
|
|
211
|
+
/**
|
|
212
|
+
* Provider costs in USD per lookup
|
|
213
|
+
*/
|
|
214
|
+
export declare const PROVIDER_COSTS: Record<ProviderName, number>;
|
|
215
|
+
/**
|
|
216
|
+
* Email verification result
|
|
217
|
+
*/
|
|
218
|
+
export interface VerificationResult {
|
|
219
|
+
/** Whether the email is valid */
|
|
220
|
+
valid: boolean | null;
|
|
221
|
+
/** Confidence score 0-100 */
|
|
222
|
+
confidence: number;
|
|
223
|
+
/** Reason for the result */
|
|
224
|
+
reason?: "valid" | "invalid" | "syntax" | "mx_missing" | "disposable" | "role_account" | "catch_all" | "timeout" | "error";
|
|
225
|
+
/** Whether this is a catch-all domain */
|
|
226
|
+
isCatchAll: boolean;
|
|
227
|
+
/** Whether this is a role account (info@, support@, etc.) */
|
|
228
|
+
isRoleAccount: boolean;
|
|
229
|
+
/** Whether this is a disposable email */
|
|
230
|
+
isDisposable: boolean;
|
|
231
|
+
/** MX records found */
|
|
232
|
+
mxRecords?: string[];
|
|
233
|
+
}
|
|
234
|
+
export interface SmartProspectCompany {
|
|
235
|
+
name: string;
|
|
236
|
+
website: string;
|
|
237
|
+
}
|
|
238
|
+
export interface SmartProspectContact {
|
|
239
|
+
id: string;
|
|
240
|
+
firstName: string;
|
|
241
|
+
lastName: string;
|
|
242
|
+
fullName: string;
|
|
243
|
+
title: string;
|
|
244
|
+
company: SmartProspectCompany;
|
|
245
|
+
department: string[];
|
|
246
|
+
level: string;
|
|
247
|
+
industry: string;
|
|
248
|
+
subIndustry: string;
|
|
249
|
+
companyHeadCount: string;
|
|
250
|
+
companyRevenue: string;
|
|
251
|
+
country: string;
|
|
252
|
+
state: string;
|
|
253
|
+
city: string;
|
|
254
|
+
email: string;
|
|
255
|
+
emailSource?: string;
|
|
256
|
+
linkedin: string;
|
|
257
|
+
emailDeliverability: number;
|
|
258
|
+
address: string;
|
|
259
|
+
status?: string;
|
|
260
|
+
verificationStatus?: string;
|
|
261
|
+
catchAllStatus?: string;
|
|
262
|
+
}
|
|
263
|
+
export interface SmartProspectSearchFilters {
|
|
264
|
+
name?: string[];
|
|
265
|
+
firstName?: string[];
|
|
266
|
+
lastName?: string[];
|
|
267
|
+
title?: string[];
|
|
268
|
+
company?: string[];
|
|
269
|
+
domain?: string[];
|
|
270
|
+
department?: string[];
|
|
271
|
+
level?: string[];
|
|
272
|
+
industry?: string[];
|
|
273
|
+
country?: string[];
|
|
274
|
+
state?: string[];
|
|
275
|
+
city?: string[];
|
|
276
|
+
companyHeadCount?: string[];
|
|
277
|
+
companyRevenue?: string[];
|
|
278
|
+
dontDisplayOwnedContact?: boolean;
|
|
279
|
+
limit?: number;
|
|
280
|
+
titleExactMatch?: boolean;
|
|
281
|
+
scroll_id?: string;
|
|
282
|
+
}
|
|
283
|
+
export interface SmartProspectSearchResponse {
|
|
284
|
+
success: boolean;
|
|
285
|
+
message: string;
|
|
286
|
+
data: {
|
|
287
|
+
list: SmartProspectContact[];
|
|
288
|
+
scroll_id?: string;
|
|
289
|
+
filter_id?: number;
|
|
290
|
+
total_count: number;
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
export interface SmartProspectFetchResponse {
|
|
294
|
+
success: boolean;
|
|
295
|
+
message: string;
|
|
296
|
+
data: {
|
|
297
|
+
list: SmartProspectContact[];
|
|
298
|
+
total_count: number;
|
|
299
|
+
metrics: {
|
|
300
|
+
totalContacts: number;
|
|
301
|
+
totalEmails: number;
|
|
302
|
+
noEmailFound: number;
|
|
303
|
+
invalidEmails: number;
|
|
304
|
+
catchAllEmails: number;
|
|
305
|
+
verifiedEmails: number;
|
|
306
|
+
completed: number;
|
|
307
|
+
};
|
|
308
|
+
leads_found: number;
|
|
309
|
+
email_fetched: number;
|
|
310
|
+
verification_status_list: string[];
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
export interface LddProfileEmail {
|
|
314
|
+
email_address: string;
|
|
315
|
+
email_type?: string | null;
|
|
316
|
+
}
|
|
317
|
+
export interface LddProfilePhone {
|
|
318
|
+
phone_number: string;
|
|
319
|
+
phone_type?: string | null;
|
|
320
|
+
}
|
|
321
|
+
export interface LddProfileData {
|
|
322
|
+
source_record_id: string;
|
|
323
|
+
linkedin_profile_url?: string | null;
|
|
324
|
+
linkedin_id?: string | null;
|
|
325
|
+
linkedin_username?: string | null;
|
|
326
|
+
first_name?: string | null;
|
|
327
|
+
last_name?: string | null;
|
|
328
|
+
full_name?: string | null;
|
|
329
|
+
profile_headline?: string | null;
|
|
330
|
+
profile_summary?: string | null;
|
|
331
|
+
profile_location?: string | null;
|
|
332
|
+
emails: LddProfileEmail[];
|
|
333
|
+
phones: LddProfilePhone[];
|
|
334
|
+
}
|
|
335
|
+
export type LddApiResponse = {
|
|
336
|
+
success: true;
|
|
337
|
+
data: LddProfileData;
|
|
338
|
+
} | {
|
|
339
|
+
success: false;
|
|
340
|
+
error: string;
|
|
341
|
+
message: string;
|
|
342
|
+
statusCode?: number;
|
|
343
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Email Enrichment Types
|
|
4
|
+
*
|
|
5
|
+
* Core types for the email enrichment module. These types are designed to be
|
|
6
|
+
* stateless - consumers pass their own API keys and configuration.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.PROVIDER_COSTS = exports.DEFAULT_PROVIDER_ORDER = void 0;
|
|
10
|
+
/**
|
|
11
|
+
* Default provider order
|
|
12
|
+
*/
|
|
13
|
+
exports.DEFAULT_PROVIDER_ORDER = [
|
|
14
|
+
"construct",
|
|
15
|
+
"ldd",
|
|
16
|
+
"smartprospect",
|
|
17
|
+
"hunter",
|
|
18
|
+
"apollo",
|
|
19
|
+
"dropcontact",
|
|
20
|
+
];
|
|
21
|
+
/**
|
|
22
|
+
* Provider costs in USD per lookup
|
|
23
|
+
*/
|
|
24
|
+
exports.PROVIDER_COSTS = {
|
|
25
|
+
construct: 0,
|
|
26
|
+
ldd: 0,
|
|
27
|
+
smartprospect: 0.01,
|
|
28
|
+
hunter: 0.005,
|
|
29
|
+
apollo: 0,
|
|
30
|
+
dropcontact: 0.01,
|
|
31
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Disposable Email Domain Detection
|
|
3
|
+
*
|
|
4
|
+
* Detects disposable/temporary email domains (Mailinator, Guerrillamail, etc.)
|
|
5
|
+
* that should be filtered out when enriching emails.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Set of known disposable email domains (600+)
|
|
9
|
+
*/
|
|
10
|
+
export declare const DISPOSABLE_DOMAINS: Set<string>;
|
|
11
|
+
/**
|
|
12
|
+
* Check if an email is from a disposable domain
|
|
13
|
+
*
|
|
14
|
+
* @param email - Email address to check
|
|
15
|
+
* @returns true if the email is from a disposable domain
|
|
16
|
+
*/
|
|
17
|
+
export declare function isDisposableEmail(email: string): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Check if a domain is a disposable email domain
|
|
20
|
+
*
|
|
21
|
+
* @param domain - Domain to check
|
|
22
|
+
* @returns true if the domain is a disposable email domain
|
|
23
|
+
*/
|
|
24
|
+
export declare function isDisposableDomain(domain: string): boolean;
|