feat: add NangoConnection<I> extractor for nango-powered integration routes#3962
Open
devin-ai-integration[bot] wants to merge 5 commits intomainfrom
Open
feat: add NangoConnection<I> extractor for nango-powered integration routes#3962devin-ai-integration[bot] wants to merge 5 commits intomainfrom
devin-ai-integration[bot] wants to merge 5 commits intomainfrom
Conversation
…routes - Add nango_connections supabase migration table - Add OwnedNangoProxy + OwnedNangoHttpClient to nango crate - Add NangoIntegrationId trait with GoogleCalendar/GoogleDrive marker types - Add NangoConnection<I> axum extractor (resolves connection_id from DB) - Extend webhook handler to upsert/delete nango_connections - Refactor api-calendar to use NangoConnection<GoogleCalendar> - Refactor api-storage to use NangoConnection<GoogleDrive> - Remove connection_id from request bodies (server-side lookup) - Remove duplicated config.rs/state.rs from api-calendar and api-storage Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
✅ Deploy Preview for hyprnote-storybook canceled.
|
✅ Deploy Preview for hyprnote canceled.
|
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat: add NangoConnection<I> extractor for nango-powered integration routes
Summary
Introduces a generic
NangoConnection<I>axum extractor that resolves a user's Nangoconnection_idfrom a Supabasenango_connectionstable, removing the need for clients to passconnection_idin every request body. The extractor uses marker types (Option B from design discussion) for type-safe integration identification.Key pieces:
nango_connectionstable) — storesuser_id ↔ connection_idper integration, populated by webhookOwnedNangoProxy+OwnedNangoHttpClientincrates/nango— owned variants to solve lifetime issues in extractorsNangoIntegrationIdtrait +GoogleCalendar/GoogleDrivemarker types incrates/api-nangoNangoConnection<I>extractor — readsAuthContextfor user_id, queries Supabase PostgREST for connection_id, builds ready-to-use HTTP clientconnection_idremoved from all request bodies, duplicatedconfig.rs/state.rsdeletedBefore → After (handler example):
Review & Testing Checklist for Human
connection_idis removed from all calendar/storage request bodies. Verify frontend/client code is updated accordingly or this is intentional for a new flow.20250214000000_create_nango_connections.sql— RLS policies, FK constraint, unique index on(user_id, integration_id).end_user.end_user_idfrom Nango webhook matches Supabaseauth.users.idformat (UUID string).NangoConnectionStateextension is available to calendar routes (added after.nest("/calendar", ...)but before auth middleware).nango_connections→ call/calendar/calendarswith just auth token → verify it resolves connection and returns data.Notes
supabase_service_role_keyenv var is optional — webhooks will log errors but returnokif not setlist_calendarsis now a POST with no request body (just the extractor)OwnedNangoProxyduplicates method signatures fromNangoProxy— shared header logic extracted toapply_proxy_headersLink to Devin run: https://app.devin.ai/sessions/95a166d9b051412fb31184ba37b3b80f
Requested by: @yujonglee