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

chore(release): pull main into develop post release v1.41.0 #2585

Merged
merged 9 commits into from
Sep 11, 2023
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@

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.41.0](https://github.com/rudderlabs/rudder-transformer/compare/v1.40.2...v1.41.0) (2023-09-11)


### Features

* add support for updating profile properties through track call ([#2581](https://github.com/rudderlabs/rudder-transformer/issues/2581)) ([f0f20d6](https://github.com/rudderlabs/rudder-transformer/commit/f0f20d654ec5ee8eb078ce7f5610a4666d73fd8c))
* **INT-580:** messageId to event_id mapping support ([#2570](https://github.com/rudderlabs/rudder-transformer/issues/2570)) ([b38843b](https://github.com/rudderlabs/rudder-transformer/commit/b38843bce9bc02d73dceedc6f751f402251fd23a))
* **tiktok_ads:** messageId to event_id mapping support ([72f87bf](https://github.com/rudderlabs/rudder-transformer/commit/72f87bfa381ed7a5b74fb5907f932b78d0257ab9))


### Bug Fixes

* **bugsnag:** alerts ([266514b](https://github.com/rudderlabs/rudder-transformer/commit/266514bd56c150d6c88c1db0733a1da0a4367c02))
* **bugsnag:** alerts ([#2580](https://github.com/rudderlabs/rudder-transformer/issues/2580)) ([9e9eeac](https://github.com/rudderlabs/rudder-transformer/commit/9e9eeacdf79cf8175f87f302242542060f668db8))
* json paths for non tracks events for warehouse ([#2571](https://github.com/rudderlabs/rudder-transformer/issues/2571)) ([e455368](https://github.com/rudderlabs/rudder-transformer/commit/e45536805cf9545b73f4d5bf1be5fad1565ab075))

### [1.40.2](https://github.com/rudderlabs/rudder-transformer/compare/v1.40.1...v1.40.2) (2023-09-06)


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.40.2",
"version": "1.41.0",
"description": "",
"homepage": "https://github.com/rudderlabs/rudder-transformer#readme",
"bugs": {
Expand Down
6 changes: 3 additions & 3 deletions src/v0/destinations/adobe_analytics/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ const handleTrack = (message, destinationConfig) => {
let payload = null;
// handle ecommerce events separately
// generic events should go to the default
const event = rawEvent?.toLowerCase();
const event = typeof rawEvent === 'string' ? rawEvent.toLowerCase() : rawEvent;
switch (event) {
case 'product viewed':
case 'product list viewed':
Expand Down Expand Up @@ -372,10 +372,10 @@ const handleTrack = (message, destinationConfig) => {
payload = processTrackEvent(message, 'scOpen', destinationConfig);
break;
default:
if (destinationConfig.rudderEventsToAdobeEvents[event.toLowerCase()]) {
if (destinationConfig.rudderEventsToAdobeEvents[event]) {
payload = processTrackEvent(
message,
destinationConfig.rudderEventsToAdobeEvents[event.toLowerCase()].trim(),
destinationConfig.rudderEventsToAdobeEvents[event]?.trim(),
destinationConfig,
);
} else if (message?.properties?.overrideEventName) {
Expand Down
6 changes: 5 additions & 1 deletion src/v0/destinations/branch/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ function getCategoryAndName(rudderEventName) {
let requiredCategory = null;
// eslint-disable-next-line array-callback-return
Object.keys(category.name).find((branchKey) => {
if (branchKey.toLowerCase() === rudderEventName.toLowerCase()) {
if (
typeof branchKey === 'string' &&
typeof rudderEventName === 'string' &&
branchKey.toLowerCase() === rudderEventName.toLowerCase()
) {
requiredName = category.name[branchKey];
requiredCategory = category;
}
Expand Down
12 changes: 8 additions & 4 deletions src/v0/destinations/fb/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,11 @@ function sanityCheckPayloadForTypesAndModifications(updatedEvent) {
case 'ud[ln]':
case 'ud[st]':
case 'ud[cn]':
if (clonedUpdatedEvent[prop] && clonedUpdatedEvent[prop] !== '') {
if (
clonedUpdatedEvent[prop] &&
typeof clonedUpdatedEvent[prop] === 'string' &&
clonedUpdatedEvent[prop] !== ''
) {
isUDSet = true;
clonedUpdatedEvent[prop] = sha256(clonedUpdatedEvent[prop].toLowerCase());
}
Expand All @@ -105,8 +109,7 @@ function sanityCheckPayloadForTypesAndModifications(updatedEvent) {
if (clonedUpdatedEvent[prop] && clonedUpdatedEvent[prop] !== '') {
if (typeof clonedUpdatedEvent[prop] !== 'string') {
delete clonedUpdatedEvent[prop];
}
else {
} else {
isUDSet = true;
clonedUpdatedEvent[prop] = sha256(
clonedUpdatedEvent[prop].toLowerCase() === 'female' ? 'f' : 'm',
Expand Down Expand Up @@ -167,7 +170,8 @@ function getCorrectedTypedValue(pathToKey, value, originalPath) {
}

throw new InstrumentationError(
`${typeof originalPath === 'object' ? JSON.stringify(originalPath) : originalPath
`${
typeof originalPath === 'object' ? JSON.stringify(originalPath) : originalPath
} is not of valid type`,
);
}
Expand Down
31 changes: 16 additions & 15 deletions src/v0/destinations/klaviyo/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@ const { JSON_MIME_TYPE } = require('../../util/constant');
/**
* Main Identify request handler func
* The function is used to create/update new users and also for adding/subscribing
* members to the list depending on conditons.If listId is there member is added to that list &
* if subscribe is true member is subscribed to that list else not.
* DOCS: https://www.klaviyo.com/docs/http-api
* users to the list.
* DOCS: 1. https://developers.klaviyo.com/en/v2023-02-22/reference/create_profile
* 2. https://developers.klaviyo.com/en/v2023-02-22/reference/update_profile
* 3. https://developers.klaviyo.com/en/v2023-02-22/reference/subscribe_profiles
* @param {*} message
* @param {*} category
* @param {*} destination
Expand Down Expand Up @@ -123,7 +124,7 @@ const identifyRequestHandler = async (message, category, destination) => {
// ----------------------
// Main handler func for track request/screen request
// User info needs to be mapped to a track event (mandatory)
// DOCS: https://www.klaviyo.com/docs/http-api
// DOCS: https://developers.klaviyo.com/en/v2023-02-22/reference/create_event
// ----------------------

const trackRequestHandler = (message, category, destination) => {
Expand All @@ -138,10 +139,6 @@ const trackRequestHandler = (message, category, destination) => {
attributes.metric = { name: eventName };
const categ = CONFIG_CATEGORIES[eventMap];
attributes.properties = constructPayload(message.properties, MAPPING_CONFIG[categ.name]);
attributes.properties = {
...attributes.properties,
...populateCustomFieldsFromTraits(message),
};

// products mapping using Items.json
// mapping properties.items to payload.properties.items and using properties.products as a fallback to properties.items
Expand Down Expand Up @@ -191,17 +188,21 @@ const trackRequestHandler = (message, category, destination) => {
if (value) {
attributes.value = value;
}
attributes.properties = {
...attributes.properties,
...populateCustomFieldsFromTraits(message),
};
}
// if flattenProperties is enabled from UI, flatten the event properties
attributes.properties = flattenProperties
? flattenJson(attributes.properties, '.', 'normal', false)
: attributes.properties;
// Map user properties to profile object
attributes.profile = createCustomerProperties(message, destination.Config);
attributes.profile = {
...createCustomerProperties(message, destination.Config),
...populateCustomFieldsFromTraits(message),
};

attributes.profile = flattenProperties
? flattenJson(attributes.profile, '.', 'normal', false)
: attributes.profile;

if (message.timestamp) {
attributes.time = message.timestamp;
}
Expand All @@ -222,9 +223,9 @@ const trackRequestHandler = (message, category, destination) => {

// ----------------------
// Main handlerfunc for group request
// we will map user to list (subscribe and/or member)
// we will add/subscribe users to the list
// based on property sent
// DOCS: https://www.klaviyo.com/docs/api/v2/lists
// DOCS: https://developers.klaviyo.com/en/v2023-02-22/reference/subscribe_profiles
// ----------------------
const groupRequestHandler = (message, category, destination) => {
if (!message.groupId) {
Expand Down
2 changes: 1 addition & 1 deletion src/v0/destinations/klaviyo/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ const profileUpdateResponseBuilder = (payload, profileId, category, privateApiKe

/**
* This function is used for creating response for subscribing users to a particular list.
* DOCS: https://www.klaviyo.com/docs/api/v2/lists
* DOCS: https://developers.klaviyo.com/en/v2023-02-22/reference/subscribe_profiles
*/
const subscribeUserToList = (message, traitsInfo, destination) => {
// listId from message properties are preferred over Config listId
Expand Down
2 changes: 1 addition & 1 deletion src/v0/destinations/tiktok_ads/data/TikTokTrack.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[
{
"destKey": "event_id",
"sourceKeys": "properties.eventId",
"sourceKeys": ["properties.eventId", "properties.event_id", "messageId"],
"required": false
},
{
Expand Down
Loading