Skip to content
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: marketo backward compatibility #2880

Merged
merged 3 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading