feat(schema): add Timeline display type and TimelineSeriesSchema#2190
feat(schema): add Timeline display type and TimelineSeriesSchema#2190alex-fedotyev wants to merge 6 commits intomainfrom
Conversation
Adds `DisplayType.Timeline = 'timeline'` to the shared enum and the accompanying `TimelineSeriesSchema` + `TimelineSeries` type to `SharedChartSettingsSchema`. Updates all exhaustive `Record<DisplayType, ...>` maps: - `rawSqlParams.ts`: `QUERY_PARAMS_BY_DISPLAY_TYPE` and `QUERY_PARAM_EXAMPLES` get Timeline SQL-parameter entries and a worked example query. - `ChartEditor/constants.tsx`: `SQL_PLACEHOLDERS` gets a Timeline default query; `DISPLAY_TYPE_INSTRUCTIONS` gets the column-shape documentation (Partial Record, but added here for consistency). - `external-api/v2/utils/dashboards.ts`: two switch fall-throughs route Timeline the same way as Heatmap (unsupported for external API export, logs an error). This is PR A in a three-part chain (schema → renderer → builder). Nothing in the app renders or edits Timeline tiles yet. Co-Authored-By: Claude Opus <model> <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 510a4c8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🔴 Tier 4 — CriticalTouches auth, data models, config, tasks, OTel pipeline, ClickHouse, or CI/CD. Why this tier:
Additional context: agent branch ( Review process: Deep review from a domain expert. Synchronous walkthrough may be required. Stats
|
PR Review✅ No critical issues found. A few minor observations worth considering:
Both points are non-blocking for a schema-only PR. The Zod |
E2E Test Results✅ All tests passed • 159 passed • 3 skipped • 1231s
Tests ran across 4 shards in parallel. |
Timeline has no form-based E2E path yet (renderer and editor land in PR B/C). Excluding it from TileConfig keeps the same treatment as Heatmap and unblocks the TypeScript build. Co-Authored-By: Claude Opus <model> <noreply@anthropic.com>
- Extract Timeline SQL example to TIMELINE_EXAMPLE_SQL constant in rawSqlParams.ts and import it in ChartEditor/constants.tsx; removes the duplicate inline copy - Add .superRefine() to TimelineSeriesSchema enforcing that events mode requires labelExpression and value_change mode requires trackColumn - Add 4 unit tests covering both valid and invalid cases for the new mode-dependent validation - Fix two em-dashes in TimelineSeriesSchema JSDoc comments Co-Authored-By: Claude Opus <noreply@anthropic.com>
|
Good catch on both items. Applied in 77b24fe:
|
Prettier requires the z.object().superRefine() chain to be written as z\n .object()\n .superRefine() when the chain is too long. Reformats the schema to match. Co-Authored-By: Claude Opus <model> <noreply@anthropic.com>
|
PR B (renderer) is open at #2192 and stacked on this branch. If you're reviewing both together, start here. |
Add
DisplayType.Timelineto the shared enum and the accompanyingTimelineSeriesSchematypes. This is the first of three chained PRs landing the Timeline dashboard tile; the renderer and builder editor follow separately.Summary
Registers
DisplayType.Timeline = 'timeline'in the shared enum, addsTimelineSeriesSchemaandTimelineSeriestoSharedChartSettingsSchema, and updates all exhaustiveRecord<DisplayType, ...>maps so TypeScript compilation stays clean throughout the chain.External API (
packages/api/src/routers/external-api/v2/utils/dashboards.ts): two fall-through cases route Timeline to the existing "unsupported display type" error path, matching what Heatmap does. No Timeline tile is reachable from the external API until a later PR adds full support there.What's in this PR
DisplayType.Timelineenum value inpackages/common-utils/src/types.tsTimelineSeriesSchema(Zod) +TimelineSeries(inferred type)timelineSeries: z.array(TimelineSeriesSchema).optional()onSharedChartSettingsSchemaQUERY_PARAMS_BY_DISPLAY_TYPE[Timeline]andQUERY_PARAM_EXAMPLES[Timeline]inrawSqlParams.tsSQL_PLACEHOLDERS[Timeline]andDISPLAY_TYPE_INSTRUCTIONS[Timeline]inChartEditor/constants.tsxdashboards.tsWhat's NOT in this PR
DBTimelineChart,DashboardTimelineChart) - in PR BTimelineEditor,TimelineSeriesRow) - in PR CDBDashboardPagetile render path) - in PR Bpackages/api/src/utils/zod.tsexternal API schema mirror - in PR B or CWhy the split
The renderer and editor touch ~1 200 lines across
packages/app/. Keeping the schema as its own commit makes the exhaustive-record updates reviewable in isolation and gives PR B a clean base to target.Test plan
yarn nx run-many -t typecheck)