@erdoai/cli 0.237.0 → 0.238.0
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/index.js +27 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1847,6 +1847,13 @@ var ErdoClient = class {
|
|
|
1847
1847
|
`/v1/datasets/${encodeURIComponent(datasetSlug)}/leads/${encodeURIComponent(lead)}`
|
|
1848
1848
|
);
|
|
1849
1849
|
}
|
|
1850
|
+
resolveLeadReferences(datasetSlug, leadRefs) {
|
|
1851
|
+
return this.request(
|
|
1852
|
+
"POST",
|
|
1853
|
+
`/v1/datasets/${encodeURIComponent(datasetSlug)}/lead-reference-resolutions`,
|
|
1854
|
+
{ lead_refs: leadRefs }
|
|
1855
|
+
);
|
|
1856
|
+
}
|
|
1850
1857
|
// The captures the platform refused to resolve: two leads sharing a contact
|
|
1851
1858
|
// detail, or a submission whose email and phone point at different leads.
|
|
1852
1859
|
listLeadMergeCandidates(datasetSlug, limit, traffic) {
|
|
@@ -10049,6 +10056,26 @@ leadsCmd.command("get <dataset> <lead>").description(
|
|
|
10049
10056
|
fail(e);
|
|
10050
10057
|
}
|
|
10051
10058
|
});
|
|
10059
|
+
leadsCmd.command("resolve <dataset> <refs...>").description("Resolve many stored lead references to their surviving leads after merges").option("--json", "print the raw JSON result instead of a table").action(async (dataset, refs, opts) => {
|
|
10060
|
+
try {
|
|
10061
|
+
const res = await new ErdoClient().resolveLeadReferences(dataset, refs);
|
|
10062
|
+
if (opts.json) {
|
|
10063
|
+
print(res);
|
|
10064
|
+
return;
|
|
10065
|
+
}
|
|
10066
|
+
const rows = res.resolved.map((item) => [
|
|
10067
|
+
item.lead_ref,
|
|
10068
|
+
item.survivor_lead_ref,
|
|
10069
|
+
item.survivor_canonical_lead_id,
|
|
10070
|
+
item.merged ? "yes" : "no"
|
|
10071
|
+
]);
|
|
10072
|
+
if (rows.length) printAlignedTable(["input", "survivor", "survivor canonical id", "merged"], rows);
|
|
10073
|
+
if (res.not_found.length) console.log(`Not found: ${res.not_found.join(", ")}`);
|
|
10074
|
+
if (res.invalid.length) console.log(`Invalid: ${res.invalid.join(", ")}`);
|
|
10075
|
+
} catch (e) {
|
|
10076
|
+
fail(e);
|
|
10077
|
+
}
|
|
10078
|
+
});
|
|
10052
10079
|
leadsCmd.command("candidates <dataset>").description(
|
|
10053
10080
|
"List unresolved refused submissions and their candidate leads. Inspect the saved evidence before previewing an apply-to-lead or dismissal decision with leads resolve-capture."
|
|
10054
10081
|
).option("-l, --limit <n>", "maximum captures to return (default 50, maximum 200)", (v) => parseInt(v, 10)).addOption(new Option2("--traffic <kind>", "include real submissions, independently trusted tests, or both").choices(["real", "test", "all"])).option("--json", "print the raw JSON result instead of a table").action(async (dataset, opts) => {
|