linkedin-secret-sauce 0.3.24 → 0.3.26
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/linkedin-api.js +50 -6
- package/dist/types.d.ts +5 -0
- package/package.json +1 -1
package/dist/linkedin-api.js
CHANGED
|
@@ -1,4 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.COMPANY_SIZE_OPTIONS = exports.INDUSTRY_OPTIONS = exports.LANGUAGE_OPTIONS = exports.REGION_OPTIONS = exports.FUNCTION_OPTIONS = exports.SENIORITY_OPTIONS = exports.YEARS_OF_EXPERIENCE_OPTIONS = exports.YEARS_IN_POSITION_OPTIONS = exports.YEARS_AT_COMPANY_OPTIONS = void 0;
|
|
4
37
|
exports.getProfileByVanity = getProfileByVanity;
|
|
@@ -212,9 +245,11 @@ async function searchSalesLeads(keywords, options) {
|
|
|
212
245
|
const start = Number.isFinite(options?.start) ? Number(options.start) : 0;
|
|
213
246
|
const count = Number.isFinite(options?.count) ? Number(options.count) : 25;
|
|
214
247
|
const deco = options?.decorationId || 'com.linkedin.sales.deco.desktop.searchv2.LeadSearchResult-14';
|
|
248
|
+
// Generate or use provided sessionId
|
|
249
|
+
const sessionId = options?.sessionId || (await Promise.resolve().then(() => __importStar(require('crypto')))).randomUUID();
|
|
215
250
|
const sig = (0, search_encoder_1.buildFilterSignature)(options?.filters, options?.rawQuery);
|
|
216
251
|
// Phase 2.1: Include sessionId in cache key for session-specific caching
|
|
217
|
-
const cacheKey = JSON.stringify({ k: String(keywords || '').toLowerCase(), start, count, deco, sig, sessionId
|
|
252
|
+
const cacheKey = JSON.stringify({ k: String(keywords || '').toLowerCase(), start, count, deco, sig, sessionId });
|
|
218
253
|
const cached = getCached(searchCache, cacheKey, cfg.searchCacheTtl);
|
|
219
254
|
if (cached) {
|
|
220
255
|
(0, metrics_1.incrementMetric)('searchCacheHits');
|
|
@@ -230,16 +265,16 @@ async function searchSalesLeads(keywords, options) {
|
|
|
230
265
|
async function doRequest(decorationId) {
|
|
231
266
|
const url = `${SALES_NAV_BASE}/salesApiLeadSearch?q=searchQuery&start=${start}&count=${count}&decorationId=${encodeURIComponent(decorationId)}&query=${queryStruct}`;
|
|
232
267
|
try {
|
|
233
|
-
(0, logger_1.log)('info', 'api.start', { operation: 'searchSalesLeads', selector: { keywords, start, count, deco: decorationId, sessionId
|
|
268
|
+
(0, logger_1.log)('info', 'api.start', { operation: 'searchSalesLeads', selector: { keywords, start, count, deco: decorationId, sessionId } });
|
|
234
269
|
}
|
|
235
270
|
catch { }
|
|
236
271
|
const out = await (0, http_client_1.executeLinkedInRequest)({
|
|
237
272
|
url,
|
|
238
273
|
headers: { Referer: 'https://www.linkedin.com/sales/search/people' },
|
|
239
|
-
sessionId
|
|
274
|
+
sessionId, // Phase 2.1: Pass sessionId for account stickiness
|
|
240
275
|
}, 'searchSalesLeads');
|
|
241
276
|
try {
|
|
242
|
-
(0, logger_1.log)('info', 'api.ok', { operation: 'searchSalesLeads', selector: { keywords, start, count, deco: decorationId, sessionId
|
|
277
|
+
(0, logger_1.log)('info', 'api.ok', { operation: 'searchSalesLeads', selector: { keywords, start, count, deco: decorationId, sessionId } });
|
|
243
278
|
}
|
|
244
279
|
catch { }
|
|
245
280
|
return out;
|
|
@@ -254,11 +289,20 @@ async function searchSalesLeads(keywords, options) {
|
|
|
254
289
|
// Extract metadata.totalDisplayCount (LinkedIn's display string like "500K+")
|
|
255
290
|
const metadataVal = rrec && 'metadata' in rrec ? rrec.metadata : undefined;
|
|
256
291
|
const metadata = (metadataVal && typeof metadataVal === 'object') ? metadataVal : undefined;
|
|
292
|
+
// Calculate hasMore: if we got a full page of results, there may be more
|
|
293
|
+
// This is more reliable than relying on total, which is often undefined
|
|
294
|
+
const hasMore = items.length === count;
|
|
257
295
|
const result = options
|
|
258
296
|
? {
|
|
259
297
|
items,
|
|
260
|
-
page: {
|
|
261
|
-
|
|
298
|
+
page: {
|
|
299
|
+
start: Number(paging.start ?? start),
|
|
300
|
+
count: Number(paging.count ?? count),
|
|
301
|
+
total: paging?.total,
|
|
302
|
+
hasMore
|
|
303
|
+
},
|
|
304
|
+
metadata: metadata?.totalDisplayCount ? { totalDisplayCount: metadata.totalDisplayCount } : undefined,
|
|
305
|
+
_meta: { sessionId } // Return sessionId to consumer
|
|
262
306
|
}
|
|
263
307
|
: items; // backward-compat: old tests expect an array when no options passed
|
|
264
308
|
searchCache.set(cacheKey, { data: result, ts: Date.now() });
|
package/dist/types.d.ts
CHANGED
|
@@ -153,10 +153,15 @@ export interface SearchSalesResult {
|
|
|
153
153
|
start: number;
|
|
154
154
|
count: number;
|
|
155
155
|
total?: number;
|
|
156
|
+
hasMore?: boolean;
|
|
156
157
|
};
|
|
157
158
|
metadata?: {
|
|
158
159
|
totalDisplayCount?: string;
|
|
159
160
|
};
|
|
161
|
+
_meta?: {
|
|
162
|
+
sessionId?: string;
|
|
163
|
+
accountId?: string;
|
|
164
|
+
};
|
|
160
165
|
}
|
|
161
166
|
export interface Company {
|
|
162
167
|
companyId: string;
|