Repository navigation
feat(af): add endpoint path to responses - #4631
Conversation
Summary by CodeRabbit
WalkthroughRefactors AF endpoint construction to derive path from a shared Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Caller
participant Transform as AF Transform
participant Config as AF Config
Caller->>Transform: request build response
Transform->>Config: read ENDPOINT_PATH / ENDPOINT_PATH_V2
Note right of Config: BASE_ENDPOINT_PATH = "/inappevent/" #ffe6cc
Transform->>Transform: determine authVersion (v1/v2)
alt authVersion == 'v2'
Transform->>Transform: finalEndPoint = ENDPOINT_V2
Transform->>Transform: finalEndPointPath = ENDPOINT_PATH_V2
else
Transform->>Transform: finalEndPoint = ENDPOINT
Transform->>Transform: finalEndPointPath = ENDPOINT_PATH
end
Transform->>Transform: determineEndpoint(..., finalEndPoint, ...)
Transform->>Caller: response (endpoint, endpointPath, payload)
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Allure Test reports for this run are available at:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #4631 +/- ##
========================================
Coverage 91.78% 91.79%
========================================
Files 642 642
Lines 33941 33963 +22
Branches 8042 8043 +1
========================================
+ Hits 31153 31175 +22
Misses 2536 2536
Partials 252 252 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
- Update AF destination configuration - Enhance transform logic for better data processing - Update test data and validation for AF destination - Improve test utilities for integration testing
0c03538 to
1fd6bbc
Compare
|
Allure Test reports for this run are available at:
|
- Update AF destination configuration - Enhance transform logic for better data processing - Update test data and validation for AF destination - Improve test utilities for integration testing
|
Allure Test reports for this run are available at:
|
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (3)
src/v0/destinations/af/transform.js (3)
22-25: Normalize config path to avoid double slashes in endpointPath.Given config.js builds
ENDPOINT_PATHas/v1/${BASE_ENDPOINT_PATH}andENDPOINT_PATH_V2as/v2/${BASE_ENDPOINT_PATH}, ifBASE_ENDPOINT_PATHstarts with/,endpointPathwill be/v1//...or/v2//.... This can break strict assertions or downstream parsing.Prefer fixing in config.js:
-const ENDPOINT_PATH = `/v1/${BASE_ENDPOINT_PATH}`; -const ENDPOINT_PATH_V2 = `/v2/${BASE_ENDPOINT_PATH}`; +const ENDPOINT_PATH = `/v1${BASE_ENDPOINT_PATH.startsWith('/') ? '' : '/'}${BASE_ENDPOINT_PATH}`; +const ENDPOINT_PATH_V2 = `/v2${BASE_ENDPOINT_PATH.startsWith('/') ? '' : '/'}${BASE_ENDPOINT_PATH}`;As a belt-and-suspenders alternative, you can also normalize at the assignment site (see comment on Line 105).
49-55: Normalize authVersion once and reuse; simplifies logic and avoids case-sensitivity pitfalls.Today we compare raw
authVersionstrings in multiple places. Normalize once to reduce mistakes (e.g., 'V2') and make the code easier to read.- let finalEndPoint = ENDPOINT; - let finalEndPointPath = ENDPOINT_PATH; - - if (authVersion === 'v2') { - finalEndPoint = ENDPOINT_V2; - finalEndPointPath = ENDPOINT_PATH_V2; - } + const authVer = (authVersion || 'v1').toLowerCase(); + const finalEndPoint = authVer === 'v2' ? ENDPOINT_V2 : ENDPOINT; + const finalEndPointPath = authVer === 'v2' ? ENDPOINT_PATH_V2 : ENDPOINT_PATH;- const finalAuthentication = - isDefinedAndNotNull(authVersion) && authVersion === 'v2' ? s2sKey : devKey; + const finalAuthentication = authVer === 'v2' ? s2sKey : devKey;Optional: if unsupported versions are possible, add a guard earlier to throw on anything other than 'v1' or 'v2'.
Also applies to: 100-102
105-105: Set endpointPath and normalize it; verify downstream consumers expect this new field.Good addition. To avoid surprises from accidental
//, normalize the path. Also, please confirm router/test utilities and any analytics that readendpointPathare updated.- response.endpointPath = finalEndPointPath; + response.endpointPath = finalEndPointPath.replace(/\/{2,}/g, '/');If consumers expect the versioned, app-agnostic path (as introduced), this is fine. If they expect the exact request pathname (including app id), consider documenting the contract in code comments or tests.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
test/integrations/destinations/af/processor/validation.tsis excluded by!**/test/**
📒 Files selected for processing (2)
src/v0/destinations/af/config.js(2 hunks)src/v0/destinations/af/transform.js(3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- src/v0/destinations/af/config.js
🧰 Additional context used
📓 Path-based instructions (1)
**/*.js
⚙️ CodeRabbit configuration file
Focus on ESLint errors (max 3) and warnings (max 5).
Files:
src/v0/destinations/af/transform.js
🧬 Code graph analysis (1)
src/v0/destinations/af/transform.js (1)
src/v0/destinations/af/config.js (4)
ENDPOINT(62-62)ENDPOINT_PATH(60-60)ENDPOINT_V2(63-63)ENDPOINT_PATH_V2(61-61)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
- GitHub Check: Build User Transformer Docker Image - PR / Build Transformer Docker Image AMD64
- GitHub Check: Build Transformer Docker Image - PR / Build Transformer Docker Image AMD64
- GitHub Check: Code Coverage
- GitHub Check: test_and_publish
- GitHub Check: UT Tests
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: Analyze (go)



What are the changes introduced in this PR?
Updated AF destination configuration and transform logic to improve data processing capabilities.
What is the related Linear task?
Resolves https://linear.app/rudderstack/issue/INT-4102/add-endpoint-path-details-in-rudder-transformer-for-top-15
Please explain the objectives of your changes below
This PR includes updates to the AF (AppsFlyer) destination integration:
Any changes to existing capabilities/behaviour, mention the reason & what are the changes ?
Any new dependencies introduced with this change?
N/A
Any new generic utility introduced or modified. Please explain the changes.
Any technical or performance related pointers to consider with the change?
@coderabbitai review
Developer checklist
Reviewer checklist