salesprompter-cli 0.1.51 → 0.1.52
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 +1 -0
- package/dist/cli.js +51 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -72,6 +72,7 @@ salesprompter leads:collect \
|
|
|
72
72
|
|
|
73
73
|
# Enrich one or more stored imports: Sales Navigator company -> official domain -> Hunter email
|
|
74
74
|
# This updates workspace data only. It does not create or start outreach.
|
|
75
|
+
# Stale imported company ids fall back to exact-name Account Search automatically.
|
|
75
76
|
salesprompter leads:enrich-import \
|
|
76
77
|
--run-id "$CLI_IMPORT_RUN_ID"
|
|
77
78
|
|
package/dist/cli.js
CHANGED
|
@@ -13864,6 +13864,7 @@ async function runSalesNavigatorImportEnrichmentCommand(options) {
|
|
|
13864
13864
|
}
|
|
13865
13865
|
};
|
|
13866
13866
|
const detailCache = new Map();
|
|
13867
|
+
const companyIdsWithDetails = new Set();
|
|
13867
13868
|
const enrichResolvedCompanies = async (resolutions) => {
|
|
13868
13869
|
const resolutionBatchSize = 20;
|
|
13869
13870
|
for (let offset = 0; offset < resolutions.length; offset += resolutionBatchSize) {
|
|
@@ -13903,14 +13904,59 @@ async function runSalesNavigatorImportEnrichmentCommand(options) {
|
|
|
13903
13904
|
});
|
|
13904
13905
|
}
|
|
13905
13906
|
}
|
|
13906
|
-
|
|
13907
|
+
const fallbackResolutions = [];
|
|
13908
|
+
for (let index = 0; index < resolutionBatch.length; index += 1) {
|
|
13909
|
+
const resolution = resolutionBatch[index];
|
|
13907
13910
|
const cached = detailCache.get(resolution.resolvedCompanyId ?? "");
|
|
13911
|
+
if (cached?.detail && resolution.resolvedCompanyId) {
|
|
13912
|
+
companyIdsWithDetails.add(resolution.resolvedCompanyId);
|
|
13913
|
+
}
|
|
13914
|
+
if (!cached?.detail &&
|
|
13915
|
+
cached?.status === 404 &&
|
|
13916
|
+
!resolution.accountSearchUsed &&
|
|
13917
|
+
resolution.candidate.companyName) {
|
|
13918
|
+
try {
|
|
13919
|
+
const fallback = await resolveCliImportCompanyIdentity({
|
|
13920
|
+
...resolution.candidate,
|
|
13921
|
+
companyId: null,
|
|
13922
|
+
salesNavCompanyUrl: null,
|
|
13923
|
+
linkedinCompanyUrl: null,
|
|
13924
|
+
}, config, companyTimeoutMs, browserRelay);
|
|
13925
|
+
if (fallback.resolvedCompanyId) {
|
|
13926
|
+
fallbackResolutions.push(fallback);
|
|
13927
|
+
}
|
|
13928
|
+
else {
|
|
13929
|
+
pendingProfiles.push(buildCliImportCompanyProfile(fallback, null, {
|
|
13930
|
+
status: 404,
|
|
13931
|
+
error: "No exact LinkedIn company was found by Account Search",
|
|
13932
|
+
}));
|
|
13933
|
+
}
|
|
13934
|
+
}
|
|
13935
|
+
catch (error) {
|
|
13936
|
+
if (error instanceof CliImportCompanyRateLimitError ||
|
|
13937
|
+
error instanceof CliImportCompanySessionError) {
|
|
13938
|
+
throw error;
|
|
13939
|
+
}
|
|
13940
|
+
pendingProfiles.push(buildCliImportCompanyProfile(resolution, null, {
|
|
13941
|
+
status: 500,
|
|
13942
|
+
error: error instanceof Error ? error.message : String(error),
|
|
13943
|
+
}));
|
|
13944
|
+
}
|
|
13945
|
+
if (index < resolutionBatch.length - 1 &&
|
|
13946
|
+
companyDelayMaxMs > 0) {
|
|
13947
|
+
await delay(randomIntegerBetween(companyDelayMinMs, companyDelayMaxMs));
|
|
13948
|
+
}
|
|
13949
|
+
continue;
|
|
13950
|
+
}
|
|
13908
13951
|
pendingProfiles.push(buildCliImportCompanyProfile(resolution, cached?.detail ?? null, {
|
|
13909
13952
|
status: cached?.status ?? 500,
|
|
13910
13953
|
error: cached?.error ?? "Sales Navigator returned no company detail",
|
|
13911
13954
|
}));
|
|
13912
13955
|
}
|
|
13913
13956
|
await flushCompanyProfiles();
|
|
13957
|
+
if (fallbackResolutions.length > 0) {
|
|
13958
|
+
await enrichResolvedCompanies(fallbackResolutions);
|
|
13959
|
+
}
|
|
13914
13960
|
if (offset + resolutionBatchSize < resolutions.length &&
|
|
13915
13961
|
companyDelayMaxMs > 0) {
|
|
13916
13962
|
await delay(randomIntegerBetween(companyDelayMinMs, companyDelayMaxMs));
|
|
@@ -13922,6 +13968,10 @@ async function runSalesNavigatorImportEnrichmentCommand(options) {
|
|
|
13922
13968
|
await enrichResolvedCompanies(knownResolutions);
|
|
13923
13969
|
const knownByAlias = new Map();
|
|
13924
13970
|
for (const candidate of knownCandidates) {
|
|
13971
|
+
if (!candidate.companyId ||
|
|
13972
|
+
!companyIdsWithDetails.has(candidate.companyId)) {
|
|
13973
|
+
continue;
|
|
13974
|
+
}
|
|
13925
13975
|
for (const alias of [
|
|
13926
13976
|
candidate.companyName ?? "",
|
|
13927
13977
|
aggressivelyCleanLookupCompanyName(candidate.companyName ?? ""),
|
package/package.json
CHANGED