Skip to content

Commit

Permalink
chore(release): pull release/v1.30.0 into main (#2216)
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsSudip authored May 30, 2023
2 parents c128bd2 + f409cf9 commit 1194194
Show file tree
Hide file tree
Showing 50 changed files with 3,055 additions and 448 deletions.
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,27 @@

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.30.0](https://github.com/rudderlabs/rudder-transformer/compare/v1.29.2...v1.30.0) (2023-05-30)


### Features

* add cdk stats ([#2131](https://github.com/rudderlabs/rudder-transformer/issues/2131)) ([3fe837b](https://github.com/rudderlabs/rudder-transformer/commit/3fe837b1b561da1563042b2128420214b1103b2a))
* auto register missing metrics ([#2170](https://github.com/rudderlabs/rudder-transformer/issues/2170)) ([0bbe371](https://github.com/rudderlabs/rudder-transformer/commit/0bbe371246f750b9b92595b5e8d00212366742c7))
* mixpanel deletion api ([#2206](https://github.com/rudderlabs/rudder-transformer/issues/2206)) ([19e20eb](https://github.com/rudderlabs/rudder-transformer/commit/19e20eb16def7296d88e67a7c325b123881042f9)), closes [#2200](https://github.com/rudderlabs/rudder-transformer/issues/2200)
* onboard bingads audience destination (CDK) ([#2214](https://github.com/rudderlabs/rudder-transformer/issues/2214)) ([411c2c9](https://github.com/rudderlabs/rudder-transformer/commit/411c2c9fcd7c8892ce994ad18831f1accc632dab))
* onboard dynamic yield ([#2177](https://github.com/rudderlabs/rudder-transformer/issues/2177)) ([fc4c007](https://github.com/rudderlabs/rudder-transformer/commit/fc4c00716a4e45852e9aef20682ab4388cc8e890))
* remove custom property dependency for fb pixel ([#2215](https://github.com/rudderlabs/rudder-transformer/issues/2215)) ([e22b2ac](https://github.com/rudderlabs/rudder-transformer/commit/e22b2ac62d5c442f78862201acbb611c5e6f7c63))
* **transformation:** adding geo location function support ([#2165](https://github.com/rudderlabs/rudder-transformer/issues/2165)) ([7a153a5](https://github.com/rudderlabs/rudder-transformer/commit/7a153a58a93fb7dde44abdd26a5d3a6fff20b77e))


### Bug Fixes

* add async/await in af,clevertap, engage and sendgird ([#2183](https://github.com/rudderlabs/rudder-transformer/issues/2183)) ([20846ab](https://github.com/rudderlabs/rudder-transformer/commit/20846ab102abd41bc75eb4c164f096638e822d73))
* **gaoc:** adding batching support ([#2201](https://github.com/rudderlabs/rudder-transformer/issues/2201)) ([5865f50](https://github.com/rudderlabs/rudder-transformer/commit/5865f508d98c8bb8eed809636b14d3cf2eb213be))
* handling proxy responses for tiktok_ads, snapchat_custom_audience ([#2169](https://github.com/rudderlabs/rudder-transformer/issues/2169)) ([906d799](https://github.com/rudderlabs/rudder-transformer/commit/906d79985d6162f7ebc3ab5b57b72ada72b988fa))
* pinterest ge parameter ([#2210](https://github.com/rudderlabs/rudder-transformer/issues/2210)) ([f64e30d](https://github.com/rudderlabs/rudder-transformer/commit/f64e30df851366207e8464a9073a5d5e628923e5))

### [1.29.2](https://github.com/rudderlabs/rudder-transformer/compare/v1.29.1...v1.29.2) (2023-05-26)


Expand Down
38 changes: 33 additions & 5 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rudder-transformer",
"version": "1.29.2",
"version": "1.30.0",
"description": "",
"homepage": "https://github.com/rudderlabs/rudder-transformer#readme",
"bugs": {
Expand Down Expand Up @@ -94,7 +94,7 @@
"prom-client": "^14.2.0",
"qs": "^6.11.1",
"rudder-transformer-cdk": "^1.4.5",
"rudder-workflow-engine": "^0.4.5",
"rudder-workflow-engine": "^0.4.6",
"set-value": "^4.1.0",
"sha256": "^0.2.0",
"stacktrace-parser": "^0.1.10",
Expand Down
6 changes: 3 additions & 3 deletions src/adapters/utils/networkUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const {
isNonFuncObject,
isDefinedAndNotNull,
isHttpStatusSuccess,
getErrorStatusCode,
} = require('../../v0/util');
const { AbortedError } = require('../../v0/util/errorTypes');
const tags = require('../../v0/util/tags');
Expand Down Expand Up @@ -143,8 +144,8 @@ const processAxiosResponse = (clientResponse) => {
}
// (edge case) response and code is not present
return {
response: '',
status: 500,
response: clientResponse?.response?.data || '',
status: getErrorStatusCode(clientResponse, HTTP_STATUS_CODES.INTERNAL_SERVER_ERROR),
};
}
// success(2xx) axios response
Expand All @@ -155,7 +156,6 @@ const processAxiosResponse = (clientResponse) => {
};
};


function getCompatibleStatusCode(status) {
if (status === HTTP_STATUS_CODES.NOT_FOUND) {
return HTTP_STATUS_CODES.BAD_REQUEST;
Expand Down
10 changes: 10 additions & 0 deletions src/cdk/v2/destinations/bingads_audience/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const AUDIENCE_ATTRIBUTE = {
EMAIL: 'email',
};

const BINGADS_SUPPORTED_OPERATION = 'add';

module.exports = {
BINGADS_SUPPORTED_OPERATION,
AUDIENCE_ATTRIBUTE,
};
49 changes: 49 additions & 0 deletions src/cdk/v2/destinations/bingads_audience/procWorkflow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
bindings:
- name: EventType
path: ../../../../constants
- path: ../../bindings/jsontemplate
exportAll: true
- path: ./config
- name: removeUndefinedAndNullValues
path: ../../../../v0/util
- name: defaultRequestConfig
path: ../../../../v0/util

steps:
- name: validateInput
template: |
let messageType = .message.type;
$.assert(.message.type, "message Type is not present. Aborting message.");
$.assert(.message.type.toLowerCase() ==='audiencelist', "Event type " + .message.type.toLowerCase() + " is not supported. Aborting message.");
$.assert(.message.properties, "Message properties is not present. Aborting message.");
$.assert(.message.properties.listData, "listData is not present inside properties. Aborting message.");
$.assert(.message.properties.listData.[$.BINGADS_SUPPORTED_OPERATION], "The only supported operation for audience updationn" +$.BINGADS_SUPPORTED_OPERATION+ " is not present. Aborting message.");
- name: prepareIdentifiersList
description: |
Populate list of identifiers to be updated
template: |
const listArray = .message.properties.listData.add;
const hashEmail = .destination.Config.hashEmail;
console.log("fdsfdsf", [email protected]);
console.log("aaa", hashEmail)
list = listArray.({
"hashedEmail" : hashEmail ? $.SHA256(.email) : .email ,
"email": .email
})
- name: payload
template: |
const outputPayload = {
"list": $.outputs.prepareIdentifiersList
}
- name: buildResponseForProcessTransformation
description: build response
template: |
const response = $.defaultRequestConfig();
console.log(response);
response.body.JSON = $.outputs.payload;
response.endpoint = "";
response.headers = {};
finalResponse = response;
13 changes: 13 additions & 0 deletions src/cdk/v2/destinations/dynamic_yield/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const ENDPOINT = 'https://dy-api.com/v2/collect/user/event';

const ecomEventsMapping = {
product_added: 'Add to Cart',
product_removed: 'Remove from Cart',
product_added_to_wishlist: 'Add to Wishlist',
order_completed: 'Purchase',
};

module.exports = {
ENDPOINT,
ecomEventsMapping,
};
179 changes: 179 additions & 0 deletions src/cdk/v2/destinations/dynamic_yield/procWorkflow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
bindings:
- name: EventType
path: ../../../../constants
- path: ../../bindings/jsontemplate
exportAll: true
- path: ./config
- name: removeUndefinedAndNullValues
path: ../../../../v0/util
- name: defaultRequestConfig
path: ../../../../v0/util

steps:
- name: validateInput
template: |
let messageType = .message.type;
$.assert(.message.type, "message Type is not present. Aborting message.");
$.assert(.destination.Config.apiKey, "Api Key is not present");
$.assert(messageType in {{$.EventType.([.IDENTIFY, .TRACK])}},
"message type " + messageType + " is not supported")
- name: messageType
template: |
.message.type.toLowerCase()
- name: validateInputForTrack
description: Additional validation for Track events
condition: $.outputs.messageType === {{$.EventType.TRACK}}
template: |
$.assert(.message.event, "event is not present. Aborting.")
- name: commonFields
description: |
Builds common fields in destination payload.
template: |
let commonFields = .message.().({
"user": { "id": {{{{$.getGenericPaths("userId")}}}}},
"session": {"custom": {{{{$.getGenericPaths("sessionId")}}}}},
"context":{"device":{"ip": .context.ip}}
});
commonFields.session.custom = String(commonFields.session.custom);
$.removeUndefinedAndNullValues(commonFields)
- name: validateCommonFields
template: |
const userId = $.outputs.commonFields.user.id;
const sessionId = $.outputs.commonFields.session.custom;
const ip = $.outputs.commonFields.context.device.ip;
$.assert(userId, "userId is required");
$.assert(sessionId, "sessionId is required");
$.assert(ip, "ip is required");
- name: prepareIdentifyPayload
condition: $.outputs.messageType === {{$.EventType.IDENTIFY}}
steps:
- name: propertiesFields
template: |
const email = .message.().(
{{{{$.getGenericPaths("email")}}}};
);
const hashEmail = .destination.Config.hashEmail;
hashedEmail = hashEmail ? $.SHA256(email) : email;
let properties = {
"hashedEmail": hashedEmail,
"dyType": 'identify-v1'
};
properties = $.removeUndefinedAndNullValues(properties);
- name: updatedPropertiesFields
condition: $.outputs.prepareIdentifyPayload.propertiesFields.hashedEmail === undefined
template: |
let cuid = $.outputs.commonFields.user.id;
{
"dyType": 'identify-v1',
"cuidType": "userId",
"cuid": cuid
};
- name: events
template: |
let properties = $.outputs.prepareIdentifyPayload.updatedPropertiesFields || $.outputs.prepareIdentifyPayload.propertiesFields;
[{
"name": "Identify User",
"properties": properties
}];
- name: prepareTrackPayload
condition: $.outputs.messageType === {{$.EventType.TRACK}}
steps:
- name: getTrimmedEvent
template: |
const trimmedEvent = .message.event.trim().toLowerCase().replace(new RegExp('\\s+', 'g'),'_');
- name: populateCustomEventProperties
condition: $.ecomEventsMapping[$.outputs.prepareTrackPayload.getTrimmedEvent] === undefined
template: |
{
"name": .message.event,
"properties" : .message.properties
}
onComplete: return

- name: populateEventProperties
condition: $.outputs.prepareTrackPayload.getTrimmedEvent in ["product_added", "product_removed", "product_added_to_wishlist", "order_completed"]
template: |
const trimmedEvent = $.outputs.prepareTrackPayload.getTrimmedEvent;
const dyType = $.ecomEventsMapping[trimmedEvent].toLowerCase().replace(new RegExp('\\s+', 'g'),'-')+"-v1";
{
"name": $.ecomEventsMapping[trimmedEvent],
"properties" : {
"dyType": dyType,
"value": Number(parseFloat(.message.properties.value || .message.properties.revenue || .message.properties.price).toFixed(2)),
"currency": .message.properties.currency,
}
}
- name: updateOrderCompletedEventProperties
condition: $.outputs.prepareTrackPayload.getTrimmedEvent === 'order_completed'
template: |
{
...$.outputs.prepareTrackPayload.populateEventProperties,
"properties": {
...$.outputs.prepareTrackPayload.populateEventProperties.properties,
"uniqueTransactionId" : ^.message.properties.order_id,
"value": .message.properties.value || .message.properties.revenue || .message.properties.price
}
}
- name: updateOtherEventProperties
condition: $.outputs.prepareTrackPayload.getTrimmedEvent !== 'order_completed'
template: |
{
...$.outputs.prepareTrackPayload.populateEventProperties,
"properties": {
...$.outputs.prepareTrackPayload.populateEventProperties.properties,
"quantity" : .message.properties.quantity,
"productId": .message.properties.sku || .message.properties.product_id
}
}
- name: populateCartObj
condition: Array.isArray(.message.properties.products)
template: |
const eventProperties = $.outputs.prepareTrackPayload.getTrimmedEvent === 'order_completed' ? $.outputs.prepareTrackPayload.updateOrderCompletedEventProperties.properties : $.outputs.prepareTrackPayload.populateEventProperties.properties;
{
...$.outputs.prepareTrackPayload.populateEventProperties,
"properties": {
...eventProperties,
cart: [email protected].({
"productId": .sku ?? prop.sku,
"quantity": Number(.quantity ?? prop.quantity),
"itemPrice": Number(parseFloat(.price ?? prop.price).toFixed(2))
})
}
}
- name: payload
condition: $.outputs.messageType === {{$.EventType.IDENTIFY}}
template: |
const outputPayload = {
...$.outputs.commonFields,
"events": $.outputs.prepareIdentifyPayload
}
else:
name: trackPayload
template: |
const outputPayload = {
...$.outputs.commonFields,
"events": [$.outputs.prepareTrackPayload]
}
- name: buildResponseForProcessTransformation
description: build response
template: |
const response = $.defaultRequestConfig();
response.body.JSON = $.outputs.payload;
response.endpoint = $.ENDPOINT;
response.headers = {
"DY-API-Key": .destination.Config.apiKey,
"Content-Type": "application/json"
};
finalResponse = response;
3 changes: 2 additions & 1 deletion src/cdk/v2/destinations/pinterest_tag/procWorkflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ steps:
let gender = .message.traits.gender ?? .message.context.traits.gender;
gender = gender && (
(gender in ["f", "F", "Female", "female", "FEMALE"] ? "f") ??
(gender in ["m", "M", "Male", "male", "MALE"] ? "m": gender)
(gender in ["m", "M", "Male", "male", "MALE"] ? "m") ??
(gender in ["n", "N", "non-binary", "non binary", "Non-Binary", "Non Binary"] ? "n" : gender)
);
let userFields = .message.().({
"em": {{{{$.getGenericPaths("email")}}}},
Expand Down
Loading

0 comments on commit 1194194

Please sign in to comment.