Skip to content

Commit

Permalink
chore(release): pull release/v1.87.0 into main (#3937)
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsSudip authored Dec 16, 2024
2 parents 0965f30 + 7d4fbaa commit 9d6a002
Show file tree
Hide file tree
Showing 66 changed files with 3,068 additions and 619 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.87.0](https://github.com/rudderlabs/rudder-transformer/compare/v1.86.0...v1.87.0) (2024-12-13)


### Features

* onboard topsort destination ([#3913](https://github.com/rudderlabs/rudder-transformer/issues/3913)) ([227419f](https://github.com/rudderlabs/rudder-transformer/commit/227419f1ff618f96aafa849862828e2315e4ac55))


### Bug Fixes

* handling partial error in a batch for reddit destination ([#3935](https://github.com/rudderlabs/rudder-transformer/issues/3935)) ([d40db6c](https://github.com/rudderlabs/rudder-transformer/commit/d40db6c1e7f71c5ab5fc3a3659d1fc51b6d527fa))

## [1.86.0](https://github.com/rudderlabs/rudder-transformer/compare/v1.85.1...v1.86.0) (2024-12-09)


Expand Down
8 changes: 5 additions & 3 deletions package-lock.json

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

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rudder-transformer",
"version": "1.86.0",
"version": "1.87.0",
"description": "",
"homepage": "https://github.com/rudderlabs/rudder-transformer#readme",
"bugs": {
Expand Down Expand Up @@ -36,11 +36,11 @@
"test": "jest -c jest.config.js --detectOpenHandles",
"test:ci": "npm run test -- --coverage --expand --maxWorkers=50%",
"test:js": "jest -c jest.default.config.js --detectOpenHandles",
"test:js:silent": "npm run test:js -- --silent",
"test:js:silent": "export LOG_LEVEL=silent && npm run test:js -- --silent",
"test:js:ci": "npm run test:js -- --coverage --expand --maxWorkers=50%",
"test:ts": "jest -c jest.config.typescript.js --detectOpenHandles",
"test:ts:component:generateNwMocks": "npm run test:ts -- component --generate=true",
"test:ts:silent": "npm run test:ts -- --silent",
"test:ts:silent": "export LOG_LEVEL=silent && npm run test:ts -- --silent",
"test:ts:ci": "npm run test:ts -- --coverage --expand --maxWorkers=50%",
"test:ut:integration": "jest \"user_transformation.integration.test.js\" --detectOpenHandles --notify",
"test:ut:integration:silent": "npm run test:ut:integration -- --silent",
Expand Down
62 changes: 26 additions & 36 deletions src/cdk/v2/destinations/pinterest_tag/utils.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* eslint-disable no-param-reassign */
const sha256 = require('sha256');
const { InstrumentationError, ConfigurationError } = require('@rudderstack/integrations-lib');

const { API_VERSION } = require('./config');
const { CommonUtils } = require('../../../../util/common');

const VALID_ACTION_SOURCES = ['app_android', 'app_ios', 'web', 'offline'];

Expand All @@ -21,9 +21,15 @@ const ecomEventMaps = [
},
];

const USER_NON_ARRAY_PROPERTIES = ['client_user_agent', 'client_ip_address'];
const USER_NON_ARRAY_PROPERTIES = [
'client_user_agent',
'client_ip_address',
'click_id',
'partner_id',
];

const getHashedValue = (key, value) => {
const transformValue = (key, value) => {
const arrayValue = CommonUtils.toArray(value);
switch (key) {
case 'em':
case 'ct':
Expand All @@ -32,33 +38,18 @@ const getHashedValue = (key, value) => {
case 'ln':
case 'fn':
case 'ge':
value = Array.isArray(value)
? value.map((val) => val.toString().trim().toLowerCase())
: value.toString().trim().toLowerCase();
break;
return arrayValue.map((val) => val.toString().trim().toLowerCase());
case 'ph':
// phone numbers should only contain digits & should not contain leading zeros
value = Array.isArray(value)
? value.map((val) => val.toString().replace(/\D/g, '').replace(/^0+/, ''))
: value.toString().replace(/\D/g, '').replace(/^0+/, '');
break;
return arrayValue.map((val) => val.toString().replace(/\D/g, '').replace(/^0+/, ''));
case 'zp':
// zip fields should only contain digits
value = Array.isArray(value)
? value.map((val) => val.toString().trim().replace(/\D/g, ''))
: value.toString().replace(/\D/g, '');
break;
case 'hashed_maids':
case 'external_id':
case 'db':
// no action needed on value
break;
return arrayValue.map((val) => val.toString().trim().replace(/\D/g, ''));
default:
return String(value);
return arrayValue;
}
return Array.isArray(value) ? value.map((val) => sha256(val)) : [sha256(value)];
};

const getHashedValue = (key, value) => transformValue(key, value).map((val) => sha256(val));

/**
*
* @param {*} userPayload Payload mapped from user fields
Expand All @@ -67,10 +58,15 @@ const getHashedValue = (key, value) => {
* Ref: https://s.pinimg.com/ct/docs/conversions_api/dist/v3.html
*/
const processUserPayload = (userPayload) => {
Object.keys(userPayload).forEach((key) => {
userPayload[key] = getHashedValue(key, userPayload[key]);
const newPayload = { ...userPayload };
Object.keys(newPayload).forEach((key) => {
if (USER_NON_ARRAY_PROPERTIES.includes(key)) {
newPayload[key] = String(newPayload[key]);
} else {
newPayload[key] = getHashedValue(key, newPayload[key]);
}
});
return userPayload;
return newPayload;
};

/**
Expand Down Expand Up @@ -99,22 +95,16 @@ const processHashedUserPayload = (userPayload, message) => {
const processedHashedUserPayload = {};
Object.keys(userPayload).forEach((key) => {
if (!USER_NON_ARRAY_PROPERTIES.includes(key)) {
if (Array.isArray(userPayload[key])) {
processedHashedUserPayload[key] = [...userPayload[key]];
} else {
processedHashedUserPayload[key] = [userPayload[key]];
}
processedHashedUserPayload[key] = CommonUtils.toArray(userPayload[key]);
} else {
processedHashedUserPayload[key] = userPayload[key];
}
});
// multiKeyMap will works on only specific values like m, male, MALE, f, F, Female
// if hashed data is sent from the user, it is directly set over here
const gender = message.traits?.gender || message.context?.traits?.gender;
if (gender && Array.isArray(gender)) {
processedHashedUserPayload.ge = [...gender];
} else if (gender) {
processedHashedUserPayload.ge = [gender];
if (gender) {
processedHashedUserPayload.ge = CommonUtils.toArray(gender);
}
return processedHashedUserPayload;
};
Expand Down
6 changes: 5 additions & 1 deletion src/cdk/v2/destinations/reddit/rtWorkflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ steps:
description: Batches the successfulEvents using endpoint
condition: $.outputs.successfulEvents.length
template: |
let batches = $.batchEvents($.outputs.successfulEvents);
const dontBatchTrueEvents = $.outputs.successfulEvents{.metadata.dontBatch}[];
const dontBatchFalseEvents = $.outputs.successfulEvents{!.metadata.dontBatch}[];
const dontBatchTrueEventsChunks = $.chunk(dontBatchTrueEvents, 1);
let batches = [...$.batchEvents(dontBatchFalseEvents), ...$.batchEventChunks(dontBatchTrueEventsChunks)];
batches@batch.({
"batchedRequest": {
"body": {
Expand Down
1 change: 1 addition & 0 deletions src/cdk/v2/destinations/reddit/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ const populateRevenueField = (eventType, properties) => {
};
module.exports = {
batchEvents,
batchEventChunks,
populateRevenueField,
calculateDefaultRevenue,
};
1 change: 1 addition & 0 deletions src/features.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ const defaultFeaturesConfig: FeaturesConfig = {
AMAZON_AUDIENCE: true,
INTERCOM_V2: true,
LINKEDIN_AUDIENCE: true,
TOPSORT: true,
},
regulations: [
'BRAZE',
Expand Down
3 changes: 2 additions & 1 deletion src/v0/destinations/amazon_audience/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ const buildResponseWithUsers = (users, action, config, jobIdList, secret) => {
if (!secret?.clientId) {
throw new OAuthSecretError('OAuth - Client Id not found');
}
const externalId = `Rudderstack_${sha256(`${jobIdList}`)}`;
const jobIdHash = sha256(String(jobIdList));
const externalId = `Rudderstack_${jobIdHash}`;
const response = defaultRequestConfig();
response.endpoint = '';
response.method = defaultPostRequestConfig.requestMethod;
Expand Down
1 change: 0 additions & 1 deletion src/v0/destinations/braze/braze.util.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,6 @@ describe('dedup utility tests', () => {
enableNestedArrayOperations: false,
enableSubscriptionGroupInGroupCall: false,
eventFilteringOption: 'disable',
oneTrustCookieCategories: [],
restApiKey: 'test-rest-api-key',
supportDedup: true,
trackAnonymousUser: true,
Expand Down
Loading

0 comments on commit 9d6a002

Please sign in to comment.