Skip to content

Commit a67f1e7

Browse files
os-zhuangclaude
andauthored
chore(deps): upgrade ObjectStack to v9.0.0 + analytics single-form migration (#381)
Upgrade all @objectstack/* packages ^8.0.1 -> ^9.0.0 and complete the v9 breaking changes (docs.objectstack.ai/docs/releases/v9). Analytics single-form cutover (ADR-0021): the inline analytics authoring fields were removed in v9, so drop them from every dashboard widget (object/categoryField/valueField/aggregate) and report (objectName/columns/groupingsDown/groupingsAcross; filter -> runtimeFilter), keeping only the dataset-bound form (dataset/dimensions|rows/values). Fixes surfaced by v9's stricter validation and dataset-only rendering: - chartConfig axis `field` must reference dataset MEASURE/DIMENSION names, not raw object fields (amount->total_amount, count->case_count/account_count, list_price->list_price_sum) — otherwise the chart renders empty ("No rows"). - Invalid relative-date macros never resolved and matched nothing: {last_12_months}/{last_6_months}/{last_30_days} -> {12_months_ago}/{6_months_ago}/{30_days_ago}. - Seed option values rejected by v9 insert validation: opportunity type renewal->existing_renewal, lead_source advertising->advertisement (incl. the generator arrays); lead industry travel->hospitality, financial_services->finance, consumer_goods->retail, construction->other. Realigned the Sales "Deal Type" filter options too. Verified in-browser: all 4 dashboards and 10 reports render real data with zero "No rows" failures; clean seed (no validation errors); core CRM list views load. tsc / validate / build / lint all green. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 3aa4675 commit a67f1e7

12 files changed

Lines changed: 525 additions & 691 deletions

package.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@
2626
},
2727
"packageManager": "pnpm@10.33.0",
2828
"dependencies": {
29-
"@objectstack/account": "^8.0.1",
30-
"@objectstack/cli": "^8.0.1",
31-
"@objectstack/driver-memory": "^8.0.1",
32-
"@objectstack/driver-sql": "^8.0.1",
33-
"@objectstack/driver-sqlite-wasm": "^8.0.1",
34-
"@objectstack/metadata": "^8.0.1",
35-
"@objectstack/objectql": "^8.0.1",
36-
"@objectstack/runtime": "^8.0.1",
37-
"@objectstack/service-analytics": "^8.0.1",
38-
"@objectstack/service-automation": "^8.0.1",
39-
"@objectstack/spec": "^8.0.1"
29+
"@objectstack/account": "^9.0.0",
30+
"@objectstack/cli": "^9.0.0",
31+
"@objectstack/driver-memory": "^9.0.0",
32+
"@objectstack/driver-sql": "^9.0.0",
33+
"@objectstack/driver-sqlite-wasm": "^9.0.0",
34+
"@objectstack/metadata": "^9.0.0",
35+
"@objectstack/objectql": "^9.0.0",
36+
"@objectstack/runtime": "^9.0.0",
37+
"@objectstack/service-analytics": "^9.0.0",
38+
"@objectstack/service-automation": "^9.0.0",
39+
"@objectstack/spec": "^9.0.0"
4040
},
4141
"optionalDependencies": {
4242
"better-sqlite3": "^12.10.0"

pnpm-lock.yaml

Lines changed: 477 additions & 432 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/dashboards/crm.dashboard.ts

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,7 @@ export const CrmOverviewDashboard: Dashboard = {
5757
title: 'Total Revenue',
5858
description: 'Closed-won revenue this period',
5959
type: 'metric',
60-
object: 'crm_opportunity',
6160
filter: { stage: 'closed_won' },
62-
valueField: 'amount',
63-
aggregate: 'sum',
6461
colorVariant: 'success',
6562
actionUrl: '/reports/revenue',
6663
actionType: 'url',
@@ -77,9 +74,7 @@ export const CrmOverviewDashboard: Dashboard = {
7774
title: 'Active Deals',
7875
description: 'Open opportunities in the pipeline',
7976
type: 'metric',
80-
object: 'crm_opportunity',
8177
filter: { stage: { $nin: ['closed_won', 'closed_lost'] } },
82-
aggregate: 'count',
8378
colorVariant: 'blue',
8479
actionUrl: '/objects/opportunity?filter=open',
8580
actionType: 'url',
@@ -97,10 +92,7 @@ export const CrmOverviewDashboard: Dashboard = {
9792
title: 'Won Deals',
9893
description: 'Closed-won deals this period',
9994
type: 'metric',
100-
object: 'crm_opportunity',
10195
filter: { stage: 'closed_won' },
102-
valueField: 'id',
103-
aggregate: 'count',
10496
colorVariant: 'purple',
10597
actionUrl: '/reports/win-rate',
10698
actionType: 'url',
@@ -118,10 +110,7 @@ export const CrmOverviewDashboard: Dashboard = {
118110
title: 'Avg Deal Size',
119111
description: 'Average value of closed-won deals',
120112
type: 'metric',
121-
object: 'crm_opportunity',
122113
filter: { stage: 'closed_won' },
123-
valueField: 'amount',
124-
aggregate: 'avg',
125114
colorVariant: 'orange',
126115
actionUrl: '/reports/avg-deal-size',
127116
actionType: 'url',
@@ -140,11 +129,7 @@ export const CrmOverviewDashboard: Dashboard = {
140129
title: 'Revenue Trends',
141130
description: 'Closed-won revenue over the last 12 months',
142131
type: 'area',
143-
object: 'crm_opportunity',
144-
filter: { stage: 'closed_won', close_date: { $gte: '{last_12_months}' } },
145-
categoryField: 'close_date',
146-
valueField: 'amount',
147-
aggregate: 'sum',
132+
filter: { stage: 'closed_won', close_date: { $gte: '{12_months_ago}' } },
148133
colorVariant: 'success',
149134
dataset: 'opportunity_metrics', dimensions: ['close_date'], values: ['total_amount'],
150135
layout: { x: 0, y: 2, w: 9, h: 4 },
@@ -154,7 +139,7 @@ export const CrmOverviewDashboard: Dashboard = {
154139
showDataLabels: false,
155140
colors: ['#10B981'],
156141
xAxis: { field: 'close_date', title: 'Month', showGridLines: false, logarithmic: false },
157-
yAxis: [{ field: 'amount', title: 'Revenue', format: '$0,0', showGridLines: true, logarithmic: false }],
142+
yAxis: [{ field: 'total_amount', title: 'Revenue', format: '$0,0', showGridLines: true, logarithmic: false }],
158143
interaction: { tooltips: true, brush: true, zoom: false },
159144
},
160145
options: { dateGranularity: 'month' },
@@ -164,10 +149,6 @@ export const CrmOverviewDashboard: Dashboard = {
164149
title: 'Lead Source',
165150
description: 'Pipeline value by acquisition channel',
166151
type: 'donut',
167-
object: 'crm_opportunity',
168-
categoryField: 'lead_source',
169-
valueField: 'amount',
170-
aggregate: 'sum',
171152
colorVariant: 'purple',
172153
dataset: 'opportunity_metrics', dimensions: ['lead_source'], values: ['total_amount'],
173154
layout: { x: 9, y: 2, w: 3, h: 4 },
@@ -185,11 +166,7 @@ export const CrmOverviewDashboard: Dashboard = {
185166
title: 'Pipeline by Stage',
186167
description: 'Open opportunity value at each sales stage',
187168
type: 'funnel',
188-
object: 'crm_opportunity',
189169
filter: { stage: { $nin: ['closed_won', 'closed_lost'] } },
190-
categoryField: 'stage',
191-
valueField: 'amount',
192-
aggregate: 'sum',
193170
colorVariant: 'teal',
194171
dataset: 'opportunity_metrics', dimensions: ['stage'], values: ['total_amount'],
195172
layout: { x: 0, y: 6, w: 6, h: 4 },
@@ -205,10 +182,6 @@ export const CrmOverviewDashboard: Dashboard = {
205182
title: 'Top Products',
206183
description: 'Total list-price revenue by product category',
207184
type: 'bar',
208-
object: 'crm_product',
209-
categoryField: 'category',
210-
valueField: 'list_price',
211-
aggregate: 'sum',
212185
colorVariant: 'blue',
213186
dataset: 'product_metrics', dimensions: ['category'], values: ['list_price_sum'],
214187
layout: { x: 6, y: 6, w: 6, h: 4 },
@@ -218,7 +191,7 @@ export const CrmOverviewDashboard: Dashboard = {
218191
showDataLabels: true,
219192
colors: ['#4F46E5'],
220193
xAxis: { field: 'category', title: 'Category', showGridLines: false, logarithmic: false },
221-
yAxis: [{ field: 'list_price', title: 'Revenue', format: '$0,0', showGridLines: true, logarithmic: false }],
194+
yAxis: [{ field: 'list_price_sum', title: 'Revenue', format: '$0,0', showGridLines: true, logarithmic: false }],
222195
},
223196
},
224197

@@ -228,8 +201,6 @@ export const CrmOverviewDashboard: Dashboard = {
228201
title: 'Recent Opportunities',
229202
description: 'Most recently updated deals across the team',
230203
type: 'table',
231-
object: 'crm_opportunity',
232-
aggregate: 'count',
233204
colorVariant: 'default',
234205
dataset: 'opportunity_metrics', values: ['opp_count'],
235206
layout: { x: 0, y: 10, w: 12, h: 4 },

src/dashboards/executive.dashboard.ts

Lines changed: 4 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,7 @@ export const ExecutiveDashboard: Dashboard = {
6767
title: 'Total Revenue (YTD)',
6868
description: 'Closed-won revenue this year',
6969
type: 'metric',
70-
object: 'crm_opportunity',
7170
filter: { stage: 'closed_won', close_date: { $gte: '{current_year_start}' } },
72-
valueField: 'amount',
73-
aggregate: 'sum',
7471
colorVariant: 'success',
7572
actionUrl: '/reports/revenue-ytd',
7673
actionType: 'url',
@@ -87,9 +84,7 @@ export const ExecutiveDashboard: Dashboard = {
8784
title: 'Active Accounts',
8885
description: 'Customers with at least one active relationship',
8986
type: 'metric',
90-
object: 'crm_account',
9187
filter: { is_active: true },
92-
aggregate: 'count',
9388
colorVariant: 'blue',
9489
actionUrl: '/objects/account',
9590
actionType: 'url',
@@ -107,8 +102,6 @@ export const ExecutiveDashboard: Dashboard = {
107102
title: 'Total Contacts',
108103
description: 'People in our address book',
109104
type: 'metric',
110-
object: 'crm_contact',
111-
aggregate: 'count',
112105
colorVariant: 'purple',
113106
actionUrl: '/objects/contact',
114107
actionType: 'url',
@@ -126,9 +119,7 @@ export const ExecutiveDashboard: Dashboard = {
126119
title: 'Open Leads',
127120
description: 'Unconverted leads in the funnel',
128121
type: 'metric',
129-
object: 'crm_lead',
130122
filter: { is_converted: false },
131-
aggregate: 'count',
132123
colorVariant: 'orange',
133124
actionUrl: '/objects/lead',
134125
actionType: 'url',
@@ -148,11 +139,7 @@ export const ExecutiveDashboard: Dashboard = {
148139
title: 'Revenue Trend',
149140
description: 'Closed-won revenue over the last 12 months',
150141
type: 'area',
151-
object: 'crm_opportunity',
152-
filter: { stage: 'closed_won', close_date: { $gte: '{last_12_months}' } },
153-
categoryField: 'close_date',
154-
valueField: 'amount',
155-
aggregate: 'sum',
142+
filter: { stage: 'closed_won', close_date: { $gte: '{12_months_ago}' } },
156143
colorVariant: 'success',
157144
dataset: 'opportunity_metrics', dimensions: ['close_date'], values: ['total_amount'],
158145
layout: { x: 0, y: 2, w: 8, h: 4 },
@@ -164,7 +151,7 @@ export const ExecutiveDashboard: Dashboard = {
164151
showDataLabels: false,
165152
colors: ['#10B981'],
166153
xAxis: { field: 'close_date', title: 'Month', showGridLines: false, logarithmic: false },
167-
yAxis: [{ field: 'amount', title: 'Revenue', format: '$0,0', showGridLines: true, logarithmic: false }],
154+
yAxis: [{ field: 'total_amount', title: 'Revenue', format: '$0,0', showGridLines: true, logarithmic: false }],
168155
interaction: { tooltips: true, zoom: false, brush: true },
169156
},
170157
options: { dateGranularity: 'month' },
@@ -174,11 +161,7 @@ export const ExecutiveDashboard: Dashboard = {
174161
title: 'Revenue by Industry',
175162
description: 'YTD closed-won revenue split by customer industry',
176163
type: 'donut',
177-
object: 'crm_opportunity',
178164
filter: { stage: 'closed_won', close_date: { $gte: '{current_year_start}' } },
179-
categoryField: 'crm_account.industry',
180-
valueField: 'amount',
181-
aggregate: 'sum',
182165
colorVariant: 'blue',
183166
dataset: 'opportunity_metrics', dimensions: ['account_industry'], values: ['total_amount'],
184167
layout: { x: 8, y: 2, w: 4, h: 4 },
@@ -196,11 +179,7 @@ export const ExecutiveDashboard: Dashboard = {
196179
title: 'Pipeline by Stage',
197180
description: 'Open opportunity value by sales stage',
198181
type: 'funnel',
199-
object: 'crm_opportunity',
200182
filter: { stage: { $nin: ['closed_won', 'closed_lost'] } },
201-
categoryField: 'stage',
202-
valueField: 'amount',
203-
aggregate: 'sum',
204183
colorVariant: 'teal',
205184
dataset: 'opportunity_metrics', dimensions: ['stage'], values: ['total_amount'],
206185
layout: { x: 0, y: 6, w: 6, h: 4 },
@@ -216,10 +195,7 @@ export const ExecutiveDashboard: Dashboard = {
216195
title: 'New Accounts',
217196
description: 'Account creation cadence — last 6 months',
218197
type: 'bar',
219-
object: 'crm_account',
220-
filter: { created_at: { $gte: '{last_6_months}' } },
221-
categoryField: 'created_at',
222-
aggregate: 'count',
198+
filter: { created_at: { $gte: '{6_months_ago}' } },
223199
colorVariant: 'purple',
224200
dataset: 'account_metrics', dimensions: ['created_at'], values: ['account_count'],
225201
layout: { x: 6, y: 6, w: 6, h: 4 },
@@ -229,7 +205,7 @@ export const ExecutiveDashboard: Dashboard = {
229205
showDataLabels: true,
230206
colors: ['#8B5CF6'],
231207
xAxis: { field: 'created_at', title: 'Month', showGridLines: false, logarithmic: false },
232-
yAxis: [{ field: 'count', title: 'New accounts', showGridLines: true, logarithmic: false }],
208+
yAxis: [{ field: 'account_count', title: 'New accounts', showGridLines: true, logarithmic: false }],
233209
},
234210
options: { dateGranularity: 'month' },
235211
},
@@ -240,8 +216,6 @@ export const ExecutiveDashboard: Dashboard = {
240216
title: 'Top Accounts by Revenue',
241217
description: 'Largest customers ranked by annual revenue',
242218
type: 'table',
243-
object: 'crm_account',
244-
aggregate: 'count',
245219
colorVariant: 'default',
246220
dataset: 'account_metrics', values: ['account_count'],
247221
layout: { x: 0, y: 10, w: 12, h: 4 },

0 commit comments

Comments
 (0)