linkedin-secret-sauce 0.11.0 → 0.12.0
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/README.md +512 -232
- package/dist/cosiall-client.d.ts +40 -1
- package/dist/cosiall-client.js +142 -3
- package/dist/enrichment/auth/smartlead-auth.d.ts +3 -3
- package/dist/enrichment/auth/smartlead-auth.js +25 -25
- package/dist/enrichment/index.d.ts +6 -4
- package/dist/enrichment/index.js +25 -24
- package/dist/enrichment/matching.d.ts +8 -3
- package/dist/enrichment/matching.js +7 -5
- package/dist/enrichment/orchestrator.js +44 -14
- package/dist/enrichment/providers/construct.js +72 -14
- package/dist/enrichment/providers/hunter.js +6 -60
- package/dist/enrichment/providers/index.d.ts +0 -1
- package/dist/enrichment/providers/index.js +1 -3
- package/dist/enrichment/providers/ldd.js +5 -47
- package/dist/enrichment/providers/smartprospect.js +9 -14
- package/dist/enrichment/types.d.ts +23 -24
- package/dist/enrichment/types.js +22 -21
- package/dist/enrichment/utils/http-retry.d.ts +96 -0
- package/dist/enrichment/utils/http-retry.js +162 -0
- package/dist/enrichment/verification/index.d.ts +1 -1
- package/dist/enrichment/verification/index.js +3 -1
- package/dist/enrichment/verification/mx.d.ts +33 -0
- package/dist/enrichment/verification/mx.js +367 -7
- package/dist/index.d.ts +197 -6
- package/dist/index.js +159 -12
- package/dist/parsers/search-parser.js +7 -3
- package/dist/types.d.ts +29 -3
- package/dist/utils/metrics.d.ts +3 -0
- package/dist/utils/metrics.js +3 -0
- package/package.json +30 -22
package/dist/index.d.ts
CHANGED
|
@@ -1,18 +1,209 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LinkedIn Secret Sauce
|
|
3
|
+
*
|
|
4
|
+
* A complete LinkedIn Sales Navigator client + Email Enrichment library.
|
|
5
|
+
*
|
|
6
|
+
* ## Two Main Modules
|
|
7
|
+
*
|
|
8
|
+
* ### 1. LinkedIn API
|
|
9
|
+
* Server-side LinkedIn Sales Navigator client with automatic cookie management,
|
|
10
|
+
* retries, caching, and parsing.
|
|
11
|
+
*
|
|
12
|
+
* ```typescript
|
|
13
|
+
* import { initializeLinkedInClient, searchSalesLeads, getProfileByVanity } from 'linkedin-secret-sauce';
|
|
14
|
+
*
|
|
15
|
+
* initializeLinkedInClient({
|
|
16
|
+
* cosiallApiUrl: process.env.COSIALL_API_URL,
|
|
17
|
+
* cosiallApiKey: process.env.COSIALL_API_KEY,
|
|
18
|
+
* });
|
|
19
|
+
*
|
|
20
|
+
* const profile = await getProfileByVanity('john-doe');
|
|
21
|
+
* const leads = await searchSalesLeads('cto fintech', { count: 25 });
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* ### 2. Email Enrichment
|
|
25
|
+
* Find business emails using multiple providers with waterfall/parallel strategies.
|
|
26
|
+
*
|
|
27
|
+
* ```typescript
|
|
28
|
+
* import { createEnrichmentClient } from 'linkedin-secret-sauce';
|
|
29
|
+
*
|
|
30
|
+
* const enrichment = createEnrichmentClient({
|
|
31
|
+
* providers: {
|
|
32
|
+
* hunter: { apiKey: process.env.HUNTER_API_KEY },
|
|
33
|
+
* bouncer: { apiKey: process.env.BOUNCER_API_KEY },
|
|
34
|
+
* },
|
|
35
|
+
* });
|
|
36
|
+
*
|
|
37
|
+
* const result = await enrichment.enrich({
|
|
38
|
+
* firstName: 'John',
|
|
39
|
+
* lastName: 'Doe',
|
|
40
|
+
* domain: 'acme.com',
|
|
41
|
+
* });
|
|
42
|
+
* console.log(result.business_email); // john.doe@acme.com
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* @packageDocumentation
|
|
46
|
+
*/
|
|
1
47
|
export { initializeLinkedInClient, getConfig } from "./config";
|
|
2
48
|
export type { LinkedInClientConfig } from "./config";
|
|
49
|
+
export * from "./linkedin-api";
|
|
50
|
+
export * from "./types";
|
|
51
|
+
export type { LinkedInTenure, LinkedInPosition, LinkedInSpotlightBadge, SalesLeadSearchResult, } from "./types";
|
|
3
52
|
export { LinkedInClientError } from "./utils/errors";
|
|
4
53
|
export * from "./cosiall-client";
|
|
5
54
|
export * from "./cookie-pool";
|
|
55
|
+
export type { CosiallProfileEmailsResponse, ProfileEmailsLookupOptions, } from "./types";
|
|
6
56
|
export { parseFullProfile } from "./parsers/profile-parser";
|
|
7
57
|
export { parseSalesSearchResults } from "./parsers/search-parser";
|
|
8
|
-
export * from "./linkedin-api";
|
|
9
|
-
export * from "./types";
|
|
10
|
-
export type { LinkedInTenure, LinkedInPosition, LinkedInSpotlightBadge, SalesLeadSearchResult, } from "./types";
|
|
11
58
|
export * from "./utils/metrics";
|
|
12
59
|
export { getRequestHistory, clearRequestHistory, } from "./utils/request-history";
|
|
13
60
|
export type { RequestHistoryEntry } from "./utils/request-history";
|
|
14
61
|
export * from "./constants";
|
|
62
|
+
/**
|
|
63
|
+
* Create an enrichment client for finding business emails
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```typescript
|
|
67
|
+
* const enrichment = createEnrichmentClient({
|
|
68
|
+
* providers: {
|
|
69
|
+
* construct: {}, // FREE pattern matching
|
|
70
|
+
* hunter: { apiKey: 'xxx' },
|
|
71
|
+
* bouncer: { apiKey: 'xxx' },
|
|
72
|
+
* },
|
|
73
|
+
* onCost: (provider, cost) => console.log(`${provider}: $${cost}`),
|
|
74
|
+
* });
|
|
75
|
+
*
|
|
76
|
+
* const result = await enrichment.enrich({
|
|
77
|
+
* firstName: 'John',
|
|
78
|
+
* lastName: 'Doe',
|
|
79
|
+
* domain: 'acme.com',
|
|
80
|
+
* });
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
15
83
|
export { createEnrichmentClient } from "./enrichment";
|
|
16
|
-
export type {
|
|
17
|
-
|
|
18
|
-
|
|
84
|
+
export type {
|
|
85
|
+
/** Result returned by enrichment operations */
|
|
86
|
+
CanonicalEmail,
|
|
87
|
+
/** Input candidate for email lookup */
|
|
88
|
+
EnrichmentCandidate,
|
|
89
|
+
/** Raw provider result */
|
|
90
|
+
ProviderResult,
|
|
91
|
+
/** Provider function signature */
|
|
92
|
+
ProviderFunc,
|
|
93
|
+
/** Supported provider names */
|
|
94
|
+
ProviderName,
|
|
95
|
+
/** Full client configuration */
|
|
96
|
+
EnrichmentClientConfig,
|
|
97
|
+
/** Enrichment client interface */
|
|
98
|
+
EnrichmentClient,
|
|
99
|
+
/** Provider configuration map */
|
|
100
|
+
ProvidersConfig,
|
|
101
|
+
/** Enrichment options */
|
|
102
|
+
EnrichmentOptions,
|
|
103
|
+
/** Batch processing options */
|
|
104
|
+
BatchEnrichmentOptions,
|
|
105
|
+
/** Hunter.io configuration */
|
|
106
|
+
HunterConfig,
|
|
107
|
+
/** SmartProspect/SmartLead configuration */
|
|
108
|
+
SmartProspectConfig,
|
|
109
|
+
/** LinkedIn Data Dump configuration */
|
|
110
|
+
LddConfig,
|
|
111
|
+
/** Dropcontact configuration */
|
|
112
|
+
DropcontactConfig,
|
|
113
|
+
/** Construct provider configuration */
|
|
114
|
+
ConstructConfig,
|
|
115
|
+
/** Cache adapter interface */
|
|
116
|
+
CacheAdapter,
|
|
117
|
+
/** Cost tracking callback */
|
|
118
|
+
CostCallback,
|
|
119
|
+
/** Logger interface */
|
|
120
|
+
EnrichmentLogger,
|
|
121
|
+
/** Email verification result */
|
|
122
|
+
VerificationResult,
|
|
123
|
+
/** SmartProspect contact */
|
|
124
|
+
SmartProspectContact,
|
|
125
|
+
/** SmartProspect search filters */
|
|
126
|
+
SmartProspectSearchFilters,
|
|
127
|
+
/** LDD profile data */
|
|
128
|
+
LddProfileData,
|
|
129
|
+
/** LDD API response */
|
|
130
|
+
LddApiResponse, } from "./enrichment";
|
|
131
|
+
export {
|
|
132
|
+
/**
|
|
133
|
+
* Check if email is from a personal domain (Gmail, Yahoo, etc.)
|
|
134
|
+
* @example isPersonalEmail('john@gmail.com') // true
|
|
135
|
+
*/
|
|
136
|
+
isPersonalEmail,
|
|
137
|
+
/**
|
|
138
|
+
* Check if email is from a business domain
|
|
139
|
+
* @example isBusinessEmail('john@acme.com') // true
|
|
140
|
+
*/
|
|
141
|
+
isBusinessEmail,
|
|
142
|
+
/**
|
|
143
|
+
* Check if domain is a personal email provider
|
|
144
|
+
* @example isPersonalDomain('gmail.com') // true
|
|
145
|
+
*/
|
|
146
|
+
isPersonalDomain,
|
|
147
|
+
/**
|
|
148
|
+
* Check if email is from a disposable/temporary email service
|
|
149
|
+
* @example isDisposableEmail('test@mailinator.com') // true
|
|
150
|
+
*/
|
|
151
|
+
isDisposableEmail,
|
|
152
|
+
/**
|
|
153
|
+
* Check if domain is a disposable email provider
|
|
154
|
+
* @example isDisposableDomain('guerrillamail.com') // true
|
|
155
|
+
*/
|
|
156
|
+
isDisposableDomain,
|
|
157
|
+
/**
|
|
158
|
+
* Validate email syntax
|
|
159
|
+
* @example isValidEmailSyntax('john@example.com') // true
|
|
160
|
+
*/
|
|
161
|
+
isValidEmailSyntax,
|
|
162
|
+
/**
|
|
163
|
+
* Check if email is a role account (info@, support@, etc.)
|
|
164
|
+
* @example isRoleAccount('info@company.com') // true
|
|
165
|
+
*/
|
|
166
|
+
isRoleAccount,
|
|
167
|
+
/**
|
|
168
|
+
* Verify email via MX record lookup
|
|
169
|
+
*/
|
|
170
|
+
verifyEmailMx,
|
|
171
|
+
/** Set of known personal email domains */
|
|
172
|
+
PERSONAL_DOMAINS,
|
|
173
|
+
/** Set of known disposable email domains */
|
|
174
|
+
DISPOSABLE_DOMAINS,
|
|
175
|
+
/** Default provider execution order */
|
|
176
|
+
DEFAULT_PROVIDER_ORDER,
|
|
177
|
+
/** Cost per lookup by provider (USD) */
|
|
178
|
+
PROVIDER_COSTS, } from "./enrichment";
|
|
179
|
+
export {
|
|
180
|
+
/**
|
|
181
|
+
* Get JWT token for SmartLead API (cached, auto-refreshes)
|
|
182
|
+
* @example const token = await getSmartLeadToken({ credentials: { email, password } });
|
|
183
|
+
*/
|
|
184
|
+
getSmartLeadToken,
|
|
185
|
+
/**
|
|
186
|
+
* Get SmartLead user info from cached login
|
|
187
|
+
*/
|
|
188
|
+
getSmartLeadUser,
|
|
189
|
+
/**
|
|
190
|
+
* Clear cached token for an email (e.g., on 401 error)
|
|
191
|
+
*/
|
|
192
|
+
clearSmartLeadToken,
|
|
193
|
+
/**
|
|
194
|
+
* Clear all cached SmartLead tokens
|
|
195
|
+
*/
|
|
196
|
+
clearAllSmartLeadTokens,
|
|
197
|
+
/**
|
|
198
|
+
* Get token cache statistics for debugging
|
|
199
|
+
*/
|
|
200
|
+
getSmartLeadTokenCacheStats, } from "./enrichment";
|
|
201
|
+
export type {
|
|
202
|
+
/** SmartLead login credentials */
|
|
203
|
+
SmartLeadCredentials,
|
|
204
|
+
/** SmartLead authentication configuration */
|
|
205
|
+
SmartLeadAuthConfig,
|
|
206
|
+
/** SmartLead user info */
|
|
207
|
+
SmartLeadUser,
|
|
208
|
+
/** SmartLead login response */
|
|
209
|
+
SmartLeadLoginResponse, } from "./enrichment";
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,50 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* LinkedIn Secret Sauce
|
|
4
|
+
*
|
|
5
|
+
* A complete LinkedIn Sales Navigator client + Email Enrichment library.
|
|
6
|
+
*
|
|
7
|
+
* ## Two Main Modules
|
|
8
|
+
*
|
|
9
|
+
* ### 1. LinkedIn API
|
|
10
|
+
* Server-side LinkedIn Sales Navigator client with automatic cookie management,
|
|
11
|
+
* retries, caching, and parsing.
|
|
12
|
+
*
|
|
13
|
+
* ```typescript
|
|
14
|
+
* import { initializeLinkedInClient, searchSalesLeads, getProfileByVanity } from 'linkedin-secret-sauce';
|
|
15
|
+
*
|
|
16
|
+
* initializeLinkedInClient({
|
|
17
|
+
* cosiallApiUrl: process.env.COSIALL_API_URL,
|
|
18
|
+
* cosiallApiKey: process.env.COSIALL_API_KEY,
|
|
19
|
+
* });
|
|
20
|
+
*
|
|
21
|
+
* const profile = await getProfileByVanity('john-doe');
|
|
22
|
+
* const leads = await searchSalesLeads('cto fintech', { count: 25 });
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* ### 2. Email Enrichment
|
|
26
|
+
* Find business emails using multiple providers with waterfall/parallel strategies.
|
|
27
|
+
*
|
|
28
|
+
* ```typescript
|
|
29
|
+
* import { createEnrichmentClient } from 'linkedin-secret-sauce';
|
|
30
|
+
*
|
|
31
|
+
* const enrichment = createEnrichmentClient({
|
|
32
|
+
* providers: {
|
|
33
|
+
* hunter: { apiKey: process.env.HUNTER_API_KEY },
|
|
34
|
+
* bouncer: { apiKey: process.env.BOUNCER_API_KEY },
|
|
35
|
+
* },
|
|
36
|
+
* });
|
|
37
|
+
*
|
|
38
|
+
* const result = await enrichment.enrich({
|
|
39
|
+
* firstName: 'John',
|
|
40
|
+
* lastName: 'Doe',
|
|
41
|
+
* domain: 'acme.com',
|
|
42
|
+
* });
|
|
43
|
+
* console.log(result.business_email); // john.doe@acme.com
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* @packageDocumentation
|
|
47
|
+
*/
|
|
2
48
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
49
|
if (k2 === undefined) k2 = k;
|
|
4
50
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -15,46 +61,147 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
61
|
};
|
|
16
62
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
63
|
exports.getSmartLeadTokenCacheStats = exports.clearAllSmartLeadTokens = exports.clearSmartLeadToken = exports.getSmartLeadUser = exports.getSmartLeadToken = exports.PROVIDER_COSTS = exports.DEFAULT_PROVIDER_ORDER = exports.DISPOSABLE_DOMAINS = exports.PERSONAL_DOMAINS = exports.verifyEmailMx = exports.isRoleAccount = exports.isValidEmailSyntax = exports.isDisposableDomain = exports.isDisposableEmail = exports.isPersonalDomain = exports.isBusinessEmail = exports.isPersonalEmail = exports.createEnrichmentClient = exports.clearRequestHistory = exports.getRequestHistory = exports.parseSalesSearchResults = exports.parseFullProfile = exports.LinkedInClientError = exports.getConfig = exports.initializeLinkedInClient = void 0;
|
|
64
|
+
// =============================================================================
|
|
65
|
+
// LinkedIn API - Configuration
|
|
66
|
+
// =============================================================================
|
|
18
67
|
var config_1 = require("./config");
|
|
19
68
|
Object.defineProperty(exports, "initializeLinkedInClient", { enumerable: true, get: function () { return config_1.initializeLinkedInClient; } });
|
|
20
69
|
Object.defineProperty(exports, "getConfig", { enumerable: true, get: function () { return config_1.getConfig; } });
|
|
70
|
+
// =============================================================================
|
|
71
|
+
// LinkedIn API - Core Functions
|
|
72
|
+
// =============================================================================
|
|
73
|
+
__exportStar(require("./linkedin-api"), exports);
|
|
74
|
+
// =============================================================================
|
|
75
|
+
// LinkedIn API - Types
|
|
76
|
+
// =============================================================================
|
|
77
|
+
__exportStar(require("./types"), exports);
|
|
78
|
+
// =============================================================================
|
|
79
|
+
// LinkedIn API - Errors
|
|
80
|
+
// =============================================================================
|
|
21
81
|
var errors_1 = require("./utils/errors");
|
|
22
82
|
Object.defineProperty(exports, "LinkedInClientError", { enumerable: true, get: function () { return errors_1.LinkedInClientError; } });
|
|
83
|
+
// =============================================================================
|
|
84
|
+
// LinkedIn API - Cookie Management
|
|
85
|
+
// =============================================================================
|
|
23
86
|
__exportStar(require("./cosiall-client"), exports);
|
|
24
87
|
__exportStar(require("./cookie-pool"), exports);
|
|
88
|
+
// =============================================================================
|
|
89
|
+
// LinkedIn API - Parsers
|
|
90
|
+
// =============================================================================
|
|
25
91
|
var profile_parser_1 = require("./parsers/profile-parser");
|
|
26
92
|
Object.defineProperty(exports, "parseFullProfile", { enumerable: true, get: function () { return profile_parser_1.parseFullProfile; } });
|
|
27
93
|
var search_parser_1 = require("./parsers/search-parser");
|
|
28
94
|
Object.defineProperty(exports, "parseSalesSearchResults", { enumerable: true, get: function () { return search_parser_1.parseSalesSearchResults; } });
|
|
29
|
-
|
|
30
|
-
|
|
95
|
+
// =============================================================================
|
|
96
|
+
// LinkedIn API - Metrics & Monitoring
|
|
97
|
+
// =============================================================================
|
|
31
98
|
__exportStar(require("./utils/metrics"), exports);
|
|
32
99
|
var request_history_1 = require("./utils/request-history");
|
|
33
100
|
Object.defineProperty(exports, "getRequestHistory", { enumerable: true, get: function () { return request_history_1.getRequestHistory; } });
|
|
34
101
|
Object.defineProperty(exports, "clearRequestHistory", { enumerable: true, get: function () { return request_history_1.clearRequestHistory; } });
|
|
102
|
+
// =============================================================================
|
|
103
|
+
// LinkedIn API - Constants
|
|
104
|
+
// =============================================================================
|
|
35
105
|
__exportStar(require("./constants"), exports);
|
|
36
|
-
//
|
|
106
|
+
// =============================================================================
|
|
107
|
+
// Email Enrichment - Client
|
|
108
|
+
// =============================================================================
|
|
109
|
+
/**
|
|
110
|
+
* Create an enrichment client for finding business emails
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* ```typescript
|
|
114
|
+
* const enrichment = createEnrichmentClient({
|
|
115
|
+
* providers: {
|
|
116
|
+
* construct: {}, // FREE pattern matching
|
|
117
|
+
* hunter: { apiKey: 'xxx' },
|
|
118
|
+
* bouncer: { apiKey: 'xxx' },
|
|
119
|
+
* },
|
|
120
|
+
* onCost: (provider, cost) => console.log(`${provider}: $${cost}`),
|
|
121
|
+
* });
|
|
122
|
+
*
|
|
123
|
+
* const result = await enrichment.enrich({
|
|
124
|
+
* firstName: 'John',
|
|
125
|
+
* lastName: 'Doe',
|
|
126
|
+
* domain: 'acme.com',
|
|
127
|
+
* });
|
|
128
|
+
* ```
|
|
129
|
+
*/
|
|
37
130
|
var enrichment_1 = require("./enrichment");
|
|
38
131
|
Object.defineProperty(exports, "createEnrichmentClient", { enumerable: true, get: function () { return enrichment_1.createEnrichmentClient; } });
|
|
132
|
+
// =============================================================================
|
|
133
|
+
// Email Enrichment - Utilities
|
|
134
|
+
// =============================================================================
|
|
39
135
|
var enrichment_2 = require("./enrichment");
|
|
40
|
-
|
|
136
|
+
/**
|
|
137
|
+
* Check if email is from a personal domain (Gmail, Yahoo, etc.)
|
|
138
|
+
* @example isPersonalEmail('john@gmail.com') // true
|
|
139
|
+
*/
|
|
41
140
|
Object.defineProperty(exports, "isPersonalEmail", { enumerable: true, get: function () { return enrichment_2.isPersonalEmail; } });
|
|
141
|
+
/**
|
|
142
|
+
* Check if email is from a business domain
|
|
143
|
+
* @example isBusinessEmail('john@acme.com') // true
|
|
144
|
+
*/
|
|
42
145
|
Object.defineProperty(exports, "isBusinessEmail", { enumerable: true, get: function () { return enrichment_2.isBusinessEmail; } });
|
|
146
|
+
/**
|
|
147
|
+
* Check if domain is a personal email provider
|
|
148
|
+
* @example isPersonalDomain('gmail.com') // true
|
|
149
|
+
*/
|
|
43
150
|
Object.defineProperty(exports, "isPersonalDomain", { enumerable: true, get: function () { return enrichment_2.isPersonalDomain; } });
|
|
151
|
+
/**
|
|
152
|
+
* Check if email is from a disposable/temporary email service
|
|
153
|
+
* @example isDisposableEmail('test@mailinator.com') // true
|
|
154
|
+
*/
|
|
44
155
|
Object.defineProperty(exports, "isDisposableEmail", { enumerable: true, get: function () { return enrichment_2.isDisposableEmail; } });
|
|
156
|
+
/**
|
|
157
|
+
* Check if domain is a disposable email provider
|
|
158
|
+
* @example isDisposableDomain('guerrillamail.com') // true
|
|
159
|
+
*/
|
|
45
160
|
Object.defineProperty(exports, "isDisposableDomain", { enumerable: true, get: function () { return enrichment_2.isDisposableDomain; } });
|
|
161
|
+
/**
|
|
162
|
+
* Validate email syntax
|
|
163
|
+
* @example isValidEmailSyntax('john@example.com') // true
|
|
164
|
+
*/
|
|
46
165
|
Object.defineProperty(exports, "isValidEmailSyntax", { enumerable: true, get: function () { return enrichment_2.isValidEmailSyntax; } });
|
|
166
|
+
/**
|
|
167
|
+
* Check if email is a role account (info@, support@, etc.)
|
|
168
|
+
* @example isRoleAccount('info@company.com') // true
|
|
169
|
+
*/
|
|
47
170
|
Object.defineProperty(exports, "isRoleAccount", { enumerable: true, get: function () { return enrichment_2.isRoleAccount; } });
|
|
48
|
-
|
|
171
|
+
/**
|
|
172
|
+
* Verify email via MX record lookup
|
|
173
|
+
*/
|
|
49
174
|
Object.defineProperty(exports, "verifyEmailMx", { enumerable: true, get: function () { return enrichment_2.verifyEmailMx; } });
|
|
50
|
-
|
|
175
|
+
/** Set of known personal email domains */
|
|
51
176
|
Object.defineProperty(exports, "PERSONAL_DOMAINS", { enumerable: true, get: function () { return enrichment_2.PERSONAL_DOMAINS; } });
|
|
177
|
+
/** Set of known disposable email domains */
|
|
52
178
|
Object.defineProperty(exports, "DISPOSABLE_DOMAINS", { enumerable: true, get: function () { return enrichment_2.DISPOSABLE_DOMAINS; } });
|
|
179
|
+
/** Default provider execution order */
|
|
53
180
|
Object.defineProperty(exports, "DEFAULT_PROVIDER_ORDER", { enumerable: true, get: function () { return enrichment_2.DEFAULT_PROVIDER_ORDER; } });
|
|
181
|
+
/** Cost per lookup by provider (USD) */
|
|
54
182
|
Object.defineProperty(exports, "PROVIDER_COSTS", { enumerable: true, get: function () { return enrichment_2.PROVIDER_COSTS; } });
|
|
55
|
-
//
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
183
|
+
// =============================================================================
|
|
184
|
+
// Email Enrichment - SmartLead Authentication
|
|
185
|
+
// =============================================================================
|
|
186
|
+
var enrichment_3 = require("./enrichment");
|
|
187
|
+
/**
|
|
188
|
+
* Get JWT token for SmartLead API (cached, auto-refreshes)
|
|
189
|
+
* @example const token = await getSmartLeadToken({ credentials: { email, password } });
|
|
190
|
+
*/
|
|
191
|
+
Object.defineProperty(exports, "getSmartLeadToken", { enumerable: true, get: function () { return enrichment_3.getSmartLeadToken; } });
|
|
192
|
+
/**
|
|
193
|
+
* Get SmartLead user info from cached login
|
|
194
|
+
*/
|
|
195
|
+
Object.defineProperty(exports, "getSmartLeadUser", { enumerable: true, get: function () { return enrichment_3.getSmartLeadUser; } });
|
|
196
|
+
/**
|
|
197
|
+
* Clear cached token for an email (e.g., on 401 error)
|
|
198
|
+
*/
|
|
199
|
+
Object.defineProperty(exports, "clearSmartLeadToken", { enumerable: true, get: function () { return enrichment_3.clearSmartLeadToken; } });
|
|
200
|
+
/**
|
|
201
|
+
* Clear all cached SmartLead tokens
|
|
202
|
+
*/
|
|
203
|
+
Object.defineProperty(exports, "clearAllSmartLeadTokens", { enumerable: true, get: function () { return enrichment_3.clearAllSmartLeadTokens; } });
|
|
204
|
+
/**
|
|
205
|
+
* Get token cache statistics for debugging
|
|
206
|
+
*/
|
|
207
|
+
Object.defineProperty(exports, "getSmartLeadTokenCacheStats", { enumerable: true, get: function () { return enrichment_3.getSmartLeadTokenCacheStats; } });
|
|
@@ -9,10 +9,14 @@ function parseSalesSearchResults(rawResponse) {
|
|
|
9
9
|
: [];
|
|
10
10
|
const results = [];
|
|
11
11
|
for (const el of elements) {
|
|
12
|
-
const
|
|
13
|
-
|
|
12
|
+
const firstName = (0, json_sanitizer_1.sanitizeForJson)(el?.firstName) || undefined;
|
|
13
|
+
const lastName = (0, json_sanitizer_1.sanitizeForJson)(el?.lastName) || undefined;
|
|
14
|
+
const fullName = [firstName, lastName].filter(Boolean).join(" ").trim() || undefined;
|
|
14
15
|
const res = {
|
|
15
|
-
|
|
16
|
+
firstName,
|
|
17
|
+
lastName,
|
|
18
|
+
fullName,
|
|
19
|
+
name: fullName, // Backward compatible
|
|
16
20
|
headline: (0, json_sanitizer_1.sanitizeForJson)((el?.summary || "").split("\n")[0]?.slice(0, 180)),
|
|
17
21
|
salesProfileUrn: el?.entityUrn,
|
|
18
22
|
objectUrn: el?.objectUrn,
|
package/dist/types.d.ts
CHANGED
|
@@ -1,3 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Response from the Cosiall Profile Emails API endpoint.
|
|
3
|
+
* Returns email addresses associated with a LinkedIn profile.
|
|
4
|
+
*/
|
|
5
|
+
export interface CosiallProfileEmailsResponse {
|
|
6
|
+
/** Cosiall internal profile ID */
|
|
7
|
+
profileId: number;
|
|
8
|
+
/** LinkedIn ObjectURN identifier (e.g., "urn:li:fsd_profile:ACoAABcdEfG") */
|
|
9
|
+
objectUrn: string;
|
|
10
|
+
/** LinkedIn profile URL */
|
|
11
|
+
linkedInUrl: string;
|
|
12
|
+
/** List of email addresses associated with the profile (may be empty) */
|
|
13
|
+
emails: string[];
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Options for looking up profile emails from Cosiall.
|
|
17
|
+
* At least one of objectUrn, linkedInUrl, or vanity must be provided.
|
|
18
|
+
*/
|
|
19
|
+
export interface ProfileEmailsLookupOptions {
|
|
20
|
+
/** LinkedIn ObjectURN identifier (most precise lookup method) */
|
|
21
|
+
objectUrn?: string;
|
|
22
|
+
/** Full LinkedIn profile URL (e.g., "https://www.linkedin.com/in/john-doe/") */
|
|
23
|
+
linkedInUrl?: string;
|
|
24
|
+
/** LinkedIn username/vanity name (e.g., "john-doe") */
|
|
25
|
+
vanity?: string;
|
|
26
|
+
}
|
|
1
27
|
export interface LinkedInCookie {
|
|
2
28
|
name: string;
|
|
3
29
|
value: string;
|
|
@@ -6,7 +32,7 @@ export interface LinkedInCookie {
|
|
|
6
32
|
expires?: number;
|
|
7
33
|
httpOnly?: boolean;
|
|
8
34
|
secure?: boolean;
|
|
9
|
-
sameSite?:
|
|
35
|
+
sameSite?: "Strict" | "Lax" | "None";
|
|
10
36
|
}
|
|
11
37
|
export interface AccountCookies {
|
|
12
38
|
accountId: string;
|
|
@@ -184,7 +210,7 @@ export interface Company {
|
|
|
184
210
|
specialties?: string[];
|
|
185
211
|
emailDomains?: string[];
|
|
186
212
|
}
|
|
187
|
-
export type TypeaheadType =
|
|
213
|
+
export type TypeaheadType = "BING_GEO" | "TITLE" | "INDUSTRY" | "SENIORITY_LEVEL" | "FUNCTION" | "COMPANY_SIZE" | "COMPANY" | "PROFILE_LANGUAGE";
|
|
188
214
|
export interface TypeaheadItem {
|
|
189
215
|
id: string;
|
|
190
216
|
text: string;
|
|
@@ -208,7 +234,7 @@ export interface SalesNavigatorProfile {
|
|
|
208
234
|
flagshipProfileUrl?: string;
|
|
209
235
|
}
|
|
210
236
|
export type Geo = {
|
|
211
|
-
type:
|
|
237
|
+
type: "region" | "country" | "state" | "city" | "postal";
|
|
212
238
|
value: string;
|
|
213
239
|
id?: string;
|
|
214
240
|
};
|
package/dist/utils/metrics.d.ts
CHANGED
|
@@ -15,6 +15,9 @@ export interface Metrics {
|
|
|
15
15
|
cosiallFetches: number;
|
|
16
16
|
cosiallSuccess: number;
|
|
17
17
|
cosiallFailures: number;
|
|
18
|
+
cosiallProfileEmailsFetches: number;
|
|
19
|
+
cosiallProfileEmailsSuccess: number;
|
|
20
|
+
cosiallProfileEmailsFailures: number;
|
|
18
21
|
companyFetches: number;
|
|
19
22
|
typeaheadRequests: number;
|
|
20
23
|
}
|
package/dist/utils/metrics.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "linkedin-secret-sauce",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "Private LinkedIn Sales Navigator client with automatic cookie management",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -10,6 +10,30 @@
|
|
|
10
10
|
"publishConfig": {
|
|
11
11
|
"registry": "https://registry.npmjs.org/"
|
|
12
12
|
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"dev:playground": "pnpm -C apps/playground dev",
|
|
15
|
+
"search": "node scripts/rg-fast.mjs",
|
|
16
|
+
"rg:fast": "node scripts/rg-fast.mjs",
|
|
17
|
+
"build": "tsc -p tsconfig.json",
|
|
18
|
+
"typecheck": "tsc --noEmit",
|
|
19
|
+
"typecheck:playground": "pnpm -C apps/playground typecheck",
|
|
20
|
+
"typecheck:all": "pnpm typecheck && pnpm typecheck:playground",
|
|
21
|
+
"lint": "eslint \"src/**/*.ts\" --max-warnings=0",
|
|
22
|
+
"lint:playground": "eslint \"apps/playground/src/**/*.{ts,tsx}\" \"apps/playground/server/**/*.ts\" --max-warnings=0",
|
|
23
|
+
"lint:all": "eslint \"src/**/*.ts\" \"apps/playground/src/**/*.{ts,tsx}\" \"apps/playground/server/**/*.ts\" --max-warnings=0",
|
|
24
|
+
"lint:fix": "eslint \"src/**/*.ts\" \"apps/playground/src/**/*.{ts,tsx}\" \"apps/playground/server/**/*.ts\" --fix",
|
|
25
|
+
"check": "pnpm typecheck:all && pnpm lint:all",
|
|
26
|
+
"dev": "pnpm dev:playground",
|
|
27
|
+
"dev:watch": "tsc -w -p tsconfig.json",
|
|
28
|
+
"test": "vitest run",
|
|
29
|
+
"docs": "typedoc",
|
|
30
|
+
"docs:netlify": "rm -rf docs/api && typedoc && echo 'Build complete'",
|
|
31
|
+
"docs:watch": "typedoc --watch",
|
|
32
|
+
"prepublishOnly": "npm run build",
|
|
33
|
+
"release:patch": "npm version patch && git push --follow-tags",
|
|
34
|
+
"release:minor": "npm version minor && git push --follow-tags",
|
|
35
|
+
"release:major": "npm version major && git push --follow-tags"
|
|
36
|
+
},
|
|
13
37
|
"keywords": [
|
|
14
38
|
"linkedin",
|
|
15
39
|
"sales-navigator",
|
|
@@ -28,35 +52,19 @@
|
|
|
28
52
|
"bugs": {
|
|
29
53
|
"url": "https://github.com/enerage/LinkedInSecretSauce/issues"
|
|
30
54
|
},
|
|
31
|
-
"homepage": "https://github.
|
|
55
|
+
"homepage": "https://enerage.github.io/LinkedInSecretSauce/",
|
|
32
56
|
"devDependencies": {
|
|
33
57
|
"@commitlint/cli": "^19.4.0",
|
|
34
58
|
"@commitlint/config-conventional": "^19.4.0",
|
|
35
59
|
"@types/node": "^20.11.0",
|
|
36
60
|
"@typescript-eslint/eslint-plugin": "^8.9.0",
|
|
37
61
|
"@typescript-eslint/parser": "^8.9.0",
|
|
62
|
+
"concurrently": "^9.2.1",
|
|
38
63
|
"eslint": "^9.12.0",
|
|
39
64
|
"husky": "^9.0.11",
|
|
65
|
+
"typedoc": "^0.28.15",
|
|
66
|
+
"typedoc-plugin-markdown": "^4.9.0",
|
|
40
67
|
"typescript": "^5.9.3",
|
|
41
68
|
"vitest": "^1.6.0"
|
|
42
|
-
},
|
|
43
|
-
"scripts": {
|
|
44
|
-
"dev:playground": "pnpm -C apps/playground dev",
|
|
45
|
-
"search": "node scripts/rg-fast.mjs",
|
|
46
|
-
"rg:fast": "node scripts/rg-fast.mjs",
|
|
47
|
-
"build": "tsc -p tsconfig.json",
|
|
48
|
-
"typecheck": "tsc --noEmit",
|
|
49
|
-
"typecheck:playground": "pnpm -C apps/playground typecheck",
|
|
50
|
-
"typecheck:all": "pnpm typecheck && pnpm typecheck:playground",
|
|
51
|
-
"lint": "eslint \"src/**/*.ts\" --max-warnings=0",
|
|
52
|
-
"lint:playground": "eslint \"apps/playground/src/**/*.{ts,tsx}\" \"apps/playground/server/**/*.ts\" --max-warnings=0",
|
|
53
|
-
"lint:all": "eslint \"src/**/*.ts\" \"apps/playground/src/**/*.{ts,tsx}\" \"apps/playground/server/**/*.ts\" --max-warnings=0",
|
|
54
|
-
"lint:fix": "eslint \"src/**/*.ts\" \"apps/playground/src/**/*.{ts,tsx}\" \"apps/playground/server/**/*.ts\" --fix",
|
|
55
|
-
"check": "pnpm typecheck:all && pnpm lint:all",
|
|
56
|
-
"dev": "tsc -w -p tsconfig.json",
|
|
57
|
-
"test": "vitest run",
|
|
58
|
-
"release:patch": "npm version patch && git push --follow-tags",
|
|
59
|
-
"release:minor": "npm version minor && git push --follow-tags",
|
|
60
|
-
"release:major": "npm version major && git push --follow-tags"
|
|
61
69
|
}
|
|
62
|
-
}
|
|
70
|
+
}
|