@dench.com/cli 3.2.1-staging.295 → 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/README.md CHANGED
@@ -204,8 +204,12 @@ dench signin --host https://staging.dench.com
204
204
  ## Saved prospect lists
205
205
 
206
206
  People found with `dench leads find` stay in saved lists, not the CRM.
207
- The lead-finding skill establishes `/workspace/ICP.md` on first use and
208
- reads it before later searches. There is no mandatory per-profile ICP decision.
207
+ For new prospect discovery, the lead-finding skill establishes a general
208
+ `/workspace/ICP.md` on first use and reads it before later prospect searches.
209
+ Campaign filters, dates, and counts stay with the search; the current request
210
+ overrides general preferences. Existing-list actions do not restart ICP setup.
211
+ Ordinary web, company, or hiring research does not require lead-finding or ICP
212
+ questions, reads, or scoring. There is no mandatory per-profile ICP decision.
209
213
  In Find, click **Find** in a Work email, Phone, or Personal email cell to
210
214
  request that field. The control discloses credit use; the lookup starts directly.
211
215
  Different people run concurrently; wait for a person's current lookup before
@@ -230,8 +234,9 @@ unchanged. Optional `--filters-json` stores criteria/source evidence metadata.
230
234
  In chat, explicitly present the final list; research batches stay in activity
231
235
  details instead of becoming competing result sets.
232
236
 
233
- Before presenting a shortlist, the skill saves an ICP relevance score (0–100)
234
- and short reason for each profile using the confirmed brief. These appear as
237
+ Before presenting a prospect shortlist, the skill saves an ICP relevance score
238
+ (0–100) and short reason for each profile against that search's resolved criteria,
239
+ using the general brief as relevant guidance. These appear as
235
240
  **ICP fit** and **Why this lead** in Find and in CSV exports. Scores are not
236
241
  conversion probabilities or CRM statuses. To save assessments for canonical
