Skip to content

Commit

Permalink
Merge branch 'develop' into feat.hs-batching
Browse files Browse the repository at this point in the history
  • Loading branch information
mihir-4116 authored Jan 24, 2024
2 parents 00fdf9a + de4e321 commit f448299
Show file tree
Hide file tree
Showing 332 changed files with 34,479 additions and 117,277 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/component-test-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Component Test Reporter

on:
pull_request:
types:
- opened
- reopened
- synchronize

permissions:
id-token: write # allows the JWT to be requested from GitHub's OIDC provider
contents: read # This is required for actions/checkout

jobs:
test_and_upload:
runs-on: ubuntu-latest

steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::${{ secrets.AWS_DEV_ACCOUNT_ID }}:role/${{ secrets.AWS_DEV_S3_SYNC_ROLE }}
aws-region: us-east-1

- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 1

- name: Setup Node
uses: actions/[email protected]
with:
node-version-file: '.nvmrc'
cache: 'npm'

- name: Install Dependencies
run: npm ci

- name: Run Tests and Generate Report
run: |
npm run test:ts -- component
- name: Uplaod Report to S3
run: |
aws s3 cp ./test_reports/ s3://test-integrations-dev/integrations-test-reports/rudder-transformer/${{ github.event.number }}/ --recursive
- name: Comment on PR with S3 Object URL
uses: actions/github-script@v7
with:
github-token: ${{ secrets.PAT }}
script: |
const { owner, repo } = context.repo;
// Get the pull request number
const prNumber = context.payload.pull_request.number;
const commentBody = `Test report for this run is available at: https://test-integrations-dev.s3.amazonaws.com/integrations-test-reports/rudder-transformer/${prNumber}/test-report.html`;
// Comment on the pull request
github.rest.issues.createComment({
owner,
repo,
issue_number: prNumber,
body: commentBody
});
2 changes: 1 addition & 1 deletion .github/workflows/prepare-for-dev-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
report-coverage:
name: Report Code Coverage
if: github.event_name == 'push'
uses: ./.github/workflows/report-code-coverage.yml
uses: ./.github/workflows/dt-test-and-report-code-coverage.yml
secrets:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/prepare-for-prod-dt-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
report-coverage:
name: Report Code Coverage
if: github.event_name == 'push'
uses: ./.github/workflows/report-code-coverage.yml
uses: ./.github/workflows/dt-test-and-report-code-coverage.yml
secrets:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/prepare-for-prod-ut-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
report-coverage:
name: Report Code Coverage
if: github.event_name == 'push'
uses: ./.github/workflows/report-code-coverage.yml
uses: ./.github/workflows/dt-test-and-report-code-coverage.yml
secrets:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ut-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Setup Go
uses: actions/setup-go@v4.1.0
uses: actions/setup-go@v5.0.0
with:
go-version: 1.17

Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,7 @@ dist
**/.DS_Store


.idea
.idea

# component test report
test_reports/
2 changes: 1 addition & 1 deletion 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
Expand Up @@ -110,7 +110,7 @@
"stacktrace-parser": "^0.1.10",
"statsd-client": "^0.4.7",
"truncate-utf8-bytes": "^1.0.2",
"ua-parser-js": "^1.0.35",
"ua-parser-js": "^1.0.37",
"unset-value": "^2.0.1",
"uuid": "^9.0.0",
"valid-url": "^1.0.9"
Expand Down
3 changes: 2 additions & 1 deletion src/cdk/v2/destinations/ortto/procWorkflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ steps:
description: |
Builds common fields in destination payload.
template: |
let phone = .message.().({{{{$.getGenericPaths("phone")}}}});
let commonFields = .message.().({
"fields": {
"str::first": {{{{$.getGenericPaths("firstName")}}}},
Expand All @@ -46,7 +47,7 @@ steps:
"dtz::b": $.getBirthdayObj({{{{$.getGenericPaths("birthday")}}}}),
"str::ei": {{{{$.getGenericPaths("userId")}}}},
"str::language": .context.traits.language || .context.locale,
"phn::phone": {"n": {{{{$.getGenericPaths("phone")}}}}},
"phn::phone": phone ? {"n": phone},
"bol::gdpr": .context.traits.gdpr ?? true,
"bol::p": .context.traits.emailConsent || false,
"bol::sp": .context.traits.smsConsent || false,
Expand Down
49 changes: 30 additions & 19 deletions src/cdk/v2/destinations/the_trade_desk/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const {
getSuccessRespEvents,
removeUndefinedAndNullValues,
handleRtTfSingleEventError,
isEmptyObject,
} = require('../../../../v0/util');
const tradeDeskConfig = require('./config');

Expand Down Expand Up @@ -59,34 +60,44 @@ const processRecordInputs = (inputs, destination) => {
const successMetadata = [];
const errorResponseList = [];

const error = new InstrumentationError('Invalid action type');
const invalidActionTypeError = new InstrumentationError('Invalid action type');
const emptyFieldsError = new InstrumentationError('Fields cannot be empty');

inputs.forEach((input) => {
const { fields, action } = input.message;
const isInsertOrDelete = action === 'insert' || action === 'delete';

if (isInsertOrDelete) {
successMetadata.push(input.metadata);
const data = [
{
Name: Config.audienceId,
TTLInMinutes: action === 'insert' ? ttlInMin(Config.ttlInDays) : 0,
},
];

Object.keys(fields).forEach((id) => {
const value = fields[id];
if (value) {
// adding only non empty ID's
items.push({ [id]: value, Data: data });
}
});
} else {
errorResponseList.push(handleRtTfSingleEventError(input, error, {}));
if (!isInsertOrDelete) {
errorResponseList.push(handleRtTfSingleEventError(input, invalidActionTypeError, {}));
return;
}

if (isEmptyObject(fields)) {
errorResponseList.push(handleRtTfSingleEventError(input, emptyFieldsError, {}));
return;
}

successMetadata.push(input.metadata);
const data = [
{
Name: Config.audienceId,
TTLInMinutes: action === 'insert' ? ttlInMin(Config.ttlInDays) : 0,
},
];

Object.keys(fields).forEach((id) => {
const value = fields[id];
if (value) {
// adding only non empty ID's
items.push({ [id]: value, Data: data });
}
});
});

const payloads = batchResponseBuilder(items, Config);
if (payloads.length === 0) {
return errorResponseList;
}

const response = getSuccessRespEvents(payloads, successMetadata, destination, true);
return [response, ...errorResponseList];
Expand Down
Loading

0 comments on commit f448299

Please sign in to comment.