@dench.com/cli 3.2.1 → 3.2.3-staging.306
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 +5 -4
- package/app-sdk.d.ts +60 -2
- package/crm.ts +18 -0
- package/leads.ts +46 -2
- package/lib/api-schemas.ts +120 -0
- package/lib/app-sdk-catalog.generated.ts +2 -0
- package/lib/app-sdk-surface.ts +1 -0
- package/lib/command-registry.ts +24 -0
- package/lib/enrichment-gateway.ts +90 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -236,9 +236,10 @@ details instead of becoming competing result sets.
|
|
|
236
236
|
|
|
237
237
|
Before presenting a prospect shortlist, the skill saves an ICP relevance score
|
|
238
238
|
(0–100) and short reason for each profile against that search's resolved criteria,
|
|
239
|
-
using the general brief as relevant guidance.
|
|
240
|
-
**ICP fit** and **Why this lead**
|
|
241
|
-
|
|
239
|
+
using the general brief as relevant guidance. Saved assessments remain available
|
|
240
|
+
in list reads and CSV exports; the **ICP fit** and **Why this lead** columns are
|
|
241
|
+
temporarily hidden in Find. Scores are not conversion probabilities or CRM
|
|
242
|
+
statuses. To save assessments for canonical
|
|
242
243
|
rows returned by `lists rows`, create a JSON array of
|
|
243
244
|
`{row, suggestion: {fit, score, reason}}` (1–100 items per file):
|
|
244
245
|
|
|
@@ -249,7 +250,7 @@ dench lists assess <artifactId> --assessments-file /tmp/icp-assessments.json --j
|
|
|
249
250
|
`fit` is `likely_fit`, `unlikely_fit`, or `unknown`; `score` is a whole number
|
|
250
251
|
from 0 to 100. The CLI validates the file before writes and reports partial
|
|
251
252
|
failures; retrying updates existing assessments. Re-read rows to verify every
|
|
252
|
-
saved score and reason. Older
|
|
253
|
+
saved score and reason. Older profiles have no saved score until assessed.
|
|
253
254
|
|
|
254
255
|
Directory and row reads return `page`, `continueCursor`, and `isDone`.
|
|
255
256
|
Follow cursors even through empty filtered pages. Lists survive new chats;
|
package/app-sdk.d.ts
CHANGED
|
@@ -1467,6 +1467,30 @@ export interface ApiRequests {
|
|
|
1467
1467
|
contacts: Record<string, unknown>[];
|
|
1468
1468
|
[key: string]: unknown;
|
|
1469
1469
|
};
|
|
1470
|
+
/** Look up up to 100 people or company profiles without buying emails or phones. Pass kind (people|companies) and lookups; results preserve inputIndex. People require linkedinUrl or email; companies require domain or linkedinUrl. — `dench crm enrich profiles` — POST /api/v1/enrichment/profiles/bulk */
|
|
1471
|
+
"enrichment.profiles.bulk": {
|
|
1472
|
+
kind: "people" | "companies";
|
|
1473
|
+
/** Input order is preserved. Does not purchase contact data or write CRM records. */
|
|
1474
|
+
lookups: Array<{
|
|
1475
|
+
linkedinUrl: string;
|
|
1476
|
+
} | {
|
|
1477
|
+
email: string;
|
|
1478
|
+
} | {
|
|
1479
|
+
domain: string;
|
|
1480
|
+
}>;
|
|
1481
|
+
};
|
|
1482
|
+
/** Read company employees, founders, funding, investors, acquisitions, or investments. Pass domain or linkedinUrl, kind, limit (1–100), and optional pageToken. Does not import CRM records or buy contacts. — `dench companies related` — POST /api/v1/enrichment/company/related */
|
|
1483
|
+
"enrichment.company.related": {
|
|
1484
|
+
/** Company domain. Provide exactly one of domain or linkedinUrl. */
|
|
1485
|
+
domain?: string;
|
|
1486
|
+
/** Company LinkedIn URL. Omit when domain is provided. */
|
|
1487
|
+
linkedinUrl?: string;
|
|
1488
|
+
kind: "employees" | "founders" | "funding" | "investors" | "acquisitions" | "investments";
|
|
1489
|
+
/** Records per page; defaults to 25. Keep unchanged when using pageToken. */
|
|
1490
|
+
limit?: number;
|
|
1491
|
+
/** Opaque metadata.nextPageToken from this same company, kind, and page size. */
|
|
1492
|
+
pageToken?: string;
|
|
1493
|
+
};
|
|
1470
1494
|
/** Preview how many records a find would return. — `dench leads find --limit 1` — POST /api/v1/enrichment/search/preview */
|
|
1471
1495
|
"enrichment.search.preview": {
|
|
1472
1496
|
kind?: "people" | "companies" | "jobs";
|
|
@@ -4168,6 +4192,29 @@ export interface ApiResponses {
|
|
|
4168
4192
|
[key: string]: unknown;
|
|
4169
4193
|
};
|
|
4170
4194
|
"enrichment.person.contact": Record<string, unknown>;
|
|
4195
|
+
"enrichment.profiles.bulk": {
|
|
4196
|
+
kind: "people" | "companies";
|
|
4197
|
+
records: Array<{
|
|
4198
|
+
inputIndex: number;
|
|
4199
|
+
/** Dench person/company profile, or null for a genuine miss. No provider-specific IDs or payloads. */
|
|
4200
|
+
data: Record<string, unknown> | null;
|
|
4201
|
+
}>;
|
|
4202
|
+
billing: {
|
|
4203
|
+
charged_cents: number;
|
|
4204
|
+
};
|
|
4205
|
+
};
|
|
4206
|
+
"enrichment.company.related": {
|
|
4207
|
+
kind: "employees" | "founders" | "funding" | "investors" | "acquisitions" | "investments";
|
|
4208
|
+
/** Normalized records for the requested kind; employees include employment, funding includes USD amounts and investors. */
|
|
4209
|
+
items: Record<string, unknown>[];
|
|
4210
|
+
metadata: {
|
|
4211
|
+
total: number;
|
|
4212
|
+
nextPageToken?: string;
|
|
4213
|
+
};
|
|
4214
|
+
billing: {
|
|
4215
|
+
charged_cents: number;
|
|
4216
|
+
};
|
|
4217
|
+
};
|
|
4171
4218
|
"enrichment.search.preview": {
|
|
4172
4219
|
count: number;
|
|
4173
4220
|
source?: "live" | "cache";
|
|
@@ -5983,6 +6030,7 @@ export type DenchApiTree = {
|
|
|
5983
6030
|
get(args: Req<"campaigns.get">): Promise<Res<"campaigns.get">>;
|
|
5984
6031
|
launch: {
|
|
5985
6032
|
/** Launch a ready draft. Pass the fingerprint from the preview and acknowledge the LinkedIn notice when LinkedIn steps exist. (`dench campaign launch`) */
|
|
6033
|
+
(args: Req<"campaigns.launch">): Promise<Res<"campaigns.launch">>;
|
|
5986
6034
|
$call(args: Req<"campaigns.launch">): Promise<Res<"campaigns.launch">>;
|
|
5987
6035
|
/** Launch readiness: blockers grouped by problem, warnings, and the fingerprint `launch` requires. (`dench campaign launch`) */
|
|
5988
6036
|
preview(args: Req<"campaigns.launch.preview">): Promise<Res<"campaigns.launch.preview">>;
|
|
@@ -6465,18 +6513,28 @@ export type DenchApiTree = {
|
|
|
6465
6513
|
};
|
|
6466
6514
|
};
|
|
6467
6515
|
enrichment: {
|
|
6468
|
-
|
|
6469
|
-
|
|
6516
|
+
company: {
|
|
6517
|
+
/** Look up one company profile. (`dench crm enrich cell`) */
|
|
6518
|
+
(args: Req<"enrichment.company">): Promise<Res<"enrichment.company">>;
|
|
6519
|
+
$call(args: Req<"enrichment.company">): Promise<Res<"enrichment.company">>;
|
|
6520
|
+
/** Read company employees, founders, funding, investors, acquisitions, or investments. Pass domain or linkedinUrl, kind, limit (1–100), and optional pageToken. Does not import CRM records or buy contacts. (`dench companies related`) */
|
|
6521
|
+
related(args: Req<"enrichment.company.related">): Promise<Res<"enrichment.company.related">>;
|
|
6522
|
+
};
|
|
6470
6523
|
jobs: {
|
|
6471
6524
|
/** Search job postings through Dench find. `companyDomains` takes up to 1000 domains (chunked automatically); `dench jobs find --company-list <id|view>` resolves a saved company list into it. (`dench jobs find`) */
|
|
6472
6525
|
search(args: Req<"enrichment.jobs.search">): Promise<Res<"enrichment.jobs.search">>;
|
|
6473
6526
|
};
|
|
6474
6527
|
person: {
|
|
6475
6528
|
/** Look up one person profile. (`dench crm enrich cell`) */
|
|
6529
|
+
(args: Req<"enrichment.person">): Promise<Res<"enrichment.person">>;
|
|
6476
6530
|
$call(args: Req<"enrichment.person">): Promise<Res<"enrichment.person">>;
|
|
6477
6531
|
/** Look up verified emails and phones for people. (`dench crm enrich cell`) */
|
|
6478
6532
|
contact(args: Req<"enrichment.person.contact">): Promise<Res<"enrichment.person.contact">>;
|
|
6479
6533
|
};
|
|
6534
|
+
profiles: {
|
|
6535
|
+
/** Look up up to 100 people or company profiles without buying emails or phones. Pass kind (people|companies) and lookups; results preserve inputIndex. People require linkedinUrl or email; companies require domain or linkedinUrl. (`dench crm enrich profiles`) */
|
|
6536
|
+
bulk(args: Req<"enrichment.profiles.bulk">): Promise<Res<"enrichment.profiles.bulk">>;
|
|
6537
|
+
};
|
|
6480
6538
|
search: {
|
|
6481
6539
|
/** Preview how many records a find would return. (`dench leads find --limit 1`) */
|
|
6482
6540
|
preview(args: Req<"enrichment.search.preview">): Promise<Res<"enrichment.search.preview">>;
|
package/crm.ts
CHANGED
|
@@ -64,6 +64,7 @@ import {
|
|
|
64
64
|
type EnrichPersonBody,
|
|
65
65
|
enrichCompany,
|
|
66
66
|
enrichPerson,
|
|
67
|
+
enrichProfiles,
|
|
67
68
|
} from "./lib/enrichment-gateway";
|
|
68
69
|
import { closestMatch, levenshteinDistance } from "./lib/levenshtein";
|
|
69
70
|
|
|
@@ -4299,6 +4300,22 @@ async function runCompaniesCommand(ctx: CrmCliContext): Promise<void> {
|
|
|
4299
4300
|
async function runEnrichCommand(ctx: CrmCliContext): Promise<void> {
|
|
4300
4301
|
const verb = ctx.args.shift();
|
|
4301
4302
|
switch (verb) {
|
|
4303
|
+
case "profiles": {
|
|
4304
|
+
const kind = getFlag(ctx.args, "--kind");
|
|
4305
|
+
if (kind !== "people" && kind !== "companies")
|
|
4306
|
+
throw new CrmCliError("--kind must be people or companies.");
|
|
4307
|
+
const input = await readJsonArrayInput({
|
|
4308
|
+
args: ctx.args,
|
|
4309
|
+
command: "crm enrich profiles",
|
|
4310
|
+
inlineFlag: "--lookups",
|
|
4311
|
+
inlineValue: getFlag(ctx.args, "--lookups"),
|
|
4312
|
+
});
|
|
4313
|
+
const lookups = input.map((value, index) =>
|
|
4314
|
+
requireNonEmptyJsonRecord(value, `lookup ${index + 1}`),
|
|
4315
|
+
);
|
|
4316
|
+
out(ctx, await enrichProfiles({ kind, lookups }, ctx.enrichmentGateway));
|
|
4317
|
+
return;
|
|
4318
|
+
}
|
|
4302
4319
|
case "cell": {
|
|
4303
4320
|
const objectName = shift(ctx.args, "object name");
|
|
4304
4321
|
const entryId = shift(ctx.args, "entry id");
|
|
@@ -4707,6 +4724,7 @@ People + companies shortcuts:
|
|
|
4707
4724
|
dench crm companies enrich <entryId> [--field 'Company Name'] [--input-field Domain]
|
|
4708
4725
|
|
|
4709
4726
|
Cell / row / object enrichment:
|
|
4727
|
+
dench crm enrich profiles --kind people|companies --file lookups.json [--json]
|
|
4710
4728
|
dench crm enrich cell <object> <entryId> <field> [--input-field <field>] [--category people|company] [--apollo-path <path>] [--overwrite]
|
|
4711
4729
|
dench crm enrich object <object> --field <field> [--input-field <field>] [--category people|company] [--apollo-path <path>] [--limit N] [--all] [--overwrite]
|
|
4712
4730
|
|
package/leads.ts
CHANGED
|
@@ -15,6 +15,8 @@ import {
|
|
|
15
15
|
shift as shiftRaw,
|
|
16
16
|
} from "./lib/cli-args";
|
|
17
17
|
import {
|
|
18
|
+
type CompanyRelatedKind,
|
|
19
|
+
companyRelatedRecords,
|
|
18
20
|
EnrichmentGatewayError,
|
|
19
21
|
type EnrichmentGatewayOptions,
|
|
20
22
|
searchCompanies,
|
|
@@ -475,6 +477,7 @@ export function companiesHelp(): void {
|
|
|
475
477
|
console.log(`Dench companies
|
|
476
478
|
|
|
477
479
|
Usage:
|
|
480
|
+
dench companies related --domain acme.com --kind employees|founders|funding|investors|acquisitions|investments [--limit 25] [--page-token <token>] [--json]
|
|
478
481
|
dench companies find --name "Acme" [--domain acme.com] [--keywords fintech] [--industries SaaS] [--locations "San Francisco"] [--linkedin https://linkedin.com/company/acme] [--save-as "Target accounts"] [--limit 500] [--page-token <token>] [--json]
|
|
479
482
|
|
|
480
483
|
Finds companies through Dench search and writes a workspace list artifact.
|
|
@@ -911,8 +914,11 @@ export async function runLeadsCommand(opts: {
|
|
|
911
914
|
subFunctions: flags.subFunctions,
|
|
912
915
|
industries: flags.industries,
|
|
913
916
|
companyDomain: flags.companyDomain,
|
|
914
|
-
companyDomains:
|
|
915
|
-
companyNames:
|
|
917
|
+
companyDomains: flags.companyDomains,
|
|
918
|
+
companyNames: flags.companyNames,
|
|
919
|
+
companyScope: companyList
|
|
920
|
+
? { domains: companyList.domains, names: companyList.names }
|
|
921
|
+
: undefined,
|
|
916
922
|
pastCompanyNames: flags.pastCompanyNames,
|
|
917
923
|
companyHeadquarters: flags.companyHeadquarters,
|
|
918
924
|
companyTypes: flags.companyTypes,
|
|
@@ -1105,6 +1111,44 @@ export async function runCompaniesCommand(opts: {
|
|
|
1105
1111
|
companiesHelp();
|
|
1106
1112
|
return;
|
|
1107
1113
|
}
|
|
1114
|
+
if (verb === "related") {
|
|
1115
|
+
const domain = getFlag(args, "--domain");
|
|
1116
|
+
const linkedinUrl = getFlag(args, "--linkedin");
|
|
1117
|
+
const kind = getFlag(args, "--kind");
|
|
1118
|
+
const limit = parseLimit(args);
|
|
1119
|
+
const pageToken = getFlag(args, "--page-token");
|
|
1120
|
+
assertNoUnknownFlags(args, "companies related");
|
|
1121
|
+
if (Boolean(domain) === Boolean(linkedinUrl))
|
|
1122
|
+
throw new FindCliError("Provide exactly one of --domain or --linkedin.");
|
|
1123
|
+
if (
|
|
1124
|
+
!kind ||
|
|
1125
|
+
![
|
|
1126
|
+
"employees",
|
|
1127
|
+
"founders",
|
|
1128
|
+
"funding",
|
|
1129
|
+
"investors",
|
|
1130
|
+
"acquisitions",
|
|
1131
|
+
"investments",
|
|
1132
|
+
].includes(kind)
|
|
1133
|
+
)
|
|
1134
|
+
throw new FindCliError(
|
|
1135
|
+
"--kind must be employees, founders, funding, investors, acquisitions, or investments.",
|
|
1136
|
+
);
|
|
1137
|
+
if (limit !== undefined && limit > 100)
|
|
1138
|
+
throw new FindCliError("--limit must be between 1 and 100.");
|
|
1139
|
+
const result = await companyRelatedRecords(
|
|
1140
|
+
{
|
|
1141
|
+
domain,
|
|
1142
|
+
linkedinUrl,
|
|
1143
|
+
kind: kind as CompanyRelatedKind,
|
|
1144
|
+
limit,
|
|
1145
|
+
pageToken,
|
|
1146
|
+
},
|
|
1147
|
+
ctx.enrichmentGateway,
|
|
1148
|
+
);
|
|
1149
|
+
console.log(JSON.stringify(result, null, 2));
|
|
1150
|
+
return;
|
|
1151
|
+
}
|
|
1108
1152
|
if (verb !== "find") {
|
|
1109
1153
|
throw new FindCliError(`Unknown companies verb: ${verb}`);
|
|
1110
1154
|
}
|
package/lib/api-schemas.ts
CHANGED
|
@@ -1895,6 +1895,27 @@ const jobsSearchResponse = z
|
|
|
1895
1895
|
})
|
|
1896
1896
|
.passthrough();
|
|
1897
1897
|
|
|
1898
|
+
const companyRelatedKind = z.enum([
|
|
1899
|
+
"employees",
|
|
1900
|
+
"founders",
|
|
1901
|
+
"funding",
|
|
1902
|
+
"investors",
|
|
1903
|
+
"acquisitions",
|
|
1904
|
+
"investments",
|
|
1905
|
+
]);
|
|
1906
|
+
const profileLookup = z
|
|
1907
|
+
.union([
|
|
1908
|
+
z.object({ linkedinUrl: z.string().url() }).strict(),
|
|
1909
|
+
z.object({ email: z.string().email() }).strict(),
|
|
1910
|
+
z.object({ domain: z.string().trim().min(1) }).strict(),
|
|
1911
|
+
])
|
|
1912
|
+
.describe(
|
|
1913
|
+
"Exactly one identifier per lookup. People: linkedinUrl or email. Companies: domain or linkedinUrl. The gateway validates the identifier against kind.",
|
|
1914
|
+
);
|
|
1915
|
+
const enrichmentCharge = z.object({
|
|
1916
|
+
charged_cents: z.number().int().nonnegative(),
|
|
1917
|
+
});
|
|
1918
|
+
|
|
1898
1919
|
// ---------------------------------------------------------------------------
|
|
1899
1920
|
// Request schemas keyed by operation id
|
|
1900
1921
|
// ---------------------------------------------------------------------------
|
|
@@ -3258,6 +3279,52 @@ export const requestSchemas: Record<string, ZodTypeAny> = {
|
|
|
3258
3279
|
contacts: z.array(z.record(z.string(), z.unknown())).min(1),
|
|
3259
3280
|
})
|
|
3260
3281
|
.passthrough(),
|
|
3282
|
+
"enrichment.profiles.bulk": z
|
|
3283
|
+
.object({
|
|
3284
|
+
kind: z.enum(["people", "companies"]),
|
|
3285
|
+
lookups: z
|
|
3286
|
+
.array(profileLookup)
|
|
3287
|
+
.min(1)
|
|
3288
|
+
.max(100)
|
|
3289
|
+
.describe(
|
|
3290
|
+
"Input order is preserved. Does not purchase contact data or write CRM records.",
|
|
3291
|
+
),
|
|
3292
|
+
})
|
|
3293
|
+
.strict(),
|
|
3294
|
+
"enrichment.company.related": z
|
|
3295
|
+
.object({
|
|
3296
|
+
domain: z
|
|
3297
|
+
.string()
|
|
3298
|
+
.trim()
|
|
3299
|
+
.min(1)
|
|
3300
|
+
.optional()
|
|
3301
|
+
.describe(
|
|
3302
|
+
"Company domain. Provide exactly one of domain or linkedinUrl.",
|
|
3303
|
+
),
|
|
3304
|
+
linkedinUrl: z
|
|
3305
|
+
.string()
|
|
3306
|
+
.url()
|
|
3307
|
+
.optional()
|
|
3308
|
+
.describe("Company LinkedIn URL. Omit when domain is provided."),
|
|
3309
|
+
kind: companyRelatedKind,
|
|
3310
|
+
limit: z
|
|
3311
|
+
.number()
|
|
3312
|
+
.int()
|
|
3313
|
+
.min(1)
|
|
3314
|
+
.max(100)
|
|
3315
|
+
.optional()
|
|
3316
|
+
.describe(
|
|
3317
|
+
"Records per page; defaults to 25. Keep unchanged when using pageToken.",
|
|
3318
|
+
),
|
|
3319
|
+
pageToken: z
|
|
3320
|
+
.string()
|
|
3321
|
+
.min(1)
|
|
3322
|
+
.optional()
|
|
3323
|
+
.describe(
|
|
3324
|
+
"Opaque metadata.nextPageToken from this same company, kind, and page size.",
|
|
3325
|
+
),
|
|
3326
|
+
})
|
|
3327
|
+
.strict(),
|
|
3261
3328
|
|
|
3262
3329
|
// Email (sender identities, raw sends, templates, campaigns)
|
|
3263
3330
|
"email.identity.verify": z.object({
|
|
@@ -4431,6 +4498,34 @@ export const responseSchemas: Record<string, ZodTypeAny> = {
|
|
|
4431
4498
|
})
|
|
4432
4499
|
.passthrough(),
|
|
4433
4500
|
"enrichment.person.contact": z.object({}).passthrough(),
|
|
4501
|
+
"enrichment.profiles.bulk": z.object({
|
|
4502
|
+
kind: z.enum(["people", "companies"]),
|
|
4503
|
+
records: z.array(
|
|
4504
|
+
z.object({
|
|
4505
|
+
inputIndex: z.number().int().nonnegative(),
|
|
4506
|
+
data: z
|
|
4507
|
+
.record(z.string(), z.unknown())
|
|
4508
|
+
.nullable()
|
|
4509
|
+
.describe(
|
|
4510
|
+
"Dench person/company profile, or null for a genuine miss. No provider-specific IDs or payloads.",
|
|
4511
|
+
),
|
|
4512
|
+
}),
|
|
4513
|
+
),
|
|
4514
|
+
billing: enrichmentCharge,
|
|
4515
|
+
}),
|
|
4516
|
+
"enrichment.company.related": z.object({
|
|
4517
|
+
kind: companyRelatedKind,
|
|
4518
|
+
items: z
|
|
4519
|
+
.array(z.record(z.string(), z.unknown()))
|
|
4520
|
+
.describe(
|
|
4521
|
+
"Normalized records for the requested kind; employees include employment, funding includes USD amounts and investors.",
|
|
4522
|
+
),
|
|
4523
|
+
metadata: z.object({
|
|
4524
|
+
total: z.number().int().nonnegative(),
|
|
4525
|
+
nextPageToken: z.string().optional(),
|
|
4526
|
+
}),
|
|
4527
|
+
billing: enrichmentCharge,
|
|
4528
|
+
}),
|
|
4434
4529
|
|
|
4435
4530
|
// Email
|
|
4436
4531
|
"email.identity.verify": z
|
|
@@ -5148,6 +5243,15 @@ export const requestExamples: Record<string, unknown> = {
|
|
|
5148
5243
|
"enrichment.person.contact": {
|
|
5149
5244
|
contacts: [{ linkedinUrl: "https://www.linkedin.com/in/janedoe" }],
|
|
5150
5245
|
},
|
|
5246
|
+
"enrichment.profiles.bulk": {
|
|
5247
|
+
kind: "companies",
|
|
5248
|
+
lookups: [{ domain: "acme.com" }],
|
|
5249
|
+
},
|
|
5250
|
+
"enrichment.company.related": {
|
|
5251
|
+
domain: "acme.com",
|
|
5252
|
+
kind: "founders",
|
|
5253
|
+
limit: 10,
|
|
5254
|
+
},
|
|
5151
5255
|
"email.identity.verify": { type: "email", identity: "founder@example.com" },
|
|
5152
5256
|
"email.identity.create": {
|
|
5153
5257
|
type: "domain",
|
|
@@ -5996,6 +6100,22 @@ export const responseExamples: Record<string, unknown> = {
|
|
|
5996
6100
|
data: { name: "Acme", website: "acme.com" },
|
|
5997
6101
|
},
|
|
5998
6102
|
"enrichment.person.contact": { enrichmentId: "job_123", status: "queued" },
|
|
6103
|
+
"enrichment.profiles.bulk": {
|
|
6104
|
+
kind: "companies",
|
|
6105
|
+
records: [{ inputIndex: 0, data: { name: "Acme", website: "acme.com" } }],
|
|
6106
|
+
billing: { charged_cents: 3 },
|
|
6107
|
+
},
|
|
6108
|
+
"enrichment.company.related": {
|
|
6109
|
+
kind: "founders",
|
|
6110
|
+
items: [
|
|
6111
|
+
{
|
|
6112
|
+
fullName: "Jane Doe",
|
|
6113
|
+
linkedinUrl: "https://www.linkedin.com/in/janedoe",
|
|
6114
|
+
},
|
|
6115
|
+
],
|
|
6116
|
+
metadata: { total: 1 },
|
|
6117
|
+
billing: { charged_cents: 1 },
|
|
6118
|
+
},
|
|
5999
6119
|
"email.identity.verify": {
|
|
6000
6120
|
ok: true,
|
|
6001
6121
|
identity: "example.com",
|
|
@@ -250,6 +250,8 @@ export const APP_SDK_OPERATIONS: readonly AppSdkOperationInfo[] = [
|
|
|
250
250
|
{"id":"enrichment.person","group":"crm","summary":"Look up one person profile.","cli":"dench crm enrich cell","method":"POST","path":"/enrichment/person","permission":"crm:write","pathParams":[]},
|
|
251
251
|
{"id":"enrichment.company","group":"crm","summary":"Look up one company profile.","cli":"dench crm enrich cell","method":"POST","path":"/enrichment/company","permission":"crm:write","pathParams":[]},
|
|
252
252
|
{"id":"enrichment.person.contact","group":"crm","summary":"Look up verified emails and phones for people.","cli":"dench crm enrich cell","method":"POST","path":"/enrichment/person/contact","permission":"crm:write","pathParams":[]},
|
|
253
|
+
{"id":"enrichment.profiles.bulk","group":"crm","summary":"Look up up to 100 people or company profiles without buying emails or phones. Pass kind (people|companies) and lookups; results preserve inputIndex. People require linkedinUrl or email; companies require domain or linkedinUrl.","cli":"dench crm enrich profiles","method":"POST","path":"/enrichment/profiles/bulk","permission":"crm:write","pathParams":[]},
|
|
254
|
+
{"id":"enrichment.company.related","group":"crm","summary":"Read company employees, founders, funding, investors, acquisitions, or investments. Pass domain or linkedinUrl, kind, limit (1–100), and optional pageToken. Does not import CRM records or buy contacts.","cli":"dench companies related","method":"POST","path":"/enrichment/company/related","permission":"crm:read","pathParams":[]},
|
|
253
255
|
{"id":"enrichment.search.preview","group":"crm","summary":"Preview how many records a find would return.","cli":"dench leads find --limit 1","method":"POST","path":"/enrichment/search/preview","permission":"crm:read","pathParams":[]},
|
|
254
256
|
{"id":"crm.templates.list","group":"crm","summary":"List one-click CRM templates (objects + automations + sample rows) with per-workspace installed flags.","cli":"dench crm templates list","method":"GET","path":"/crm/templates","permission":"crm:read","pathParams":[]},
|
|
255
257
|
{"id":"crm.templates.install","group":"crm","summary":"Install a CRM template. Idempotent: re-installs top up missing pieces and never duplicate objects, automations, or sample rows.","cli":"dench crm templates install","method":"POST","path":"/crm/templates/{templateId}/install","permission":"crm:write","pathParams":["templateId"]},
|
package/lib/app-sdk-surface.ts
CHANGED
|
@@ -1403,6 +1403,7 @@ export const READ_OPERATION_OVERRIDES = new Set<string>([
|
|
|
1403
1403
|
"crm.companies.search",
|
|
1404
1404
|
"enrichment.jobs.search",
|
|
1405
1405
|
"enrichment.search.preview",
|
|
1406
|
+
"enrichment.company.related",
|
|
1406
1407
|
"search.web",
|
|
1407
1408
|
"search.contents",
|
|
1408
1409
|
"search.answer",
|
package/lib/command-registry.ts
CHANGED
|
@@ -2357,6 +2357,30 @@ const rawApiOperations = [
|
|
|
2357
2357
|
responseSchema: anyResponse,
|
|
2358
2358
|
backend: gateway("POST", "/enrichment/person/contact"),
|
|
2359
2359
|
}),
|
|
2360
|
+
op({
|
|
2361
|
+
id: "enrichment.profiles.bulk",
|
|
2362
|
+
group: "crm",
|
|
2363
|
+
summary:
|
|
2364
|
+
"Look up up to 100 people or company profiles without buying emails or phones. Pass kind (people|companies) and lookups; results preserve inputIndex. People require linkedinUrl or email; companies require domain or linkedinUrl.",
|
|
2365
|
+
cli: "dench crm enrich profiles",
|
|
2366
|
+
method: "POST",
|
|
2367
|
+
path: "/enrichment/profiles/bulk",
|
|
2368
|
+
requestSchema: anyObject,
|
|
2369
|
+
responseSchema: anyResponse,
|
|
2370
|
+
backend: gateway("POST", "/enrichment/profiles/bulk"),
|
|
2371
|
+
}),
|
|
2372
|
+
op({
|
|
2373
|
+
id: "enrichment.company.related",
|
|
2374
|
+
group: "crm",
|
|
2375
|
+
summary:
|
|
2376
|
+
"Read company employees, founders, funding, investors, acquisitions, or investments. Pass domain or linkedinUrl, kind, limit (1–100), and optional pageToken. Does not import CRM records or buy contacts.",
|
|
2377
|
+
cli: "dench companies related",
|
|
2378
|
+
method: "POST",
|
|
2379
|
+
path: "/enrichment/company/related",
|
|
2380
|
+
requestSchema: anyObject,
|
|
2381
|
+
responseSchema: anyResponse,
|
|
2382
|
+
backend: gateway("POST", "/enrichment/company/related"),
|
|
2383
|
+
}),
|
|
2360
2384
|
op({
|
|
2361
2385
|
id: "enrichment.search.preview",
|
|
2362
2386
|
group: "crm",
|
|
@@ -94,6 +94,7 @@ export type SearchPeopleBody = {
|
|
|
94
94
|
companyNames?: SearchFilterItem[];
|
|
95
95
|
pastCompanyNames?: SearchFilterItem[];
|
|
96
96
|
companyDomains?: SearchFilterItem[];
|
|
97
|
+
companyScope?: { domains?: string[]; names?: string[] };
|
|
97
98
|
companyHeadquarters?: SearchFilterItem[];
|
|
98
99
|
companyTypes?: SearchFilterItem[];
|
|
99
100
|
universities?: SearchFilterItem[];
|
|
@@ -241,6 +242,7 @@ function mapRequiredFieldsToEnrichFields(rf?: string[]): EnrichField[] {
|
|
|
241
242
|
|
|
242
243
|
export type ApolloPersonEnvelope = {
|
|
243
244
|
person: {
|
|
245
|
+
search_match?: { derivedFields: string[]; basis: "current_title" };
|
|
244
246
|
name?: string;
|
|
245
247
|
first_name?: string;
|
|
246
248
|
last_name?: string;
|
|
@@ -267,6 +269,7 @@ export type ApolloPersonEnvelope = {
|
|
|
267
269
|
};
|
|
268
270
|
|
|
269
271
|
type EnrichedPersonUpsertLike = {
|
|
272
|
+
searchMatch?: { derivedFields: string[]; basis: "current_title" };
|
|
270
273
|
fullName?: string;
|
|
271
274
|
firstName?: string;
|
|
272
275
|
lastName?: string;
|
|
@@ -296,6 +299,7 @@ function shapePersonToApolloEnvelope(
|
|
|
296
299
|
const companyWebsite = u.currentCompanyWebsite;
|
|
297
300
|
return {
|
|
298
301
|
person: {
|
|
302
|
+
...(u.searchMatch ? { search_match: u.searchMatch } : {}),
|
|
299
303
|
name: u.fullName,
|
|
300
304
|
first_name: u.firstName,
|
|
301
305
|
last_name: u.lastName,
|
|
@@ -365,6 +369,8 @@ type EnrichedCompanyUpsertLike = {
|
|
|
365
369
|
totalFunding?: number;
|
|
366
370
|
description?: string;
|
|
367
371
|
hqAddress?: {
|
|
372
|
+
line1?: string;
|
|
373
|
+
line2?: string;
|
|
368
374
|
city?: string;
|
|
369
375
|
region?: string;
|
|
370
376
|
country?: string;
|
|
@@ -378,7 +384,7 @@ function shapeCompanyToApolloEnvelope(
|
|
|
378
384
|
const hq = c.hqAddress;
|
|
379
385
|
const city = hq?.city;
|
|
380
386
|
const country = hq?.country ?? hq?.countryCode;
|
|
381
|
-
const hqLocationParts = [city, country].filter(
|
|
387
|
+
const hqLocationParts = [city ?? hq?.line1, hq?.region, country].filter(
|
|
382
388
|
(v): v is string => typeof v === "string" && v.length > 0,
|
|
383
389
|
);
|
|
384
390
|
return {
|
|
@@ -399,7 +405,10 @@ function shapeCompanyToApolloEnvelope(
|
|
|
399
405
|
hq_country: hq?.country,
|
|
400
406
|
hq_country_code: hq?.countryCode,
|
|
401
407
|
hq_location:
|
|
402
|
-
|
|
408
|
+
hq?.line2?.trim() ||
|
|
409
|
+
(hqLocationParts.length > 0
|
|
410
|
+
? [...new Set(hqLocationParts)].join(", ")
|
|
411
|
+
: undefined),
|
|
403
412
|
},
|
|
404
413
|
};
|
|
405
414
|
}
|
|
@@ -464,9 +473,20 @@ export async function enrichPerson(
|
|
|
464
473
|
// Cache hit: shape and return immediately.
|
|
465
474
|
const cachedResults = personContactResp.cachedResults ?? [];
|
|
466
475
|
if (cachedResults.length > 0) {
|
|
467
|
-
const hit = cachedResults[0] as EnrichedPersonUpsertLike
|
|
476
|
+
const hit = cachedResults[0] as EnrichedPersonUpsertLike & {
|
|
477
|
+
error?: { message: string; code: string };
|
|
478
|
+
source?: string;
|
|
479
|
+
warnings?: string[];
|
|
480
|
+
};
|
|
481
|
+
if (hit.error)
|
|
482
|
+
throw new EnrichmentGatewayError(hit.error.message, {
|
|
483
|
+
code: hit.error.code,
|
|
484
|
+
});
|
|
468
485
|
return {
|
|
469
|
-
_meta: {
|
|
486
|
+
_meta: {
|
|
487
|
+
cacheHit: hit.source !== "live",
|
|
488
|
+
...(hit.warnings?.length ? { warnings: hit.warnings } : {}),
|
|
489
|
+
},
|
|
470
490
|
...shapePersonToApolloEnvelope(hit),
|
|
471
491
|
} as Record<string, unknown>;
|
|
472
492
|
}
|
|
@@ -628,7 +648,14 @@ async function submitContactBulkChunk(
|
|
|
628
648
|
const resp = raw as {
|
|
629
649
|
enrichmentId?: string | null;
|
|
630
650
|
status?: string;
|
|
631
|
-
cachedResults?: Array<
|
|
651
|
+
cachedResults?: Array<
|
|
652
|
+
EnrichedPersonUpsertLike & {
|
|
653
|
+
inputIndex?: number;
|
|
654
|
+
source?: string;
|
|
655
|
+
error?: { message: string; code: string };
|
|
656
|
+
warnings?: string[];
|
|
657
|
+
}
|
|
658
|
+
>;
|
|
632
659
|
queuedCount?: number;
|
|
633
660
|
};
|
|
634
661
|
|
|
@@ -637,13 +664,29 @@ async function submitContactBulkChunk(
|
|
|
637
664
|
const cached = resp.cachedResults ?? [];
|
|
638
665
|
const seenIndexes = new Set<number>();
|
|
639
666
|
for (const hit of cached) {
|
|
640
|
-
|
|
667
|
+
// Gateway inputIndex is chunk-local; callers may have global indexes.
|
|
668
|
+
const idx =
|
|
669
|
+
typeof hit.inputIndex === "number"
|
|
670
|
+
? contacts[hit.inputIndex]?.inputIndex
|
|
671
|
+
: undefined;
|
|
641
672
|
if (idx === undefined) continue;
|
|
642
673
|
seenIndexes.add(idx);
|
|
674
|
+
if (hit.error) {
|
|
675
|
+
results.set(idx, {
|
|
676
|
+
ok: false,
|
|
677
|
+
error: new EnrichmentGatewayError(hit.error.message, {
|
|
678
|
+
code: hit.error.code,
|
|
679
|
+
}),
|
|
680
|
+
});
|
|
681
|
+
continue;
|
|
682
|
+
}
|
|
643
683
|
results.set(idx, {
|
|
644
684
|
ok: true,
|
|
645
685
|
data: {
|
|
646
|
-
_meta: {
|
|
686
|
+
_meta: {
|
|
687
|
+
cacheHit: hit.source !== "live",
|
|
688
|
+
...(hit.warnings?.length ? { warnings: hit.warnings } : {}),
|
|
689
|
+
},
|
|
647
690
|
...shapePersonToApolloEnvelope(hit),
|
|
648
691
|
},
|
|
649
692
|
});
|
|
@@ -1138,6 +1181,45 @@ export async function enrichCompany(
|
|
|
1138
1181
|
}
|
|
1139
1182
|
|
|
1140
1183
|
// ---------------------------------------------------------------------------
|
|
1184
|
+
export async function enrichProfiles(
|
|
1185
|
+
body: { kind: "people" | "companies"; lookups: Record<string, unknown>[] },
|
|
1186
|
+
options: EnrichmentGatewayOptions = {},
|
|
1187
|
+
): Promise<Record<string, unknown>> {
|
|
1188
|
+
if (body.lookups.length < 1 || body.lookups.length > 100)
|
|
1189
|
+
throw new EnrichmentGatewayError("Provide 1–100 profile lookups.", {
|
|
1190
|
+
code: "invalid_request",
|
|
1191
|
+
});
|
|
1192
|
+
return callGatewayJson("/v1/enrichment/profiles/bulk", {
|
|
1193
|
+
method: "POST",
|
|
1194
|
+
body,
|
|
1195
|
+
options,
|
|
1196
|
+
}) as Promise<Record<string, unknown>>;
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
export type CompanyRelatedKind =
|
|
1200
|
+
| "employees"
|
|
1201
|
+
| "founders"
|
|
1202
|
+
| "funding"
|
|
1203
|
+
| "investors"
|
|
1204
|
+
| "acquisitions"
|
|
1205
|
+
| "investments";
|
|
1206
|
+
export async function companyRelatedRecords(
|
|
1207
|
+
body: {
|
|
1208
|
+
domain?: string;
|
|
1209
|
+
linkedinUrl?: string;
|
|
1210
|
+
kind: CompanyRelatedKind;
|
|
1211
|
+
limit?: number;
|
|
1212
|
+
pageToken?: string;
|
|
1213
|
+
},
|
|
1214
|
+
options: EnrichmentGatewayOptions = {},
|
|
1215
|
+
): Promise<Record<string, unknown>> {
|
|
1216
|
+
return callGatewayJson("/v1/enrichment/company/related", {
|
|
1217
|
+
method: "POST",
|
|
1218
|
+
body,
|
|
1219
|
+
options,
|
|
1220
|
+
}) as Promise<Record<string, unknown>>;
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1141
1223
|
// Person profile — POST /v1/enrichment/person (synchronous waterfall)
|
|
1142
1224
|
// ---------------------------------------------------------------------------
|
|
1143
1225
|
|
|
@@ -1370,6 +1452,7 @@ export function buildPeopleSearchRequest(
|
|
|
1370
1452
|
}
|
|
1371
1453
|
|
|
1372
1454
|
const keywords = body.keywords ?? body.qKeywords;
|
|
1455
|
+
if (body.companyScope) payload.companyScope = body.companyScope;
|
|
1373
1456
|
if (keywords) payload.keywords = keywords;
|
|
1374
1457
|
if (body.limit !== undefined) payload.limit = body.limit;
|
|
1375
1458
|
else if (body.perPage !== undefined) payload.limit = body.perPage;
|