237
242
  rows returned by `lists rows`, create a JSON array of
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
- /** Look up one company profile. (`dench crm enrich cell`) */
6469
- company(args: Req<"enrichment.company">): Promise<Res<"enrichment.company">>;
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.
@@ -910,9 +913,7 @@ export async function runLeadsCommand(opts: {
910
913
  jobFunctions: flags.functions,
911
914
  subFunctions: flags.subFunctions,
912
915
  industries: flags.industries,
913
- organizationDomains: flags.companyDomain
914
- ? [flags.companyDomain]
915
- : undefined,
916
+ companyDomain: flags.companyDomain,
916
917
  companyDomains: mergeUnique(flags.companyDomains, companyList?.domains),
917
918
  companyNames: mergeUnique(flags.companyNames, companyList?.names),
918
919
  pastCompanyNames: flags.pastCompanyNames,
@@ -1107,6 +1108,44 @@ export async function runCompaniesCommand(opts: {
1107
1108
  companiesHelp();
1108
1109
  return;
1109
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
+ }
1110
1149
  if (verb !== "find") {
1111
1150
  throw new FindCliError(`Unknown companies verb: ${verb}`);
1112
1151
  }
@@ -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"]},
@@ -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",
@@ -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",
@@ -54,6 +54,15 @@ export type SearchFilterItem =
54
54
  export type SearchRangeFilter = { min?: number; max?: number };
55
55
 
56
56
  export type SearchPeopleBody = {
57
+ /** Canonical gateway fields. locations is the PERSON; companyHeadquarters is the employer. */
58
+ linkedinUrl?: string;
59
+ fullName?: string;
60
+ firstName?: string;
61
+ lastName?: string;
62
+ companyDomain?: string;
63
+ companyName?: string;
64
+ exactMatch?: boolean;
65
+ preferCache?: boolean;
57
66
  personTitles?: string[];
58
67
  personLocations?: string[];
59
68
  personSeniorities?: string[];
@@ -97,6 +106,8 @@ export type SearchPeopleBody = {
97
106
  };
98
107
 
99
108
  export type SearchCompaniesBody = {
109
+ exactMatch?: boolean;
110
+ preferCache?: boolean;
100
111
  domain?: string;
101
112
  name?: string;
102
113
  linkedinUrl?: string;
@@ -453,9 +464,20 @@ export async function enrichPerson(
453
464
  // Cache hit: shape and return immediately.
454
465
  const cachedResults = personContactResp.cachedResults ?? [];
455
466
  if (cachedResults.length > 0) {
456
- 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
+ });
457
476
  return {
458
- _meta: { cacheHit: true },
477
+ _meta: {
478
+ cacheHit: hit.source !== "live",
479
+ ...(hit.warnings?.length ? { warnings: hit.warnings } : {}),
480
+ },
459
481
  ...shapePersonToApolloEnvelope(hit),
460
482
  } as Record<string, unknown>;
461
483
  }
@@ -617,7 +639,14 @@ async function submitContactBulkChunk(
617
639
  const resp = raw as {
618
640
  enrichmentId?: string | null;
619
641
  status?: string;
620
- cachedResults?: Array<EnrichedPersonUpsertLike & { inputIndex?: number }>;
642
+ cachedResults?: Array<
643
+ EnrichedPersonUpsertLike & {
644
+ inputIndex?: number;
645
+ source?: string;
646
+ error?: { message: string; code: string };
647
+ warnings?: string[];
648
+ }
649
+ >;
621
650
  queuedCount?: number;
622
651
  };
623
652
 
@@ -626,13 +655,29 @@ async function submitContactBulkChunk(
626
655
  const cached = resp.cachedResults ?? [];
627
656
  const seenIndexes = new Set<number>();
628
657
  for (const hit of cached) {
629
- const idx = typeof hit.inputIndex === "number" ? hit.inputIndex : undefined;
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;
630
663
  if (idx === undefined) continue;
631
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
+ }
632
674
  results.set(idx, {
633
675
  ok: true,
634
676
  data: {
635
- _meta: { cacheHit: true },
677
+ _meta: {
678
+ cacheHit: hit.source !== "live",
679
+ ...(hit.warnings?.length ? { warnings: hit.warnings } : {}),
680
+ },
636
681
  ...shapePersonToApolloEnvelope(hit),
637
682
  },
638
683
  });
@@ -1127,6 +1172,45 @@ export async function enrichCompany(
1127
1172
  }
1128
1173
 
1129
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
+
1130
1214
  // Person profile — POST /v1/enrichment/person (synchronous waterfall)
1131
1215
  // ---------------------------------------------------------------------------
1132
1216
 
@@ -1270,13 +1354,25 @@ export async function aviatoEnrichCompany(
1270
1354
  // searchPeople — calls POST /v1/enrichment/people/search (synchronous)
1271
1355
  // ---------------------------------------------------------------------------
1272
1356
 
1273
- export async function searchPeople(
1357
+ export function buildPeopleSearchRequest(
1274
1358
  body: SearchPeopleBody,
1275
- options: EnrichmentGatewayOptions = {},
1276
- ): Promise<Record<string, unknown>> {
1359
+ ): Record<string, unknown> {
1277
1360
  // Request body matches gateway `peopleSearchRequestSchema`:
1278
1361
  // `locations`, `headcountRanges`, `titles`, `companyDomain`, etc.
1279
- const payload: Record<string, unknown> = { preferCache: true };
1362
+ const payload: Record<string, unknown> = {
1363
+ preferCache: body.preferCache ?? true,
1364
+ };
1365
+ for (const key of [
1366
+ "linkedinUrl",
1367
+ "fullName",
1368
+ "firstName",
1369
+ "lastName",
1370
+ "companyDomain",
1371
+ "companyName",
1372
+ "exactMatch",
1373
+ ] as const) {
1374
+ if (body[key] !== undefined) payload[key] = body[key];
1375
+ }
1280
1376
 
1281
1377
  const mergeItems = (
1282
1378
  legacy: string[] | undefined,
@@ -1291,14 +1387,17 @@ export async function searchPeople(
1291
1387
  const titles = mergeItems(body.personTitles, body.titles);
1292
1388
  if (titles.length > 0) payload.titles = titles;
1293
1389
 
1294
- const locations = mergeItems(
1295
- [...(body.personLocations ?? []), ...(body.organizationLocations ?? [])],
1296
- body.locations,
1297
- );
1390
+ const locations = mergeItems(body.personLocations, body.locations);
1298
1391
  if (locations.length > 0) payload.locations = locations;
1299
1392
 
1300
- if (body.organizationDomains && body.organizationDomains.length > 0) {
1301
- payload.companyDomain = body.organizationDomains[0];
1393
+ const headquarters = mergeItems(
1394
+ body.organizationLocations,
1395
+ body.companyHeadquarters,
1396
+ );
1397
+ if (headquarters.length) payload.companyHeadquarters = headquarters;
1398
+ const domains = mergeItems(body.organizationDomains, body.companyDomains);
1399
+ if (domains.length) {
1400
+ payload.companyDomains = domains;
1302
1401
  }
1303
1402
 
1304
1403
  const headcountRanges = mergeItems(
@@ -1321,8 +1420,6 @@ export async function searchPeople(
1321
1420
  "subFunctions",
1322
1421
  "companyNames",
1323
1422
  "pastCompanyNames",
1324
- "companyDomains",
1325
- "companyHeadquarters",
1326
1423
  "companyTypes",
1327
1424
  "universities",
1328
1425
  "skills",
@@ -1350,12 +1447,22 @@ export async function searchPeople(
1350
1447
  if (body.limit !== undefined) payload.limit = body.limit;
1351
1448
  else if (body.perPage !== undefined) payload.limit = body.perPage;
1352
1449
  if (body.offset !== undefined) payload.offset = body.offset;
1450
+ else if (body.page !== undefined && body.page > 1) {
1451
+ payload.offset = (body.page - 1) * (body.limit ?? body.perPage ?? 10);
1452
+ }
1353
1453
  if (body.searchAfter !== undefined) payload.searchAfter = body.searchAfter;
1354
1454
  if (body.pageToken) payload.pageToken = body.pageToken;
1355
1455
 
1456
+ return payload;
1457
+ }
1458
+
1459
+ export async function searchPeople(
1460
+ body: SearchPeopleBody,
1461
+ options: EnrichmentGatewayOptions = {},
1462
+ ): Promise<Record<string, unknown>> {
1356
1463
  return callGatewayJson("/v1/enrichment/people/search", {
1357
1464
  method: "POST",
1358
- body: payload,
1465
+ body: buildPeopleSearchRequest(body),
1359
1466
  options,
1360
1467
  });
1361
1468
  }
@@ -1364,7 +1471,10 @@ export async function searchCompanies(
1364
1471
  body: SearchCompaniesBody,
1365
1472
  options: EnrichmentGatewayOptions = {},
1366
1473
  ): Promise<Record<string, unknown>> {
1367
- const payload: Record<string, unknown> = { preferCache: true };
1474
+ const payload: Record<string, unknown> = {
1475
+ preferCache: body.preferCache ?? true,
1476
+ };
1477
+ if (body.exactMatch !== undefined) payload.exactMatch = body.exactMatch;
1368
1478
  if (body.domain) payload.domain = body.domain;
1369
1479
  if (body.name) payload.name = body.name;
1370
1480
  if (body.linkedinUrl) payload.linkedinUrl = body.linkedinUrl;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dench.com/cli",
3
- "version": "3.2.1-staging.295",
3
+ "version": "3.2.2-staging.305",
4
4
  "description": "Dench agent workspace CLI.",
5
5
  "type": "module",
6
6
  "bin": {