@altertable/data-app-examples 0.78.0 → 0.79.0

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.
Files changed (28) hide show
  1. package/dist/index.js +2 -2
  2. package/dist/index.js.map +1 -1
  3. package/dist/types/index.d.ts +2 -2
  4. package/package.json +1 -1
  5. package/templates/starter-data-app/index.tsx +71 -680
  6. package/templates/starter-finding-data-app/index.tsx +9 -31
  7. package/templates/starter-local-data-app/AGENTS.md +1 -1
  8. package/templates/starter-local-data-app/README.md +5 -8
  9. package/templates/starter-local-data-app/app.ts +15 -246
  10. package/templates/starter-local-data-app/package.json +3 -3
  11. package/templates/starter-local-data-app/src/App.tsx +32 -253
  12. package/templates/starter-local-data-app/src/data-context.ts +8 -27
  13. package/templates/starter-local-data-app/src/filters.ts +9 -30
  14. package/templates/starter-local-data-app/src/operations.ts +9 -125
  15. package/templates/starter-local-finding-data-app/AGENTS.md +1 -1
  16. package/templates/starter-local-finding-data-app/README.md +2 -2
  17. package/templates/starter-local-finding-data-app/package.json +3 -3
  18. package/templates/starter-local-finding-data-app/src/App.tsx +7 -23
  19. package/templates/starter-local-finding-data-app/src/data-context.ts +3 -9
  20. package/templates/starter-local-metric-data-app/AGENTS.md +1 -1
  21. package/templates/starter-local-metric-data-app/README.md +2 -2
  22. package/templates/starter-local-metric-data-app/app.ts +4 -4
  23. package/templates/starter-local-metric-data-app/package.json +3 -3
  24. package/templates/starter-local-metric-data-app/src/App.tsx +4 -8
  25. package/templates/starter-local-metric-data-app/src/data-context.ts +4 -8
  26. package/templates/starter-local-metric-data-app/src/filters.ts +1 -0
  27. package/templates/starter-local-metric-data-app/src/operations.ts +4 -12
  28. package/templates/starter-metric-data-app/index.tsx +18 -32
@@ -289,13 +289,7 @@ export const operations = dataApp.defineOperations({
289
289
  },
290
290
  }),
291
291
  });
