feature: Added V2 API endpoint for Connections.#2452
Conversation
Added connections endpoint to /api/v2/connections supporting list, get, create, update, all using Bearer token auth.
🦋 Changeset detectedLatest commit: a9bed8b The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 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:
Review process: Deep review from a domain expert. Synchronous walkthrough may be required. Stats
|
Greptile SummaryAdds a full CRUD
Confidence Score: 5/5Safe to merge — auth scoping, password exclusion, and field-clearing semantics are all correctly implemented and well-tested. The new external connections router correctly enforces team isolation on every operation, never leaks passwords, and handles the tricky PUT partial-update semantics (keep/clear optional fields) properly. Test coverage is thorough across auth, isolation, and edge cases. openapi.json — POST create is documented as 200 instead of 201, and the 403 response is missing from several single-resource operation specs. Important Files Changed
Reviews (4): Last reviewed commit: "Merge branch 'main' into jordansimonovsk..." | Re-trigger Greptile |
E2E Test Results✅ All tests passed • 202 passed • 3 skipped • 1307s
Tests ran across 4 shards in parallel. |
…g serialization error
knudtty
left a comment
There was a problem hiding this comment.
Just team adjacent requests
| const updateConnectionBodySchema = ConnectionSchema.omit({ id: true }).extend({ | ||
| hyperdxSettingPrefix: z | ||
| .string() | ||
| .regex(/^[a-z0-9_]+$/i) |
There was a problem hiding this comment.
I feel like this regex might be overkill, probably fine though
| const connections = await getConnections(); | ||
| const { teamId } = getNonNullUserWithTeam(req); | ||
|
|
||
| const connections = await getConnectionsByTeam(teamId.toString()); | ||
|
|
||
| res.json(connections.map(c => c.toJSON({ virtuals: true }))); |
There was a problem hiding this comment.
Assuming only one team is fine here
| // Returns all connections across all teams. Only intended for instance-level | ||
| // operations (e.g. startup auto-provisioning); user-facing routes must use | ||
| // the team-scoped variants below. | ||
| export function getConnections() { | ||
| // Never return password back to the user | ||
| // Return all connections in current tenant |
There was a problem hiding this comment.
same comment, assuming one team is fine
There was a problem hiding this comment.
Given the team ID is derived from the personal tokens in UI, I feel it would be a security issue if we could modify multiple teams with the one token.
We may need to rethink how we manage API tokens in the future if we want to be able to define team IDs dynamically.
Summary
Added connections endpoint to /api/v2/connections supporting list, get, create, update, all using Bearer token auth.
References
See Linear ticket for more information on this.
resolves: HDX-4530