@dench.com/cli 2.9.1 → 2.9.2
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/crm.ts +9 -5
- package/dench.ts +49 -0
- package/lib/api-schemas.ts +81 -0
- package/lib/command-registry.ts +167 -12
- package/lib/meetings-import.ts +426 -0
- package/meetings.ts +701 -0
- package/package.json +2 -1
package/crm.ts
CHANGED
|
@@ -440,7 +440,7 @@ export function stableJsonStringify(value: unknown): string {
|
|
|
440
440
|
}
|
|
441
441
|
|
|
442
442
|
/** Count batch.apply result statuses (created / already_existed / updated). */
|
|
443
|
-
function countResultStatuses(results: unknown[]): {
|
|
443
|
+
export function countResultStatuses(results: unknown[]): {
|
|
444
444
|
created: number;
|
|
445
445
|
alreadyExisted: number;
|
|
446
446
|
updated: number;
|
|
@@ -506,7 +506,7 @@ function parseCellSetManyRows(items: unknown[]): Array<{
|
|
|
506
506
|
});
|
|
507
507
|
}
|
|
508
508
|
|
|
509
|
-
type CrmBatchOp =
|
|
509
|
+
export type CrmBatchOp =
|
|
510
510
|
| {
|
|
511
511
|
type: "entries.create";
|
|
512
512
|
objectName: string;
|
|
@@ -518,7 +518,7 @@ type CrmBatchOp =
|
|
|
518
518
|
}
|
|
519
519
|
| { type: "entries.update"; entryId: string; data: JsonRecord };
|
|
520
520
|
|
|
521
|
-
type CrmOnConflictPolicy = "skip" | "update" | "error";
|
|
521
|
+
export type CrmOnConflictPolicy = "skip" | "update" | "error";
|
|
522
522
|
|
|
523
523
|
export const CRM_OBJECT_VISIBILITY_FLAG_VALUES = [
|
|
524
524
|
"workspace",
|
|
@@ -546,7 +546,9 @@ export function parseObjectVisibilityFlag(
|
|
|
546
546
|
);
|
|
547
547
|
}
|
|
548
548
|
|
|
549
|
-
function parseOnConflictFlag(
|
|
549
|
+
export function parseOnConflictFlag(
|
|
550
|
+
raw: string | undefined,
|
|
551
|
+
): CrmOnConflictPolicy {
|
|
550
552
|
const value = raw ?? "skip";
|
|
551
553
|
if (value === "skip" || value === "update" || value === "error") {
|
|
552
554
|
return value;
|
|
@@ -573,7 +575,7 @@ function chunkIdempotencyKey(
|
|
|
573
575
|
: undefined;
|
|
574
576
|
}
|
|
575
577
|
|
|
576
|
-
async function applyBatchOpsInChunks(
|
|
578
|
+
export async function applyBatchOpsInChunks(
|
|
577
579
|
ctx: CrmCliContext,
|
|
578
580
|
ops: CrmBatchOp[],
|
|
579
581
|
idempotencyKey: string | undefined,
|
|
@@ -4421,6 +4423,8 @@ Import / export:
|
|
|
4421
4423
|
dench crm export <object> --format csv|jsonl [--limit N]
|
|
4422
4424
|
Pages with a real cursor and verifies no duplicate ids before
|
|
4423
4425
|
emitting; a summary (exportedCount/uniqueIds) is printed to stderr.
|
|
4426
|
+
For calls with transcripts / action items / attendees, use
|
|
4427
|
+
\`dench meetings import\` instead — same flags, plus the side tables.
|
|
4424
4428
|
|
|
4425
4429
|
Transactions (multi-step, all-or-nothing):
|
|
4426
4430
|
TXN=$(dench crm transaction begin)
|
package/dench.ts
CHANGED
|
@@ -543,6 +543,14 @@ CRM (Daytona-native rewrite):
|
|
|
543
543
|
Batch write helpers: entries create-many/update-many, cells set-many
|
|
544
544
|
Help: dench crm help
|
|
545
545
|
|
|
546
|
+
Meetings (CRM \`meeting\` records + their transcript, action items, attendance):
|
|
547
|
+
dench meetings list [--limit N] | get <meetingId>
|
|
548
|
+
dench meetings transcript get|set|clear <meetingId> [--text file | --jsonl file]
|
|
549
|
+
dench meetings action-items list|add|set|done|delete ...
|
|
550
|
+
dench meetings participants list|set <meetingId> [--people 'Name <email>; ...']
|
|
551
|
+
dench meetings import --csv calls.csv | --jsonl calls.jsonl [--dedupe-key <col>] [--on-conflict skip|update|error]
|
|
552
|
+
Help: dench meetings help
|
|
553
|
+
|
|
546
554
|
Notifications (the bell's inbox):
|
|
547
555
|
dench notifications list [--filter inbox|unread|archived|all] [--limit N] [--json]
|
|
548
556
|
dench notifications count | read <id> [--unread] | read-all | archive <id>
|
|
@@ -4521,6 +4529,47 @@ async function main() {
|
|
|
4521
4529
|
return;
|
|
4522
4530
|
}
|
|
4523
4531
|
|
|
4532
|
+
if (command === "meetings") {
|
|
4533
|
+
// Meetings are CRM records; this surface adds the side tables the CRM
|
|
4534
|
+
// verbs cannot reach (transcript, action items, attendance) and the
|
|
4535
|
+
// composite `import`. Same org-scoped auth shape as `dench crm`.
|
|
4536
|
+
const subArgs = stripRuntimeFlags(args.slice(args.indexOf("meetings") + 1));
|
|
4537
|
+
const sub = subArgs[0];
|
|
4538
|
+
if (!sub || sub === "help" || sub === "--help") {
|
|
4539
|
+
const { runMeetingsCommand } = await import("./meetings");
|
|
4540
|
+
// biome-ignore lint/suspicious/noExplicitAny: harmless help-only stub
|
|
4541
|
+
await runMeetingsCommand({ convex: {} as any, args: subArgs });
|
|
4542
|
+
return;
|
|
4543
|
+
}
|
|
4544
|
+
const { runMeetingsCommand } = await import("./meetings");
|
|
4545
|
+
const runtime = await getRuntime();
|
|
4546
|
+
if (runtime.mode === "dev") {
|
|
4547
|
+
await runMeetingsCommand({
|
|
4548
|
+
convex: runtime.client,
|
|
4549
|
+
args: subArgs,
|
|
4550
|
+
sessionToken: encodeDevCrmSessionToken(runtime.workspaceArgs),
|
|
4551
|
+
host: resolveApiHost(LOCAL_HOST),
|
|
4552
|
+
workspaceSlug: runtime.workspaceArgs.workspaceSlug,
|
|
4553
|
+
});
|
|
4554
|
+
return;
|
|
4555
|
+
}
|
|
4556
|
+
const authedRuntime = requireAuthenticatedRuntime(
|
|
4557
|
+
runtime,
|
|
4558
|
+
"dench meetings",
|
|
4559
|
+
);
|
|
4560
|
+
await runMeetingsCommand({
|
|
4561
|
+
convex: authedRuntime.client,
|
|
4562
|
+
args: subArgs,
|
|
4563
|
+
sessionToken: authedRuntime.sessionToken,
|
|
4564
|
+
host: authedRuntime.host,
|
|
4565
|
+
workspaceSlug:
|
|
4566
|
+
authedRuntime.organization?.slug ??
|
|
4567
|
+
process.env.DENCH_ORG_SLUG?.trim() ??
|
|
4568
|
+
undefined,
|
|
4569
|
+
});
|
|
4570
|
+
return;
|
|
4571
|
+
}
|
|
4572
|
+
|
|
4524
4573
|
if (command === "leads") {
|
|
4525
4574
|
const { runLeadsCommand, assertLeadsFindArgs, runFindFiltersCommand } =
|
|
4526
4575
|
await import("./leads");
|
package/lib/api-schemas.ts
CHANGED
|
@@ -2349,6 +2349,87 @@ export const requestSchemas: Record<string, ZodTypeAny> = {
|
|
|
2349
2349
|
"crm.tasks.complete": z.object({ entryId: z.string() }),
|
|
2350
2350
|
"crm.tasks.reopen": z.object({ entryId: z.string() }),
|
|
2351
2351
|
|
|
2352
|
+
// Meetings — the record itself is a CRM entry on `meeting`; these reach
|
|
2353
|
+
// the transcript, action-item and attendance side tables.
|
|
2354
|
+
"meetings.list": z.object({
|
|
2355
|
+
limit: z.coerce.number().int().min(1).max(100).optional(),
|
|
2356
|
+
cursor: z
|
|
2357
|
+
.string()
|
|
2358
|
+
.optional()
|
|
2359
|
+
.describe("continueCursor from the prior page."),
|
|
2360
|
+
}),
|
|
2361
|
+
"meetings.transcript.list": z.object({
|
|
2362
|
+
meetingEntryId: z.string(),
|
|
2363
|
+
limit: z.coerce.number().int().min(1).max(500).optional(),
|
|
2364
|
+
cursor: z.string().optional(),
|
|
2365
|
+
}),
|
|
2366
|
+
"meetings.transcript.append": z.object({
|
|
2367
|
+
meetingEntryId: z.string(),
|
|
2368
|
+
segments: z
|
|
2369
|
+
.array(
|
|
2370
|
+
z.object({
|
|
2371
|
+
seq: z
|
|
2372
|
+
.number()
|
|
2373
|
+
.int()
|
|
2374
|
+
.min(0)
|
|
2375
|
+
.optional()
|
|
2376
|
+
.describe("Ordinal; omitted continues after the last row."),
|
|
2377
|
+
speakerName: z.string().nullable().optional(),
|
|
2378
|
+
speakerEmail: z
|
|
2379
|
+
.string()
|
|
2380
|
+
.nullable()
|
|
2381
|
+
.optional()
|
|
2382
|
+
.describe(
|
|
2383
|
+
"Links the speaker to an existing person by exact email.",
|
|
2384
|
+
),
|
|
2385
|
+
startMs: z.number().min(0).optional(),
|
|
2386
|
+
endMs: z.number().min(0).optional(),
|
|
2387
|
+
text: z.string().min(1),
|
|
2388
|
+
}),
|
|
2389
|
+
)
|
|
2390
|
+
.min(1)
|
|
2391
|
+
.max(500),
|
|
2392
|
+
}),
|
|
2393
|
+
"meetings.transcript.clear": z.object({ meetingEntryId: z.string() }),
|
|
2394
|
+
"meetings.actionItems.list": z.object({ meetingEntryId: z.string() }),
|
|
2395
|
+
"meetings.actionItems.add": z.object({
|
|
2396
|
+
meetingEntryId: z.string(),
|
|
2397
|
+
items: z
|
|
2398
|
+
.array(
|
|
2399
|
+
z.object({
|
|
2400
|
+
text: z.string().min(1),
|
|
2401
|
+
ownerName: z.string().nullable().optional(),
|
|
2402
|
+
done: z.boolean().optional(),
|
|
2403
|
+
}),
|
|
2404
|
+
)
|
|
2405
|
+
.min(1)
|
|
2406
|
+
.max(100),
|
|
2407
|
+
replace: z.boolean().optional().describe("Delete the existing list first."),
|
|
2408
|
+
}),
|
|
2409
|
+
"meetings.actionItems.setDone": z.object({
|
|
2410
|
+
itemId: z.string(),
|
|
2411
|
+
done: z.boolean(),
|
|
2412
|
+
}),
|
|
2413
|
+
"meetings.actionItems.delete": z.object({ itemId: z.string() }),
|
|
2414
|
+
"meetings.participants.list": z.object({ meetingEntryId: z.string() }),
|
|
2415
|
+
"meetings.participants.set": z.object({
|
|
2416
|
+
meetingEntryId: z.string(),
|
|
2417
|
+
participants: z
|
|
2418
|
+
.array(
|
|
2419
|
+
z.object({
|
|
2420
|
+
name: z.string().nullable().optional(),
|
|
2421
|
+
email: z.string().nullable().optional(),
|
|
2422
|
+
isHost: z.boolean().optional(),
|
|
2423
|
+
}),
|
|
2424
|
+
)
|
|
2425
|
+
.min(1)
|
|
2426
|
+
.max(200),
|
|
2427
|
+
replace: z
|
|
2428
|
+
.boolean()
|
|
2429
|
+
.optional()
|
|
2430
|
+
.describe("Drop attendees not in this list. Default merges."),
|
|
2431
|
+
}),
|
|
2432
|
+
|
|
2352
2433
|
// Members + my profile
|
|
2353
2434
|
"members.presence": z.object({
|
|
2354
2435
|
userIds: z
|
package/lib/command-registry.ts
CHANGED
|
@@ -1792,22 +1792,18 @@ const rawApiOperations = [
|
|
|
1792
1792
|
responseSchema: anyResponse,
|
|
1793
1793
|
backend: gateway("POST", "/enrichment/people/search"),
|
|
1794
1794
|
}),
|
|
1795
|
+
// One route, two CLI spellings: `dench companies find` is the explorer's
|
|
1796
|
+
// name for the same gateway search. It used to be a second op on the same
|
|
1797
|
+
// method+path, which the API dispatcher cannot distinguish (and the
|
|
1798
|
+
// registry test rejects) — so it is an alias, like `dench leads find` is
|
|
1799
|
+
// for people.
|
|
1795
1800
|
op({
|
|
1796
1801
|
id: "crm.companies.search",
|
|
1797
1802
|
group: "crm",
|
|
1798
|
-
summary:
|
|
1803
|
+
summary:
|
|
1804
|
+
"Search for companies through the enrichment gateway (also `dench companies find`).",
|
|
1799
1805
|
cli: "dench crm companies search",
|
|
1800
|
-
|
|
1801
|
-
path: "/enrichment/company/search",
|
|
1802
|
-
requestSchema: anyObject,
|
|
1803
|
-
responseSchema: anyResponse,
|
|
1804
|
-
backend: gateway("POST", "/enrichment/company/search"),
|
|
1805
|
-
}),
|
|
1806
|
-
op({
|
|
1807
|
-
id: "enrichment.companies.search",
|
|
1808
|
-
group: "crm",
|
|
1809
|
-
summary: "Search companies through Dench find.",
|
|
1810
|
-
cli: "dench companies find",
|
|
1806
|
+
aliases: ["dench companies find"],
|
|
1811
1807
|
method: "POST",
|
|
1812
1808
|
path: "/enrichment/company/search",
|
|
1813
1809
|
requestSchema: anyObject,
|
|
@@ -1970,6 +1966,165 @@ const rawApiOperations = [
|
|
|
1970
1966
|
),
|
|
1971
1967
|
}),
|
|
1972
1968
|
|
|
1969
|
+
// Meetings. A meeting is an ordinary CRM record (`/crm/objects/meeting/…`
|
|
1970
|
+
// creates, updates and deletes it); these endpoints reach the side tables
|
|
1971
|
+
// the CRM verbs cannot — transcript, action items, attendance — so a call
|
|
1972
|
+
// imported from another notetaker gets the same tabs a recorded one has.
|
|
1973
|
+
op({
|
|
1974
|
+
id: "meetings.list",
|
|
1975
|
+
group: "meetings",
|
|
1976
|
+
summary: "List meetings, newest first, with status and participants.",
|
|
1977
|
+
cli: "dench meetings list",
|
|
1978
|
+
method: "GET",
|
|
1979
|
+
path: "/meetings",
|
|
1980
|
+
requestSchema: noBody,
|
|
1981
|
+
responseSchema: anyResponse,
|
|
1982
|
+
backend: {
|
|
1983
|
+
...convex("query", "functions/meetings/library:listMeetings"),
|
|
1984
|
+
transformArgs: (input) => ({
|
|
1985
|
+
paginationOpts: paginationOptsFrom(input, 50),
|
|
1986
|
+
}),
|
|
1987
|
+
},
|
|
1988
|
+
}),
|
|
1989
|
+
op({
|
|
1990
|
+
id: "meetings.transcript.list",
|
|
1991
|
+
group: "meetings",
|
|
1992
|
+
summary: "Read a meeting's transcript, in order, one page at a time.",
|
|
1993
|
+
cli: "dench meetings transcript get",
|
|
1994
|
+
method: "GET",
|
|
1995
|
+
path: "/meetings/{meetingEntryId}/transcript",
|
|
1996
|
+
requestSchema: noBody,
|
|
1997
|
+
responseSchema: anyResponse,
|
|
1998
|
+
backend: {
|
|
1999
|
+
...convex(
|
|
2000
|
+
"query",
|
|
2001
|
+
"functions/meetings/transcripts:listMeetingTranscript",
|
|
2002
|
+
),
|
|
2003
|
+
transformArgs: (input) => ({
|
|
2004
|
+
meetingEntryId: input.meetingEntryId,
|
|
2005
|
+
paginationOpts: paginationOptsFrom(input, 100),
|
|
2006
|
+
}),
|
|
2007
|
+
},
|
|
2008
|
+
}),
|
|
2009
|
+
op({
|
|
2010
|
+
id: "meetings.transcript.append",
|
|
2011
|
+
group: "meetings",
|
|
2012
|
+
summary:
|
|
2013
|
+
"Append up to 500 transcript segments to a meeting (speakers with an email link to existing people).",
|
|
2014
|
+
cli: "dench meetings transcript set",
|
|
2015
|
+
method: "POST",
|
|
2016
|
+
path: "/meetings/{meetingEntryId}/transcript",
|
|
2017
|
+
requestSchema: anyObject,
|
|
2018
|
+
responseSchema: anyResponse,
|
|
2019
|
+
backend: convex(
|
|
2020
|
+
"mutation",
|
|
2021
|
+
"functions/meetings/importer:appendTranscriptSegments",
|
|
2022
|
+
),
|
|
2023
|
+
}),
|
|
2024
|
+
op({
|
|
2025
|
+
id: "meetings.transcript.clear",
|
|
2026
|
+
group: "meetings",
|
|
2027
|
+
summary:
|
|
2028
|
+
"Delete a batch of a meeting's transcript segments; repeat until `done` before re-appending.",
|
|
2029
|
+
cli: "dench meetings transcript clear",
|
|
2030
|
+
method: "DELETE",
|
|
2031
|
+
path: "/meetings/{meetingEntryId}/transcript",
|
|
2032
|
+
requestSchema: noBody,
|
|
2033
|
+
responseSchema: anyResponse,
|
|
2034
|
+
backend: convex("mutation", "functions/meetings/importer:clearTranscript"),
|
|
2035
|
+
}),
|
|
2036
|
+
op({
|
|
2037
|
+
id: "meetings.actionItems.list",
|
|
2038
|
+
group: "meetings",
|
|
2039
|
+
summary: "List a meeting's action items.",
|
|
2040
|
+
cli: "dench meetings action-items list",
|
|
2041
|
+
method: "GET",
|
|
2042
|
+
path: "/meetings/{meetingEntryId}/action-items",
|
|
2043
|
+
requestSchema: noBody,
|
|
2044
|
+
responseSchema: anyResponse,
|
|
2045
|
+
backend: convex("query", "functions/meetings/actionItems:listActionItems"),
|
|
2046
|
+
}),
|
|
2047
|
+
op({
|
|
2048
|
+
id: "meetings.actionItems.add",
|
|
2049
|
+
group: "meetings",
|
|
2050
|
+
summary:
|
|
2051
|
+
"Add action items to a meeting; `replace: true` swaps the whole list.",
|
|
2052
|
+
cli: "dench meetings action-items set",
|
|
2053
|
+
method: "POST",
|
|
2054
|
+
path: "/meetings/{meetingEntryId}/action-items",
|
|
2055
|
+
requestSchema: anyObject,
|
|
2056
|
+
responseSchema: anyResponse,
|
|
2057
|
+
backend: convex("mutation", "functions/meetings/importer:addActionItems"),
|
|
2058
|
+
}),
|
|
2059
|
+
op({
|
|
2060
|
+
id: "meetings.actionItems.setDone",
|
|
2061
|
+
group: "meetings",
|
|
2062
|
+
summary: "Tick or untick one action item.",
|
|
2063
|
+
cli: "dench meetings action-items done",
|
|
2064
|
+
method: "PATCH",
|
|
2065
|
+
path: "/meetings/action-items/{itemId}",
|
|
2066
|
+
requestSchema: anyObject,
|
|
2067
|
+
responseSchema: anyResponse,
|
|
2068
|
+
backend: convex(
|
|
2069
|
+
"mutation",
|
|
2070
|
+
"functions/meetings/actionItems:setActionItemDone",
|
|
2071
|
+
),
|
|
2072
|
+
}),
|
|
2073
|
+
op({
|
|
2074
|
+
id: "meetings.actionItems.delete",
|
|
2075
|
+
group: "meetings",
|
|
2076
|
+
summary: "Delete one action item.",
|
|
2077
|
+
cli: "dench meetings action-items delete",
|
|
2078
|
+
method: "DELETE",
|
|
2079
|
+
path: "/meetings/action-items/{itemId}",
|
|
2080
|
+
requestSchema: noBody,
|
|
2081
|
+
responseSchema: anyResponse,
|
|
2082
|
+
backend: convex(
|
|
2083
|
+
"mutation",
|
|
2084
|
+
"functions/meetings/actionItems:deleteActionItem",
|
|
2085
|
+
),
|
|
2086
|
+
}),
|
|
2087
|
+
op({
|
|
2088
|
+
id: "meetings.participants.list",
|
|
2089
|
+
group: "meetings",
|
|
2090
|
+
summary: "Who was in the meeting, merged with the linked calendar invite.",
|
|
2091
|
+
cli: "dench meetings participants list",
|
|
2092
|
+
method: "GET",
|
|
2093
|
+
path: "/meetings/{meetingEntryId}/participants",
|
|
2094
|
+
requestSchema: noBody,
|
|
2095
|
+
responseSchema: anyResponse,
|
|
2096
|
+
backend: convex(
|
|
2097
|
+
"query",
|
|
2098
|
+
"functions/meetings/participantLinks:listMeetingParticipantRoster",
|
|
2099
|
+
),
|
|
2100
|
+
}),
|
|
2101
|
+
op({
|
|
2102
|
+
id: "meetings.participants.set",
|
|
2103
|
+
group: "meetings",
|
|
2104
|
+
summary:
|
|
2105
|
+
"Record attendees by name/email; known members and existing people are linked, nobody is created.",
|
|
2106
|
+
cli: "dench meetings participants set",
|
|
2107
|
+
method: "PUT",
|
|
2108
|
+
path: "/meetings/{meetingEntryId}/participants",
|
|
2109
|
+
requestSchema: anyObject,
|
|
2110
|
+
responseSchema: anyResponse,
|
|
2111
|
+
backend: convex("mutation", "functions/meetings/importer:setParticipants"),
|
|
2112
|
+
}),
|
|
2113
|
+
op({
|
|
2114
|
+
id: "meetings.import",
|
|
2115
|
+
group: "local",
|
|
2116
|
+
summary:
|
|
2117
|
+
"Import calls from a local CSV/JSONL: meeting fields plus transcript, action items and attendees per row.",
|
|
2118
|
+
cli: "dench meetings import",
|
|
2119
|
+
method: "POST",
|
|
2120
|
+
path: "/local/meetings/import",
|
|
2121
|
+
requestSchema: anyObject,
|
|
2122
|
+
responseSchema: anyResponse,
|
|
2123
|
+
backend: local(
|
|
2124
|
+
"Reads a CSV/JSONL from the caller's local filesystem. Over the API: POST /crm/objects/meeting/entries/batch with seedKey per row, then POST /meetings/{meetingEntryId}/transcript, POST …/action-items and PUT …/participants for each created meeting.",
|
|
2125
|
+
),
|
|
2126
|
+
}),
|
|
2127
|
+
|
|
1973
2128
|
// Managed email campaigns.
|
|
1974
2129
|
op({
|
|
1975
2130
|
id: "email.identity.verify",
|