salesprompter-cli 0.1.38 → 0.1.39
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/cli.js +96 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -124,6 +124,20 @@ const LinkedInCompanyBackfillStatusResponseSchema = z.object({
|
|
|
124
124
|
failureCode: z.string().nullable().optional(),
|
|
125
125
|
failureMessage: z.string().nullable().optional()
|
|
126
126
|
});
|
|
127
|
+
const LeadPoolEmailFinderProcessResponseSchema = z.object({
|
|
128
|
+
success: z.boolean(),
|
|
129
|
+
provider: z.string().optional(),
|
|
130
|
+
selected: z.number().int().nonnegative(),
|
|
131
|
+
found: z.number().int().nonnegative(),
|
|
132
|
+
notFound: z.number().int().nonnegative(),
|
|
133
|
+
failed: z.number().int().nonnegative(),
|
|
134
|
+
durationMs: z.number().nonnegative(),
|
|
135
|
+
launched: z.boolean().optional(),
|
|
136
|
+
agentId: z.string().nullable().optional(),
|
|
137
|
+
containerId: z.string().nullable().optional(),
|
|
138
|
+
csvInputUrl: z.string().nullable().optional(),
|
|
139
|
+
processedAt: z.string()
|
|
140
|
+
});
|
|
127
141
|
const PhantombusterContainersSyncResponseSchema = z.object({
|
|
128
142
|
status: z.literal("ok"),
|
|
129
143
|
agentIds: z.array(z.string().min(1)),
|
|
@@ -5719,6 +5733,24 @@ async function syncPhantombusterContainersViaApp(session, payload) {
|
|
|
5719
5733
|
}), PhantombusterContainersSyncResponseSchema);
|
|
5720
5734
|
return value;
|
|
5721
5735
|
}
|
|
5736
|
+
async function runLeadPoolEmailFinderViaApp(session, payload) {
|
|
5737
|
+
const url = new URL("/api/leadpool/process-hunter-emails", session.apiBaseUrl);
|
|
5738
|
+
url.searchParams.set("provider", payload.provider);
|
|
5739
|
+
url.searchParams.set("limit", String(payload.limit));
|
|
5740
|
+
if (payload.concurrency != null) {
|
|
5741
|
+
url.searchParams.set("concurrency", String(payload.concurrency));
|
|
5742
|
+
}
|
|
5743
|
+
if (payload.retryNotFoundAfterDays != null) {
|
|
5744
|
+
url.searchParams.set("retryNotFoundAfterDays", String(payload.retryNotFoundAfterDays));
|
|
5745
|
+
}
|
|
5746
|
+
const { value } = await fetchCliJson(session, (currentSession) => fetch(url.toString(), {
|
|
5747
|
+
method: "POST",
|
|
5748
|
+
headers: {
|
|
5749
|
+
Authorization: `Bearer ${currentSession.accessToken}`
|
|
5750
|
+
}
|
|
5751
|
+
}), LeadPoolEmailFinderProcessResponseSchema);
|
|
5752
|
+
return value;
|
|
5753
|
+
}
|
|
5722
5754
|
function serializeSalesNavigatorFiltersForApi(filters) {
|
|
5723
5755
|
return filters.map((filter) => ({
|
|
5724
5756
|
type: filter.type,
|
|
@@ -10763,6 +10795,8 @@ program
|
|
|
10763
10795
|
.requiredOption("--out-dir <path>", "Output directory for artifacts")
|
|
10764
10796
|
.option("--trace-id <traceId>", "Trace id for this batch")
|
|
10765
10797
|
.option("--endpoint-url <url>", "Override the enrichment workflow endpoint")
|
|
10798
|
+
.option("--provider <provider>", "Email finder provider for workspace queue: hunter or phantombuster", "hunter")
|
|
10799
|
+
.option("--retry-not-found-after-days <number>", "Retry stale Email not found rows after this many days", "1")
|
|
10766
10800
|
.option("--timeout-ms <number>", "Workflow trigger timeout in milliseconds", "30000")
|
|
10767
10801
|
.option("--company-cleaning <mode>", "Company cleaning mode for direct input: off, basic, or ai", "basic")
|
|
10768
10802
|
.option("--dry-run", "Preview the next batch without starting background processing", false)
|
|
@@ -10771,7 +10805,69 @@ program
|
|
|
10771
10805
|
const outDir = z.string().min(1).parse(options.outDir);
|
|
10772
10806
|
const timeoutMs = z.coerce.number().int().min(1000).max(300000).parse(options.timeoutMs);
|
|
10773
10807
|
const usingDirectInput = typeof options.in === "string" && options.in.trim().length > 0;
|
|
10808
|
+
const provider = z.enum(["hunter", "phantombuster"]).parse(String(options.provider ?? "hunter").trim().toLowerCase());
|
|
10809
|
+
const retryNotFoundAfterDays = z.coerce.number().int().min(0).max(30).parse(options.retryNotFoundAfterDays);
|
|
10774
10810
|
const companyCleaningMode = resolveCompanyCleaningMode(String(options.companyCleaning ?? process.env.SALESPROMPTER_COMPANY_CLEANING_MODE ?? "basic"));
|
|
10811
|
+
if (provider === "phantombuster" && !usingDirectInput) {
|
|
10812
|
+
await mkdir(outDir, { recursive: true });
|
|
10813
|
+
const traceId = z.string().min(1).parse(options.traceId ?? `salesprompter-cli-email-phantombuster-${Date.now()}`);
|
|
10814
|
+
const requestPath = `${outDir}/email-enrichment-request-phantombuster.json`;
|
|
10815
|
+
const responsePath = `${outDir}/email-enrichment-response-phantombuster.json`;
|
|
10816
|
+
const requestPayload = {
|
|
10817
|
+
traceId,
|
|
10818
|
+
provider,
|
|
10819
|
+
limit,
|
|
10820
|
+
retryNotFoundAfterDays
|
|
10821
|
+
};
|
|
10822
|
+
await writeJsonFile(requestPath, requestPayload);
|
|
10823
|
+
if (options.dryRun) {
|
|
10824
|
+
printOutput({
|
|
10825
|
+
status: "ok",
|
|
10826
|
+
provider,
|
|
10827
|
+
limit,
|
|
10828
|
+
traceId,
|
|
10829
|
+
dryRun: true,
|
|
10830
|
+
mode: "workspace-queue",
|
|
10831
|
+
contactsQueued: null,
|
|
10832
|
+
started: false,
|
|
10833
|
+
artifacts: {
|
|
10834
|
+
inputSqlPath: null,
|
|
10835
|
+
inputRowsPath: null,
|
|
10836
|
+
directReportPath: null,
|
|
10837
|
+
requestPath,
|
|
10838
|
+
responsePath: null
|
|
10839
|
+
}
|
|
10840
|
+
});
|
|
10841
|
+
return;
|
|
10842
|
+
}
|
|
10843
|
+
const session = await requireAuthSession();
|
|
10844
|
+
const result = await runLeadPoolEmailFinderViaApp(session, {
|
|
10845
|
+
provider,
|
|
10846
|
+
limit,
|
|
10847
|
+
retryNotFoundAfterDays
|
|
10848
|
+
});
|
|
10849
|
+
await writeJsonFile(responsePath, result);
|
|
10850
|
+
printOutput({
|
|
10851
|
+
status: result.success ? "ok" : "partial",
|
|
10852
|
+
provider,
|
|
10853
|
+
limit,
|
|
10854
|
+
traceId,
|
|
10855
|
+
dryRun: false,
|
|
10856
|
+
mode: "workspace-queue",
|
|
10857
|
+
contactsQueued: result.selected,
|
|
10858
|
+
started: Boolean(result.launched),
|
|
10859
|
+
agentId: result.agentId ?? null,
|
|
10860
|
+
containerId: result.containerId ?? null,
|
|
10861
|
+
artifacts: {
|
|
10862
|
+
inputSqlPath: null,
|
|
10863
|
+
inputRowsPath: null,
|
|
10864
|
+
directReportPath: null,
|
|
10865
|
+
requestPath,
|
|
10866
|
+
responsePath
|
|
10867
|
+
}
|
|
10868
|
+
});
|
|
10869
|
+
return;
|
|
10870
|
+
}
|
|
10775
10871
|
let clientId;
|
|
10776
10872
|
let queueRows;
|
|
10777
10873
|
let directReportRows = null;
|
package/package.json
CHANGED