Skip to content

Commit

Permalink
chore: refactorx1
Browse files Browse the repository at this point in the history
  • Loading branch information
yashasvibajpai committed Feb 20, 2024
1 parent 27ea96e commit fdb7a8b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/v0/destinations/sfmc/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ const responseBuilderSimple = async (message, category, destination) => {
eventToExternalKey,
eventToPrimaryKey,
eventToUUID,
eventToDefinitionMapping
eventToDefinitionMapping,
} = destination.Config;
// map from an event name to an external key of a data extension.
const hashMapExternalKey = getHashFromArray(eventToExternalKey, 'from', 'to');
Expand All @@ -220,7 +220,7 @@ const responseBuilderSimple = async (message, category, destination) => {
// token needed for authorization for subsequent calls
const authToken = await getToken(clientId, clientSecret, subDomain);
// map from an event name to an event definition key.
const hashMapEventDefinition = getHashFromArray(eventToDefinitionMapping, 'from', 'to')
const hashMapEventDefinition = getHashFromArray(eventToDefinitionMapping, 'from', 'to');
// if createOrUpdateContacts is true identify calls for create and update of contacts will not occur.
if (category.type === 'identify' && !createOrUpdateContacts) {
// first call to identify the contact
Expand Down Expand Up @@ -254,12 +254,12 @@ const responseBuilderSimple = async (message, category, destination) => {
if (typeof message.event !== 'string') {
throw new ConfigurationError('Event name must be a string');
}
if (!isDefinedAndNotNull(hashMapExternalKey[message.event.toLowerCase()])) {
throw new ConfigurationError('Event not mapped for this track call');
}
if (hashMapEventDefinition[message.event.toLowerCase()]) {
return responseBuilderForMessageEvent(message, subDomain, authToken, hashMapEventDefinition);

Check warning on line 258 in src/v0/destinations/sfmc/transform.js

View check run for this annotation

Codecov / codecov/patch

src/v0/destinations/sfmc/transform.js#L258

Added line #L258 was not covered by tests
}
if (!isDefinedAndNotNull(hashMapExternalKey[message.event.toLowerCase()])) {
throw new ConfigurationError('Event not mapped for this track call');
}
return responseBuilderForInsertData(
message,
hashMapExternalKey[message.event.toLowerCase()],
Expand Down

0 comments on commit fdb7a8b

Please sign in to comment.