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 hotfix-release/v1.53.1 into main #2992

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from 4 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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

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.53.1](https://github.com/rudderlabs/rudder-transformer/compare/v1.53.0...v1.53.1) (2024-01-16)


### Bug Fixes

* mixpanel timestamp in ms ([#2990](https://github.com/rudderlabs/rudder-transformer/issues/2990)) ([0da63a4](https://github.com/rudderlabs/rudder-transformer/commit/0da63a4e368e59d46c1eaa4a77d4ac81e686183a))
* klaviyo: Event validation to be string before operating on it ([#2994](https://github.com/rudderlabs/rudder-transformer/issues/2994)) ([cd68d7c](https://github.com/rudderlabs/rudder-transformer/commit/cd68d7c4068588a325029e0cc523b74c3d3ccb1a))

## [1.53.0](https://github.com/rudderlabs/rudder-transformer/compare/v1.52.4...v1.53.0) (2024-01-08)


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.53.0",
"version": "1.53.1",
"description": "",
"homepage": "https://github.com/rudderlabs/rudder-transformer#readme",
"bugs": {
Expand Down
3 changes: 3 additions & 0 deletions src/v0/destinations/klaviyo/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ const trackRequestHandler = (message, category, destination) => {
const payload = {};
const { privateApiKey, flattenProperties } = destination.Config;
let event = get(message, 'event');
if (typeof event !== 'undefined' && typeof event !== 'string') {
anantjain45823 marked this conversation as resolved.
Show resolved Hide resolved
throw new InstrumentationError('Event type should be a string or undefined');
anantjain45823 marked this conversation as resolved.
Show resolved Hide resolved
}
event = event ? event.trim().toLowerCase() : event;
krishna2020 marked this conversation as resolved.
Show resolved Hide resolved
let attributes = {};
if (ecomEvents.includes(event) && message.properties) {
Expand Down
7 changes: 4 additions & 3 deletions src/v0/destinations/mp/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const {
getTimeDifference,
getValuesAsArrayFromConfig,
removeUndefinedValues,
toUnixTimestamp,
toUnixTimestampInMS,
getFieldValueFromMessage,
checkInvalidRtTfEvents,
handleRtTfSingleEventError,
Expand Down Expand Up @@ -174,7 +174,8 @@ const getEventValueForTrackEvent = (message, destination) => {
if (mappedProperties.$insert_id) {
mappedProperties.$insert_id = mappedProperties.$insert_id.slice(-36);
}
const unixTimestamp = toUnixTimestamp(message.timestamp);

const unixTimestamp = toUnixTimestampInMS(message.timestamp || message.originalTimestamp);
let properties = {
...message.properties,
...get(message, 'context.traits'),
Expand Down Expand Up @@ -304,7 +305,7 @@ const processPageOrScreenEvents = (message, type, destination) => {
...mappedProperties,
token: destination.Config.token,
distinct_id: message.userId || message.anonymousId,
time: toUnixTimestamp(message.timestamp),
time: toUnixTimestampInMS(message.timestamp || message.originalTimestamp),
...buildUtmParams(message.context?.campaign),
};
if (destination.Config?.identityMergeApi === 'simplified') {
Expand Down
4 changes: 2 additions & 2 deletions src/v0/destinations/mp/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const {
extractCustomFields,
isAppleFamily,
getBrowserInfo,
toUnixTimestamp,
toUnixTimestampInMS,
batchMultiplexedEvents,
getSuccessRespEvents,
defaultBatchRequestConfig,
Expand Down Expand Up @@ -113,7 +113,7 @@ const createIdentifyResponse = (message, type, destination, responseBuilderSimpl
$token: token,
$distinct_id: message.userId || message.anonymousId,
$ip: get(message, 'context.ip') || message.request_ip,
$time: toUnixTimestamp(message.timestamp),
$time: toUnixTimestampInMS(message.timestamp || message.originalTimestamp),
};

if (destination?.Config.identityMergeApi === 'simplified') {
Expand Down
4 changes: 4 additions & 0 deletions src/v0/util/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1232,6 +1232,9 @@ function toUnixTimestamp(timestamp) {
return unixTimestamp;
}

// Accepts a timestamp and returns the corresponding unix timestamp in milliseconds
const toUnixTimestampInMS = (timestamp) => new Date(timestamp).getTime();

// Accecpts timestamp as a parameter and returns the difference of the same with current time.
function getTimeDifference(timestamp) {
const currentTime = Date.now();
Expand Down Expand Up @@ -2193,6 +2196,7 @@ module.exports = {
stripTrailingSlash,
toTitleCase,
toUnixTimestamp,
toUnixTimestampInMS,
updatePayload,
checkInvalidRtTfEvents,
simpleProcessRouterDest,
Expand Down
128 changes: 63 additions & 65 deletions test/integrations/destinations/klaviyo/network.ts
Original file line number Diff line number Diff line change
@@ -1,75 +1,73 @@
export const networkCallsData = [
{
httpReq: {
url: 'https://a.klaviyo.com/api/v2/list/XUepkK/subscribe',
method: 'GET',
},
httpRes: {
status: 200
},
{
httpReq: {
url: 'https://a.klaviyo.com/api/v2/list/XUepkK/subscribe',
method: 'GET',
},
{
httpReq: {
url: 'https://a.klaviyo.com/api/v2/list/XUepkK/members',
method: 'GET',
},
httpRes: {
status: 200
},
httpRes: {
status: 200,
},
{
httpReq: {
url: 'https://a.klaviyo.com/api/profiles',
method: 'GET',
data: {
attributes: {
email: "[email protected]"
}
}
},
httpRes: {
status: 409,
data: {
}
},
},
{
httpReq: {
url: 'https://a.klaviyo.com/api/v2/list/XUepkK/members',
method: 'GET',
},
{
httpReq: {
url: 'https://a.klaviyo.com/api/profiles',
method: 'GET',
},
httpRes: {
status: 201,
data: {
data: {
id: '01GW3PHVY0MTCDGS0A1612HARX',
attributes: {}
},
}
},
httpRes: {
status: 200,
},
{
httpReq: {
url: 'https://a.klaviyo.com/api/profiles',
method: 'POST',
headers: { Authorization: 'Klaviyo-API-Key dummyPrivateApiKeyforfailure' }
},
httpRes: {
},
{
httpReq: {
url: 'https://a.klaviyo.com/api/profiles',
method: 'GET',
data: {
attributes: {
email: '[email protected]',
},
},
},
httpRes: {
status: 409,
data: {},
},
{
httpReq: {
url: 'https://a.klaviyo.com/api/profiles',
method: 'POST',
},
{
httpReq: {
url: 'https://a.klaviyo.com/api/profiles',
method: 'GET',
},
httpRes: {
status: 201,
data: {
data: {
id: '01GW3PHVY0MTCDGS0A1612HARX',
attributes: {},
},
httpRes: {
status: 201,
data: {
data: {
id: '01GW3PHVY0MTCDGS0A1612HARX',
attributes: {}
},
}
},
},
},
{
httpReq: {
url: 'https://a.klaviyo.com/api/profiles',
method: 'POST',
headers: { Authorization: 'Klaviyo-API-Key dummyPrivateApiKeyforfailure' },
},
httpRes: {},
},
{
httpReq: {
url: 'https://a.klaviyo.com/api/profiles',
method: 'POST',
},
httpRes: {
status: 201,
data: {
data: {
id: '01GW3PHVY0MTCDGS0A1612HARX',
attributes: {},
},
}
},
},
},
];
Loading
Loading