-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: update proxy data type for response handler input #3030
Merged
Merged
Changes from 27 commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
7d6ea12
feat: update proxy data type for response handler input
utsabc b1327eb
feat: update proxy v1 test cases
utsabc 30c4eca
Merge branch 'develop' into fix.network-handlers
utsabc 9dd8625
feat: update proxy tests for cm360
utsabc 650911e
fix: typo
utsabc 84b6a5d
Update test/integrations/destinations/campaign_manager/dataDelivery/b…
utsabc 686f524
Update test/integrations/destinations/campaign_manager/dataDelivery/b…
utsabc 76e0284
fix: api contract for v1 proxy
utsabc 93947db
fix: api contract for v1 proxy (#3049)
utsabc d2e65f4
chore: clean up zod type
7ce0a66
chore: update testutils
99f5cb2
chore: update V0 proxy request type and zod schema
0504ffa
feat: update proxy tests for cm360 (#3039)
utsabc bd6af6b
Merge branch 'develop' into fix.network-handlers
utsabc 014bf5e
Merge branch 'develop' of github.com:rudderlabs/rudder-transformer in…
b57a926
Merge branch 'fix.network-handlers' of github.com:rudderlabs/rudder-t…
325433b
feat: adding zod validations (#3066)
utsabc 689b0cd
chore: update delivery test cases for criteo audience
ItsSudip 9e04774
Revert "chore: update delivery test cases for criteo audience"
ItsSudip 7114f9b
chore: add type def for proxy v1 test
33d4d62
chore: fix generateMetdata func
455dce7
chore: criteo audience update proxy test (#3068)
ItsSudip c7133b3
chore: enable batch response schema check (#3083)
chandumlg a8b8f23
chore: braze proxy v1 test (#3087)
utsabc fe18acd
chore: resolve conflicts
3a8f67b
Merge branch 'develop' into fix.network-handlers
utsabc b29d624
chore: resolve conflicts
2aa9bf2
Merge branch 'develop' into fix.network-handlers
utsabc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ import groupBy from 'lodash/groupBy'; | |
import cloneDeep from 'lodash/cloneDeep'; | ||
import { DestinationService } from '../../interfaces/DestinationService'; | ||
import { | ||
DeliveryResponse, | ||
DeliveryV0Response, | ||
ErrorDetailer, | ||
MetaTransferObject, | ||
ProcessorTransformationRequest, | ||
|
@@ -16,9 +16,9 @@ import { | |
UserDeletionRequest, | ||
UserDeletionResponse, | ||
ProxyRequest, | ||
ProxyDeliveriesRequest, | ||
ProxyDeliveryRequest, | ||
DeliveriesResponse, | ||
ProxyV0Request, | ||
ProxyV1Request, | ||
DeliveryV1Response, | ||
DeliveryJobState, | ||
} from '../../types/index'; | ||
import { DestinationPostTransformationService } from './postTransformation'; | ||
|
@@ -181,7 +181,7 @@ export class NativeIntegrationDestinationService implements DestinationService { | |
destinationType: string, | ||
_requestMetadata: NonNullable<unknown>, | ||
version: string, | ||
): Promise<DeliveryResponse | DeliveriesResponse> { | ||
): Promise<DeliveryV0Response | DeliveryV1Response> { | ||
try { | ||
const { networkHandler, handlerVersion } = networkHandlerFactory.getNetworkHandler( | ||
destinationType, | ||
|
@@ -191,24 +191,22 @@ export class NativeIntegrationDestinationService implements DestinationService { | |
const processedProxyResponse = networkHandler.processAxiosResponse(rawProxyResponse); | ||
let rudderJobMetadata = | ||
version.toLowerCase() === 'v1' | ||
? (deliveryRequest as ProxyDeliveriesRequest).metadata | ||
: (deliveryRequest as ProxyDeliveryRequest).metadata; | ||
? (deliveryRequest as ProxyV1Request).metadata | ||
: (deliveryRequest as ProxyV0Request).metadata; | ||
|
||
if (version.toLowerCase() === 'v1' && handlerVersion.toLowerCase() === 'v0') { | ||
rudderJobMetadata = rudderJobMetadata[0]; | ||
} | ||
|
||
let responseProxy = networkHandler.responseHandler( | ||
{ | ||
...processedProxyResponse, | ||
rudderJobMetadata, | ||
}, | ||
destinationType, | ||
); | ||
const responseParams = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the core part where the change has been done which affects all network handlers |
||
destinationResponse: processedProxyResponse, | ||
rudderJobMetadata, | ||
destType: destinationType, | ||
}; | ||
let responseProxy = networkHandler.responseHandler(responseParams); | ||
// Adaption Logic for V0 to V1 | ||
if (handlerVersion.toLowerCase() === 'v0' && version.toLowerCase() === 'v1') { | ||
const v0Response = responseProxy as DeliveryResponse; | ||
const jobStates = (deliveryRequest as ProxyDeliveriesRequest).metadata.map( | ||
const v0Response = responseProxy as DeliveryV0Response; | ||
const jobStates = (deliveryRequest as ProxyV1Request).metadata.map( | ||
(metadata) => | ||
({ | ||
error: JSON.stringify(v0Response.destinationResponse?.response), | ||
|
@@ -221,7 +219,7 @@ export class NativeIntegrationDestinationService implements DestinationService { | |
status: v0Response.status, | ||
message: v0Response.message, | ||
authErrorCategory: v0Response.authErrorCategory, | ||
} as DeliveriesResponse; | ||
} as DeliveryV1Response; | ||
} | ||
return responseProxy; | ||
} catch (err: any) { | ||
|
@@ -236,10 +234,10 @@ export class NativeIntegrationDestinationService implements DestinationService { | |
); | ||
|
||
if (version.toLowerCase() === 'v1') { | ||
metaTO.metadatas = (deliveryRequest as ProxyDeliveriesRequest).metadata; | ||
metaTO.metadatas = (deliveryRequest as ProxyV1Request).metadata; | ||
return DestinationPostTransformationService.handlevV1DeliveriesFailureEvents(err, metaTO); | ||
} | ||
metaTO.metadata = (deliveryRequest as ProxyDeliveryRequest).metadata; | ||
metaTO.metadata = (deliveryRequest as ProxyV0Request).metadata; | ||
return DestinationPostTransformationService.handleDeliveryFailureEvents(err, metaTO); | ||
} | ||
} | ||
|
This file contains 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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the
deliverToDestinationV1
method, the handling ofDeliveryV1Response
andProxyV1Request
is consistent with the PR's goal. However, the access tometadata[0]
assumes that themetadata
array is not empty. It's recommended to add a check for the array's length to avoid potential runtime errors.