hyperdx/packages/common-utils/src
Aaron Knudtson ce8506478d
fix: better source validation and refine required source fields (#1895)
## Summary

Large refactor changing the TSource type to a true discriminated union. This means that the expected fields for `kind: 'log'` will differ from those for `'trace', 'session', 'metrics'`.  This avoids the current laissez faire source type that currently exists, and required extensive changes across the api and app packages. Also includes a nice addition to `useSource` - you can now specify a `kind` field, which will properly infer the type of the returned source. 

This also makes use of discriminators in mongoose. This does change a bit of the way that we create and update sources. Obvious changes to sources have also been made, namely making `timeValueExpression` required on sources. Care has been taken to avoid requiring a migration.

### How to test locally or on Vercel

1. `yarn dev`
2. Play around with the app, especially around source creation, source edits, and loading existing sources from a previous version

### References

- Linear Issue: References HDX-3352
- Related PRs:

Ref: HDX-3352
2026-03-19 12:56:08 +00:00
..
__tests__ fix: better source validation and refine required source fields (#1895) 2026-03-19 12:56:08 +00:00
clickhouse fix: better source validation and refine required source fields (#1895) 2026-03-19 12:56:08 +00:00
core fix: better source validation and refine required source fields (#1895) 2026-03-19 12:56:08 +00:00
guards.ts feat: Add RawSqlChartConfig types for SQL-based Table (#1846) 2026-03-05 20:30:58 +00:00
macros.ts feat: Add support for dashboard filters on Raw SQL Charts (#1924) 2026-03-18 12:03:27 +00:00
queryParser.ts feat: Add support for querying nested/array fields (#1660) 2026-02-04 17:34:48 +00:00
rawSqlParams.ts feat: Add support for dashboard filters on Raw SQL Charts (#1924) 2026-03-18 12:03:27 +00:00
sqlFormatter.ts fix: Support formatting queries with % operator (#1427) 2025-12-02 20:04:31 +00:00
types.ts fix: better source validation and refine required source fields (#1895) 2026-03-19 12:56:08 +00:00
validation.ts feat: Improve Slack Webhook validation (#1153) 2025-09-11 11:41:11 -04:00