linkedin-secret-sauce 0.3.21 → 0.3.23
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/types.d.ts +4 -16
- package/dist/utils/search-encoder.js +25 -32
- package/package.json +1 -1
package/dist/types.d.ts
CHANGED
|
@@ -207,24 +207,12 @@ export type Geo = {
|
|
|
207
207
|
export type SalesSearchFilters = {
|
|
208
208
|
company?: {
|
|
209
209
|
current?: {
|
|
210
|
-
include?: (string |
|
|
211
|
-
|
|
212
|
-
text?: string;
|
|
213
|
-
})[];
|
|
214
|
-
exclude?: (string | {
|
|
215
|
-
id?: string | number;
|
|
216
|
-
text?: string;
|
|
217
|
-
})[];
|
|
210
|
+
include?: (string | number)[];
|
|
211
|
+
exclude?: (string | number)[];
|
|
218
212
|
};
|
|
219
213
|
past?: {
|
|
220
|
-
include?: (string |
|
|
221
|
-
|
|
222
|
-
text?: string;
|
|
223
|
-
})[];
|
|
224
|
-
exclude?: (string | {
|
|
225
|
-
id?: string | number;
|
|
226
|
-
text?: string;
|
|
227
|
-
})[];
|
|
214
|
+
include?: (string | number)[];
|
|
215
|
+
exclude?: (string | number)[];
|
|
228
216
|
};
|
|
229
217
|
headcount?: {
|
|
230
218
|
include?: ("1-10" | "11-50" | "51-200" | "201-500" | "501-1000" | "1001-5000" | "5001-10000" | "10000+")[];
|
|
@@ -117,43 +117,25 @@ function buildLeadSearchQuery(keywords, filters) {
|
|
|
117
117
|
});
|
|
118
118
|
pushFilter(f, 'COMPANY_HEADCOUNT', values);
|
|
119
119
|
}
|
|
120
|
-
// CURRENT_COMPANY — accept org URN (urn:li:organization:ID)
|
|
120
|
+
// CURRENT_COMPANY — accept org URN (urn:li:organization:ID) or numeric ID (auto-converted to URN)
|
|
121
121
|
function encodeCompanies(arr) {
|
|
122
122
|
if (!arr || !arr.length)
|
|
123
123
|
return [];
|
|
124
124
|
return arr.map((c) => {
|
|
125
|
-
const
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}
|
|
134
|
-
else {
|
|
135
|
-
parts.push(`id:${idStr}`);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
if (c.text) {
|
|
139
|
-
parts.push(`text:${encText(c.text)}`);
|
|
140
|
-
}
|
|
125
|
+
const idStr = String(c);
|
|
126
|
+
let urn;
|
|
127
|
+
// If already a URN, use as-is; otherwise convert numeric ID to URN
|
|
128
|
+
if (/^urn:li:organization:\d+$/i.test(idStr)) {
|
|
129
|
+
urn = idStr;
|
|
130
|
+
}
|
|
131
|
+
else if (/^\d+$/.test(idStr)) {
|
|
132
|
+
urn = `urn:li:organization:${idStr}`;
|
|
141
133
|
}
|
|
142
134
|
else {
|
|
143
|
-
//
|
|
144
|
-
|
|
145
|
-
if (/^urn:li:organization:\d+$/i.test(s)) {
|
|
146
|
-
parts.push(`id:${s}`);
|
|
147
|
-
}
|
|
148
|
-
else if (/^\d+$/.test(s)) {
|
|
149
|
-
parts.push(`id:urn:li:organization:${s}`);
|
|
150
|
-
}
|
|
151
|
-
else {
|
|
152
|
-
parts.push(`text:${encText(s)}`);
|
|
153
|
-
}
|
|
135
|
+
// If not URN or numeric, assume it's already a URN (pass through)
|
|
136
|
+
urn = idStr;
|
|
154
137
|
}
|
|
155
|
-
|
|
156
|
-
return valObj(parts);
|
|
138
|
+
return valObj([`id:${encodeURIComponent(urn)}`, 'selectionType:INCLUDED']);
|
|
157
139
|
});
|
|
158
140
|
}
|
|
159
141
|
const curCompanies = encodeCompanies(filters?.company?.current?.include);
|
|
@@ -189,6 +171,17 @@ function buildLeadSearchQuery(keywords, filters) {
|
|
|
189
171
|
if (yr?.years_experience_ids?.length) {
|
|
190
172
|
pushFilter(f, 'YEARS_OF_EXPERIENCE', yr.years_experience_ids.map((id) => valObj([`id:${id}`, 'selectionType:INCLUDED'])));
|
|
191
173
|
}
|
|
192
|
-
|
|
193
|
-
|
|
174
|
+
// Build query with minimal format for maximum compatibility
|
|
175
|
+
// LinkedIn rejects spellCorrectionEnabled:true,keywords: with 400 errors
|
|
176
|
+
const parts = [];
|
|
177
|
+
// Only include keywords if non-empty
|
|
178
|
+
if (encodedKw) {
|
|
179
|
+
parts.push(`keywords:${encodedKw}`);
|
|
180
|
+
}
|
|
181
|
+
// Add filters if present
|
|
182
|
+
if (f.length) {
|
|
183
|
+
parts.push(`filters:${list(f)}`);
|
|
184
|
+
}
|
|
185
|
+
// Return minimal format - no spellCorrectionEnabled wrapper
|
|
186
|
+
return parts.length > 0 ? `(${parts.join(',')})` : '()';
|
|
194
187
|
}
|