@dench.com/cli 3.2.1 → 3.2.2-staging.305
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/app-sdk.d.ts +60 -2
- package/crm.ts +18 -0
- package/leads.ts +41 -0
- 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 +78 -5
- package/package.json +1 -1
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.
|
|
@@ -1105,6 +1108,44 @@ export async function runCompaniesCommand(opts: {
|
|
|
1105
1108
|
companiesHelp();
|
|
1106
1109
|
return;
|
|
1107
1110
|
}
|
|
1111
|
+
if (verb === "related") {
|
|
1112
|
+
const domain = getFlag(args, "--domain");
|
|
1113
|
+
const linkedinUrl = getFlag(args, "--linkedin");
|
|
1114
|
+
const kind = getFlag(args, "--kind");
|
|
1115
|
+
const limit = parseLimit(args);
|
|
1116
|
+
const pageToken = getFlag(args, "--page-token");
|
|
1117
|
+
assertNoUnknownFlags(args, "companies related");
|
|
1118
|
+
if (Boolean(domain) === Boolean(linkedinUrl))
|
|
1119
|
+
throw new FindCliError("Provide exactly one of --domain or --linkedin.");
|
|
1120
|
+
if (
|
|
1121
|
+
!kind ||
|
|
1122
|
+
![
|
|
1123
|
+
"employees",
|
|
1124
|
+
"founders",
|
|
1125
|
+
"funding",
|
|
1126
|
+
"investors",
|
|
1127
|
+
"acquisitions",
|
|
1128
|
+
"investments",
|
|
1129
|
+
].includes(kind)
|
|
1130
|
+
)
|
|
1131
|
+
throw new FindCliError(
|
|
1132
|
+
"--kind must be employees, founders, funding, investors, acquisitions, or investments.",
|
|
1133
|
+
);
|
|
1134
|
+
if (limit !== undefined && limit > 100)
|
|
1135
|
+
throw new FindCliError("--limit must be between 1 and 100.");
|
|
1136
|
+
const result = await companyRelatedRecords(
|
|
1137
|
+
{
|
|
1138
|
+
domain,
|
|
1139
|
+
linkedinUrl,
|
|
1140
|
+
kind: kind as CompanyRelatedKind,
|
|
1141
|
+
limit,
|
|
1142
|
+
pageToken,
|
|
1143
|
+
},
|
|
1144
|
+
ctx.enrichmentGateway,
|
|
1145
|
+
);
|
|
1146
|
+
console.log(JSON.stringify(result, null, 2));
|
|
1147
|
+
return;
|
|
1148
|
+
}
|
|
1108
1149
|
if (verb !== "find") {
|
|
1109
1150
|
throw new FindCliError(`Unknown companies verb: ${verb}`);
|
|
1110
1151
|
}
|
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",
|
|
@@ -464,9 +464,20 @@ export async function enrichPerson(
|
|
|
464
464
|
// Cache hit: shape and return immediately.
|
|
465
465
|
const cachedResults = personContactResp.cachedResults ?? [];
|
|
466
466
|
if (cachedResults.length > 0) {
|
|
467
|
-
const hit = cachedResults[0] as EnrichedPersonUpsertLike
|
|
467
|
+
const hit = cachedResults[0] as EnrichedPersonUpsertLike & {
|
|
468
|
+
error?: { message: string; code: string };
|
|
469
|
+
source?: string;
|
|
470
|
+
warnings?: string[];
|
|
471
|
+
};
|
|
472
|
+
if (hit.error)
|
|
473
|
+
throw new EnrichmentGatewayError(hit.error.message, {
|
|
474
|
+
code: hit.error.code,
|
|
475
|
+
});
|
|
468
476
|
return {
|
|
469
|
-
_meta: {
|
|
477
|
+
_meta: {
|
|
478
|
+
cacheHit: hit.source !== "live",
|
|
479
|
+
...(hit.warnings?.length ? { warnings: hit.warnings } : {}),
|
|
480
|
+
},
|
|
470
481
|
...shapePersonToApolloEnvelope(hit),
|
|
471
482
|
} as Record<string, unknown>;
|
|
472
483
|
}
|
|
@@ -628,7 +639,14 @@ async function submitContactBulkChunk(
|
|
|
628
639
|
const resp = raw as {
|
|
629
640
|
enrichmentId?: string | null;
|
|
630
641
|
status?: string;
|
|
631
|
-
cachedResults?: Array<
|
|
642
|
+
cachedResults?: Array<
|
|
643
|
+
EnrichedPersonUpsertLike & {
|
|
644
|
+
inputIndex?: number;
|
|
645
|
+
source?: string;
|
|
646
|
+
error?: { message: string; code: string };
|
|
647
|
+
warnings?: string[];
|
|
648
|
+
}
|
|
649
|
+
>;
|
|
632
650
|
queuedCount?: number;
|
|
633
651
|
};
|
|
634
652
|
|
|
@@ -637,13 +655,29 @@ async function submitContactBulkChunk(
|
|
|
637
655
|
const cached = resp.cachedResults ?? [];
|
|
638
656
|
const seenIndexes = new Set<number>();
|
|
639
657
|
for (const hit of cached) {
|
|
640
|
-
|
|
658
|
+
// Gateway inputIndex is chunk-local; callers may have global indexes.
|
|
659
|
+
const idx =
|
|
660
|
+
typeof hit.inputIndex === "number"
|
|
661
|
+
? contacts[hit.inputIndex]?.inputIndex
|
|
662
|
+
: undefined;
|
|
641
663
|
if (idx === undefined) continue;
|
|
642
664
|
seenIndexes.add(idx);
|
|
665
|
+
if (hit.error) {
|
|
666
|
+
results.set(idx, {
|
|
667
|
+
ok: false,
|
|
668
|
+
error: new EnrichmentGatewayError(hit.error.message, {
|
|
669
|
+
code: hit.error.code,
|
|
670
|
+
}),
|
|
671
|
+
});
|
|
672
|
+
continue;
|
|
673
|
+
}
|
|
643
674
|
results.set(idx, {
|
|
644
675
|
ok: true,
|
|
645
676
|
data: {
|
|
646
|
-
_meta: {
|
|
677
|
+
_meta: {
|
|
678
|
+
cacheHit: hit.source !== "live",
|
|
679
|
+
...(hit.warnings?.length ? { warnings: hit.warnings } : {}),
|
|
680
|
+
},
|
|
647
681
|
...shapePersonToApolloEnvelope(hit),
|
|
648
682
|
},
|
|
649
683
|
});
|
|
@@ -1138,6 +1172,45 @@ export async function enrichCompany(
|
|
|
1138
1172
|
}
|
|
1139
1173
|
|
|
1140
1174
|
// ---------------------------------------------------------------------------
|
|
1175
|
+
export async function enrichProfiles(
|
|
1176
|
+
body: { kind: "people" | "companies"; lookups: Record<string, unknown>[] },
|
|
1177
|
+
options: EnrichmentGatewayOptions = {},
|
|
1178
|
+
): Promise<Record<string, unknown>> {
|
|
1179
|
+
if (body.lookups.length < 1 || body.lookups.length > 100)
|
|
1180
|
+
throw new EnrichmentGatewayError("Provide 1–100 profile lookups.", {
|
|
1181
|
+
code: "invalid_request",
|
|
1182
|
+
});
|
|
1183
|
+
return callGatewayJson("/v1/enrichment/profiles/bulk", {
|
|
1184
|
+
method: "POST",
|
|
1185
|
+
body,
|
|
1186
|
+
options,
|
|
1187
|
+
}) as Promise<Record<string, unknown>>;
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1190
|
+
export type CompanyRelatedKind =
|
|
1191
|
+
| "employees"
|
|
1192
|
+
| "founders"
|
|
1193
|
+
| "funding"
|
|
1194
|
+
| "investors"
|
|
1195
|
+
| "acquisitions"
|
|
1196
|
+
| "investments";
|
|
1197
|
+
export async function companyRelatedRecords(
|
|
1198
|
+
body: {
|
|
1199
|
+
domain?: string;
|
|
1200
|
+
linkedinUrl?: string;
|
|
1201
|
+
kind: CompanyRelatedKind;
|
|
1202
|
+
limit?: number;
|
|
1203
|
+
pageToken?: string;
|
|
1204
|
+
},
|
|
1205
|
+
options: EnrichmentGatewayOptions = {},
|
|
1206
|
+
): Promise<Record<string, unknown>> {
|
|
1207
|
+
return callGatewayJson("/v1/enrichment/company/related", {
|
|
1208
|
+
method: "POST",
|
|
1209
|
+
body,
|
|
1210
|
+
options,
|
|
1211
|
+
}) as Promise<Record<string, unknown>>;
|
|
1212
|
+
}
|
|
1213
|
+
|
|
1141
1214
|
// Person profile — POST /v1/enrichment/person (synchronous waterfall)
|
|
1142
1215
|
// ---------------------------------------------------------------------------
|
|
1143
1216
|
|