@dench.com/cli 2.9.4 → 2.9.6-staging.240

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 CHANGED
@@ -29,6 +29,7 @@
29
29
  */
30
30
  import type { ConvexHttpClient } from "convex/browser";
31
31
  import { makeFunctionReference } from "convex/server";
32
+ import { runAnalyticsCommand } from "./crm-analytics";
32
33
  import {
33
34
  runCommentsCommand,
34
35
  runTasksCommand,
@@ -1053,6 +1054,8 @@ export async function runCrmCommand(opts: {
1053
1054
  return await runEnrichCommand(ctx);
1054
1055
  case "reports":
1055
1056
  return await runReportsCommand(ctx);
1057
+ case "analytics":
1058
+ return await runAnalyticsCommand(ctx);
1056
1059
  case "docs":
1057
1060
  case "documents":
1058
1061
  return await runDocsCommand(ctx);
@@ -1104,6 +1107,7 @@ const CRM_SUBCOMMANDS = [
1104
1107
  "companies",
1105
1108
  "enrich",
1106
1109
  "reports",
1110
+ "analytics",
1107
1111
  "docs",
1108
1112
  "documents",
1109
1113
  "actions",
@@ -4550,6 +4554,64 @@ Cell / row / object enrichment:
4550
4554
  Reports (chart-ready JSON):
4551
4555
  dench crm reports generate '<name>' --object <object> --type pie|bar|line|table --group-by <field> [--metric count|sum --metric-field <field>]
4552
4556
 
4557
+ Analytics (the dashboard strip above every object table — same math the UI draws):
4558
+ dench crm analytics get <object> [--view <view-name>] [--json]
4559
+ Panels, field roles, the strip's collapsed flag, the fields panels may
4560
+ bucket on (synthetic $createdAt / $location last), and — with --view —
4561
+ that saved view's own dashboard (viewAnalytics; null when it inherits).
4562
+ dench crm analytics compute <object> [--view <view-name>] [--period this_week|this_month|last_month|this_quarter|last_quarter|this_year]
4563
+ [--panel <id> ...] [--panels '<JSON array of panel defs>'] [--filters '<FilterGroup JSON>'] [--json]
4564
+ Chart-ready buckets / series / values for the stored dashboard, a
4565
+ subset of its panels (--panel), or ad-hoc definitions (--panels; nothing
4566
+ is persisted). --period scopes every panel AND fills previousValue from
4567
+ the previous interval, exactly like the strip's period pill. The
4568
+ response carries a "link" that opens the dashboard in the app. Prefer
4569
+ this over "reports generate" and over aggregating query rows yourself.
4570
+ Panel def (every key the chart editor has):
4571
+ {"title","type":stat|bar|line|area|donut|funnel|leaderboard|forecast|map,
4572
+ "metric":count|sum|avg|min|max,"metricField"?,
4573
+ "groupBy"? breakdown field; $location for a map's place field;
4574
+ on line/area/forecast it splits the series into one line per value
4575
+ "dateField"?,"dateBucket"?:day|week|month|quarter time axis ($createdAt works)
4576
+ "filters"? panel-scoped FilterGroup (saved-view shape)
4577
+ "derived"?:conversion_rate|win_rate|won_amount|lost_amount|open_pipeline|pipeline_forecast|mrr|arr
4578
+ role-driven metric — ignores metric/metricField
4579
+ "span"?:2|3|4|6 width: third | half | two-thirds | full (default by chart kind)
4580
+ "hidden"?:true off the strip; only in the full analytics view
4581
+ "sortOrder"?}
4582
+ dench crm analytics save <object> <panelId> --panel '<panel JSON>' [--view <view-name>]
4583
+ Create or replace one panel (whole definition). With --view the write
4584
+ lands on that view's own dashboard (forking a copy if it was still
4585
+ inheriting the object's).
4586
+ dench crm analytics update <object> <panelId> --patch '<partial panel JSON>' [--view <view-name>]
4587
+ Edit part of a stored panel: only the keys given change; null clears
4588
+ one ("span":null → default width, "filters":null → no filter).
4589
+ dench crm analytics hide <object> <panelId> [--view <view-name>]
4590
+ dench crm analytics show <object> <panelId> [--view <view-name>]
4591
+ Take a chart off the strip above the table (it stays in the full
4592
+ analytics view, "+N more") or bring it back — the card's ⋮ menu.
4593
+ dench crm analytics resize <object> <panelId> third|half|two-thirds|full|default [--view <view-name>]
4594
+ Card width on the 6-track grid (2|3|4|6 also accepted); default clears
4595
+ it so the chart kind's default applies again.
4596
+ dench crm analytics delete <object> <panelId> [--view <view-name>]
4597
+ Idempotent; template panels (tpl:…) are tombstoned so a re-install
4598
+ never brings them back.
4599
+ dench crm analytics reorder <object> <id1> <id2> ... [--view <view-name>]
4600
+ Must name EVERY stored panel of the targeted dashboard (stats too).
4601
+ dench crm analytics roles <object> --roles '{"amount":"Amount","stage":"Stage","wonValues":["Closed Won"],"lostValues":["Closed Lost"],"convertedValues":["Qualified"],"closeDate":"Close Date","owner":"Owner","location":"Account.HQ Location","recurrence":"annual","stageProbabilities":{"Discovery":0.2,"Proposal":0.5}}' [--merge]
4602
+ The analytics setup shared by EVERY chart and view of the object —
4603
+ what the strip's ⚙ sheet edits. Replaces the mapping; --merge changes
4604
+ only the keys given (null clears one). "location" may be a relation
4605
+ path (field on the linked record); "recurrence" is monthly|annual|one_time;
4606
+ "stageProbabilities" are 0..1 per open stage for the weighted forecast.
4607
+ dench crm analytics collapse <object> | expand <object>
4608
+ Team-shared collapsed state of the strip (like saved views).
4609
+ dench crm analytics scope <object> <view-name> --mode own|shared
4610
+ own: the view gets its own dashboard (a copy of the object's panels);
4611
+ shared: back to the object's. Any active view follows its filters by
4612
+ default either way.
4613
+ Deep link: /?path=<object>&analytics=1[&view=<view>][&analyticsPeriod=<period>]
4614
+
4553
4615
  Docs:
4554
4616
  dench crm docs list
4555
4617
  dench crm docs create <path> [--title ...] [--icon ...] [--link-entry <id>]
package/dench.ts CHANGED
@@ -552,7 +552,7 @@ Meetings (CRM \`meeting\` records + their transcript, action items, attendance):
552
552
  Help: dench meetings help
553
553
 
554
554
  Notifications (the bell's inbox):
555
- dench notifications list [--filter inbox|unread|archived|all] [--limit N] [--json]
555
+ dench notifications list [--filter inbox|unread|archived|all|mentions] [--limit N] [--json]
556
556
  dench notifications count | read <id> [--unread] | read-all | archive <id>
557
557
  dench notifications prefs [--set emailEnabled=false] [--set <kind>.email=false]
558
558
  Help: dench notifications help