linkedin-secret-sauce 0.3.20 → 0.3.22
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 -4
- package/dist/utils/search-encoder.js +23 -11
- package/package.json +1 -1
package/dist/types.d.ts
CHANGED
|
@@ -207,12 +207,12 @@ export type Geo = {
|
|
|
207
207
|
export type SalesSearchFilters = {
|
|
208
208
|
company?: {
|
|
209
209
|
current?: {
|
|
210
|
-
include?: string[];
|
|
211
|
-
exclude?: string[];
|
|
210
|
+
include?: (string | number)[];
|
|
211
|
+
exclude?: (string | number)[];
|
|
212
212
|
};
|
|
213
213
|
past?: {
|
|
214
|
-
include?: string[];
|
|
215
|
-
exclude?: string[];
|
|
214
|
+
include?: (string | number)[];
|
|
215
|
+
exclude?: (string | number)[];
|
|
216
216
|
};
|
|
217
217
|
headcount?: {
|
|
218
218
|
include?: ("1-10" | "11-50" | "51-200" | "201-500" | "501-1000" | "1001-5000" | "5001-10000" | "10000+")[];
|
|
@@ -117,22 +117,34 @@ 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)
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
120
|
+
// CURRENT_COMPANY — accept org URN (urn:li:organization:ID) or numeric ID (auto-converted to URN)
|
|
121
|
+
function encodeCompanies(arr) {
|
|
122
|
+
if (!arr || !arr.length)
|
|
123
|
+
return [];
|
|
124
|
+
return arr.map((c) => {
|
|
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}`;
|
|
127
133
|
}
|
|
128
134
|
else {
|
|
129
|
-
|
|
135
|
+
// If not URN or numeric, assume it's already a URN (pass through)
|
|
136
|
+
urn = idStr;
|
|
130
137
|
}
|
|
131
|
-
|
|
132
|
-
return valObj(parts);
|
|
138
|
+
return valObj([`id:${urn}`, 'selectionType:INCLUDED']);
|
|
133
139
|
});
|
|
134
|
-
pushFilter(f, 'CURRENT_COMPANY', values);
|
|
135
140
|
}
|
|
141
|
+
const curCompanies = encodeCompanies(filters?.company?.current?.include);
|
|
142
|
+
if (curCompanies.length)
|
|
143
|
+
pushFilter(f, 'CURRENT_COMPANY', curCompanies);
|
|
144
|
+
// PAST_COMPANY — same logic as current
|
|
145
|
+
const pastCompanies = encodeCompanies(filters?.company?.past?.include);
|
|
146
|
+
if (pastCompanies.length)
|
|
147
|
+
pushFilter(f, 'PAST_COMPANY', pastCompanies);
|
|
136
148
|
// COMPANY_TYPE — map to C,P,N,D,G when known; allow raw codes
|
|
137
149
|
const COMPANY_TYPE = {
|
|
138
150
|
PUBLIC: 'C',
|