hyperdx/packages/common-utils
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
..
src fix: better source validation and refine required source fields (#1895) 2026-03-19 12:56:08 +00:00
.env.test Enable parallel integration testing across multiple worktrees (#1917) 2026-03-16 19:42:08 +00:00
CHANGELOG.md Release HyperDX (#1832) 2026-03-10 18:14:11 -07:00
eslint.config.mjs fix: Adjust CI logs verbosity (#1888) 2026-03-11 20:32:02 +00:00
jest.config.js fix: Adjust CI logs verbosity (#1888) 2026-03-11 20:32:02 +00:00
jest.int.config.js Enable parallel integration testing across multiple worktrees (#1917) 2026-03-16 19:42:08 +00:00
jest.setup.ts fix: Adjust CI logs verbosity (#1888) 2026-03-11 20:32:02 +00:00
package.json Release HyperDX (#1832) 2026-03-10 18:14:11 -07:00
README.md DX: running api + app + task concurrently with npm script (dev) (#567) 2025-01-23 17:31:25 +00:00
tsconfig.json Improve common-utils intellisense. Currently "Go to Definition" on an… (#1159) 2025-09-11 12:57:41 -06:00
tsup.config.ts feat: introduce common-utils package (#554) 2025-01-16 18:15:22 +00:00

How to test the package with HyperDX app/api

  1. Run yarn build in the root directory of this project (packages/common-utils)
  2. Run yarn dev in the root directory of app/api project (packages/app,api)
  3. You should be able to test utils with the app