Skip to content

Commit

Permalink
fix: marketo backward compatibility (#2880)
Browse files Browse the repository at this point in the history
  • Loading branch information
utsabc authored Dec 6, 2023
2 parents 45db590 + 24a2cd4 commit af6aebb
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 32 deletions.
17 changes: 1 addition & 16 deletions src/services/destination/postTransformation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,6 @@ import { ErrorReportingService } from '../errorReporting';
import tags from '../../v0/util/tags';
import stats from '../../util/stats';

type ErrorResponse = {
status?: number;
message?: string;
destinationResponse?: object;
statTags?: object;
authErrorCategory?: string | undefined;
response?: object | undefined;
};

export class DestinationPostTransformationService {
public static handleProcessorTransformSucessEvents(
event: ProcessorTransformationRequest,
Expand Down Expand Up @@ -148,7 +139,7 @@ export class DestinationPostTransformationService {
}

public static handleDeliveryFailureEvents(
error: ErrorResponse,
error: NonNullable<unknown>,
metaTo: MetaTransferObject,
): DeliveryResponse {
const errObj = generateErrorObject(error, metaTo.errorDetails, false);
Expand All @@ -161,12 +152,6 @@ export class DestinationPostTransformationService {
authErrorCategory: errObj.authErrorCategory,
}),
} as DeliveryResponse;

// for transformer-proxy to maintain contract
const { response } = error;
if (response) {
resp.response = response;
}
ErrorReportingService.reportError(error, metaTo.errorContext, resp);
return resp;
}
Expand Down
18 changes: 6 additions & 12 deletions src/v0/destinations/marketo/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,18 @@ const DESTINATION = 'marketo';
const formatConfig = (destination) => ({
ID: destination.ID,
...destination.Config,
customActivityEventMap: getHashFromArray(
destination.Config.rudderEventsMapping,
'event',
'marketoActivityId',
false,
),
customActivityEventMap: destination.Config?.rudderEventsMapping
? getHashFromArray(destination.Config.rudderEventsMapping, 'event', 'marketoActivityId', false)
: getHashFromArray(destination.Config.customActivityEventMap, 'from', 'to', false),
customActivityPropertyMap: getHashFromArray(
destination.Config.customActivityPropertyMap,
'from',
'to',
false,
),
customActivityPrimaryKeyMap: getHashFromArray(
destination.Config.rudderEventsMapping,
'event',
'marketoPrimarykey',
false,
),
customActivityPrimaryKeyMap: destination.Config?.rudderEventsMapping
? getHashFromArray(destination.Config.rudderEventsMapping, 'event', 'marketoPrimarykey', false)
: getHashFromArray(destination.Config.customActivityPrimaryKeyMap, 'from', 'to', false),
leadTraitMapping: getHashFromArray(destination.Config.leadTraitMapping, 'from', 'to', false),
responseRules: destination.DestinationDefinition
? destination.DestinationDefinition.ResponseRules
Expand Down
13 changes: 9 additions & 4 deletions test/__tests__/data/marketo_input.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,16 @@
}
],
"createIfNotExist": true,
"rudderEventsMapping": [
"customActivityPrimaryKeyMap": [
{
"event": "Product Clicked",
"marketoPrimarykey": "name",
"marketoActivityId": "100001"
"from": "Product Clicked",
"to": "name"
}
],
"customActivityEventMap": [
{
"from": "Product Clicked",
"to": "100001"
}
]
}
Expand Down

0 comments on commit af6aebb

Please sign in to comment.