292
- const queryNames = {
293
- ...operations.sampleTotals.queryNames,
294
- ...operations.samplesOverTime.queryNames,
295
- ...operations.samplesByMember.queryNames,
296
- ...operations.sampleRows.queryNames,
297
- };
298
- const sampleDataContext = createDataContext(queryNames)({
292
+ const sampleDataContext = createDataContext(dataApp.queryNames)({
299
293
  description:
300
294
  'Fictional daily sample counts by group and segment. Comparisons use equal-length periods in UTC.',
301
295
  glossary: {
@@ -309,7 +303,7 @@ const sampleDataContext = createDataContext(queryNames)({
309
303
  term: 'Sample count',
310
304
  definition:
311
305
  'Number of samples recorded for each day, group, and segment.',
312
- queryNames: Object.values(queryNames),
306
+ queryNames: Object.values(dataApp.queryNames),
313
307
  },
314
308
  },
315
309
  });
@@ -322,22 +316,18 @@ const emptyFallback = {
322
316
  const totalsView = defineView({
323
317
  dataContext: sampleDataContext,
324
318
  operation: 'sampleTotals',
325
- isEmpty: rows => rows.length === 0,
326
319
  emptyFallback,
327
320
  });
328
321
  const totals = totalsView.dataset({
329
322
  name: 'Period totals',
330
- select: rows => rows,
331
323
  rowKey: () => 'total',
332
324
  columns: {
333
325
  currentCount: {
334
326
  label: 'Selected period',
335
- value: row => row.currentCount,
336
327
  format: count,
337
328
  },
338
329
  previousCount: {
339
330
  label: 'Previous period',
340
- value: row => row.previousCount,
341
331
  format: count,
342
332
  },
343
333
  },
@@ -346,49 +336,41 @@ const totals = totalsView.dataset({
346
336
  const trendView = defineView({
347
337
  dataContext: sampleDataContext,
348
338
  operation: 'samplesOverTime',
349
- isEmpty: rows => rows.length === 0,
350
339
  emptyFallback,
351
340
  });
352
341
  const trend = trendView.dataset({
353
342
  name: 'Samples over time',
354
- select: rows => rows,
355
343
  rowKey: row => row.periodStart,
356
344
  columns: {
357
- periodStart: { label: 'Period start', value: row => row.periodStart },
358
- sampleCount: { value: row => row.sampleCount, format: count },
345
+ periodStart: { label: 'Period start' },
346
+ sampleCount: { format: count },
359
347
  },
360
348
  evidence: { id: 'samples-over-time', glossaryIds: ['sampleCount'] },
361
349
  });
362
350
  const memberView = defineView({
363
351
  dataContext: sampleDataContext,
364
352
  operation: 'samplesByMember',
365
- isEmpty: rows => rows.length === 0,
366
353
  emptyFallback,
367
354
  });
368
355
  const byMember = memberView.dataset({
369
356
  name: 'Member comparison',
370
- select: rows => rows,
371
357
  rowKey: row => row.member,
372
358
  columns: {
373
- member: { label: 'Member', value: row => row.member },
359
+ member: { label: 'Member' },
374
360
  currentCount: {
375
361
  label: 'Selected period',
376
- value: row => row.currentCount,
377
362
  format: count,
378
363
  },
379
364
  previousCount: {
380
365
  label: 'Previous period',
381
- value: row => row.previousCount,
382
366
  format: count,
383
367
  },
384
368
  change: {
385
369
  label: 'Change',
386
- value: row => row.change,
387
370
  format: row => formatNumber(row.change, { signDisplay: 'exceptZero' }),
388
371
  },
389
372
  changeRate: {
390
373
  label: 'Change %',
391
- value: row => row.changeRate,
392
374
  format: row => formatPercent(row.changeRate),
393
375
  },
394
376
  },
@@ -399,13 +381,11 @@ const byMember = memberView.dataset({
399
381
  });
400
382
  const selectedMembers = memberView.dataset({
401
383
  name: 'Selected-period samples',
402
- select: rows => rows,
403
384
  rowKey: row => row.member,
404
385
  columns: {
405
- member: { label: 'Member', value: row => row.member },
386
+ member: { label: 'Member' },
406
387
  currentCount: {
407
388
  label: 'Samples',
408
- value: row => row.currentCount,
409
389
  format: count,
410
390
  },
411
391
  },
@@ -414,17 +394,15 @@ const selectedMembers = memberView.dataset({
414
394
  const rowsView = defineView({
415
395
  dataContext: sampleDataContext,
416
396
  operation: 'sampleRows',
417
- isEmpty: rows => rows.length === 0,
418
397
  emptyFallback,
419
398
  });
420
399
  const sampleRows = rowsView.dataset({
421
400
  name: 'Samples',
422
- select: rows => rows,
423
401
  rowKey: row => `${row.periodStart}:${row.member}`,
424
402
  columns: {
425
- periodStart: { label: 'Period start', value: row => row.periodStart },
426
- member: { label: 'Member', value: row => row.member },
427
- sampleCount: { value: row => row.sampleCount, format: count },
403
+ periodStart: { label: 'Period start' },
404
+ member: { label: 'Member' },
405
+ sampleCount: { format: count },
428
406
  },
429
407
  evidence: { id: 'samples', glossaryIds: ['sampleCount'] },
430
408
  });
@@ -2,7 +2,7 @@
2
2
 
3
3
  Read `node_modules/@altertable/data-app/docs/app-authoring.md` and use this project
4
4
  as the selected scaffold. If dependencies are unavailable, read the
5
- [version-matched recipe](https://github.com/altertable-ai/data-app/blob/v0.78.0/docs/app-authoring.md). <!-- x-release-please-version -->
5
+ [version-matched recipe](https://github.com/altertable-ai/data-app/blob/v0.79.0/docs/app-authoring.md). <!-- x-release-please-version -->
6
6
 
7
7
  | Task | App-owned files |
8
8
  | ------------------------------------------ | ----------------------------------------------- |
@@ -1,7 +1,7 @@
1
1
  # Local data app starter
2
2
 
3
3
  Use `node_modules/@altertable/data-app/docs/app-authoring.md` for this SDK version.
4
- Otherwise, read the [version-matched authoring recipe](https://github.com/altertable-ai/data-app/blob/v0.78.0/docs/app-authoring.md). <!-- x-release-please-version -->
4
+ Otherwise, read the [version-matched authoring recipe](https://github.com/altertable-ai/data-app/blob/v0.79.0/docs/app-authoring.md). <!-- x-release-please-version -->
5
5
  See [AGENTS.md](AGENTS.md) for app-owned files.
6
6
 
7
7
  ## Run the app
@@ -23,13 +23,10 @@ CLI proxy. Missing credentials stop startup.
23
23
 
24
24
  ## Explore the example
25
25
 
26
- Choose a billing month and customer to explore the fictional cost dashboard.
27
- Compare weekly allocations, switch the cost breakdown between services and
28
- customers, and inspect the service mix for each customer. Select a service to see
29
- its contributing customer allocations. Widget inspection exposes the registered
30
- query, selected parameters, and cost definitions. All views use the same scope;
31
- weekly batches, customer allocations, and services reconcile to the total.
32
- Logging demonstrates a recorded zero.
26
+ Choose a group to narrow the fictional sample counts. The chart, its inspected
27
+ rows, and the CSV export share one query, operation, view, and dataset. Widget
28
+ inspection exposes the registered query, selected parameters, and the sample
29
+ count definition. Gamma demonstrates a recorded zero.
33
30
 
34
31
  ## Build the app
35
32
 
@@ -2,261 +2,30 @@ import { defineDataApp } from '@altertable/data-app';
2
2
 
3
3
  export const dataApp = defineDataApp({
4
4
  // Replace the demo title, description, and scope labels with the app's identity.
5
- title: 'Infrastructure costs',
6
- description: 'USD · Fictional weekly allocations',
5
+ title: 'Sample counts',
6
+ description: 'Compare fictional sample counts across groups.',
7
7
  scope: { organization: 'demo', environment: 'sample' },
8
8
  appearance: { theme: 'system' },
9
9
  queries: {
10
- costBreakdown: {
11
- projections: {
12
- member_name: { type: 'string' },
13
- cost_cents: { type: 'number' },
14
- },
10
+ sampleCountsByGroup: {
11
+ // Fictional rows. Replace the CTE with an inspected source.
15
12
  statement: `
16
- WITH infrastructure_costs(month, service_name, customer_name, week_1, week_2, week_3, week_4) AS (
17
- -- Fictional allocation batches in integer cents.
18
- -- Replace this CTE with verified billing data.
19
- VALUES
20
- ('2026-09', 'Compute', 'Atlas', 84000, 126000, 84000, 126000),
21
- ('2026-09', 'Compute', 'Beacon', 42000, 63000, 42000, 63000),
22
- ('2026-09', 'Compute', 'Cedar', 18000, 27000, 18000, 27000),
23
- ('2026-09', 'Storage', 'Atlas', 24000, 16000, 24000, 16000),
24
- ('2026-09', 'Storage', 'Beacon', 84000, 56000, 84000, 56000),
25
- ('2026-09', 'Storage', 'Cedar', 36000, 24000, 36000, 24000),
26
- ('2026-09', 'Networking', 'Atlas', 3000, 6000, 9000, 12000),
27
- ('2026-09', 'Networking', 'Beacon', 6000, 12000, 18000, 24000),
28
- ('2026-09', 'Networking', 'Cedar', 3000, 6000, 9000, 12000),
29
- ('2026-09', 'Logging', 'Atlas', 0, 0, 0, 0),
30
- ('2026-09', 'Logging', 'Beacon', 0, 0, 0, 0),
31
- ('2026-09', 'Logging', 'Cedar', 0, 0, 0, 0),
32
- ('2026-08', 'Compute', 'Atlas', 76000, 114000, 76000, 114000),
33
- ('2026-08', 'Compute', 'Beacon', 40000, 60000, 40000, 60000),
34
- ('2026-08', 'Compute', 'Cedar', 16000, 24000, 16000, 24000),
35
- ('2026-08', 'Storage', 'Atlas', 24000, 16000, 24000, 16000),
36
- ('2026-08', 'Storage', 'Beacon', 75000, 50000, 75000, 50000),
37
- ('2026-08', 'Storage', 'Cedar', 33000, 22000, 33000, 22000),
38
- ('2026-08', 'Networking', 'Atlas', 2000, 4000, 6000, 8000),
39
- ('2026-08', 'Networking', 'Beacon', 5000, 10000, 15000, 20000),
40
- ('2026-08', 'Networking', 'Cedar', 3000, 6000, 9000, 12000),
41
- ('2026-08', 'Logging', 'Atlas', 0, 0, 0, 0),
42
- ('2026-08', 'Logging', 'Beacon', 0, 0, 0, 0),
43
- ('2026-08', 'Logging', 'Cedar', 0, 0, 0, 0)
44
- ),
45
- selected_costs AS (
46
- SELECT service_name, customer_name,
47
- week_1 + week_2 + week_3 + week_4 AS cost_cents
48
- FROM infrastructure_costs
49
- WHERE month = $month AND ($customerName = '' OR customer_name = $customerName)
13
+ WITH sample_counts(group_name, sample_count) AS (
14
+ VALUES ('Alpha', 1200), ('Alpha', 800), ('Beta', 450), ('Gamma', 0)
50
15
  )
51
- SELECT CASE WHEN $breakdown = 'service' THEN service_name ELSE customer_name END AS member_name,
52
- CAST(SUM(cost_cents) AS BIGINT) AS cost_cents
53
- FROM selected_costs GROUP BY member_name
54
- ORDER BY cost_cents DESC, member_name LIMIT $limit`,
16
+ SELECT group_name, CAST(SUM(sample_count) AS BIGINT) AS sample_count
17
+ FROM sample_counts
18
+ WHERE $groupName = 'all' OR group_name = $groupName
19
+ GROUP BY group_name
20
+ ORDER BY sample_count DESC, group_name
21
+ LIMIT $limit`,
55
22
  params: {
56
- month: { type: 'string', defaultValue: '2026-09' },
57
- customerName: { type: 'string', defaultValue: '' },
58
- breakdown: { type: 'string', defaultValue: 'service' },
23
+ groupName: { type: 'string', defaultValue: 'all' },
59
24
  limit: { type: 'number', defaultValue: 10 },
60
25
  },
61
- },
62
- totalCost: {
63
26
  projections: {
64
- cost_cents: { type: 'number' },
65
- customer_count: { type: 'number' },
66
- },
67
- statement: `
68
- WITH infrastructure_costs(month, service_name, customer_name, week_1, week_2, week_3, week_4) AS (
69
- -- Fictional allocation batches in integer cents.
70
- -- Replace this CTE with verified billing data.
71
- VALUES
72
- ('2026-09', 'Compute', 'Atlas', 84000, 126000, 84000, 126000),
73
- ('2026-09', 'Compute', 'Beacon', 42000, 63000, 42000, 63000),
74
- ('2026-09', 'Compute', 'Cedar', 18000, 27000, 18000, 27000),
75
- ('2026-09', 'Storage', 'Atlas', 24000, 16000, 24000, 16000),
76
- ('2026-09', 'Storage', 'Beacon', 84000, 56000, 84000, 56000),
77
- ('2026-09', 'Storage', 'Cedar', 36000, 24000, 36000, 24000),
78
- ('2026-09', 'Networking', 'Atlas', 3000, 6000, 9000, 12000),
79
- ('2026-09', 'Networking', 'Beacon', 6000, 12000, 18000, 24000),
80
- ('2026-09', 'Networking', 'Cedar', 3000, 6000, 9000, 12000),
81
- ('2026-09', 'Logging', 'Atlas', 0, 0, 0, 0),
82
- ('2026-09', 'Logging', 'Beacon', 0, 0, 0, 0),
83
- ('2026-09', 'Logging', 'Cedar', 0, 0, 0, 0),
84
- ('2026-08', 'Compute', 'Atlas', 76000, 114000, 76000, 114000),
85
- ('2026-08', 'Compute', 'Beacon', 40000, 60000, 40000, 60000),
86
- ('2026-08', 'Compute', 'Cedar', 16000, 24000, 16000, 24000),
87
- ('2026-08', 'Storage', 'Atlas', 24000, 16000, 24000, 16000),
88
- ('2026-08', 'Storage', 'Beacon', 75000, 50000, 75000, 50000),
89
- ('2026-08', 'Storage', 'Cedar', 33000, 22000, 33000, 22000),
90
- ('2026-08', 'Networking', 'Atlas', 2000, 4000, 6000, 8000),
91
- ('2026-08', 'Networking', 'Beacon', 5000, 10000, 15000, 20000),
92
- ('2026-08', 'Networking', 'Cedar', 3000, 6000, 9000, 12000),
93
- ('2026-08', 'Logging', 'Atlas', 0, 0, 0, 0),
94
- ('2026-08', 'Logging', 'Beacon', 0, 0, 0, 0),
95
- ('2026-08', 'Logging', 'Cedar', 0, 0, 0, 0)
96
- ),
97
- selected_costs AS (
98
- SELECT service_name, customer_name,
99
- week_1 + week_2 + week_3 + week_4 AS cost_cents
100
- FROM infrastructure_costs
101
- WHERE month = $month AND ($customerName = '' OR customer_name = $customerName)
102
- )
103
- SELECT CAST(SUM(cost_cents) AS BIGINT) AS cost_cents,
104
- COUNT(DISTINCT customer_name) AS customer_count
105
- FROM selected_costs HAVING COUNT(*) > 0`,
106
- params: {
107
- month: { type: 'string', defaultValue: '2026-09' },
108
- customerName: { type: 'string', defaultValue: '' },
109
- },
110
- },
111
- costsByCustomer: {
112
- projections: {
113
- customer_name: { type: 'string' },
114
- cost_cents: { type: 'number' },
115
- },
116
- statement: `
117
- WITH infrastructure_costs(month, service_name, customer_name, week_1, week_2, week_3, week_4) AS (
118
- -- Fictional allocation batches in integer cents.
119
- -- Replace this CTE with verified billing data.
120
- VALUES
121
- ('2026-09', 'Compute', 'Atlas', 84000, 126000, 84000, 126000),
122
- ('2026-09', 'Compute', 'Beacon', 42000, 63000, 42000, 63000),
123
- ('2026-09', 'Compute', 'Cedar', 18000, 27000, 18000, 27000),
124
- ('2026-09', 'Storage', 'Atlas', 24000, 16000, 24000, 16000),
125
- ('2026-09', 'Storage', 'Beacon', 84000, 56000, 84000, 56000),
126
- ('2026-09', 'Storage', 'Cedar', 36000, 24000, 36000, 24000),
127
- ('2026-09', 'Networking', 'Atlas', 3000, 6000, 9000, 12000),
128
- ('2026-09', 'Networking', 'Beacon', 6000, 12000, 18000, 24000),
129
- ('2026-09', 'Networking', 'Cedar', 3000, 6000, 9000, 12000),
130
- ('2026-09', 'Logging', 'Atlas', 0, 0, 0, 0),
131
- ('2026-09', 'Logging', 'Beacon', 0, 0, 0, 0),
132
- ('2026-09', 'Logging', 'Cedar', 0, 0, 0, 0),
133
- ('2026-08', 'Compute', 'Atlas', 76000, 114000, 76000, 114000),
134
- ('2026-08', 'Compute', 'Beacon', 40000, 60000, 40000, 60000),
135
- ('2026-08', 'Compute', 'Cedar', 16000, 24000, 16000, 24000),
136
- ('2026-08', 'Storage', 'Atlas', 24000, 16000, 24000, 16000),
137
- ('2026-08', 'Storage', 'Beacon', 75000, 50000, 75000, 50000),
138
- ('2026-08', 'Storage', 'Cedar', 33000, 22000, 33000, 22000),
139
- ('2026-08', 'Networking', 'Atlas', 2000, 4000, 6000, 8000),
140
- ('2026-08', 'Networking', 'Beacon', 5000, 10000, 15000, 20000),
141
- ('2026-08', 'Networking', 'Cedar', 3000, 6000, 9000, 12000),
142
- ('2026-08', 'Logging', 'Atlas', 0, 0, 0, 0),
143
- ('2026-08', 'Logging', 'Beacon', 0, 0, 0, 0),
144
- ('2026-08', 'Logging', 'Cedar', 0, 0, 0, 0)
145
- ),
146
- selected_costs AS (
147
- SELECT service_name, customer_name,
148
- week_1 + week_2 + week_3 + week_4 AS cost_cents
149
- FROM infrastructure_costs
150
- WHERE month = $month AND ($customerName = '' OR customer_name = $customerName)
151
- )
152
- SELECT customer_name, CAST(SUM(cost_cents) AS BIGINT) AS cost_cents
153
- FROM selected_costs WHERE service_name = $serviceName
154
- GROUP BY customer_name ORDER BY cost_cents DESC, customer_name LIMIT $limit`,
155
- params: {
156
- month: { type: 'string', defaultValue: '2026-09' },
157
- customerName: { type: 'string', defaultValue: '' },
158
- serviceName: { type: 'string' },
159
- limit: { type: 'number', defaultValue: 10 },
160
- },
161
- },
162
- costTrend: {
163
- projections: {
164
- period_start: { type: 'string' },
165
- cost_cents: { type: 'number' },
166
- },
167
- statement: `
168
- WITH infrastructure_costs(month, service_name, customer_name, week_1, week_2, week_3, week_4) AS (
169
- -- Fictional allocation batches in integer cents.
170
- -- Replace this CTE with verified billing data.
171
- VALUES
172
- ('2026-09', 'Compute', 'Atlas', 84000, 126000, 84000, 126000),
173
- ('2026-09', 'Compute', 'Beacon', 42000, 63000, 42000, 63000),
174
- ('2026-09', 'Compute', 'Cedar', 18000, 27000, 18000, 27000),
175
- ('2026-09', 'Storage', 'Atlas', 24000, 16000, 24000, 16000),
176
- ('2026-09', 'Storage', 'Beacon', 84000, 56000, 84000, 56000),
177
- ('2026-09', 'Storage', 'Cedar', 36000, 24000, 36000, 24000),
178
- ('2026-09', 'Networking', 'Atlas', 3000, 6000, 9000, 12000),
179
- ('2026-09', 'Networking', 'Beacon', 6000, 12000, 18000, 24000),
180
- ('2026-09', 'Networking', 'Cedar', 3000, 6000, 9000, 12000),
181
- ('2026-09', 'Logging', 'Atlas', 0, 0, 0, 0),
182
- ('2026-09', 'Logging', 'Beacon', 0, 0, 0, 0),
183
- ('2026-09', 'Logging', 'Cedar', 0, 0, 0, 0),
184
- ('2026-08', 'Compute', 'Atlas', 76000, 114000, 76000, 114000),
185
- ('2026-08', 'Compute', 'Beacon', 40000, 60000, 40000, 60000),
186
- ('2026-08', 'Compute', 'Cedar', 16000, 24000, 16000, 24000),
187
- ('2026-08', 'Storage', 'Atlas', 24000, 16000, 24000, 16000),
188
- ('2026-08', 'Storage', 'Beacon', 75000, 50000, 75000, 50000),
189
- ('2026-08', 'Storage', 'Cedar', 33000, 22000, 33000, 22000),
190
- ('2026-08', 'Networking', 'Atlas', 2000, 4000, 6000, 8000),
191
- ('2026-08', 'Networking', 'Beacon', 5000, 10000, 15000, 20000),
192
- ('2026-08', 'Networking', 'Cedar', 3000, 6000, 9000, 12000),
193
- ('2026-08', 'Logging', 'Atlas', 0, 0, 0, 0),
194
- ('2026-08', 'Logging', 'Beacon', 0, 0, 0, 0),
195
- ('2026-08', 'Logging', 'Cedar', 0, 0, 0, 0)
196
- ),
197
- -- The four fictional batch dates match the week_1 through week_4 columns.
198
- weeks(day) AS (VALUES ('01'), ('08'), ('15'), ('22'))
199
- SELECT $month || '-' || day AS period_start,
200
- CAST(SUM(CASE day WHEN '01' THEN week_1 WHEN '08' THEN week_2
201
- WHEN '15' THEN week_3 ELSE week_4 END) AS BIGINT) AS cost_cents
202
- FROM infrastructure_costs CROSS JOIN weeks
203
- WHERE month = $month AND ($customerName = '' OR customer_name = $customerName)
204
- GROUP BY day ORDER BY day LIMIT $limit`,
205
- params: {
206
- month: { type: 'string', defaultValue: '2026-09' },
207
- customerName: { type: 'string', defaultValue: '' },
208
- limit: { type: 'number', defaultValue: 10 },
209
- },
210
- },
211
- customerServiceMix: {
212
- projections: {
213
- customer_name: { type: 'string' },
214
- service_name: { type: 'string' },
215
- cost_cents: { type: 'number' },
216
- },
217
- statement: `
218
- WITH infrastructure_costs(month, service_name, customer_name, week_1, week_2, week_3, week_4) AS (
219
- -- Fictional allocation batches in integer cents.
220
- -- Replace this CTE with verified billing data.
221
- VALUES
222
- ('2026-09', 'Compute', 'Atlas', 84000, 126000, 84000, 126000),
223
- ('2026-09', 'Compute', 'Beacon', 42000, 63000, 42000, 63000),
224
- ('2026-09', 'Compute', 'Cedar', 18000, 27000, 18000, 27000),
225
- ('2026-09', 'Storage', 'Atlas', 24000, 16000, 24000, 16000),
226
- ('2026-09', 'Storage', 'Beacon', 84000, 56000, 84000, 56000),
227
- ('2026-09', 'Storage', 'Cedar', 36000, 24000, 36000, 24000),
228
- ('2026-09', 'Networking', 'Atlas', 3000, 6000, 9000, 12000),
229
- ('2026-09', 'Networking', 'Beacon', 6000, 12000, 18000, 24000),
230
- ('2026-09', 'Networking', 'Cedar', 3000, 6000, 9000, 12000),
231
- ('2026-09', 'Logging', 'Atlas', 0, 0, 0, 0),
232
- ('2026-09', 'Logging', 'Beacon', 0, 0, 0, 0),
233
- ('2026-09', 'Logging', 'Cedar', 0, 0, 0, 0),
234
- ('2026-08', 'Compute', 'Atlas', 76000, 114000, 76000, 114000),
235
- ('2026-08', 'Compute', 'Beacon', 40000, 60000, 40000, 60000),
236
- ('2026-08', 'Compute', 'Cedar', 16000, 24000, 16000, 24000),
237
- ('2026-08', 'Storage', 'Atlas', 24000, 16000, 24000, 16000),
238
- ('2026-08', 'Storage', 'Beacon', 75000, 50000, 75000, 50000),
239
- ('2026-08', 'Storage', 'Cedar', 33000, 22000, 33000, 22000),
240
- ('2026-08', 'Networking', 'Atlas', 2000, 4000, 6000, 8000),
241
- ('2026-08', 'Networking', 'Beacon', 5000, 10000, 15000, 20000),
242
- ('2026-08', 'Networking', 'Cedar', 3000, 6000, 9000, 12000),
243
- ('2026-08', 'Logging', 'Atlas', 0, 0, 0, 0),
244
- ('2026-08', 'Logging', 'Beacon', 0, 0, 0, 0),
245
- ('2026-08', 'Logging', 'Cedar', 0, 0, 0, 0)
246
- ),
247
- selected_costs AS (
248
- SELECT service_name, customer_name,
249
- week_1 + week_2 + week_3 + week_4 AS cost_cents
250
- FROM infrastructure_costs
251
- WHERE month = $month AND ($customerName = '' OR customer_name = $customerName)
252
- )
253
- SELECT customer_name, service_name, CAST(SUM(cost_cents) AS BIGINT) AS cost_cents
254
- FROM selected_costs GROUP BY customer_name, service_name
255
- ORDER BY customer_name, service_name LIMIT $limit`,
256
- params: {
257
- month: { type: 'string', defaultValue: '2026-09' },
258
- customerName: { type: 'string', defaultValue: '' },
259
- limit: { type: 'number', defaultValue: 20 },
27
+ group_name: { type: 'string' },
28
+ sample_count: { type: 'number' },
260
29
  },
261
30
  },
262
31
  },
@@ -17,9 +17,9 @@
17
17
  "lint:fix": "oxlint --type-aware --fix src app.ts"
18
18
  },
19
19
  "dependencies": {
20
- "@altertable/data-app": "0.78.0",
21
- "@altertable/data-app-bun": "0.78.0",
22
- "@altertable/data-app-react": "0.78.0",
20
+ "@altertable/data-app": "0.79.0",
21
+ "@altertable/data-app-bun": "0.79.0",
22
+ "@altertable/data-app-react": "0.79.0",
23
23
  "react": "19.3.1",
24
24
  "react-dom": "19.3.1"
25
25
  },