Skip to content

chore(release): pull release/v1.97.0 into main #4239

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

Merged
merged 53 commits into from
Apr 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
3334363
chore: clean up source version specific code everywhere
vinayteki95 Mar 17, 2025
8e8a111
chore: features upgradedToSourceTransformV2 is needed for now
vinayteki95 Mar 17, 2025
f2d1964
chore: remove unnecessary types
vinayteki95 Mar 26, 2025
2abdf5d
chore: use internal build-scan-push for security scans
vinayteki95 Feb 4, 2025
1de7b61
chore: upgrade build-scan-push version
vinayteki95 Mar 5, 2025
eeeb414
chore: truffleignore for false positives
vinayteki95 Mar 6, 2025
529215a
chore: test cases fixed to pass trufflehog
vinayteki95 Mar 6, 2025
29a9877
chore: missing digest when push is false fix
vinayteki95 Mar 6, 2025
6f1807d
chore: false positives in system files
vinayteki95 Mar 6, 2025
3b56142
chore: platform argument for right image build
vinayteki95 Mar 7, 2025
9e87367
chore: use different workflow runner based on labels
vinayteki95 Mar 12, 2025
513924e
chore: arm64 truffle hog ignore paths for false positives
vinayteki95 Mar 12, 2025
aad00c9
chore: clean up truffleignore file
vinayteki95 Mar 13, 2025
472e6c9
chore: testing without pushing image
vinayteki95 Mar 19, 2025
984ed33
chore: requires push true for successful cosign
vinayteki95 Mar 19, 2025
0d2e2b3
Merge branch 'develop' into chore.v2-spec-cleanup
vinayteki95 Mar 27, 2025
3c9ebd0
Merge branch 'develop' into chore.v2-spec-cleanup
vinayteki95 Apr 1, 2025
33bbf00
Merge branch 'develop' into chore.v2-spec-cleanup
vinayteki95 Apr 1, 2025
40ea550
chore: features cleanup, rename functions, test cases fixed
vinayteki95 Apr 1, 2025
18684ea
Merge branch 'develop' into chore.v2-spec-cleanup
vinayteki95 Apr 1, 2025
97c7675
chore: seperate dt and ut devops prs
vinayteki95 Apr 1, 2025
5d31b5a
chore: set profile config for openfaas
Thrinadh-Kumpatla Apr 1, 2025
1e8e824
fix: remove extra env
Thrinadh-Kumpatla Apr 2, 2025
3430ec8
chore(release): pull main into develop post release v1.96.0 (#4226)
ItsSudip Apr 2, 2025
342c82d
Merge branch 'develop' into chore.add-profile-annotation
Thrinadh-Kumpatla Apr 2, 2025
1944669
chore: set profile config for openfaas INF-834 (#4224)
Thrinadh-Kumpatla Apr 2, 2025
0530a1c
chore: update subteam in tagged user groups in release notif (#4227)
yashasvibajpai Apr 2, 2025
3176dfe
fix: validation error message in ga4 (#4208)
koladilip Apr 2, 2025
c82d934
fix: seperate dt and ut devops prs (#4223)
vinayteki95 Apr 3, 2025
960a49e
chore: use internal build-scan-push for security scans (#4044)
vinayteki95 Apr 4, 2025
322ddbc
Merge branch 'develop' into chore.v2-spec-cleanup
vinayteki95 Apr 4, 2025
cc81cfe
chore: sources v2 spec cleanup (#4192)
vinayteki95 Apr 4, 2025
b56ea86
fix: encode userId with forward slashes in CustomerIO URLs (#4229)
koladilip Apr 4, 2025
bc70358
refactor(iterable): update api limits and batching logic (#4232)
koladilip Apr 4, 2025
179eab7
chore: clean up old zoho logic after releasing vdmv2 (#4189)
am6010 Apr 4, 2025
d379d7f
fix: removing unwanted fields from event metadata in reddit destinati…
manish339k Apr 7, 2025
6ba03a0
fix: use UTC in getBirthdayObj to fix the ortto destination test in d…
manish339k Apr 7, 2025
668a144
chore: use google ads SDK in GAEC destination (#4177)
ItsSudip Apr 7, 2025
bcade26
fix(customerio): encode path parameter function (#4234)
koladilip Apr 7, 2025
bad8a67
feat(mp): add validation for property limits in mixpanel destination …
koladilip Apr 7, 2025
d72fbaa
feat: add spread middleware which will help to spread information aro…
ItsSudip Apr 8, 2025
38f3da2
fix: handle null properties for ga nonEcomGenericEvent (#4207)
ItsSudip Apr 8, 2025
e23fff9
feat: support compacted destination transformation payloads (#4220)
atzoum Apr 8, 2025
ab427cd
fix: handle fb_custom_audience auth error (#4237)
maheshkutty Apr 8, 2025
8e28808
feat: add record v1 support to event stream for garl (#4231)
koladilip Apr 8, 2025
fd392dc
refactor: shopify source tracker (#4230)
koladilip Apr 8, 2025
f7e8e47
chore(deps): bump delete-old-branches-action to 0.0.11 (#4219)
dependabot[bot] Apr 8, 2025
cce35f3
feat: added union and append operation in mp (#4225)
manish339k Apr 8, 2025
333c42e
feat: onboard userpilot integration (#4238)
yashasvibajpai Apr 8, 2025
e17248b
chore(release): 1.97.0
web-flow Apr 8, 2025
c182e7f
feat: add validation for sourceEvents array type (#4240)
koladilip Apr 8, 2025
90095be
fix: ensure marketo_static_list metadata is always an array (#4241)
koladilip Apr 9, 2025
5b3c7d3
fix: handle invalid logincustomerId depending on subAccount (#4243)
ItsSudip Apr 9, 2025
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
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
node_modules/

Check warning on line 1 in .eslintignore

View workflow job for this annotation

GitHub Actions / Check for formatting & lint errors

File ignored by default.
.husky/
reports/
test/
benchmark/
dist/
dist-test/
**/warehouse/
**/lambda/
**/openfaas/
Expand Down
20 changes: 15 additions & 5 deletions .github/workflows/build-push-docker-image.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build Transformer Docker Image

Check warning on line 1 in .github/workflows/build-push-docker-image.yml

View workflow job for this annotation

GitHub Actions / Check for formatting & lint errors

File ignored by default.

on:
workflow_call:
Expand Down Expand Up @@ -36,6 +36,10 @@
DOCKERHUB_TOKEN:
required: true

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

env:
DOCKERHUB_USERNAME: rudderlabs

Expand Down Expand Up @@ -88,7 +92,7 @@

build-transformer-image-arm64:
name: Build Transformer Docker Image ARM64
runs-on: [self-hosted, Linux, ARM64]
runs-on: [self-hosted, Linux, ARM64, ubuntu-22]
needs: [get_sha, get_changed_files]
steps:
- name: Checkout
Expand All @@ -107,13 +111,16 @@
uses: docker/[email protected]

- name: Build Docker Image
uses: docker/build-push-action@v6.9.0
uses: rudderlabs/build-scan-push-action@v1.5.2
with:
context: .
file: ${{ inputs.dockerfile }}
target: ${{ inputs.load_target }}
load: true
tags: ${{ inputs.build_tag }}
push: true
platforms: |
linux/arm64
# cache-from: type=gha
# cache-to: type=gha,mode=max

Expand All @@ -124,7 +131,7 @@
docker run ${{ inputs.build_tag }} npm run test:ts:ci

- name: Build and Push Multi-platform Images
uses: docker/build-push-action@v6.9.0
uses: rudderlabs/build-scan-push-action@v1.5.2
with:
context: .
file: ${{ inputs.dockerfile }}
Expand Down Expand Up @@ -160,13 +167,16 @@
uses: docker/[email protected]

- name: Build Docker Image
uses: docker/build-push-action@v6.9.0
uses: rudderlabs/build-scan-push-action@v1.5.2
with:
context: .
file: ${{ inputs.dockerfile }}
target: ${{ inputs.load_target }}
load: true
tags: ${{ inputs.build_tag }}
push: true
platforms: |
linux/amd64
# cache-from: type=gha
# cache-to: type=gha,mode=max

Expand All @@ -177,7 +187,7 @@
docker run ${{ inputs.build_tag }} npm run test:ts:ci

- name: Build and Push Multi-platform Images
uses: docker/build-push-action@v6.9.0
uses: rudderlabs/build-scan-push-action@v1.5.2
with:
context: .
file: ${{ inputs.dockerfile }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/housekeeping.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Handle Stale PRs, Issues and Branches

Check warning on line 1 in .github/workflows/housekeeping.yml

View workflow job for this annotation

GitHub Actions / Check for formatting & lint errors

File ignored by default.

on:
schedule:
Expand Down Expand Up @@ -36,7 +36,7 @@
uses: actions/[email protected]

- name: Delete Old Branches
uses: beatlabs/[email protected].10
uses: beatlabs/[email protected].11
with:
repo_token: ${{ secrets.PAT }}
date: '3 months ago'
Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/prepare-for-prod-dt-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Prepare for DT Production Environment Deployment

Check warning on line 1 in .github/workflows/prepare-for-prod-dt-deploy.yml

View workflow job for this annotation

GitHub Actions / Check for formatting & lint errors

File ignored by default.

on:
push:
Expand Down Expand Up @@ -107,21 +107,15 @@

cd helm-charts/shared-services/per-az/environment/production
yq eval -i ".rudder-transformer.image.tag=\"$TAG_NAME\"" production.yaml
yq eval -i ".user-transformer.image.tag=\"$TAG_NAME\"" production.yaml
yq eval -i ".rudder-transformer.image.repository=\"$TF_IMAGE_REPOSITORY\"" production.yaml
yq eval -i ".user-transformer.image.repository=\"$TF_IMAGE_REPOSITORY\"" production.yaml
git add production.yaml

yq eval -i ".rudder-transformer.image.tag=\"$TAG_NAME\"" enterprise/enterprise.yaml
yq eval -i ".user-transformer.image.tag=\"$TAG_NAME\"" enterprise/enterprise.yaml
yq eval -i ".rudder-transformer.image.repository=\"$TF_IMAGE_REPOSITORY\"" enterprise/enterprise.yaml
yq eval -i ".user-transformer.image.repository=\"$TF_IMAGE_REPOSITORY\"" enterprise/enterprise.yaml
git add enterprise/enterprise.yaml

yq eval -i ".rudder-transformer.image.tag=\"$TAG_NAME\"" multi-tenant/multi-tenant.yaml
yq eval -i ".user-transformer.image.tag=\"$TAG_NAME\"" multi-tenant/multi-tenant.yaml
yq eval -i ".rudder-transformer.image.repository=\"$TF_IMAGE_REPOSITORY\"" multi-tenant/multi-tenant.yaml
yq eval -i ".user-transformer.image.repository=\"$TF_IMAGE_REPOSITORY\"" multi-tenant/multi-tenant.yaml
git add multi-tenant/multi-tenant.yaml

cd ../../../../config-be-rudder-transformer/environment/prod
Expand Down
14 changes: 13 additions & 1 deletion .github/workflows/prepare-for-prod-ut-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Prepare for UT Production Environment Deployment

Check warning on line 1 in .github/workflows/prepare-for-prod-ut-deploy.yml

View workflow job for this annotation

GitHub Actions / Check for formatting & lint errors

File ignored by default.

on:
push:
Expand Down Expand Up @@ -110,8 +110,20 @@
cd rudder-devops
git checkout -b shared-user-transformer-$UT_TAG_NAME

cd helm-charts/config-be-rudder-transformer/environment/prod
cd helm-charts/shared-services/per-az/environment/production
yq eval -i ".user-transformer.image.tag=\"$TAG_NAME\"" production.yaml
yq eval -i ".user-transformer.image.repository=\"$TF_IMAGE_REPOSITORY\"" production.yaml
git add production.yaml

yq eval -i ".user-transformer.image.tag=\"$TAG_NAME\"" enterprise/enterprise.yaml
yq eval -i ".user-transformer.image.repository=\"$TF_IMAGE_REPOSITORY\"" enterprise/enterprise.yaml
git add enterprise/enterprise.yaml

yq eval -i ".user-transformer.image.tag=\"$TAG_NAME\"" multi-tenant/multi-tenant.yaml
yq eval -i ".user-transformer.image.repository=\"$TF_IMAGE_REPOSITORY\"" multi-tenant/multi-tenant.yaml
git add multi-tenant/multi-tenant.yaml

cd ../../../../config-be-rudder-transformer/environment/prod
yq eval -i ".config-be-user-transformer.image.tag=\"$UT_TAG_NAME\"" base.yaml
git add base.yaml

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-new-release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Publish New GitHub Release

Check warning on line 1 in .github/workflows/publish-new-release.yml

View workflow job for this annotation

GitHub Actions / Check for formatting & lint errors

File ignored by default.

on:
pull_request:
Expand Down Expand Up @@ -100,7 +100,7 @@
channel-id: ${{ secrets.SLACK_RELEASE_CHANNEL_ID }}
payload: |
{
"text": "*<${{env.RELEASES_URL}}v${{ steps.extract-version.outputs.release_version }}|v${{ steps.extract-version.outputs.release_version }}>*\nCC: <@S02AEQL26CT> <@S03SEKBFX0D> <@U021E50QAGY>",
"text": "*<${{env.RELEASES_URL}}v${{ steps.extract-version.outputs.release_version }}|v${{ steps.extract-version.outputs.release_version }}>*\nCC: <!subteam^S02AEQL26CT> <!subteam^S03SEKBFX0D> <@U021E50QAGY>",
"blocks": [
{
"type": "header",
Expand All @@ -116,7 +116,7 @@
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*<${{env.RELEASES_URL}}v${{ steps.extract-version.outputs.release_version }}|v${{ steps.extract-version.outputs.release_version }}>*\nCC: <@U03KG4BK1L1> <@U024YF8CR53> <@U01LVJ30QEB>"
"text": "*<${{env.RELEASES_URL}}v${{ steps.extract-version.outputs.release_version }}|v${{ steps.extract-version.outputs.release_version }}>*\nCC: <!subteam^S02AEQL26CT> <!subteam^S03SEKBFX0D> <@U021E50QAGY>"
}
}
]
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Logs

Check warning on line 1 in .gitignore

View workflow job for this annotation

GitHub Actions / Check for formatting & lint errors

File ignored by default.
logs
*.log
npm-debug.log*
Expand Down Expand Up @@ -148,4 +148,7 @@
allure-report/

# local scripts
*/scripts/local/
*/scripts/local/

# git conflict files
*.orig
6 changes: 6 additions & 0 deletions .truffleignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/opt/yarn-v1.22.22/

Check warning on line 1 in .truffleignore

View workflow job for this annotation

GitHub Actions / Check for formatting & lint errors

File ignored by default.
/usr/lib/x86_64-linux-gnu/
/var/lib/dpkg/
image-metadata:history*:created-by
node_modules/
/usr/lib/aarch64-linux-gnu/
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,31 @@

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.97.0](https://github.com/rudderlabs/rudder-transformer/compare/v1.96.0...v1.97.0) (2025-04-08)


### Features

* add record v1 support to event stream for garl ([#4231](https://github.com/rudderlabs/rudder-transformer/issues/4231)) ([8e28808](https://github.com/rudderlabs/rudder-transformer/commit/8e288083e40a1d5c38bbec1984aba9e427b26247))
* add spread middleware which will help to spread information around the event body ([#4186](https://github.com/rudderlabs/rudder-transformer/issues/4186)) ([d72fbaa](https://github.com/rudderlabs/rudder-transformer/commit/d72fbaa7bc890fe5ea5480d436e88c92efce51a8))
* added union and append operation in mp ([#4225](https://github.com/rudderlabs/rudder-transformer/issues/4225)) ([cce35f3](https://github.com/rudderlabs/rudder-transformer/commit/cce35f358d83307a6a4263150e25a07d53e824ab))
* **mp:** add validation for property limits in mixpanel destination ([#4233](https://github.com/rudderlabs/rudder-transformer/issues/4233)) ([bad8a67](https://github.com/rudderlabs/rudder-transformer/commit/bad8a67df303c92b301484e780cf64584e75f695))
* onboard userpilot integration ([#4238](https://github.com/rudderlabs/rudder-transformer/issues/4238)) ([333c42e](https://github.com/rudderlabs/rudder-transformer/commit/333c42e174fcba4f575563b551b617a247ce6912)), closes [#4164](https://github.com/rudderlabs/rudder-transformer/issues/4164)
* support compacted destination transformation payloads ([#4220](https://github.com/rudderlabs/rudder-transformer/issues/4220)) ([e23fff9](https://github.com/rudderlabs/rudder-transformer/commit/e23fff924bfd29df3b27fffa14774ac26f43d63f))


### Bug Fixes

* **customerio:** encode path parameter function ([#4234](https://github.com/rudderlabs/rudder-transformer/issues/4234)) ([bcade26](https://github.com/rudderlabs/rudder-transformer/commit/bcade26479821f016ad9dd60c700deeff47fdea8))
* encode userId with forward slashes in CustomerIO URLs ([#4229](https://github.com/rudderlabs/rudder-transformer/issues/4229)) ([b56ea86](https://github.com/rudderlabs/rudder-transformer/commit/b56ea8651648ffaeef94a4fda569daa69ae2d9b2))
* handle fb_custom_audience auth error ([#4237](https://github.com/rudderlabs/rudder-transformer/issues/4237)) ([ab427cd](https://github.com/rudderlabs/rudder-transformer/commit/ab427cd7e3d685e2a36bcbd423a9938afbf1808b))
* handle null properties for ga nonEcomGenericEvent ([#4207](https://github.com/rudderlabs/rudder-transformer/issues/4207)) ([38f3da2](https://github.com/rudderlabs/rudder-transformer/commit/38f3da239f3eb3b3afe01cd95dfda0f2f5faecc5))
* remove extra env ([1e8e824](https://github.com/rudderlabs/rudder-transformer/commit/1e8e8246bf5c784f5a683c8a701e8365efed3cef))
* removing unwanted fields from event metadata in reddit destination ([#4221](https://github.com/rudderlabs/rudder-transformer/issues/4221)) ([d379d7f](https://github.com/rudderlabs/rudder-transformer/commit/d379d7f25fcc672721174b32cebc09954cc534ce))
* seperate dt and ut devops prs ([#4223](https://github.com/rudderlabs/rudder-transformer/issues/4223)) ([c82d934](https://github.com/rudderlabs/rudder-transformer/commit/c82d934a3a3934339a1da81f95f1b782304c3bf4))
* use UTC in getBirthdayObj to fix the ortto destination test in different timezones ([#4209](https://github.com/rudderlabs/rudder-transformer/issues/4209)) ([6ba03a0](https://github.com/rudderlabs/rudder-transformer/commit/6ba03a0120f16aa72be1ddd542c83abb945954ba))
* validation error message in ga4 ([#4208](https://github.com/rudderlabs/rudder-transformer/issues/4208)) ([3176dfe](https://github.com/rudderlabs/rudder-transformer/commit/3176dfe10acb8bbcb1ee0e5ecd1032181c8b6f57))

## [1.96.0](https://github.com/rudderlabs/rudder-transformer/compare/v1.95.2...v1.96.0) (2025-04-01)


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.96.0",
"version": "1.97.0",
"description": "",
"homepage": "https://github.com/rudderlabs/rudder-transformer#readme",
"bugs": {
Expand Down
11 changes: 6 additions & 5 deletions src/cdk/v2/destinations/ortto/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@ const lodash = require('lodash');
const { CommonUtils } = require('../../../../util/common');
const { maxBatchSize } = require('./config');

const getBirthdayObj = (birthday) => {
const dateRegex = /^\d{4}-\d{2}-\d{2}$/; // YYYY-MM-DD format
const dateRegex = /^\d{4}-\d{2}-\d{2}$/; // YYYY-MM-DD format

const getBirthdayObj = (birthday) => {
if (!dateRegex.test(birthday)) {
return null; // Invalid birthday format
}

const date = new Date(birthday);

const year = date.getFullYear();
const month = date.getMonth() + 1; // Month is 0-based, so add 1
const day = date.getDate();
const year = date.getUTCFullYear();
const month = date.getUTCMonth() + 1; // Month is 0-based, so add 1
const day = date.getUTCDate();

return { year, month, day };
};
Expand Down
2 changes: 1 addition & 1 deletion src/cdk/v2/destinations/reddit/procWorkflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ steps:
"event_at": .message.().({{{{$.getGenericPaths("timestamp")}}}}),
"event_type": $.outputs.prepareTrackPayload.eventType,
"user": $.outputs.prepareTrackPayload.prepareUserObject,
"event_metadata": $.outputs.prepareTrackPayload.combineAllEcomFields,
"event_metadata": $.removeUnsupportedFields($.outputs.prepareTrackPayload.eventType.tracking_type, $.outputs.prepareTrackPayload.combineAllEcomFields),
}]
}

Expand Down
26 changes: 26 additions & 0 deletions src/cdk/v2/destinations/reddit/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,35 @@ const populateRevenueField = (eventType, properties) => {
// Return the value as it is if it's not NaN
return revenueInCents;
};

// ref: https://business.reddithelp.com/s/article/about-event-metadata
const itemCountSupportedEvents = new Set(['Purchase', 'AddToCart', 'AddToWishlist', 'Custom']);
const valueAndCurrencySupportedEvents = new Set([
'Purchase',
'AddToCart',
'AddToWishlist',
'Lead',
'SignUp',
'Custom',
]);

const removeUnsupportedFields = (eventType, eventMetadata) => {
const updatedEventMetadata = { ...eventMetadata }; // Ensure immutability

if (!itemCountSupportedEvents.has(eventType)) {
delete updatedEventMetadata.item_count;
}
if (!valueAndCurrencySupportedEvents.has(eventType)) {
['value', 'value_decimal', 'currency'].forEach((field) => delete updatedEventMetadata[field]);
}

return updatedEventMetadata;
};

module.exports = {
batchEvents,
batchEventChunks,
populateRevenueField,
calculateDefaultRevenue,
removeUnsupportedFields,
};
9 changes: 9 additions & 0 deletions src/cdk/v2/destinations/userpilot/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const DEFAULT_BASE_URL = 'https://analytex.userpilot.io';

const MAPPINGS = {
createdAt: 'created_at',
};
module.exports = {
MAPPINGS,
DEFAULT_BASE_URL,
};
78 changes: 78 additions & 0 deletions src/cdk/v2/destinations/userpilot/procWorkflow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
bindings:
- name: EventType
path: ../../../../constants
- name: defaultRequestConfig
path: ../../../../v0/util
- name: removeUndefinedAndNullValues
path: ../../../../v0/util
- name: transformTraits
path: ./utils
- name: getEndpoints
path: ./utils
steps:
- name: validateInput
template: |
$.assert(.message.type, "message Type is not present. Aborting message.");
$.assert(.message.type in {{$.EventType.([.IDENTIFY, .TRACK, .GROUP])}},
"message type " + .message.type + " is not supported by Userpilot");

- name: prepareContext
template: |
$.context.messageType = .message.type;
$.context.payload = {};
$.context.apiVersion = "2020-09-22";
$.context.finalHeaders = {
"Authorization": "Token " + .destination.Config.apiKey,
"Content-Type": "application/json",
"X-API-Version": $.context.apiVersion
};

- name: identifyPayload
condition: $.context.messageType == {{$.EventType.IDENTIFY}}
template: |
$.assert(.message.userId, "User ID is required for Userpilot identify calls");

$.context.payload = {
"user_id": .message.userId
};

let traits = $.transformTraits(.message.context.traits || {});
$.context.payload.metadata = $.removeUndefinedAndNullValues(traits);
$.context.endpoint = $.getEndpoints(.destination.Config).IDENTIFY;

- name: trackPayload
condition: $.context.messageType == {{$.EventType.TRACK}}
template: |
$.assert(.message.userId, "User ID is required for Userpilot track calls");
$.assert(.message.event, "Event name is required for Userpilot track calls");

$.context.payload = {
"user_id": .message.userId,
"event": .message.event,
"metadata": $.removeUndefinedAndNullValues(.message.properties || {}),
};

$.context.endpoint = $.getEndpoints(.destination.Config).TRACK;

- name: groupPayload
condition: $.context.messageType == {{$.EventType.GROUP}}
template: |
$.assert(.message.groupId, "Group ID is required for Userpilot group calls");

let traits = $.transformTraits(.message.traits || {});

$.context.payload = {
"company_id": .message.groupId,
"metadata": $.removeUndefinedAndNullValues(traits),
};

$.context.endpoint = $.getEndpoints(.destination.Config).GROUP;

- name: returnResponse
template: |
const response = $.defaultRequestConfig();
response.endpoint = $.context.endpoint;
response.headers = $.context.finalHeaders;
response.method = "POST";
response.body = $.context.payload;
response
Loading
Loading