Skip to content

Commit

Permalink
Merge branch 'develop' into lytics.event-stream-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
shrouti1507 authored Sep 23, 2024
2 parents 1bdc972 + ede31ef commit 5d8fa65
Show file tree
Hide file tree
Showing 7 changed files with 565 additions and 40 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [1.79.0](https://github.com/rudderlabs/rudder-transformer/compare/v1.78.0...v1.79.0) (2024-09-20)


### Features

* add support for vdm next to fb custom audiences ([#3729](https://github.com/rudderlabs/rudder-transformer/issues/3729)) ([f33f525](https://github.com/rudderlabs/rudder-transformer/commit/f33f52503679be9271751aaa2fdca0661fed62e9))


### Bug Fixes

* use destination definition name in place of string for custom object ([#3746](https://github.com/rudderlabs/rudder-transformer/issues/3746)) ([27040b0](https://github.com/rudderlabs/rudder-transformer/commit/27040b06276c2bd1c1a6bd535172b50848a97261))

## [1.78.0](https://github.com/rudderlabs/rudder-transformer/compare/v1.77.1...v1.78.0) (2024-09-16)


Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rudder-transformer",
"version": "1.78.0",
"version": "1.79.0",
"description": "",
"homepage": "https://github.com/rudderlabs/rudder-transformer#readme",
"bugs": {
Expand Down
10 changes: 7 additions & 3 deletions src/v0/destinations/salesforce/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,10 @@ async function getSaleforceIdForRecord(
);
}
const searchRecord = processedsfSearchResponse.response?.searchRecords?.find(
(rec) => typeof identifierValue !== 'undefined' && rec[identifierType] === `${identifierValue}`,
(rec) =>
typeof identifierValue !== 'undefined' &&
// eslint-disable-next-line eqeqeq
rec[identifierType] == identifierValue,
);

return searchRecord?.Id;
Expand Down Expand Up @@ -190,8 +193,9 @@ async function getSalesforceIdFromPayload(
'Invalid externalId. id, type, identifierType must be provided',
);
}

const objectType = type.toLowerCase().replace('salesforce-', '');
const objectType = type
.toLowerCase()
.replace(`${destination.DestinationDefinition.Name.toLowerCase()}-`, '');
let salesforceId = id;

// Fetch the salesforce Id if the identifierType is not ID
Expand Down
60 changes: 56 additions & 4 deletions test/integrations/destinations/salesforce/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,7 @@ const transformationMocksData = [
httpRes: {
status: 200,
data: {
access_token:
'00D2v000002lXbX!ARcAQJBSGNA1Rq.MbUdtmlREscrN_nO3ckBz6kc4jRQGxqAzNkhT1XZIF0yPqyCQSnezWO3osMw1ewpjToO7q41E9.LvedWY',
access_token: 'dummy.access.token',
instance_url: 'https://ap15.salesforce.com',
id: 'https://login.salesforce.com/id/00D2v000002lXbXEAU/0052v00000ga9WqAAI',
token_type: 'Bearer',
Expand All @@ -198,8 +197,7 @@ const transformationMocksData = [
httpRes: {
status: 200,
data: {
access_token:
'00D2v000002lXbX!ARcAQJBSGNA1Rq.MbUdtmlREscrN_nO3ckBz6kc4jRQGxqAzNkhT1XZIF0yPqyCQSnezWO3osMw1ewpjToO7q41E9.LvedWY',
access_token: 'dummy.access.token',
instance_url: 'https://ap15.salesforce.com',
id: 'https://login.salesforce.com/id/00D2v000002lXbXEAU/0052v00000ga9WqAAI',
token_type: 'Bearer',
Expand Down Expand Up @@ -245,6 +243,18 @@ const transformationMocksData = [
},
},
},
{
httpReq: {
url: 'https://ap15.salesforce.com/services/data/v50.0/parameterizedSearch/?q=72727&sobject=customobject&in=CustomObject__c&customobject.fields=id,CustomObject__c',
method: 'GET',
},
httpRes: {
status: 200,
data: {
searchRecords: [],
},
},
},
{
httpReq: {
url: 'https://ap15.salesforce.com/services/data/v50.0/parameterizedSearch/?q=peter.gibbons1%40initech.com&sobject=Lead&Lead.fields=id',
Expand All @@ -265,6 +275,48 @@ const transformationMocksData = [
},
},
},
{
httpReq: {
url: 'https://ap15.salesforce.com/services/data/v50.0/parameterizedSearch/?q=72728&sobject=customobject2&in=CustomObject2__c&customobject2.fields=id,CustomObject2__c',
method: 'GET',
},
httpRes: {
status: 200,
data: {
searchRecords: [
{
attributes: {
type: 'CustomObject2__c',
url: '/services/data/v50.0/CustomObject2__c/id1101',
},
Id: 'id1101',
CustomObject2__c: 72728,
},
],
},
},
},
{
httpReq: {
url: 'https://ap15.salesforce.com/services/data/v50.0/parameterizedSearch/?q=72729&sobject=customobject2&in=CustomObject2__c&customobject2.fields=id,CustomObject2__c',
method: 'GET',
},
httpRes: {
status: 200,
data: {
searchRecords: [
{
attributes: {
type: 'CustomObject2__c',
url: '/services/data/v50.0/CustomObject2__c/id1102',
},
Id: 'id1102',
CustomObject2__c: '72729',
},
],
},
},
},
{
httpReq: {
url: 'https://ap15.salesforce.com/services/data/v50.0/parameterizedSearch/?q=ddv_ua%2B%7B%7B1234*245%7D%7D%40bugFix.com&sobject=Lead&Lead.fields=id,IsConverted,ConvertedContactId,IsDeleted',
Expand Down
30 changes: 10 additions & 20 deletions test/integrations/destinations/salesforce/processor/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,7 @@ export const data = [
endpoint: 'https://ap15.salesforce.com/services/data/v50.0/sobjects/Lead',
headers: {
'Content-Type': 'application/json',
Authorization:
'Bearer 00D2v000002lXbX!ARcAQJBSGNA1Rq.MbUdtmlREscrN_nO3ckBz6kc4jRQGxqAzNkhT1XZIF0yPqyCQSnezWO3osMw1ewpjToO7q41E9.LvedWY',
Authorization: 'Bearer dummy.access.token',
},
params: {},
body: {
Expand Down Expand Up @@ -225,8 +224,7 @@ export const data = [
endpoint: 'https://ap15.salesforce.com/services/data/v50.0/sobjects/Lead',
headers: {
'Content-Type': 'application/json',
Authorization:
'Bearer 00D2v000002lXbX!ARcAQJBSGNA1Rq.MbUdtmlREscrN_nO3ckBz6kc4jRQGxqAzNkhT1XZIF0yPqyCQSnezWO3osMw1ewpjToO7q41E9.LvedWY',
Authorization: 'Bearer dummy.access.token',
},
params: {},
body: {
Expand Down Expand Up @@ -354,8 +352,7 @@ export const data = [
endpoint: 'https://ap15.salesforce.com/services/data/v50.0/sobjects/Lead',
headers: {
'Content-Type': 'application/json',
Authorization:
'Bearer 00D2v000002lXbX!ARcAQJBSGNA1Rq.MbUdtmlREscrN_nO3ckBz6kc4jRQGxqAzNkhT1XZIF0yPqyCQSnezWO3osMw1ewpjToO7q41E9.LvedWY',
Authorization: 'Bearer dummy.access.token',
},
params: {},
body: {
Expand Down Expand Up @@ -591,8 +588,7 @@ export const data = [
endpoint: 'https://ap15.salesforce.com/services/data/v50.0/sobjects/Lead',
headers: {
'Content-Type': 'application/json',
Authorization:
'Bearer 00D2v000002lXbX!ARcAQJBSGNA1Rq.MbUdtmlREscrN_nO3ckBz6kc4jRQGxqAzNkhT1XZIF0yPqyCQSnezWO3osMw1ewpjToO7q41E9.LvedWY',
Authorization: 'Bearer dummy.access.token',
},
params: {},
body: {
Expand Down Expand Up @@ -721,8 +717,7 @@ export const data = [
endpoint: 'https://ap15.salesforce.com/services/data/v50.0/sobjects/Lead',
headers: {
'Content-Type': 'application/json',
Authorization:
'Bearer 00D2v000002lXbX!ARcAQJBSGNA1Rq.MbUdtmlREscrN_nO3ckBz6kc4jRQGxqAzNkhT1XZIF0yPqyCQSnezWO3osMw1ewpjToO7q41E9.LvedWY',
Authorization: 'Bearer dummy.access.token',
},
params: {},
body: {
Expand Down Expand Up @@ -855,8 +850,7 @@ export const data = [
'https://ap15.salesforce.com/services/data/v50.0/sobjects/Contact/sf-contact-id?_HttpMethod=PATCH',
headers: {
'Content-Type': 'application/json',
Authorization:
'Bearer 00D2v000002lXbX!ARcAQJBSGNA1Rq.MbUdtmlREscrN_nO3ckBz6kc4jRQGxqAzNkhT1XZIF0yPqyCQSnezWO3osMw1ewpjToO7q41E9.LvedWY',
Authorization: 'Bearer dummy.access.token',
},
params: {},
body: {
Expand Down Expand Up @@ -989,8 +983,7 @@ export const data = [
'https://ap15.salesforce.com/services/data/v50.0/sobjects/Lead/sf-contact-id?_HttpMethod=PATCH',
headers: {
'Content-Type': 'application/json',
Authorization:
'Bearer 00D2v000002lXbX!ARcAQJBSGNA1Rq.MbUdtmlREscrN_nO3ckBz6kc4jRQGxqAzNkhT1XZIF0yPqyCQSnezWO3osMw1ewpjToO7q41E9.LvedWY',
Authorization: 'Bearer dummy.access.token',
},
params: {},
userId: '',
Expand Down Expand Up @@ -1117,8 +1110,7 @@ export const data = [
endpoint: 'https://ap15.salesforce.com/services/data/v50.0/sobjects/Lead',
headers: {
'Content-Type': 'application/json',
Authorization:
'Bearer 00D2v000002lXbX!ARcAQJBSGNA1Rq.MbUdtmlREscrN_nO3ckBz6kc4jRQGxqAzNkhT1XZIF0yPqyCQSnezWO3osMw1ewpjToO7q41E9.LvedWY',
Authorization: 'Bearer dummy.access.token',
},
params: {},
body: {
Expand Down Expand Up @@ -1244,8 +1236,7 @@ export const data = [
'https://ap15.salesforce.com/services/data/v50.0/sobjects/custom_object__c/a005g0000383kmUAAQ?_HttpMethod=PATCH',
headers: {
'Content-Type': 'application/json',
Authorization:
'Bearer 00D2v000002lXbX!ARcAQJBSGNA1Rq.MbUdtmlREscrN_nO3ckBz6kc4jRQGxqAzNkhT1XZIF0yPqyCQSnezWO3osMw1ewpjToO7q41E9.LvedWY',
Authorization: 'Bearer dummy.access.token',
},
params: {},
body: {
Expand Down Expand Up @@ -1360,8 +1351,7 @@ export const data = [
'https://ap15.salesforce.com/services/data/v50.0/sobjects/custom_object__c/a005g0000383kmUAAQ?_HttpMethod=PATCH',
headers: {
'Content-Type': 'application/json',
Authorization:
'Bearer 00D2v000002lXbX!ARcAQJBSGNA1Rq.MbUdtmlREscrN_nO3ckBz6kc4jRQGxqAzNkhT1XZIF0yPqyCQSnezWO3osMw1ewpjToO7q41E9.LvedWY',
Authorization: 'Bearer dummy.access.token',
},
params: {},
body: {
Expand Down
Loading

0 comments on commit 5d8fa65

Please sign in to comment.