Migrate enrichment from backend to Supabase edge function#2853
Open
malek10xdev wants to merge 5 commits into
Open
Migrate enrichment from backend to Supabase edge function#2853malek10xdev wants to merge 5 commits into
malek10xdev wants to merge 5 commits into
Conversation
Add a new Supabase Edge Function for contact enrichment that: - POST /enrich/person - enrich a single contact with cache check, credit validation, task tracking, and result storage - POST /enrich/person/bulk - bulk enrich contacts with cache, credit limits, and progress tracking - POST /enrich/webhook/:id - async webhook handler for 3rd-party enrichment engine results - Uses Hono framework, structured logging, i18n support
Replace backend calls with supabase.functions.invoke for enrichment endpoints. Adapt response handling to work with the edge function response format (non-2xx body parsing, status adaptation).
Remove the old backend enrichment controller, routes, and all enrichment service implementations (enrich-layer, thedig, voilanorbert). This functionality has been migrated to the supabase/functions/enrich edge function.
Coverage Report✅ Passed Commit: ee066b4 Summary
All files
No coverage changes
Generated by Test Coverage Reporter for commit ee066b4 |
The open-source enrich function should not contain billing logic. Billing (credit validation and deduction) will be added in the leadminer-commercial repo by overriding this function to call the billing edge function. Remove: validate_customer_credits RPC, deduct_customer_credits RPC, ValidateCreditsResult interface, credits_insufficient i18n keys, and all credit-related branching logic.
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.
Summary
Migrate the contact enrichment service from the Node.js backend (controllers, routes, enrichment engines) to a new
supabase/functions/enrichedge function. This reduces backend surface area and moves enrichment logic closer to Supabase.Changes
supabase/functions/enrichedge function with three endpoints:POST /enrich/person- single contact enrichment with cache check, credit validation, task tracking, and result storagePOST /enrich/person/bulk- bulk enrichment with cache hits, credit-limited processing, and progress trackingPOST /enrich/webhook/:id- async webhook for third-party enrichment engine resultsEnrichButton.vuefrontend component to callsupabase.functions.invokeinstead of `` backend callsTesting