@dench.com/cli 3.12.30-staging.1461 → 3.12.32-staging.1473
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 +412 -3
- package/crm-columns.ts +982 -0
- package/crm.ts +40 -5
- package/dench.ts +15 -9
- package/environments.ts +48 -8
- package/leads.ts +204 -40
- package/lib/api-schemas.ts +12 -1
- package/lib/app-sdk-catalog.generated.ts +18 -1
- package/lib/app-sdk-surface.ts +3 -0
- package/lib/command-registry.ts +655 -2
- package/lib/references.generated.json +6 -6
- package/members.ts +7 -6
- package/package.json +2 -1
package/crm.ts
CHANGED
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
import type { ConvexHttpClient } from "convex/browser";
|
|
34
34
|
import { makeFunctionReference } from "convex/server";
|
|
35
35
|
import { runAnalyticsCommand } from "./crm-analytics";
|
|
36
|
+
import { runColumnsCommand } from "./crm-columns";
|
|
36
37
|
import {
|
|
37
38
|
runActivityCommand,
|
|
38
39
|
runBriefCommand,
|
|
@@ -1152,23 +1153,34 @@ const api = {
|
|
|
1152
1153
|
|
|
1153
1154
|
/** These read commands have local, command-specific help (no runtime needed). */
|
|
1154
1155
|
export function isCrmReadHelpRequest(args: readonly string[]): boolean {
|
|
1155
|
-
const
|
|
1156
|
-
|
|
1156
|
+
const filtered = args.filter((arg) => arg !== "--json");
|
|
1157
|
+
const command = filtered[0];
|
|
1158
|
+
if (
|
|
1157
1159
|
(command === "query" || command === "aggregate") &&
|
|
1158
|
-
(
|
|
1160
|
+
(filtered.includes("--help") || filtered.includes("-h"))
|
|
1161
|
+
) {
|
|
1162
|
+
return true;
|
|
1163
|
+
}
|
|
1164
|
+
return (
|
|
1165
|
+
command === "columns" &&
|
|
1166
|
+
(filtered.length === 1 ||
|
|
1167
|
+
filtered[1] === "help" ||
|
|
1168
|
+
filtered.includes("--help") ||
|
|
1169
|
+
filtered.includes("-h"))
|
|
1159
1170
|
);
|
|
1160
1171
|
}
|
|
1161
1172
|
|
|
1162
1173
|
export async function runCrmCommand(opts: {
|
|
1163
1174
|
convex: ConvexHttpClient;
|
|
1164
1175
|
args: string[];
|
|
1176
|
+
jsonOutput?: boolean;
|
|
1165
1177
|
sessionToken?: string;
|
|
1166
1178
|
enrichmentGateway?: Pick<EnrichmentGatewayOptions, "apiKey" | "baseUrl">;
|
|
1167
1179
|
host?: string;
|
|
1168
1180
|
workspaceSlug?: string;
|
|
1169
1181
|
}): Promise<void> {
|
|
1170
1182
|
const args = [...opts.args];
|
|
1171
|
-
const jsonOutput = hasFlag(args, "--json");
|
|
1183
|
+
const jsonOutput = hasFlag(args, "--json") || Boolean(opts.jsonOutput);
|
|
1172
1184
|
const ctx: CrmCliContext = {
|
|
1173
1185
|
convex: opts.convex,
|
|
1174
1186
|
args,
|
|
@@ -1193,10 +1205,12 @@ export async function runCrmCommand(opts: {
|
|
|
1193
1205
|
Default limit: 100. Maximum: 1000 for a one-shot array, 100 for a cursor page.
|
|
1194
1206
|
Continue cursor pages until isDone, including empty filtered pages.
|
|
1195
1207
|
Example: dench crm query company --where '{"Status":"New"}' --select Name --limit 25 --json`);
|
|
1196
|
-
} else {
|
|
1208
|
+
} else if (subcommand === "aggregate") {
|
|
1197
1209
|
console.log(`Usage: dench crm aggregate <object> --field <Field> [--sum <NumberField>] [--json]
|
|
1198
1210
|
Count rows per value of --field. --sum also totals a number field within each bucket.
|
|
1199
1211
|
Example: dench crm aggregate deal --field Stage --sum Amount --json`);
|
|
1212
|
+
} else if (subcommand === "columns") {
|
|
1213
|
+
return await runColumnsCommand(ctx);
|
|
1200
1214
|
}
|
|
1201
1215
|
return;
|
|
1202
1216
|
}
|
|
@@ -1259,6 +1273,8 @@ Example: dench crm aggregate deal --field Stage --sum Amount --json`);
|
|
|
1259
1273
|
return await runReportsCommand(ctx);
|
|
1260
1274
|
case "analytics":
|
|
1261
1275
|
return await runAnalyticsCommand(ctx);
|
|
1276
|
+
case "columns":
|
|
1277
|
+
return await runColumnsCommand(ctx);
|
|
1262
1278
|
case "detections":
|
|
1263
1279
|
return await runDetectionsCommand(ctx);
|
|
1264
1280
|
case "privacy":
|
|
@@ -1323,6 +1339,7 @@ const CRM_SUBCOMMANDS = [
|
|
|
1323
1339
|
"enrich",
|
|
1324
1340
|
"reports",
|
|
1325
1341
|
"analytics",
|
|
1342
|
+
"columns",
|
|
1326
1343
|
"detections",
|
|
1327
1344
|
"privacy",
|
|
1328
1345
|
"docs",
|
|
@@ -5812,6 +5829,24 @@ Analytics (the dashboard strip above every object table — same math the UI dra
|
|
|
5812
5829
|
default either way.
|
|
5813
5830
|
Deep link: /?path=<object>&analytics=1[&view=<view>][&analyticsPeriod=<period>]
|
|
5814
5831
|
|
|
5832
|
+
Columns (staging lists + cited AI Research columns — 2 AI credits/row, zero autorun):
|
|
5833
|
+
dench crm columns lists [--json]
|
|
5834
|
+
dench crm columns create-list <displayName> [--entity-kind company|person] [--json]
|
|
5835
|
+
dench crm columns delete-list <objectName> [--json]
|
|
5836
|
+
dench crm columns summary <object> [--json]
|
|
5837
|
+
dench crm columns create-ai <object> <name> --prompt <text> --output-kind fit_check|text|enum|number|url [--enum-values '<JSON>'] [--description <text>] [--required-input-fields <ids>] [--json]
|
|
5838
|
+
dench crm columns update-ai <object> <field> [--prompt <text>] [--enum-values '<JSON>'] [--description <text>] [--required-input-fields <ids>] [--json]
|
|
5839
|
+
dench crm columns delete-ai <object> <field> [--json]
|
|
5840
|
+
dench crm columns estimate-run <object> <field> --scope selected|empty|all [--entry-ids <id1,id2>] [--include-unknown-and-failed|--no-include-unknown-and-failed] [--limit <1..2000>] [--json]
|
|
5841
|
+
dench crm columns start-run <object> <field> --scope selected|empty|all [--entry-ids <id1,id2>] [--include-unknown-and-failed|--no-include-unknown-and-failed] [--limit <1..2000>] [--credit-stop-ceiling <N|null>|--clear-credit-stop-ceiling] [--json]
|
|
5842
|
+
dench crm columns pause-run <runId> [--json]
|
|
5843
|
+
dench crm columns resume-run <runId> [--credit-stop-ceiling <N|null>|--clear-credit-stop-ceiling] [--json]
|
|
5844
|
+
dench crm columns stop-run <runId> [--json]
|
|
5845
|
+
dench crm columns run-status <object> [--field <field>] [--run-id <runId>] [--json]
|
|
5846
|
+
dench crm columns override-cell <object> <entryId> <field> (--value <JSON|text> | --clear) [--json]
|
|
5847
|
+
dench crm columns rerun-cell <object> <entryId> <field> [--unlock-override] [--json]
|
|
5848
|
+
dench crm columns provenance <object> --entry-ids <id1,id2> [--json]
|
|
5849
|
+
|
|
5815
5850
|
Docs:
|
|
5816
5851
|
dench crm docs list
|
|
5817
5852
|
dench crm docs create <path> [--title ...] [--icon ...] [--link-entry <id>]
|
package/dench.ts
CHANGED
|
@@ -484,17 +484,17 @@ Usage:
|
|
|
484
484
|
dench artifacts [--limit 25] [--json]
|
|
485
485
|
dench artifacts list [--limit 25] [--json]
|
|
486
486
|
dench artifacts show <id> [--json]
|
|
487
|
-
dench artifacts import <id> --to lead|company|job_posting [--view "Q3 outbound"] [--pin] [--json]
|
|
487
|
+
dench artifacts import <id> --to lead|company|job_posting|<list_slug> [--view "Q3 outbound"] [--pin] [--json]
|
|
488
488
|
dench lists [--limit 25] [--json]
|
|
489
489
|
dench lists show <id> [--json]
|
|
490
490
|
dench lists save --title "Shortlist" --people-file <people.json> [--json]
|
|
491
491
|
dench lists rename <id> "New name" [--json]
|
|
492
492
|
dench lists update <id> [--title "New name"] [--filters-json '{...}'] [--json]
|
|
493
493
|
dench lists delete <id> [--json]
|
|
494
|
-
dench leads find --titles "VP Sales" [--locations "San Francisco"] [--save-as "Q3 targets"] [--limit 500] [--page-token <token>] [--json] (rich filters: dench leads help)
|
|
494
|
+
dench leads find --titles "VP Sales" [--company-list <ref> [--fit-only]] [--into-list "Q3 targets"] [--locations "San Francisco"] [--save-as "Q3 targets"] [--limit 500] [--page-token <token>] [--json] (rich filters: dench leads help)
|
|
495
495
|
dench leads filters [--filter titles|locations|company-hq|...] [--search "query"] [--json]
|
|
496
|
-
dench companies find --name "Acme" [--domain acme.com] [--keywords fintech] [--save-as "Target accounts"] [--limit 500] [--page-token <token>] [--json]
|
|
497
|
-
dench jobs find --titles "Account Executive" [--locations "San Francisco"] [--save-as "AE openings"] [--limit 500] [--page-token <token>] [--json]
|
|
496
|
+
dench companies find --name "Acme" [--domain acme.com] [--keywords fintech] [--into-list "Target accounts"] [--save-as "Target accounts"] [--limit 500] [--page-token <token>] [--json]
|
|
497
|
+
dench jobs find --titles "Account Executive" [--company-list <ref> [--fit-only]] [--locations "San Francisco"] [--save-as "AE openings"] [--limit 500] [--page-token <token>] [--json]
|
|
498
498
|
dench suggested-work [--json]
|
|
499
499
|
dench billing status [--json]
|
|
500
500
|
dench billing topup --amount 5 [--no-open] [--json]
|
|
@@ -747,7 +747,7 @@ function leadsHelp() {
|
|
|
747
747
|
console.log(`Dench leads
|
|
748
748
|
|
|
749
749
|
Usage:
|
|
750
|
-
dench leads find --titles "VP Sales" --locations "San Francisco" [--company-domain acme.com] [--keywords fintech] [--save-as "Q3 targets"] [--limit 500] [--page-token <token>] [--json]
|
|
750
|
+
dench leads find --titles "VP Sales" --locations "San Francisco" [--company-list <ref> [--fit-only]] [--into-list "Q3 targets"] [--company-domain acme.com] [--keywords fintech] [--save-as "Q3 targets"] [--limit 500] [--page-token <token>] [--json]
|
|
751
751
|
dench leads filters [--filter titles|locations|company-hq|universities|skills|keywords|...] [--search "query"] [--json]
|
|
752
752
|
|
|
753
753
|
Rich filter flags: --past-titles --person-names --seniorities --functions
|
|
@@ -763,7 +763,7 @@ function companiesHelp() {
|
|
|
763
763
|
console.log(`Dench companies
|
|
764
764
|
|
|
765
765
|
Usage:
|
|
766
|
-
dench companies find --name "Acme" [--domain acme.com] [--keywords fintech] [--industries SaaS] [--locations "San Francisco"] [--save-as "Target accounts"] [--limit 500] [--page-token <token>] [--json]
|
|
766
|
+
dench companies find --name "Acme" [--domain acme.com] [--keywords fintech] [--industries SaaS] [--locations "San Francisco"] [--into-list "Target accounts"] [--save-as "Target accounts"] [--limit 500] [--page-token <token>] [--json]
|
|
767
767
|
`);
|
|
768
768
|
}
|
|
769
769
|
|
|
@@ -771,7 +771,7 @@ function jobsHelp() {
|
|
|
771
771
|
console.log(`Dench jobs
|
|
772
772
|
|
|
773
773
|
Usage:
|
|
774
|
-
dench jobs find --titles "Account Executive" --locations "San Francisco" [--company-domain acme.com] [--keywords remote] [--save-as "AE openings"] [--limit 500] [--page-token <token>] [--json]
|
|
774
|
+
dench jobs find --titles "Account Executive" --locations "San Francisco" [--company-list <ref> [--fit-only]] [--company-domain acme.com] [--keywords remote] [--save-as "AE openings"] [--limit 500] [--page-token <token>] [--json]
|
|
775
775
|
`);
|
|
776
776
|
}
|
|
777
777
|
|
|
@@ -4711,8 +4711,12 @@ async function main() {
|
|
|
4711
4711
|
) {
|
|
4712
4712
|
// runCrmCommand only needs `convex` for actual queries; help
|
|
4713
4713
|
// doesn't touch it. Pass a minimal stub.
|
|
4714
|
-
|
|
4715
|
-
|
|
4714
|
+
await runCrmCommand({
|
|
4715
|
+
// biome-ignore lint/suspicious/noExplicitAny: harmless help-only stub
|
|
4716
|
+
convex: {} as any,
|
|
4717
|
+
args: subArgs,
|
|
4718
|
+
jsonOutput: json,
|
|
4719
|
+
});
|
|
4716
4720
|
return;
|
|
4717
4721
|
}
|
|
4718
4722
|
const runtime = await getRuntime();
|
|
@@ -4729,6 +4733,7 @@ async function main() {
|
|
|
4729
4733
|
await runCrmCommand({
|
|
4730
4734
|
convex: runtime.client,
|
|
4731
4735
|
args: subArgs,
|
|
4736
|
+
jsonOutput: json,
|
|
4732
4737
|
sessionToken: encodeDevCrmSessionToken(runtime.workspaceArgs),
|
|
4733
4738
|
host: resolveApiHost(LOCAL_HOST),
|
|
4734
4739
|
workspaceSlug: runtime.workspaceArgs.workspaceSlug,
|
|
@@ -4749,6 +4754,7 @@ async function main() {
|
|
|
4749
4754
|
await runCrmCommand({
|
|
4750
4755
|
convex: authedRuntime.client,
|
|
4751
4756
|
args: subArgs,
|
|
4757
|
+
jsonOutput: json,
|
|
4752
4758
|
sessionToken: authedRuntime.sessionToken,
|
|
4753
4759
|
host: authedRuntime.host,
|
|
4754
4760
|
workspaceSlug:
|
package/environments.ts
CHANGED
|
@@ -310,6 +310,41 @@ async function restoreState(
|
|
|
310
310
|
);
|
|
311
311
|
}
|
|
312
312
|
|
|
313
|
+
async function readStagedEnvironmentResolution(
|
|
314
|
+
resolutionFile: string,
|
|
315
|
+
parsed: { name?: string; revision?: string },
|
|
316
|
+
): Promise<ResolvedEnvironment> {
|
|
317
|
+
try {
|
|
318
|
+
const info = await lstat(resolutionFile);
|
|
319
|
+
if (info.isSymbolicLink() || !info.isFile()) {
|
|
320
|
+
throw new Error(
|
|
321
|
+
"invalid_environment_resolution: Staged environment payload must be a regular file.",
|
|
322
|
+
);
|
|
323
|
+
}
|
|
324
|
+
const resolved = JSON.parse(
|
|
325
|
+
await readFile(resolutionFile, "utf8"),
|
|
326
|
+
) as ResolvedEnvironment;
|
|
327
|
+
if (
|
|
328
|
+
!resolved ||
|
|
329
|
+
typeof resolved !== "object" ||
|
|
330
|
+
resolved.name !== parsed.name ||
|
|
331
|
+
(parsed.revision && resolved.revision !== parsed.revision) ||
|
|
332
|
+
!resolved.manifest ||
|
|
333
|
+
typeof resolved.credentialEnv !== "object" ||
|
|
334
|
+
resolved.credentialEnv === null ||
|
|
335
|
+
!Array.isArray(resolved.credentialFiles)
|
|
336
|
+
) {
|
|
337
|
+
throw new Error(
|
|
338
|
+
"invalid_environment_resolution: Staged environment payload did not match the requested revision.",
|
|
339
|
+
);
|
|
340
|
+
}
|
|
341
|
+
return resolved;
|
|
342
|
+
} finally {
|
|
343
|
+
delete process.env.DENCH_ENVIRONMENT_RESOLUTION_FILE;
|
|
344
|
+
await rm(resolutionFile, { force: true }).catch(() => undefined);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
|
|
313
348
|
async function executeSavedEnvironment(
|
|
314
349
|
opts: ClientOptions,
|
|
315
350
|
parsed: Exclude<ReturnType<typeof validateEnvironmentArgs>, { verb: "help" }>,
|
|
@@ -320,12 +355,17 @@ async function executeSavedEnvironment(
|
|
|
320
355
|
const stateKey =
|
|
321
356
|
parsed.stateKey ??
|
|
322
357
|
(job ? `job:${job}` : `local:${sha256(process.cwd()).slice(0, 32)}`);
|
|
323
|
-
const
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
358
|
+
const stagedResolutionFile =
|
|
359
|
+
process.env.DENCH_ENVIRONMENT_RESOLUTION_FILE?.trim();
|
|
360
|
+
const resolvedFromStagedFile = Boolean(stagedResolutionFile);
|
|
361
|
+
const environment = stagedResolutionFile
|
|
362
|
+
? await readStagedEnvironmentResolution(stagedResolutionFile, parsed)
|
|
363
|
+
: ((await opts.convex.action(actionRef("resolveForAdmin"), {
|
|
364
|
+
...token,
|
|
365
|
+
name: parsed.name,
|
|
366
|
+
...(parsed.revision ? { revision: parsed.revision } : {}),
|
|
367
|
+
stateKey,
|
|
368
|
+
})) as ResolvedEnvironment);
|
|
329
369
|
const suppliedWorkspace =
|
|
330
370
|
opts.execution?.workspace ?? process.env.DENCH_ENVIRONMENT_WORKSPACE;
|
|
331
371
|
const workspace =
|
|
@@ -377,12 +417,12 @@ async function executeSavedEnvironment(
|
|
|
377
417
|
? await acquireEnvironmentWorkspaceLock(workspace)
|
|
378
418
|
: undefined;
|
|
379
419
|
try {
|
|
380
|
-
if (releaseExecution) {
|
|
420
|
+
if (releaseExecution && !resolvedFromStagedFile) {
|
|
381
421
|
// Another command may have committed state or rotated credentials while
|
|
382
422
|
// this process waited. Read again under the lock, retaining this revision.
|
|
383
423
|
Object.assign(
|
|
384
424
|
environment,
|
|
385
|
-
await opts.convex.action(actionRef("
|
|
425
|
+
await opts.convex.action(actionRef("resolveForAdmin"), {
|
|
386
426
|
...token,
|
|
387
427
|
name: environment.name,
|
|
388
428
|
revision: environment.revision,
|