Skip to content

Commit

Permalink
fix: merge develop and resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
shrouti1507 committed Nov 1, 2023
2 parents 1050114 + c38f14f commit 1e0b1a3
Show file tree
Hide file tree
Showing 248 changed files with 113,884 additions and 91,941 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/draft-new-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest

# Only allow release stakeholders to initiate releases
if: (github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/heads/hotfix/')) && (github.actor == 'ItsSudip' || github.actor == 'krishna2020' || github.actor == 'saikumarrs' || github.actor == 'sandeepdsvs' || github.actor == 'shrouti1507' || github.actor == 'anantjain45823' || github.actor == 'chandumlg' || github.actor == 'mihir-4116') && (github.triggering_actor == 'ItsSudip' || github.triggering_actor == 'krishna2020' || github.triggering_actor == 'saikumarrs' || github.triggering_actor == 'sandeepdsvs' || github.triggering_actor == 'shrouti1507' || github.triggering_actor == 'anantjain45823' || github.triggering_actor == 'chandumlg' || github.triggering_actor == 'mihir-4116')
if: (github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/heads/hotfix/')) && (github.actor == 'ItsSudip' || github.actor == 'krishna2020' || github.actor == 'saikumarrs' || github.actor == 'sandeepdsvs' || github.actor == 'shrouti1507' || github.actor == 'anantjain45823' || github.actor == 'chandumlg' || github.actor == 'mihir-4116' || github.actor == 'yashasvibajpai' || github.actor == 'sanpj2292') && (github.triggering_actor == 'ItsSudip' || github.triggering_actor == 'krishna2020' || github.triggering_actor == 'saikumarrs' || github.triggering_actor == 'sandeepdsvs' || github.triggering_actor == 'shrouti1507' || github.triggering_actor == 'anantjain45823' || github.triggering_actor == 'chandumlg' || github.triggering_actor == 'mihir-4116' || github.triggering_actor == 'yashasvibajpai' || github.triggering_actor == 'sanpj2292')
steps:
- name: Checkout
uses: actions/[email protected]
Expand Down
52 changes: 52 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,58 @@

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


### Features

* add custom utm parameters to mixpanel ([#2771](https://github.com/rudderlabs/rudder-transformer/issues/2771)) ([9c4fcd3](https://github.com/rudderlabs/rudder-transformer/commit/9c4fcd3595534a8b563df3467e23c94c580f08a6))
* add support filtering component tests by feature and index ([#2748](https://github.com/rudderlabs/rudder-transformer/issues/2748)) ([146f1c6](https://github.com/rudderlabs/rudder-transformer/commit/146f1c63db4e895c7d5ce2848a1b60e7c5bb9fb6))
* onboard destination ortto ([#2730](https://github.com/rudderlabs/rudder-transformer/issues/2730)) ([9be5740](https://github.com/rudderlabs/rudder-transformer/commit/9be5740d8670890b0318da3d37f258ddc5e35445))
* onboard facebook custom audience to transformer proxy ([#2769](https://github.com/rudderlabs/rudder-transformer/issues/2769)) ([14c5e40](https://github.com/rudderlabs/rudder-transformer/commit/14c5e40284af7df9e4f5b262ad226dd3afef226e))
* add custom event name support in pinterest v5 ([#2773](https://github.com/rudderlabs/rudder-transformer/pull/2773)) ([a586a92](https://github.com/rudderlabs/rudder-transformer/commit/a586a92bf410679d0f3aa7012d4d10f8e2f515d5))


### Bug Fixes

* bugsnag error for salesforce ([#2753](https://github.com/rudderlabs/rudder-transformer/issues/2753)) ([a2ccdad](https://github.com/rudderlabs/rudder-transformer/commit/a2ccdad52a1fb88f962745800cb45d605b5e0bf3))
* oom kill while stringifying large response json ([#2754](https://github.com/rudderlabs/rudder-transformer/issues/2754)) ([c8baf5b](https://github.com/rudderlabs/rudder-transformer/commit/c8baf5b2b6325d9e30200339055dcbefd780936c))
* salesforce: handle ECONNABORTED error ([#2732](https://github.com/rudderlabs/rudder-transformer/issues/2732)) ([6b23a9b](https://github.com/rudderlabs/rudder-transformer/commit/6b23a9b33acd28fdacaa2390c1970a1fa4415ffa))

### [1.46.5](https://github.com/rudderlabs/rudder-transformer/compare/v1.46.4...v1.46.5) (2023-10-23)


### Bug Fixes

* **hubspot:** property mismatch ([5530031](https://github.com/rudderlabs/rudder-transformer/commit/553003192a1492220e3930c6b6f2dd11ebac1bcb))

### [1.46.4](https://github.com/rudderlabs/rudder-transformer/compare/v1.46.3...v1.46.4) (2023-10-20)


### Bug Fixes

* **hs:** time stamp and contact not found issue ([391c7cd](https://github.com/rudderlabs/rudder-transformer/commit/391c7cdc5576152576bbd2c6d335a04ce6795833))

### [1.46.3](https://github.com/rudderlabs/rudder-transformer/compare/v1.46.2...v1.46.3) (2023-10-20)


### Bug Fixes

* deduplication key issue ([#2757](https://github.com/rudderlabs/rudder-transformer/issues/2757)) ([bc76305](https://github.com/rudderlabs/rudder-transformer/commit/bc76305e3fcc3c9ac69e639e90a37499566d0837))

### [1.46.2](https://github.com/rudderlabs/rudder-transformer/compare/v1.46.1...v1.46.2) (2023-10-19)


### Bug Fixes

* do not send 298 event for aborted ones in ut ([d414064](https://github.com/rudderlabs/rudder-transformer/commit/d414064aac1c8d769607346bc48b8db549e7a8dc))

### [1.46.1](https://github.com/rudderlabs/rudder-transformer/compare/v1.46.0...v1.46.1) (2023-10-19)

### Bug Fixes

* add gzip support compatibility ([#2745](https://github.com/rudderlabs/rudder-transformer/issues/2745)) ([d72410f](https://github.com/rudderlabs/rudder-transformer/commit/d72410f7962e702218be3c2414de62341ca29e39))

## [1.46.0](https://github.com/rudderlabs/rudder-transformer/compare/v1.45.3...v1.46.0) (2023-10-18)


Expand Down
6 changes: 3 additions & 3 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ module.exports = {
coverageThreshold: {
global: {
branches: 60,
functions: 80,
lines: 80,
statements: 80,
functions: 75,
lines: 75,
statements: 75,
},
},

Expand Down
6 changes: 3 additions & 3 deletions jest.default.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ module.exports = {
coverageThreshold: {
global: {
branches: 60,
functions: 80,
lines: 80,
statements: 80,
functions: 75,
lines: 75,
statements: 75,
},
},

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.46.0",
"version": "1.47.0",
"description": "",
"homepage": "https://github.com/rudderlabs/rudder-transformer#readme",
"bugs": {
Expand Down
8 changes: 8 additions & 0 deletions src/adapters/utils/networkUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ const nodeSysErrorToStatus = (code) => {
status: 500,
message: '[ETIMEDOUT] :: Operation timed out',
},
EAI_AGAIN: {
status: 500,
message: '[EAI_AGAIN] :: Temporary failure in name resolution',
},
ECONNABORTED: {
status: 500,
message: '[ECONNABORTED] :: Connection aborted',
},
};
return sysErrorToStatusMap[code] || { status: 400, message: `[${code}]` };
};
Expand Down
38 changes: 38 additions & 0 deletions src/cdk/v2/destinations/ortto/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
const IDENTIFY_ENDPOINT = {
au: 'https://api.au.ap3api.com/v1/person/merge',
eu: 'https://api.eu.ap3api.com/v1/person/merge',
other: 'https://api.ap3api.com/v1/person/merge',
};
// https://help.ortto.com/developer/latest/api-reference/person/merge.html#person-fields
const TRACK_ENDPOINT = {
au: 'https://api.au.ap3api.com/v1/activities/create',
eu: 'https://api.eu.ap3api.com/v1/activities/create',
other: 'https://api.ap3api.com/v1/activities/create',
};
// https://help.ortto.com/a-271-create-a-custom-activity-event-create

const maxBatchSize = 1;

const fieldTypeMap = {
text: 'str',
email: 'str',
longText: 'txt',
number: 'int',
decimalNumber: 'int',
currency: 'int',
date: 'dtz',
timeAndDate: 'tme',
boolean: 'bol',
phone: 'phn',
singleSelect: 'str',
multiSelect: 'sst',
link: 'str',
object: 'obj',
};

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

steps:
- name: validateInput
template: |
let messageType = .message.type;
$.assert(.message.type, "message Type is not present. Aborting message.");
$.assertConfig(.destination.Config.privateApiKey, "Private Api Key is not present");
$.assertConfig(.destination.Config.instanceRegion, "Instance Region is not present");
$.assert(messageType in {{$.EventType.([.IDENTIFY, .TRACK])}}, "message type " + messageType + " is not supported");
$.assert(.message.().({{{{$.getGenericPaths("email")}}}}) || .message.().({{{{$.getGenericPaths("userId")}}}}), "Either of email or userId is required. Aborting message.");
- 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.().({
"fields": {
"str::first": {{{{$.getGenericPaths("firstName")}}}},
"str::last": {{{{$.getGenericPaths("lastName")}}}},
"str::email": {{{{$.getGenericPaths("email")}}}},
"geo::city": {"name":{{{{$.getGenericPaths("city")}}}}},
"geo::country": {"name":{{{{$.getGenericPaths("country")}}}}},
"geo::region": {"name":{{{{$.getGenericPaths("region")}}}}},
"str::postal": {{{{$.getGenericPaths("zipcode")}}}},
"dtz::b": $.getBirthdayObj({{{{$.getGenericPaths("birthday")}}}}),
"str::ei": {{{{$.getGenericPaths("userId")}}}},
"str::language": .context.traits.language || .context.locale,
"phn::phone": {"n": {{{{$.getGenericPaths("phone")}}}}},
"bol::gdpr": .context.traits.gdpr ?? true,
"bol::p": .context.traits.emailConsent || false,
"bol::sp": .context.traits.smsConsent || false,
},
"location": {"source_ip": .context.ip}
});
.destination.Config.orttoPersonAttributes@attribute.(
const trimmedOrttoAttribute = attribute.orttoAttribute.trim().toLowerCase().replace(new RegExp('\\s+', 'g'),'-');
commonFields.fields[$.fieldTypeMap[attribute.type]+":cm:"+trimmedOrttoAttribute] = $.originalInput.message.context.traits[attribute.rudderTraits]
)[]
commonFields.fields = $.removeUndefinedAndNullValues(commonFields.fields)
$.removeUndefinedAndNullValues(commonFields)
- name: prepareIdentifyPayload
condition: $.outputs.messageType === {{$.EventType.IDENTIFY}}
template: |
const peopleObj = {
"fields": $.outputs.commonFields.fields,
"tags": .message.context.traits.tags || .message.traits.tags,
"unset_tags": .message.context.traits.unset_tags || .message.traits.unset_tags
}
const identifyPayoad = {
"people":[peopleObj],
"merge_by": ["str::ei", "str::email"]
}
$.removeUndefinedAndNullValues(identifyPayoad)
- name: prepareTrackPayload
condition: $.outputs.messageType === {{$.EventType.TRACK}}
steps:
- name: getTrimmedEvent
template: |
let customEvent = "";
const event = .message.event;
.destination.Config.orttoEventsMapping@order.(
customEvent = event === .rsEventName ? .orttoEventName : null;
)
$.assert(customEvent, "Event names is not mapped");
"act:cm:"+customEvent.trim().toLowerCase().replace(new RegExp('\\s+', 'g'),'-');
- name: getAttributes
template: |
let attributes = {};
[email protected]@prop.(
attributes[$.fieldTypeMap[prop.type]+":cm:"+prop.orttoProperty.trim().toLowerCase().replace(new RegExp('\\s+', 'g'),'-')] = $.originalInput.message.properties[prop.rudderProperty]
)
$.removeUndefinedAndNullValues(attributes)
- name: preparePayload
template: |
const activityObj = {
"fields": $.outputs.commonFields.fields,
"activity_id": $.outputs.prepareTrackPayload.getTrimmedEvent,
"attributes": $.outputs.prepareTrackPayload.getAttributes,
"location": {"source_ip": .message.context.ip}
};
{
"activities":[activityObj],
"merge_by": ["str::ei", "str::email"]
}
- name: payload
template: |
$.outputs.messageType === {{$.EventType.IDENTIFY}} ? $.outputs.prepareIdentifyPayload : $.outputs.prepareTrackPayload
- name: buildResponseForProcessTransformation
description: build response
template: |
const response = $.defaultRequestConfig();
const instanceRegion = $.originalInput.destination.Config.instanceRegion;
response.body.JSON = $.outputs.payload;
response.endpoint = response.body.JSON.people? $.IDENTIFY_ENDPOINT[instanceRegion] : $.TRACK_ENDPOINT[instanceRegion];
response.headers = {
"X-Api-Key": .destination.Config.privateApiKey,
"Content-Type": "application/json"
};
response;
70 changes: 70 additions & 0 deletions src/cdk/v2/destinations/ortto/rtWorkflow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
bindings:
- path: ./utils
- path: ./config

steps:
- name: validateInput
template: |
$.assert(Array.isArray(^) && ^.length > 0, "Invalid event array")
- name: transform
externalWorkflow:
path: ./procWorkflow.yaml
bindings:
- name: batchMode
value: true
loopOverInput: true
- name: successfulEvents
template: |
$.outputs.transform#idx.output.({
"message": .[],
"destination": ^ [idx].destination,
"metadata": ^ [idx].metadata
})[]
- name: failedEvents
template: |
$.outputs.transform#idx.error.({
"metadata": ^[idx].metadata[],
"destination": ^[idx].destination,
"batched": false,
"statusCode": .status,
"error": .message,
"statTags": .originalError.statTags
})[]
- name: batchSuccessfulEvents
description: Batches the successfulEvents using V3 API
condition: $.outputs.successfulEvents.length
template: |
let batches = $.batchEvents($.outputs.successfulEvents);
batches@batch.({
"batchedRequest": {
"body": {
"JSON": batch.message,
"JSON_ARRAY": {},
"XML": {},
"FORM": {}
},
"version": "1",
"type": "REST",
"method": "POST",
"endpoint": batch.message.people ? $.IDENTIFY_ENDPOINT[$.originalInput[0].destination.Config.instanceRegion] : $.TRACK_ENDPOINT[$.originalInput[0].destination.Config.instanceRegion],
"headers": {
"X-Api-Key": .destination.Config.privateApiKey,
"Content-Type": "application/json",
},
"params": {},
"files": {}
},
"metadata": batch.metadata,
"batched": true,
"statusCode": 200,
"destination": batch.destination
})[];
else:
name: returnEmptyOuput
template: '[]'

- name: finalPayload
template: |
[...$.outputs.batchSuccessfulEvents, ...$.outputs.failedEvents]
Loading

0 comments on commit 1e0b1a3

Please sign in to comment.