@dench.com/cli 3.0.3-staging.286 → 3.0.4-staging.289
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 +20 -0
- package/campaign.ts +12 -1
- package/chat.ts +10 -10
- package/crm-comments.ts +90 -9
- package/crm.ts +34 -15
- package/email.ts +1 -1
- package/lib/app-sdk-catalog.generated.ts +4 -0
- package/lib/app-sdk-surface.ts +3 -0
- package/lib/command-registry.ts +60 -9
- package/members.ts +28 -7
- package/package.json +1 -1
package/app-sdk.d.ts
CHANGED
|
@@ -570,6 +570,12 @@ export interface ApiRequests {
|
|
|
570
570
|
/** Defaults to true; false unfollows. */
|
|
571
571
|
watching?: boolean;
|
|
572
572
|
};
|
|
573
|
+
/** Page assigned tasks in priority order (or completed tasks by recency). — `dench crm tasks mine --page` — POST /api/v1/crm/tasks/assigned/page */
|
|
574
|
+
"crm.tasks.pageAssigned": Record<string, unknown>;
|
|
575
|
+
/** Page all tasks linked to a record, including subtasks. — `dench crm tasks list --page` — POST /api/v1/crm/objects/{objectName}/entries/{entryId}/tasks/page */
|
|
576
|
+
"crm.tasks.pageForEntry": Record<string, unknown>;
|
|
577
|
+
/** Start or resume preparation of exact task ordering and progress. — `dench crm tasks prepare` — POST /api/v1/crm/tasks/prepare */
|
|
578
|
+
"crm.tasks.prepare": Record<string, unknown>;
|
|
573
579
|
/** Your open tasks (plus ones completed today). — `dench crm tasks mine` — GET /api/v1/crm/tasks/mine */
|
|
574
580
|
"crm.tasks.mine": {
|
|
575
581
|
limit?: number;
|
|
@@ -796,6 +802,8 @@ export interface ApiRequests {
|
|
|
796
802
|
/** Which `user` field "assigned" means. Default: the analytics owner role, else the task `Assignee`, else a user field named like owner/assignee, else the first user field. */
|
|
797
803
|
assigneeField?: string;
|
|
798
804
|
};
|
|
805
|
+
/** Scan CRM entries with a resumable cursor. Empty filtered pages can have more results. — `dench crm query --page` — POST /api/v1/crm/query/page */
|
|
806
|
+
"crm.queryPage": Record<string, unknown>;
|
|
799
807
|
/** Run CRM SQL-compatible query. — `dench crm sql` — POST /api/v1/crm/sql */
|
|
800
808
|
"crm.sql": {
|
|
801
809
|
objectName: string;
|
|
@@ -3350,6 +3358,9 @@ export interface ApiResponses {
|
|
|
3350
3358
|
"crm.watch.set": {
|
|
3351
3359
|
watching: boolean;
|
|
3352
3360
|
};
|
|
3361
|
+
"crm.tasks.pageAssigned": unknown;
|
|
3362
|
+
"crm.tasks.pageForEntry": unknown;
|
|
3363
|
+
"crm.tasks.prepare": unknown;
|
|
3353
3364
|
"crm.tasks.mine": Record<string, unknown>[];
|
|
3354
3365
|
"crm.tasks.forEntry": Record<string, unknown>[];
|
|
3355
3366
|
"crm.tasks.createForEntry": Record<string, unknown>;
|
|
@@ -3417,6 +3428,7 @@ export interface ApiResponses {
|
|
|
3417
3428
|
updatedBy: string;
|
|
3418
3429
|
sortOrder: number;
|
|
3419
3430
|
}[];
|
|
3431
|
+
"crm.queryPage": unknown;
|
|
3420
3432
|
"crm.sql": {
|
|
3421
3433
|
id: string;
|
|
3422
3434
|
objectId: string;
|
|
@@ -6149,6 +6161,8 @@ export type DenchApiTree = {
|
|
|
6149
6161
|
};
|
|
6150
6162
|
/** Query CRM entries. (`dench crm query`) */
|
|
6151
6163
|
query(args: Req<"crm.query">): Promise<Res<"crm.query">>;
|
|
6164
|
+
/** Scan CRM entries with a resumable cursor. Empty filtered pages can have more results. (`dench crm query --page`) */
|
|
6165
|
+
queryPage(args: Req<"crm.queryPage">): Promise<Res<"crm.queryPage">>;
|
|
6152
6166
|
reports: {
|
|
6153
6167
|
/** Generate a CRM report. (`dench crm reports generate`) */
|
|
6154
6168
|
generate(args: Req<"crm.reports.generate">): Promise<Res<"crm.reports.generate">>;
|
|
@@ -6194,6 +6208,12 @@ export type DenchApiTree = {
|
|
|
6194
6208
|
forEntry(args: Req<"crm.tasks.forEntry">): Promise<Res<"crm.tasks.forEntry">>;
|
|
6195
6209
|
/** Your open tasks (plus ones completed today). (`dench crm tasks mine`) */
|
|
6196
6210
|
mine(args?: Req<"crm.tasks.mine">): Promise<Res<"crm.tasks.mine">>;
|
|
6211
|
+
/** Page assigned tasks in priority order (or completed tasks by recency). (`dench crm tasks mine --page`) */
|
|
6212
|
+
pageAssigned(args: Req<"crm.tasks.pageAssigned">): Promise<Res<"crm.tasks.pageAssigned">>;
|
|
6213
|
+
/** Page all tasks linked to a record, including subtasks. (`dench crm tasks list --page`) */
|
|
6214
|
+
pageForEntry(args: Req<"crm.tasks.pageForEntry">): Promise<Res<"crm.tasks.pageForEntry">>;
|
|
6215
|
+
/** Start or resume preparation of exact task ordering and progress. (`dench crm tasks prepare`) */
|
|
6216
|
+
prepare(args: Req<"crm.tasks.prepare">): Promise<Res<"crm.tasks.prepare">>;
|
|
6197
6217
|
/** Reopen a completed task. (`dench crm tasks reopen`) */
|
|
6198
6218
|
reopen(args: Req<"crm.tasks.reopen">): Promise<Res<"crm.tasks.reopen">>;
|
|
6199
6219
|
repeat: {
|
package/campaign.ts
CHANGED
|
@@ -290,6 +290,17 @@ async function callMutation(
|
|
|
290
290
|
} as never);
|
|
291
291
|
}
|
|
292
292
|
|
|
293
|
+
async function callAction(
|
|
294
|
+
ctx: CampaignCliContext,
|
|
295
|
+
name: string,
|
|
296
|
+
args: JsonRecord,
|
|
297
|
+
): Promise<unknown> {
|
|
298
|
+
return await ctx.convex.action(makeFunctionReference<"action">(name), {
|
|
299
|
+
...args,
|
|
300
|
+
sessionToken: ctx.sessionToken,
|
|
301
|
+
} as never);
|
|
302
|
+
}
|
|
303
|
+
|
|
293
304
|
function out(
|
|
294
305
|
ctx: CampaignCliContext,
|
|
295
306
|
payload: unknown,
|
|
@@ -1289,7 +1300,7 @@ async function runGet(ctx: CampaignCliContext): Promise<void> {
|
|
|
1289
1300
|
const sequenceId = String(row._id);
|
|
1290
1301
|
const [detail, analytics, live] = await Promise.all([
|
|
1291
1302
|
loadDetail(ctx, sequenceId),
|
|
1292
|
-
|
|
1303
|
+
callAction(ctx, `${OUTREACH}:computeSequenceAnalytics`, {
|
|
1293
1304
|
sequenceId,
|
|
1294
1305
|
}) as Promise<CampaignAnalytics>,
|
|
1295
1306
|
callQuery(ctx, `${OUTREACH}:getSequenceLive`, {
|
package/chat.ts
CHANGED
|
@@ -63,15 +63,11 @@ function parseLimit(raw: string | undefined): number | undefined {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
const api = {
|
|
66
|
-
listPastChats: makeFunctionReference<"query">(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
searchPastChats: makeFunctionReference<"query">(
|
|
70
|
-
"functions/chat:searchPastChats",
|
|
71
|
-
),
|
|
72
|
-
readPastChat: makeFunctionReference<"query">(
|
|
73
|
-
"functions/chat:readPastChat",
|
|
66
|
+
listPastChats: makeFunctionReference<"query">("functions/chat:listPastChats"),
|
|
67
|
+
searchPastChats: makeFunctionReference<"action">(
|
|
68
|
+
"functions/chat:searchPastChatsComplete",
|
|
74
69
|
),
|
|
70
|
+
readPastChat: makeFunctionReference<"query">("functions/chat:readPastChat"),
|
|
75
71
|
renameThreads: makeFunctionReference<"mutation">(
|
|
76
72
|
"functions/chat:renameThreads",
|
|
77
73
|
),
|
|
@@ -247,7 +243,8 @@ async function runChatSearchCommand(ctx: ChatCliContext): Promise<void> {
|
|
|
247
243
|
}
|
|
248
244
|
out(
|
|
249
245
|
ctx,
|
|
250
|
-
await
|
|
246
|
+
await ctx.convex.action(api.searchPastChats, {
|
|
247
|
+
...commonArgs(ctx),
|
|
251
248
|
query,
|
|
252
249
|
limit,
|
|
253
250
|
includeAutomated,
|
|
@@ -536,7 +533,10 @@ async function runChatTreeCommand(ctx: ChatCliContext): Promise<void> {
|
|
|
536
533
|
// Sort children oldest-first within each parent (spawn order),
|
|
537
534
|
// roots newest-first (most recent root at the top).
|
|
538
535
|
for (const list of childrenByParent.values()) {
|
|
539
|
-
list.sort(
|
|
536
|
+
list.sort(
|
|
537
|
+
(a, b) =>
|
|
538
|
+
(a.createdAt || a.lastMessageAt) - (b.createdAt || b.lastMessageAt),
|
|
539
|
+
);
|
|
540
540
|
}
|
|
541
541
|
roots.sort((a, b) => b.lastMessageAt - a.lastMessageAt);
|
|
542
542
|
|
package/crm-comments.ts
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
assertNoUnknownFlags,
|
|
14
14
|
type CrmCliContext,
|
|
15
15
|
CrmCliError,
|
|
16
|
+
callAction,
|
|
16
17
|
callMutation,
|
|
17
18
|
callQuery,
|
|
18
19
|
out,
|
|
@@ -44,6 +45,15 @@ const api = {
|
|
|
44
45
|
),
|
|
45
46
|
},
|
|
46
47
|
tasks: {
|
|
48
|
+
pageAssigned: makeFunctionReference<"query">(
|
|
49
|
+
"functions/crm/tasks:pageAssignedTasks",
|
|
50
|
+
),
|
|
51
|
+
pageEntry: makeFunctionReference<"query">(
|
|
52
|
+
"functions/crm/tasks:pageEntryTasks",
|
|
53
|
+
),
|
|
54
|
+
prepare: makeFunctionReference<"mutation">(
|
|
55
|
+
"functions/crm/taskReadModels:ensureReady",
|
|
56
|
+
),
|
|
47
57
|
listMyOpenTasks: makeFunctionReference<"query">(
|
|
48
58
|
"functions/crm/tasks:listMyOpenTasks",
|
|
49
59
|
),
|
|
@@ -71,8 +81,8 @@ const api = {
|
|
|
71
81
|
setTaskParent: makeFunctionReference<"mutation">(
|
|
72
82
|
"functions/crm/tasks:setTaskParent",
|
|
73
83
|
),
|
|
74
|
-
deleteTask: makeFunctionReference<"
|
|
75
|
-
"functions/crm/tasks:
|
|
84
|
+
deleteTask: makeFunctionReference<"action">(
|
|
85
|
+
"functions/crm/tasks:deleteTaskComplete",
|
|
76
86
|
),
|
|
77
87
|
},
|
|
78
88
|
repeat: {
|
|
@@ -310,26 +320,71 @@ export async function runWatchCommand(ctx: CrmCliContext): Promise<void> {
|
|
|
310
320
|
export async function runTasksCommand(ctx: CrmCliContext): Promise<void> {
|
|
311
321
|
const verb = ctx.args.shift();
|
|
312
322
|
switch (verb) {
|
|
323
|
+
case "prepare": {
|
|
324
|
+
assertNoUnknownFlags(ctx.args, "crm tasks prepare");
|
|
325
|
+
out(ctx, await callMutation(ctx, api.tasks.prepare, {}));
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
313
328
|
case "mine": {
|
|
314
329
|
const rawLimit = getFlag(ctx.args, "--limit");
|
|
315
330
|
const priority = getFlag(ctx.args, "--priority");
|
|
331
|
+
const cursor = getFlag(ctx.args, "--cursor");
|
|
332
|
+
const paged = hasFlag(ctx.args, "--page") || cursor !== undefined;
|
|
333
|
+
const done = hasFlag(ctx.args, "--done");
|
|
316
334
|
assertNoUnknownFlags(ctx.args, "crm tasks mine");
|
|
317
335
|
out(
|
|
318
336
|
ctx,
|
|
319
|
-
await callQuery(
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
337
|
+
await callQuery(
|
|
338
|
+
ctx,
|
|
339
|
+
paged || done ? api.tasks.pageAssigned : api.tasks.listMyOpenTasks,
|
|
340
|
+
{
|
|
341
|
+
...(paged || done
|
|
342
|
+
? {
|
|
343
|
+
paginationOpts: {
|
|
344
|
+
cursor: cursor ?? null,
|
|
345
|
+
numItems: Number.parseInt(rawLimit ?? "25", 10),
|
|
346
|
+
},
|
|
347
|
+
done,
|
|
348
|
+
}
|
|
349
|
+
: rawLimit
|
|
350
|
+
? { limit: Number.parseInt(rawLimit, 10) }
|
|
351
|
+
: {}),
|
|
352
|
+
...(priority ? { priority } : {}),
|
|
353
|
+
},
|
|
354
|
+
),
|
|
323
355
|
);
|
|
324
356
|
return;
|
|
325
357
|
}
|
|
326
358
|
case "list": {
|
|
327
359
|
const objectName = shift(ctx.args, "object name");
|
|
328
360
|
const entryId = shift(ctx.args, "entry id");
|
|
361
|
+
const cursor = getFlag(ctx.args, "--cursor");
|
|
362
|
+
const limit = getFlag(ctx.args, "--limit");
|
|
363
|
+
const paged =
|
|
364
|
+
hasFlag(ctx.args, "--page") ||
|
|
365
|
+
cursor !== undefined ||
|
|
366
|
+
limit !== undefined;
|
|
367
|
+
const done = hasFlag(ctx.args, "--done");
|
|
329
368
|
assertNoUnknownFlags(ctx.args, "crm tasks list");
|
|
330
369
|
out(
|
|
331
370
|
ctx,
|
|
332
|
-
await callQuery(
|
|
371
|
+
await callQuery(
|
|
372
|
+
ctx,
|
|
373
|
+
paged || done ? api.tasks.pageEntry : api.tasks.listEntryTasks,
|
|
374
|
+
{
|
|
375
|
+
objectName,
|
|
376
|
+
entryId,
|
|
377
|
+
...(paged || done
|
|
378
|
+
? {
|
|
379
|
+
done,
|
|
380
|
+
paginationOpts: {
|
|
381
|
+
cursor: cursor ?? null,
|
|
382
|
+
numItems: Number.parseInt(limit ?? "25", 10),
|
|
383
|
+
},
|
|
384
|
+
}
|
|
385
|
+
: {}),
|
|
386
|
+
},
|
|
387
|
+
),
|
|
333
388
|
);
|
|
334
389
|
return;
|
|
335
390
|
}
|
|
@@ -450,8 +505,34 @@ export async function runTasksCommand(ctx: CrmCliContext): Promise<void> {
|
|
|
450
505
|
}
|
|
451
506
|
case "subtasks": {
|
|
452
507
|
const entryId = shift(ctx.args, "task entry id");
|
|
508
|
+
const cursor = getFlag(ctx.args, "--cursor");
|
|
509
|
+
const limit = getFlag(ctx.args, "--limit");
|
|
510
|
+
const paged =
|
|
511
|
+
hasFlag(ctx.args, "--page") ||
|
|
512
|
+
cursor !== undefined ||
|
|
513
|
+
limit !== undefined;
|
|
514
|
+
const done = hasFlag(ctx.args, "--done");
|
|
453
515
|
assertNoUnknownFlags(ctx.args, "crm tasks subtasks");
|
|
454
|
-
out(
|
|
516
|
+
out(
|
|
517
|
+
ctx,
|
|
518
|
+
await callQuery(
|
|
519
|
+
ctx,
|
|
520
|
+
paged || done ? api.tasks.pageEntry : api.tasks.listSubtasks,
|
|
521
|
+
{
|
|
522
|
+
entryId,
|
|
523
|
+
...(paged || done
|
|
524
|
+
? {
|
|
525
|
+
objectName: "task",
|
|
526
|
+
done,
|
|
527
|
+
paginationOpts: {
|
|
528
|
+
cursor: cursor ?? null,
|
|
529
|
+
numItems: Number.parseInt(limit ?? "25", 10),
|
|
530
|
+
},
|
|
531
|
+
}
|
|
532
|
+
: {}),
|
|
533
|
+
},
|
|
534
|
+
),
|
|
535
|
+
);
|
|
455
536
|
return;
|
|
456
537
|
}
|
|
457
538
|
case "create-subtask": {
|
|
@@ -503,7 +584,7 @@ export async function runTasksCommand(ctx: CrmCliContext): Promise<void> {
|
|
|
503
584
|
assertNoUnknownFlags(ctx.args, "crm tasks delete");
|
|
504
585
|
out(
|
|
505
586
|
ctx,
|
|
506
|
-
await
|
|
587
|
+
await callAction(ctx, api.tasks.deleteTask, {
|
|
507
588
|
entryId,
|
|
508
589
|
subtasks: keep ? "keep" : "delete",
|
|
509
590
|
}),
|
package/crm.ts
CHANGED
|
@@ -764,7 +764,7 @@ export async function callMutation(
|
|
|
764
764
|
}
|
|
765
765
|
}
|
|
766
766
|
|
|
767
|
-
async function callAction(
|
|
767
|
+
export async function callAction(
|
|
768
768
|
ctx: CrmCliContext,
|
|
769
769
|
fn: Parameters<ConvexHttpClient["action"]>[0],
|
|
770
770
|
args: Record<string, unknown> = {},
|
|
@@ -882,8 +882,8 @@ const api = {
|
|
|
882
882
|
objects: {
|
|
883
883
|
list: makeFunctionReference<"query">("functions/crm/objects:list"),
|
|
884
884
|
get: makeFunctionReference<"query">("functions/crm/objects:get"),
|
|
885
|
-
materializeView: makeFunctionReference<"
|
|
886
|
-
"functions/crm/objects:
|
|
885
|
+
materializeView: makeFunctionReference<"action">(
|
|
886
|
+
"functions/crm/objects:completeView",
|
|
887
887
|
),
|
|
888
888
|
create: makeFunctionReference<"mutation">("functions/crm/objects:create"),
|
|
889
889
|
update: makeFunctionReference<"mutation">("functions/crm/objects:update"),
|
|
@@ -972,8 +972,11 @@ const api = {
|
|
|
972
972
|
append: makeFunctionReference<"mutation">("functions/crm/cells:append"),
|
|
973
973
|
},
|
|
974
974
|
query: {
|
|
975
|
-
queryEntries: makeFunctionReference<"
|
|
976
|
-
"functions/crm/query:
|
|
975
|
+
queryEntries: makeFunctionReference<"action">(
|
|
976
|
+
"functions/crm/query:runQueryEntries",
|
|
977
|
+
),
|
|
978
|
+
scanEntries: makeFunctionReference<"query">(
|
|
979
|
+
"functions/crm/query:scanEntries",
|
|
977
980
|
),
|
|
978
981
|
aggregate: makeFunctionReference<"query">("functions/crm/query:aggregate"),
|
|
979
982
|
search: makeFunctionReference<"query">("functions/crm/query:search"),
|
|
@@ -1802,6 +1805,7 @@ async function runViewsCommand(ctx: CrmCliContext): Promise<void> {
|
|
|
1802
1805
|
10,
|
|
1803
1806
|
);
|
|
1804
1807
|
const withMeta = hasFlag(ctx.args, "--with-meta");
|
|
1808
|
+
const after = getFlag(ctx.args, "--cursor");
|
|
1805
1809
|
const assigneeScopeArgs = resolveAssigneeScopeFlags(ctx.args);
|
|
1806
1810
|
assertNoUnknownFlags(ctx.args, "crm views entries");
|
|
1807
1811
|
if (!Number.isFinite(page) || page < 1) {
|
|
@@ -1827,10 +1831,11 @@ async function runViewsCommand(ctx: CrmCliContext): Promise<void> {
|
|
|
1827
1831
|
)
|
|
1828
1832
|
: undefined;
|
|
1829
1833
|
const materialized = (await suppressForwardedConvexLogs(() =>
|
|
1830
|
-
|
|
1834
|
+
callAction(ctx, api.objects.materializeView, {
|
|
1831
1835
|
objectName,
|
|
1832
1836
|
page,
|
|
1833
1837
|
pageSize,
|
|
1838
|
+
after,
|
|
1834
1839
|
filters: view.filters,
|
|
1835
1840
|
sort: Array.isArray(view.sort) ? view.sort : undefined,
|
|
1836
1841
|
pinnedEntryIds,
|
|
@@ -1843,6 +1848,10 @@ async function runViewsCommand(ctx: CrmCliContext): Promise<void> {
|
|
|
1843
1848
|
page?: number;
|
|
1844
1849
|
pageSize?: number;
|
|
1845
1850
|
truncated?: boolean;
|
|
1851
|
+
continueCursor?: string;
|
|
1852
|
+
isDone?: boolean;
|
|
1853
|
+
startedAt?: number;
|
|
1854
|
+
completedAt?: number;
|
|
1846
1855
|
assigneeScope?: unknown;
|
|
1847
1856
|
} | null;
|
|
1848
1857
|
|
|
@@ -1879,6 +1888,10 @@ async function runViewsCommand(ctx: CrmCliContext): Promise<void> {
|
|
|
1879
1888
|
page: materialized.page ?? page,
|
|
1880
1889
|
pageSize: materialized.pageSize ?? pageSize,
|
|
1881
1890
|
truncated: materialized.truncated ?? false,
|
|
1891
|
+
continueCursor: materialized.continueCursor,
|
|
1892
|
+
isDone: materialized.isDone,
|
|
1893
|
+
startedAt: materialized.startedAt,
|
|
1894
|
+
completedAt: materialized.completedAt,
|
|
1882
1895
|
assigneeScope: materialized.assigneeScope ?? null,
|
|
1883
1896
|
entries,
|
|
1884
1897
|
});
|
|
@@ -2856,12 +2869,14 @@ async function runQueryCommand(ctx: CrmCliContext): Promise<void> {
|
|
|
2856
2869
|
| undefined;
|
|
2857
2870
|
const select = getFlag(ctx.args, "--select")?.split(",").filter(Boolean);
|
|
2858
2871
|
const sort = getFlag(ctx.args, "--sort");
|
|
2872
|
+
const cursor = getFlag(ctx.args, "--cursor");
|
|
2873
|
+
const pageMode = hasFlag(ctx.args, "--page") || cursor !== undefined;
|
|
2859
2874
|
// The server clamps at 1000 silently; surface the clamp on stderr so
|
|
2860
2875
|
// callers never mistake a truncated page for the full dataset. Output
|
|
2861
2876
|
// here is a bare JSON array, so stderr is the only safe channel.
|
|
2862
2877
|
const limit = resolveLimitFlag(ctx.args, {
|
|
2863
2878
|
defaultValue: 100,
|
|
2864
|
-
cap: 1000,
|
|
2879
|
+
cap: pageMode ? 100 : 1000,
|
|
2865
2880
|
command: "crm query",
|
|
2866
2881
|
});
|
|
2867
2882
|
const assigneeScopeArgs = resolveAssigneeScopeFlags(ctx.args);
|
|
@@ -2871,15 +2886,17 @@ async function runQueryCommand(ctx: CrmCliContext): Promise<void> {
|
|
|
2871
2886
|
// has any operator-shaped clause.
|
|
2872
2887
|
const dsl = { filter, select, sort, limit: limit.effective };
|
|
2873
2888
|
const hasDollarKey = filter ? containsDollarKey(filter) : false;
|
|
2889
|
+
const args = hasDollarKey
|
|
2890
|
+
? { objectName, dslJson: JSON.stringify(dsl), ...assigneeScopeArgs }
|
|
2891
|
+
: { objectName, dsl, ...assigneeScopeArgs };
|
|
2874
2892
|
out(
|
|
2875
2893
|
ctx,
|
|
2876
|
-
|
|
2877
|
-
ctx,
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
),
|
|
2894
|
+
pageMode
|
|
2895
|
+
? await callQuery(ctx, api.query.scanEntries, {
|
|
2896
|
+
...args,
|
|
2897
|
+
paginationOpts: { cursor: cursor ?? null, numItems: limit.effective },
|
|
2898
|
+
})
|
|
2899
|
+
: await callAction(ctx, api.query.queryEntries, args),
|
|
2883
2900
|
);
|
|
2884
2901
|
}
|
|
2885
2902
|
|
|
@@ -3640,7 +3657,7 @@ async function runSqlCommand(ctx: CrmCliContext): Promise<void> {
|
|
|
3640
3657
|
: undefined;
|
|
3641
3658
|
out(
|
|
3642
3659
|
ctx,
|
|
3643
|
-
await
|
|
3660
|
+
await callAction(ctx, api.query.queryEntries, {
|
|
3644
3661
|
objectName,
|
|
3645
3662
|
dsl: { select, sort, limit },
|
|
3646
3663
|
}),
|
|
@@ -4607,6 +4624,8 @@ Cells (single-field updates):
|
|
|
4607
4624
|
|
|
4608
4625
|
Query DSL:
|
|
4609
4626
|
dench crm query <object> --where '{"Status":"New"}' --select Name,Email --sort -Score --limit 100
|
|
4627
|
+
dench crm query <object> --page --select Name,Email --limit 100 [--cursor '<continueCursor>'] --json
|
|
4628
|
+
Cursor pages use index order (omit --sort). Continue until isDone, including empty filtered pages.
|
|
4610
4629
|
[--assigned-to me|unassigned|<userId|email> | --mine] [--assignee-field <Field>]
|
|
4611
4630
|
--mine AND-s "assigned to me" onto --where without you having to
|
|
4612
4631
|
know your own userId or the object's people field.
|
package/email.ts
CHANGED
|
@@ -1410,7 +1410,7 @@ async function runMultichannel(ctx: EmailCliContext) {
|
|
|
1410
1410
|
const sequenceId = requiredFlag(ctx.args, "--sequence");
|
|
1411
1411
|
const [detail, analytics] = await Promise.all([
|
|
1412
1412
|
callQuery(ctx, "functions/outreachSequences:getSequence", { sequenceId }),
|
|
1413
|
-
|
|
1413
|
+
callAction(ctx, "functions/outreachSequences:computeSequenceAnalytics", {
|
|
1414
1414
|
sequenceId,
|
|
1415
1415
|
}),
|
|
1416
1416
|
]);
|
|
@@ -162,6 +162,9 @@ export const APP_SDK_OPERATIONS: readonly AppSdkOperationInfo[] = [
|
|
|
162
162
|
{"id":"crm.comments.react","group":"crm","summary":"Toggle an emoji reaction on a comment.","cli":"dench crm comments react","method":"PUT","path":"/crm/comments/{commentId}/reactions/{emoji}","permission":"crm:write","pathParams":["commentId","emoji"]},
|
|
163
163
|
{"id":"crm.watch.get","group":"crm","summary":"Whether you follow a CRM entry's activity.","cli":"dench crm watch status","method":"GET","path":"/crm/objects/{objectName}/entries/{entryId}/watch","permission":"crm:read","pathParams":["objectName","entryId"]},
|
|
164
164
|
{"id":"crm.watch.set","group":"crm","summary":"Follow or unfollow a CRM entry's activity.","cli":"dench crm watch","method":"PUT","path":"/crm/objects/{objectName}/entries/{entryId}/watch","permission":"crm:write","pathParams":["objectName","entryId"]},
|
|
165
|
+
{"id":"crm.tasks.pageAssigned","group":"crm","summary":"Page assigned tasks in priority order (or completed tasks by recency).","cli":"dench crm tasks mine --page","method":"POST","path":"/crm/tasks/assigned/page","permission":"crm:read","pathParams":[]},
|
|
166
|
+
{"id":"crm.tasks.pageForEntry","group":"crm","summary":"Page all tasks linked to a record, including subtasks.","cli":"dench crm tasks list --page","method":"POST","path":"/crm/objects/{objectName}/entries/{entryId}/tasks/page","permission":"crm:read","pathParams":["objectName","entryId"]},
|
|
167
|
+
{"id":"crm.tasks.prepare","group":"crm","summary":"Start or resume preparation of exact task ordering and progress.","cli":"dench crm tasks prepare","method":"POST","path":"/crm/tasks/prepare","permission":"crm:write","pathParams":[]},
|
|
165
168
|
{"id":"crm.tasks.mine","group":"crm","summary":"Your open tasks (plus ones completed today).","cli":"dench crm tasks mine","method":"GET","path":"/crm/tasks/mine","permission":"crm:read","pathParams":[]},
|
|
166
169
|
{"id":"crm.tasks.forEntry","group":"crm","summary":"Tasks linked to a CRM entry.","cli":"dench crm tasks list","method":"GET","path":"/crm/objects/{objectName}/entries/{entryId}/tasks","permission":"crm:read","pathParams":["objectName","entryId"]},
|
|
167
170
|
{"id":"crm.tasks.createForEntry","group":"crm","summary":"Create a task linked to a CRM entry.","cli":"dench crm tasks create","method":"POST","path":"/crm/objects/{objectName}/entries/{entryId}/tasks","permission":"crm:write","pathParams":["objectName","entryId"]},
|
|
@@ -191,6 +194,7 @@ export const APP_SDK_OPERATIONS: readonly AppSdkOperationInfo[] = [
|
|
|
191
194
|
{"id":"crm.cells.setMany","group":"crm","summary":"Set many CRM cell values.","cli":"dench crm cells set-many","method":"POST","path":"/crm/cells/batch","permission":"crm:write","pathParams":[]},
|
|
192
195
|
{"id":"crm.cells.append","group":"crm","summary":"Append to a CRM cell.","cli":"dench crm cells append","method":"POST","path":"/crm/objects/{objectName}/entries/{entryId}/fields/{fieldName}/append","permission":"crm:write","pathParams":["objectName","entryId","fieldName"]},
|
|
193
196
|
{"id":"crm.query","group":"crm","summary":"Query CRM entries.","cli":"dench crm query","method":"POST","path":"/crm/query","permission":"crm:read","pathParams":[]},
|
|
197
|
+
{"id":"crm.queryPage","group":"crm","summary":"Scan CRM entries with a resumable cursor. Empty filtered pages can have more results.","cli":"dench crm query --page","method":"POST","path":"/crm/query/page","permission":"crm:read","pathParams":[]},
|
|
194
198
|
{"id":"crm.sql","group":"crm","summary":"Run CRM SQL-compatible query.","cli":"dench crm sql","method":"POST","path":"/crm/sql","permission":"crm:read","pathParams":[]},
|
|
195
199
|
{"id":"crm.aggregate","group":"crm","summary":"Aggregate CRM entries.","cli":"dench crm aggregate","method":"POST","path":"/crm/aggregate","permission":"crm:read","pathParams":[]},
|
|
196
200
|
{"id":"crm.search","group":"crm","summary":"Search CRM entries.","cli":"dench crm search","method":"GET","path":"/crm/search","permission":"crm:read","pathParams":[]},
|
package/lib/app-sdk-surface.ts
CHANGED
|
@@ -1393,6 +1393,9 @@ export const GROUP_SCOPE_OVERRIDES: Record<string, string> = {
|
|
|
1393
1393
|
/** Operations that are reads despite a non-GET method. */
|
|
1394
1394
|
export const READ_OPERATION_OVERRIDES = new Set<string>([
|
|
1395
1395
|
"crm.query",
|
|
1396
|
+
"crm.queryPage",
|
|
1397
|
+
"crm.tasks.pageAssigned",
|
|
1398
|
+
"crm.tasks.pageForEntry",
|
|
1396
1399
|
"crm.sql",
|
|
1397
1400
|
"crm.aggregate",
|
|
1398
1401
|
"crm.analytics.compute",
|
package/lib/command-registry.ts
CHANGED
|
@@ -518,9 +518,14 @@ const rawApiOperations = [
|
|
|
518
518
|
path: "/chat/search",
|
|
519
519
|
requestSchema: anyObject,
|
|
520
520
|
responseSchema: anyResponse,
|
|
521
|
-
backend: convex(
|
|
522
|
-
|
|
523
|
-
|
|
521
|
+
backend: convex(
|
|
522
|
+
"action",
|
|
523
|
+
"functions/chat:searchPastChatsComplete",
|
|
524
|
+
"bearer",
|
|
525
|
+
{
|
|
526
|
+
includeRunId: true,
|
|
527
|
+
},
|
|
528
|
+
),
|
|
524
529
|
}),
|
|
525
530
|
op({
|
|
526
531
|
id: "chat.read",
|
|
@@ -734,7 +739,7 @@ const rawApiOperations = [
|
|
|
734
739
|
path: "/crm/objects/{objectName}/views/{viewName}/entries",
|
|
735
740
|
requestSchema: noBody,
|
|
736
741
|
responseSchema: anyResponse,
|
|
737
|
-
backend: convex("
|
|
742
|
+
backend: convex("action", "functions/crm/objects:completeView"),
|
|
738
743
|
}),
|
|
739
744
|
op({
|
|
740
745
|
id: "crm.views.create",
|
|
@@ -1199,6 +1204,40 @@ const rawApiOperations = [
|
|
|
1199
1204
|
// CRM tasks — conveniences over the protected `task` object. Tasks are
|
|
1200
1205
|
// still ordinary entries (`crm.entries.*` works on them); these add the
|
|
1201
1206
|
// "mine", "for this record", complete/reopen shortcuts the app uses.
|
|
1207
|
+
op({
|
|
1208
|
+
id: "crm.tasks.pageAssigned",
|
|
1209
|
+
group: "crm",
|
|
1210
|
+
summary:
|
|
1211
|
+
"Page assigned tasks in priority order (or completed tasks by recency).",
|
|
1212
|
+
cli: "dench crm tasks mine --page",
|
|
1213
|
+
method: "POST",
|
|
1214
|
+
path: "/crm/tasks/assigned/page",
|
|
1215
|
+
requestSchema: anyObject,
|
|
1216
|
+
responseSchema: anyResponse,
|
|
1217
|
+
backend: convex("query", "functions/crm/tasks:pageAssignedTasks"),
|
|
1218
|
+
}),
|
|
1219
|
+
op({
|
|
1220
|
+
id: "crm.tasks.pageForEntry",
|
|
1221
|
+
group: "crm",
|
|
1222
|
+
summary: "Page all tasks linked to a record, including subtasks.",
|
|
1223
|
+
cli: "dench crm tasks list --page",
|
|
1224
|
+
method: "POST",
|
|
1225
|
+
path: "/crm/objects/{objectName}/entries/{entryId}/tasks/page",
|
|
1226
|
+
requestSchema: anyObject,
|
|
1227
|
+
responseSchema: anyResponse,
|
|
1228
|
+
backend: convex("query", "functions/crm/tasks:pageEntryTasks"),
|
|
1229
|
+
}),
|
|
1230
|
+
op({
|
|
1231
|
+
id: "crm.tasks.prepare",
|
|
1232
|
+
group: "crm",
|
|
1233
|
+
summary: "Start or resume preparation of exact task ordering and progress.",
|
|
1234
|
+
cli: "dench crm tasks prepare",
|
|
1235
|
+
method: "POST",
|
|
1236
|
+
path: "/crm/tasks/prepare",
|
|
1237
|
+
requestSchema: noBody,
|
|
1238
|
+
responseSchema: anyResponse,
|
|
1239
|
+
backend: convex("mutation", "functions/crm/taskReadModels:ensureReady"),
|
|
1240
|
+
}),
|
|
1202
1241
|
op({
|
|
1203
1242
|
id: "crm.tasks.mine",
|
|
1204
1243
|
group: "crm",
|
|
@@ -1317,7 +1356,7 @@ const rawApiOperations = [
|
|
|
1317
1356
|
requestSchema: anyObject,
|
|
1318
1357
|
responseSchema: anyResponse,
|
|
1319
1358
|
backend: {
|
|
1320
|
-
...convex("
|
|
1359
|
+
...convex("action", "functions/crm/tasks:deleteTaskComplete"),
|
|
1321
1360
|
transformArgs: (input) => ({
|
|
1322
1361
|
entryId: input.entryId,
|
|
1323
1362
|
subtasks: input.subtasks === "keep" ? "keep" : "delete",
|
|
@@ -1555,7 +1594,19 @@ const rawApiOperations = [
|
|
|
1555
1594
|
path: "/crm/query",
|
|
1556
1595
|
requestSchema: anyObject,
|
|
1557
1596
|
responseSchema: anyResponse,
|
|
1558
|
-
backend: convex("
|
|
1597
|
+
backend: convex("action", "functions/crm/query:runQueryEntries"),
|
|
1598
|
+
}),
|
|
1599
|
+
op({
|
|
1600
|
+
id: "crm.queryPage",
|
|
1601
|
+
group: "crm",
|
|
1602
|
+
summary:
|
|
1603
|
+
"Scan CRM entries with a resumable cursor. Empty filtered pages can have more results.",
|
|
1604
|
+
cli: "dench crm query --page",
|
|
1605
|
+
method: "POST",
|
|
1606
|
+
path: "/crm/query/page",
|
|
1607
|
+
requestSchema: anyObject,
|
|
1608
|
+
responseSchema: anyResponse,
|
|
1609
|
+
backend: convex("query", "functions/crm/query:scanEntries"),
|
|
1559
1610
|
}),
|
|
1560
1611
|
op({
|
|
1561
1612
|
id: "crm.sql",
|
|
@@ -1566,7 +1617,7 @@ const rawApiOperations = [
|
|
|
1566
1617
|
path: "/crm/sql",
|
|
1567
1618
|
requestSchema: anyObject,
|
|
1568
1619
|
responseSchema: anyResponse,
|
|
1569
|
-
backend: convex("
|
|
1620
|
+
backend: convex("action", "functions/crm/query:runQueryEntries"),
|
|
1570
1621
|
}),
|
|
1571
1622
|
op({
|
|
1572
1623
|
id: "crm.aggregate",
|
|
@@ -3025,8 +3076,8 @@ const rawApiOperations = [
|
|
|
3025
3076
|
requestSchema: anyObject,
|
|
3026
3077
|
responseSchema: anyResponse,
|
|
3027
3078
|
backend: convex(
|
|
3028
|
-
"
|
|
3029
|
-
"functions/outreachSequences:
|
|
3079
|
+
"action",
|
|
3080
|
+
"functions/outreachSequences:computeSequenceAnalytics",
|
|
3030
3081
|
),
|
|
3031
3082
|
}),
|
|
3032
3083
|
op({
|
package/members.ts
CHANGED
|
@@ -280,16 +280,37 @@ async function runMemberActivity(ctx: MembersCliContext): Promise<void> {
|
|
|
280
280
|
async function runMemberTasks(ctx: MembersCliContext): Promise<void> {
|
|
281
281
|
const target = shiftArg(ctx, "member id or email");
|
|
282
282
|
const rawLimit = getFlag(ctx.args, "--limit");
|
|
283
|
+
const cursor = getFlag(ctx.args, "--cursor");
|
|
284
|
+
const paged = hasFlag(ctx.args, "--page") || cursor !== undefined;
|
|
285
|
+
const done = hasFlag(ctx.args, "--done");
|
|
283
286
|
assertNoFlags(ctx, "dench members tasks");
|
|
284
287
|
const userId = await resolveMemberId(ctx, target);
|
|
285
288
|
const todayStart = new Date();
|
|
286
289
|
todayStart.setHours(0, 0, 0, 0);
|
|
287
290
|
out(
|
|
288
|
-
await callQuery(
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
291
|
+
await callQuery(
|
|
292
|
+
ctx,
|
|
293
|
+
paged || done
|
|
294
|
+
? makeFunctionReference<"query">(
|
|
295
|
+
"functions/crm/tasks:pageAssignedTasks",
|
|
296
|
+
)
|
|
297
|
+
: api.profiles.tasks,
|
|
298
|
+
{
|
|
299
|
+
userId,
|
|
300
|
+
todayStartMs: todayStart.getTime(),
|
|
301
|
+
...(paged || done
|
|
302
|
+
? {
|
|
303
|
+
done,
|
|
304
|
+
paginationOpts: {
|
|
305
|
+
cursor: cursor ?? null,
|
|
306
|
+
numItems: Number.parseInt(rawLimit ?? "25", 10),
|
|
307
|
+
},
|
|
308
|
+
}
|
|
309
|
+
: rawLimit
|
|
310
|
+
? { limit: Number.parseInt(rawLimit, 10) }
|
|
311
|
+
: {}),
|
|
312
|
+
},
|
|
313
|
+
),
|
|
293
314
|
);
|
|
294
315
|
}
|
|
295
316
|
|
|
@@ -437,8 +458,8 @@ Subcommands:
|
|
|
437
458
|
dench members activity <userId|email> [--limit N] [--kinds comments,changes]
|
|
438
459
|
What they did across the CRM, newest first: their comments and the
|
|
439
460
|
field changes they made (Dench / automations acting for them excluded).
|
|
440
|
-
dench members tasks <userId|email> [--limit N]
|
|
441
|
-
|
|
461
|
+
dench members tasks <userId|email> [--limit N] [--page] [--cursor TOKEN] [--done]
|
|
462
|
+
Assigned-task preview, or a cursor page for complete traversal.
|
|
442
463
|
dench members presence [<userId|email>...]
|
|
443
464
|
Live presence for some or all members.
|
|
444
465
|
dench members me [--name "…"] [--tagline "…"] [--timezone <IANA>|--auto-timezone]
|