From 56831b359ad3b0c7129522ab6289ef15564199cf Mon Sep 17 00:00:00 2001 From: Dilip Kola <33080863+koladilip@users.noreply.github.com> Date: Tue, 10 Dec 2024 11:38:51 +0530 Subject: [PATCH 01/14] chore: add gh workflow for raising pr for constants (#1832) --- .github/workflows/check-generated.yml | 2 + .github/workflows/raise-pr-for-constants.yml | 80 ++++++++++++++++++++ generated/Destinations.dart | 4 +- generated/Destinations.java | 4 +- generated/Destinations.kt | 4 +- generated/Destinations.m | 4 +- generated/Destinations.swift | 4 +- generated/Destinations.ts | 4 +- templates/Destinations.dart.template | 4 +- templates/Destinations.java.template | 4 +- templates/Destinations.kt.template | 4 +- templates/Destinations.m.template | 4 +- templates/Destinations.swift.template | 4 +- templates/Destinations.ts.template | 4 +- 14 files changed, 106 insertions(+), 24 deletions(-) create mode 100644 .github/workflows/raise-pr-for-constants.yml diff --git a/.github/workflows/check-generated.yml b/.github/workflows/check-generated.yml index b6d021c80..d8c40f7ac 100644 --- a/.github/workflows/check-generated.yml +++ b/.github/workflows/check-generated.yml @@ -32,6 +32,8 @@ jobs: run: | if [ -n "$(git status --porcelain)" ]; then echo "::error::Generated constants are not up-to-date. Run 'npm run generate:constants' and commit the changes."; + echo "Here are the differences:"; + git diff || true 2>&1; exit 1; else echo "Git state is clean."; diff --git a/.github/workflows/raise-pr-for-constants.yml b/.github/workflows/raise-pr-for-constants.yml new file mode 100644 index 000000000..c509f166a --- /dev/null +++ b/.github/workflows/raise-pr-for-constants.yml @@ -0,0 +1,80 @@ +name: Raise PR for Destination Constants + +on: + push: + branches: + - develop + +permissions: + contents: write + pull-requests: write + +env: + BRANCH_NAME: fix/gh-update-destinations-ts + SRC_FILE: generated/Destinations.ts + DEST_PATH: packages/analytics-js-common/src/constants/integrations/Destinations.ts + +jobs: + check_changes: + runs-on: ubuntu-latest + outputs: + pr_required: ${{ steps.compare_files.outputs.pr_required }} + steps: + - name: Checkout Source Repo + uses: actions/checkout@v4 + with: + ref: develop + + - name: Checkout Destination Repo + run: | + DEST_REPO="rudderlabs/rudder-sdk-js" + git clone https://github.com/${DEST_REPO}.git dest-repo || exit 1 + cd dest-repo + git config --global user.name "GitHub Actions" + git config --global user.email "noreply@github.com" + git config --global url."https://${{ secrets.GITHUB_TOKEN }}@github.com/".insteadOf "https://github.com/" + git checkout ${{ env.BRANCH_NAME }} || git checkout -b ${{ env.BRANCH_NAME }} + + - name: Compare Destinations.ts + id: compare_files + run: | + if cmp -s "${{ env.SRC_FILE }}" "dest-repo/${{ env.DEST_PATH }}"; then + echo "No changes detected." > "result.txt" + echo "pr_required=false" >> $GITHUB_OUTPUT + else + echo "Changes detected." > "result.txt" + echo "pr_required=true" >> $GITHUB_OUTPUT + fi + + raise_pr: + needs: check_changes + if: needs.check_changes.outputs.pr_required == 'true' + runs-on: ubuntu-latest + steps: + - name: Commit and Push Changes + run: | + cd dest-repo + cp "../generated/Destinations.ts" "packages/analytics-js-common/src/constants/integrations/Destinations.ts" + git add packages/analytics-js-common/src/constants/integrations/Destinations.ts + git commit -m "fix: update destinations.ts" + git push origin ${{ env.BRANCH_NAME }} + + - name: Create or Update PR + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + cd dest-repo + EXISTING_PR=$(gh pr list --head ${{ env.BRANCH_NAME }} --json number --jq ".[0].number") + if [ -z "$EXISTING_PR" ]; then + gh pr create \ + --title "fix: update destination constants" \ + --body "This PR updates the destination constants file. + + **Changes:** + - Updated \`Destinations.ts\` with latest constants + + This PR was automatically generated by GitHub Actions." \ + --label "automated,dependencies" + else + echo "PR already exists: $EXISTING_PR" + fi diff --git a/generated/Destinations.dart b/generated/Destinations.dart index 9c2159fb5..be0ef7a06 100644 --- a/generated/Destinations.dart +++ b/generated/Destinations.dart @@ -1,9 +1,9 @@ /* GENERATED - DO NOT EDIT This file is generated from the templates/Destinations.dart.template file. - Orginal file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.dart + Original file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.dart - NOTE: Containly only constants for device mode destinations + NOTE: Contains only constants for device mode destinations */ class Destinations { diff --git a/generated/Destinations.java b/generated/Destinations.java index b1d57fd79..092d09b2c 100644 --- a/generated/Destinations.java +++ b/generated/Destinations.java @@ -1,9 +1,9 @@ /* GENERATED - DO NOT EDIT This file is generated from the templates/Destinations.java.template file. - Orginal file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.java + Original file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.java - NOTE: Containly only constants for device mode destinations + NOTE: Contains only constants for device mode destinations */ public class Destinations { diff --git a/generated/Destinations.kt b/generated/Destinations.kt index d26980292..02178de38 100644 --- a/generated/Destinations.kt +++ b/generated/Destinations.kt @@ -1,9 +1,9 @@ /* GENERATED - DO NOT EDIT This file is generated from the templates/Destinations.kt.template file. - Orginal file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.kt + Original file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.kt - NOTE: Containly only constants for device mode destinations + NOTE: Contains only constants for device mode destinations */ object Destinations { diff --git a/generated/Destinations.m b/generated/Destinations.m index c0b98180b..1bf83b059 100644 --- a/generated/Destinations.m +++ b/generated/Destinations.m @@ -1,9 +1,9 @@ /* GENERATED - DO NOT EDIT This file is generated from the templates/Destinations.m.template file. - Orginal file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.m + Original file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.m - NOTE: Containly only constants for device mode destinations */ + NOTE: Contains only constants for device mode destinations */ #import diff --git a/generated/Destinations.swift b/generated/Destinations.swift index 368d890df..cd9694920 100644 --- a/generated/Destinations.swift +++ b/generated/Destinations.swift @@ -1,9 +1,9 @@ /* GENERATED - DO NOT EDIT This file is generated from the templates/Destinations.swift.template file. - Orginal file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.swift + Original file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.swift - NOTE: Containly only constants for device mode destinations + NOTE: Contains only constants for device mode destinations */ struct Destinations { diff --git a/generated/Destinations.ts b/generated/Destinations.ts index e97f1016c..a764b822c 100644 --- a/generated/Destinations.ts +++ b/generated/Destinations.ts @@ -1,9 +1,9 @@ /* GENERATED - DO NOT EDIT This file is generated from the templates/Destinations.ts.template file. - Orginal file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.ts + Original file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.ts - NOTE: Containly only constants for device mode destinations + NOTE: Contains only constants for device mode destinations */ export const ACTIVE_CAMPAIGN_NAME = 'ACTIVE_CAMPAIGN'; export const ACTIVE_CAMPAIGN_DISPLAY_NAME = 'ActiveCampaign'; diff --git a/templates/Destinations.dart.template b/templates/Destinations.dart.template index f78f19489..9b6b5b615 100644 --- a/templates/Destinations.dart.template +++ b/templates/Destinations.dart.template @@ -1,9 +1,9 @@ /* GENERATED - DO NOT EDIT This file is generated from the templates/Destinations.dart.template file. - Orginal file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.dart + Original file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.dart - NOTE: Containly only constants for device mode destinations + NOTE: Contains only constants for device mode destinations */ class Destinations { diff --git a/templates/Destinations.java.template b/templates/Destinations.java.template index 941f2cebc..b1cb12bb0 100644 --- a/templates/Destinations.java.template +++ b/templates/Destinations.java.template @@ -1,9 +1,9 @@ /* GENERATED - DO NOT EDIT This file is generated from the templates/Destinations.java.template file. - Orginal file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.java + Original file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.java - NOTE: Containly only constants for device mode destinations + NOTE: Contains only constants for device mode destinations */ public class Destinations { diff --git a/templates/Destinations.kt.template b/templates/Destinations.kt.template index 66feb5340..c6ca2a5cb 100644 --- a/templates/Destinations.kt.template +++ b/templates/Destinations.kt.template @@ -1,9 +1,9 @@ /* GENERATED - DO NOT EDIT This file is generated from the templates/Destinations.kt.template file. - Orginal file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.kt + Original file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.kt - NOTE: Containly only constants for device mode destinations + NOTE: Contains only constants for device mode destinations */ object Destinations { diff --git a/templates/Destinations.m.template b/templates/Destinations.m.template index 3c091322e..0b53a7c8c 100644 --- a/templates/Destinations.m.template +++ b/templates/Destinations.m.template @@ -1,9 +1,9 @@ /* GENERATED - DO NOT EDIT This file is generated from the templates/Destinations.m.template file. - Orginal file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.m + Original file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.m - NOTE: Containly only constants for device mode destinations */ + NOTE: Contains only constants for device mode destinations */ #import diff --git a/templates/Destinations.swift.template b/templates/Destinations.swift.template index 735c26006..a0af3a6e6 100644 --- a/templates/Destinations.swift.template +++ b/templates/Destinations.swift.template @@ -1,9 +1,9 @@ /* GENERATED - DO NOT EDIT This file is generated from the templates/Destinations.swift.template file. - Orginal file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.swift + Original file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.swift - NOTE: Containly only constants for device mode destinations + NOTE: Contains only constants for device mode destinations */ struct Destinations { diff --git a/templates/Destinations.ts.template b/templates/Destinations.ts.template index 30b567063..582562b0e 100644 --- a/templates/Destinations.ts.template +++ b/templates/Destinations.ts.template @@ -1,9 +1,9 @@ /* GENERATED - DO NOT EDIT This file is generated from the templates/Destinations.ts.template file. - Orginal file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.ts + Original file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.ts - NOTE: Containly only constants for device mode destinations + NOTE: Contains only constants for device mode destinations */ ${ destinations.map((dest) => From e57aa07e578f4017d06465baf82bca580233f8aa Mon Sep 17 00:00:00 2001 From: Dilip Kola <33080863+koladilip@users.noreply.github.com> Date: Tue, 10 Dec 2024 13:45:34 +0530 Subject: [PATCH 02/14] fix: constants pr workflow to keep all steps under the same job (#1834) --- .github/workflows/raise-pr-for-constants.yml | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/.github/workflows/raise-pr-for-constants.yml b/.github/workflows/raise-pr-for-constants.yml index c509f166a..0df7cd8bd 100644 --- a/.github/workflows/raise-pr-for-constants.yml +++ b/.github/workflows/raise-pr-for-constants.yml @@ -15,10 +15,8 @@ env: DEST_PATH: packages/analytics-js-common/src/constants/integrations/Destinations.ts jobs: - check_changes: + check_changes_and_raise_pr: runs-on: ubuntu-latest - outputs: - pr_required: ${{ steps.compare_files.outputs.pr_required }} steps: - name: Checkout Source Repo uses: actions/checkout@v4 @@ -46,12 +44,8 @@ jobs: echo "pr_required=true" >> $GITHUB_OUTPUT fi - raise_pr: - needs: check_changes - if: needs.check_changes.outputs.pr_required == 'true' - runs-on: ubuntu-latest - steps: - name: Commit and Push Changes + if: steps.compare_files.outputs.pr_required == 'true' run: | cd dest-repo cp "../generated/Destinations.ts" "packages/analytics-js-common/src/constants/integrations/Destinations.ts" @@ -60,6 +54,7 @@ jobs: git push origin ${{ env.BRANCH_NAME }} - name: Create or Update PR + if: steps.compare_files.outputs.pr_required == 'true' env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | From 676e0b0ffb9adf5a7a13544be7d1a601f602ec50 Mon Sep 17 00:00:00 2001 From: Dilip Kola Date: Tue, 10 Dec 2024 14:05:21 +0530 Subject: [PATCH 03/14] fix: tokens in constants pr workflow --- .github/workflows/raise-pr-for-constants.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/raise-pr-for-constants.yml b/.github/workflows/raise-pr-for-constants.yml index 0df7cd8bd..8b38c44ec 100644 --- a/.github/workflows/raise-pr-for-constants.yml +++ b/.github/workflows/raise-pr-for-constants.yml @@ -28,9 +28,6 @@ jobs: DEST_REPO="rudderlabs/rudder-sdk-js" git clone https://github.com/${DEST_REPO}.git dest-repo || exit 1 cd dest-repo - git config --global user.name "GitHub Actions" - git config --global user.email "noreply@github.com" - git config --global url."https://${{ secrets.GITHUB_TOKEN }}@github.com/".insteadOf "https://github.com/" git checkout ${{ env.BRANCH_NAME }} || git checkout -b ${{ env.BRANCH_NAME }} - name: Compare Destinations.ts @@ -46,17 +43,21 @@ jobs: - name: Commit and Push Changes if: steps.compare_files.outputs.pr_required == 'true' + env: + GH_TOKEN: ${{ secrets.PAT }} run: | cd dest-repo cp "../generated/Destinations.ts" "packages/analytics-js-common/src/constants/integrations/Destinations.ts" git add packages/analytics-js-common/src/constants/integrations/Destinations.ts + git config --global user.name "GitHub Actions" + git config --global user.email "noreply@github.com" git commit -m "fix: update destinations.ts" git push origin ${{ env.BRANCH_NAME }} - name: Create or Update PR if: steps.compare_files.outputs.pr_required == 'true' env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_TOKEN: ${{ secrets.PAT }} run: | cd dest-repo EXISTING_PR=$(gh pr list --head ${{ env.BRANCH_NAME }} --json number --jq ".[0].number") From 05eaf6e594d2106844797a3ff88787f7752afcc0 Mon Sep 17 00:00:00 2001 From: Dilip Kola Date: Tue, 10 Dec 2024 14:15:45 +0530 Subject: [PATCH 04/14] fix: tokens in constants pr workflow --- .github/workflows/raise-pr-for-constants.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/raise-pr-for-constants.yml b/.github/workflows/raise-pr-for-constants.yml index 8b38c44ec..d7e264637 100644 --- a/.github/workflows/raise-pr-for-constants.yml +++ b/.github/workflows/raise-pr-for-constants.yml @@ -25,8 +25,7 @@ jobs: - name: Checkout Destination Repo run: | - DEST_REPO="rudderlabs/rudder-sdk-js" - git clone https://github.com/${DEST_REPO}.git dest-repo || exit 1 + git clone https://github.com/rudderlabs/rudder-sdk-js.git dest-repo || exit 1 cd dest-repo git checkout ${{ env.BRANCH_NAME }} || git checkout -b ${{ env.BRANCH_NAME }} @@ -43,14 +42,13 @@ jobs: - name: Commit and Push Changes if: steps.compare_files.outputs.pr_required == 'true' - env: - GH_TOKEN: ${{ secrets.PAT }} run: | cd dest-repo cp "../generated/Destinations.ts" "packages/analytics-js-common/src/constants/integrations/Destinations.ts" git add packages/analytics-js-common/src/constants/integrations/Destinations.ts git config --global user.name "GitHub Actions" git config --global user.email "noreply@github.com" + git config --global url."https://${{ secrets.PAT }}@github.com/".insteadOf "https://github.com/" git commit -m "fix: update destinations.ts" git push origin ${{ env.BRANCH_NAME }} From 133681ab820690d07c3c3364d573557215ea5fe9 Mon Sep 17 00:00:00 2001 From: Dilip Kola Date: Tue, 10 Dec 2024 14:30:11 +0530 Subject: [PATCH 05/14] fix: pr body in constants pr workflow --- .github/workflows/raise-pr-for-constants.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/raise-pr-for-constants.yml b/.github/workflows/raise-pr-for-constants.yml index d7e264637..47691c630 100644 --- a/.github/workflows/raise-pr-for-constants.yml +++ b/.github/workflows/raise-pr-for-constants.yml @@ -62,12 +62,15 @@ jobs: if [ -z "$EXISTING_PR" ]; then gh pr create \ --title "fix: update destination constants" \ - --body "This PR updates the destination constants file. + --body "$(cat < Date: Tue, 10 Dec 2024 14:39:19 +0530 Subject: [PATCH 06/14] fix: pr body in constants pr workflow --- .github/workflows/raise-pr-for-constants.yml | 27 ++++++++++---------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/.github/workflows/raise-pr-for-constants.yml b/.github/workflows/raise-pr-for-constants.yml index 47691c630..ef5fd004c 100644 --- a/.github/workflows/raise-pr-for-constants.yml +++ b/.github/workflows/raise-pr-for-constants.yml @@ -33,10 +33,10 @@ jobs: id: compare_files run: | if cmp -s "${{ env.SRC_FILE }}" "dest-repo/${{ env.DEST_PATH }}"; then - echo "No changes detected." > "result.txt" + echo "No changes detected." echo "pr_required=false" >> $GITHUB_OUTPUT else - echo "Changes detected." > "result.txt" + echo "Changes detected." echo "pr_required=true" >> $GITHUB_OUTPUT fi @@ -58,20 +58,21 @@ jobs: GH_TOKEN: ${{ secrets.PAT }} run: | cd dest-repo - EXISTING_PR=$(gh pr list --head ${{ env.BRANCH_NAME }} --json number --jq ".[0].number") + EXISTING_PR=$(gh pr list --head "$BRANCH_NAME" --json number --jq ".[0].number") if [ -z "$EXISTING_PR" ]; then - gh pr create \ - --title "fix: update destination constants" \ - --body "$(cat < Date: Tue, 10 Dec 2024 09:09:31 +0000 Subject: [PATCH 07/14] chore(release): 1.99.0 --- CHANGELOG.md | 19 +++++++++++++++++++ package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2625c7a41..ade56fbed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,25 @@ 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.99.0](https://github.com/rudderlabs/rudder-config-schema/compare/v1.98.2...v1.99.0) (2024-12-10) + + +### Features + +* add iubenda to a subset of destinations ([#1795](https://github.com/rudderlabs/rudder-config-schema/issues/1795)) ([65b6f16](https://github.com/rudderlabs/rudder-config-schema/commit/65b6f16bc5de853c0dca0b6fe031f3e323b3ba73)) +* add iubenda to shopify source in tiktok ads dest ([#1824](https://github.com/rudderlabs/rudder-config-schema/issues/1824)) ([0d681b1](https://github.com/rudderlabs/rudder-config-schema/commit/0d681b10bd46b1bdb84d42b48b06f1d01daad785)) +* generate destination constants ([#1800](https://github.com/rudderlabs/rudder-config-schema/issues/1800)) ([5f58915](https://github.com/rudderlabs/rudder-config-schema/commit/5f589157b7c947ae7fd4ae46fe908588f8c67abf)) +* update mapping component regex for HTTP destination ([#1820](https://github.com/rudderlabs/rudder-config-schema/issues/1820)) ([54c5b17](https://github.com/rudderlabs/rudder-config-schema/commit/54c5b17e87eccbf77dc911ed1449f272917f3084)) + + +### Bug Fixes + +* constants pr workflow to keep all steps under the same job ([#1834](https://github.com/rudderlabs/rudder-config-schema/issues/1834)) ([e57aa07](https://github.com/rudderlabs/rudder-config-schema/commit/e57aa07e578f4017d06465baf82bca580233f8aa)) +* **http:** updated property mapping regex ([#1830](https://github.com/rudderlabs/rudder-config-schema/issues/1830)) ([186f04a](https://github.com/rudderlabs/rudder-config-schema/commit/186f04a63533a4240998e7eb26afd3a8b610e629)) +* pr body in constants pr workflow ([133681a](https://github.com/rudderlabs/rudder-config-schema/commit/133681ab820690d07c3c3364d573557215ea5fe9)) +* tokens in constants pr workflow ([05eaf6e](https://github.com/rudderlabs/rudder-config-schema/commit/05eaf6e594d2106844797a3ff88787f7752afcc0)) +* tokens in constants pr workflow ([676e0b0](https://github.com/rudderlabs/rudder-config-schema/commit/676e0b0ffb9adf5a7a13544be7d1a601f602ec50)) + ### [1.98.2](https://github.com/rudderlabs/rudder-config-schema/compare/v1.98.1...v1.98.2) (2024-12-04) diff --git a/package-lock.json b/package-lock.json index 61d5d0ac4..4c119bead 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "rudder-config-schema", - "version": "1.98.2", + "version": "1.99.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "rudder-config-schema", - "version": "1.98.2", + "version": "1.99.0", "license": "MIT", "dependencies": { "ajv": "^8.12.0", diff --git a/package.json b/package.json index 74998fd8f..a2692ac4e 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rudder-config-schema", - "version": "1.98.2", + "version": "1.99.0", "description": "", "main": "src/index.ts", "private": true, From 83d7b2674f2b4bc209331d1dcd2b3c3bacafb4ab Mon Sep 17 00:00:00 2001 From: Dilip Kola Date: Tue, 10 Dec 2024 14:45:40 +0530 Subject: [PATCH 08/14] fix: pr body in constants pr workflow --- .github/workflows/raise-pr-for-constants.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/raise-pr-for-constants.yml b/.github/workflows/raise-pr-for-constants.yml index ef5fd004c..87ad99b84 100644 --- a/.github/workflows/raise-pr-for-constants.yml +++ b/.github/workflows/raise-pr-for-constants.yml @@ -66,7 +66,7 @@ jobs: **Changes:** - Updated \`Destinations.ts\` with latest constants - NOTE: This PR was automatically generated by GitHub Actions." + **NOTE:** This PR was automatically generated by GitHub Actions." # Create a new PR gh pr create \ From e8c5167cad5f9792e2621ddc7695fe85b7aa8fb4 Mon Sep 17 00:00:00 2001 From: Dilip Kola Date: Tue, 10 Dec 2024 15:05:46 +0530 Subject: [PATCH 09/14] fix: pr labels in constants pr workflow --- .github/workflows/raise-pr-for-constants.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/raise-pr-for-constants.yml b/.github/workflows/raise-pr-for-constants.yml index 87ad99b84..b559d8d8c 100644 --- a/.github/workflows/raise-pr-for-constants.yml +++ b/.github/workflows/raise-pr-for-constants.yml @@ -72,7 +72,7 @@ jobs: gh pr create \ --title "fix: update destination constants" \ --body "$PR_BODY" \ - --label "automated,dependencies" + --label "github_actions,dependencies" else echo "PR already exists: $EXISTING_PR" fi From 5fc592f4d52697737f6716a93e5b6372d3211e98 Mon Sep 17 00:00:00 2001 From: Sandeep Digumarty Date: Thu, 12 Dec 2024 12:34:14 +0530 Subject: [PATCH 10/14] fix(http): update the default for propertiesMapping (#1838) --- src/configurations/destinations/http/schema.json | 8 ++++---- src/configurations/destinations/http/ui-config.json | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/configurations/destinations/http/schema.json b/src/configurations/destinations/http/schema.json index b383def51..706b28362 100644 --- a/src/configurations/destinations/http/schema.json +++ b/src/configurations/destinations/http/schema.json @@ -34,11 +34,11 @@ "properties": { "to": { "type": "string", - "pattern": "^\\$(\\.(\\w+|\\*)|\\[\\d+\\]|\\[('\\w+'|\"\\w+\")\\]|\\[\\*\\]|\\.\\w+\\(\\))*$" + "pattern": "^\\$(?:\\.|(\\.(\\w+|\\*)|\\[\\d+\\]|\\[('\\w+'|\"\\w+\")\\]|\\[\\*\\]|\\.\\w+\\(\\))*)$" }, "from": { "type": "string", - "pattern": "^\\$(\\.(\\w+|\\*)|\\[\\d+\\]|\\[('\\w+'|\"\\w+\")\\]|\\[\\*\\]|\\.\\w+\\(\\))*$|^(?!\\\\$)[A-Za-z0-9!#$%&'*+.^_`|~-]{1,100}$" + "pattern": "^\\$(?:\\.|(\\.(\\w+|\\*)|\\[\\d+\\]|\\[('\\w+'|\"\\w+\")\\]|\\[\\*\\]|\\.\\w+\\(\\))*)$|^(?!\\\\$)[A-Za-z0-9!#$%&'*+.^_`|~-]{1,100}$" } } } @@ -54,7 +54,7 @@ }, "from": { "type": "string", - "pattern": "^\\$(\\.(\\w+|\\*)|\\[\\d+\\]|\\[('\\w+'|\"\\w+\")\\]|\\[\\*\\]|\\.\\w+\\(\\))*$|^(?!\\\\$)[A-Za-z0-9!#$%&'*+.^_`|~-]{1,100}$" + "pattern": "^\\$(?:\\.|(\\.(\\w+|\\*)|\\[\\d+\\]|\\[('\\w+'|\"\\w+\")\\]|\\[\\*\\]|\\.\\w+\\(\\))*)$|^(?!\\\\$)[A-Za-z0-9!#$%&'*+.^_`|~-]{1,100}$" } } } @@ -70,7 +70,7 @@ }, "from": { "type": "string", - "pattern": "^\\$(\\.(\\w+|\\*)|\\[\\d+\\]|\\[('\\w+'|\"\\w+\")\\]|\\[\\*\\]|\\.\\w+\\(\\))*$|^(?!\\\\$)[A-Za-z0-9!#$%&'*+.^_`|~-]{1,100}$" + "pattern": "^\\$(?:\\.|(\\.(\\w+|\\*)|\\[\\d+\\]|\\[('\\w+'|\"\\w+\")\\]|\\[\\*\\]|\\.\\w+\\(\\))*)$|^(?!\\\\$)[A-Za-z0-9!#$%&'*+.^_`|~-]{1,100}$" } } } diff --git a/src/configurations/destinations/http/ui-config.json b/src/configurations/destinations/http/ui-config.json index 84656d740..8148ce3b0 100644 --- a/src/configurations/destinations/http/ui-config.json +++ b/src/configurations/destinations/http/ui-config.json @@ -464,8 +464,8 @@ "configKey": "propertiesMapping", "default": [ { - "from": "$.", - "to": "$." + "from": "$", + "to": "$" } ], "columns": [ @@ -473,7 +473,7 @@ "type": "textInput", "key": "to", "label": "Key", - "regex": "^\\$(\\.(\\w+|\\*)|\\[\\d+\\]|\\[('\\w+'|\"\\w+\")\\]|\\[\\*\\]|\\.\\w+\\(\\))*$", + "regex": "^\\$(?:\\.|(\\.(\\w+|\\*)|\\[\\d+\\]|\\[('\\w+'|\"\\w+\")\\]|\\[\\*\\]|\\.\\w+\\(\\))*)$", "regexErrorMessage": "Please enter a valid JSON path", "placeholder": "e.g: $.events.key2" }, @@ -481,7 +481,7 @@ "type": "textInput", "key": "from", "label": "Value", - "regex": "^\\$(\\.(\\w+|\\*)|\\[\\d+\\]|\\[('\\w+'|\"\\w+\")\\]|\\[\\*\\]|\\.\\w+\\(\\))*$|^(?!\\\\$)[A-Za-z0-9!#$%&'*+.^_`|~-]{1,100}$", + "regex": "^\\$(?:\\.|(\\.(\\w+|\\*)|\\[\\d+\\]|\\[('\\w+'|\"\\w+\")\\]|\\[\\*\\]|\\.\\w+\\(\\))*)$|^(?!\\\\$)[A-Za-z0-9!#$%&'*+.^_`|~-]{1,100}$", "regexErrorMessage": "Please enter a valid JSON path or a constant", "placeholder": "e.g: $.properties.key1" } @@ -511,7 +511,7 @@ "type": "textInput", "key": "from", "label": "Value", - "regex": "^\\$(\\.(\\w+|\\*)|\\[\\d+\\]|\\[('\\w+'|\"\\w+\")\\]|\\[\\*\\]|\\.\\w+\\(\\))*$|^(?!\\\\$)[A-Za-z0-9!#$%&'*+.^_`|~-]{1,100}$", + "regex": "^\\$(?:\\.|(\\.(\\w+|\\*)|\\[\\d+\\]|\\[('\\w+'|\"\\w+\")\\]|\\[\\*\\]|\\.\\w+\\(\\))*)$|^(?!\\\\$)[A-Za-z0-9!#$%&'*+.^_`|~-]{1,100}$", "regexErrorMessage": "Please enter a valid JSON path or a constant", "placeholder": "e.g: $.userId or userId" } @@ -541,7 +541,7 @@ "type": "textInput", "key": "from", "label": "Value", - "regex": "^\\$(\\.(\\w+|\\*)|\\[\\d+\\]|\\[('\\w+'|\"\\w+\")\\]|\\[\\*\\]|\\.\\w+\\(\\))*$|^(?!\\\\$)[A-Za-z0-9!#$%&'*+.^_`|~-]{1,100}$", + "regex": "^\\$(?:\\.|(\\.(\\w+|\\*)|\\[\\d+\\]|\\[('\\w+'|\"\\w+\")\\]|\\[\\*\\]|\\.\\w+\\(\\))*)$|^(?!\\\\$)[A-Za-z0-9!#$%&'*+.^_`|~-]{1,100}$", "regexErrorMessage": "Please enter a valid JSON path or a constant", "placeholder": "e.g. application/json" } From b9f0481089d873fcd486f15631dcf9f625f109c2 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Thu, 12 Dec 2024 07:05:20 +0000 Subject: [PATCH 11/14] chore(release): 1.99.1 --- CHANGELOG.md | 7 +++++++ package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ade56fbed..7818ad799 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ 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.99.1](https://github.com/rudderlabs/rudder-config-schema/compare/v1.99.0...v1.99.1) (2024-12-12) + + +### Bug Fixes + +* **http:** update the default for propertiesMapping ([#1838](https://github.com/rudderlabs/rudder-config-schema/issues/1838)) ([5fc592f](https://github.com/rudderlabs/rudder-config-schema/commit/5fc592f4d52697737f6716a93e5b6372d3211e98)) + ## [1.99.0](https://github.com/rudderlabs/rudder-config-schema/compare/v1.98.2...v1.99.0) (2024-12-10) diff --git a/package-lock.json b/package-lock.json index 4c119bead..471aed4ef 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "rudder-config-schema", - "version": "1.99.0", + "version": "1.99.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "rudder-config-schema", - "version": "1.99.0", + "version": "1.99.1", "license": "MIT", "dependencies": { "ajv": "^8.12.0", diff --git a/package.json b/package.json index a2692ac4e..9b18ff8b6 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rudder-config-schema", - "version": "1.99.0", + "version": "1.99.1", "description": "", "main": "src/index.ts", "private": true, From 52f9bf2015e07c9466f59edbc0311cb22841d3ea Mon Sep 17 00:00:00 2001 From: Dilip Kola <33080863+koladilip@users.noreply.github.com> Date: Thu, 12 Dec 2024 17:35:42 +0530 Subject: [PATCH 12/14] chore: add item name to script to update single destination (#1837) --- scripts/deployToDB.py | 116 +++++++++++++------------- scripts/listJsonMapperDestinations.js | 48 +++++++++++ 2 files changed, 107 insertions(+), 57 deletions(-) create mode 100644 scripts/listJsonMapperDestinations.js diff --git a/scripts/deployToDB.py b/scripts/deployToDB.py index c04cf3f40..b2f1f37bb 100644 --- a/scripts/deployToDB.py +++ b/scripts/deployToDB.py @@ -8,41 +8,67 @@ from constants import CONFIG_DIR +ALL_SELECTORS = ["destination", "source", "wht-lib-project"] + + def get_command_line_arguments(): parser = argparse.ArgumentParser(description="Script to deploy config files to DB.") parser.add_argument("control_plane_url", nargs="?", help="Control plane URL") parser.add_argument("username", nargs="?", help="Control plane admin username") parser.add_argument("password", nargs="?", help="Control plane admin password") + parser.add_argument( + "selector", + nargs="?", + help="Specify destination, source or wht-lib-project", + default=None, + ) + parser.add_argument( + "item_name", nargs="?", help="Specific item name to update.", default=None + ) args = parser.parse_args() control_plane_url = args.control_plane_url or os.getenv("CONTROL_PLANE_URL") username = args.username or os.getenv("API_USER") password = args.password or os.getenv("API_PASSWORD") + selector = args.selector or os.getenv("SELECTOR") + item_name = args.item_name or os.getenv("ITEM_NAME") - missing_args = [] + invalid_args = [] if control_plane_url is None: - missing_args.append( - "1st positional argument or CONTROL_PLANE_URL environment variable" + invalid_args.append( + "1st positional argument or CONTROL_PLANE_URL environment variable is missing" ) if username is None: - missing_args.append("2nd positional argument or API_USER environment variable") + invalid_args.append( + "2nd positional argument or API_USER environment variable is missing" + ) if password is None: - missing_args.append( - "3rd positional argument or API_PASSWORD environment variable" + invalid_args.append( + "3rd positional argument or API_PASSWORD environment variable is missing" ) + if selector is None: + SELECTORS = ALL_SELECTORS + elif selector not in ALL_SELECTORS: + invalid_args.append( + "4th positional argument or SELECTOR environment variable is invalid" + ) + else: + SELECTORS = [selector] - if missing_args: - print("Error: Missing the following arguments or environment variables:") - for arg in missing_args: + if invalid_args: + print("Error: The following arguments or environment variables are invalid:") + for arg in invalid_args: print(arg) sys.exit(1) - return control_plane_url, username, password + return control_plane_url, username, password, SELECTORS, item_name -CONTROL_PLANE_URL, USERNAME, PASSWORD = get_command_line_arguments() +CONTROL_PLANE_URL, USERNAME, PASSWORD, SELECTORS, ITEM_NAME = ( + get_command_line_arguments() +) # CONSTANTS HEADER = {"Content-Type": "application/json"} @@ -139,11 +165,16 @@ def update_config(data_diff, selector): return json.dumps(results, indent=2) -def update_diff_db(selector): +def update_diff_db(selector, item_name=None): final_report = [] ## data sets - current_items = os.listdir(f"./{CONFIG_DIR}/{selector}s") + if item_name: + current_items = [item_name] + else: + current_items = os.listdir(f"./{CONFIG_DIR}/{selector}s") + + print(f"Current items: {current_items}") for item in current_items: # check if item is a directory @@ -203,47 +234,18 @@ def get_stale_data(selector, report): if __name__ == "__main__": - print("\n") - print("#" * 50) - print("Running Destination Definitions Updates") - dest_final_report = update_diff_db("destination") - - print("\n") - print("#" * 50) - print("Destination Definition Update Report") - print(get_formatted_json(dest_final_report)) - - print("\n") - print("#" * 50) - print("Stale Destinations Report") - print(get_formatted_json(get_stale_data("destination", dest_final_report))) - - print("\n") - print("#" * 50) - print("Running Source Definitions Updates") - src_final_report = update_diff_db("source") - - print("\n") - print("#" * 50) - print("Source Definition Update Report") - print(get_formatted_json(src_final_report)) - - print("\n") - print("#" * 50) - print("Stale Sources Report") - print(get_formatted_json(get_stale_data("source", src_final_report))) - - print("\n") - print("#" * 50) - print("Running Wht Lib Project Definitions Updates") - wht_final_report = update_diff_db("wht-lib-project") - - print("\n") - print("#" * 50) - print("Wht Lib Project Definition Update Report") - print(get_formatted_json(wht_final_report)) - - print("\n") - print("#" * 50) - print("Stale Wht Lib Projects Report") - print(get_formatted_json(get_stale_data("wht-lib-project", wht_final_report))) + for selector in SELECTORS: + print("\n") + print("#" * 50) + print("Running {} Definitions Updates".format(selector.capitalize())) + final_report = update_diff_db(selector, ITEM_NAME) + + print("\n") + print("#" * 50) + print("{} Definition Update Report".format(selector.capitalize())) + print(get_formatted_json(final_report)) + + print("\n") + print("#" * 50) + print("Stale {}s Report".format(selector.capitalize())) + print(get_formatted_json(get_stale_data(selector, final_report))) diff --git a/scripts/listJsonMapperDestinations.js b/scripts/listJsonMapperDestinations.js new file mode 100644 index 000000000..3520fc088 --- /dev/null +++ b/scripts/listJsonMapperDestinations.js @@ -0,0 +1,48 @@ +/* eslint-disable no-console */ +const fs = require('fs'); +const path = require('path'); + +const destinationsDir = path.join(__dirname, '../src/configurations/destinations'); + +function findJsonMapperDestinations() { + try { + if (!fs.existsSync(destinationsDir)) { + throw new Error(`Destinations directory not found: ${destinationsDir}`); + } + return fs + .readdirSync(destinationsDir) + .map((destination) => { + try { + const destinationsFilePath = path.join(destinationsDir, destination, 'db-config.json'); + if (!fs.existsSync(destinationsFilePath)) { + console.warn(`Skipping ${destination}: Missing configuration file`); + return null; + } + const destinationsContent = fs.readFileSync(destinationsFilePath, 'utf8'); + const destinationDefinition = JSON.parse(destinationsContent); + if (!destinationDefinition.name) { + console.warn(`Skipping ${destination}: Missing name`); + return null; + } + return { + name: destinationDefinition.name, + config: destinationDefinition.config, + }; + } catch (err) { + console.error(`Error processing ${destination}:`, err.message); + return null; + } + }) + .filter(Boolean) + .filter( + (destination) => + !destination.config?.disableJsonMapper && !destination.config?.supportsVisualMapper, + ) + .map((destination) => destination.name); + } catch (err) { + console.error('Failed to process destinations:', err.message); + return []; + } +} + +console.log(findJsonMapperDestinations().join('\n')); From 1f4e1c5edb6fb95be21e62d5671427a91a371a50 Mon Sep 17 00:00:00 2001 From: Sai Kumar Battinoju <88789928+saikumarrs@users.noreply.github.com> Date: Thu, 12 Dec 2024 17:50:40 +0530 Subject: [PATCH 13/14] feat: add tags for sdk source types (#1841) --- src/configurations/sources/amp/db-config.json | 5 ++++- src/configurations/sources/android/db-config.json | 5 ++++- src/configurations/sources/cordova/db-config.json | 5 ++++- src/configurations/sources/dotnet/db-config.json | 5 ++++- src/configurations/sources/flutter/db-config.json | 5 ++++- src/configurations/sources/go/db-config.json | 5 ++++- src/configurations/sources/ios/db-config.json | 5 ++++- src/configurations/sources/java/db-config.json | 5 ++++- src/configurations/sources/javascript/db-config.json | 5 ++++- src/configurations/sources/node/db-config.json | 5 ++++- src/configurations/sources/php/db-config.json | 5 ++++- src/configurations/sources/python/db-config.json | 5 ++++- src/configurations/sources/react_native/db-config.json | 5 ++++- src/configurations/sources/ruby/db-config.json | 5 ++++- src/configurations/sources/rust/db-config.json | 5 ++++- src/configurations/sources/unity/db-config.json | 5 ++++- src/schemas/sources/db-config-schema.json | 6 ++++++ 17 files changed, 70 insertions(+), 16 deletions(-) diff --git a/src/configurations/sources/amp/db-config.json b/src/configurations/sources/amp/db-config.json index f27a7d0cf..d98b0b85c 100644 --- a/src/configurations/sources/amp/db-config.json +++ b/src/configurations/sources/amp/db-config.json @@ -1,5 +1,8 @@ { "name": "AMP", "displayName": "AMP", - "type": "amp" + "type": "amp", + "options": { + "sdkExecutionEnvironment": "client" + } } diff --git a/src/configurations/sources/android/db-config.json b/src/configurations/sources/android/db-config.json index 95473faed..d9e1b8c21 100644 --- a/src/configurations/sources/android/db-config.json +++ b/src/configurations/sources/android/db-config.json @@ -1,5 +1,8 @@ { "name": "Android", "displayName": "Android", - "type": "android" + "type": "android", + "options": { + "sdkExecutionEnvironment": "client" + } } diff --git a/src/configurations/sources/cordova/db-config.json b/src/configurations/sources/cordova/db-config.json index 5ee84ca76..6cc47e2d2 100644 --- a/src/configurations/sources/cordova/db-config.json +++ b/src/configurations/sources/cordova/db-config.json @@ -1,5 +1,8 @@ { "name": "Cordova", "displayName": "Cordova", - "type": "cordova" + "type": "cordova", + "options": { + "sdkExecutionEnvironment": "client" + } } diff --git a/src/configurations/sources/dotnet/db-config.json b/src/configurations/sources/dotnet/db-config.json index dd5204182..f737ad33c 100644 --- a/src/configurations/sources/dotnet/db-config.json +++ b/src/configurations/sources/dotnet/db-config.json @@ -1,5 +1,8 @@ { "name": "DotNet", "displayName": ".Net", - "type": "cloud" + "type": "cloud", + "options": { + "sdkExecutionEnvironment": "server" + } } diff --git a/src/configurations/sources/flutter/db-config.json b/src/configurations/sources/flutter/db-config.json index d2b602e62..26856f086 100644 --- a/src/configurations/sources/flutter/db-config.json +++ b/src/configurations/sources/flutter/db-config.json @@ -1,5 +1,8 @@ { "name": "Flutter", "displayName": "Flutter", - "type": "flutter" + "type": "flutter", + "options": { + "sdkExecutionEnvironment": "client" + } } diff --git a/src/configurations/sources/go/db-config.json b/src/configurations/sources/go/db-config.json index ca4b23f3c..76e630e2d 100644 --- a/src/configurations/sources/go/db-config.json +++ b/src/configurations/sources/go/db-config.json @@ -1,5 +1,8 @@ { "name": "Go", "displayName": "Go", - "type": "cloud" + "type": "cloud", + "options": { + "sdkExecutionEnvironment": "server" + } } diff --git a/src/configurations/sources/ios/db-config.json b/src/configurations/sources/ios/db-config.json index a55f4d793..4d65dc374 100644 --- a/src/configurations/sources/ios/db-config.json +++ b/src/configurations/sources/ios/db-config.json @@ -1,5 +1,8 @@ { "name": "iOS", "displayName": "iOS", - "type": "ios" + "type": "ios", + "options": { + "sdkExecutionEnvironment": "client" + } } diff --git a/src/configurations/sources/java/db-config.json b/src/configurations/sources/java/db-config.json index 58f6b8686..506d5dc28 100644 --- a/src/configurations/sources/java/db-config.json +++ b/src/configurations/sources/java/db-config.json @@ -1,5 +1,8 @@ { "name": "Java", "displayName": "Java", - "type": "cloud" + "type": "cloud", + "options": { + "sdkExecutionEnvironment": "server" + } } diff --git a/src/configurations/sources/javascript/db-config.json b/src/configurations/sources/javascript/db-config.json index e823e2183..4f0773d72 100644 --- a/src/configurations/sources/javascript/db-config.json +++ b/src/configurations/sources/javascript/db-config.json @@ -1,5 +1,8 @@ { "name": "Javascript", "displayName": "Javascript", - "type": "web" + "type": "web", + "options": { + "sdkExecutionEnvironment": "client" + } } diff --git a/src/configurations/sources/node/db-config.json b/src/configurations/sources/node/db-config.json index c7ab6a7ff..8d897bee4 100644 --- a/src/configurations/sources/node/db-config.json +++ b/src/configurations/sources/node/db-config.json @@ -1,5 +1,8 @@ { "name": "Node", "displayName": "Node", - "type": "cloud" + "type": "cloud", + "options": { + "sdkExecutionEnvironment": "server" + } } diff --git a/src/configurations/sources/php/db-config.json b/src/configurations/sources/php/db-config.json index c34a3cdd5..149c70949 100644 --- a/src/configurations/sources/php/db-config.json +++ b/src/configurations/sources/php/db-config.json @@ -1,5 +1,8 @@ { "name": "PHP", "displayName": "PHP", - "type": "cloud" + "type": "cloud", + "options": { + "sdkExecutionEnvironment": "server" + } } diff --git a/src/configurations/sources/python/db-config.json b/src/configurations/sources/python/db-config.json index 76415d16d..e8ee2c15c 100644 --- a/src/configurations/sources/python/db-config.json +++ b/src/configurations/sources/python/db-config.json @@ -1,5 +1,8 @@ { "name": "Python", "displayName": "Python", - "type": "cloud" + "type": "cloud", + "options": { + "sdkExecutionEnvironment": "server" + } } diff --git a/src/configurations/sources/react_native/db-config.json b/src/configurations/sources/react_native/db-config.json index 37a80466e..f49efcbfa 100644 --- a/src/configurations/sources/react_native/db-config.json +++ b/src/configurations/sources/react_native/db-config.json @@ -1,5 +1,8 @@ { "name": "ReactNative", "displayName": "React Native", - "type": "reactnative" + "type": "reactnative", + "options": { + "sdkExecutionEnvironment": "client" + } } diff --git a/src/configurations/sources/ruby/db-config.json b/src/configurations/sources/ruby/db-config.json index 8b0e872f2..6da7a202d 100644 --- a/src/configurations/sources/ruby/db-config.json +++ b/src/configurations/sources/ruby/db-config.json @@ -1,5 +1,8 @@ { "name": "Ruby", "displayName": "Ruby", - "type": "cloud" + "type": "cloud", + "options": { + "sdkExecutionEnvironment": "server" + } } diff --git a/src/configurations/sources/rust/db-config.json b/src/configurations/sources/rust/db-config.json index 12e377523..aa4322a1f 100644 --- a/src/configurations/sources/rust/db-config.json +++ b/src/configurations/sources/rust/db-config.json @@ -1,5 +1,8 @@ { "name": "Rust", "displayName": "Rust", - "type": "cloud" + "type": "cloud", + "options": { + "sdkExecutionEnvironment": "server" + } } diff --git a/src/configurations/sources/unity/db-config.json b/src/configurations/sources/unity/db-config.json index ab4bf8d8e..1783a5160 100644 --- a/src/configurations/sources/unity/db-config.json +++ b/src/configurations/sources/unity/db-config.json @@ -1,5 +1,8 @@ { "name": "Unity", "displayName": "Unity", - "type": "unity" + "type": "unity", + "options": { + "sdkExecutionEnvironment": "client" + } } diff --git a/src/schemas/sources/db-config-schema.json b/src/schemas/sources/db-config-schema.json index dc1cfa381..1761b63d6 100644 --- a/src/schemas/sources/db-config-schema.json +++ b/src/schemas/sources/db-config-schema.json @@ -146,6 +146,12 @@ "type": "boolean", "title": "Supports Destination Sync Mode", "description": "TBD" + }, + "sdkExecutionEnvironment": { + "type": "string", + "title": "SDK Execution Environment", + "description": "It denotes the environment in which the SDK is executed. The presence of this field also indicates that the source is an SDK source.", + "enum": ["server", "client"] } } } From 2c683fec0ac8d8518096413c6d2b018a1e7b4d1e Mon Sep 17 00:00:00 2001 From: Aanshi Lahoti <110057617+aanshi07@users.noreply.github.com> Date: Fri, 13 Dec 2024 14:42:55 +0530 Subject: [PATCH 14/14] feat: onboard topsort destination (#1842) --- .../destinations/topsort/db-config.json | 109 +++ .../destinations/topsort/schema.json | 876 ++++++++++++++++++ .../destinations/topsort/ui-config.json | 260 ++++++ .../data/validation/destinations/topsort.json | 197 ++++ 4 files changed, 1442 insertions(+) create mode 100644 src/configurations/destinations/topsort/db-config.json create mode 100644 src/configurations/destinations/topsort/schema.json create mode 100644 src/configurations/destinations/topsort/ui-config.json create mode 100644 test/data/validation/destinations/topsort.json diff --git a/src/configurations/destinations/topsort/db-config.json b/src/configurations/destinations/topsort/db-config.json new file mode 100644 index 000000000..a332d44c6 --- /dev/null +++ b/src/configurations/destinations/topsort/db-config.json @@ -0,0 +1,109 @@ +{ + "name": "TOPSORT", + "displayName": "Topsort", + "config": { + "transformAtV1": "processor", + "saveDestinationResponse": true, + "excludeKeys": [], + "supportedSourceTypes": [ + "android", + "ios", + "unity", + "amp", + "web", + "cloud", + "warehouse", + "reactnative", + "flutter", + "cordova", + "shopify" + ], + "supportedMessageTypes": { "cloud": ["track"] }, + "supportedConnectionModes": { + "android": ["cloud"], + "ios": ["cloud"], + "web": ["cloud"], + "unity": ["cloud"], + "amp": ["cloud"], + "reactnative": ["cloud"], + "flutter": ["cloud"], + "cordova": ["cloud"], + "shopify": ["cloud"], + "cloud": ["cloud"], + "warehouse": ["cloud"] + }, + "destConfig": { + "defaultConfig": ["apiKey", "topsortEvents"], + "android": [ + "connectionMode", + "consentManagement", + "oneTrustCookieCategories", + "ketchConsentPurposes" + ], + "ios": [ + "connectionMode", + "consentManagement", + "oneTrustCookieCategories", + "ketchConsentPurposes" + ], + "unity": [ + "connectionMode", + "consentManagement", + "oneTrustCookieCategories", + "ketchConsentPurposes" + ], + "amp": [ + "connectionMode", + "consentManagement", + "oneTrustCookieCategories", + "ketchConsentPurposes" + ], + "reactnative": [ + "connectionMode", + "consentManagement", + "oneTrustCookieCategories", + "ketchConsentPurposes" + ], + "flutter": [ + "connectionMode", + "consentManagement", + "oneTrustCookieCategories", + "ketchConsentPurposes" + ], + "cordova": [ + "connectionMode", + "consentManagement", + "oneTrustCookieCategories", + "ketchConsentPurposes" + ], + "web": [ + "connectionMode", + "consentManagement", + "oneTrustCookieCategories", + "ketchConsentPurposes" + ], + "cloud": [ + "connectionMode", + "consentManagement", + "oneTrustCookieCategories", + "ketchConsentPurposes" + ], + "shopify": [ + "connectionMode", + "consentManagement", + "oneTrustCookieCategories", + "ketchConsentPurposes" + ], + "warehouse": [ + "connectionMode", + "consentManagement", + "oneTrustCookieCategories", + "ketchConsentPurposes" + ] + }, + "secretKeys": ["apiKey"] + }, + "options": { + "isBeta": true + } +} diff --git a/src/configurations/destinations/topsort/schema.json b/src/configurations/destinations/topsort/schema.json new file mode 100644 index 000000000..be1f7159f --- /dev/null +++ b/src/configurations/destinations/topsort/schema.json @@ -0,0 +1,876 @@ +{ + "configSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "required": ["apiKey"], + "type": "object", + "properties": { + "apiKey": { + "type": "string", + "pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{1,100})$" + }, + "topsortEvents": { + "type": "array", + "items": { + "type": "object", + "properties": { + "from": { + "type": "string", + "enum": [ + "Product Clicked", + "Product Viewed", + "Product Added", + "Product Removed", + "Cart Viewed", + "Checkout Started", + "Checkout Step Viewed", + "Payment Info Entered", + "Order Updated", + "Order Completed", + "Order Refunded", + "Order Cancelled" + ] + }, + "to": { + "type": "string", + "enum": ["clicks", "impressions", "purchases"] + } + } + } + }, + "oneTrustCookieCategories": { + "type": "object", + "properties": { + "android": { + "type": "array", + "items": { + "type": "object", + "properties": { + "oneTrustCookieCategory": { + "type": "string", + "pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$" + } + } + } + }, + "ios": { + "type": "array", + "items": { + "type": "object", + "properties": { + "oneTrustCookieCategory": { + "type": "string", + "pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$" + } + } + } + }, + "unity": { + "type": "array", + "items": { + "type": "object", + "properties": { + "oneTrustCookieCategory": { + "type": "string", + "pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$" + } + } + } + }, + "amp": { + "type": "array", + "items": { + "type": "object", + "properties": { + "oneTrustCookieCategory": { + "type": "string", + "pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$" + } + } + } + }, + "reactnative": { + "type": "array", + "items": { + "type": "object", + "properties": { + "oneTrustCookieCategory": { + "type": "string", + "pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$" + } + } + } + }, + "flutter": { + "type": "array", + "items": { + "type": "object", + "properties": { + "oneTrustCookieCategory": { + "type": "string", + "pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$" + } + } + } + }, + "cordova": { + "type": "array", + "items": { + "type": "object", + "properties": { + "oneTrustCookieCategory": { + "type": "string", + "pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$" + } + } + } + }, + "web": { + "type": "array", + "items": { + "type": "object", + "properties": { + "oneTrustCookieCategory": { + "type": "string", + "pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$" + } + } + } + }, + "cloud": { + "type": "array", + "items": { + "type": "object", + "properties": { + "oneTrustCookieCategory": { + "type": "string", + "pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$" + } + } + } + }, + "shopify": { + "type": "array", + "items": { + "type": "object", + "properties": { + "oneTrustCookieCategory": { + "type": "string", + "pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$" + } + } + } + }, + "warehouse": { + "type": "array", + "items": { + "type": "object", + "properties": { + "oneTrustCookieCategory": { + "type": "string", + "pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$" + } + } + } + } + } + }, + "consentManagement": { + "type": "object", + "properties": { + "cloud": { + "type": "array", + "items": { + "type": "object", + "properties": { + "provider": { + "type": "string", + "enum": ["custom", "ketch", "oneTrust"], + "default": "oneTrust" + }, + "consents": { + "type": "array", + "items": { + "type": "object", + "properties": { + "consent": { + "type": "string", + "pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$" + } + } + } + } + }, + "allOf": [ + { + "if": { + "properties": { + "provider": { + "const": "custom" + } + }, + "required": ["provider"] + }, + "then": { + "properties": { + "resolutionStrategy": { + "type": "string", + "enum": ["and", "or"] + } + }, + "required": ["resolutionStrategy"] + } + } + ] + } + }, + "warehouse": { + "type": "array", + "items": { + "type": "object", + "properties": { + "provider": { + "type": "string", + "enum": ["custom", "ketch", "oneTrust"], + "default": "oneTrust" + }, + "consents": { + "type": "array", + "items": { + "type": "object", + "properties": { + "consent": { + "type": "string", + "pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$" + } + } + } + } + }, + "allOf": [ + { + "if": { + "properties": { + "provider": { + "const": "custom" + } + }, + "required": ["provider"] + }, + "then": { + "properties": { + "resolutionStrategy": { + "type": "string", + "enum": ["and", "or"] + } + }, + "required": ["resolutionStrategy"] + } + } + ] + } + }, + "android": { + "type": "array", + "items": { + "type": "object", + "properties": { + "provider": { + "type": "string", + "enum": ["custom", "ketch", "oneTrust"], + "default": "oneTrust" + }, + "consents": { + "type": "array", + "items": { + "type": "object", + "properties": { + "consent": { + "type": "string", + "pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$" + } + } + } + } + }, + "allOf": [ + { + "if": { + "properties": { + "provider": { + "const": "custom" + } + }, + "required": ["provider"] + }, + "then": { + "properties": { + "resolutionStrategy": { + "type": "string", + "enum": ["and", "or"] + } + }, + "required": ["resolutionStrategy"] + } + } + ] + } + }, + "ios": { + "type": "array", + "items": { + "type": "object", + "properties": { + "provider": { + "type": "string", + "enum": ["custom", "ketch", "oneTrust"], + "default": "oneTrust" + }, + "consents": { + "type": "array", + "items": { + "type": "object", + "properties": { + "consent": { + "type": "string", + "pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$" + } + } + } + } + }, + "allOf": [ + { + "if": { + "properties": { + "provider": { + "const": "custom" + } + }, + "required": ["provider"] + }, + "then": { + "properties": { + "resolutionStrategy": { + "type": "string", + "enum": ["and", "or"] + } + }, + "required": ["resolutionStrategy"] + } + } + ] + } + }, + "web": { + "type": "array", + "items": { + "type": "object", + "properties": { + "provider": { + "type": "string", + "enum": ["custom", "ketch", "oneTrust"], + "default": "oneTrust" + }, + "consents": { + "type": "array", + "items": { + "type": "object", + "properties": { + "consent": { + "type": "string", + "pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$" + } + } + } + } + }, + "allOf": [ + { + "if": { + "properties": { + "provider": { + "const": "custom" + } + }, + "required": ["provider"] + }, + "then": { + "properties": { + "resolutionStrategy": { + "type": "string", + "enum": ["and", "or"] + } + }, + "required": ["resolutionStrategy"] + } + } + ] + } + }, + "unity": { + "type": "array", + "items": { + "type": "object", + "properties": { + "provider": { + "type": "string", + "enum": ["custom", "ketch", "oneTrust"], + "default": "oneTrust" + }, + "consents": { + "type": "array", + "items": { + "type": "object", + "properties": { + "consent": { + "type": "string", + "pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$" + } + } + } + } + }, + "allOf": [ + { + "if": { + "properties": { + "provider": { + "const": "custom" + } + }, + "required": ["provider"] + }, + "then": { + "properties": { + "resolutionStrategy": { + "type": "string", + "enum": ["and", "or"] + } + }, + "required": ["resolutionStrategy"] + } + } + ] + } + }, + "amp": { + "type": "array", + "items": { + "type": "object", + "properties": { + "provider": { + "type": "string", + "enum": ["custom", "ketch", "oneTrust"], + "default": "oneTrust" + }, + "consents": { + "type": "array", + "items": { + "type": "object", + "properties": { + "consent": { + "type": "string", + "pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$" + } + } + } + } + }, + "allOf": [ + { + "if": { + "properties": { + "provider": { + "const": "custom" + } + }, + "required": ["provider"] + }, + "then": { + "properties": { + "resolutionStrategy": { + "type": "string", + "enum": ["and", "or"] + } + }, + "required": ["resolutionStrategy"] + } + } + ] + } + }, + "reactnative": { + "type": "array", + "items": { + "type": "object", + "properties": { + "provider": { + "type": "string", + "enum": ["custom", "ketch", "oneTrust"], + "default": "oneTrust" + }, + "consents": { + "type": "array", + "items": { + "type": "object", + "properties": { + "consent": { + "type": "string", + "pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$" + } + } + } + } + }, + "allOf": [ + { + "if": { + "properties": { + "provider": { + "const": "custom" + } + }, + "required": ["provider"] + }, + "then": { + "properties": { + "resolutionStrategy": { + "type": "string", + "enum": ["and", "or"] + } + }, + "required": ["resolutionStrategy"] + } + } + ] + } + }, + "flutter": { + "type": "array", + "items": { + "type": "object", + "properties": { + "provider": { + "type": "string", + "enum": ["custom", "ketch", "oneTrust"], + "default": "oneTrust" + }, + "consents": { + "type": "array", + "items": { + "type": "object", + "properties": { + "consent": { + "type": "string", + "pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$" + } + } + } + } + }, + "allOf": [ + { + "if": { + "properties": { + "provider": { + "const": "custom" + } + }, + "required": ["provider"] + }, + "then": { + "properties": { + "resolutionStrategy": { + "type": "string", + "enum": ["and", "or"] + } + }, + "required": ["resolutionStrategy"] + } + } + ] + } + }, + "cordova": { + "type": "array", + "items": { + "type": "object", + "properties": { + "provider": { + "type": "string", + "enum": ["custom", "ketch", "oneTrust"], + "default": "oneTrust" + }, + "consents": { + "type": "array", + "items": { + "type": "object", + "properties": { + "consent": { + "type": "string", + "pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$" + } + } + } + } + }, + "allOf": [ + { + "if": { + "properties": { + "provider": { + "const": "custom" + } + }, + "required": ["provider"] + }, + "then": { + "properties": { + "resolutionStrategy": { + "type": "string", + "enum": ["and", "or"] + } + }, + "required": ["resolutionStrategy"] + } + } + ] + } + }, + "shopify": { + "type": "array", + "items": { + "type": "object", + "properties": { + "provider": { + "type": "string", + "enum": ["custom", "ketch", "oneTrust"], + "default": "oneTrust" + }, + "consents": { + "type": "array", + "items": { + "type": "object", + "properties": { + "consent": { + "type": "string", + "pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$" + } + } + } + } + }, + "allOf": [ + { + "if": { + "properties": { + "provider": { + "const": "custom" + } + }, + "required": ["provider"] + }, + "then": { + "properties": { + "resolutionStrategy": { + "type": "string", + "enum": ["and", "or"] + } + }, + "required": ["resolutionStrategy"] + } + } + ] + } + } + } + }, + "ketchConsentPurposes": { + "type": "object", + "properties": { + "android": { + "type": "array", + "items": { + "type": "object", + "properties": { + "purpose": { + "type": "string", + "pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$" + } + } + } + }, + "ios": { + "type": "array", + "items": { + "type": "object", + "properties": { + "purpose": { + "type": "string", + "pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$" + } + } + } + }, + "unity": { + "type": "array", + "items": { + "type": "object", + "properties": { + "purpose": { + "type": "string", + "pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$" + } + } + } + }, + "amp": { + "type": "array", + "items": { + "type": "object", + "properties": { + "purpose": { + "type": "string", + "pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$" + } + } + } + }, + "reactnative": { + "type": "array", + "items": { + "type": "object", + "properties": { + "purpose": { + "type": "string", + "pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$" + } + } + } + }, + "flutter": { + "type": "array", + "items": { + "type": "object", + "properties": { + "purpose": { + "type": "string", + "pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$" + } + } + } + }, + "cordova": { + "type": "array", + "items": { + "type": "object", + "properties": { + "purpose": { + "type": "string", + "pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$" + } + } + } + }, + "web": { + "type": "array", + "items": { + "type": "object", + "properties": { + "purpose": { + "type": "string", + "pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$" + } + } + } + }, + "cloud": { + "type": "array", + "items": { + "type": "object", + "properties": { + "purpose": { + "type": "string", + "pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$" + } + } + } + }, + "shopify": { + "type": "array", + "items": { + "type": "object", + "properties": { + "purpose": { + "type": "string", + "pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$" + } + } + } + }, + "warehouse": { + "type": "array", + "items": { + "type": "object", + "properties": { + "purpose": { + "type": "string", + "pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$" + } + } + } + } + } + }, + "connectionMode": { + "type": "object", + "properties": { + "android": { + "type": "string", + "enum": ["cloud"] + }, + "ios": { + "type": "string", + "enum": ["cloud"] + }, + "web": { + "type": "string", + "enum": ["cloud"] + }, + "unity": { + "type": "string", + "enum": ["cloud"] + }, + "amp": { + "type": "string", + "enum": ["cloud"] + }, + "reactnative": { + "type": "string", + "enum": ["cloud"] + }, + "flutter": { + "type": "string", + "enum": ["cloud"] + }, + "cordova": { + "type": "string", + "enum": ["cloud"] + }, + "shopify": { + "type": "string", + "enum": ["cloud"] + }, + "cloud": { + "type": "string", + "enum": ["cloud"] + }, + "warehouse": { + "type": "string", + "enum": ["cloud"] + } + } + } + } + } +} diff --git a/src/configurations/destinations/topsort/ui-config.json b/src/configurations/destinations/topsort/ui-config.json new file mode 100644 index 000000000..6a6d4573c --- /dev/null +++ b/src/configurations/destinations/topsort/ui-config.json @@ -0,0 +1,260 @@ +{ + "uiConfig": { + "baseTemplate": [ + { + "title": "Initial setup", + "note": "Review how this destination is set up", + "sections": [ + { + "groups": [ + { + "title": "Connection Settings", + "note": "Update your connection settings here", + "icon": "settings", + "fields": [ + { + "type": "textInput", + "label": "API Key", + "configKey": "apiKey", + "regex": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{1,100})$", + "regexErrorMessage": "Invalid API Key", + "placeholder": "e.g. 88a1b72e-a017-4803-9854-0c447045c29e" + } + ] + } + ] + }, + { + "groups": [ + { + "title": "Connection mode", + "note": [ + "Update how you want to route events from your source to destination. ", + { + "text": "Get help deciding", + "link": "https://www.rudderstack.com/docs/destinations/rudderstack-connection-modes/" + } + ], + "icon": "sliders", + "fields": [] + } + ] + } + ] + }, + { + "title": "Configuration settings", + "note": "Manage the settings for your destination", + "sections": [ + { + "id": "consentSettings", + "title": "Consent settings", + "note": "Configure consent settings for each provider here", + "icon": "settings", + "groups": [] + } + ] + }, + { + "title": "Event mapping", + "note": "Map RudderStack events to Topsort events", + "hideEditIcon": true, + "sections": [ + { + "groups": [ + { + "title": "RudderStack Event to Topsort Event Mapping", + "fields": [ + { + "type": "redirect", + "redirectGroupKey": "eventsMapping", + "label": "Event and property mappings", + "note": "Map RudderStack events/properties to Topsort events/properties" + } + ] + } + ] + } + ] + } + ], + "sdkTemplate": { + "title": "SDK settings", + "note": "not visible in the ui", + "fields": [] + }, + "redirectGroups": { + "eventsMapping": { + "fields": [ + { + "type": "mapping", + "label": "Map RudderStack event to Topsort event", + "configKey": "topsortEvents", + "default": [ + { + "from": "Product Clicked", + "to": "clicks" + }, + { + "from": "Product Viewed", + "to": "impressions" + }, + { + "from": "Order Completed", + "to": "purchases" + } + ], + "columns": [ + { + "type": "singleSelect", + "key": "from", + "label": "RudderStack Event", + "options": [ + { + "label": "Product Clicked", + "value": "Product Clicked" + }, + { + "label": "Product Viewed", + "value": "Product Viewed" + }, + { + "label": "Product Added", + "value": "Product Added" + }, + { + "label": "Product Removed", + "value": "Product Removed" + }, + { + "label": "Cart Viewed", + "value": "Cart Viewed" + }, + { + "label": "Checkout Started", + "value": "Checkout Started" + }, + { + "label": "Checkout Step Viewed", + "value": "Checkout Step Viewed" + }, + { + "label": "Payment Info Entered", + "value": "Payment Info Entered" + }, + { + "label": "Order Updated", + "value": "Order Updated" + }, + { + "label": "Order Completed", + "value": "Order Completed" + }, + { + "label": "Order Refunded", + "value": "Order Refunded" + }, + { + "label": "Order Cancelled", + "value": "Order Cancelled" + } + ] + }, + { + "type": "singleSelect", + "key": "to", + "label": "Topsort event", + "options": [ + { + "label": "clicks", + "value": "clicks" + }, + { + "label": "impressions", + "value": "impressions" + }, + { + "label": "purchases", + "value": "purchases" + } + ] + } + ] + } + ] + } + }, + "consentSettingsTemplate": { + "title": "Consent settings", + "note": "not visible in the ui", + "fields": [ + { + "type": "dynamicCustomForm", + "configKey": "consentManagement", + "default": [], + "rowFields": [ + { + "type": "singleSelect", + "label": "Consent management provider", + "configKey": "provider", + "options": [ + { + "label": "Custom", + "value": "custom" + }, + { + "label": "Ketch", + "value": "ketch" + }, + { + "label": "OneTrust", + "value": "oneTrust" + } + ], + "default": "oneTrust", + "required": true + }, + { + "type": "singleSelect", + "label": "the required consent logic", + "configKey": "resolutionStrategy", + "options": [ + { + "label": "AND", + "value": "and" + }, + { + "label": "OR", + "value": "or" + } + ], + "required": true, + "variant": "badge", + "preRequisites": { + "fields": [ + { + "configKey": "provider", + "value": "custom" + } + ] + } + }, + { + "type": "tagInput", + "label": "Enter consent category IDs", + "note": "Input your consent category IDs by pressing 'Enter' after each entry. We recommend using IDs instead of names as IDs are unique and less likely to change over time, making them a more reliable choice.", + "configKey": "consents", + "tagKey": "consent", + "placeholder": "e.g: Marketing", + "default": [ + { + "consent": "" + } + ] + } + ] + } + ] + } + } +} diff --git a/test/data/validation/destinations/topsort.json b/test/data/validation/destinations/topsort.json new file mode 100644 index 000000000..a07f0132a --- /dev/null +++ b/test/data/validation/destinations/topsort.json @@ -0,0 +1,197 @@ +[ + { + "testTitle": "With all valid events and details", + "config": { + "apiKey": "test-api", + "topsortEvents": [ + { + "to": "clicks", + "from": "Product Clicked" + }, + { + "to": "impressions", + "from": "Product Viewed" + }, + { + "to": "purchases", + "from": "Order Completed" + } + ], + "connectionMode": { + "web": "cloud" + }, + "consentManagement": {}, + "oneTrustCookieCategories": {}, + "ketchConsentPurposes": {} + }, + "result": true + }, + { + "testTitle": "With invalid connectionMode value", + "config": { + "apiKey": "test-api", + "topsortEvents": [ + { + "to": "clicks", + "from": "Product Clicked" + }, + { + "to": "impressions", + "from": "Product Viewed" + }, + { + "to": "purchases", + "from": "Order Completed" + } + ], + "connectionMode": { + "web": "abc" + }, + "consentManagement": {}, + "oneTrustCookieCategories": {}, + "ketchConsentPurposes": {} + }, + "result": false, + "err": ["connectionMode.web must be equal to one of the allowed values"] + }, + { + "testTitle": "Device mode is not supported", + "config": { + "connectionMode": { + "web": "device" + }, + "consentManagement": {}, + "oneTrustCookieCategories": {}, + "ketchConsentPurposes": {}, + "apiKey": "test-api", + "topsortEvents": [ + { + "to": "clicks", + "from": "Product Clicked" + }, + { + "to": "impressions", + "from": "Product Viewed" + }, + { + "to": "purchases", + "from": "Order Completed" + } + ] + }, + "result": false, + "err": ["connectionMode.web must be equal to one of the allowed values"] + }, + { + "testTitle": "without api key", + "config": { + "connectionMode": { + "web": "cloud" + }, + "consentManagement": {}, + "oneTrustCookieCategories": {}, + "ketchConsentPurposes": {}, + "topsortEvents": [ + { + "to": "clicks", + "from": "Product Clicked" + }, + { + "to": "impressions", + "from": "Product Viewed" + }, + { + "to": "purchases", + "from": "Order Completed" + } + ] + }, + "result": false, + "err": [" must have required property 'apiKey'"] + }, + { + "testTitle": "Invalid Topsort event name", + "config": { + "connectionMode": { + "web": "cloud" + }, + "consentManagement": {}, + "oneTrustCookieCategories": {}, + "ketchConsentPurposes": {}, + "apiKey": "test-api", + "topsortEvents": [ + { + "to": "test", + "from": "Product Clicked" + }, + { + "to": "impressions", + "from": "Product Viewed" + } + ] + }, + "result": false, + "err": ["topsortEvents.0.to must be equal to one of the allowed values"] + }, + { + "testTitle": "Invalid Rudderstack event name", + "config": { + "connectionMode": { + "web": "cloud" + }, + "consentManagement": {}, + "oneTrustCookieCategories": {}, + "ketchConsentPurposes": {}, + "apiKey": "test-api", + "topsortEvents": [ + { + "to": "clicks", + "from": "test" + }, + { + "to": "impressions", + "from": "Product Viewed" + } + ] + }, + "result": false, + "err": ["topsortEvents.0.from must be equal to one of the allowed values"] + }, + { + "testTitle": "With consent management custom provider config and no resolutionStrategy value", + "config": { + "apiKey": "test-api", + "consentManagement": { + "android": [ + { + "provider": "custom" + } + ] + } + }, + "oneTrustCookieCategories": {}, + "ketchConsentPurposes": {}, + "result": false, + "err": [ + "consentManagement.android.0 must have required property 'resolutionStrategy'", + "consentManagement.android.0 must match \"then\" schema" + ] + }, + { + "testTitle": "With consent management custom provider config invalid provider value", + "config": { + "apiKey": "test-api", + "consentManagement": { + "android": [ + { + "provider": "dummyProvider" + } + ] + }, + "oneTrustCookieCategories": {}, + "ketchConsentPurposes": {} + }, + "result": false, + "err": ["consentManagement.android.0.provider must be equal to one of the allowed values"] + } +]