diff --git a/.eslintrc.json b/.eslintrc.json index c2614ac5ef..d2928e50fd 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -54,7 +54,7 @@ "@typescript-eslint/no-explicit-any": "off", "class-methods-use-this": "off", "@typescript-eslint/return-await": "error", - "import/prefer-default-export": "error", + "import/prefer-default-export": "off", "sonarjs/no-ignored-return": "error", "no-new": "error", "@typescript-eslint/no-shadow": "error", diff --git a/.github/workflows/create-hotfix-branch.yml b/.github/workflows/create-hotfix-branch.yml index 97611f1eee..03c79e0df1 100644 --- a/.github/workflows/create-hotfix-branch.yml +++ b/.github/workflows/create-hotfix-branch.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest # Only allow these users to create new hotfix branch from 'main' - if: github.ref == 'refs/heads/main' && (github.actor == 'ItsSudip' || github.actor == 'krishna2020' || github.actor == 'saikumarrs' || github.actor == 'sandeepdsvs' || github.actor == 'shrouti1507' || github.actor == 'anantjain45823' || github.actor == 'chandumlg' || github.actor == 'mihir-4116' || github.actor == 'ujjwal-ab') && (github.triggering_actor == 'ItsSudip' || github.triggering_actor == 'krishna2020' || github.triggering_actor == 'saikumarrs' || github.triggering_actor == 'sandeepdsvs' || github.triggering_actor == 'shrouti1507' || github.triggering_actor == 'anantjain45823' || github.triggering_actor == 'chandumlg' || github.triggering_actor == 'mihir-4116' || github.triggering_actor == 'ujjwal-ab) + if: github.ref == 'refs/heads/main' && (github.actor == 'ItsSudip' || github.actor == 'krishna2020' || github.actor == 'saikumarrs' || github.actor == 'sandeepdsvs' || github.actor == 'shrouti1507' || github.actor == 'anantjain45823' || github.actor == 'chandumlg' || github.actor == 'mihir-4116' || github.actor == 'ujjwal-ab') && (github.triggering_actor == 'ItsSudip' || github.triggering_actor == 'krishna2020' || github.triggering_actor == 'saikumarrs' || github.triggering_actor == 'sandeepdsvs' || github.triggering_actor == 'shrouti1507' || github.triggering_actor == 'anantjain45823' || github.triggering_actor == 'chandumlg' || github.triggering_actor == 'mihir-4116' || github.triggering_actor == 'ujjwal-ab') steps: - name: Create Branch uses: peterjgrainger/action-create-branch@v2.4.0 diff --git a/CHANGELOG.md b/CHANGELOG.md index b9256fa915..8f990fe3b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,33 @@ 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.50.0](https://github.com/rudderlabs/rudder-transformer/compare/v1.49.1...v1.50.0) (2023-11-13) + + +### Features + +* add clickId support for tiktok and pinterest destination ([#2784](https://github.com/rudderlabs/rudder-transformer/issues/2784)) ([0e14296](https://github.com/rudderlabs/rudder-transformer/commit/0e1429663d167a2c5cded0d9130374eb586a18c0)) +* add delivery_category as part of contents, remove flattening custom_data in FB conversions ([#2812](https://github.com/rudderlabs/rudder-transformer/issues/2812)) ([e82cef8](https://github.com/rudderlabs/rudder-transformer/commit/e82cef88e154d47519f0deeb60f55773f25fd3ad)) +* add delivery_category as part of contents, update flattening custom_data in FB Pixel ([#2816](https://github.com/rudderlabs/rudder-transformer/issues/2816)) ([ee1f473](https://github.com/rudderlabs/rudder-transformer/commit/ee1f4733e82291375d85a6de8b8626ffdc8907b1)) +* adding support for future oauth facility in salesforce ([#2746](https://github.com/rudderlabs/rudder-transformer/issues/2746)) ([916ea4c](https://github.com/rudderlabs/rudder-transformer/commit/916ea4c8d08f69b68b7795dd513a25a3cded55fa)) +* introduce v1/source/sourceType endpoint ([#2722](https://github.com/rudderlabs/rudder-transformer/issues/2722)) ([0996e81](https://github.com/rudderlabs/rudder-transformer/commit/0996e816d3671c3e25561f76e3219be99225f24b)) +* move cdkV1 to cdkv2 component tests ([#2804](https://github.com/rudderlabs/rudder-transformer/issues/2804)) ([195b48a](https://github.com/rudderlabs/rudder-transformer/commit/195b48ac0f438a200933e4bbb956fcc3941b7aed)) +* use custom screen name amplitude ([#2823](https://github.com/rudderlabs/rudder-transformer/issues/2823)) ([93a82bd](https://github.com/rudderlabs/rudder-transformer/commit/93a82bd4856b462768d0213ae3de8b9b78e9858c)) + + +### Bug Fixes + +* source_transform_error stat label correction ([#2825](https://github.com/rudderlabs/rudder-transformer/issues/2825)) ([f3bcd7c](https://github.com/rudderlabs/rudder-transformer/commit/f3bcd7c9338ef96267be84f845c63f5234d37e33)) +* shopify redis metric when there is no data returned for a key ([#2811](https://github.com/rudderlabs/rudder-transformer/issues/2811)) ([c02370e](https://github.com/rudderlabs/rudder-transformer/commit/c02370e38fabb581698baa00e1ddd3da93dc07fa)) +* snapchat_conversion category mapping ([#2826](https://github.com/rudderlabs/rudder-transformer/issues/2826)) ([7acd004](https://github.com/rudderlabs/rudder-transformer/commit/7acd004e4290dfb5ea20402929041462eddb4496)) + +### [1.49.1](https://github.com/rudderlabs/rudder-transformer/compare/v1.49.0...v1.49.1) (2023-11-10) + + +### Bug Fixes + +* update create-hotfix-branch.yml ([#2815](https://github.com/rudderlabs/rudder-transformer/issues/2815)) ([dd884dd](https://github.com/rudderlabs/rudder-transformer/commit/dd884ddc78898bd7de155ec4f05ce8fe6e2c4b80)) + ## [1.49.0](https://github.com/rudderlabs/rudder-transformer/compare/v1.48.0...v1.49.0) (2023-11-06) diff --git a/package-lock.json b/package-lock.json index c16855ccfd..4f83954e5b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "rudder-transformer", - "version": "1.49.0", + "version": "1.50.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "rudder-transformer", - "version": "1.49.0", + "version": "1.50.0", "license": "ISC", "dependencies": { "@amplitude/ua-parser-js": "^0.7.24", @@ -19,7 +19,8 @@ "@koa/router": "^12.0.0", "@ndhoule/extend": "^2.0.0", "@pyroscope/nodejs": "^0.2.6", - "@rudderstack/workflow-engine": "^0.5.7", + "@rudderstack/integrations-lib": "^0.1.8", + "@rudderstack/workflow-engine": "^0.6.9", "ajv": "^8.12.0", "ajv-draft-04": "^1.0.0", "ajv-formats": "^2.1.1", @@ -6637,13 +6638,64 @@ "node": ">= 8" } }, - "node_modules/@rudderstack/json-template-engine": { + "node_modules/@rudderstack/integrations-lib": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/@rudderstack/integrations-lib/-/integrations-lib-0.1.8.tgz", + "integrity": "sha512-f8GX78RFma3XAWPNEI6QjGk4avbE8r9aspHNaYE+YyRKsJGWrl8gw/k+Jso36C0juOGas79GWPSiypbXLu8Q/g==", + "dependencies": { + "@rudderstack/workflow-engine": "^0.5.7", + "axios": "^1.4.0", + "axios-mock-adapter": "^1.22.0", + "crypto": "^1.0.1", + "get-value": "^3.0.1", + "handlebars": "^4.7.8", + "lodash": "^4.17.21", + "moment": "^2.29.4", + "moment-timezone": "^0.5.43", + "set-value": "^4.1.0", + "sha256": "^0.2.0", + "tslib": "^2.4.0" + } + }, + "node_modules/@rudderstack/integrations-lib/node_modules/@aws-crypto/sha256-js": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/sha256-js/-/sha256-js-4.0.0.tgz", + "integrity": "sha512-MHGJyjE7TX9aaqXj7zk2ppnFUOhaDs5sP+HtNS0evOxn72c+5njUmyJmpGd7TfyoDznZlHMmdo/xGUdu2NIjNQ==", + "dependencies": { + "@aws-crypto/util": "^4.0.0", + "@aws-sdk/types": "^3.222.0", + "tslib": "^1.11.1" + } + }, + "node_modules/@rudderstack/integrations-lib/node_modules/@aws-crypto/sha256-js/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + }, + "node_modules/@rudderstack/integrations-lib/node_modules/@aws-crypto/util": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/util/-/util-4.0.0.tgz", + "integrity": "sha512-2EnmPy2gsFZ6m8bwUQN4jq+IyXV3quHAcwPOS6ZA3k+geujiqI8aRokO2kFJe+idJ/P3v4qWI186rVMo0+zLDQ==", + "dependencies": { + "@aws-sdk/types": "^3.222.0", + "@aws-sdk/util-utf8-browser": "^3.0.0", + "tslib": "^1.11.1" + } + }, + "node_modules/@rudderstack/integrations-lib/node_modules/@aws-crypto/util/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + }, + "node_modules/@rudderstack/integrations-lib/node_modules/@rudderstack/json-template-engine": { "version": "0.5.5", - "license": "MIT" + "resolved": "https://registry.npmjs.org/@rudderstack/json-template-engine/-/json-template-engine-0.5.5.tgz", + "integrity": "sha512-p3HdTqgZiJjjZmjaHN2paa1e87ifGE5UjkA4zdvge4bBzJbKKMQNWqRg6I96SwoA+hsxNkW/f9R83SPLU9t7LA==" }, - "node_modules/@rudderstack/workflow-engine": { - "version": "0.5.7", - "license": "MIT", + "node_modules/@rudderstack/integrations-lib/node_modules/@rudderstack/workflow-engine": { + "version": "0.5.8", + "resolved": "https://registry.npmjs.org/@rudderstack/workflow-engine/-/workflow-engine-0.5.8.tgz", + "integrity": "sha512-H1aCowYqTnOoqJtL9cGDhdhoGNl+KzqmVbSjFmE7n75onZaIMs87+HQyW08jYxS9l1Uo4TL8SAvzFICqFqkBbw==", "dependencies": { "@aws-crypto/sha256-js": "^4.0.0", "@rudderstack/json-template-engine": "^0.5.5", @@ -6653,27 +6705,81 @@ "object-sizeof": "^2.6.3" } }, + "node_modules/@rudderstack/json-template-engine": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/@rudderstack/json-template-engine/-/json-template-engine-0.8.2.tgz", + "integrity": "sha512-9oMBnqgNuwiXd7MUlNOAchCnJXQAy6w6XGmDqDM6iXdYDkvqYFiq7sbg5j4SdtpTTST293hahREr5PXfFVzVKg==" + }, + "node_modules/@rudderstack/workflow-engine": { + "version": "0.6.9", + "resolved": "https://registry.npmjs.org/@rudderstack/workflow-engine/-/workflow-engine-0.6.9.tgz", + "integrity": "sha512-b0ZHURJfCj2REIL/w7AJgJ+K5BGwIVX3sRDZQqN3F4YWcZX3ZYUXo7gtUeb99FLnZzm7KuThIWR02Fxwos+L4Q==", + "dependencies": { + "@aws-crypto/sha256-js": "^5.0.0", + "@rudderstack/json-template-engine": "^0.8.1", + "jsonata": "^2.0.3", + "lodash": "^4.17.21", + "object-sizeof": "^2.6.3", + "yaml": "^2.3.2" + } + }, "node_modules/@rudderstack/workflow-engine/node_modules/@aws-crypto/sha256-js": { - "version": "4.0.0", - "license": "Apache-2.0", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/sha256-js/-/sha256-js-5.2.0.tgz", + "integrity": "sha512-FFQQyu7edu4ufvIZ+OadFpHHOt+eSTBaYaki44c+akjg7qZg9oOQeLlk77F6tSYqjDAFClrHJk9tMf0HdVyOvA==", "dependencies": { - "@aws-crypto/util": "^4.0.0", + "@aws-crypto/util": "^5.2.0", "@aws-sdk/types": "^3.222.0", - "tslib": "^1.11.1" + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" } }, "node_modules/@rudderstack/workflow-engine/node_modules/@aws-crypto/util": { - "version": "4.0.0", - "license": "Apache-2.0", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/util/-/util-5.2.0.tgz", + "integrity": "sha512-4RkU9EsI6ZpBve5fseQlGNUWKMa1RLPQ1dnjnQoe07ldfIzcsGb5hC5W0Dm7u423KWzawlrpbjXBrXCEv9zazQ==", "dependencies": { "@aws-sdk/types": "^3.222.0", - "@aws-sdk/util-utf8-browser": "^3.0.0", - "tslib": "^1.11.1" + "@smithy/util-utf8": "^2.0.0", + "tslib": "^2.6.2" } }, - "node_modules/@rudderstack/workflow-engine/node_modules/tslib": { - "version": "1.14.1", - "license": "0BSD" + "node_modules/@rudderstack/workflow-engine/node_modules/@smithy/is-array-buffer": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@smithy/is-array-buffer/-/is-array-buffer-2.0.0.tgz", + "integrity": "sha512-z3PjFjMyZNI98JFRJi/U0nGoLWMSJlDjAW4QUX2WNZLas5C0CmVV6LJ01JI0k90l7FvpmixjWxPFmENSClQ7ug==", + "dependencies": { + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@rudderstack/workflow-engine/node_modules/@smithy/util-buffer-from": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-buffer-from/-/util-buffer-from-2.0.0.tgz", + "integrity": "sha512-/YNnLoHsR+4W4Vf2wL5lGv0ksg8Bmk3GEGxn2vEQt52AQaPSCuaO5PM5VM7lP1K9qHRKHwrPGktqVoAHKWHxzw==", + "dependencies": { + "@smithy/is-array-buffer": "^2.0.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@rudderstack/workflow-engine/node_modules/@smithy/util-utf8": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@smithy/util-utf8/-/util-utf8-2.0.2.tgz", + "integrity": "sha512-qOiVORSPm6Ce4/Yu6hbSgNHABLP2VMv8QOC3tTDNHHlWY19pPyc++fBTbZPtx6egPXi4HQxKDnMxVxpbtX2GoA==", + "dependencies": { + "@smithy/util-buffer-from": "^2.0.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } }, "node_modules/@sideway/address": { "version": "4.1.4", @@ -8184,7 +8290,6 @@ "version": "1.22.0", "resolved": "https://registry.npmjs.org/axios-mock-adapter/-/axios-mock-adapter-1.22.0.tgz", "integrity": "sha512-dmI0KbkyAhntUR05YY96qg2H6gg0XMl2+qTW0xmYg6Up+BFBAJYRLROMXRdDEL06/Wqwa0TJThAYvFtSFdRCZw==", - "dev": true, "dependencies": { "fast-deep-equal": "^3.1.3", "is-buffer": "^2.0.5" @@ -8197,7 +8302,6 @@ "version": "2.0.5", "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz", "integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==", - "dev": true, "funding": [ { "type": "github", @@ -10608,6 +10712,12 @@ "node": "*" } }, + "node_modules/crypto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/crypto/-/crypto-1.0.1.tgz", + "integrity": "sha512-VxBKmeNcqQdiUQUW2Tzq0t377b54N2bMtXO/qiLa+6eRRmmC4qT3D4OnTGoT/U6O9aklQ/jTwbOtRMTTY8G0Ig==", + "deprecated": "This package is no longer supported. It's now a built-in Node module. If you've depended on crypto, you should switch to the one that's built-in." + }, "node_modules/crypto-js": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.2.0.tgz", @@ -13104,11 +13214,12 @@ "license": "MIT" }, "node_modules/handlebars": { - "version": "4.7.7", - "license": "MIT", + "version": "4.7.8", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.8.tgz", + "integrity": "sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ==", "dependencies": { "minimist": "^1.2.5", - "neo-async": "^2.6.0", + "neo-async": "^2.6.2", "source-map": "^0.6.1", "wordwrap": "^1.0.0" }, @@ -19354,8 +19465,9 @@ } }, "node_modules/tslib": { - "version": "2.5.3", - "license": "0BSD" + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" }, "node_modules/tsscmp": { "version": "1.0.6", @@ -19893,9 +20005,9 @@ "license": "ISC" }, "node_modules/yaml": { - "version": "2.3.1", - "dev": true, - "license": "ISC", + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.4.tgz", + "integrity": "sha512-8aAvwVUSHpfEqTQ4w/KMlf3HcRdt50E5ODIQJBw1fQ5RL34xabzxtUlzTXVqc4rkZsPbvrXKWnABCD7kWSmocA==", "engines": { "node": ">= 14" } diff --git a/package.json b/package.json index f0746c9aaf..8a8b6177bd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rudder-transformer", - "version": "1.49.0", + "version": "1.50.0", "description": "", "homepage": "https://github.com/rudderlabs/rudder-transformer#readme", "bugs": { @@ -28,6 +28,7 @@ "build:ci": "tsc -p tsconfig.json", "build:swagger": "npm run build && npm run setup:swagger", "build": "npm run build:ci && npm run copy", + "clean:build": "npm run clean && npm run build", "build:clean": "npm run clean && npm run build", "verify": "eslint . || exit 1; npm run test:js || exit 1", "test:testRouter": "jest testRouter --detectOpenHandles --coverage --notify --watchAll=false", @@ -63,7 +64,8 @@ "@koa/router": "^12.0.0", "@ndhoule/extend": "^2.0.0", "@pyroscope/nodejs": "^0.2.6", - "@rudderstack/workflow-engine": "^0.5.7", + "@rudderstack/integrations-lib": "^0.1.8", + "@rudderstack/workflow-engine": "^0.6.9", "ajv": "^8.12.0", "ajv-draft-04": "^1.0.0", "ajv-formats": "^2.1.1", diff --git a/src/adapters/networkHandlerFactory.js b/src/adapters/networkHandlerFactory.js index 7cfa4b048e..f4940553f5 100644 --- a/src/adapters/networkHandlerFactory.js +++ b/src/adapters/networkHandlerFactory.js @@ -8,6 +8,8 @@ const { getIntegrations } = require('../routes/utils'); const handlers = { generic: GenericNetworkHandler, + v0: {}, + v1: {}, }; // Dynamically import the network handlers for all @@ -16,7 +18,17 @@ SUPPORTED_VERSIONS.forEach((version) => { const destinations = getIntegrations(path.resolve(__dirname, `../${version}/destinations`)); destinations.forEach((dest) => { try { - handlers[dest] = require(`../${version}/destinations/${dest}/networkHandler`).networkHandler; + // handles = { + // v0: { + // dest: handler + // }, + // v1: { + // dest: handler + // }, + // generic: GenericNetworkHandler, + // } + handlers[version][dest] = + require(`../${version}/destinations/${dest}/networkHandler`).networkHandler; } catch { // Do nothing as exception indicates // network handler is not defined for that destination @@ -24,8 +36,8 @@ SUPPORTED_VERSIONS.forEach((version) => { }); }); -const getNetworkHandler = (type) => { - const NetworkHandler = handlers[type] || handlers.generic; +const getNetworkHandler = (type, version) => { + const NetworkHandler = handlers[version][type] || handlers.generic; return new NetworkHandler(); }; diff --git a/src/adapters/networkHandlerFactory.test.js b/src/adapters/networkHandlerFactory.test.js new file mode 100644 index 0000000000..c4713e66a8 --- /dev/null +++ b/src/adapters/networkHandlerFactory.test.js @@ -0,0 +1,25 @@ +const { getNetworkHandler } = require('./networkHandlerFactory'); +const { networkHandler: GenericNetworkHandler } = require('./networkhandler/genericNetworkHandler'); + +describe(`Network Handler Tests`, () => { + it('Should return v0 networkhandler', () => { + let proxyHandler = getNetworkHandler('campaign_manager', `v0`); + const cmProxy = require(`../v0/destinations/campaign_manager/networkHandler`).networkHandler; + expect(proxyHandler).toEqual(new cmProxy()); + + proxyHandler = getNetworkHandler('braze', `v0`); + const brazeProxy = require(`../v0/destinations/braze/networkHandler`).networkHandler; + expect(proxyHandler).toEqual(new brazeProxy()); + }); + + it('Should return v1 networkhandler', () => { + let proxyHandler = getNetworkHandler('campaign_manager', `v1`); + const cmProxy = require(`../v1/destinations/campaign_manager/networkHandler`).networkHandler; + expect(proxyHandler).toEqual(new cmProxy()); + }); + + it('Should return genericHandler if v1 proxy and handler is not present for destination', () => { + let proxyHandler = getNetworkHandler('braze', `v1`); + expect(proxyHandler).toEqual(new GenericNetworkHandler()); + }); +}); diff --git a/src/adapters/networkhandler/genericNetworkHandler.js b/src/adapters/networkhandler/genericNetworkHandler.js index 23bdc1d7a2..bcbcb21259 100644 --- a/src/adapters/networkhandler/genericNetworkHandler.js +++ b/src/adapters/networkhandler/genericNetworkHandler.js @@ -1,7 +1,7 @@ +const { NetworkError } = require('@rudderstack/integrations-lib'); const { isHttpStatusSuccess } = require('../../v0/util/index'); const { proxyRequest, prepareProxyRequest } = require('../network'); const { getDynamicErrorType, processAxiosResponse } = require('../utils/networkUtils'); -const { NetworkError } = require('../../v0/util/errorTypes'); const tags = require('../../v0/util/tags'); /** diff --git a/src/adapters/utils/networkUtils.js b/src/adapters/utils/networkUtils.js index 7f830f5a4b..0dcb9931e9 100644 --- a/src/adapters/utils/networkUtils.js +++ b/src/adapters/utils/networkUtils.js @@ -1,6 +1,7 @@ /* eslint-disable eqeqeq */ const lodash = require('lodash'); const { isEmpty } = require('lodash'); +const { AbortedError } = require('@rudderstack/integrations-lib'); const { isHttpStatusRetryable, isDefinedAndNotNullAndNotEmpty, @@ -9,7 +10,6 @@ const { isHttpStatusSuccess, getErrorStatusCode, } = require('../../v0/util'); -const { AbortedError } = require('../../v0/util/errorTypes'); const tags = require('../../v0/util/tags'); const { HTTP_STATUS_CODES } = require('../../v0/util/constant'); diff --git a/src/cdk/v1/autopilot/transform.js b/src/cdk/v1/autopilot/transform.js index 613b985c0d..b27e50f096 100644 --- a/src/cdk/v1/autopilot/transform.js +++ b/src/cdk/v1/autopilot/transform.js @@ -1,5 +1,5 @@ const { Utils } = require('rudder-transformer-cdk'); -const { InstrumentationError } = require('../../../v0/util/errorTypes'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); function identifyPostMapper(event, mappedPayload) { const { message } = event; diff --git a/src/cdk/v1/dcm_floodlight/transform.js b/src/cdk/v1/dcm_floodlight/transform.js index d5835d3e2b..bb93333745 100644 --- a/src/cdk/v1/dcm_floodlight/transform.js +++ b/src/cdk/v1/dcm_floodlight/transform.js @@ -5,6 +5,7 @@ const { removeUndefinedAndNullValues, isDefinedAndNotNull, } = require('rudder-transformer-cdk/build/utils'); +const { ConfigurationError, InstrumentationError } = require('@rudderstack/integrations-lib'); const { getIntegrationsObj, isEmpty, @@ -14,7 +15,6 @@ const { } = require('../../../v0/util'); const { GENERIC_TRUE_VALUES, GENERIC_FALSE_VALUES } = require('../../../constants'); const { BASE_URL, BLACKLISTED_CHARACTERS } = require('./config'); -const { ConfigurationError, InstrumentationError } = require('../../../v0/util/errorTypes'); // append properties to endpoint // eg: ${BASE_URL}key1=value1;key2=value2;.... diff --git a/src/cdk/v1/handler.js b/src/cdk/v1/handler.js index a7dfe85a9f..0af0859f49 100644 --- a/src/cdk/v1/handler.js +++ b/src/cdk/v1/handler.js @@ -6,13 +6,13 @@ const path = require('path'); const basePath = path.resolve(__dirname); ConfigFactory.init({ basePath, loggingMode: 'production' }); -const tags = require('../../v0/util/tags'); -const { generateErrorObject } = require('../../v0/util'); const { + InstrumentationError, TransformationError, ConfigurationError, - InstrumentationError, -} = require('../../v0/util/errorTypes'); +} = require('@rudderstack/integrations-lib'); +const tags = require('../../v0/util/tags'); +const { generateErrorObject } = require('../../v0/util'); const defTags = { [tags.TAG_NAMES.IMPLEMENTATION]: tags.IMPLEMENTATIONS.CDK_V1, diff --git a/src/cdk/v2/bindings/default.js b/src/cdk/v2/bindings/default.js index b86b6d2b63..a447370aca 100644 --- a/src/cdk/v2/bindings/default.js +++ b/src/cdk/v2/bindings/default.js @@ -3,7 +3,7 @@ const { InstrumentationError, ConfigurationError, NetworkError, -} = require('../../../v0/util/errorTypes'); +} = require('@rudderstack/integrations-lib'); const { isHttpStatusSuccess } = require('../../../v0/util'); const { getDynamicErrorType } = require('../../../adapters/utils/networkUtils'); const tags = require('../../../v0/util/tags'); diff --git a/src/cdk/v2/destinations/dcm_floodlight/utils.js b/src/cdk/v2/destinations/dcm_floodlight/utils.js index bee45bdea3..07b158efa3 100644 --- a/src/cdk/v2/destinations/dcm_floodlight/utils.js +++ b/src/cdk/v2/destinations/dcm_floodlight/utils.js @@ -1,7 +1,7 @@ const lodash = require('lodash'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { getValueFromPropertiesOrTraits, getHashFromArray } = require('../../../../v0/util'); const { GENERIC_TRUE_VALUES, GENERIC_FALSE_VALUES } = require('../../../../constants'); -const { InstrumentationError } = require('../../../../v0/util/errorTypes'); // valid flag should be provided [1|true] or [0|false] const mapFlagValue = (key, value) => { diff --git a/src/cdk/v2/destinations/gladly/procWorkflow.yaml b/src/cdk/v2/destinations/gladly/procWorkflow.yaml new file mode 100644 index 0000000000..fe8697bc31 --- /dev/null +++ b/src/cdk/v2/destinations/gladly/procWorkflow.yaml @@ -0,0 +1,88 @@ +bindings: + - name: EventType + path: ../../../../constants + - path: ./utils + exportAll: true + - name: defaultRequestConfig + path: ../../../../v0/util + - name: removeUndefinedAndNullValues + path: ../../../../v0/util + - name: getDestinationExternalID + path: ../../../../v0/util + - name: httpGET + path: ../../../../adapters/network + - name: processAxiosResponse + path: ../../../../adapters/utils/networkUtils + + +steps: + - name: checkIfProcessed + condition: .message.statusCode + template: | + $.batchMode ? .message.body.JSON : .message + onComplete: return + + - name: messageType + template: | + .message.type.toLowerCase() + + - name: validateInput + template: | + let messageType = $.outputs.messageType + $.assert(messageType, "message Type is not present. Aborting") + $.assert(messageType in {{$.EventType.([.IDENTIFY])}}, "message type " + messageType + " is not supported") + $.assertConfig(.destination.Config.apiToken, "API Token is not present. Aborting") + $.assertConfig(.destination.Config.domain, "Gladly domain is not present. Aborting") + $.assertConfig(.destination.Config.userName, "User Name is not present. Aborting") + + - name: preparePayload + template: | + $.context.payload = { + name: .message.traits.name || .message.context.traits.name, + image: .message.traits.avatar || .message.context.traits.avatar, + address: .message.traits.address || .message.context.traits.address + } + $.context.payload.address && typeof $.context.payload.address === "object" ? $.context.payload.address = JSON.stringify($.context.payload.address) + $.context.payload.emails = $.formatField(.message, "email") + $.context.payload.phones = $.formatField(.message, "phone") + $.context.payload.customAttributes = $.getCustomAttributes(.message) + $.context.payload.externalCustomerId = $.getExternalCustomerId(.message) + $.context.payload.id = $.getCustomerId(.message) + $.context.payload = $.removeUndefinedAndNullValues($.context.payload) + + - name: validatePayload + template: | + $.validatePayload($.context.payload) + + - name: findCustomer + description: Find if customer is exist or not based on email, phone or externalCustomerId + condition: $.getQueryParams($.context.payload) !== undefined + template: | + const requestOptions = { + headers: $.getHeaders(.destination) + } + const endpoint = $.getEndpoint(.destination) + "?" + $.getQueryParams($.context.payload); + const rawResponse = await $.httpGET(endpoint,requestOptions) + const processedResponse = $.processAxiosResponse(rawResponse) + processedResponse + + - name: createCustomer + description: Build response for create customer + condition: $.outputs.findCustomer.status === 400 || ($.outputs.findCustomer.status === 200 && $.outputs.findCustomer.response.length === 0) || $.getQueryParams($.context.payload) === undefined + template: | + const response = $.defaultRequestConfig() + response.body.JSON = $.removeUndefinedAndNullValues($.context.payload) + response.endpoint = $.getEndpoint(.destination) + response.method = "POST" + response.headers = $.getHeaders(.destination) + response + else: + name: updateCustomer + description: Build response for update customer + template: | + const response = $.defaultRequestConfig() + response.body.JSON = $.removeUndefinedAndNullValues($.context.payload.{~["id"]}) + response.endpoint = $.getEndpoint(.destination) + "/" + $.outputs.findCustomer.response[0].id + response.method = "PATCH" + response.headers = $.getHeaders(.destination) + response diff --git a/src/cdk/v2/destinations/gladly/rtWorkflow.yaml b/src/cdk/v2/destinations/gladly/rtWorkflow.yaml new file mode 100644 index 0000000000..341e5552c8 --- /dev/null +++ b/src/cdk/v2/destinations/gladly/rtWorkflow.yaml @@ -0,0 +1,33 @@ +bindings: + - name: handleRtTfSingleEventError + path: ../../../../v0/util/index + - path: ./utils + exportAll: true + +steps: + - name: validateInput + template: | + $.assert(Array.isArray(^) && ^.length > 0, "Invalid event array") + + - name: transform + externalWorkflow: + path: ./procWorkflow.yaml + loopOverInput: true + + - name: successfulEvents + template: | + $.outputs.transform#idx.output.({ + "batchedRequest": ., + "batched": false, + "destination": ^[idx].destination, + "metadata": ^[idx].metadata[], + "statusCode": 200 + })[] + - name: failedEvents + template: | + $.outputs.transform#idx.error.( + $.handleRtTfSingleEventError(^[idx], .originalError ?? ., {}) + )[] + - name: finalPayload + template: | + [...$.outputs.successfulEvents, ...$.outputs.failedEvents] \ No newline at end of file diff --git a/src/cdk/v2/destinations/gladly/utils.js b/src/cdk/v2/destinations/gladly/utils.js new file mode 100644 index 0000000000..0489f410ec --- /dev/null +++ b/src/cdk/v2/destinations/gladly/utils.js @@ -0,0 +1,174 @@ +const get = require('get-value'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); +const { base64Convertor, getDestinationExternalID } = require('../../../../v0/util'); +const { MappedToDestinationKey } = require('../../../../constants'); + +const reservedCustomAttributes = [ + 'email', + 'phone', + 'address', + 'name', + 'avatar', + 'firstName', + 'lastName', + 'userId', +]; + +const externalIdKey = 'context.externalId.0.id'; +const identifierTypeKey = 'context.externalId.0.identifierType'; + +const getHeaders = (destination) => { + const { apiToken, userName } = destination.Config; + const credentials = `${userName}:${apiToken}`; + const base64Credentials = base64Convertor(credentials); + return { + 'Content-Type': 'application/json', + Authorization: `Basic ${base64Credentials}`, + }; +}; + +const getEndpoint = (destination) => { + const { domain } = destination.Config; + return `https://${domain}/api/v1/customer-profiles`; +}; + +const getFieldValue = (field) => { + if (field) { + if (Array.isArray(field)) { + return field.map((item) => ({ original: item })); + } + return [{ original: field }]; + } + return undefined; +}; + +const formatFieldForRETl = (message, fieldName) => { + const identifierType = get(message, identifierTypeKey); + if (identifierType && identifierType === fieldName) { + const field = get(message, externalIdKey); + if (field) { + return [{ original: field }]; + } + } + const key = fieldName === 'email' ? 'emails' : 'phones'; + const field = get(message, `traits.${key}`); + return getFieldValue(field); +}; + +const formatFieldForEventStream = (message, fieldName) => { + const field = get(message, `context.traits.${fieldName}`); + return getFieldValue(field); +}; + +const formatField = (message, fieldName) => { + const mappedToDestination = get(message, MappedToDestinationKey); + if (mappedToDestination) { + return formatFieldForRETl(message, fieldName); + } + return formatFieldForEventStream(message, fieldName); +}; + +const getCustomAttributes = (message) => { + const mappedToDestination = get(message, MappedToDestinationKey); + // for rETL + if (mappedToDestination) { + if (message?.traits?.customAttributes && typeof message.traits.customAttributes === 'object') { + return Object.keys(message.traits.customAttributes).length > 0 + ? message.traits.customAttributes + : undefined; + } + return undefined; + } + + // for event stream + const customAttributes = message.context?.traits || {}; + reservedCustomAttributes.forEach((customAttribute) => { + if (customAttributes[customAttribute]) { + delete customAttributes[customAttribute]; + } + }); + return Object.keys(customAttributes).length > 0 ? customAttributes : undefined; +}; + +const getExternalCustomerId = (message) => { + const mappedToDestination = get(message, MappedToDestinationKey); + // for rETL + if (mappedToDestination) { + const identifierType = get(message, identifierTypeKey); + if (identifierType === 'externalCustomerId') { + return get(message, externalIdKey); + } + + if (message?.traits?.externalCustomerId) { + return message.traits.externalCustomerId; + } + + return undefined; + } + + // for event stream + return message.userId; +}; + +const getCustomerId = (message) => { + const mappedToDestination = get(message, MappedToDestinationKey); + // for rETL + if (mappedToDestination) { + const identifierType = get(message, identifierTypeKey); + if (identifierType === 'id') { + return get(message, externalIdKey); + } + + if (message?.traits?.id) { + return message.traits.id; + } + + return undefined; + } + + // for event stream + const customerId = getDestinationExternalID(message, 'GladlyCustomerId'); + if (customerId) { + return customerId; + } + + return undefined; +}; + +const validatePayload = (payload) => { + if (!(payload?.phones || payload?.emails || payload?.id || payload?.externalCustomerId)) { + throw new InstrumentationError( + 'One of phone, email, userId or GladlyCustomerId is required for an identify call', + ); + } +}; + +const getQueryParams = (payload) => { + if (payload.emails && payload.emails.length > 0) { + return `email=${encodeURIComponent(payload.emails[0].original)}`; + } + + if (payload.phones && payload.phones.length > 0) { + return `phoneNumber=${encodeURIComponent(payload.phones[0].original)}`; + } + + if (payload.externalCustomerId) { + return `externalCustomerId=${encodeURIComponent(payload.externalCustomerId)}`; + } + + return undefined; +}; + +module.exports = { + getHeaders, + getEndpoint, + formatField, + getFieldValue, + getCustomerId, + getQueryParams, + validatePayload, + formatFieldForRETl, + getCustomAttributes, + getExternalCustomerId, + formatFieldForEventStream, +}; diff --git a/src/cdk/v2/destinations/gladly/utils.test.js b/src/cdk/v2/destinations/gladly/utils.test.js new file mode 100644 index 0000000000..116f150448 --- /dev/null +++ b/src/cdk/v2/destinations/gladly/utils.test.js @@ -0,0 +1,503 @@ +const { + getHeaders, + getEndpoint, + formatField, + getCustomerId, + getFieldValue, + getQueryParams, + validatePayload, + formatFieldForRETl, + getCustomAttributes, + getExternalCustomerId, + formatFieldForEventStream, +} = require('./utils'); +const { base64Convertor } = require('../../../../v0/util'); + +describe('Unit test cases for getHeaders function', () => { + it('Should return headers', () => { + const destination = { + Config: { + apiToken: 'token', + userName: 'user', + }, + }; + const expectedHeaders = { + 'Content-Type': 'application/json', + Authorization: `Basic ${base64Convertor('user:token')}`, + }; + + const result = getHeaders(destination); + + expect(result).toEqual(expectedHeaders); + }); +}); + +describe('Unit test cases for getEndpoint function', () => { + it('Should return destination endpoint', () => { + const destination = { + Config: { + domain: 'rudderstack.us-uat.gladly.qa', + }, + }; + const expected = 'https://rudderstack.us-uat.gladly.qa/api/v1/customer-profiles'; + const result = getEndpoint(destination); + expect(result).toBe(expected); + }); +}); + +describe('Unit test cases for getFieldValue function', () => { + it('Should return an array with a single object containing the original value when the input field is a string', () => { + const field = 'rudderlabs1@gmail.com'; + const result = getFieldValue(field); + expect(result).toEqual([{ original: field }]); + }); + + it('should return an array with each element containing the original value when the input field is an array', () => { + const field = ['rudderlabs1@gmail.com', 'rudderlabs2@gmail.com', 'rudderlabs3@gmail.com']; + const result = getFieldValue(field); + expect(result).toEqual([ + { + original: 'rudderlabs1@gmail.com', + }, + { + original: 'rudderlabs2@gmail.com', + }, + { + original: 'rudderlabs3@gmail.com', + }, + ]); + }); + + it('Should return undefined when the input field is null', () => { + const field = null; + const result = getFieldValue(field); + expect(result).toBeUndefined(); + }); + + it('Should return undefined when the input field is undefined', () => { + const field = undefined; + const result = getFieldValue(field); + expect(result).toBeUndefined(); + }); +}); + +describe('Unit test cases for formatFieldForRETl function', () => { + it('should return the object containing the original value when identifierType matches fieldName', () => { + const message = { + context: { + externalId: [ + { + id: 'test@rudderlabs.com', + identifierType: 'email', + }, + ], + }, + traits: { + emails: ['test@rudderlabs.com', 'test@rudderlabshome.com'], + }, + }; + const fieldName = 'email'; + const expected = [{ original: 'test@rudderlabs.com' }]; + + const result = formatFieldForRETl(message, fieldName); + + expect(result).toEqual(expected); + }); + + it('Should retrieve the email value from traits when fieldName does not match with identifierType', () => { + const message = { + context: { + externalId: [ + { + id: '+91 9999999999', + identifierType: 'phone', + }, + ], + }, + traits: { + emails: ['test@rudderlabs.com', 'test@rudderlabshome.com'], + }, + }; + const fieldName = 'email'; + const expected = [{ original: 'test@rudderlabs.com' }, { original: 'test@rudderlabshome.com' }]; + + const result = formatFieldForRETl(message, fieldName); + + expect(result).toEqual(expected); + }); +}); + +describe('Unit test cases for formatFieldForEventStream function', () => { + it('Should return field value when fieldName exist in payload', () => { + const message = { + context: { + traits: { + phone: '+91 9999999999', + }, + }, + }; + const fieldName = 'phone'; + const expected = [{ original: '+91 9999999999' }]; + + const result = formatFieldForEventStream(message, fieldName); + expect(result).toEqual(expected); + }); + + it('Should return undefined when fieldName does not exist in payload', () => { + const message = { + context: { + traits: { + phone: '+91 9999999999', + }, + }, + }; + const fieldName = 'email'; + const result = formatFieldForEventStream(message, fieldName); + expect(result).toBeUndefined(); + }); +}); + +describe('Unit test cases for formatField function', () => { + describe('rETL tests', () => { + it('Should return field value from externalId when identifier type matches with fieldName', () => { + const message = { + context: { + externalId: [ + { + id: '+91 9999999999', + identifierType: 'phone', + }, + ], + mappedToDestination: true, + }, + traits: { + emails: ['test@rudderlabs.com', 'test@rudderlabshome.com'], + }, + }; + const result = formatField(message, 'phone'); + expect(result).toEqual([{ original: '+91 9999999999' }]); + }); + + it('Should return field value from traits when identifier type does not match with fieldName', () => { + const message = { + context: { + externalId: [ + { + id: 'user@1', + identifierType: 'externalCustomerId', + }, + ], + mappedToDestination: true, + }, + traits: { + phones: ['+91 9999999999'], + }, + }; + const result = formatField(message, 'phone'); + expect(result).toEqual([{ original: '+91 9999999999' }]); + }); + }); + + describe('Event stream tests', () => { + it('Should return field value from payload', () => { + const message = { + context: { + traits: { + phone: ['+91 9999999999'], + }, + }, + }; + const result = formatField(message, 'phone'); + expect(result).toEqual([{ original: '+91 9999999999' }]); + }); + }); +}); + +describe('Unit test cases for getCustomAttributes function', () => { + describe('rETL tests', () => { + it('Should return custom attributes from payload', () => { + const message = { + context: { + mappedToDestination: true, + }, + traits: { + customAttributes: { + attribute1: 'value1', + attribute2: 'value2', + }, + }, + }; + const result = getCustomAttributes(message); + expect(result).toEqual({ + attribute1: 'value1', + attribute2: 'value2', + }); + }); + + it('Should return undefined when empty custom attributes object is present in payload', () => { + const message = { + context: { + mappedToDestination: true, + }, + traits: { + customAttributes: {}, + }, + }; + const result = getCustomAttributes(message); + expect(result).toBeUndefined(); + }); + + it('Should return undefined when no custom attributes are present in payload', () => { + const message = { + context: { + mappedToDestination: true, + }, + traits: {}, + }; + const result = getCustomAttributes(message); + expect(result).toBeUndefined(); + }); + }); + + describe('Event stream tests', () => { + it('Should filter traits and return remaining custom attributes from payload', () => { + const message = { + context: { + traits: { + name: 'John Doe', + email: 'john@gmail.com', + age: 65, + source: 'rudderstack', + }, + }, + }; + const result = getCustomAttributes(message); + expect(result).toEqual({ + age: 65, + source: 'rudderstack', + }); + }); + + it('Should return undefined when empty traits object is present in payload', () => { + const message = { + context: { + traits: {}, + }, + }; + const result = getCustomAttributes(message); + expect(result).toBeUndefined(); + }); + + it('Should return undefined when no traits object is present in payload', () => { + const message = { + context: {}, + }; + const result = getCustomAttributes(message); + expect(result).toBeUndefined(); + }); + }); +}); + +describe('Unit test cases for getExternalCustomerId function', () => { + describe('rETL tests', () => { + it('Should return the external ID when the identifier type is "externalCustomerId"', () => { + const message = { + context: { + externalId: [ + { + id: 'externalCustomer@1', + identifierType: 'externalCustomerId', + }, + ], + mappedToDestination: true, + }, + }; + + const result = getExternalCustomerId(message); + expect(result).toBe('externalCustomer@1'); + }); + + it('Should return the external ID from traits when identifier type is not "externalCustomerId"', () => { + const message = { + context: { + externalId: [ + { + id: 'test@rudderlabs.com', + identifierType: 'email', + }, + ], + mappedToDestination: true, + }, + traits: { + externalCustomerId: 'externalCustomer@1', + }, + }; + const result = getExternalCustomerId(message); + expect(result).toBe('externalCustomer@1'); + }); + + it('Should return undefined when external customer id is not present in payload', () => { + const message = { + context: { + mappedToDestination: true, + }, + }; + + const result = getExternalCustomerId(message); + expect(result).toBeUndefined(); + }); + }); + + describe('Event stream tests', () => { + it('Should return the external ID as userId is present in payload', () => { + const message = { + userId: 'externalCustomer@1', + context: {}, + }; + + const result = getExternalCustomerId(message); + expect(result).toBe('externalCustomer@1'); + }); + + it('Should return undefined when userId is not present in payload', () => { + const message = { + context: {}, + }; + + const result = getExternalCustomerId(message); + expect(result).toBeUndefined(); + }); + }); +}); + +describe('Unit test cases for getCustomerId function', () => { + describe('rETL tests', () => { + it('Should return the customerId when the identifier type is "id"', () => { + const message = { + context: { + externalId: [ + { + id: 'user@1', + identifierType: 'id', + }, + ], + mappedToDestination: true, + }, + }; + + const result = getCustomerId(message); + expect(result).toBe('user@1'); + }); + + it('Should return the customerId from traits when identifier type is not "id"', () => { + const message = { + context: { + externalId: [ + { + id: 'test@rudderlabs.com', + identifierType: 'email', + }, + ], + mappedToDestination: true, + }, + traits: { + id: 'user@1', + }, + }; + const result = getCustomerId(message); + expect(result).toBe('user@1'); + }); + + it('Should return undefined when customerId is not present in payload', () => { + const message = { + context: { + mappedToDestination: true, + }, + }; + + const result = getCustomerId(message); + expect(result).toBeUndefined(); + }); + }); + + describe('Event stream tests', () => { + it('Should return the customerId as GladlyCustomerId is present in payload', () => { + const message = { + context: { + externalId: [ + { + id: 'user@1', + type: 'GladlyCustomerId', + }, + ], + }, + }; + const result = getCustomerId(message); + expect(result).toBe('user@1'); + }); + + it('Should return undefined when GladlyCustomerId is not present in payload', () => { + const message = { + context: {}, + }; + const result = getCustomerId(message); + expect(result).toBeUndefined(); + }); + }); +}); + +describe('Unit test cases for validatePayload function', () => { + it('Should throw an error when payload does not have all required fields', () => { + const payload = {}; + try { + validatePayload(payload); + } catch (err) { + expect(err.message).toEqual( + 'One of phone, email, userId or GladlyCustomerId is required for an identify call', + ); + } + }); + + it('Should throw an error when payload is undefined', () => { + const payload = undefined; + try { + validatePayload(payload); + } catch (err) { + expect(err.message).toEqual( + 'One of phone, email, userId or GladlyCustomerId is required for an identify call', + ); + } + }); +}); + +describe('Unit test cases for getQueryParams function', () => { + it('Should return email as query parameter if email is present in payload', () => { + const payload = { + emails: [{ original: 'test@example.com' }], + }; + const result = getQueryParams(payload); + expect(result).toBe('email=test%40example.com'); + }); + + it('Should return phone as query parameter if phone is present in payload', () => { + const payload = { + phones: [{ original: '+91 9999999999' }], + }; + const result = getQueryParams(payload); + expect(result).toBe('phoneNumber=%2B91%209999999999'); + }); + + it('Should return externalCustomerId as query parameter if externalCustomerId is present in payload', () => { + const payload = { + externalCustomerId: 'externalCustomer@1', + }; + const result = getQueryParams(payload); + expect(result).toBe('externalCustomerId=externalCustomer%401'); + }); + + it('should return undefined when no supported query params are present in payload', () => { + const payload = {}; + const result = getQueryParams(payload); + expect(result).toBeUndefined(); + }); +}); diff --git a/src/cdk/v2/destinations/pinterest_tag/procWorkflow.yaml b/src/cdk/v2/destinations/pinterest_tag/procWorkflow.yaml index e0b81e0afe..7bcb804126 100644 --- a/src/cdk/v2/destinations/pinterest_tag/procWorkflow.yaml +++ b/src/cdk/v2/destinations/pinterest_tag/procWorkflow.yaml @@ -100,7 +100,8 @@ steps: "hashed_maids": .context.device.advertisingId, "client_ip_address": .context.ip ?? .request_ip, "client_user_agent": .context.userAgent, - "external_id": {{{{$.getGenericPaths("userId")}}}} + "external_id": {{{{$.getGenericPaths("userId")}}}}, + "click_id": .properties.clickId }); !.destination.Config.sendExternalId ? userFields = userFields{~["external_id"]} : null; userFields = $.removeUndefinedAndNullAndEmptyValues(userFields); @@ -185,14 +186,13 @@ steps: - name: payload template: | $.outputs.eventNames.().({...$.outputs.basePayload, event_name: .})[] - + - name: checkSendTestEventConfig description: | If sendTestEvent is enabled, we send test event to the destination ref: https://help.pinterest.com/en/business/article/track-conversions-with-the-conversions-api template: | - ^.destination.Config.sendAsTestEvent ? {"test": true} : {} - + ^.destination.Config.sendAsTestEvent ? {"test": true} : {} - name: buildResponseForBatchMode description: In batchMode we return payload directly diff --git a/src/cdk/v2/handler.ts b/src/cdk/v2/handler.ts index 4b3868b85b..47d6d10179 100644 --- a/src/cdk/v2/handler.ts +++ b/src/cdk/v2/handler.ts @@ -64,25 +64,26 @@ export function getCachedWorkflowEngine( return workflowEnginePromiseMap[destName][feature]; } -export async function executeWorkflow(workflowEngine: WorkflowEngine, parsedEvent: FixMe) { - try { - const result = await workflowEngine.execute(parsedEvent); - // TODO: Handle remaining output scenarios - return result.output; - } catch (error) { - throw getErrorInfo(error, isCdkV2Destination(parsedEvent), defTags); - } +export async function executeWorkflow( + workflowEngine: WorkflowEngine, + parsedEvent: FixMe, + requestMetadata: NonNullable = {}, +) { + const result = await workflowEngine.execute(parsedEvent, { requestMetadata }); + // TODO: Handle remaining output scenarios + return result.output; } export async function processCdkV2Workflow( destType: string, parsedEvent: FixMe, feature: string, + requestMetadata: NonNullable = {}, bindings: Record = {}, ) { try { const workflowEngine = await getCachedWorkflowEngine(destType, feature, bindings); - return await executeWorkflow(workflowEngine, parsedEvent); + return await executeWorkflow(workflowEngine, parsedEvent, requestMetadata); } catch (error) { throw getErrorInfo(error, isCdkV2Destination(parsedEvent), defTags); } diff --git a/src/cdk/v2/utils.ts b/src/cdk/v2/utils.ts index 3fb26c07e0..f9a5c66937 100644 --- a/src/cdk/v2/utils.ts +++ b/src/cdk/v2/utils.ts @@ -1,9 +1,9 @@ import path from 'path'; import fs from 'fs/promises'; import { WorkflowExecutionError, WorkflowCreationError } from '@rudderstack/workflow-engine'; +import { PlatformError } from '@rudderstack/integrations-lib'; import logger from '../../logger'; import { generateErrorObject } from '../../v0/util'; -import { PlatformError } from '../../v0/util/errorTypes'; import tags from '../../v0/util/tags'; import { CatchErr } from '../../util/types'; diff --git a/src/constants/destinationCanonicalNames.js b/src/constants/destinationCanonicalNames.js index 870c534db0..d1e199c9e2 100644 --- a/src/constants/destinationCanonicalNames.js +++ b/src/constants/destinationCanonicalNames.js @@ -1,5 +1,6 @@ const DestHandlerMap = { ga360: 'ga', + salesforce_oauth: 'salesforce', }; const DestCanonicalNames = { diff --git a/src/controllers/delivery.ts b/src/controllers/delivery.ts index 5dee091c46..3ccc241b87 100644 --- a/src/controllers/delivery.ts +++ b/src/controllers/delivery.ts @@ -1,24 +1,30 @@ import { Context } from 'koa'; -import MiscService from '../services/misc'; +import { MiscService } from '../services/misc'; import { DeliveryResponse, ProcessorTransformationOutput } from '../types/index'; -import ServiceSelector from '../helpers/serviceSelector'; -import DeliveryTestService from '../services/delivertTest/deliveryTest'; -import ControllerUtility from './util'; +import { ServiceSelector } from '../helpers/serviceSelector'; +import { DeliveryTestService } from '../services/delivertTest/deliveryTest'; +import { ControllerUtility } from './util'; import logger from '../logger'; -import DestinationPostTransformationService from '../services/destination/postTransformation'; +import { DestinationPostTransformationService } from '../services/destination/postTransformation'; import tags from '../v0/util/tags'; import { FixMe } from '../util/types'; -export default class DeliveryController { +export class DeliveryController { public static async deliverToDestination(ctx: Context) { logger.debug('Native(Delivery):: Request to transformer::', JSON.stringify(ctx.request.body)); let deliveryResponse: DeliveryResponse; const requestMetadata = MiscService.getRequestMetadata(ctx); const event = ctx.request.body as ProcessorTransformationOutput; const { destination }: { destination: string } = ctx.params; + const { version }: { version: string } = ctx.params; const integrationService = ServiceSelector.getNativeDestinationService(); try { - deliveryResponse = await integrationService.deliver(event, destination, requestMetadata); + deliveryResponse = await integrationService.deliver( + event, + destination, + requestMetadata, + version, + ); } catch (error: any) { const metaTO = integrationService.getTags( destination, diff --git a/src/controllers/destination.ts b/src/controllers/destination.ts index 60eac8a56c..71075d1b4c 100644 --- a/src/controllers/destination.ts +++ b/src/controllers/destination.ts @@ -1,22 +1,22 @@ import { Context } from 'koa'; -import MiscService from '../services/misc'; -import PreTransformationDestinationService from '../services/destination/preTransformation'; -import PostTransformationDestinationService from '../services/destination/postTransformation'; +import { MiscService } from '../services/misc'; +import { DestinationPreTransformationService } from '../services/destination/preTransformation'; +import { DestinationPostTransformationService } from '../services/destination/postTransformation'; import { ProcessorTransformationRequest, RouterTransformationRequest, ProcessorTransformationResponse, RouterTransformationResponse, } from '../types/index'; -import ServiceSelector from '../helpers/serviceSelector'; -import ControllerUtility from './util'; +import { ServiceSelector } from '../helpers/serviceSelector'; +import { ControllerUtility } from './util'; import stats from '../util/stats'; import logger from '../logger'; import { getIntegrationVersion } from '../util/utils'; import tags from '../v0/util/tags'; -import DynamicConfigParser from '../util/dynamicConfigParser'; +import { DynamicConfigParser } from '../util/dynamicConfigParser'; -export default class DestinationController { +export class DestinationController { public static async destinationTransformAtProcessor(ctx: Context) { const startTime = new Date(); logger.debug( @@ -36,7 +36,7 @@ export default class DestinationController { const integrationService = ServiceSelector.getDestinationService(events); try { integrationService.init(); - events = PreTransformationDestinationService.preProcess( + events = DestinationPreTransformationService.preProcess( events, ctx, ) as ProcessorTransformationRequest[]; @@ -59,7 +59,7 @@ export default class DestinationController { tags.FEATURES.PROCESSOR, ); metaTO.metadata = ev.metadata; - const errResp = PostTransformationDestinationService.handleProcessorTransformFailureEvents( + const errResp = DestinationPostTransformationService.handleProcessorTransformFailureEvents( error, metaTO, ); @@ -110,7 +110,7 @@ export default class DestinationController { const integrationService = ServiceSelector.getDestinationService(events); let resplist: RouterTransformationResponse[]; try { - events = PreTransformationDestinationService.preProcess(events, ctx); + events = DestinationPreTransformationService.preProcess(events, ctx); const timestampCorrectEvents = ControllerUtility.handleTimestampInEvents(events); events = DynamicConfigParser.process(timestampCorrectEvents); resplist = await integrationService.doRouterTransformation( @@ -127,7 +127,7 @@ export default class DestinationController { tags.FEATURES.ROUTER, ); metaTO.metadatas = events.map((ev) => ev.metadata); - const errResp = PostTransformationDestinationService.handleRouterTransformFailureEvents( + const errResp = DestinationPostTransformationService.handleRouterTransformFailureEvents( error, metaTO, ); @@ -165,7 +165,7 @@ export default class DestinationController { let events = routerRequest.input; const integrationService = ServiceSelector.getDestinationService(events); try { - events = PreTransformationDestinationService.preProcess(events, ctx); + events = DestinationPreTransformationService.preProcess(events, ctx); const timestampCorrectEvents = ControllerUtility.handleTimestampInEvents(events); const resplist = integrationService.doBatchTransformation( timestampCorrectEvents, @@ -182,7 +182,7 @@ export default class DestinationController { tags.FEATURES.BATCH, ); metaTO.metadatas = events.map((ev) => ev.metadata); - const errResp = PostTransformationDestinationService.handleBatchTransformFailureEvents( + const errResp = DestinationPostTransformationService.handleBatchTransformFailureEvents( error, metaTO, ); diff --git a/src/controllers/eventTest.ts b/src/controllers/eventTest.ts index 8888b63807..d5507f65d2 100644 --- a/src/controllers/eventTest.ts +++ b/src/controllers/eventTest.ts @@ -1,9 +1,9 @@ import { Context } from 'koa'; -import EventTesterService from '../services/eventTest/eventTester'; +import { EventTesterService } from '../services/eventTest/eventTester'; // eslint-disable-next-line @typescript-eslint/no-unused-vars import { CatchErr, FixMe } from '../util/types'; -export default class EventTestController { +export class EventTestController { private static API_VERSION = '1'; public static async testEvent(ctx: Context) { diff --git a/src/controllers/misc.ts b/src/controllers/misc.ts index 92ec33f80f..e2efdab5db 100644 --- a/src/controllers/misc.ts +++ b/src/controllers/misc.ts @@ -1,7 +1,7 @@ import { Context } from 'koa'; -import MiscService from '../services/misc'; +import { MiscService } from '../services/misc'; -export default class MiscController { +export class MiscController { public static healthStats(ctx: Context) { ctx.body = MiscService.getHealthInfo(); ctx.status = 200; diff --git a/src/controllers/profile.ts b/src/controllers/profile.ts index 984f4ac645..a0a62bf479 100644 --- a/src/controllers/profile.ts +++ b/src/controllers/profile.ts @@ -1,8 +1,8 @@ import { Context } from 'koa'; -import ProfileService from '../services/profile'; -import ControllerUtility from './util'; +import { ProfileService } from '../services/profile'; +import { ControllerUtility } from './util'; -export default class ProfileController { +export class ProfileController { /** * Example usage of API * diff --git a/src/controllers/regulation.ts b/src/controllers/regulation.ts index cefe1f748a..a50541780d 100644 --- a/src/controllers/regulation.ts +++ b/src/controllers/regulation.ts @@ -1,15 +1,14 @@ import { Context } from 'koa'; import logger from '../logger'; import { UserDeletionRequest, UserDeletionResponse } from '../types'; -import ServiceSelector from '../helpers/serviceSelector'; +import { ServiceSelector } from '../helpers/serviceSelector'; import tags from '../v0/util/tags'; import stats from '../util/stats'; -import PostTransformationDestinationService from '../services/destination/postTransformation'; +import { DestinationPostTransformationService } from '../services/destination/postTransformation'; // eslint-disable-next-line @typescript-eslint/no-unused-vars import { CatchErr } from '../util/types'; -// TODO: refactor this class to new format -export default class RegulationController { +export class RegulationController { public static async deleteUsers(ctx: Context) { logger.debug( 'Native(Process-Transform):: Requst to transformer::', @@ -44,7 +43,7 @@ export default class RegulationController { tags.FEATURES.USER_DELETION, ); // eslint-disable-next-line @typescript-eslint/no-unused-vars - const errResp = PostTransformationDestinationService.handleUserDeletionFailureEvents( + const errResp = DestinationPostTransformationService.handleUserDeletionFailureEvents( error, metaTO, ); diff --git a/src/controllers/source.ts b/src/controllers/source.ts index efb6dc746e..ef5483a756 100644 --- a/src/controllers/source.ts +++ b/src/controllers/source.ts @@ -1,11 +1,11 @@ import { Context } from 'koa'; -import MiscService from '../services/misc'; -import ServiceSelector from '../helpers/serviceSelector'; -import ControllerUtility from './util'; +import { MiscService } from '../services/misc'; +import { ServiceSelector } from '../helpers/serviceSelector'; +import { ControllerUtility } from './util'; import logger from '../logger'; -import PostTransformationServiceSource from '../services/source/postTransformation'; +import { SourcePostTransformationService } from '../services/source/postTransformation'; -export default class SourceController { +export class SourceController { public static async sourceTransform(ctx: Context) { logger.debug( 'Native(Source-Transform):: Request to transformer::', @@ -16,16 +16,21 @@ export default class SourceController { const { version, source }: { version: string; source: string } = ctx.params; const integrationService = ServiceSelector.getNativeSourceService(); try { - const resplist = await integrationService.sourceTransformRoutine( - events, + const { implementationVersion, input } = ControllerUtility.adaptInputToVersion( source, version, + events, + ); + const resplist = await integrationService.sourceTransformRoutine( + input, + source, + implementationVersion, requestMetadata, ); ctx.body = resplist; } catch (err: any) { const metaTO = integrationService.getTags(); - const resp = PostTransformationServiceSource.handleFailureEventsSource(err, metaTO); + const resp = SourcePostTransformationService.handleFailureEventsSource(err, metaTO); ctx.body = [resp]; } ControllerUtility.postProcess(ctx); diff --git a/src/controllers/trackingPlan.ts b/src/controllers/trackingPlan.ts index 66bf360700..74e47e0ec9 100644 --- a/src/controllers/trackingPlan.ts +++ b/src/controllers/trackingPlan.ts @@ -1,8 +1,8 @@ import { Context } from 'koa'; -import TrackingPlanservice from '../services/trackingPlan'; -import ControllerUtility from './util'; +import { TrackingPlanservice } from '../services/trackingPlan'; +import { ControllerUtility } from './util'; -export default class TrackingPlanController { +export class TrackingPlanController { public static async validateTrackingPlan(ctx: Context) { const events = ctx.request.body; const requestSize = Number(ctx.request.get('content-length')); diff --git a/src/controllers/userTransform.ts b/src/controllers/userTransform.ts index 6cbf578077..c344bd072a 100644 --- a/src/controllers/userTransform.ts +++ b/src/controllers/userTransform.ts @@ -1,15 +1,15 @@ import { Context } from 'koa'; import { ProcessorTransformationRequest, UserTransformationServiceResponse } from '../types/index'; -import UserTransformService from '../services/userTransform'; +import { UserTransformService } from '../services/userTransform'; import logger from '../logger'; import { setupUserTransformHandler, extractLibraries, validateCode, } from '../util/customTransformer'; -import ControllerUtility from './util'; +import { ControllerUtility } from './util'; -export default class UserTransformController { +export class UserTransformController { public static async transform(ctx: Context) { logger.debug( '(User transform - router:/customTransform ):: Request to transformer', diff --git a/src/controllers/util/index.test.ts b/src/controllers/util/index.test.ts new file mode 100644 index 0000000000..e23d3f6832 --- /dev/null +++ b/src/controllers/util/index.test.ts @@ -0,0 +1,149 @@ +import { ControllerUtility } from './index'; + +describe('adaptInputToVersion', () => { + it('should return the input unchanged when the implementation version is not found', () => { + const sourceType = 'NA_SOURCE'; + const requestVersion = 'v0'; + const input = [ + { key1: 'val1', key2: 'val2' }, + { key1: 'val1', key2: 'val2' }, + { key1: 'val1', key2: 'val2' }, + ]; + const expected = { + implementationVersion: undefined, + input: [ + { key1: 'val1', key2: 'val2' }, + { key1: 'val1', key2: 'val2' }, + { key1: 'val1', key2: 'val2' }, + ], + }; + + const result = ControllerUtility.adaptInputToVersion(sourceType, requestVersion, input); + + expect(result).toEqual(expected); + }); + it('should return the input unchanged when the implementation version and request version are the same i.e. v0', () => { + const sourceType = 'pipedream'; + const requestVersion = 'v0'; + const input = [ + { key1: 'val1', key2: 'val2' }, + { key1: 'val1', key2: 'val2' }, + { key1: 'val1', key2: 'val2' }, + ]; + const expected = { + implementationVersion: 'v0', + input: [ + { key1: 'val1', key2: 'val2' }, + { key1: 'val1', key2: 'val2' }, + { key1: 'val1', key2: 'val2' }, + ], + }; + + const result = ControllerUtility.adaptInputToVersion(sourceType, requestVersion, input); + + expect(result).toEqual(expected); + }); + it('should return the input unchanged when the implementation version and request version are the same i.e. v1', () => { + const sourceType = 'webhook'; + const requestVersion = 'v1'; + const input = [ + { + event: { key1: 'val1', key2: 'val2' }, + source: { id: 'source_id', config: { configField1: 'configVal1' } }, + }, + { + event: { key1: 'val1', key2: 'val2' }, + source: { id: 'source_id', config: { configField1: 'configVal1' } }, + }, + { + event: { key1: 'val1', key2: 'val2' }, + source: { id: 'source_id', config: { configField1: 'configVal1' } }, + }, + ]; + const expected = { + implementationVersion: 'v1', + input: [ + { + event: { key1: 'val1', key2: 'val2' }, + source: { id: 'source_id', config: { configField1: 'configVal1' } }, + }, + { + event: { key1: 'val1', key2: 'val2' }, + source: { id: 'source_id', config: { configField1: 'configVal1' } }, + }, + { + event: { key1: 'val1', key2: 'val2' }, + source: { id: 'source_id', config: { configField1: 'configVal1' } }, + }, + ], + }; + + const result = ControllerUtility.adaptInputToVersion(sourceType, requestVersion, input); + + expect(result).toEqual(expected); + }); + it('should convert input from v0 to v1 when the request version is v0 and the implementation version is v1', () => { + const sourceType = 'webhook'; + const requestVersion = 'v0'; + const input = [ + { key1: 'val1', key2: 'val2' }, + { key1: 'val1', key2: 'val2' }, + { key1: 'val1', key2: 'val2' }, + ]; + const expected = { + implementationVersion: 'v1', + input: [ + { event: { key1: 'val1', key2: 'val2' }, source: undefined }, + { event: { key1: 'val1', key2: 'val2' }, source: undefined }, + { event: { key1: 'val1', key2: 'val2' }, source: undefined }, + ], + }; + + const result = ControllerUtility.adaptInputToVersion(sourceType, requestVersion, input); + + expect(result).toEqual(expected); + }); + + it('should convert input from v1 to v0 format when the request version is v1 and the implementation version is v0', () => { + const sourceType = 'pipedream'; + const requestVersion = 'v1'; + const input = [ + { + event: { key1: 'val1', key2: 'val2' }, + source: { id: 'source_id', config: { configField1: 'configVal1' } }, + }, + { + event: { key1: 'val1', key2: 'val2' }, + source: { id: 'source_id', config: { configField1: 'configVal1' } }, + }, + { + event: { key1: 'val1', key2: 'val2' }, + source: { id: 'source_id', config: { configField1: 'configVal1' } }, + }, + ]; + const expected = { + implementationVersion: 'v0', + input: [ + { key1: 'val1', key2: 'val2' }, + { key1: 'val1', key2: 'val2' }, + { key1: 'val1', key2: 'val2' }, + ], + }; + + const result = ControllerUtility.adaptInputToVersion(sourceType, requestVersion, input); + + expect(result).toEqual(expected); + }); + + // Should return an empty array when the input is an empty array + it('should return an empty array when the input is an empty array', () => { + const sourceType = 'pipedream'; + const requestVersion = 'v1'; + const input = []; + const expected = { implementationVersion: 'v0', input: [] }; + + const result = ControllerUtility.adaptInputToVersion(sourceType, requestVersion, input); + + expect(result).toEqual(expected); + }); +}); diff --git a/src/controllers/util/index.ts b/src/controllers/util/index.ts index e2071968d7..75d3d8ffa7 100644 --- a/src/controllers/util/index.ts +++ b/src/controllers/util/index.ts @@ -1,3 +1,5 @@ +import fs = require('fs'); +import path = require('path'); import { Context } from 'koa'; import isEmpty from 'lodash/isEmpty'; import get from 'get-value'; @@ -7,12 +9,15 @@ import { ProcessorTransformationRequest, RouterTransformationRequestData, RudderMessage, + SourceInput, } from '../../types'; import { getValueFromMessage } from '../../v0/util'; import genericFieldMap from '../../v0/util/data/GenericFieldMapping.json'; import { EventType, MappedToDestinationKey } from '../../constants'; -export default class ControllerUtility { +export class ControllerUtility { + private static sourceVersionMap: Map = new Map(); + public static timestampValsMap: Record = { [EventType.IDENTIFY]: [ `context.${RETL_TIMESTAMP}`, @@ -23,6 +28,49 @@ export default class ControllerUtility { [EventType.TRACK]: [`properties.${RETL_TIMESTAMP}`, ...genericFieldMap.timestamp], }; + private static getSourceVersionsMap(): Map { + if (this.sourceVersionMap?.size > 0) { + return this.sourceVersionMap; + } + const versions = ['v0', 'v1']; + versions.forEach((version) => { + const files = fs.readdirSync(path.resolve(__dirname, `../../${version}/sources`), { + withFileTypes: true, + }); + const sources = files.filter((file) => file.isDirectory()).map((folder) => folder.name); + sources.forEach((source) => { + this.sourceVersionMap.set(source, version); + }); + }); + return this.sourceVersionMap; + } + + private static convertSourceInputv1Tov0(sourceEvents: SourceInput[]): NonNullable[] { + return sourceEvents.map((sourceEvent) => sourceEvent.event); + } + + private static convertSourceInputv0Tov1(sourceEvents: unknown[]): SourceInput[] { + return sourceEvents.map( + (sourceEvent) => ({ event: sourceEvent, source: undefined } as SourceInput), + ); + } + + public static adaptInputToVersion( + sourceType: string, + requestVersion: string, + input: NonNullable[], + ): { implementationVersion: string; input: NonNullable[] } { + const sourceToVersionMap = this.getSourceVersionsMap(); + const implementationVersion = sourceToVersionMap.get(sourceType); + let updatedInput: NonNullable[] = input; + if (requestVersion === 'v0' && implementationVersion === 'v1') { + updatedInput = this.convertSourceInputv0Tov1(input); + } else if (requestVersion === 'v1' && implementationVersion === 'v0') { + updatedInput = this.convertSourceInputv1Tov0(input as SourceInput[]); + } + return { implementationVersion, input: updatedInput }; + } + private static getCompatibleStatusCode(status: number): number { return getCompatibleStatusCode(status); } diff --git a/src/features.json b/src/features.json index 9793f667e3..23c01c3731 100644 --- a/src/features.json +++ b/src/features.json @@ -25,6 +25,7 @@ "PINTEREST_TAG": true, "PROFITWELL": true, "SALESFORCE": true, + "SALESFORCE_OAUTH": true, "SFMC": true, "SNAPCHAT_CONVERSION": true, "TIKTOK_ADS": true, @@ -59,7 +60,10 @@ "TWITTER_ADS": true, "CLEVERTAP": true, "ORTTO": true, + "GLADLY": true, "ONE_SIGNAL": true, "TIKTOK_AUDIENCE": true - } + }, + "supportSourceTransformV1": true, + "transformerProxyV1": true } diff --git a/src/helpers/fetchHandlers.ts b/src/helpers/fetchHandlers.ts index 96a74e528d..ef7d9e6611 100644 --- a/src/helpers/fetchHandlers.ts +++ b/src/helpers/fetchHandlers.ts @@ -1,6 +1,6 @@ -import MiscService from '../services/misc'; +import { MiscService } from '../services/misc'; -export default class FetchHandler { +export class FetchHandler { private static sourceHandlerMap: Map = new Map(); private static destHandlerMap: Map = new Map(); diff --git a/src/helpers/serviceSelector.ts b/src/helpers/serviceSelector.ts index bac1a17c16..89678e9407 100644 --- a/src/helpers/serviceSelector.ts +++ b/src/helpers/serviceSelector.ts @@ -1,16 +1,16 @@ +import { PlatformError } from '@rudderstack/integrations-lib'; import { ProcessorTransformationRequest, RouterTransformationRequestData } from '../types/index'; import { INTEGRATION_SERVICE } from '../routes/utils/constants'; -import CDKV1DestinationService from '../services/destination/cdkV1Integration'; -import CDKV2DestinationService from '../services/destination/cdkV2Integration'; -import DestinationService from '../interfaces/DestinationService'; -import NativeIntegrationDestinationService from '../services/destination/nativeIntegration'; -import SourceService from '../interfaces/SourceService'; -import NativeIntegrationSourceService from '../services/source/nativeIntegration'; -import { PlatformError } from '../v0/util/errorTypes'; -import ComparatorService from '../services/comparator'; +import { CDKV1DestinationService } from '../services/destination/cdkV1Integration'; +import { CDKV2DestinationService } from '../services/destination/cdkV2Integration'; +import { DestinationService } from '../interfaces/DestinationService'; +import { NativeIntegrationDestinationService } from '../services/destination/nativeIntegration'; +import { SourceService } from '../interfaces/SourceService'; +import { NativeIntegrationSourceService } from '../services/source/nativeIntegration'; +import { ComparatorService } from '../services/comparator'; import { FixMe } from '../util/types'; -export default class ServiceSelector { +export class ServiceSelector { private static serviceMap: Map = new Map(); private static services = { diff --git a/src/index.ts b/src/index.ts index d1cc95cc36..36f32f1aed 100644 --- a/src/index.ts +++ b/src/index.ts @@ -4,8 +4,6 @@ import gracefulShutdown from 'http-graceful-shutdown'; import dotenv from 'dotenv'; import logger from './logger'; import cluster from './util/cluster'; -import { router } from './legacy/router'; -import { testRouter } from './testRouter'; import { metricsRouter } from './routes/metricsRouter'; import { addStatMiddleware, addRequestSizeMiddleware, initPyroscope } from './middleware'; import { logProcessInfo } from './util/utils'; @@ -14,7 +12,6 @@ import { RedisDB } from './util/redis/redisConnector'; dotenv.config(); const clusterEnabled = process.env.CLUSTER_ENABLED !== 'false'; -const useUpdatedRoutes = process.env.ENABLE_NEW_ROUTES !== 'false'; const port = parseInt(process.env.PORT ?? '9090', 10); const metricsPort = parseInt(process.env.METRICS_PORT || '9091', 10); @@ -35,15 +32,8 @@ app.use( addRequestSizeMiddleware(app); addSwaggerRoutes(app); -if (useUpdatedRoutes) { - logger.info('Using new routes'); - applicationRoutes(app); -} else { - // To be depricated - logger.info('Using old routes'); - app.use(router.routes()).use(router.allowedMethods()); - app.use(testRouter.routes()).use(testRouter.allowedMethods()); -} +logger.info('Using new routes'); +applicationRoutes(app); function finalFunction() { RedisDB.disconnect(); diff --git a/src/interfaces/DestinationService.ts b/src/interfaces/DestinationService.ts index 123da35292..16f6b9349c 100644 --- a/src/interfaces/DestinationService.ts +++ b/src/interfaces/DestinationService.ts @@ -10,7 +10,7 @@ import { UserDeletionResponse, } from '../types/index'; -export default interface DestinationService { +export interface DestinationService { getName(): string; init(): void; @@ -47,6 +47,7 @@ export default interface DestinationService { event: ProcessorTransformationOutput, destinationType: string, requestMetadata: NonNullable, + version: string, ): Promise; processUserDeletion( diff --git a/src/interfaces/SourceService.ts b/src/interfaces/SourceService.ts index 99b29f095b..c7de8cfe8b 100644 --- a/src/interfaces/SourceService.ts +++ b/src/interfaces/SourceService.ts @@ -1,6 +1,6 @@ import { MetaTransferObject, SourceTransformationResponse } from '../types/index'; -export default interface SourceService { +export interface SourceService { getTags(): MetaTransferObject; sourceTransformRoutine( diff --git a/src/legacy/router.js b/src/legacy/router.js index 99fb8570fb..f8deb3fe62 100644 --- a/src/legacy/router.js +++ b/src/legacy/router.js @@ -7,6 +7,7 @@ const Router = require('@koa/router'); const lodash = require('lodash'); const fs = require('fs'); const path = require('path'); +const { PlatformError } = require('@rudderstack/integrations-lib'); const logger = require('../logger'); const stats = require('../util/stats'); const { SUPPORTED_VERSIONS, API_VERSION } = require('../routes/utils/constants'); @@ -35,7 +36,6 @@ const { sendViolationMetrics, constructValidationErrors, } = require('../util/utils'); -const { PlatformError } = require('../v0/util/errorTypes'); const { processCdkV1 } = require('../cdk/v1/handler'); const { extractLibraries } = require('../util/customTransformer'); const { getCompatibleStatusCode } = require('../adapters/utils/networkUtils'); diff --git a/src/middlewares/featureFlag.ts b/src/middlewares/featureFlag.ts index 146e57186c..206fa7c5ea 100644 --- a/src/middlewares/featureFlag.ts +++ b/src/middlewares/featureFlag.ts @@ -6,7 +6,7 @@ export interface FeatureFlags { export const FEATURE_FILTER_CODE = 'filter-code'; -export default class FeatureFlagMiddleware { +export class FeatureFlagMiddleware { public static async handle(ctx: Context, next: Next): Promise { // Initialize ctx.state.features if it doesn't exist ctx.state.features = (ctx.state.features || {}) as FeatureFlags; diff --git a/src/middlewares/routeActivation.ts b/src/middlewares/routeActivation.ts index dfdaef964e..ffb1e15e80 100644 --- a/src/middlewares/routeActivation.ts +++ b/src/middlewares/routeActivation.ts @@ -18,7 +18,7 @@ const destinationFilterList = process.env.DESTINATION_FILTER_LIST?.toLocaleLower const sourceFilteList = process.env.SOURCE_FILTER_LIST?.toLocaleLowerCase(); const deliveryFilterList = process.env.DESTINATION_DELIVERY_FILTER_LIST?.toLocaleLowerCase(); -export default class RouteActivationMiddleware { +export class RouteActivationMiddleware { private static executeActivationRule(ctx: Context, next: Next, shouldActivate: boolean) { if (shouldActivate) { return next(); diff --git a/src/routes/delivery.ts b/src/routes/delivery.ts index 141700fd9f..0591dc8b9e 100644 --- a/src/routes/delivery.ts +++ b/src/routes/delivery.ts @@ -1,6 +1,6 @@ import Router from '@koa/router'; -import DeliveryController from '../controllers/delivery'; -import RouteActivationMiddleware from '../middlewares/routeActivation'; +import { DeliveryController } from '../controllers/delivery'; +import { RouteActivationMiddleware } from '../middlewares/routeActivation'; const router = new Router(); diff --git a/src/routes/destination.ts b/src/routes/destination.ts index 3d4be42ff3..1c47825145 100644 --- a/src/routes/destination.ts +++ b/src/routes/destination.ts @@ -1,30 +1,30 @@ import Router from '@koa/router'; -import DestinationController from '../controllers/destination'; -import RegulationController from '../controllers/regulation'; -import FeatureFlagController from '../middlewares/featureFlag'; -import RouteActivationController from '../middlewares/routeActivation'; +import { DestinationController } from '../controllers/destination'; +import { RegulationController } from '../controllers/regulation'; +import { FeatureFlagMiddleware } from '../middlewares/featureFlag'; +import { RouteActivationMiddleware } from '../middlewares/routeActivation'; const router = new Router(); router.post( '/:version/destinations/:destination', - RouteActivationController.isDestinationRouteActive, - RouteActivationController.destinationProcFilter, - FeatureFlagController.handle, + RouteActivationMiddleware.isDestinationRouteActive, + RouteActivationMiddleware.destinationProcFilter, + FeatureFlagMiddleware.handle, DestinationController.destinationTransformAtProcessor, ); router.post( '/routerTransform', - RouteActivationController.isDestinationRouteActive, - RouteActivationController.destinationRtFilter, - FeatureFlagController.handle, + RouteActivationMiddleware.isDestinationRouteActive, + RouteActivationMiddleware.destinationRtFilter, + FeatureFlagMiddleware.handle, DestinationController.destinationTransformAtRouter, ); router.post( '/batch', - RouteActivationController.isDestinationRouteActive, - RouteActivationController.destinationBatchFilter, - FeatureFlagController.handle, + RouteActivationMiddleware.isDestinationRouteActive, + RouteActivationMiddleware.destinationBatchFilter, + FeatureFlagMiddleware.handle, DestinationController.batchProcess, ); diff --git a/src/routes/misc.ts b/src/routes/misc.ts index 750c1194dd..4d1c5d5fb5 100644 --- a/src/routes/misc.ts +++ b/src/routes/misc.ts @@ -1,6 +1,6 @@ import Router from '@koa/router'; -import ProfileController from '../controllers/profile'; -import MiscController from '../controllers/misc'; +import { ProfileController } from '../controllers/profile'; +import { MiscController } from '../controllers/misc'; const router = new Router(); diff --git a/src/routes/source.ts b/src/routes/source.ts index ade26c8700..1abc46e2e4 100644 --- a/src/routes/source.ts +++ b/src/routes/source.ts @@ -1,13 +1,13 @@ import Router from '@koa/router'; -import RouteActivationController from '../middlewares/routeActivation'; -import SourceController from '../controllers/source'; +import { RouteActivationMiddleware } from '../middlewares/routeActivation'; +import { SourceController } from '../controllers/source'; const router = new Router(); router.post( '/:version/sources/:source', - RouteActivationController.isSourceRouteActive, - RouteActivationController.sourceFilter, + RouteActivationMiddleware.isSourceRouteActive, + RouteActivationMiddleware.sourceFilter, SourceController.sourceTransform, ); diff --git a/src/routes/testEvents.ts b/src/routes/testEvents.ts index 556ec10198..a35fe447ba 100644 --- a/src/routes/testEvents.ts +++ b/src/routes/testEvents.ts @@ -1,5 +1,5 @@ import Router from '@koa/router'; -import EventTestController from '../controllers/eventTest'; +import { EventTestController } from '../controllers/eventTest'; const router = new Router({ prefix: '/test-router' }); diff --git a/src/routes/trackingPlan.ts b/src/routes/trackingPlan.ts index d177af7b2c..3e62ba2a74 100644 --- a/src/routes/trackingPlan.ts +++ b/src/routes/trackingPlan.ts @@ -1,5 +1,5 @@ import Router from '@koa/router'; -import TrackingPlanController from '../controllers/trackingPlan'; +import { TrackingPlanController } from '../controllers/trackingPlan'; const router = new Router(); diff --git a/src/routes/userTransform.ts b/src/routes/userTransform.ts index 23870db3b4..1fb8ad3a1c 100644 --- a/src/routes/userTransform.ts +++ b/src/routes/userTransform.ts @@ -1,34 +1,34 @@ import Router from '@koa/router'; -import RouteActivationController from '../middlewares/routeActivation'; -import FeatureFlagController from '../middlewares/featureFlag'; -import UserTransformController from '../controllers/userTransform'; +import { RouteActivationMiddleware } from '../middlewares/routeActivation'; +import { FeatureFlagMiddleware } from '../middlewares/featureFlag'; +import { UserTransformController } from '../controllers/userTransform'; const router = new Router(); router.post( '/customTransform', - RouteActivationController.isUserTransformRouteActive, - FeatureFlagController.handle, + RouteActivationMiddleware.isUserTransformRouteActive, + FeatureFlagMiddleware.handle, UserTransformController.transform, ); router.post( '/transformation/test', - RouteActivationController.isUserTransformTestRouteActive, + RouteActivationMiddleware.isUserTransformTestRouteActive, UserTransformController.testTransform, ); router.post( '/transformationLibrary/test', - RouteActivationController.isUserTransformTestRouteActive, + RouteActivationMiddleware.isUserTransformTestRouteActive, UserTransformController.testTransformLibrary, ); router.post( '/transformation/sethandle', - RouteActivationController.isUserTransformTestRouteActive, + RouteActivationMiddleware.isUserTransformTestRouteActive, UserTransformController.testTransformSethandle, ); router.post( '/extractLibs', - RouteActivationController.isUserTransformRouteActive, + RouteActivationMiddleware.isUserTransformRouteActive, UserTransformController.extractLibhandle, ); diff --git a/src/routes/utils/constants.js b/src/routes/utils/constants.js index f074db6c62..ccec8e54dd 100644 --- a/src/routes/utils/constants.js +++ b/src/routes/utils/constants.js @@ -1,4 +1,4 @@ -const SUPPORTED_VERSIONS = ['v0']; +const SUPPORTED_VERSIONS = ['v0', 'v1']; const API_VERSION = '2'; const INTEGRATION_SERVICE = { COMPARATOR: 'comparator', @@ -7,8 +7,8 @@ const INTEGRATION_SERVICE = { NATIVE_DEST: 'native_dest', NATIVE_SOURCE: 'native_source', }; -const CHANNELS= { - sources: 'sources' +const CHANNELS = { + sources: 'sources', }; const RETL_TIMESTAMP = 'timestamp'; diff --git a/src/services/comparator.ts b/src/services/comparator.ts index 3495b7bbfd..58c96beabb 100644 --- a/src/services/comparator.ts +++ b/src/services/comparator.ts @@ -1,5 +1,5 @@ /* eslint-disable class-methods-use-this */ -import IntegrationDestinationService from '../interfaces/DestinationService'; +import { DestinationService } from '../interfaces/DestinationService'; import { DeliveryResponse, Destination, @@ -20,15 +20,12 @@ import { CommonUtils } from '../util/common'; const NS_PER_SEC = 1e9; -export default class ComparatorService implements IntegrationDestinationService { - secondaryService: IntegrationDestinationService; +export class ComparatorService implements DestinationService { + secondaryService: DestinationService; - primaryService: IntegrationDestinationService; + primaryService: DestinationService; - constructor( - primaryService: IntegrationDestinationService, - secondaryService: IntegrationDestinationService, - ) { + constructor(primaryService: DestinationService, secondaryService: DestinationService) { this.primaryService = primaryService; this.secondaryService = secondaryService; } @@ -371,11 +368,13 @@ export default class ComparatorService implements IntegrationDestinationService event: ProcessorTransformationOutput, destinationType: string, requestMetadata: NonNullable, + version: string, ): Promise { const primaryResplist = await this.primaryService.deliver( event, destinationType, requestMetadata, + version, ); logger.error('[LIVE_COMPARE_TEST] not implemented for delivery routine'); diff --git a/src/services/delivertTest/deliveryTest.ts b/src/services/delivertTest/deliveryTest.ts index e5713073c1..0d960ade17 100644 --- a/src/services/delivertTest/deliveryTest.ts +++ b/src/services/delivertTest/deliveryTest.ts @@ -7,7 +7,7 @@ import stats from '../../util/stats'; import logger from '../../logger'; import tags from '../../v0/util/tags'; -export default class DeliveryTestService { +export class DeliveryTestService { public static async doTestDelivery( destination: string, routerDestReqPayload: any, diff --git a/src/services/destination/cdkV1Integration.ts b/src/services/destination/cdkV1Integration.ts index a016665afb..8ccd3341e5 100644 --- a/src/services/destination/cdkV1Integration.ts +++ b/src/services/destination/cdkV1Integration.ts @@ -1,7 +1,8 @@ /* eslint-disable @typescript-eslint/no-unused-vars */ import { ConfigFactory, Executor, RudderBaseConfig } from 'rudder-transformer-cdk'; import path from 'path'; -import IntegrationDestinationService from '../../interfaces/DestinationService'; +import { TransformationError } from '@rudderstack/integrations-lib'; +import { DestinationService } from '../../interfaces/DestinationService'; import { DeliveryResponse, ErrorDetailer, @@ -14,13 +15,12 @@ import { UserDeletionRequest, UserDeletionResponse, } from '../../types/index'; -import { TransformationError } from '../../v0/util/errorTypes'; -import DestinationPostTransformationService from './postTransformation'; +import { DestinationPostTransformationService } from './postTransformation'; import tags from '../../v0/util/tags'; import { getErrorInfo } from '../../cdk/v1/handler'; import { CatchErr } from '../../util/types'; -export default class CDKV1DestinationService implements IntegrationDestinationService { +export class CDKV1DestinationService implements DestinationService { public init() { ConfigFactory.init({ basePath: path.resolve(__dirname, '../../cdk/v1'), diff --git a/src/services/destination/cdkV2Integration.ts b/src/services/destination/cdkV2Integration.ts index b4c0a15e87..67295e85f1 100644 --- a/src/services/destination/cdkV2Integration.ts +++ b/src/services/destination/cdkV2Integration.ts @@ -1,8 +1,9 @@ /* eslint-disable @typescript-eslint/no-unused-vars */ /* eslint-disable class-methods-use-this */ import groupBy from 'lodash/groupBy'; +import { TransformationError } from '@rudderstack/integrations-lib'; import { processCdkV2Workflow } from '../../cdk/v2/handler'; -import IntegrationDestinationService from '../../interfaces/DestinationService'; +import { DestinationService } from '../../interfaces/DestinationService'; import { DeliveryResponse, ErrorDetailer, @@ -15,13 +16,12 @@ import { UserDeletionRequest, UserDeletionResponse, } from '../../types/index'; -import { TransformationError } from '../../v0/util/errorTypes'; import tags from '../../v0/util/tags'; -import DestinationPostTransformationService from './postTransformation'; +import { DestinationPostTransformationService } from './postTransformation'; import stats from '../../util/stats'; import { CatchErr } from '../../util/types'; -export default class CDKV2DestinationService implements IntegrationDestinationService { +export class CDKV2DestinationService implements DestinationService { public init() {} public getName(): string { @@ -52,7 +52,7 @@ export default class CDKV2DestinationService implements IntegrationDestinationSe events: ProcessorTransformationRequest[], destinationType: string, _version: string, - _requestMetadata: NonNullable, + requestMetadata: NonNullable, ): Promise { // TODO: Change the promise type const respList: ProcessorTransformationResponse[][] = await Promise.all( @@ -64,6 +64,7 @@ export default class CDKV2DestinationService implements IntegrationDestinationSe destinationType, event, tags.FEATURES.PROCESSOR, + requestMetadata, ); stats.increment('event_transform_success', { @@ -108,7 +109,7 @@ export default class CDKV2DestinationService implements IntegrationDestinationSe events: RouterTransformationRequestData[], destinationType: string, _version: string, - _requestMetadata: NonNullable, + requestMetadata: NonNullable, ): Promise { const allDestEvents: object = groupBy( events, @@ -126,7 +127,12 @@ export default class CDKV2DestinationService implements IntegrationDestinationSe metaTo.metadata = destInputArray[0].metadata; try { const doRouterTransformationResponse: RouterTransformationResponse[] = - await processCdkV2Workflow(destinationType, destInputArray, tags.FEATURES.ROUTER); + await processCdkV2Workflow( + destinationType, + destInputArray, + tags.FEATURES.ROUTER, + requestMetadata, + ); return DestinationPostTransformationService.handleRouterTransformSuccessEvents( doRouterTransformationResponse, undefined, diff --git a/src/services/destination/nativeIntegration.ts b/src/services/destination/nativeIntegration.ts index a788b388e4..510fa80362 100644 --- a/src/services/destination/nativeIntegration.ts +++ b/src/services/destination/nativeIntegration.ts @@ -1,7 +1,7 @@ /* eslint-disable @typescript-eslint/no-unused-vars */ import groupBy from 'lodash/groupBy'; import cloneDeep from 'lodash/cloneDeep'; -import IntegrationDestinationService from '../../interfaces/DestinationService'; +import { DestinationService } from '../../interfaces/DestinationService'; import { DeliveryResponse, ErrorDetailer, @@ -14,12 +14,12 @@ import { UserDeletionRequest, UserDeletionResponse, } from '../../types/index'; -import DestinationPostTransformationService from './postTransformation'; +import { DestinationPostTransformationService } from './postTransformation'; import networkHandlerFactory from '../../adapters/networkHandlerFactory'; -import FetchHandler from '../../helpers/fetchHandlers'; +import { FetchHandler } from '../../helpers/fetchHandlers'; import tags from '../../v0/util/tags'; -export default class NativeIntegrationDestinationService implements IntegrationDestinationService { +export class NativeIntegrationDestinationService implements DestinationService { public init() {} public getName(): string { @@ -172,9 +172,10 @@ export default class NativeIntegrationDestinationService implements IntegrationD destinationRequest: ProcessorTransformationOutput, destinationType: string, _requestMetadata: NonNullable, + version: string, ): Promise { try { - const networkHandler = networkHandlerFactory.getNetworkHandler(destinationType); + const networkHandler = networkHandlerFactory.getNetworkHandler(destinationType, version); const rawProxyResponse = await networkHandler.proxy(destinationRequest, destinationType); const processedProxyResponse = networkHandler.processAxiosResponse(rawProxyResponse); return networkHandler.responseHandler( diff --git a/src/services/destination/postTransformation.ts b/src/services/destination/postTransformation.ts index 090e39b059..1e99961045 100644 --- a/src/services/destination/postTransformation.ts +++ b/src/services/destination/postTransformation.ts @@ -12,11 +12,20 @@ import { UserDeletionResponse, } from '../../types/index'; import { generateErrorObject } from '../../v0/util'; -import ErrorReportingService from '../errorReporting'; +import { ErrorReportingService } from '../errorReporting'; import tags from '../../v0/util/tags'; import stats from '../../util/stats'; -export default class DestinationPostTransformationService { +type ErrorResponse = { + status?: number; + message?: string; + destinationResponse?: object; + statTags?: object; + authErrorCategory?: string | undefined; + response?: object | undefined; +}; + +export class DestinationPostTransformationService { public static handleProcessorTransformSucessEvents( event: ProcessorTransformationRequest, transformedPayloads: ProcessorTransformationOutput | ProcessorTransformationOutput[], @@ -139,7 +148,7 @@ export default class DestinationPostTransformationService { } public static handleDeliveryFailureEvents( - error: NonNullable, + error: ErrorResponse, metaTo: MetaTransferObject, ): DeliveryResponse { const errObj = generateErrorObject(error, metaTo.errorDetails, false); @@ -152,6 +161,12 @@ export default class DestinationPostTransformationService { authErrorCategory: errObj.authErrorCategory, }), } as DeliveryResponse; + + // for transformer-proxy to maintain contract + const { response } = error; + if (response) { + resp.response = response; + } ErrorReportingService.reportError(error, metaTo.errorContext, resp); return resp; } diff --git a/src/services/destination/preTransformation.ts b/src/services/destination/preTransformation.ts index dd5579b7b9..db1d76d64e 100644 --- a/src/services/destination/preTransformation.ts +++ b/src/services/destination/preTransformation.ts @@ -1,7 +1,7 @@ import { Context } from 'koa'; import { ProcessorTransformationRequest, RouterTransformationRequestData } from '../../types/index'; -export default class PreTransformationDestinationService { +export class DestinationPreTransformationService { public static preProcess( events: ProcessorTransformationRequest[] | RouterTransformationRequestData[], ctx: Context, diff --git a/src/services/errorReporting.ts b/src/services/errorReporting.ts index 2d3c84ff30..3a4276f978 100644 --- a/src/services/errorReporting.ts +++ b/src/services/errorReporting.ts @@ -1,6 +1,6 @@ import { client } from '../util/errorNotifier'; -export default class ErrorReportingService { +export class ErrorReportingService { public static reportError(error: NonNullable, context: string, errorResp: object) { client.notify(error, context, { ...errorResp, diff --git a/src/services/eventTest/eventTester.ts b/src/services/eventTest/eventTester.ts index a3755d3e80..75df29cc63 100644 --- a/src/services/eventTest/eventTester.ts +++ b/src/services/eventTest/eventTester.ts @@ -1,7 +1,7 @@ import { sendToDestination, userTransformHandler } from '../../routerUtils'; import { FixMe } from '../../util/types'; -export default class EventTesterService { +export class EventTesterService { private static getDestHandler(version, destination) { // eslint-disable-next-line global-require, import/no-dynamic-require return require(`../../${version}/destinations/${destination}/transform`); diff --git a/src/services/misc.ts b/src/services/misc.ts index 4c3e2ae6da..e0953d08bf 100644 --- a/src/services/misc.ts +++ b/src/services/misc.ts @@ -6,7 +6,7 @@ import { DestHandlerMap } from '../constants/destinationCanonicalNames'; import { Metadata } from '../types'; import { getCPUProfile, getHeapProfile } from '../middleware'; -export default class MiscService { +export class MiscService { public static getDestHandler(dest: string, version: string) { if (DestHandlerMap.hasOwnProperty(dest)) { return require(`../${version}/destinations/${DestHandlerMap[dest]}/transform`); diff --git a/src/services/profile.ts b/src/services/profile.ts index 4d7a7104e7..d71826e251 100644 --- a/src/services/profile.ts +++ b/src/services/profile.ts @@ -22,7 +22,7 @@ logger.info(`Interval Bytes set: ${intervalBytes}`); heap.start(intervalBytes, stackDepth); -export default class ProfileService { +export class ProfileService { private static async promisifiedRead(readable: any) { // eslint-disable-next-line no-new new Promise((resolve, reject) => { diff --git a/src/services/source/nativeIntegration.ts b/src/services/source/nativeIntegration.ts index f29d68d054..6eaef2f835 100644 --- a/src/services/source/nativeIntegration.ts +++ b/src/services/source/nativeIntegration.ts @@ -1,4 +1,4 @@ -import IntegrationSourceService from '../../interfaces/SourceService'; +import { SourceService } from '../../interfaces/SourceService'; import { ErrorDetailer, MetaTransferObject, @@ -6,12 +6,12 @@ import { SourceTransformationResponse, } from '../../types/index'; import { FixMe } from '../../util/types'; -import PostTransformationServiceSource from './postTransformation'; -import FetchHandler from '../../helpers/fetchHandlers'; +import { SourcePostTransformationService } from './postTransformation'; +import { FetchHandler } from '../../helpers/fetchHandlers'; import tags from '../../v0/util/tags'; import stats from '../../util/stats'; -export default class NativeIntegrationSourceService implements IntegrationSourceService { +export class NativeIntegrationSourceService implements SourceService { public getTags(): MetaTransferObject { const metaTO = { errorDetails: { @@ -38,14 +38,14 @@ export default class NativeIntegrationSourceService implements IntegrationSource try { const respEvents: RudderMessage | RudderMessage[] | SourceTransformationResponse = await sourceHandler.process(sourceEvent); - return PostTransformationServiceSource.handleSuccessEventsSource(respEvents); + return SourcePostTransformationService.handleSuccessEventsSource(respEvents); } catch (error: FixMe) { const metaTO = this.getTags(); stats.increment('source_transform_errors', { - sourceType, + source: sourceType, version, }); - return PostTransformationServiceSource.handleFailureEventsSource(error, metaTO); + return SourcePostTransformationService.handleFailureEventsSource(error, metaTO); } }), ); diff --git a/src/services/source/postTransformation.ts b/src/services/source/postTransformation.ts index f732cac3a7..20c815171b 100644 --- a/src/services/source/postTransformation.ts +++ b/src/services/source/postTransformation.ts @@ -1,9 +1,9 @@ import { MetaTransferObject, RudderMessage, SourceTransformationResponse } from '../../types/index'; import { CatchErr } from '../../util/types'; import { generateErrorObject } from '../../v0/util'; -import ErrorReportingService from '../errorReporting'; +import { ErrorReportingService } from '../errorReporting'; -export default class PostTransformationSourceService { +export class SourcePostTransformationService { public static handleFailureEventsSource( error: CatchErr, metaTO: MetaTransferObject, diff --git a/src/services/trackingPlan.ts b/src/services/trackingPlan.ts index 35f21320a5..2e68df55e9 100644 --- a/src/services/trackingPlan.ts +++ b/src/services/trackingPlan.ts @@ -4,7 +4,7 @@ import { getMetadata } from '../v0/util'; import eventValidator from '../util/eventValidation'; import stats from '../util/stats'; -export default class TrackingPlanservice { +export class TrackingPlanservice { public static async validateTrackingPlan(events, requestSize, reqParams) { const requestStartTime = new Date(); const respList: any[] = []; diff --git a/src/services/userTransform.ts b/src/services/userTransform.ts index 4fe1ad0b52..ddd5c82f67 100644 --- a/src/services/userTransform.ts +++ b/src/services/userTransform.ts @@ -24,7 +24,7 @@ import { CatchErr, FixMe } from '../util/types'; import { FeatureFlags, FEATURE_FILTER_CODE } from '../middlewares/featureFlag'; import { HTTP_CUSTOM_STATUS_CODES } from '../constants'; -export default class UserTransformService { +export class UserTransformService { public static async transformRoutine( events: ProcessorTransformationRequest[], features: FeatureFlags = {}, diff --git a/src/types/index.ts b/src/types/index.ts index 79efaecb40..7a23132173 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -140,6 +140,7 @@ type DeliveryResponse = { destinationResponse: any; statTags: object; authErrorCategory?: string; + response?: object; }; enum MessageType { @@ -224,7 +225,34 @@ type ComparatorInput = { requestMetadata: object; feature: string; }; +type SourceDefinition = { + ID: string; + Name: string; + Category: string; + Type: string; +}; + +type Source = { + ID: string; + OriginalID: string; + Name: string; + SourceDefinition: SourceDefinition; + Config: object; + Enabled: boolean; + WorkspaceID: string; + WriteKey: string; + Transformations?: UserTransformationInput[]; + RevisionID?: string; + Destinations?: Destination[]; + Transient: boolean; + EventSchemasEnabled: boolean; + DgSourceTrackingPlanConfig: object; +}; +type SourceInput = { + event: NonNullable[]; + source?: Source; +}; export { Metadata, MessageIdMetadataMap, @@ -246,4 +274,6 @@ export { UserDeletionResponse, Destination, ComparatorInput, + SourceInput, + Source, }; diff --git a/src/util/dynamicConfigParser.ts b/src/util/dynamicConfigParser.ts index 73ad85a0d2..6de2e38f94 100644 --- a/src/util/dynamicConfigParser.ts +++ b/src/util/dynamicConfigParser.ts @@ -6,7 +6,7 @@ import { FixMe } from './types'; const get = require('get-value'); const unset = require('unset-value'); -export default class DynamicConfigParser { +export class DynamicConfigParser { private static getDynamicConfigValue( event: ProcessorTransformationRequest | RouterTransformationRequestData, value: FixMe, diff --git a/src/util/errorNotifier/bugsnag.js b/src/util/errorNotifier/bugsnag.js index a88432f23d..ef01c58730 100644 --- a/src/util/errorNotifier/bugsnag.js +++ b/src/util/errorNotifier/bugsnag.js @@ -5,9 +5,6 @@ const { DataValidationError, } = require('rudder-transformer-cdk/build/error/index'); const stackTraceParser = require('stacktrace-parser'); -const { logger } = require('../../logger'); -const pkg = require('../../../package.json'); - const { BaseError, TransformationError, @@ -23,8 +20,10 @@ const { UnhandledStatusCodeError, UnauthorizedError, NetworkInstrumentationError, - FilteredEventsError, -} = require('../../v0/util/errorTypes'); +} = require('@rudderstack/integrations-lib'); +const { FilteredEventsError } = require('../../v0/util/errorTypes'); +const { logger } = require('../../logger'); +const pkg = require('../../../package.json'); const { BUGSNAG_API_KEY: apiKey, diff --git a/src/util/openfaas/index.js b/src/util/openfaas/index.js index 47a69aeb18..878fa706d9 100644 --- a/src/util/openfaas/index.js +++ b/src/util/openfaas/index.js @@ -247,24 +247,13 @@ const executeFaasFunction = async ( try { if (testMode) await awaitFunctionReadiness(name); return await invokeFunction(name, events); - } catch (error) { logger.error(`Error while invoking ${name}: ${error.message}`); errorRaised = error; - if ( - error.statusCode === 404 && - error.message.includes(`error finding function ${name}`) - ) { + if (error.statusCode === 404 && error.message.includes(`error finding function ${name}`)) { removeFunctionFromCache(name); - await setupFaasFunction( - name, - null, - versionId, - libraryVersionIDs, - testMode, - trMetadata, - ); + await setupFaasFunction(name, null, versionId, libraryVersionIDs, testMode, trMetadata); throw new RetryRequestError(`${name} not found`); } @@ -277,29 +266,30 @@ const executeFaasFunction = async ( } if (error.statusCode === 504) { - throw new RespStatusError(`${name} timed out`); + throw new RespStatusError(`${name} timed out`, 504); } throw error; } finally { // delete the function created, if it's called as part of testMode if (testMode) { - deleteFunction(name).catch((err) => - logger.error(`[Faas] Error while deleting ${name}: ${err.message}`)) + deleteFunction(name).catch((err) => + logger.error(`[Faas] Error while deleting ${name}: ${err.message}`), + ); } // setup the tags for observability and then fire the stats const tags = { - identifier: "openfaas", + identifier: 'openfaas', testMode: testMode, errored: errorRaised ? true : false, statusCode: errorRaised ? errorRaised.statusCode : HTTP_STATUS_CODES.OK, // default statuscode is 200OK - ...events.length && events[0].metadata ? getMetadata(events[0].metadata) : {}, - ...events.length && events[0].metadata ? getTransformationMetadata(events[0].metadata) : {}, - } + ...(events.length && events[0].metadata ? getMetadata(events[0].metadata) : {}), + ...(events.length && events[0].metadata ? getTransformationMetadata(events[0].metadata) : {}), + }; - stats.counter('user_transform_function_input_events', events.length, tags) - stats.timing('user_transform_function_latency', startTime, tags) + stats.counter('user_transform_function_input_events', events.length, tags); + stats.timing('user_transform_function_latency', startTime, tags); } }; diff --git a/src/util/redis/redisConnector.js b/src/util/redis/redisConnector.js index 749e23ff83..84d578d3b3 100644 --- a/src/util/redis/redisConnector.js +++ b/src/util/redis/redisConnector.js @@ -1,5 +1,5 @@ const Redis = require('ioredis'); -const { RedisError } = require('../../v0/util/errorTypes'); +const { RedisError } = require('@rudderstack/integrations-lib'); const log = require('../../logger'); const stats = require('../stats'); diff --git a/src/v0/destinations/active_campaign/transform.js b/src/v0/destinations/active_campaign/transform.js index 9c6643ebc3..e00808622d 100644 --- a/src/v0/destinations/active_campaign/transform.js +++ b/src/v0/destinations/active_campaign/transform.js @@ -1,6 +1,11 @@ /* eslint-disable array-callback-return */ /* eslint-disable no-empty */ const get = require('get-value'); +const { + InstrumentationError, + TransformationError, + NetworkError, +} = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { CONFIG_CATEGORIES, MAPPING_CONFIG, getHeader } = require('./config'); const { @@ -12,11 +17,6 @@ const { } = require('../../util'); const { errorHandler } = require('./util'); const { httpGET, httpPOST } = require('../../../adapters/network'); -const { - InstrumentationError, - TransformationError, - NetworkError, -} = require('../../util/errorTypes'); const { getDynamicErrorType } = require('../../../adapters/utils/networkUtils'); const tags = require('../../util/tags'); diff --git a/src/v0/destinations/active_campaign/util.js b/src/v0/destinations/active_campaign/util.js index c508618336..6e1f5a3683 100644 --- a/src/v0/destinations/active_campaign/util.js +++ b/src/v0/destinations/active_campaign/util.js @@ -1,8 +1,8 @@ +const { NetworkError } = require('@rudderstack/integrations-lib'); const { nodeSysErrorToStatus, getDynamicErrorType, } = require('../../../adapters/utils/networkUtils'); -const { NetworkError } = require('../../util/errorTypes'); const tags = require('../../util/tags'); const errorHandler = (err, message) => { diff --git a/src/v0/destinations/adj/transform.js b/src/v0/destinations/adj/transform.js index 695654e58a..8248e731c9 100644 --- a/src/v0/destinations/adj/transform.js +++ b/src/v0/destinations/adj/transform.js @@ -1,4 +1,9 @@ const get = require('get-value'); +const { + InstrumentationError, + TransformationError, + ConfigurationError, +} = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { CONFIG_CATEGORIES, MAPPING_CONFIG, baseEndpoint } = require('./config'); const { @@ -11,11 +16,6 @@ const { isAppleFamily, simpleProcessRouterDest, } = require('../../util'); -const { - InstrumentationError, - TransformationError, - ConfigurationError, -} = require('../../util/errorTypes'); const rejectParams = ['revenue', 'currency']; diff --git a/src/v0/destinations/adobe_analytics/transform.js b/src/v0/destinations/adobe_analytics/transform.js index 67bb66310a..8bac0edd70 100644 --- a/src/v0/destinations/adobe_analytics/transform.js +++ b/src/v0/destinations/adobe_analytics/transform.js @@ -1,5 +1,10 @@ const jsonxml = require('jsontoxml'); const get = require('get-value'); +const { + InstrumentationError, + TransformationError, + ConfigurationError, +} = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { ECOM_PRODUCT_EVENTS, commonConfig, formatDestinationConfig } = require('./config'); const { @@ -14,11 +19,6 @@ const { removeUndefinedAndNullValues, simpleProcessRouterDest, } = require('../../util'); -const { - InstrumentationError, - TransformationError, - ConfigurationError, -} = require('../../util/errorTypes'); const { handleContextData, @@ -76,6 +76,7 @@ const responseBuilderSimple = async (message, destinationConfig, basicPayload) = } payload.linkURL = adobeIntegrationsObject?.linkURL || context?.page?.url || 'No linkURL provided'; + payload.linkURL = encodeURI(payload.linkURL); } // handle hier if (overrideHiers) { @@ -97,7 +98,7 @@ const responseBuilderSimple = async (message, destinationConfig, basicPayload) = const propertiesPageUrl = properties?.pageUrl; const pageUrl = contextPageUrl || propertiesPageUrl; if (isDefinedAndNotNullAndNotEmpty(pageUrl)) { - payload.pageUrl = pageUrl; + payload.pageUrl = encodeURI(pageUrl); } if (trackPageName) { // better handling possible here, both error and implementation wise diff --git a/src/v0/destinations/adobe_analytics/utils.js b/src/v0/destinations/adobe_analytics/utils.js index 55059884b1..bcb138d77b 100644 --- a/src/v0/destinations/adobe_analytics/utils.js +++ b/src/v0/destinations/adobe_analytics/utils.js @@ -4,8 +4,8 @@ /* eslint-disable unicorn/no-for-loop */ /* eslint-disable no-restricted-syntax */ const get = require('get-value'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { isDefinedAndNotNull, getValueFromMessage } = require('../../util'); -const { InstrumentationError } = require('../../util/errorTypes'); const SOURCE_KEYS = ['properties', 'traits', 'context.traits', 'context']; @@ -75,6 +75,25 @@ function handleContextData(payload, destinationConfig, message) { return payload; } +/** + * This function is used for replacing '&', '<' and '>' with their respective HTML entities + * @param {*} inputString + * @returns string with HTML entities replaced + * + */ + +function escapeToHTML(inputString) { + return inputString.replace( + /[&<>]/g, + (match) => + ({ + '&': '&', + '<': '<', + '>': '>', + }[match]), + ); +} + /** * This function is used for populating the eVars and hVars in the payload * @param {*} destVarMapping @@ -90,16 +109,16 @@ function rudderPropToDestMap(destVarMapping, message, payload, destVarStrPrefix) let val = get(message, `properties.${key}`); if (isDefinedAndNotNull(val)) { const destVarKey = destVarStrPrefix + destVarMapping[key]; - mappedVar[destVarKey] = val; + mappedVar[destVarKey] = escapeToHTML(val); } else { SOURCE_KEYS.some((sourceKey) => { val = getMappingFieldValueFormMessage(message, sourceKey, key); if (isDefinedAndNotNull(val)) { - mappedVar[`${destVarStrPrefix}${[destVarMapping[key]]}`] = val; + mappedVar[`${destVarStrPrefix}${[destVarMapping[key]]}`] = escapeToHTML(val); } else { val = getValueByPath(message, key); if (isDefinedAndNotNull(val)) { - mappedVar[`${destVarStrPrefix}${[destVarMapping[key]]}`] = val; + mappedVar[`${destVarStrPrefix}${[destVarMapping[key]]}`] = escapeToHTML(val); } } }); @@ -147,13 +166,13 @@ function rudderPropToDestMapWithDelimitter(mapping, delimMapping, message, prefi `${prefix} mapping properties variable is neither a string nor an array`, ); } - + if (typeof val === 'string') { /* following regex is used to find the one or more commas separated/padded by white spaces. Example: val = 'r15,faze90R' , 'r1v, bvp, pol' */ - val = val.replace(/\s*,+\s*/g, delimMapping[key]); - // Above regex is good as for every comma with whitespace padding the no. of steps will increase by 4. + val = val.replace(/\s*,+\s*/g, delimMapping[key]); + // Above regex is good as for every comma with whitespace padding the no. of steps will increase by 4. } else { val = val.join(delimMapping[key]); } @@ -200,4 +219,5 @@ module.exports = { handleList, handleCustomProperties, stringifyValueAndJoinWithDelimiter, + escapeToHTML, }; diff --git a/src/v0/destinations/af/deleteUsers.js b/src/v0/destinations/af/deleteUsers.js index 7970d02c20..2d68549fcc 100644 --- a/src/v0/destinations/af/deleteUsers.js +++ b/src/v0/destinations/af/deleteUsers.js @@ -1,12 +1,16 @@ /* eslint-disable no-await-in-loop */ /* eslint-disable no-param-reassign */ +const { + ConfigurationError, + InstrumentationError, + NetworkError, +} = require('@rudderstack/integrations-lib'); const { httpPOST } = require('../../../adapters/network'); const { processAxiosResponse, getDynamicErrorType, } = require('../../../adapters/utils/networkUtils'); const { generateUUID, isHttpStatusSuccess } = require('../../util'); -const { ConfigurationError, InstrumentationError, NetworkError } = require('../../util/errorTypes'); const tags = require('../../util/tags'); const { executeCommonValidations } = require('../../util/regulation-api'); diff --git a/src/v0/destinations/af/transform.js b/src/v0/destinations/af/transform.js index 858adce147..4d7ed7e635 100644 --- a/src/v0/destinations/af/transform.js +++ b/src/v0/destinations/af/transform.js @@ -1,6 +1,7 @@ const get = require('get-value'); const set = require('set-value'); +const { InstrumentationError, ConfigurationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { removeUndefinedValues, @@ -15,7 +16,6 @@ const { isDefinedAndNotNullAndNotEmpty, simpleProcessRouterDest, } = require('../../util'); -const { InstrumentationError, ConfigurationError } = require('../../util/errorTypes'); const { Event, ENDPOINT, ConfigCategory, mappingConfig, nameToEventMap } = require('./config'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/destinations/airship/transform.js b/src/v0/destinations/airship/transform.js index a390ec8060..091c9b7f39 100644 --- a/src/v0/destinations/airship/transform.js +++ b/src/v0/destinations/airship/transform.js @@ -1,3 +1,4 @@ +const { InstrumentationError, ConfigurationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { @@ -22,7 +23,6 @@ const { isEmptyObject, simpleProcessRouterDest, } = require('../../util'); -const { InstrumentationError, ConfigurationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const DEFAULT_ACCEPT_HEADER = 'application/vnd.urbanairship+json; version=3'; diff --git a/src/v0/destinations/algolia/transform.js b/src/v0/destinations/algolia/transform.js index c8b9be28dd..8e9cd57e8b 100644 --- a/src/v0/destinations/algolia/transform.js +++ b/src/v0/destinations/algolia/transform.js @@ -1,10 +1,10 @@ const set = require('set-value'); -const { EventType } = require('../../../constants'); const { InstrumentationError, ConfigurationError, PlatformError, -} = require('../../util/errorTypes'); +} = require('@rudderstack/integrations-lib'); +const { EventType } = require('../../../constants'); const { getValueFromMessage, constructPayload, diff --git a/src/v0/destinations/algolia/util.js b/src/v0/destinations/algolia/util.js index 89048f0e43..eddb4dc16d 100644 --- a/src/v0/destinations/algolia/util.js +++ b/src/v0/destinations/algolia/util.js @@ -1,5 +1,5 @@ +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const logger = require('../../../logger'); -const { InstrumentationError } = require('../../util/errorTypes'); const { EVENT_TYPES } = require('./config'); /** diff --git a/src/v0/destinations/am/deleteUsers.js b/src/v0/destinations/am/deleteUsers.js index c0402284b4..578c58fb5c 100644 --- a/src/v0/destinations/am/deleteUsers.js +++ b/src/v0/destinations/am/deleteUsers.js @@ -1,4 +1,5 @@ const btoa = require('btoa'); +const { ConfigurationError, NetworkError } = require('@rudderstack/integrations-lib'); const { httpPOST } = require('../../../adapters/network'); const tags = require('../../util/tags'); const { @@ -6,7 +7,6 @@ const { getDynamicErrorType, } = require('../../../adapters/utils/networkUtils'); const { isHttpStatusSuccess } = require('../../util'); -const { ConfigurationError, NetworkError } = require('../../util/errorTypes'); const { executeCommonValidations } = require('../../util/regulation-api'); const { DELETE_MAX_BATCH_SIZE } = require('./config'); const { getUserIdBatches } = require('../../util/deleteUserUtils'); diff --git a/src/v0/destinations/am/transform.js b/src/v0/destinations/am/transform.js index 04a1c5a107..05a130d6e0 100644 --- a/src/v0/destinations/am/transform.js +++ b/src/v0/destinations/am/transform.js @@ -4,6 +4,7 @@ const cloneDeep = require('lodash/cloneDeep'); const get = require('get-value'); const set = require('set-value'); +const { InstrumentationError, ConfigurationError } = require('@rudderstack/integrations-lib'); const { EventType, SpecedTraits, @@ -44,7 +45,7 @@ const tags = require('../../util/tags'); const AMUtils = require('./utils'); const logger = require('../../../logger'); -const { InstrumentationError, ConfigurationError } = require('../../util/errorTypes'); + const { JSON_MIME_TYPE } = require('../../util/constant'); const EVENTS_KEY_PATH = 'body.JSON.events'; @@ -194,9 +195,9 @@ const handleTraits = (messageTrait, destination) => { const getScreenevTypeAndUpdatedProperties = (message, CATEGORY_KEY) => { const name = message.name || message.event || get(message, CATEGORY_KEY); - const updatedName = name ? `${name} ` : ''; + return { - eventType: `Viewed ${updatedName}Screen`, + eventType: `Viewed ${message.name || message.event || get(message, CATEGORY_KEY) || ''} Screen`, updatedProperties: { ...message.properties, name, @@ -577,8 +578,6 @@ const getGroupInfo = (destination, groupInfo, groupTraits) => { } return groupInfo; }; -const getUpdatedPageNameWithoutUserDefinedPageEventName = (name, message, CATEGORY_KEY) => - name || get(message, CATEGORY_KEY) ? `${name || get(message, CATEGORY_KEY)} ` : undefined; // Generic process function which invokes specific handler functions depending on message type // and event type where applicable @@ -592,7 +591,12 @@ const processSingleMessage = (message, destination) => { const { name, event, properties } = message; const messageType = message.type.toLowerCase(); const CATEGORY_KEY = 'properties.category'; - const { useUserDefinedPageEventName, userProvidedPageEventString } = destination.Config; + const { + useUserDefinedPageEventName, + userProvidedPageEventString, + useUserDefinedScreenEventName, + userProvidedScreenEventString, + } = destination.Config; switch (messageType) { case EventType.IDENTIFY: payloadObjectName = 'events'; // identify same as events @@ -614,12 +618,7 @@ const processSingleMessage = (message, destination) => { .trim() .replaceAll(/{{([^{}]+)}}/g, get(message, getMessagePath)); } else { - const updatedName = getUpdatedPageNameWithoutUserDefinedPageEventName( - name, - message, - CATEGORY_KEY, - ); - evType = `Viewed ${updatedName || ''}Page`; + evType = `Viewed ${name || get(message, CATEGORY_KEY) || ''} Page`; } message.properties = { ...properties, @@ -633,7 +632,22 @@ const processSingleMessage = (message, destination) => { message, CATEGORY_KEY, ); - evType = eventType; + let customScreenEv = ''; + if (useUserDefinedScreenEventName) { + const getMessagePath = userProvidedScreenEventString + .substring( + userProvidedScreenEventString.indexOf('{') + 2, + userProvidedScreenEventString.indexOf('}'), + ) + .trim(); + customScreenEv = + userProvidedScreenEventString.trim() === '' + ? name + : userProvidedScreenEventString + .trim() + .replaceAll(/{{([^{}]+)}}/g, get(message, getMessagePath)); + } + evType = useUserDefinedScreenEventName ? customScreenEv : eventType; message.properties = updatedProperties; category = ConfigCategory.SCREEN; } diff --git a/src/v0/destinations/appcues/transform.js b/src/v0/destinations/appcues/transform.js index 095256cc4e..57a54bce33 100644 --- a/src/v0/destinations/appcues/transform.js +++ b/src/v0/destinations/appcues/transform.js @@ -1,4 +1,5 @@ /* eslint-disable no-underscore-dangle */ +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { @@ -9,7 +10,6 @@ const { simpleProcessRouterDest, } = require('../../util'); const { JSON_MIME_TYPE } = require('../../util/constant'); -const { InstrumentationError } = require('../../util/errorTypes'); const { ConfigCategory, mappingConfig, getEndpoint } = require('./config'); diff --git a/src/v0/destinations/attentive_tag/transform.js b/src/v0/destinations/attentive_tag/transform.js index 231beec143..fa05eb6c21 100644 --- a/src/v0/destinations/attentive_tag/transform.js +++ b/src/v0/destinations/attentive_tag/transform.js @@ -1,4 +1,5 @@ const get = require('get-value'); +const { InstrumentationError, ConfigurationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { ConfigCategory, mappingConfig, BASE_URL } = require('./config'); const { @@ -18,7 +19,6 @@ const { getPropertiesKeyValidation, validateTimestamp, } = require('./util'); -const { InstrumentationError, ConfigurationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const responseBuilder = (payload, apiKey, endpoint) => { diff --git a/src/v0/destinations/attentive_tag/util.js b/src/v0/destinations/attentive_tag/util.js index 890f73cdc9..c96d03028f 100644 --- a/src/v0/destinations/attentive_tag/util.js +++ b/src/v0/destinations/attentive_tag/util.js @@ -1,13 +1,13 @@ /* eslint-disable no-restricted-syntax */ const get = require('get-value'); const moment = require('moment'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { constructPayload, isDefinedAndNotNull, getDestinationExternalID, isDefinedAndNotNullAndNotEmpty, } = require('../../util'); -const { InstrumentationError } = require('../../util/errorTypes'); const { mappingConfig, ConfigCategory } = require('./config'); /** diff --git a/src/v0/destinations/attribution/transform.js b/src/v0/destinations/attribution/transform.js index 712f3e5e5d..fa42a6238a 100644 --- a/src/v0/destinations/attribution/transform.js +++ b/src/v0/destinations/attribution/transform.js @@ -1,3 +1,4 @@ +const { InstrumentationError, ConfigurationError } = require('@rudderstack/integrations-lib'); const { batchEndpoint } = require('./config'); const { defaultPostRequestConfig, @@ -5,7 +6,6 @@ const { removeUndefinedAndNullValues, getFieldValueFromMessage, } = require('../../util'); -const { InstrumentationError, ConfigurationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); function responseBuilderSimple(payload, attributionConfig) { diff --git a/src/v0/destinations/autopilot/transform.js b/src/v0/destinations/autopilot/transform.js index e0fe9aa400..e4a2c408af 100644 --- a/src/v0/destinations/autopilot/transform.js +++ b/src/v0/destinations/autopilot/transform.js @@ -1,3 +1,4 @@ +const { InstrumentationError, TransformationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { CONFIG_CATEGORIES, MAPPING_CONFIG } = require('./config'); const { @@ -9,7 +10,6 @@ const { simpleProcessRouterDest, } = require('../../util'); -const { InstrumentationError, TransformationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const identifyFields = [ diff --git a/src/v0/destinations/awin/transform.js b/src/v0/destinations/awin/transform.js index f6070fccd5..49a115c1ff 100644 --- a/src/v0/destinations/awin/transform.js +++ b/src/v0/destinations/awin/transform.js @@ -1,8 +1,8 @@ +const { InstrumentationError, ConfigurationError } = require('@rudderstack/integrations-lib'); const { BASE_URL, ConfigCategory, mappingConfig } = require('./config'); const { defaultRequestConfig, constructPayload, simpleProcessRouterDest } = require('../../util'); const { getParams } = require('./utils'); -const { InstrumentationError, ConfigurationError } = require('../../util/errorTypes'); const responseBuilder = (message, { Config }) => { const { advertiserId, eventsToTrack } = Config; diff --git a/src/v0/destinations/azure_event_hub/transform.js b/src/v0/destinations/azure_event_hub/transform.js index 6200e32ce7..98180b55b4 100644 --- a/src/v0/destinations/azure_event_hub/transform.js +++ b/src/v0/destinations/azure_event_hub/transform.js @@ -1,6 +1,5 @@ const cloneDeep = require('lodash/cloneDeep'); const { getIntegrationsObj } = require('../../util'); -// const { InstrumentationError } = require("../../util/errorTypes"); function process(event) { const { message, destination } = event; diff --git a/src/v0/destinations/blueshift/transform.js b/src/v0/destinations/blueshift/transform.js index b79af327d2..cdfbfe32e1 100644 --- a/src/v0/destinations/blueshift/transform.js +++ b/src/v0/destinations/blueshift/transform.js @@ -1,3 +1,8 @@ +const { + TransformationError, + InstrumentationError, + ConfigurationError, +} = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { constructPayload, @@ -10,11 +15,6 @@ const { simpleProcessRouterDest, } = require('../../util'); const { JSON_MIME_TYPE } = require('../../util/constant'); -const { - TransformationError, - InstrumentationError, - ConfigurationError, -} = require('../../util/errorTypes'); const { MAPPING_CONFIG, diff --git a/src/v0/destinations/bqstream/transform.js b/src/v0/destinations/bqstream/transform.js index 55679b08a8..598a97946d 100644 --- a/src/v0/destinations/bqstream/transform.js +++ b/src/v0/destinations/bqstream/transform.js @@ -1,5 +1,6 @@ /* eslint-disable no-console */ const lodash = require('lodash'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { defaultBatchRequestConfig, @@ -9,7 +10,6 @@ const { groupEventsByType, } = require('../../util'); const { MAX_ROWS_PER_REQUEST, DESTINATION } = require('./config'); -const { InstrumentationError } = require('../../util/errorTypes'); const { getRearrangedEvents } = require('./util'); const getInsertIdColValue = (properties, insertIdCol) => { diff --git a/src/v0/destinations/branch/transform.js b/src/v0/destinations/branch/transform.js index 0d47fbd791..23dcd6c8db 100644 --- a/src/v0/destinations/branch/transform.js +++ b/src/v0/destinations/branch/transform.js @@ -1,4 +1,5 @@ const get = require('get-value'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { endpoints } = require('./config'); const { categoriesList } = require('./data/eventMapping'); @@ -11,7 +12,6 @@ const { isAppleFamily, simpleProcessRouterDest, } = require('../../util'); -const { InstrumentationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); function responseBuilder(payload, message, destination, category) { diff --git a/src/v0/destinations/braze/deleteUsers.js b/src/v0/destinations/braze/deleteUsers.js index 799aa3f9b4..b94d901138 100644 --- a/src/v0/destinations/braze/deleteUsers.js +++ b/src/v0/destinations/braze/deleteUsers.js @@ -1,3 +1,4 @@ +const { NetworkError, ConfigurationError } = require('@rudderstack/integrations-lib'); const { httpPOST } = require('../../../adapters/network'); const { processAxiosResponse, @@ -8,7 +9,6 @@ const { isHttpStatusSuccess } = require('../../util'); const { executeCommonValidations } = require('../../util/regulation-api'); const { DEL_MAX_BATCH_SIZE } = require('./config'); const { getUserIdBatches } = require('../../util/deleteUserUtils'); -const { NetworkError, ConfigurationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const userDeletionHandler = async (userAttributes, config) => { diff --git a/src/v0/destinations/braze/networkHandler.js b/src/v0/destinations/braze/networkHandler.js index a141607fe9..c6cf7222ea 100644 --- a/src/v0/destinations/braze/networkHandler.js +++ b/src/v0/destinations/braze/networkHandler.js @@ -1,4 +1,5 @@ /* eslint-disable no-unused-vars */ +const { NetworkError } = require('@rudderstack/integrations-lib'); const { isHttpStatusSuccess } = require('../../util/index'); const { proxyRequest, prepareProxyRequest } = require('../../../adapters/network'); const { @@ -6,7 +7,6 @@ const { processAxiosResponse, } = require('../../../adapters/utils/networkUtils'); const { DESTINATION } = require('./config'); -const { NetworkError } = require('../../util/errorTypes'); const tags = require('../../util/tags'); const stats = require('../../../util/stats'); diff --git a/src/v0/destinations/braze/transform.js b/src/v0/destinations/braze/transform.js index 26fd86b3dd..b939e1f414 100644 --- a/src/v0/destinations/braze/transform.js +++ b/src/v0/destinations/braze/transform.js @@ -1,6 +1,8 @@ /* eslint-disable no-nested-ternary,no-param-reassign */ const lodash = require('lodash'); const get = require('get-value'); +const { InstrumentationError, NetworkError } = require('@rudderstack/integrations-lib'); +const { FilteredEventsError } = require('../../util/errorTypes'); const { BrazeDedupUtility, CustomAttributeOperationUtil, @@ -24,11 +26,6 @@ const { simpleProcessRouterDest, isNewStatusCodesAccepted, } = require('../../util'); -const { - InstrumentationError, - NetworkError, - FilteredEventsError, -} = require('../../util/errorTypes'); const { ConfigCategory, mappingConfig, diff --git a/src/v0/destinations/braze/util.js b/src/v0/destinations/braze/util.js index b3e60f2c6a..9b5d57d6bc 100644 --- a/src/v0/destinations/braze/util.js +++ b/src/v0/destinations/braze/util.js @@ -25,7 +25,7 @@ const { const { JSON_MIME_TYPE, HTTP_STATUS_CODES } = require('../../util/constant'); const { isObject } = require('../../util'); const { removeUndefinedValues, getIntegrationsObj } = require('../../util'); -const { InstrumentationError } = require('../../util/errorTypes'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const getEndpointFromConfig = (destination) => { // Init -- mostly for test cases diff --git a/src/v0/destinations/campaign_manager/config.js b/src/v0/destinations/campaign_manager/config.js index 063f65cb14..b3a9531347 100644 --- a/src/v0/destinations/campaign_manager/config.js +++ b/src/v0/destinations/campaign_manager/config.js @@ -9,6 +9,8 @@ const ConfigCategories = { }, }; +const MAX_BATCH_CONVERSATIONS_SIZE = 1000; + const EncryptionEntityType = [ 'ENCRYPTION_ENTITY_TYPE_UNKNOWN', 'DCM_ACCOUNT', @@ -28,4 +30,5 @@ module.exports = { BASE_URL, EncryptionEntityType, EncryptionSource, + MAX_BATCH_CONVERSATIONS_SIZE, }; diff --git a/src/v0/destinations/campaign_manager/networkHandler.js b/src/v0/destinations/campaign_manager/networkHandler.js index cd98de253e..63efff5b50 100644 --- a/src/v0/destinations/campaign_manager/networkHandler.js +++ b/src/v0/destinations/campaign_manager/networkHandler.js @@ -1,3 +1,5 @@ +/* eslint-disable no-restricted-syntax */ +const { AbortedError, RetryableError, NetworkError } = require('@rudderstack/integrations-lib'); const { prepareProxyRequest, proxyRequest } = require('../../../adapters/network'); const { isHttpStatusSuccess, getAuthErrCategoryFromStCode } = require('../../util/index'); @@ -5,26 +7,47 @@ const { processAxiosResponse, getDynamicErrorType, } = require('../../../adapters/utils/networkUtils'); -const { AbortedError, RetryableError, NetworkError } = require('../../util/errorTypes'); const tags = require('../../util/tags'); function checkIfFailuresAreRetryable(response) { + const { status } = response; try { - if (Array.isArray(response.status) && Array.isArray(response.status[0].errors)) { - return ( - response.status[0].errors[0].code !== 'PERMISSION_DENIED' && - response.status[0].errors[0].code !== 'INVALID_ARGUMENT' - ); + if (Array.isArray(status)) { + // iterate over each status, and if found retryable in conversations ..retry else discard + /* status : [{ + "conversion": { + object (Conversion) + }, + "errors": [ + { + object (ConversionError) + } + ], + "kind": string + }] */ + for (const st of status) { + for (const err of st.errors) { + // if code is any of these, event is not retryable + if ( + err.code === 'PERMISSION_DENIED' || + err.code === 'INVALID_ARGUMENT' || + err.code === 'NOT_FOUND' + ) { + return false; + } + } + } } return true; } catch (e) { - return true; + return false; } } const responseHandler = (destinationResponse) => { const message = `[CAMPAIGN_MANAGER Response Handler] - Request Processed Successfully`; const { response, status } = destinationResponse; + if (isHttpStatusSuccess(status)) { // check for Failures if (response.hasFailures === true) { diff --git a/src/v0/destinations/campaign_manager/transform.js b/src/v0/destinations/campaign_manager/transform.js index af097e5b4c..3b480dbac2 100644 --- a/src/v0/destinations/campaign_manager/transform.js +++ b/src/v0/destinations/campaign_manager/transform.js @@ -1,12 +1,16 @@ +const { InstrumentationError } = require('@rudderstack/integrations-lib'); +const lodash = require('lodash'); const { EventType } = require('../../../constants'); - const { constructPayload, defaultRequestConfig, defaultPostRequestConfig, + defaultBatchRequestConfig, removeUndefinedAndNullValues, + getSuccessRespEvents, isDefinedAndNotNull, - simpleProcessRouterDest, + checkInvalidRtTfEvents, + handleRtTfSingleEventError, getAccessToken, } = require('../../util'); @@ -16,11 +20,10 @@ const { BASE_URL, EncryptionEntityType, EncryptionSource, + MAX_BATCH_CONVERSATIONS_SIZE, } = require('./config'); const { convertToMicroseconds } = require('./util'); - -const { InstrumentationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); function isEmptyObject(obj) { @@ -179,9 +182,110 @@ function process(event) { return response; } +const generateBatch = (eventKind, events) => { + const batchRequestObject = defaultBatchRequestConfig(); + const conversions = []; + let encryptionInfo = {}; + const metadata = []; + // extracting destination, message from the first event in a batch + const { destination, message } = events[0]; + // Batch event into dest batch structure + events.forEach((ev) => { + conversions.push(...ev.message.body.JSON.conversions); + metadata.push(ev.metadata); + if (ev.message.body.JSON.encryptionInfo) { + encryptionInfo = ev.message.body.JSON.encryptionInfo; + } + }); + + batchRequestObject.batchedRequest.body.JSON = { + kind: eventKind, + conversions, + }; + + if (Object.keys(encryptionInfo).length > 0) { + batchRequestObject.batchedRequest.body.JSON.encryptionInfo = encryptionInfo; + } + + batchRequestObject.batchedRequest.endpoint = message.endpoint; + + batchRequestObject.batchedRequest.headers = message.headers; + + return { + ...batchRequestObject, + metadata, + destination, + }; +}; + +const batchEvents = (eventChunksArray) => { + const batchedResponseList = []; + + // group batchInsert and batchUpdate payloads + const groupedEventChunks = lodash.groupBy( + eventChunksArray, + (event) => event.message.body.JSON.kind, + ); + Object.keys(groupedEventChunks).forEach((eventKind) => { + // eventChunks = [[e1,e2,e3,..batchSize],[e1,e2,e3,..batchSize]..] + const eventChunks = lodash.chunk(groupedEventChunks[eventKind], MAX_BATCH_CONVERSATIONS_SIZE); + eventChunks.forEach((chunk) => { + const batchEventResponse = generateBatch(eventKind, chunk); + batchedResponseList.push( + getSuccessRespEvents( + batchEventResponse.batchedRequest, + batchEventResponse.metadata, + batchEventResponse.destination, + true, + ), + ); + }); + }); + return batchedResponseList; +}; + const processRouterDest = async (inputs, reqMetadata) => { - const respList = await simpleProcessRouterDest(inputs, process, reqMetadata); - return respList; + const errorRespEvents = checkInvalidRtTfEvents(inputs); + if (errorRespEvents.length > 0) { + return errorRespEvents; + } + + const batchErrorRespList = []; + const eventChunksArray = []; + const { destination } = inputs[0]; + await Promise.all( + inputs.map(async (event) => { + try { + if (event.message.statusCode) { + // already transformed event + eventChunksArray.push({ + message: event.message, + metadata: event.metadata, + destination, + }); + } else { + // if not transformed + const proccessedRespList = process(event); + const transformedPayload = { + message: proccessedRespList, + metadata: event.metadata, + destination, + }; + eventChunksArray.push(transformedPayload); + } + } catch (error) { + const errRespEvent = handleRtTfSingleEventError(event, error, reqMetadata); + batchErrorRespList.push(errRespEvent); + } + }), + ); + + let batchResponseList = []; + if (eventChunksArray.length > 0) { + batchResponseList = batchEvents(eventChunksArray); + } + + return [...batchResponseList, ...batchErrorRespList]; }; module.exports = { process, processRouterDest }; diff --git a/src/v0/destinations/candu/transform.js b/src/v0/destinations/candu/transform.js index 659af36540..d114998484 100644 --- a/src/v0/destinations/candu/transform.js +++ b/src/v0/destinations/candu/transform.js @@ -1,3 +1,4 @@ +const { InstrumentationError, ConfigurationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { defaultRequestConfig, @@ -6,7 +7,6 @@ const { simpleProcessRouterDest, } = require('../../util'); const { JSON_MIME_TYPE } = require('../../util/constant'); -const { InstrumentationError, ConfigurationError } = require('../../util/errorTypes'); const { endpoint, identifyDataMapping, trackDataMapping } = require('./config'); const responseBuilder = (body, { Config }) => { diff --git a/src/v0/destinations/canny/transform.js b/src/v0/destinations/canny/transform.js index d837a8ddd3..f4364e1fb7 100644 --- a/src/v0/destinations/canny/transform.js +++ b/src/v0/destinations/canny/transform.js @@ -1,3 +1,4 @@ +const { InstrumentationError, ConfigurationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { ConfigCategory, mappingConfig, BASE_URL } = require('./config'); const { @@ -14,7 +15,6 @@ const { validateCreatePostFields, validateEventMapping, } = require('./util'); -const { InstrumentationError, ConfigurationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const responseBuilder = (responseConfgs) => { diff --git a/src/v0/destinations/canny/util.js b/src/v0/destinations/canny/util.js index 002d9aa69f..59644bcd6b 100644 --- a/src/v0/destinations/canny/util.js +++ b/src/v0/destinations/canny/util.js @@ -1,8 +1,8 @@ const qs = require('qs'); +const { InstrumentationError, NetworkError } = require('@rudderstack/integrations-lib'); const { httpPOST } = require('../../../adapters/network'); const { getDynamicErrorType } = require('../../../adapters/utils/networkUtils'); const { getDestinationExternalID } = require('../../util'); -const { InstrumentationError, NetworkError } = require('../../util/errorTypes'); const tags = require('../../util/tags'); const logger = require('../../../logger'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/destinations/clevertap/deleteUsers.js b/src/v0/destinations/clevertap/deleteUsers.js index 826c6c6939..3c07a63d93 100644 --- a/src/v0/destinations/clevertap/deleteUsers.js +++ b/src/v0/destinations/clevertap/deleteUsers.js @@ -1,3 +1,4 @@ +const { NetworkError, ConfigurationError } = require('@rudderstack/integrations-lib'); const { httpPOST } = require('../../../adapters/network'); const { getEndpoint, DEL_MAX_BATCH_SIZE } = require('./config'); const { @@ -6,7 +7,6 @@ const { } = require('../../../adapters/utils/networkUtils'); const { isHttpStatusSuccess } = require('../../util'); const { executeCommonValidations } = require('../../util/regulation-api'); -const { NetworkError, ConfigurationError } = require('../../util/errorTypes'); const tags = require('../../util/tags'); const { getUserIdBatches } = require('../../util/deleteUserUtils'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/destinations/clevertap/networkHandler.js b/src/v0/destinations/clevertap/networkHandler.js index 35c972e502..e17afb57d1 100644 --- a/src/v0/destinations/clevertap/networkHandler.js +++ b/src/v0/destinations/clevertap/networkHandler.js @@ -1,10 +1,10 @@ +const { NetworkError, AbortedError } = require('@rudderstack/integrations-lib'); const { isHttpStatusSuccess } = require('../../util/index'); const { proxyRequest, prepareProxyRequest } = require('../../../adapters/network'); const { processAxiosResponse, getDynamicErrorType, } = require('../../../adapters/utils/networkUtils'); -const { NetworkError, AbortedError } = require('../../util/errorTypes'); const tags = require('../../util/tags'); const responseHandler = (destinationResponse) => { diff --git a/src/v0/destinations/clevertap/transform.js b/src/v0/destinations/clevertap/transform.js index 5c1e28c086..efcd101668 100644 --- a/src/v0/destinations/clevertap/transform.js +++ b/src/v0/destinations/clevertap/transform.js @@ -1,6 +1,7 @@ /* eslint-disable no-param-reassign */ /* eslint-disable no-nested-ternary */ const get = require('get-value'); +const { InstrumentationError, TransformationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { getEndpoint, @@ -25,7 +26,6 @@ const { } = require('../../util'); const { generateClevertapBatchedPayload } = require('./utils'); -const { InstrumentationError, TransformationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const TIMESTAMP_KEY_PATH = 'context.traits.ts'; diff --git a/src/v0/destinations/clickup/transform.js b/src/v0/destinations/clickup/transform.js index d93e53b349..0637d65bd4 100644 --- a/src/v0/destinations/clickup/transform.js +++ b/src/v0/destinations/clickup/transform.js @@ -1,3 +1,4 @@ +const { TransformationError, InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { defaultRequestConfig, @@ -14,7 +15,6 @@ const { checkEventIfUIMapped, } = require('./util'); const { CONFIG_CATEGORIES, MAPPING_CONFIG, createTaskEndPoint } = require('./config'); -const { TransformationError, InstrumentationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const responseBuilder = async (payload, listId, apiToken) => { diff --git a/src/v0/destinations/clickup/util.js b/src/v0/destinations/clickup/util.js index 7b17f83bb6..148fe1bd07 100644 --- a/src/v0/destinations/clickup/util.js +++ b/src/v0/destinations/clickup/util.js @@ -1,3 +1,4 @@ +const { NetworkError, InstrumentationError } = require('@rudderstack/integrations-lib'); const { httpGET } = require('../../../adapters/network'); const { processAxiosResponse, @@ -9,7 +10,6 @@ const { formatTimeStamp, } = require('../../util'); const { getCustomFieldsEndPoint } = require('./config'); -const { NetworkError, InstrumentationError } = require('../../util/errorTypes'); const tags = require('../../util/tags'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/destinations/confluent_cloud/transform.js b/src/v0/destinations/confluent_cloud/transform.js index e8f0f4d2e2..b33abc90cf 100644 --- a/src/v0/destinations/confluent_cloud/transform.js +++ b/src/v0/destinations/confluent_cloud/transform.js @@ -1,6 +1,5 @@ const cloneDeep = require('lodash/cloneDeep'); const { getIntegrationsObj } = require('../../util'); -// const { InstrumentationError } = require("../../util/errorTypes"); function process(event) { const { message, destination } = event; diff --git a/src/v0/destinations/courier/transform.js b/src/v0/destinations/courier/transform.js index 7d52b503d9..d5e25434ec 100644 --- a/src/v0/destinations/courier/transform.js +++ b/src/v0/destinations/courier/transform.js @@ -1,3 +1,8 @@ +const { + TransformationError, + InstrumentationError, + ConfigurationError, +} = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { defaultRequestConfig, @@ -6,11 +11,6 @@ const { simpleProcessRouterDest, } = require('../../util'); const { JSON_MIME_TYPE } = require('../../util/constant'); -const { - TransformationError, - InstrumentationError, - ConfigurationError, -} = require('../../util/errorTypes'); const { API_URL } = require('./config'); const responseBuilder = (payload, endpoint, destination) => { diff --git a/src/v0/destinations/criteo_audience/networkHandler.js b/src/v0/destinations/criteo_audience/networkHandler.js index f4369cdc9e..18bd9a93a0 100644 --- a/src/v0/destinations/criteo_audience/networkHandler.js +++ b/src/v0/destinations/criteo_audience/networkHandler.js @@ -1,3 +1,10 @@ +const { + NetworkError, + ThrottledError, + NetworkInstrumentationError, + AbortedError, + RetryableError, +} = require('@rudderstack/integrations-lib'); const { prepareProxyRequest, proxyRequest } = require('../../../adapters/network'); const { isHttpStatusSuccess } = require('../../util/index'); const { REFRESH_TOKEN } = require('../../../adapters/networkhandler/authConstants'); @@ -6,13 +13,6 @@ const { getDynamicErrorType, processAxiosResponse, } = require('../../../adapters/utils/networkUtils'); -const { - NetworkError, - ThrottledError, - NetworkInstrumentationError, - AbortedError, - RetryableError, -} = require('../../util/errorTypes'); // https://developers.criteo.com/marketing-solutions/v2021.01/docs/how-to-handle-api-errors#:~:text=the%20response%20body.-,401,-Authentication%20error // Following fucntion tells us if there is a particular error code in the response. diff --git a/src/v0/destinations/criteo_audience/transform.js b/src/v0/destinations/criteo_audience/transform.js index 7ddbdbef20..25e53cc305 100644 --- a/src/v0/destinations/criteo_audience/transform.js +++ b/src/v0/destinations/criteo_audience/transform.js @@ -1,4 +1,5 @@ const get = require('get-value'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { BASE_ENDPOINT, operation } = require('./config'); const { defaultRequestConfig, @@ -9,7 +10,6 @@ const { getEventType, getDestinationExternalIDInfoForRetl, } = require('../../util'); -const { InstrumentationError } = require('../../util/errorTypes'); const { MappedToDestinationKey } = require('../../../constants'); const { preparePayload } = require('./util'); diff --git a/src/v0/destinations/criteo_audience/util.js b/src/v0/destinations/criteo_audience/util.js index a7541f7911..d9d37bc331 100644 --- a/src/v0/destinations/criteo_audience/util.js +++ b/src/v0/destinations/criteo_audience/util.js @@ -1,6 +1,6 @@ const lodash = require('lodash'); +const { ConfigurationError, InstrumentationError } = require('@rudderstack/integrations-lib'); const { isDefinedAndNotNullAndNotEmpty } = require('../../util'); -const { ConfigurationError, InstrumentationError } = require('../../util/errorTypes'); const { MAX_IDENTIFIERS } = require('./config'); const populateIdentifiers = (audienceList, audienceType) => { diff --git a/src/v0/destinations/custify/deleteUsers.js b/src/v0/destinations/custify/deleteUsers.js index e90abe7abb..147fcc602c 100644 --- a/src/v0/destinations/custify/deleteUsers.js +++ b/src/v0/destinations/custify/deleteUsers.js @@ -1,9 +1,13 @@ +const { + ConfigurationError, + InstrumentationError, + NetworkError, +} = require('@rudderstack/integrations-lib'); const { httpDELETE } = require('../../../adapters/network'); const { processAxiosResponse, getDynamicErrorType, } = require('../../../adapters/utils/networkUtils'); -const { ConfigurationError, InstrumentationError, NetworkError } = require('../../util/errorTypes'); const { executeCommonValidations } = require('../../util/regulation-api'); const tags = require('../../util/tags'); diff --git a/src/v0/destinations/custify/transform.js b/src/v0/destinations/custify/transform.js index fd81511982..6b08be1c56 100644 --- a/src/v0/destinations/custify/transform.js +++ b/src/v0/destinations/custify/transform.js @@ -1,4 +1,5 @@ const get = require('get-value'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType, MappedToDestinationKey } = require('../../../constants'); const { ConfigCategory } = require('./config'); const { @@ -9,7 +10,6 @@ const { simpleProcessRouterDest, } = require('../../util'); const { processIdentify, processTrack, processGroup } = require('./util'); -const { InstrumentationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); /** diff --git a/src/v0/destinations/custify/util.js b/src/v0/destinations/custify/util.js index d943b5c8bf..ae6f21fe20 100644 --- a/src/v0/destinations/custify/util.js +++ b/src/v0/destinations/custify/util.js @@ -1,4 +1,5 @@ const get = require('get-value'); +const { InstrumentationError, NetworkError } = require('@rudderstack/integrations-lib'); const { ConfigCategory, MappingConfig, @@ -16,7 +17,6 @@ const { constructPayload, isHttpStatusSuccess, } = require('../../util'); -const { InstrumentationError, NetworkError } = require('../../util/errorTypes'); const tags = require('../../util/tags'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/destinations/customerio/transform.js b/src/v0/destinations/customerio/transform.js index 984fb7e67f..be4486717c 100644 --- a/src/v0/destinations/customerio/transform.js +++ b/src/v0/destinations/customerio/transform.js @@ -1,6 +1,7 @@ const get = require('get-value'); const btoa = require('btoa'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType, MappedToDestinationKey } = require('../../../constants'); const { @@ -24,7 +25,6 @@ const { defaultResponseBuilder, validateConfigFields, } = require('./util'); -const { InstrumentationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); function responseBuilder(message, evType, evName, destination, messageType) { diff --git a/src/v0/destinations/customerio/util.js b/src/v0/destinations/customerio/util.js index 6b4dbc0e11..ef983748a5 100644 --- a/src/v0/destinations/customerio/util.js +++ b/src/v0/destinations/customerio/util.js @@ -1,6 +1,7 @@ const get = require('get-value'); const set = require('set-value'); const truncate = require('truncate-utf8-bytes'); +const { InstrumentationError, ConfigurationError } = require('@rudderstack/integrations-lib'); const { MAX_BATCH_SIZE, configFieldsToCheck } = require('./config'); const { constructPayload, @@ -28,8 +29,6 @@ const { DEVICE_REGISTER_ENDPOINT, } = require('./config'); -const { InstrumentationError, ConfigurationError } = require('../../util/errorTypes'); - const deviceRelatedEventNames = [ 'Application Installed', 'Application Opened', diff --git a/src/v0/destinations/delighted/transform.js b/src/v0/destinations/delighted/transform.js index f5a2afdcaf..cf80dc878d 100644 --- a/src/v0/destinations/delighted/transform.js +++ b/src/v0/destinations/delighted/transform.js @@ -1,3 +1,8 @@ +const { + InstrumentationError, + ConfigurationError, + NetworkInstrumentationError, +} = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { getFieldValueFromMessage, @@ -20,11 +25,6 @@ const { userValidity, } = require('./util'); const { ENDPOINT, TRACKING_EXCLUSION_FIELDS, identifyMapping } = require('./config'); -const { - InstrumentationError, - ConfigurationError, - NetworkInstrumentationError, -} = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const identifyResponseBuilder = (message, { Config }) => { diff --git a/src/v0/destinations/delighted/util.js b/src/v0/destinations/delighted/util.js index 3cf26a3697..2c92685fd7 100644 --- a/src/v0/destinations/delighted/util.js +++ b/src/v0/destinations/delighted/util.js @@ -1,11 +1,11 @@ -const myAxios = require('../../../util/myAxios'); -const { getDynamicErrorType } = require('../../../adapters/utils/networkUtils'); -const { getValueFromMessage } = require('../../util'); const { NetworkInstrumentationError, InstrumentationError, NetworkError, -} = require('../../util/errorTypes'); +} = require('@rudderstack/integrations-lib'); +const myAxios = require('../../../util/myAxios'); +const { getDynamicErrorType } = require('../../../adapters/utils/networkUtils'); +const { getValueFromMessage } = require('../../util'); const { ENDPOINT } = require('./config'); const tags = require('../../util/tags'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/destinations/discord/transform.js b/src/v0/destinations/discord/transform.js index 4eb2f79235..714ee4f52b 100644 --- a/src/v0/destinations/discord/transform.js +++ b/src/v0/destinations/discord/transform.js @@ -1,6 +1,7 @@ /* eslint-disable no-nested-ternary */ /* eslint-disable no-prototype-builtins */ const Handlebars = require('handlebars'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { @@ -9,7 +10,6 @@ const { getFieldValueFromMessage, simpleProcessRouterDest, } = require('../../util'); -const { InstrumentationError } = require('../../util/errorTypes'); const { stringifyJSON, getName, diff --git a/src/v0/destinations/drip/transform.js b/src/v0/destinations/drip/transform.js index 9abe3e3f77..4ccba076d0 100644 --- a/src/v0/destinations/drip/transform.js +++ b/src/v0/destinations/drip/transform.js @@ -1,3 +1,8 @@ +const { + InstrumentationError, + ConfigurationError, + NetworkInstrumentationError, +} = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { getDestinationExternalID, @@ -31,11 +36,6 @@ const { createUpdateUser, createList, } = require('./util'); -const { - InstrumentationError, - ConfigurationError, - NetworkInstrumentationError, -} = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const identifyResponseBuilder = async (message, { Config }) => { diff --git a/src/v0/destinations/drip/util.js b/src/v0/destinations/drip/util.js index dbb59fc6af..a502cf0d20 100644 --- a/src/v0/destinations/drip/util.js +++ b/src/v0/destinations/drip/util.js @@ -1,8 +1,8 @@ +const { NetworkError, AbortedError } = require('@rudderstack/integrations-lib'); const myAxios = require('../../../util/myAxios'); const { getDynamicErrorType } = require('../../../adapters/utils/networkUtils'); const logger = require('../../../logger'); const { constructPayload, isDefinedAndNotNull } = require('../../util'); -const { NetworkError, AbortedError } = require('../../util/errorTypes'); const { ENDPOINT, productMapping } = require('./config'); const tags = require('../../util/tags'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/destinations/engage/deleteUsers.js b/src/v0/destinations/engage/deleteUsers.js index 940529ea0c..a3c3055c7d 100644 --- a/src/v0/destinations/engage/deleteUsers.js +++ b/src/v0/destinations/engage/deleteUsers.js @@ -1,3 +1,4 @@ +const { ConfigurationError, NetworkError } = require('@rudderstack/integrations-lib'); const { httpDELETE } = require('../../../adapters/network'); const { processAxiosResponse, @@ -5,7 +6,6 @@ const { } = require('../../../adapters/utils/networkUtils'); const { isHttpStatusSuccess } = require('../../util'); const tags = require('../../util/tags'); -const { ConfigurationError, NetworkError } = require('../../util/errorTypes'); const { executeCommonValidations } = require('../../util/regulation-api'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/destinations/engage/transform.js b/src/v0/destinations/engage/transform.js index 98b8bb2bb9..f5daafb98c 100644 --- a/src/v0/destinations/engage/transform.js +++ b/src/v0/destinations/engage/transform.js @@ -1,4 +1,5 @@ const { set } = require('lodash'); +const { TransformationError, InstrumentationError } = require('@rudderstack/integrations-lib'); const { defaultRequestConfig, constructPayload, @@ -14,7 +15,6 @@ const { getDestinationExternalID } = require('../../util'); const { EventType } = require('../../../constants'); const { mappingConfig, ConfigCategories } = require('./config'); const { refinePayload, generatePageName, getLists } = require('./utils'); -const { TransformationError, InstrumentationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const UID_ERROR_MSG = 'Neither externalId nor userId is available'; diff --git a/src/v0/destinations/eventbridge/transform.js b/src/v0/destinations/eventbridge/transform.js index 71c7731074..53c74d0f88 100644 --- a/src/v0/destinations/eventbridge/transform.js +++ b/src/v0/destinations/eventbridge/transform.js @@ -1,5 +1,5 @@ +const { ConfigurationError } = require('@rudderstack/integrations-lib'); const { removeUndefinedAndNullValues, simpleProcessRouterDest } = require('../../util'); -const { ConfigurationError } = require('../../util/errorTypes'); function getResouceList(config) { let resource; diff --git a/src/v0/destinations/facebook_conversions/config.js b/src/v0/destinations/facebook_conversions/config.js index fc04f13be6..0c1fc12e15 100644 --- a/src/v0/destinations/facebook_conversions/config.js +++ b/src/v0/destinations/facebook_conversions/config.js @@ -1,7 +1,7 @@ const { getMappingConfig } = require('../../util'); const ENDPOINT = (datasetId, accessToken) => - `https://graph.facebook.com/v17.0/${datasetId}/events?access_token=${accessToken}`; + `https://graph.facebook.com/v18.0/${datasetId}/events?access_token=${accessToken}`; const CONFIG_CATEGORIES = { USERDATA: { diff --git a/src/v0/destinations/facebook_conversions/transform.js b/src/v0/destinations/facebook_conversions/transform.js index dec1ef2e6c..1bb97b2672 100644 --- a/src/v0/destinations/facebook_conversions/transform.js +++ b/src/v0/destinations/facebook_conversions/transform.js @@ -1,6 +1,7 @@ /* eslint-disable no-param-reassign */ const get = require('get-value'); const moment = require('moment'); +const { InstrumentationError, ConfigurationError } = require('@rudderstack/integrations-lib'); const { CONFIG_CATEGORIES, MAPPING_CONFIG, @@ -13,7 +14,6 @@ const { EventType } = require('../../../constants'); const { constructPayload, extractCustomFields, - flattenJson, getIntegrationsObj, getValidDynamicFormConfig, simpleProcessRouterDest, @@ -34,8 +34,6 @@ const { formingFinalResponse, } = require('../../util/facebookUtils'); -const { InstrumentationError, ConfigurationError } = require('../../util/errorTypes'); - const responseBuilderSimple = (message, category, destination) => { const { Config, ID } = destination; let { categoryToContent } = Config; @@ -74,8 +72,11 @@ const responseBuilderSimple = (message, category, destination) => { commonData.action_source = getActionSource(commonData, actionSource); let customData = {}; - customData = flattenJson( - extractCustomFields(message, customData, ['properties'], FB_CONVERSIONS_DEFAULT_EXCLUSION), + customData = extractCustomFields( + message, + customData, + ['properties'], + FB_CONVERSIONS_DEFAULT_EXCLUSION, ); customData = transformedPayloadData( diff --git a/src/v0/destinations/facebook_conversions/utils.js b/src/v0/destinations/facebook_conversions/utils.js index 270fac8c45..26204ec61a 100644 --- a/src/v0/destinations/facebook_conversions/utils.js +++ b/src/v0/destinations/facebook_conversions/utils.js @@ -1,3 +1,4 @@ +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { CONFIG_CATEGORIES, OTHER_STANDARD_EVENTS, @@ -8,7 +9,6 @@ const { } = require('./config'); const { constructPayload, isObject, isAppleFamily } = require('../../util'); const { getContentType, getContentCategory } = require('../../util/facebookUtils'); -const { InstrumentationError } = require('../../util/errorTypes'); const getActionSource = (payload, fallbackActionSource) => { let actionSource = fallbackActionSource; @@ -44,7 +44,11 @@ const getCategoryFromEvent = (eventName) => { return category; }; -const populateContentsAndContentIDs = (productPropertiesArray, fallbackQuantity) => { +const populateContentsAndContentIDs = ( + productPropertiesArray, + fallbackQuantity, + fallbackDeliveryCategory, +) => { const contentIds = []; const contents = []; if (Array.isArray(productPropertiesArray)) { @@ -57,6 +61,7 @@ const populateContentsAndContentIDs = (productPropertiesArray, fallbackQuantity) id: productId, quantity: productProps.quantity || fallbackQuantity || 1, item_price: productProps.price, + delivery_category: productProps.delivery_category || fallbackDeliveryCategory, }); } } @@ -142,6 +147,7 @@ const populateCustomDataBasedOnCategory = (customData, message, category, catego const { contentIds, contents } = populateContentsAndContentIDs( message.properties?.products, message.properties?.quantity, + message.properties?.delivery_category, ); const contentCategory = eventTypeCustomData.content_category; diff --git a/src/v0/destinations/facebook_offline_conversions/transform.js b/src/v0/destinations/facebook_offline_conversions/transform.js index e30bc2fa9a..cc95270fcc 100644 --- a/src/v0/destinations/facebook_offline_conversions/transform.js +++ b/src/v0/destinations/facebook_offline_conversions/transform.js @@ -1,3 +1,4 @@ +const { InstrumentationError, TransformationError } = require('@rudderstack/integrations-lib'); const { defaultRequestConfig, simpleProcessRouterDest, @@ -7,7 +8,6 @@ const { const { offlineConversionResponseBuilder, prepareUrls } = require('./utils'); const { EventType } = require('../../../constants'); -const { InstrumentationError, TransformationError } = require('../../util/errorTypes'); const responseBuilder = (endpoint) => { if (endpoint) { diff --git a/src/v0/destinations/facebook_offline_conversions/utils.js b/src/v0/destinations/facebook_offline_conversions/utils.js index 819bf8056d..c48de4e0b9 100644 --- a/src/v0/destinations/facebook_offline_conversions/utils.js +++ b/src/v0/destinations/facebook_offline_conversions/utils.js @@ -1,5 +1,6 @@ const sha256 = require('sha256'); const get = require('get-value'); +const { ConfigurationError } = require('@rudderstack/integrations-lib'); const { isObject, formatTimeStamp, @@ -22,7 +23,6 @@ const { eventToStandardMapping, MATCH_KEY_FIELD_TYPE_DICTIONARY, } = require('./config'); -const { ConfigurationError } = require('../../util/errorTypes'); /** * @param {*} message diff --git a/src/v0/destinations/facebook_pixel/config.js b/src/v0/destinations/facebook_pixel/config.js index 99c3c70b2d..17d5887e1b 100644 --- a/src/v0/destinations/facebook_pixel/config.js +++ b/src/v0/destinations/facebook_pixel/config.js @@ -1,5 +1,7 @@ const { getMappingConfig } = require('../../util'); +const VERSION = 'v18.0'; + const CONFIG_CATEGORIES = { USERDATA: { standard: false, @@ -95,6 +97,7 @@ const OTHER_STANDARD_EVENTS = [ ]; const FB_PIXEL_DEFAULT_EXCLUSION = ['opt_out', 'event_id', 'action_source']; +const FB_PIXEL_CUSTOM_DATA_EXCLUDE_FLATTENING = ['content_ids', 'contents']; const STANDARD_ECOMM_EVENTS_TYPE = [ CONFIG_CATEGORIES.PRODUCT_LIST_VIEWED.type, CONFIG_CATEGORIES.PRODUCT_VIEWED.type, @@ -105,10 +108,12 @@ const STANDARD_ECOMM_EVENTS_TYPE = [ ]; module.exports = { + VERSION, CONFIG_CATEGORIES, MAPPING_CONFIG, ACTION_SOURCES_VALUES, FB_PIXEL_DEFAULT_EXCLUSION, + FB_PIXEL_CUSTOM_DATA_EXCLUDE_FLATTENING, STANDARD_ECOMM_EVENTS_TYPE, OTHER_STANDARD_EVENTS, DESTINATION: 'FACEBOOK_PIXEL', diff --git a/src/v0/destinations/facebook_pixel/transform.js b/src/v0/destinations/facebook_pixel/transform.js index 02c416cfde..8a63998b45 100644 --- a/src/v0/destinations/facebook_pixel/transform.js +++ b/src/v0/destinations/facebook_pixel/transform.js @@ -1,11 +1,14 @@ /* eslint-disable no-param-reassign */ const get = require('get-value'); const moment = require('moment'); +const { InstrumentationError, ConfigurationError } = require('@rudderstack/integrations-lib'); const stats = require('../../../util/stats'); const { + VERSION, CONFIG_CATEGORIES, MAPPING_CONFIG, FB_PIXEL_DEFAULT_EXCLUSION, + FB_PIXEL_CUSTOM_DATA_EXCLUDE_FLATTENING, STANDARD_ECOMM_EVENTS_TYPE, } = require('./config'); const { EventType } = require('../../../constants'); @@ -36,8 +39,6 @@ const { formingFinalResponse, } = require('../../util/facebookUtils'); -const { InstrumentationError, ConfigurationError } = require('../../util/errorTypes'); - const responseBuilderSimple = (message, category, destination) => { const { Config, ID } = destination; const { pixelId, accessToken } = Config; @@ -65,7 +66,7 @@ const responseBuilderSimple = (message, category, destination) => { } = Config; const integrationsObj = getIntegrationsObj(message, 'fb_pixel'); - const endpoint = `https://graph.facebook.com/v17.0/${pixelId}/events?access_token=${accessToken}`; + const endpoint = `https://graph.facebook.com/${VERSION}/${pixelId}/events?access_token=${accessToken}`; const userData = fetchUserData( message, @@ -85,7 +86,12 @@ const responseBuilderSimple = (message, category, destination) => { if (category.type !== 'identify') { customData = flattenJson( - extractCustomFields(message, customData, ['properties'], FB_PIXEL_DEFAULT_EXCLUSION), + extractCustomFields( + message, + customData, + ['properties'], + [...FB_PIXEL_DEFAULT_EXCLUSION, ...FB_PIXEL_CUSTOM_DATA_EXCLUDE_FLATTENING], + ), ); if (standardPageCall && category.type === 'page') { category.standard = true; @@ -125,6 +131,11 @@ const responseBuilderSimple = (message, category, destination) => { if (type === 'simple track') { customData.value = message.properties?.revenue; delete customData.revenue; + FB_PIXEL_CUSTOM_DATA_EXCLUDE_FLATTENING.forEach((customDataParameter) => { + if (message.properties?.[customDataParameter]) { + customData[customDataParameter] = message.properties[customDataParameter]; + } + }); } } } else { diff --git a/src/v0/destinations/facebook_pixel/utils.js b/src/v0/destinations/facebook_pixel/utils.js index d642c446fd..8a63a0b0fe 100644 --- a/src/v0/destinations/facebook_pixel/utils.js +++ b/src/v0/destinations/facebook_pixel/utils.js @@ -1,7 +1,12 @@ +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { isObject } = require('../../util'); -const { ACTION_SOURCES_VALUES, CONFIG_CATEGORIES, OTHER_STANDARD_EVENTS } = require('./config'); +const { + ACTION_SOURCES_VALUES, + CONFIG_CATEGORIES, + OTHER_STANDARD_EVENTS, + FB_PIXEL_CUSTOM_DATA_EXCLUDE_FLATTENING, +} = require('./config'); const { getContentType, getContentCategory } = require('../../util/facebookUtils'); -const { InstrumentationError } = require('../../util/errorTypes'); /** format revenue according to fb standards with max two decimal places. * @param revenue @@ -54,7 +59,14 @@ const handleOrder = (message, categoryToContent) => { const contentType = getContentType(message, 'product', categoryToContent); const contentIds = []; const contents = []; - const { category, quantity, price, currency, contentName } = message.properties; + const { + category, + quantity, + price, + currency, + contentName, + delivery_category: deliveryCategory, + } = message.properties; if (products) { if (products.length > 0 && Array.isArray(products)) { products.forEach((singleProduct) => { @@ -67,6 +79,7 @@ const handleOrder = (message, categoryToContent) => { id: pId, quantity: singleProduct.quantity || quantity || 1, item_price: singleProduct.price || price, + delivery_category: singleProduct.delivery_category || deliveryCategory, }; contents.push(content); } @@ -262,6 +275,11 @@ const populateCustomDataBasedOnCategory = ( case 'page': // executed when page call is done with standard PageView turned on case 'otherStandard': updatedCustomData = { ...customData }; + FB_PIXEL_CUSTOM_DATA_EXCLUDE_FLATTENING.forEach((customDataParameter) => { + if (message.properties?.[customDataParameter]) { + updatedCustomData[customDataParameter] = message.properties[customDataParameter]; + } + }); break; default: throw new InstrumentationError(`${category.standard} type of standard event does not exist`); diff --git a/src/v0/destinations/factorsai/transform.js b/src/v0/destinations/factorsai/transform.js index dd2dad42fc..9824b73bbf 100644 --- a/src/v0/destinations/factorsai/transform.js +++ b/src/v0/destinations/factorsai/transform.js @@ -1,3 +1,4 @@ +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { @@ -9,7 +10,6 @@ const { simpleProcessRouterDest, } = require('../../util'); const { JSON_MIME_TYPE } = require('../../util/constant'); -const { InstrumentationError } = require('../../util/errorTypes'); const { ConfigCategories, mappingConfig, BASE_URL } = require('./config'); diff --git a/src/v0/destinations/fb/config.js b/src/v0/destinations/fb/config.js index 2ad9aeacba..0e52b42416 100644 --- a/src/v0/destinations/fb/config.js +++ b/src/v0/destinations/fb/config.js @@ -1,6 +1,8 @@ const fs = require('fs'); const path = require('path'); +const VERSION = 'v18.0'; + const getPath = (file) => path.resolve(__dirname, file); const baseMapping = JSON.parse(fs.readFileSync(getPath('./data/FbAppBasicMapping.json'))); @@ -20,6 +22,7 @@ const eventPropToTypeMapping = JSON.parse( ); module.exports = { + VERSION, baseMapping, eventNameMapping, eventPropsMapping, diff --git a/src/v0/destinations/fb/transform.js b/src/v0/destinations/fb/transform.js index 756c74ba83..e6f8e986cf 100644 --- a/src/v0/destinations/fb/transform.js +++ b/src/v0/destinations/fb/transform.js @@ -1,6 +1,7 @@ const get = require('get-value'); const set = require('set-value'); const sha256 = require('sha256'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { removeUndefinedValues, @@ -13,6 +14,7 @@ const { } = require('../../util'); const { + VERSION, baseMapping, eventNameMapping, eventPropsMapping, @@ -20,7 +22,6 @@ const { eventPropToTypeMapping, } = require('./config'); const logger = require('../../../logger'); -const { InstrumentationError } = require('../../util/errorTypes'); // const funcMap = { // integer: parseInt, @@ -250,7 +251,7 @@ function responseBuilderSimple(message, payload, destination) { // "https://graph.facebook.com/v13.0/644748472345539/activities" - const endpoint = `https://graph.facebook.com/v17.0/${appID}/activities`; + const endpoint = `https://graph.facebook.com/${VERSION}/${appID}/activities`; const response = defaultRequestConfig(); response.endpoint = endpoint; diff --git a/src/v0/destinations/fb_custom_audience/config.js b/src/v0/destinations/fb_custom_audience/config.js index 635ad2a9bb..284ab0d4a4 100644 --- a/src/v0/destinations/fb_custom_audience/config.js +++ b/src/v0/destinations/fb_custom_audience/config.js @@ -1,4 +1,4 @@ -const BASE_URL = 'https://graph.facebook.com/v17.0'; +const BASE_URL = 'https://graph.facebook.com/v18.0'; function getEndPoint(audienceId) { return `${BASE_URL}/${audienceId}/users`; @@ -93,7 +93,7 @@ const subTypeFields = [ // const MAX_USER_COUNT = 500; (using from destination definition) const USER_ADD = 'add'; const USER_DELETE = 'remove'; -/* No official Documentation is available for this but using trial +/* No official Documentation is available for this but using trial and error method we found that 65000 bytes is the maximum payload allowed size but we are 60000 just to be sure batching is done properly */ const maxPayloadSize = 60000; // bytes diff --git a/src/v0/destinations/fb_custom_audience/transform.js b/src/v0/destinations/fb_custom_audience/transform.js index f31a3dd42e..9320a3476b 100644 --- a/src/v0/destinations/fb_custom_audience/transform.js +++ b/src/v0/destinations/fb_custom_audience/transform.js @@ -1,5 +1,10 @@ const lodash = require('lodash'); const get = require('get-value'); +const { + InstrumentationError, + TransformationError, + ConfigurationError, +} = require('@rudderstack/integrations-lib'); const { defaultRequestConfig, defaultPostRequestConfig, @@ -26,11 +31,6 @@ const { } = require('./config'); const { MappedToDestinationKey } = require('../../../constants'); -const { - InstrumentationError, - TransformationError, - ConfigurationError, -} = require('../../util/errorTypes'); const responseBuilderSimple = (payload, audienceId) => { if (payload) { diff --git a/src/v0/destinations/fb_custom_audience/util.js b/src/v0/destinations/fb_custom_audience/util.js index 9e7198e393..47ccb9bf7d 100644 --- a/src/v0/destinations/fb_custom_audience/util.js +++ b/src/v0/destinations/fb_custom_audience/util.js @@ -2,11 +2,11 @@ const lodash = require('lodash'); const sha256 = require('sha256'); const get = require('get-value'); const jsonSize = require('json-size'); +const { InstrumentationError, ConfigurationError } = require('@rudderstack/integrations-lib'); const stats = require('../../../util/stats'); const { isDefinedAndNotNull } = require('../../util'); const { maxPayloadSize } = require('./config'); -const { InstrumentationError, ConfigurationError } = require('../../util/errorTypes'); /** * Example payload ={ diff --git a/src/v0/destinations/firehose/transform.js b/src/v0/destinations/firehose/transform.js index b0dc841579..81e2a1ebc8 100644 --- a/src/v0/destinations/firehose/transform.js +++ b/src/v0/destinations/firehose/transform.js @@ -1,6 +1,6 @@ const isString = require('lodash/isString'); +const { ConfigurationError } = require('@rudderstack/integrations-lib'); const { getHashFromArray, simpleProcessRouterDest } = require('../../util'); -const { ConfigurationError } = require('../../util/errorTypes'); function getDeliveryStreamMapTo(event) { const { message, destination } = event; diff --git a/src/v0/destinations/freshmarketer/transform.js b/src/v0/destinations/freshmarketer/transform.js index 41c604d407..aa0e03811d 100644 --- a/src/v0/destinations/freshmarketer/transform.js +++ b/src/v0/destinations/freshmarketer/transform.js @@ -1,4 +1,9 @@ const get = require('get-value'); +const { + InstrumentationError, + NetworkInstrumentationError, + TransformationError, +} = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { defaultRequestConfig, @@ -9,11 +14,6 @@ const { getValidDynamicFormConfig, simpleProcessRouterDest, } = require('../../util'); -const { - InstrumentationError, - NetworkInstrumentationError, - TransformationError, -} = require('../../util/errorTypes'); const { CONFIG_CATEGORIES, MAPPING_CONFIG } = require('./config'); const { diff --git a/src/v0/destinations/freshmarketer/utils.js b/src/v0/destinations/freshmarketer/utils.js index f7dcc46b06..6fa1fe9976 100644 --- a/src/v0/destinations/freshmarketer/utils.js +++ b/src/v0/destinations/freshmarketer/utils.js @@ -1,5 +1,10 @@ /* eslint-disable no-param-reassign */ const get = require('get-value'); +const { + InstrumentationError, + NetworkInstrumentationError, + NetworkError, +} = require('@rudderstack/integrations-lib'); const logger = require('../../../logger'); const { httpPOST, httpGET } = require('../../../adapters/network'); const { @@ -13,11 +18,6 @@ const { getFieldValueFromMessage, } = require('../../util'); const { CONFIG_CATEGORIES, LIFECYCLE_STAGE_ENDPOINT } = require('./config'); -const { - InstrumentationError, - NetworkInstrumentationError, - NetworkError, -} = require('../../util/errorTypes'); const tags = require('../../util/tags'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/destinations/freshsales/transform.js b/src/v0/destinations/freshsales/transform.js index c1e18482ed..096a2d749c 100644 --- a/src/v0/destinations/freshsales/transform.js +++ b/src/v0/destinations/freshsales/transform.js @@ -1,4 +1,5 @@ const get = require('get-value'); +const { InstrumentationError, TransformationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { defaultRequestConfig, @@ -10,7 +11,6 @@ const { simpleProcessRouterDest, validateEventName, } = require('../../util'); -const { InstrumentationError, TransformationError } = require('../../util/errorTypes'); const { CONFIG_CATEGORIES, MAPPING_CONFIG } = require('./config'); const { getUserAccountDetails, diff --git a/src/v0/destinations/freshsales/utils.js b/src/v0/destinations/freshsales/utils.js index b30d9fa16b..96acabb037 100644 --- a/src/v0/destinations/freshsales/utils.js +++ b/src/v0/destinations/freshsales/utils.js @@ -1,5 +1,10 @@ /* eslint-disable no-param-reassign */ const get = require('get-value'); +const { + NetworkInstrumentationError, + InstrumentationError, + NetworkError, +} = require('@rudderstack/integrations-lib'); const { httpPOST, httpGET } = require('../../../adapters/network'); const { processAxiosResponse, @@ -10,11 +15,6 @@ const { defaultPostRequestConfig, getFieldValueFromMessage, } = require('../../util'); -const { - NetworkInstrumentationError, - InstrumentationError, - NetworkError, -} = require('../../util/errorTypes'); const { CONFIG_CATEGORIES, LIFECYCLE_STAGE_ENDPOINT } = require('./config'); const tags = require('../../util/tags'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/destinations/ga/deleteUsers.js b/src/v0/destinations/ga/deleteUsers.js index cf4694f44a..bb909a0053 100644 --- a/src/v0/destinations/ga/deleteUsers.js +++ b/src/v0/destinations/ga/deleteUsers.js @@ -1,7 +1,7 @@ const { isEmpty } = require('lodash'); +const { InstrumentationError, OAuthSecretError } = require('@rudderstack/integrations-lib'); const { httpPOST } = require('../../../adapters/network'); -const { InstrumentationError, OAuthSecretError } = require('../../util/errorTypes'); const { executeCommonValidations } = require('../../util/regulation-api'); const { GA_USER_DELETION_ENDPOINT } = require('./config'); const { gaResponseHandler } = require('./networkHandler'); diff --git a/src/v0/destinations/ga/networkHandler.js b/src/v0/destinations/ga/networkHandler.js index a12f9594cd..57db1cb7af 100644 --- a/src/v0/destinations/ga/networkHandler.js +++ b/src/v0/destinations/ga/networkHandler.js @@ -1,3 +1,4 @@ +const { NetworkError, InvalidAuthTokenError } = require('@rudderstack/integrations-lib'); const { REFRESH_TOKEN, AUTH_STATUS_INACTIVE, @@ -7,7 +8,6 @@ const { getDynamicErrorType, } = require('../../../adapters/utils/networkUtils'); -const { NetworkError, InvalidAuthTokenError } = require('../../util/errorTypes'); const tags = require('../../util/tags'); /** diff --git a/src/v0/destinations/ga/transform.js b/src/v0/destinations/ga/transform.js index c10697c4e1..32e94bdd41 100644 --- a/src/v0/destinations/ga/transform.js +++ b/src/v0/destinations/ga/transform.js @@ -1,6 +1,7 @@ /* eslint-disable no-nested-ternary */ const get = require('get-value'); const md5 = require('md5'); +const { InstrumentationError, ConfigurationError } = require('@rudderstack/integrations-lib'); const { EventType, MappedToDestinationKey } = require('../../../constants'); const { Event, GA_ENDPOINT, ConfigCategory, mappingConfig, nameToEventMap } = require('./config'); const { setContextualFields } = require('./utils'); @@ -19,7 +20,6 @@ const { } = require('../../util'); const { isDefinedAndNotNull } = require('../../util'); -const { InstrumentationError, ConfigurationError } = require('../../util/errorTypes'); const gaDisplayName = 'Google Analytics'; diff --git a/src/v0/destinations/ga/utils.js b/src/v0/destinations/ga/utils.js index 0d3a2f9798..617f2522a0 100644 --- a/src/v0/destinations/ga/utils.js +++ b/src/v0/destinations/ga/utils.js @@ -1,4 +1,4 @@ -const { InstrumentationError } = require('../../util/errorTypes'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { GA_ENDPOINT } = require('./config'); /** diff --git a/src/v0/destinations/ga360/transform.js b/src/v0/destinations/ga360/transform.js index c60ea47551..3655c330d5 100644 --- a/src/v0/destinations/ga360/transform.js +++ b/src/v0/destinations/ga360/transform.js @@ -1,5 +1,6 @@ const get = require('get-value'); const md5 = require('md5'); +const { ConfigurationError, InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { Event, GA_ENDPOINT, ConfigCategory, mappingConfig, nameToEventMap } = require('./config'); const { @@ -12,7 +13,6 @@ const { getDestinationExternalID, simpleProcessRouterDest, } = require('../../util'); -const { ConfigurationError, InstrumentationError } = require('../../util/errorTypes'); const gaDisplayName = 'Google Analytics'; diff --git a/src/v0/destinations/ga4/networkHandler.js b/src/v0/destinations/ga4/networkHandler.js index e90d2c3095..b62fcc8d3b 100644 --- a/src/v0/destinations/ga4/networkHandler.js +++ b/src/v0/destinations/ga4/networkHandler.js @@ -1,3 +1,4 @@ +const { NetworkError } = require('@rudderstack/integrations-lib'); const { proxyRequest, prepareProxyRequest } = require('../../../adapters/network'); const { getDynamicErrorType, @@ -5,7 +6,6 @@ const { } = require('../../../adapters/utils/networkUtils'); const { isDefinedAndNotNull, isDefined, isHttpStatusSuccess } = require('../../util'); -const { NetworkError } = require('../../util/errorTypes'); const tags = require('../../util/tags'); const responseHandler = (destinationResponse, dest) => { diff --git a/src/v0/destinations/ga4/transform.js b/src/v0/destinations/ga4/transform.js index d1d0790fa9..d8fc531e92 100644 --- a/src/v0/destinations/ga4/transform.js +++ b/src/v0/destinations/ga4/transform.js @@ -1,4 +1,9 @@ const get = require('get-value'); +const { + ConfigurationError, + InstrumentationError, + UnsupportedEventError, +} = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { isEmptyObject, @@ -11,11 +16,6 @@ const { getDestinationExternalID, removeUndefinedAndNullValues, } = require('../../util'); -const { - ConfigurationError, - InstrumentationError, - UnsupportedEventError, -} = require('../../util/errorTypes'); const { ENDPOINT, mappingConfig, diff --git a/src/v0/destinations/ga4/utils.js b/src/v0/destinations/ga4/utils.js index d356300ff7..e4db494727 100644 --- a/src/v0/destinations/ga4/utils.js +++ b/src/v0/destinations/ga4/utils.js @@ -1,4 +1,5 @@ const get = require('get-value'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { isEmpty, constructPayload, @@ -7,7 +8,6 @@ const { extractCustomFields, isDefinedAndNotNull, } = require('../../util'); -const { InstrumentationError } = require('../../util/errorTypes'); const { mappingConfig, ConfigCategory } = require('./config'); /** diff --git a/src/v0/destinations/gainsight/transform.js b/src/v0/destinations/gainsight/transform.js index f58fc0d566..f47296f066 100644 --- a/src/v0/destinations/gainsight/transform.js +++ b/src/v0/destinations/gainsight/transform.js @@ -1,6 +1,7 @@ /* eslint-disable no-nested-ternary */ const set = require('set-value'); const get = require('get-value'); +const { InstrumentationError, ConfigurationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { identifyMapping, @@ -28,7 +29,6 @@ const { renameCustomFieldsFromMap, getConfigOrThrowError, } = require('./util'); -const { InstrumentationError, ConfigurationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); /** diff --git a/src/v0/destinations/gainsight/util.js b/src/v0/destinations/gainsight/util.js index 3c986b420d..39e666c1a5 100644 --- a/src/v0/destinations/gainsight/util.js +++ b/src/v0/destinations/gainsight/util.js @@ -1,7 +1,11 @@ +const { + ConfigurationError, + RetryableError, + NetworkError, +} = require('@rudderstack/integrations-lib'); const myAxios = require('../../../util/myAxios'); const { getDynamicErrorType } = require('../../../adapters/utils/networkUtils'); const logger = require('../../../logger'); -const { ConfigurationError, RetryableError, NetworkError } = require('../../util/errorTypes'); const { ENDPOINTS, getLookupPayload } = require('./config'); const tags = require('../../util/tags'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/destinations/gainsight_px/transform.js b/src/v0/destinations/gainsight_px/transform.js index ab66b87c5a..4d91980f11 100644 --- a/src/v0/destinations/gainsight_px/transform.js +++ b/src/v0/destinations/gainsight_px/transform.js @@ -1,4 +1,5 @@ /* eslint-disable no-nested-ternary */ +const { InstrumentationError, ConfigurationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { isEmptyObject, @@ -29,7 +30,6 @@ const { groupMapping, identifyMapping, } = require('./config'); -const { InstrumentationError, ConfigurationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); /** diff --git a/src/v0/destinations/gainsight_px/util.js b/src/v0/destinations/gainsight_px/util.js index 6900180ab5..5109286b3f 100644 --- a/src/v0/destinations/gainsight_px/util.js +++ b/src/v0/destinations/gainsight_px/util.js @@ -1,6 +1,6 @@ +const { NetworkError } = require('@rudderstack/integrations-lib'); const myAxios = require('../../../util/myAxios'); const { ENDPOINTS } = require('./config'); -const { NetworkError } = require('../../util/errorTypes'); const tags = require('../../util/tags'); const { getDynamicErrorType } = require('../../../adapters/utils/networkUtils'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/destinations/google_adwords_enhanced_conversions/networkHandler.js b/src/v0/destinations/google_adwords_enhanced_conversions/networkHandler.js index e25349dfdc..8ac432935f 100644 --- a/src/v0/destinations/google_adwords_enhanced_conversions/networkHandler.js +++ b/src/v0/destinations/google_adwords_enhanced_conversions/networkHandler.js @@ -1,5 +1,6 @@ const { get, set } = require('lodash'); const sha256 = require('sha256'); +const { NetworkError, NetworkInstrumentationError } = require('@rudderstack/integrations-lib'); const { prepareProxyRequest, handleHttpRequest } = require('../../../adapters/network'); const { isHttpStatusSuccess, getAuthErrCategoryFromStCode } = require('../../util/index'); const { CONVERSION_ACTION_ID_CACHE_TTL } = require('./config'); @@ -12,7 +13,7 @@ const { getDynamicErrorType, } = require('../../../adapters/utils/networkUtils'); const { BASE_ENDPOINT } = require('./config'); -const { NetworkError, NetworkInstrumentationError } = require('../../util/errorTypes'); + const tags = require('../../util/tags'); const ERROR_MSG_PATH = 'response[0].error.message'; diff --git a/src/v0/destinations/google_adwords_enhanced_conversions/transform.js b/src/v0/destinations/google_adwords_enhanced_conversions/transform.js index 898c3f95b0..0be7c3f0ee 100644 --- a/src/v0/destinations/google_adwords_enhanced_conversions/transform.js +++ b/src/v0/destinations/google_adwords_enhanced_conversions/transform.js @@ -2,6 +2,7 @@ const get = require('get-value'); const { cloneDeep } = require('lodash'); +const { InstrumentationError, ConfigurationError } = require('@rudderstack/integrations-lib'); const { constructPayload, defaultRequestConfig, @@ -11,8 +12,6 @@ const { getAccessToken, } = require('../../util'); -const { InstrumentationError, ConfigurationError } = require('../../util/errorTypes'); - const { trackMapping, BASE_ENDPOINT } = require('./config'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/destinations/google_adwords_offline_conversions/networkHandler.js b/src/v0/destinations/google_adwords_offline_conversions/networkHandler.js index 71fdccff20..a87a2431f2 100644 --- a/src/v0/destinations/google_adwords_offline_conversions/networkHandler.js +++ b/src/v0/destinations/google_adwords_offline_conversions/networkHandler.js @@ -1,6 +1,11 @@ const set = require('set-value'); const get = require('get-value'); const sha256 = require('sha256'); +const { + AbortedError, + NetworkInstrumentationError, + NetworkError, +} = require('@rudderstack/integrations-lib'); const { prepareProxyRequest, httpSend, httpPOST } = require('../../../adapters/network'); const { isHttpStatusSuccess, @@ -15,11 +20,6 @@ const { processAxiosResponse, getDynamicErrorType, } = require('../../../adapters/utils/networkUtils'); -const { - AbortedError, - NetworkInstrumentationError, - NetworkError, -} = require('../../util/errorTypes'); const tags = require('../../util/tags'); const conversionCustomVariableCache = new Cache(CONVERSION_CUSTOM_VARIABLE_CACHE_TTL); diff --git a/src/v0/destinations/google_adwords_offline_conversions/transform.js b/src/v0/destinations/google_adwords_offline_conversions/transform.js index 0186739d37..397895c603 100644 --- a/src/v0/destinations/google_adwords_offline_conversions/transform.js +++ b/src/v0/destinations/google_adwords_offline_conversions/transform.js @@ -1,4 +1,5 @@ const { set, get } = require('lodash'); +const { InstrumentationError, ConfigurationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { getHashFromArrayWithDuplicate, @@ -21,7 +22,6 @@ const { requestBuilder, getClickConversionPayloadAndEndpoint, } = require('./utils'); -const { InstrumentationError, ConfigurationError } = require('../../util/errorTypes'); const helper = require('./helper'); /** diff --git a/src/v0/destinations/google_adwords_offline_conversions/utils.js b/src/v0/destinations/google_adwords_offline_conversions/utils.js index 7fa5eb29af..c69c5a436f 100644 --- a/src/v0/destinations/google_adwords_offline_conversions/utils.js +++ b/src/v0/destinations/google_adwords_offline_conversions/utils.js @@ -1,5 +1,10 @@ const sha256 = require('sha256'); const { get, set, cloneDeep } = require('lodash'); +const { + AbortedError, + ConfigurationError, + InstrumentationError, +} = require('@rudderstack/integrations-lib'); const { httpPOST } = require('../../../adapters/network'); const { isHttpStatusSuccess, @@ -24,7 +29,6 @@ const { } = require('./config'); const { processAxiosResponse } = require('../../../adapters/utils/networkUtils'); const Cache = require('../../util/cache'); -const { AbortedError, ConfigurationError, InstrumentationError } = require('../../util/errorTypes'); const helper = require('./helper'); const conversionActionIdCache = new Cache(CONVERSION_ACTION_ID_CACHE_TTL); diff --git a/src/v0/destinations/google_adwords_remarketing_lists/networkHandler.js b/src/v0/destinations/google_adwords_remarketing_lists/networkHandler.js index b8470f9d28..5be8597bdb 100644 --- a/src/v0/destinations/google_adwords_remarketing_lists/networkHandler.js +++ b/src/v0/destinations/google_adwords_remarketing_lists/networkHandler.js @@ -1,3 +1,4 @@ +const { NetworkError } = require('@rudderstack/integrations-lib'); const { httpSend, prepareProxyRequest } = require('../../../adapters/network'); const { isHttpStatusSuccess, getAuthErrCategoryFromStCode } = require('../../util/index'); @@ -5,7 +6,6 @@ const { processAxiosResponse, getDynamicErrorType, } = require('../../../adapters/utils/networkUtils'); -const { NetworkError } = require('../../util/errorTypes'); const tags = require('../../util/tags'); /** * This function helps to create a offlineUserDataJobs diff --git a/src/v0/destinations/google_adwords_remarketing_lists/transform.js b/src/v0/destinations/google_adwords_remarketing_lists/transform.js index f8cd7c7037..884fcd71f6 100644 --- a/src/v0/destinations/google_adwords_remarketing_lists/transform.js +++ b/src/v0/destinations/google_adwords_remarketing_lists/transform.js @@ -1,5 +1,6 @@ const sha256 = require('sha256'); const get = require('get-value'); +const { InstrumentationError, ConfigurationError } = require('@rudderstack/integrations-lib'); const logger = require('../../../logger'); const { isDefinedAndNotNullAndNotEmpty, @@ -14,7 +15,6 @@ const { getAccessToken, } = require('../../util'); -const { InstrumentationError, ConfigurationError } = require('../../util/errorTypes'); const { offlineDataJobsMapping, addressInfoMapping, diff --git a/src/v0/destinations/google_cloud_function/util.js b/src/v0/destinations/google_cloud_function/util.js index 0a4fb9f4de..8f85460902 100644 --- a/src/v0/destinations/google_cloud_function/util.js +++ b/src/v0/destinations/google_cloud_function/util.js @@ -1,4 +1,4 @@ -const { ConfigurationError } = require('../../util/errorTypes'); +const { ConfigurationError } = require('@rudderstack/integrations-lib'); /** * validate destination config diff --git a/src/v0/destinations/googlepubsub/transform.js b/src/v0/destinations/googlepubsub/transform.js index 44208735e0..7a022d6c29 100644 --- a/src/v0/destinations/googlepubsub/transform.js +++ b/src/v0/destinations/googlepubsub/transform.js @@ -1,5 +1,5 @@ +const { ConfigurationError } = require('@rudderstack/integrations-lib'); const { simpleProcessRouterDest } = require('../../util'); -const { ConfigurationError } = require('../../util/errorTypes'); const { getTopic, createAttributesMetadata } = require('./util'); diff --git a/src/v0/destinations/googlesheets/transform.js b/src/v0/destinations/googlesheets/transform.js index 6cfb3f1d1e..6e27f6192c 100644 --- a/src/v0/destinations/googlesheets/transform.js +++ b/src/v0/destinations/googlesheets/transform.js @@ -1,12 +1,12 @@ /* eslint-disable no-nested-ternary */ const get = require('get-value'); +const { ConfigurationError } = require('@rudderstack/integrations-lib'); const { getValueFromMessage, getSuccessRespEvents, handleRtTfSingleEventError, checkInvalidRtTfEvents, } = require('../../util'); -const { ConfigurationError } = require('../../util/errorTypes'); const SOURCE_KEYS = ['properties', 'traits', 'context.traits']; diff --git a/src/v0/destinations/heap/transform.js b/src/v0/destinations/heap/transform.js index 32196eb7be..4256324165 100644 --- a/src/v0/destinations/heap/transform.js +++ b/src/v0/destinations/heap/transform.js @@ -1,3 +1,4 @@ +const { InstrumentationError, TransformationError } = require('@rudderstack/integrations-lib'); const { CONFIG_CATEGORIES, MAPPING_CONFIG } = require('./config'); const { EventType } = require('../../../constants'); const { @@ -8,7 +9,6 @@ const { flattenJson, simpleProcessRouterDest, } = require('../../util'); -const { InstrumentationError, TransformationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); function responseBuilderSimple(message, category, destination) { diff --git a/src/v0/destinations/hs/HSTransform-v1.js b/src/v0/destinations/hs/HSTransform-v1.js index 30546ad8f6..51feebea74 100644 --- a/src/v0/destinations/hs/HSTransform-v1.js +++ b/src/v0/destinations/hs/HSTransform-v1.js @@ -1,5 +1,10 @@ const get = require('get-value'); const lodash = require('lodash'); +const { + InstrumentationError, + ConfigurationError, + TransformationError, +} = require('@rudderstack/integrations-lib'); const { MappedToDestinationKey, GENERIC_TRUE_VALUES } = require('../../../constants'); const { defaultGetRequestConfig, @@ -14,11 +19,6 @@ const { getDestinationExternalID, getDestinationExternalIDInfoForRetl, } = require('../../util'); -const { - InstrumentationError, - ConfigurationError, - TransformationError, -} = require('../../util/errorTypes'); const { BATCH_CONTACT_ENDPOINT, MAX_BATCH_SIZE, diff --git a/src/v0/destinations/hs/HSTransform-v2.js b/src/v0/destinations/hs/HSTransform-v2.js index 26c12d3eea..2acdd82152 100644 --- a/src/v0/destinations/hs/HSTransform-v2.js +++ b/src/v0/destinations/hs/HSTransform-v2.js @@ -1,5 +1,10 @@ const get = require('get-value'); const lodash = require('lodash'); +const { + TransformationError, + ConfigurationError, + InstrumentationError, +} = require('@rudderstack/integrations-lib'); const { MappedToDestinationKey, GENERIC_TRUE_VALUES } = require('../../../constants'); const { defaultPostRequestConfig, @@ -16,11 +21,6 @@ const { getDestinationExternalIDInfoForRetl, getDestinationExternalIDObjectForRetl, } = require('../../util'); -const { - TransformationError, - ConfigurationError, - InstrumentationError, -} = require('../../util/errorTypes'); const { IDENTIFY_CRM_UPDATE_CONTACT, IDENTIFY_CRM_CREATE_NEW_CONTACT, diff --git a/src/v0/destinations/hs/transform.js b/src/v0/destinations/hs/transform.js index a2326e0395..c26e024a6c 100644 --- a/src/v0/destinations/hs/transform.js +++ b/src/v0/destinations/hs/transform.js @@ -1,4 +1,5 @@ const get = require('get-value'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { checkInvalidRtTfEvents, @@ -19,7 +20,6 @@ const { getProperties, validateDestinationConfig, } = require('./util'); -const { InstrumentationError } = require('../../util/errorTypes'); const processSingleMessage = async (message, destination, propertyMap) => { if (!message.type) { diff --git a/src/v0/destinations/hs/util.js b/src/v0/destinations/hs/util.js index eb062b0c39..f83ce0b6de 100644 --- a/src/v0/destinations/hs/util.js +++ b/src/v0/destinations/hs/util.js @@ -1,4 +1,10 @@ const get = require('get-value'); +const { + NetworkInstrumentationError, + InstrumentationError, + ConfigurationError, + NetworkError, +} = require('@rudderstack/integrations-lib'); const { httpGET, httpPOST } = require('../../../adapters/network'); const { processAxiosResponse, @@ -12,12 +18,6 @@ const { getDestinationExternalIDInfoForRetl, getValueFromMessage, } = require('../../util'); -const { - NetworkInstrumentationError, - InstrumentationError, - ConfigurationError, - NetworkError, -} = require('../../util/errorTypes'); const { CONTACT_PROPERTY_MAP_ENDPOINT, IDENTIFY_CRM_SEARCH_CONTACT, @@ -607,7 +607,8 @@ const splitEventsForCreateUpdate = async (inputs, destination) => { const { destinationExternalId } = getDestinationExternalIDInfoForRetl(message, DESTINATION); const filteredInfo = updateHubspotIds.filter( - (update) => update.property.toString().toLowerCase() === destinationExternalId.toString().toLowerCase(), + (update) => + update.property.toString().toLowerCase() === destinationExternalId.toString().toLowerCase(), ); if (filteredInfo.length > 0) { diff --git a/src/v0/destinations/impact/transform.js b/src/v0/destinations/impact/transform.js index 026318cec7..2eefdf7992 100644 --- a/src/v0/destinations/impact/transform.js +++ b/src/v0/destinations/impact/transform.js @@ -1,5 +1,10 @@ const sha1 = require('js-sha1'); const btoa = require('btoa'); +const { + ConfigurationError, + TransformationError, + InstrumentationError, +} = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { CONFIG_CATEGORIES, MAPPING_CONFIG } = require('./config'); const { @@ -17,11 +22,6 @@ const { removeUndefinedAndNullValues, isDefinedAndNotNullAndNotEmpty, } = require('../../util'); -const { - ConfigurationError, - TransformationError, - InstrumentationError, -} = require('../../util/errorTypes'); /** * This function takes the transformed payload, endpoint and destination Config as input and returns the prepared response. diff --git a/src/v0/destinations/indicative/transform.js b/src/v0/destinations/indicative/transform.js index 81eb19f320..000998c3b8 100644 --- a/src/v0/destinations/indicative/transform.js +++ b/src/v0/destinations/indicative/transform.js @@ -1,4 +1,5 @@ const get = require('get-value'); +const { InstrumentationError, TransformationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { CONFIG_CATEGORIES, MAPPING_CONFIG } = require('./config'); const { @@ -9,7 +10,6 @@ const { simpleProcessRouterDest, } = require('../../util'); const { getUAInfo } = require('./utils'); -const { InstrumentationError, TransformationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const handleProperties = (properties) => { diff --git a/src/v0/destinations/intercom/deleteUsers.js b/src/v0/destinations/intercom/deleteUsers.js index 9241a22906..e11d352117 100644 --- a/src/v0/destinations/intercom/deleteUsers.js +++ b/src/v0/destinations/intercom/deleteUsers.js @@ -1,8 +1,8 @@ +const { NetworkError, ConfigurationError } = require('@rudderstack/integrations-lib'); const { httpPOST } = require('../../../adapters/network'); const { processAxiosResponse } = require('../../../adapters/utils/networkUtils'); const { isHttpStatusSuccess } = require('../../util'); const { getDynamicErrorType } = require('../../../adapters/utils/networkUtils'); -const { NetworkError, ConfigurationError } = require('../../util/errorTypes'); const { executeCommonValidations } = require('../../util/regulation-api'); const tags = require('../../util/tags'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/destinations/intercom/networkHandler.js b/src/v0/destinations/intercom/networkHandler.js index 33f78e8cf6..a4106257b3 100644 --- a/src/v0/destinations/intercom/networkHandler.js +++ b/src/v0/destinations/intercom/networkHandler.js @@ -1,8 +1,7 @@ +const { RetryableError } = require('@rudderstack/integrations-lib'); const { proxyRequest, prepareProxyRequest } = require('../../../adapters/network'); const { processAxiosResponse } = require('../../../adapters/utils/networkUtils'); -const { RetryableError } = require('../../util/errorTypes'); - const errorResponseHandler = (destinationResponse, dest) => { const { status } = destinationResponse; if (status === 408) { diff --git a/src/v0/destinations/intercom/transform.js b/src/v0/destinations/intercom/transform.js index 552c80527c..212eaba13b 100644 --- a/src/v0/destinations/intercom/transform.js +++ b/src/v0/destinations/intercom/transform.js @@ -1,5 +1,6 @@ const md5 = require('md5'); const get = require('get-value'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType, MappedToDestinationKey } = require('../../../constants'); const { ConfigCategory, @@ -18,7 +19,6 @@ const { flattenJson, } = require('../../util'); const { separateReservedAndRestMetadata } = require('./util'); -const { InstrumentationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); function getCompanyAttribute(company) { diff --git a/src/v0/destinations/iterable/deleteUsers.js b/src/v0/destinations/iterable/deleteUsers.js index 834cccd4cb..a179a8930f 100644 --- a/src/v0/destinations/iterable/deleteUsers.js +++ b/src/v0/destinations/iterable/deleteUsers.js @@ -1,8 +1,8 @@ +const { NetworkError, ConfigurationError } = require('@rudderstack/integrations-lib'); const { httpDELETE } = require('../../../adapters/network'); const { processAxiosResponse } = require('../../../adapters/utils/networkUtils'); const { isHttpStatusSuccess } = require('../../util'); const { getDynamicErrorType } = require('../../../adapters/utils/networkUtils'); -const { NetworkError, ConfigurationError } = require('../../util/errorTypes'); const { executeCommonValidations } = require('../../util/regulation-api'); const tags = require('../../util/tags'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/destinations/iterable/transform.js b/src/v0/destinations/iterable/transform.js index c54b579a52..64bdcfcfa4 100644 --- a/src/v0/destinations/iterable/transform.js +++ b/src/v0/destinations/iterable/transform.js @@ -1,5 +1,6 @@ const lodash = require('lodash'); const get = require('get-value'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { getCatalogEndpoint, hasMultipleResponses, @@ -26,7 +27,6 @@ const { } = require('../../util'); const { JSON_MIME_TYPE } = require('../../util/constant'); const { mappingConfig, ConfigCategory } = require('./config'); -const { InstrumentationError } = require('../../util/errorTypes'); const { EventType, MappedToDestinationKey } = require('../../../constants'); /** diff --git a/src/v0/destinations/iterable/util.js b/src/v0/destinations/iterable/util.js index 0b7e402f01..7c1509c2b7 100644 --- a/src/v0/destinations/iterable/util.js +++ b/src/v0/destinations/iterable/util.js @@ -1,6 +1,7 @@ const lodash = require('lodash'); const get = require('get-value'); const jsonSize = require('json-size'); +const { InstrumentationError, ConfigurationError } = require('@rudderstack/integrations-lib'); const { isAppleFamily, constructPayload, @@ -20,7 +21,6 @@ const { } = require('./config'); const { JSON_MIME_TYPE } = require('../../util/constant'); const { EventType, MappedToDestinationKey } = require('../../../constants'); -const { InstrumentationError, ConfigurationError } = require('../../util/errorTypes'); const MESSAGE_JSON_PATH = 'message.body.JSON'; diff --git a/src/v0/destinations/june/transform.js b/src/v0/destinations/june/transform.js index f85cb0fd3d..c8f3206903 100644 --- a/src/v0/destinations/june/transform.js +++ b/src/v0/destinations/june/transform.js @@ -1,3 +1,4 @@ +const { TransformationError, InstrumentationError } = require('@rudderstack/integrations-lib'); const { isEmptyObject, constructPayload, @@ -10,7 +11,6 @@ const { const { EventType } = require('../../../constants'); const { JSON_MIME_TYPE } = require('../../util/constant'); const { CONFIG_CATEGORIES, MAPPING_CONFIG } = require('./config'); -const { TransformationError, InstrumentationError } = require('../../util/errorTypes'); const responseBuilder = (payload, endpoint, destination) => { const destPayload = payload; diff --git a/src/v0/destinations/kafka/transform.js b/src/v0/destinations/kafka/transform.js index 39334b5f52..b08c717475 100644 --- a/src/v0/destinations/kafka/transform.js +++ b/src/v0/destinations/kafka/transform.js @@ -8,7 +8,6 @@ const { getSuccessRespEvents, getErrorRespEvents, } = require('../../util'); -// const { InstrumentationError } = require("../../util/errorTypes"); const filterConfigTopics = (message, destination) => { const { Config } = destination; diff --git a/src/v0/destinations/keen/transform.js b/src/v0/destinations/keen/transform.js index 6d99c90dcc..b68b5e5e1d 100644 --- a/src/v0/destinations/keen/transform.js +++ b/src/v0/destinations/keen/transform.js @@ -2,6 +2,7 @@ /* eslint-disable no-nested-ternary */ const isIp = require('is-ip'); const validUrl = require('valid-url'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { defaultPostRequestConfig, @@ -10,7 +11,6 @@ const { getFieldValueFromMessage, simpleProcessRouterDest, } = require('../../util'); -const { InstrumentationError } = require('../../util/errorTypes'); const { ENDPOINT } = require('./config'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/destinations/kissmetrics/transform.js b/src/v0/destinations/kissmetrics/transform.js index 3e2c5593de..b24395076c 100644 --- a/src/v0/destinations/kissmetrics/transform.js +++ b/src/v0/destinations/kissmetrics/transform.js @@ -9,6 +9,7 @@ const is = require('is'); const extend = require('@ndhoule/extend'); const each = require('component-each'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { defaultGetRequestConfig, @@ -17,7 +18,6 @@ const { simpleProcessRouterDest, } = require('../../util'); const { ENDPOINT } = require('./config'); -const { InstrumentationError } = require('../../util/errorTypes'); // source : https://github.com/segment-integrations/analytics.js-integration-kissmetrics/blob/master/lib/index.js function toUnixTimestamp(date) { diff --git a/src/v0/destinations/klaviyo/transform.js b/src/v0/destinations/klaviyo/transform.js index 5ad9b1869d..7c9061fc41 100644 --- a/src/v0/destinations/klaviyo/transform.js +++ b/src/v0/destinations/klaviyo/transform.js @@ -2,6 +2,7 @@ /* eslint-disable no-underscore-dangle */ /* eslint-disable array-callback-return */ const get = require('get-value'); +const { ConfigurationError, InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType, WhiteListedTraits, MappedToDestinationKey } = require('../../../constants'); const { CONFIG_CATEGORIES, @@ -36,7 +37,6 @@ const { flattenJson, isNewStatusCodesAccepted, } = require('../../util'); -const { ConfigurationError, InstrumentationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE, HTTP_STATUS_CODES } = require('../../util/constant'); /** @@ -373,8 +373,9 @@ const processRouterDest = async (inputs, reqMetadata) => { eventDestination, false, HTTP_STATUS_CODES.SUPPRESS_EVENTS, - ), error - } + ), + error, + }; } return getSuccessRespEvents(message, [metadata], eventDestination); }); diff --git a/src/v0/destinations/klaviyo/util.js b/src/v0/destinations/klaviyo/util.js index b31dafd78b..60b334f3a2 100644 --- a/src/v0/destinations/klaviyo/util.js +++ b/src/v0/destinations/klaviyo/util.js @@ -1,5 +1,6 @@ const { defaultRequestConfig } = require('rudder-transformer-cdk/build/utils'); const lodash = require('lodash'); +const { NetworkError, InstrumentationError } = require('@rudderstack/integrations-lib'); const { WhiteListedTraits } = require('../../../constants'); const { @@ -15,7 +16,6 @@ const { const tags = require('../../util/tags'); const { handleHttpRequest } = require('../../../adapters/network'); const { JSON_MIME_TYPE, HTTP_STATUS_CODES } = require('../../util/constant'); -const { NetworkError, InstrumentationError } = require('../../util/errorTypes'); const { getDynamicErrorType } = require('../../../adapters/utils/networkUtils'); const { BASE_ENDPOINT, MAPPING_CONFIG, CONFIG_CATEGORIES, MAX_BATCH_SIZE } = require('./config'); diff --git a/src/v0/destinations/kochava/transform.js b/src/v0/destinations/kochava/transform.js index c5a4fec81f..e9cf2eb1a0 100644 --- a/src/v0/destinations/kochava/transform.js +++ b/src/v0/destinations/kochava/transform.js @@ -1,4 +1,5 @@ const get = require('get-value'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { KOCHAVA_ENDPOINT, @@ -11,7 +12,6 @@ const { formatTimeStamp, isAppleFamily, } = require('../../util'); -const { InstrumentationError } = require('../../util/errorTypes'); // build final response // -------------------- diff --git a/src/v0/destinations/kustomer/transform.js b/src/v0/destinations/kustomer/transform.js index 2898f0dfc2..e5010f55e0 100644 --- a/src/v0/destinations/kustomer/transform.js +++ b/src/v0/destinations/kustomer/transform.js @@ -1,5 +1,6 @@ /* eslint-disable no-nested-ternary */ const get = require('get-value'); +const { TransformationError, InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { CONFIG_CATEGORIES, MAPPING_CONFIG, DEFAULT_BASE_ENDPOINT } = require('./config'); const { @@ -13,7 +14,6 @@ const { simpleProcessRouterDest, } = require('../../util'); const { fetchKustomer, handleAdvancedtransformations } = require('./util'); -const { TransformationError, InstrumentationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); // Function responsible for constructing the Kustomer (User) Payload for identify diff --git a/src/v0/destinations/kustomer/util.js b/src/v0/destinations/kustomer/util.js index 31157b2738..571a03f139 100644 --- a/src/v0/destinations/kustomer/util.js +++ b/src/v0/destinations/kustomer/util.js @@ -2,11 +2,11 @@ const lodash = require('lodash'); const set = require('set-value'); const get = require('get-value'); +const { NetworkError, AbortedError } = require('@rudderstack/integrations-lib'); const myAxios = require('../../../util/myAxios'); const { DEFAULT_BASE_ENDPOINT } = require('./config'); const { getType, isDefinedAndNotNull, isObject } = require('../../util'); const { getDynamicErrorType } = require('../../../adapters/utils/networkUtils'); -const { NetworkError, AbortedError } = require('../../util/errorTypes'); const tags = require('../../util/tags'); /** diff --git a/src/v0/destinations/lambda/transform.js b/src/v0/destinations/lambda/transform.js index 221ef18186..1570a69ec3 100644 --- a/src/v0/destinations/lambda/transform.js +++ b/src/v0/destinations/lambda/transform.js @@ -1,6 +1,6 @@ const _ = require('lodash'); const { getErrorRespEvents, getSuccessRespEvents } = require('../../util'); -const { ConfigurationError } = require('../../util/errorTypes'); +const { ConfigurationError } = require('@rudderstack/integrations-lib'); const DEFAULT_INVOCATION_TYPE = 'Event'; // asynchronous invocation const MAX_PAYLOAD_SIZE_IN_KB = 256; // only for asynchronous invocation diff --git a/src/v0/destinations/leanplum/transform.js b/src/v0/destinations/leanplum/transform.js index 9a5462f2e5..df075dd631 100644 --- a/src/v0/destinations/leanplum/transform.js +++ b/src/v0/destinations/leanplum/transform.js @@ -1,3 +1,4 @@ +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { ConfigCategory, mappingConfig, ENDPOINT, API_VERSION } = require('./config'); const { @@ -7,7 +8,6 @@ const { constructPayload, simpleProcessRouterDest, } = require('../../util'); -const { InstrumentationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); function preparePayload(message, name, destination) { diff --git a/src/v0/destinations/lemnisk/transform.js b/src/v0/destinations/lemnisk/transform.js index 1d6d9a89fb..905199079b 100644 --- a/src/v0/destinations/lemnisk/transform.js +++ b/src/v0/destinations/lemnisk/transform.js @@ -1,3 +1,8 @@ +const { + ConfigurationError, + TransformationError, + InstrumentationError, +} = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { CONFIG_CATEGORIES, @@ -14,11 +19,6 @@ const { isDefinedAndNotNullAndNotEmpty, } = require('../../util'); const { fetchPlatform } = require('./utils'); -const { - ConfigurationError, - TransformationError, - InstrumentationError, -} = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const responseBuilder = (message, category, destination, platform) => { diff --git a/src/v0/destinations/lemnisk/utils.js b/src/v0/destinations/lemnisk/utils.js index 207122153d..28de9ab354 100644 --- a/src/v0/destinations/lemnisk/utils.js +++ b/src/v0/destinations/lemnisk/utils.js @@ -1,4 +1,4 @@ -const { ConfigurationError } = require('../../util/errorTypes'); +const { ConfigurationError } = require('@rudderstack/integrations-lib'); /** * Fetches the platform type from the destination Config diff --git a/src/v0/destinations/lytics/transform.js b/src/v0/destinations/lytics/transform.js index a8d489fa5f..c3a971adba 100644 --- a/src/v0/destinations/lytics/transform.js +++ b/src/v0/destinations/lytics/transform.js @@ -1,3 +1,4 @@ +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { CONFIG_CATEGORIES, @@ -14,7 +15,6 @@ const { flattenJson, simpleProcessRouterDest, } = require('../../util'); -const { InstrumentationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const responseBuilderSimple = (message, category, destination) => { diff --git a/src/v0/destinations/mailchimp/transform.js b/src/v0/destinations/mailchimp/transform.js index ced92ddea1..894f70672a 100644 --- a/src/v0/destinations/mailchimp/transform.js +++ b/src/v0/destinations/mailchimp/transform.js @@ -1,4 +1,5 @@ const lodash = require('lodash'); +const { InstrumentationError, ConfigurationError } = require('@rudderstack/integrations-lib'); const { defaultPutRequestConfig, handleRtTfSingleEventError, @@ -23,7 +24,6 @@ const { stringifyPropertiesValues, } = require('./utils'); const { MAX_BATCH_SIZE, VALID_STATUSES, TRACK_CONFIG } = require('./config'); -const { InstrumentationError, ConfigurationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const responseBuilderSimple = (finalPayload, endpoint, Config, audienceId) => { diff --git a/src/v0/destinations/mailchimp/utils.js b/src/v0/destinations/mailchimp/utils.js index 5a6d62c72c..e1e2e9883b 100644 --- a/src/v0/destinations/mailchimp/utils.js +++ b/src/v0/destinations/mailchimp/utils.js @@ -1,5 +1,6 @@ const get = require('get-value'); const md5 = require('md5'); +const { InstrumentationError, NetworkError } = require('@rudderstack/integrations-lib'); const myAxios = require('../../../util/myAxios'); const { MappedToDestinationKey } = require('../../../constants'); const logger = require('../../../logger'); @@ -15,7 +16,6 @@ const { defaultBatchRequestConfig, constructPayload, } = require('../../util'); -const { InstrumentationError, NetworkError } = require('../../util/errorTypes'); const { MERGE_CONFIG, MERGE_ADDRESS, SUBSCRIPTION_STATUS, VALID_STATUSES } = require('./config'); const { getDynamicErrorType } = require('../../../adapters/utils/networkUtils'); const tags = require('../../util/tags'); diff --git a/src/v0/destinations/mailjet/transform.js b/src/v0/destinations/mailjet/transform.js index 3e3cfe5c81..9156bf45e9 100644 --- a/src/v0/destinations/mailjet/transform.js +++ b/src/v0/destinations/mailjet/transform.js @@ -1,4 +1,5 @@ const lodash = require('lodash'); +const { TransformationError, InstrumentationError } = require('@rudderstack/integrations-lib'); const { getErrorRespEvents, getSuccessRespEvents, @@ -12,7 +13,6 @@ const { const { MAX_BATCH_SIZE } = require('./config'); const { EventType } = require('../../../constants'); const { createOrUpdateContactResponseBuilder } = require('./utils'); -const { TransformationError, InstrumentationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const responseBuilder = (payload) => { diff --git a/src/v0/destinations/mailmodo/transform.js b/src/v0/destinations/mailmodo/transform.js index 39783c864f..756522939d 100644 --- a/src/v0/destinations/mailmodo/transform.js +++ b/src/v0/destinations/mailmodo/transform.js @@ -1,6 +1,7 @@ const lodash = require('lodash'); const get = require('get-value'); const { isEmpty } = require('lodash'); +const { ConfigurationError, InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { ConfigCategory, IDENTIFY_MAX_BATCH_SIZE, mappingConfig, BASE_URL } = require('./config'); const { @@ -14,7 +15,6 @@ const { handleRtTfSingleEventError, } = require('../../util'); const { deduceAddressFields, extractCustomProperties } = require('./utils'); -const { ConfigurationError, InstrumentationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const responseBuilder = (responseConfgs) => { diff --git a/src/v0/destinations/marketo/transform.js b/src/v0/destinations/marketo/transform.js index b23d992b64..5000ef506b 100644 --- a/src/v0/destinations/marketo/transform.js +++ b/src/v0/destinations/marketo/transform.js @@ -3,6 +3,11 @@ /* eslint-disable no-use-before-define */ const get = require('get-value'); const cloneDeep = require('lodash/cloneDeep'); +const { + InstrumentationError, + ConfigurationError, + UnauthorizedError, +} = require('@rudderstack/integrations-lib'); const stats = require('../../../util/stats'); const { EventType, MappedToDestinationKey } = require('../../../constants'); const { @@ -38,11 +43,6 @@ const { getResponseHandlerData, } = require('./util'); const logger = require('../../../logger'); -const { - InstrumentationError, - ConfigurationError, - UnauthorizedError, -} = require('../../util/errorTypes'); const userIdLeadCache = new Cache(USER_LEAD_CACHE_TTL); // 1 day const emailLeadCache = new Cache(USER_LEAD_CACHE_TTL); // 1 day diff --git a/src/v0/destinations/marketo/util.js b/src/v0/destinations/marketo/util.js index 0de14e2072..203e0bf859 100644 --- a/src/v0/destinations/marketo/util.js +++ b/src/v0/destinations/marketo/util.js @@ -1,9 +1,3 @@ -const { httpGET, httpPOST } = require('../../../adapters/network'); -const { - getDynamicErrorType, - processAxiosResponse, -} = require('../../../adapters/utils/networkUtils'); -const { isHttpStatusSuccess } = require('../../util/index'); const { NetworkError, AbortedError, @@ -11,7 +5,13 @@ const { RetryableError, UnhandledStatusCodeError, InstrumentationError, -} = require('../../util/errorTypes'); +} = require('@rudderstack/integrations-lib'); +const { httpGET, httpPOST } = require('../../../adapters/network'); +const { + getDynamicErrorType, + processAxiosResponse, +} = require('../../../adapters/utils/networkUtils'); +const { isHttpStatusSuccess } = require('../../util/index'); const tags = require('../../util/tags'); /** diff --git a/src/v0/destinations/marketo_bulk_upload/fetchJobStatus.js b/src/v0/destinations/marketo_bulk_upload/fetchJobStatus.js index 04eadc4c51..e6f5662000 100644 --- a/src/v0/destinations/marketo_bulk_upload/fetchJobStatus.js +++ b/src/v0/destinations/marketo_bulk_upload/fetchJobStatus.js @@ -1,8 +1,8 @@ /* eslint-disable no-restricted-syntax */ /* eslint-disable no-prototype-builtins */ +const { PlatformError } = require('@rudderstack/integrations-lib'); const { getAccessToken } = require('./util'); const { handleHttpRequest } = require('../../../adapters/network'); -const { PlatformError } = require('../../util/errorTypes'); const stats = require('../../../util/stats'); const { JSON_MIME_TYPE } = require('../../util/constant'); const { diff --git a/src/v0/destinations/marketo_bulk_upload/fileUpload.js b/src/v0/destinations/marketo_bulk_upload/fileUpload.js index 2c77cd6e29..c7212ff9cb 100644 --- a/src/v0/destinations/marketo_bulk_upload/fileUpload.js +++ b/src/v0/destinations/marketo_bulk_upload/fileUpload.js @@ -1,6 +1,12 @@ /* eslint-disable no-plusplus */ const FormData = require('form-data'); const fs = require('fs'); +const { + NetworkError, + ConfigurationError, + RetryableError, + TransformationError, +} = require('@rudderstack/integrations-lib'); const { getAccessToken, getMarketoFilePath, @@ -16,12 +22,6 @@ const { isDefinedAndNotNullAndNotEmpty, } = require('../../util'); const { handleHttpRequest } = require('../../../adapters/network'); -const { - NetworkError, - ConfigurationError, - RetryableError, - TransformationError, -} = require('../../util/errorTypes'); const { client } = require('../../../util/errorNotifier'); const stats = require('../../../util/stats'); diff --git a/src/v0/destinations/marketo_bulk_upload/marketo_bulk_upload.util.test.js b/src/v0/destinations/marketo_bulk_upload/marketo_bulk_upload.util.test.js index 777301b6c3..78ac7c9e48 100644 --- a/src/v0/destinations/marketo_bulk_upload/marketo_bulk_upload.util.test.js +++ b/src/v0/destinations/marketo_bulk_upload/marketo_bulk_upload.util.test.js @@ -4,7 +4,7 @@ const { handleFileUploadResponse, } = require('./util'); -const { AbortedError, RetryableError } = require('../../util/errorTypes'); +const { AbortedError, RetryableError } = require('@rudderstack/integrations-lib'); describe('handleCommonErrorResponse', () => { test('should throw AbortedError for abortable error codes', () => { diff --git a/src/v0/destinations/marketo_bulk_upload/poll.js b/src/v0/destinations/marketo_bulk_upload/poll.js index 5e37fd7c0e..3ad458c545 100644 --- a/src/v0/destinations/marketo_bulk_upload/poll.js +++ b/src/v0/destinations/marketo_bulk_upload/poll.js @@ -1,8 +1,8 @@ +const { NetworkError } = require('@rudderstack/integrations-lib'); const { removeUndefinedValues, isHttpStatusSuccess } = require('../../util'); const { getAccessToken, handlePollResponse, hydrateStatusForServer } = require('./util'); const { handleHttpRequest } = require('../../../adapters/network'); const stats = require('../../../util/stats'); -const { NetworkError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const { POLL_ACTIVITY } = require('./config'); diff --git a/src/v0/destinations/marketo_bulk_upload/transform.js b/src/v0/destinations/marketo_bulk_upload/transform.js index d5764ee6c3..5431e67d38 100644 --- a/src/v0/destinations/marketo_bulk_upload/transform.js +++ b/src/v0/destinations/marketo_bulk_upload/transform.js @@ -1,3 +1,4 @@ +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { getHashFromArray, getFieldValueFromMessage, @@ -5,7 +6,6 @@ const { defaultRequestConfig, } = require('../../util'); const { EventType } = require('../../../constants'); -const { InstrumentationError } = require('../../util/errorTypes'); function responseBuilderSimple(message, destination) { const payload = {}; diff --git a/src/v0/destinations/marketo_bulk_upload/util.js b/src/v0/destinations/marketo_bulk_upload/util.js index a60f57e50b..7b329a3441 100644 --- a/src/v0/destinations/marketo_bulk_upload/util.js +++ b/src/v0/destinations/marketo_bulk_upload/util.js @@ -1,10 +1,10 @@ -const { handleHttpRequest } = require('../../../adapters/network'); const { AbortedError, RetryableError, NetworkError, TransformationError, -} = require('../../util/errorTypes'); +} = require('@rudderstack/integrations-lib'); +const { handleHttpRequest } = require('../../../adapters/network'); const tags = require('../../util/tags'); const { isHttpStatusSuccess, generateUUID } = require('../../util'); const { getDynamicErrorType } = require('../../../adapters/utils/networkUtils'); diff --git a/src/v0/destinations/marketo_static_list/transform.js b/src/v0/destinations/marketo_static_list/transform.js index 156e26270b..856947c33c 100644 --- a/src/v0/destinations/marketo_static_list/transform.js +++ b/src/v0/destinations/marketo_static_list/transform.js @@ -1,5 +1,6 @@ const lodash = require('lodash'); const cloneDeep = require('lodash/cloneDeep'); +const { InstrumentationError, UnauthorizedError } = require('@rudderstack/integrations-lib'); const { defaultPostRequestConfig, defaultDeleteRequestConfig, @@ -16,7 +17,6 @@ const { const { formatConfig, MAX_LEAD_IDS_SIZE } = require('./config'); const Cache = require('../../util/cache'); const { getAuthToken } = require('../marketo/transform'); -const { InstrumentationError, UnauthorizedError } = require('../../util/errorTypes'); const authCache = new Cache(AUTH_CACHE_TTL); // 1 hr diff --git a/src/v0/destinations/marketo_static_list/util.js b/src/v0/destinations/marketo_static_list/util.js index 2d4fe493a0..3db6180d24 100644 --- a/src/v0/destinations/marketo_static_list/util.js +++ b/src/v0/destinations/marketo_static_list/util.js @@ -1,4 +1,4 @@ -const { InstrumentationError } = require('../../util/errorTypes'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); /** * Fetches the ids from the array of objects diff --git a/src/v0/destinations/mautic/transform.js b/src/v0/destinations/mautic/transform.js index 12b0d06b6f..13808f6e3c 100644 --- a/src/v0/destinations/mautic/transform.js +++ b/src/v0/destinations/mautic/transform.js @@ -1,3 +1,8 @@ +const { + TransformationError, + InstrumentationError, + ConfigurationError, +} = require('@rudderstack/integrations-lib'); const { defaultRequestConfig, constructPayload, @@ -20,11 +25,6 @@ const { const { EventType } = require('../../../constants'); const { mappingConfig, ConfigCategories } = require('./config'); -const { - TransformationError, - InstrumentationError, - ConfigurationError, -} = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const responseBuilder = async (payload, endpoint, method, messageType, Config) => { diff --git a/src/v0/destinations/mautic/utils.js b/src/v0/destinations/mautic/utils.js index f9dd787d9d..d8ad8dbffc 100644 --- a/src/v0/destinations/mautic/utils.js +++ b/src/v0/destinations/mautic/utils.js @@ -1,5 +1,10 @@ /* eslint-disable no-return-assign, no-param-reassign, no-restricted-syntax */ const get = require('get-value'); +const { + NetworkError, + InstrumentationError, + ConfigurationError, +} = require('@rudderstack/integrations-lib'); const { getFieldValueFromMessage } = require('../../util'); const { BASE_URL, lookupFieldMap } = require('./config'); const { httpGET } = require('../../../adapters/network'); @@ -7,7 +12,6 @@ const { processAxiosResponse, getDynamicErrorType, } = require('../../../adapters/utils/networkUtils'); -const { NetworkError, InstrumentationError, ConfigurationError } = require('../../util/errorTypes'); const tags = require('../../util/tags'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/destinations/moengage/transform.js b/src/v0/destinations/moengage/transform.js index d87d931817..8a16d9c7a7 100644 --- a/src/v0/destinations/moengage/transform.js +++ b/src/v0/destinations/moengage/transform.js @@ -1,4 +1,9 @@ const btoa = require('btoa'); +const { + ConfigurationError, + TransformationError, + InstrumentationError, +} = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { CONFIG_CATEGORIES, @@ -16,11 +21,6 @@ const { simpleProcessRouterDest, isAppleFamily, } = require('../../util'); -const { - ConfigurationError, - TransformationError, - InstrumentationError, -} = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); function responseBuilderSimple(message, category, destination) { @@ -119,7 +119,7 @@ const processEvent = (message, destination) => { response = responseBuilderSimple(message, category, destination); // only if device information is present device info will be added/updated // with an identify call otherwise only user info will be added/updated - if (message.context.device && message.context.device.type && message.context.device.token) { + if (message?.context?.device?.type && message?.context?.device?.token) { // build the response response = [ // user api payload (output for identify) diff --git a/src/v0/destinations/monday/transform.js b/src/v0/destinations/monday/transform.js index 37ee835e50..152b42f8d0 100644 --- a/src/v0/destinations/monday/transform.js +++ b/src/v0/destinations/monday/transform.js @@ -1,4 +1,9 @@ const get = require('get-value'); +const { + ConfigurationError, + TransformationError, + InstrumentationError, +} = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { ENDPOINT } = require('./config'); const { populatePayload, getBoardDetails, checkAllowedEventNameFromUI } = require('./util'); @@ -10,11 +15,6 @@ const { getDestinationExternalID, validateEventName, } = require('../../util'); -const { - ConfigurationError, - TransformationError, - InstrumentationError, -} = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const responseBuilder = (payload, endpoint, apiToken) => { diff --git a/src/v0/destinations/monday/util.js b/src/v0/destinations/monday/util.js index 5f260aabae..a66dd63dff 100644 --- a/src/v0/destinations/monday/util.js +++ b/src/v0/destinations/monday/util.js @@ -1,8 +1,12 @@ const { isNumber } = require('lodash'); +const { + NetworkError, + ConfigurationError, + InstrumentationError, +} = require('@rudderstack/integrations-lib'); const { httpPOST } = require('../../../adapters/network'); const { processAxiosResponse } = require('../../../adapters/utils/networkUtils'); const { getDestinationExternalID, isDefinedAndNotNull } = require('../../util'); -const { NetworkError, ConfigurationError, InstrumentationError } = require('../../util/errorTypes'); const { getDynamicErrorType } = require('../../../adapters/utils/networkUtils'); const tags = require('../../util/tags'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/destinations/monetate/transform.js b/src/v0/destinations/monetate/transform.js index e4d1f28b61..26a88e686b 100644 --- a/src/v0/destinations/monetate/transform.js +++ b/src/v0/destinations/monetate/transform.js @@ -1,4 +1,5 @@ const get = require('get-value'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { removeUndefinedValues, simpleProcessRouterDest } = require('../../util'); const { handleProductViewed, @@ -11,7 +12,6 @@ const { } = require('./utils'); const { EventType } = require('../../../constants'); const { mappingConfig } = require('./config'); -const { InstrumentationError } = require('../../util/errorTypes'); function track(message, destination) { const rawPayload = constructPayload(message, mappingConfig.MONETATETrack); diff --git a/src/v0/destinations/monetate/utils.js b/src/v0/destinations/monetate/utils.js index 7facc2617d..1fe899f120 100644 --- a/src/v0/destinations/monetate/utils.js +++ b/src/v0/destinations/monetate/utils.js @@ -1,6 +1,6 @@ const set = require('set-value'); const get = require('get-value'); -const { InstrumentationError } = require('../../util/errorTypes'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { isDefinedAndNotNull, defaultRequestConfig, getValueFromMessage } = require('../../util'); const { ENDPOINT } = require('./config'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/destinations/mp/config.js b/src/v0/destinations/mp/config.js index 41a801e9da..35b40294f5 100644 --- a/src/v0/destinations/mp/config.js +++ b/src/v0/destinations/mp/config.js @@ -11,6 +11,9 @@ const ConfigCategory = { IDENTIFY: { name: 'MPIdentifyConfig', }, + SET_ONCE: { + name: 'MPSetOnceConfig', + }, PROFILE_ANDROID: { name: 'MPProfilePropertiesAndroid', }, diff --git a/src/v0/destinations/mp/data/MPSetOnceConfig.json b/src/v0/destinations/mp/data/MPSetOnceConfig.json new file mode 100644 index 0000000000..e5aaf851a3 --- /dev/null +++ b/src/v0/destinations/mp/data/MPSetOnceConfig.json @@ -0,0 +1,122 @@ +[ + { + "destKey": "$created", + "sourceKeys": "createdAt", + "required": false + }, + { + "destKey": "$email", + "sourceKeys": "email", + "required": false + }, + { + "destKey": "$first_name", + "sourceKeys": ["firstName", "firstname", "first_name"], + "required": false + }, + { + "destKey": "$last_name", + "sourceKeys": ["lastName", "lastname", "last_name"], + "required": false + }, + { + "destKey": "$name", + "sourceKeys": "name", + "required": false + }, + { + "destKey": "$username", + "sourceKeys": ["username", "userName"], + "required": false + }, + { + "destKey": "$phone", + "sourceKeys": "phone", + "required": false + }, + { + "destKey": "$avatar", + "sourceKeys": "avatar", + "required": false + }, + { + "destKey": "$country_code", + "sourceKeys": ["country", "address.country"], + "required": false + }, + { + "destKey": "$city", + "sourceKeys": ["city", "address.city"], + "required": false + }, + { + "destKey": "$region", + "sourceKeys": ["state", "address.state", "location.region"], + "required": false + }, + { + "destKey": "$unsubscribed", + "sourceKeys": "unsubscribed", + "required": false + }, + { + "destKey": "$geo_source", + "sourceKeys": "location.geoSource", + "required": false + }, + { + "destKey": "$timezone", + "sourceKeys": "location.timezone", + "required": false + }, + { + "destKey": "$latitude", + "sourceKeys": "location.latitude", + "required": false + }, + { + "destKey": "$longitude", + "sourceKeys": "location.longitude", + "required": false + }, + { + "destKey": "$carrier", + "sourceKeys": "network.carrier", + "required": false + }, + { + "destKey": "$manufacturer", + "sourceKeys": "device.manufacturer", + "required": false + }, + { + "destKey": "$model", + "sourceKeys": "device.model", + "required": false + }, + { + "destKey": "$screen_height", + "sourceKeys": "screen.height", + "required": false + }, + { + "destKey": "$screen_width", + "sourceKeys": "screen.width", + "required": false + }, + { + "destKey": "$wifi", + "sourceKeys": "network.wifi", + "required": false + }, + { + "destKey": "$initial_referrer", + "sourceKeys": "page.initial_referrer", + "required": false + }, + { + "destKey": "$initial_referring_domain", + "sourceKeys": ["page.initial_referring_domain", "page.initialReferringDomain"], + "required": false + } +] diff --git a/src/v0/destinations/mp/deleteUsers.js b/src/v0/destinations/mp/deleteUsers.js index 5b86cae6ae..f01475ef2b 100644 --- a/src/v0/destinations/mp/deleteUsers.js +++ b/src/v0/destinations/mp/deleteUsers.js @@ -1,4 +1,5 @@ const lodash = require('lodash'); +const { ConfigurationError, NetworkError } = require('@rudderstack/integrations-lib'); const { handleHttpRequest } = require('../../../adapters/network'); const { isHttpStatusSuccess } = require('../../util'); const { @@ -7,7 +8,6 @@ const { DISTINCT_ID_MAX_BATCH_SIZE, } = require('./config'); const { executeCommonValidations } = require('../../util/regulation-api'); -const { ConfigurationError, NetworkError } = require('../../util/errorTypes'); const { getDynamicErrorType } = require('../../../adapters/utils/networkUtils'); const tags = require('../../util/tags'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/destinations/mp/transform.js b/src/v0/destinations/mp/transform.js index a5f1bf2d9d..3d0aaa7c4c 100644 --- a/src/v0/destinations/mp/transform.js +++ b/src/v0/destinations/mp/transform.js @@ -1,5 +1,6 @@ const lodash = require('lodash'); const get = require('get-value'); +const { InstrumentationError, ConfigurationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { base64Convertor, @@ -16,6 +17,7 @@ const { checkInvalidRtTfEvents, handleRtTfSingleEventError, groupEventsByType, + parseConfigArray, } = require('../../util'); const { ConfigCategory, @@ -34,8 +36,8 @@ const { combineBatchRequestsWithSameJobIds, groupEventsByEndpoint, batchEvents, + trimTraits, } = require('./util'); -const { InstrumentationError, ConfigurationError } = require('../../util/errorTypes'); const { CommonUtils } = require('../../../util/common'); // ref: https://help.mixpanel.com/hc/en-us/articles/115004613766-Default-Properties-Collected-by-Mixpanel @@ -226,17 +228,51 @@ const processTrack = (message, destination) => { return returnValue; }; +const createSetOnceResponse = (message, type, destination, setOnce) => { + const payload = { + $set_once: setOnce, + $token: destination.Config.token, + $distinct_id: message.userId || message.anonymousId, + }; + + if (destination?.Config.identityMergeApi === 'simplified') { + payload.$distinct_id = message.userId || `$device:${message.anonymousId}`; + } + + return responseBuilderSimple(payload, message, type, destination.Config); +}; + const processIdentifyEvents = async (message, type, destination) => { + const messageClone = { ...message }; + let seggregatedTraits = {}; const returnValue = []; + let setOnceProperties = []; + + // making payload for set_once properties + if (destination.Config.setOnceProperties && destination.Config.setOnceProperties.length > 0) { + setOnceProperties = parseConfigArray(destination.Config.setOnceProperties, 'property'); + seggregatedTraits = trimTraits( + messageClone.traits, + messageClone.context.traits, + setOnceProperties, + ); + messageClone.traits = seggregatedTraits.traits; + messageClone.context.traits = seggregatedTraits.contextTraits; + if (Object.keys(seggregatedTraits.setOnce).length > 0) { + returnValue.push( + createSetOnceResponse(messageClone, type, destination, seggregatedTraits.setOnce), + ); + } + } // Creating the user profile // https://developer.mixpanel.com/reference/profile-set - returnValue.push(createIdentifyResponse(message, type, destination, responseBuilderSimple)); + returnValue.push(createIdentifyResponse(messageClone, type, destination, responseBuilderSimple)); if ( destination.Config?.identityMergeApi !== 'simplified' && - message.userId && - message.anonymousId && + messageClone.userId && + messageClone.anonymousId && isImportAuthCredentialsAvailable(destination) ) { // If userId and anonymousId both are present and required credentials for /import @@ -245,13 +281,13 @@ const processIdentifyEvents = async (message, type, destination) => { const trackPayload = { event: '$merge', properties: { - $distinct_ids: [message.userId, message.anonymousId], + $distinct_ids: [messageClone.userId, messageClone.anonymousId], token: destination.Config.token, }, }; const identifyTrackResponse = responseBuilderSimple( trackPayload, - message, + messageClone, 'merge', destination.Config, ); @@ -440,7 +476,6 @@ const processRouterDest = async (inputs, reqMetadata) => { destination: event.destination, }; } - let processedEvents = await process(event); processedEvents = CommonUtils.toArray(processedEvents); return processedEvents.map((res) => ({ diff --git a/src/v0/destinations/mp/util.js b/src/v0/destinations/mp/util.js index 30173fd514..bb8f36fdbe 100644 --- a/src/v0/destinations/mp/util.js +++ b/src/v0/destinations/mp/util.js @@ -1,5 +1,7 @@ +const lodash = require('lodash'); const set = require('set-value'); const get = require('get-value'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { isDefined, constructPayload, @@ -13,6 +15,7 @@ const { defaultBatchRequestConfig, IsGzipSupported, isObject, + isDefinedAndNotNullAndNotEmpty, } = require('../../util'); const { ConfigCategory, @@ -20,12 +23,12 @@ const { GEO_SOURCE_ALLOWED_VALUES, mappingConfig, } = require('./config'); -const { InstrumentationError } = require('../../util/errorTypes'); const { CommonUtils } = require('../../../util/common'); const mPIdentifyConfigJson = mappingConfig[ConfigCategory.IDENTIFY.name]; const mPProfileAndroidConfigJson = mappingConfig[ConfigCategory.PROFILE_ANDROID.name]; const mPProfileIosConfigJson = mappingConfig[ConfigCategory.PROFILE_IOS.name]; +const mPSetOnceConfigJson = mappingConfig[ConfigCategory.SET_ONCE.name]; /** * this function has been used to create @@ -322,6 +325,72 @@ const combineBatchRequestsWithSameJobIds = (inputBatches) => { return combineBatches(combineBatches(inputBatches)); }; +/** + * Trims the traits and contextTraits objects based on the setOnceProperties array and returns an object containing the modified traits, contextTraits, and setOnce properties. + * + * @param {object} traits - An object representing the traits. + * @param {object} contextTraits - An object representing the context traits. + * @param {string[]} setOnceProperties - An array of property paths to be considered for the setOnce transformation. + * @returns {object} - An object containing the modified traits, contextTraits, and setOnce properties. + * + * @example + * const traits = { name: 'John', age: 30 }; + * const contextTraits = { country: 'USA', language: 'English', address: { city: 'New York', state: 'NY' }}}; + * const setOnceProperties = ['name', 'country', 'address.city']; + * + * const result = trimTraits(traits, contextTraits, setOnceProperties); + * // Output: { traits: { age: 30 }, contextTraits: { language: 'English' }, setOnce: { $name: 'John', $country_code: 'USA', city: 'New York'} } + */ +function trimTraits(traits, contextTraits, setOnceProperties) { + let sentOnceTransformedPayload; + // Create a copy of the original traits object + const traitsCopy = { ...traits }; + const contextTraitsCopy = { ...contextTraits }; + + // Initialize setOnce object + const setOnceEligible = {}; + + // Step 1: find the k-v pairs of setOnceProperties in traits and contextTraits + + setOnceProperties.forEach((propertyPath) => { + const propName = lodash.last(propertyPath.split('.')); + + const traitsValue = get(traitsCopy, propertyPath); + const contextTraitsValue = get(contextTraitsCopy, propertyPath); + + if (isDefinedAndNotNullAndNotEmpty(traitsValue)) { + setOnceEligible[propName] = traitsValue; + lodash.unset(traitsCopy, propertyPath); + } + if (isDefinedAndNotNullAndNotEmpty(contextTraitsValue)) { + if (!setOnceEligible.hasOwnProperty(propName)) { + setOnceEligible[propName] = contextTraitsValue; + } + lodash.unset(contextTraitsCopy, propertyPath); + } + }); + + if (setOnceEligible && Object.keys(setOnceEligible).length > 0) { + // Step 2: transform properties eligible as per rudderstack declared identify event mapping + // setOnce should have all traits from message.traits and message.context.traits by now + sentOnceTransformedPayload = constructPayload(setOnceEligible, mPSetOnceConfigJson); + + // Step 3: combine the transformed and custom setOnce traits + sentOnceTransformedPayload = extractCustomFields( + setOnceEligible, + sentOnceTransformedPayload, + 'root', + MP_IDENTIFY_EXCLUSION_LIST, + ); + } + + return { + traits: traitsCopy, + contextTraits: contextTraitsCopy, + setOnce: sentOnceTransformedPayload || {}, + }; +} + module.exports = { createIdentifyResponse, isImportAuthCredentialsAvailable, @@ -330,4 +399,5 @@ module.exports = { generateBatchedPayloadForArray, batchEvents, combineBatchRequestsWithSameJobIds, + trimTraits, }; diff --git a/src/v0/destinations/mp/util.test.js b/src/v0/destinations/mp/util.test.js index 6d5b24766d..fbaa6f9b9f 100644 --- a/src/v0/destinations/mp/util.test.js +++ b/src/v0/destinations/mp/util.test.js @@ -4,6 +4,7 @@ const { batchEvents, generateBatchedPayloadForArray, buildUtmParams, + trimTraits, } = require('./util'); const { FEATURE_GZIP_SUPPORT } = require('../../util/constant'); @@ -602,4 +603,97 @@ describe('Mixpanel utils test', () => { }); }); }); + describe('Unit test cases for trimTraits', () => { + // Given a valid traits object and contextTraits object, and a valid setOnceProperties array, the function should return an object containing traits, contextTraits, and setOnce properties. + it('should return an object containing traits, contextTraits, and setOnce properties when given valid inputs', () => { + const traits = { name: 'John', age: 30 }; + const contextTraits = { email: 'john@example.com' }; + const setOnceProperties = ['name', 'email']; + + const result = trimTraits(traits, contextTraits, setOnceProperties); + console.log(result); + + expect(result).toEqual({ + traits: { + age: 30, + }, + contextTraits: {}, + setOnce: { $name: 'John', $email: 'john@example.com' }, + }); + }); + + // Given an empty traits object and contextTraits object, and a valid setOnceProperties array, the function should return an object containing empty traits and contextTraits, and an empty setOnce property. + it('should return an object containing empty traits and contextTraits, and an empty setOnce property when given empty traits and contextTraits objects', () => { + const traits = {}; + const contextTraits = {}; + const setOnceProperties = ['name', 'email']; + + const result = trimTraits(traits, contextTraits, setOnceProperties); + + expect(result).toEqual({ + traits: {}, + contextTraits: {}, + setOnce: {}, + }); + }); + + // Given an empty setOnceProperties array, the function should return an object containing the original traits and contextTraits objects, and an empty setOnce property. + it('should return an object containing the original traits and contextTraits objects, and an empty setOnce property when given an empty setOnceProperties array', () => { + const traits = { name: 'John', age: 30 }; + const contextTraits = { email: 'john@example.com' }; + const setOnceProperties = []; + + const result = trimTraits(traits, contextTraits, setOnceProperties); + + expect(result).toEqual({ + traits: { name: 'John', age: 30 }, + contextTraits: { email: 'john@example.com' }, + setOnce: {}, + }); + }); + + // Given a setOnceProperties array containing properties that do not exist in either traits or contextTraits objects, the function should not add the property to the setOnce property. + it('should not add properties to the setOnce property when given setOnceProperties array with non-existent properties', () => { + const traits = { name: 'John', age: 30 }; + const contextTraits = { email: 'john@example.com' }; + const setOnceProperties = ['name', 'email', 'address']; + + const result = trimTraits(traits, contextTraits, setOnceProperties); + + expect(result).toEqual({ + traits: { age: 30 }, + contextTraits: {}, + setOnce: { $name: 'John', $email: 'john@example.com' }, + }); + }); + + // Given a setOnceProperties array containing properties with nested paths that do not exist in either traits or contextTraits objects, the function should not add the property to the setOnce property. + it('should not add properties to the setOnce property when given setOnceProperties array with non-existent nested properties', () => { + const traits = { name: 'John', age: 30, address: 'kolkata' }; + const contextTraits = { email: 'john@example.com' }; + const setOnceProperties = ['name', 'email', 'address.city']; + + const result = trimTraits(traits, contextTraits, setOnceProperties); + + expect(result).toEqual({ + traits: { age: 30, address: 'kolkata' }, + contextTraits: {}, + setOnce: { $name: 'John', $email: 'john@example.com' }, + }); + }); + + it('should add properties to the setOnce property when given setOnceProperties array with existent nested properties', () => { + const traits = { name: 'John', age: 30, address: { city: 'kolkata' }, isAdult: false }; + const contextTraits = { email: 'john@example.com' }; + const setOnceProperties = ['name', 'email', 'address.city']; + + const result = trimTraits(traits, contextTraits, setOnceProperties); + + expect(result).toEqual({ + traits: { age: 30, address: {}, isAdult: false }, + contextTraits: {}, + setOnce: { $name: 'John', $email: 'john@example.com', $city: 'kolkata' }, + }); + }); + }); }); diff --git a/src/v0/destinations/ometria/networkResponseHandler.js b/src/v0/destinations/ometria/networkResponseHandler.js index 2020ab0343..501b67f176 100644 --- a/src/v0/destinations/ometria/networkResponseHandler.js +++ b/src/v0/destinations/ometria/networkResponseHandler.js @@ -1,8 +1,8 @@ +const { NetworkError } = require('@rudderstack/integrations-lib'); const { getDynamicErrorType, trimResponse } = require('../../../adapters/utils/networkUtils'); const { isDefinedAndNotNull } = require('../../util'); const { isEmpty } = require('../../util/index'); const tags = require('../../util/tags'); -const { NetworkError } = require('../../util/errorTypes'); const responseTransform = (destResponse) => { let respBody; diff --git a/src/v0/destinations/ometria/transform.js b/src/v0/destinations/ometria/transform.js index 6d3c2ab174..55038e10b8 100644 --- a/src/v0/destinations/ometria/transform.js +++ b/src/v0/destinations/ometria/transform.js @@ -1,7 +1,7 @@ /* eslint-disable one-var, @typescript-eslint/naming-convention */ /* eslint-disable camelcase */ +const { ConfigurationError, InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); -const { ConfigurationError, InstrumentationError } = require('../../util/errorTypes'); const { constructPayload, extractCustomFields, diff --git a/src/v0/destinations/one_signal/transform.js b/src/v0/destinations/one_signal/transform.js index db699935f4..a072aef0e4 100644 --- a/src/v0/destinations/one_signal/transform.js +++ b/src/v0/destinations/one_signal/transform.js @@ -1,4 +1,9 @@ const get = require('get-value'); +const { + ConfigurationError, + TransformationError, + InstrumentationError, +} = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { ConfigCategory, mappingConfig, BASE_URL, ENDPOINTS } = require('./config'); const { @@ -13,11 +18,6 @@ const { defaultPutRequestConfig, } = require('../../util'); const { populateDeviceType, populateTags } = require('./util'); -const { - ConfigurationError, - TransformationError, - InstrumentationError, -} = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const responseBuilder = (payload, endpoint, eventType) => { diff --git a/src/v0/destinations/one_signal/util.js b/src/v0/destinations/one_signal/util.js index 4b53949e55..2de57de1b4 100644 --- a/src/v0/destinations/one_signal/util.js +++ b/src/v0/destinations/one_signal/util.js @@ -1,5 +1,5 @@ +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { getIntegrationsObj, getFieldValueFromMessage, getBrowserInfo } = require('../../util'); -const { InstrumentationError } = require('../../util/errorTypes'); // For mapping device_type value const deviceTypeMapping = { diff --git a/src/v0/destinations/pagerduty/transform.js b/src/v0/destinations/pagerduty/transform.js index d7a8848ace..fb862d2553 100644 --- a/src/v0/destinations/pagerduty/transform.js +++ b/src/v0/destinations/pagerduty/transform.js @@ -1,3 +1,8 @@ +const { + ConfigurationError, + TransformationError, + InstrumentationError, +} = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { defaultRequestConfig, @@ -6,11 +11,6 @@ const { removeUndefinedAndNullValues, } = require('../../util'); const { JSON_MIME_TYPE } = require('../../util/constant'); -const { - ConfigurationError, - TransformationError, - InstrumentationError, -} = require('../../util/errorTypes'); const { trackEventPayloadBuilder } = require('./util'); const responseBuilder = (payload, endpoint) => { diff --git a/src/v0/destinations/pagerduty/util.js b/src/v0/destinations/pagerduty/util.js index 42030aa2e7..5b768704ed 100644 --- a/src/v0/destinations/pagerduty/util.js +++ b/src/v0/destinations/pagerduty/util.js @@ -1,5 +1,6 @@ const get = require('get-value'); const moment = require('moment'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { SEVERITIES, EVENT_ACTIONS, @@ -9,7 +10,6 @@ const { DEFAULT_EVENT_ACTION, } = require('./config'); const { constructPayload, getIntegrationsObj } = require('../../util'); -const { InstrumentationError } = require('../../util/errorTypes'); /** * Validates the timestamp diff --git a/src/v0/destinations/pardot/networkHandler.js b/src/v0/destinations/pardot/networkHandler.js index 4cec03ebf8..12b4abbc53 100644 --- a/src/v0/destinations/pardot/networkHandler.js +++ b/src/v0/destinations/pardot/networkHandler.js @@ -1,3 +1,4 @@ +const { NetworkError } = require('@rudderstack/integrations-lib'); const { removeUndefinedValues } = require('../../util'); const { prepareProxyRequest, getPayloadData, httpSend } = require('../../../adapters/network'); const { @@ -7,7 +8,6 @@ const { const { isHttpStatusSuccess } = require('../../util/index'); const { REFRESH_TOKEN } = require('../../../adapters/networkhandler/authConstants'); const tags = require('../../util/tags'); -const { NetworkError } = require('../../util/errorTypes'); /** * Example Response from pardot diff --git a/src/v0/destinations/pardot/transform.js b/src/v0/destinations/pardot/transform.js index bfc7386ef9..b32b8967bd 100644 --- a/src/v0/destinations/pardot/transform.js +++ b/src/v0/destinations/pardot/transform.js @@ -34,6 +34,7 @@ */ const get = require('get-value'); +const { ConfigurationError, InstrumentationError } = require('@rudderstack/integrations-lib'); const { identifyConfig, DESTINATION } = require('./config'); const logger = require('../../../logger'); const { @@ -48,7 +49,6 @@ const { getAccessToken, } = require('../../util'); const { CONFIG_CATEGORIES } = require('./config'); -const { ConfigurationError, InstrumentationError } = require('../../util/errorTypes'); const buildResponse = (payload, url, destination, token) => { const responseBody = removeUndefinedValues(payload); diff --git a/src/v0/destinations/persistiq/transform.js b/src/v0/destinations/persistiq/transform.js index 195f8d6567..3b4fd6cadc 100644 --- a/src/v0/destinations/persistiq/transform.js +++ b/src/v0/destinations/persistiq/transform.js @@ -1,4 +1,5 @@ const { set } = require('lodash'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { defaultRequestConfig, removeUndefinedAndNullValues, @@ -8,7 +9,6 @@ const { const { configCategories } = require('./config'); const { buildLeadPayload, getIdentifyTraits } = require('./util'); const { EventType } = require('../../../constants'); -const { InstrumentationError } = require('../../util/errorTypes'); const responseBuilder = (payload, endpoint, method, Config) => { const { apiKey } = Config; diff --git a/src/v0/destinations/persistiq/util.js b/src/v0/destinations/persistiq/util.js index 7e1986e9b3..f37a9d1886 100644 --- a/src/v0/destinations/persistiq/util.js +++ b/src/v0/destinations/persistiq/util.js @@ -1,4 +1,5 @@ const { get } = require('lodash'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { getFieldValueFromMessage, getHashFromArray, @@ -6,7 +7,6 @@ const { flattenMultilevelPayload, } = require('../../util'); const { identifySourceKeys, fileConfigCategories, mappingConfig } = require('./config'); -const { InstrumentationError } = require('../../util/errorTypes'); /** * Returns the remaining keys from traits diff --git a/src/v0/destinations/personalize/transform.js b/src/v0/destinations/personalize/transform.js index 3523987a89..dcfaae755c 100644 --- a/src/v0/destinations/personalize/transform.js +++ b/src/v0/destinations/personalize/transform.js @@ -1,4 +1,5 @@ const lodash = require('lodash'); +const { ConfigurationError, InstrumentationError } = require('@rudderstack/integrations-lib'); const { KEY_CHECK_LIST, MANDATORY_PROPERTIES } = require('./config'); const { EventType } = require('../../../constants'); const { @@ -9,7 +10,6 @@ const { isDefined, simpleProcessRouterDest, } = require('../../util'); -const { ConfigurationError, InstrumentationError } = require('../../util/errorTypes'); const putEventsHandler = (message, destination) => { const { properties, anonymousId, event, messageId, context } = message; diff --git a/src/v0/destinations/pinterest_tag/transform.js b/src/v0/destinations/pinterest_tag/transform.js index 15efd63436..ee7e2e5b19 100644 --- a/src/v0/destinations/pinterest_tag/transform.js +++ b/src/v0/destinations/pinterest_tag/transform.js @@ -1,4 +1,5 @@ const { get } = require('lodash'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { defaultRequestConfig, @@ -28,7 +29,6 @@ const { getV5EventsEndpoint, API_VERSION, } = require('./config'); -const { InstrumentationError } = require('../../util/errorTypes'); const responseBuilderSimple = (finalPayload, { Config }) => { const { apiVersion = API_VERSION.v3, adAccountId, conversionToken, sendAsTestEvent } = Config; diff --git a/src/v0/destinations/pinterest_tag/utils.js b/src/v0/destinations/pinterest_tag/utils.js index c6822636dc..c1493e9dbd 100644 --- a/src/v0/destinations/pinterest_tag/utils.js +++ b/src/v0/destinations/pinterest_tag/utils.js @@ -1,5 +1,6 @@ /* eslint-disable no-param-reassign */ const sha256 = require('sha256'); +const { InstrumentationError, ConfigurationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { constructPayload, @@ -8,7 +9,6 @@ const { getHashFromArrayWithDuplicate, removeUndefinedAndNullValues, } = require('../../util'); -const { InstrumentationError, ConfigurationError } = require('../../util/errorTypes'); const { COMMON_CONFIGS, CUSTOM_CONFIGS, API_VERSION } = require('./config'); const VALID_ACTION_SOURCES = ['app_android', 'app_ios', 'web', 'offline']; diff --git a/src/v0/destinations/posthog/transform.js b/src/v0/destinations/posthog/transform.js index 9f639b59de..62a2f26783 100644 --- a/src/v0/destinations/posthog/transform.js +++ b/src/v0/destinations/posthog/transform.js @@ -1,4 +1,5 @@ const get = require('get-value'); +const { InstrumentationError, TransformationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { DEFAULT_BASE_ENDPOINT, CONFIG_CATEGORIES, MAPPING_CONFIG } = require('./config'); const { @@ -14,7 +15,6 @@ const { removeUndefinedAndNullValues, simpleProcessRouterDest, } = require('../../util'); -const { InstrumentationError, TransformationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); // Logic To match destination Property key that is in Rudder Stack Properties Object. diff --git a/src/v0/destinations/profitwell/transform.js b/src/v0/destinations/profitwell/transform.js index 70de193fbd..58449fd9c1 100644 --- a/src/v0/destinations/profitwell/transform.js +++ b/src/v0/destinations/profitwell/transform.js @@ -1,3 +1,8 @@ +const { + NetworkError, + ConfigurationError, + InstrumentationError, +} = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { getSubscriptionHistory, @@ -15,7 +20,6 @@ const { simpleProcessRouterDest, } = require('../../util'); const { BASE_ENDPOINT, createPayloadMapping } = require('./config'); -const { NetworkError, ConfigurationError, InstrumentationError } = require('../../util/errorTypes'); const { getDynamicErrorType } = require('../../../adapters/utils/networkUtils'); const tags = require('../../util/tags'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/destinations/profitwell/utils.js b/src/v0/destinations/profitwell/utils.js index d7a3562126..acc4db2035 100644 --- a/src/v0/destinations/profitwell/utils.js +++ b/src/v0/destinations/profitwell/utils.js @@ -1,4 +1,8 @@ const get = require('get-value'); +const { + InstrumentationError, + NetworkInstrumentationError, +} = require('@rudderstack/integrations-lib'); const { httpGET } = require('../../../adapters/network'); const { toUnixTimestamp, @@ -11,7 +15,6 @@ const { constructPayload, } = require('../../util'); const { BASE_ENDPOINT, createPayloadMapping, updatePayloadMapping } = require('./config'); -const { InstrumentationError, NetworkInstrumentationError } = require('../../util/errorTypes'); const CURRENCY_CODES = [ 'aed', diff --git a/src/v0/destinations/redis/transform.js b/src/v0/destinations/redis/transform.js index ffc4a33c43..23c73f0ba4 100644 --- a/src/v0/destinations/redis/transform.js +++ b/src/v0/destinations/redis/transform.js @@ -1,9 +1,9 @@ const lodash = require('lodash'); const flatten = require('flat'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { isEmpty, isObject } = require('../../util'); const { EventType } = require('../../../constants'); -const { InstrumentationError } = require('../../util/errorTypes'); // processValues: // 1. removes keys with empty values or still an object(empty) after flattening diff --git a/src/v0/destinations/refiner/transform.js b/src/v0/destinations/refiner/transform.js index def685b597..b891945f7f 100644 --- a/src/v0/destinations/refiner/transform.js +++ b/src/v0/destinations/refiner/transform.js @@ -1,3 +1,4 @@ +const { TransformationError, InstrumentationError } = require('@rudderstack/integrations-lib'); const { ErrorMessage, defaultRequestConfig, @@ -13,7 +14,6 @@ const { identifyUserPayloadBuilder, } = require('./utils'); const { EventType } = require('../../../constants'); -const { TransformationError, InstrumentationError } = require('../../util/errorTypes'); const responseBuilder = (payload, endpoint, destination) => { if (payload) { diff --git a/src/v0/destinations/refiner/utils.js b/src/v0/destinations/refiner/utils.js index 109f6ff656..5e788352ca 100644 --- a/src/v0/destinations/refiner/utils.js +++ b/src/v0/destinations/refiner/utils.js @@ -1,7 +1,7 @@ const get = require('get-value'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { CONFIG_CATEGORIES } = require('./config'); const { getHashFromArray, getFieldValueFromMessage } = require('../../util'); -const { InstrumentationError } = require('../../util/errorTypes'); /** * Validation for userId and an email diff --git a/src/v0/destinations/revenue_cat/transform.js b/src/v0/destinations/revenue_cat/transform.js index 5f165a9278..407cb91608 100644 --- a/src/v0/destinations/revenue_cat/transform.js +++ b/src/v0/destinations/revenue_cat/transform.js @@ -1,5 +1,10 @@ const set = require('set-value'); const { defaultRequestConfig } = require('rudder-transformer-cdk/build/utils'); +const { + ConfigurationError, + TransformationError, + InstrumentationError, +} = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { constructPayload, @@ -15,11 +20,6 @@ const { REVENUE_CAT_IDENTIFY_EXCLUSION, BASE_URL, } = require('./config'); -const { - ConfigurationError, - TransformationError, - InstrumentationError, -} = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const trackResponseBuilder = async (message, category, { Config }) => { diff --git a/src/v0/destinations/rockerbox/transform.js b/src/v0/destinations/rockerbox/transform.js index 5369afa7e5..3ac806e5ee 100644 --- a/src/v0/destinations/rockerbox/transform.js +++ b/src/v0/destinations/rockerbox/transform.js @@ -1,4 +1,5 @@ const get = require('get-value'); +const { ConfigurationError, InstrumentationError } = require('@rudderstack/integrations-lib'); const { defaultRequestConfig, removeUndefinedAndNullValues, @@ -9,7 +10,6 @@ const { } = require('../../util'); const { EventType } = require('../../../constants'); const { CONFIG_CATEGORIES, MAPPING_CONFIG, ROCKERBOX_DEFINED_PROPERTIES } = require('./config'); -const { ConfigurationError, InstrumentationError } = require('../../util/errorTypes'); const responseBuilderSimple = (message, category, destination) => { const payload = constructPayload(message, MAPPING_CONFIG[category.name]); diff --git a/src/v0/destinations/salesforce/config.js b/src/v0/destinations/salesforce/config.js index 6c0ccde80f..1425bad51b 100644 --- a/src/v0/destinations/salesforce/config.js +++ b/src/v0/destinations/salesforce/config.js @@ -24,6 +24,8 @@ const SF_TOKEN_REQUEST_URL = 'https://login.salesforce.com/services/oauth2/token const SF_TOKEN_REQUEST_URL_SANDBOX = 'https://test.salesforce.com/services/oauth2/token'; const DESTINATION = 'Salesforce'; +const OAUTH = 'oauth'; +const LEGACY = 'legacy'; const mappingConfig = getMappingConfig(ConfigCategory, __dirname); @@ -37,4 +39,6 @@ module.exports = { ignoredContactTraits: mappingConfig[ConfigCategory.IGNORE_CONTACT.name], ACCESS_TOKEN_CACHE_TTL, DESTINATION, + OAUTH, + LEGACY, }; diff --git a/src/v0/destinations/salesforce/transform.js b/src/v0/destinations/salesforce/transform.js index 95e41ccd98..5ada9dfaa0 100644 --- a/src/v0/destinations/salesforce/transform.js +++ b/src/v0/destinations/salesforce/transform.js @@ -1,5 +1,9 @@ const get = require('get-value'); const cloneDeep = require('lodash/cloneDeep'); +const { + InstrumentationError, + NetworkInstrumentationError, +} = require('@rudderstack/integrations-lib'); const { EventType, MappedToDestinationKey } = require('../../../constants'); const { SF_API_VERSION, @@ -22,10 +26,10 @@ const { checkInvalidRtTfEvents, handleRtTfSingleEventError, generateErrorObject, + isHttpStatusSuccess, } = require('../../util'); -const { getAccessToken, salesforceResponseHandler } = require('./utils'); +const { salesforceResponseHandler, collectAuthorizationInfo, getAuthHeader } = require('./utils'); const { handleHttpRequest } = require('../../../adapters/network'); -const { InstrumentationError, NetworkInstrumentationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); // Basic response builder @@ -38,6 +42,7 @@ function responseBuilderSimple( authorizationData, mapProperty, mappedToDestination, + authorizationFlow, ) { const { salesforceType, salesforceId } = salesforceMap; @@ -84,12 +89,12 @@ function responseBuilderSimple( } const response = defaultRequestConfig(); - const header = { + + response.method = defaultPostRequestConfig.requestMethod; + response.headers = { 'Content-Type': JSON_MIME_TYPE, - Authorization: authorizationData.token, + ...getAuthHeader({ authorizationFlow, authorizationData }), }; - response.method = defaultPostRequestConfig.requestMethod; - response.headers = header; response.body.JSON = removeUndefinedValues(rawPayload); response.endpoint = targetEndpoint; @@ -103,24 +108,26 @@ async function getSaleforceIdForRecord( identifierType, identifierValue, destination, + authorizationFlow, ) { const objSearchUrl = `${authorizationData.instanceUrl}/services/data/v${SF_API_VERSION}/parameterizedSearch/?q=${identifierValue}&sobject=${objectType}&in=${identifierType}&${objectType}.fields=id,${identifierType}`; const { processedResponse: processedsfSearchResponse } = await handleHttpRequest( 'get', objSearchUrl, { - headers: { Authorization: authorizationData.token }, + headers: getAuthHeader({ authorizationFlow, authorizationData }), }, { destType: 'salesforce', feature: 'transformation', }, ); - if (processedsfSearchResponse.status !== 200) { + if (!isHttpStatusSuccess(processedsfSearchResponse.status)) { salesforceResponseHandler( processedsfSearchResponse, `:- SALESFORCE SEARCH BY ID`, destination.ID, + authorizationFlow, ); } const searchRecord = processedsfSearchResponse.response?.searchRecords?.find( @@ -146,7 +153,12 @@ async function getSaleforceIdForRecord( // We'll use the Salesforce Object names by removing "Salesforce-" string from the type field // // Default Object type will be "Lead" for backward compatibility -async function getSalesforceIdFromPayload(message, authorizationData, destination) { +async function getSalesforceIdFromPayload( + message, + authorizationData, + destination, + authorizationFlow, +) { // define default map const salesforceMaps = []; @@ -188,6 +200,7 @@ async function getSalesforceIdFromPayload(message, authorizationData, destinatio identifierType, id, destination, + authorizationFlow, ); } @@ -209,12 +222,13 @@ async function getSalesforceIdFromPayload(message, authorizationData, destinatio throw new InstrumentationError('Invalid Email address for Lead Objet'); } const leadQueryUrl = `${authorizationData.instanceUrl}/services/data/v${SF_API_VERSION}/parameterizedSearch/?q=${email}&sobject=Lead&Lead.fields=id,IsConverted,ConvertedContactId,IsDeleted`; + // request configuration will be conditional const { processedResponse: processedLeadQueryResponse } = await handleHttpRequest( 'get', leadQueryUrl, { - headers: { Authorization: authorizationData.token }, + headers: getAuthHeader({ authorizationFlow, authorizationData }), }, { destType: 'salesforce', @@ -222,8 +236,13 @@ async function getSalesforceIdFromPayload(message, authorizationData, destinatio }, ); - if (processedLeadQueryResponse.status !== 200) { - salesforceResponseHandler(processedLeadQueryResponse, `:- during Lead Query`, destination.ID); + if (!isHttpStatusSuccess(processedLeadQueryResponse.status)) { + salesforceResponseHandler( + processedLeadQueryResponse, + `:- during Lead Query`, + destination.ID, + authorizationFlow, + ); } if (processedLeadQueryResponse.response.searchRecords.length > 0) { @@ -259,7 +278,7 @@ async function getSalesforceIdFromPayload(message, authorizationData, destinatio } // Function for handling identify events -async function processIdentify(message, authorizationData, destination) { +async function processIdentify(message, authorizationData, destination, authorizationFlow) { const mapProperty = destination.Config.mapProperty === undefined ? true : destination.Config.mapProperty; // check the traits before hand @@ -280,7 +299,12 @@ async function processIdentify(message, authorizationData, destination) { const responseData = []; // get salesforce object map - const salesforceMaps = await getSalesforceIdFromPayload(message, authorizationData, destination); + const salesforceMaps = await getSalesforceIdFromPayload( + message, + authorizationData, + destination, + authorizationFlow, + ); // iterate over the object types found salesforceMaps.forEach((salesforceMap) => { @@ -292,6 +316,7 @@ async function processIdentify(message, authorizationData, destination) { authorizationData, mapProperty, mappedToDestination, + authorizationFlow, ), ); }); @@ -301,10 +326,10 @@ async function processIdentify(message, authorizationData, destination) { // Generic process function which invokes specific handler functions depending on message type // and event type where applicable -async function processSingleMessage(message, authorizationData, destination) { +async function processSingleMessage(message, authorizationData, destination, authorizationFlow) { let response; if (message.type === EventType.IDENTIFY) { - response = await processIdentify(message, authorizationData, destination); + response = await processIdentify(message, authorizationData, destination, authorizationFlow); } else { throw new InstrumentationError(`message type ${message.type} is not supported`); } @@ -312,9 +337,13 @@ async function processSingleMessage(message, authorizationData, destination) { } async function process(event) { - // Get the authorization header if not available - const authorizationData = await getAccessToken(event.destination); - const response = await processSingleMessage(event.message, authorizationData, event.destination); + const authInfo = await collectAuthorizationInfo(event); + const response = await processSingleMessage( + event.message, + authInfo.authorizationData, + event.destination, + authInfo.authorizationFlow, + ); return response; } @@ -323,10 +352,9 @@ const processRouterDest = async (inputs, reqMetadata) => { if (errorRespEvents.length > 0) { return errorRespEvents; } - - let authorizationData; + let authInfo; try { - authorizationData = await getAccessToken(inputs[0].destination); + authInfo = await collectAuthorizationInfo(inputs[0]); } catch (error) { const errObj = generateErrorObject(error); const respEvents = getErrorRespEvents( @@ -348,7 +376,12 @@ const processRouterDest = async (inputs, reqMetadata) => { // unprocessed payload return getSuccessRespEvents( - await processSingleMessage(input.message, authorizationData, input.destination), + await processSingleMessage( + input.message, + authInfo.authorizationData, + input.destination, + authInfo.authorizationFlow, + ), [input.metadata], input.destination, ); diff --git a/src/v0/destinations/salesforce/utils.js b/src/v0/destinations/salesforce/utils.js index 3ffa4e56d8..c725ec3b20 100644 --- a/src/v0/destinations/salesforce/utils.js +++ b/src/v0/destinations/salesforce/utils.js @@ -1,12 +1,18 @@ +const { RetryableError, ThrottledError, AbortedError } = require('@rudderstack/integrations-lib'); const { handleHttpRequest } = require('../../../adapters/network'); -const { isHttpStatusSuccess } = require('../../util'); +const { + isHttpStatusSuccess, + getAuthErrCategoryFromStCode, + isDefinedAndNotNull, +} = require('../../util'); const Cache = require('../../util/cache'); -const { RetryableError, ThrottledError, AbortedError } = require('../../util/errorTypes'); const { ACCESS_TOKEN_CACHE_TTL, SF_TOKEN_REQUEST_URL_SANDBOX, SF_TOKEN_REQUEST_URL, DESTINATION, + LEGACY, + OAUTH, } = require('./config'); const ACCESS_TOKEN_CACHE = new Cache(ACCESS_TOKEN_CACHE_TTL); @@ -19,7 +25,7 @@ const ACCESS_TOKEN_CACHE = new Cache(ACCESS_TOKEN_CACHE_TTL); * @param {*} stage * @param {String} authKey */ -const salesforceResponseHandler = (destResponse, sourceMessage, authKey) => { +const salesforceResponseHandler = (destResponse, sourceMessage, authKey, authorizationFlow) => { const { status, response } = destResponse; // if the response from destination is not a success case build an explicit error @@ -27,13 +33,16 @@ const salesforceResponseHandler = (destResponse, sourceMessage, authKey) => { const matchErrorCode = (errorCode) => response && Array.isArray(response) && response.some((resp) => resp?.errorCode === errorCode); if (status === 401 && authKey && matchErrorCode('INVALID_SESSION_ID')) { - // checking for invalid/expired token errors and evicting cache in that case - // rudderJobMetadata contains some destination info which is being used to evict the cache - ACCESS_TOKEN_CACHE.del(authKey); + if (authorizationFlow === LEGACY) { + // checking for invalid/expired token errors and evicting cache in that case + // rudderJobMetadata contains some destination info which is being used to evict the cache + ACCESS_TOKEN_CACHE.del(authKey); + } throw new RetryableError( `${DESTINATION} Request Failed - due to "INVALID_SESSION_ID", (Retryable) ${sourceMessage}`, 500, destResponse, + authorizationFlow === LEGACY ? '' : getAuthErrCategoryFromStCode(status), ); } else if (status === 403 && matchErrorCode('REQUEST_LIMIT_EXCEEDED')) { // If the error code is REQUEST_LIMIT_EXCEEDED, you’ve exceeded API request limits in your org. @@ -89,6 +98,11 @@ const salesforceResponseHandler = (destResponse, sourceMessage, authKey) => { * @param {*} destination * @returns */ +const getAccessTokenOauth = (metadata) => ({ + token: metadata.secret?.access_token, + instanceUrl: metadata.secret?.instance_url, +}); + const getAccessToken = async (destination) => { const accessTokenKey = destination.ID; @@ -122,6 +136,7 @@ const getAccessToken = async (destination) => { processedResponse, `:- authentication failed during fetching access token.`, accessTokenKey, + LEGACY, ); } const token = httpResponse.response.data; @@ -131,6 +146,7 @@ const getAccessToken = async (destination) => { processedResponse, `:- authentication failed could not retrieve authorization token.`, accessTokenKey, + LEGACY, ); } return { @@ -140,4 +156,30 @@ const getAccessToken = async (destination) => { }); }; -module.exports = { getAccessToken, salesforceResponseHandler }; +const collectAuthorizationInfo = async (event) => { + let authorizationFlow; + let authorizationData; + if (isDefinedAndNotNull(event.metadata?.secret)) { + authorizationFlow = OAUTH; + authorizationData = getAccessTokenOauth(event.metadata); + } else { + authorizationFlow = LEGACY; + authorizationData = await getAccessToken(event.destination); + } + return { authorizationFlow, authorizationData }; +}; + +const getAuthHeader = (authInfo) => { + const { authorizationFlow, authorizationData } = authInfo; + return authorizationFlow === OAUTH + ? { Authorization: `Bearer ${authorizationData.token}` } + : { Authorization: authorizationData.token }; +}; + +module.exports = { + getAccessTokenOauth, + salesforceResponseHandler, + getAccessToken, + collectAuthorizationInfo, + getAuthHeader, +}; diff --git a/src/v0/destinations/sendgrid/deleteUsers.js b/src/v0/destinations/sendgrid/deleteUsers.js index e93fefa59e..8410f41296 100644 --- a/src/v0/destinations/sendgrid/deleteUsers.js +++ b/src/v0/destinations/sendgrid/deleteUsers.js @@ -1,3 +1,4 @@ +const { NetworkError, ConfigurationError } = require('@rudderstack/integrations-lib'); const { httpDELETE } = require('../../../adapters/network'); const { delIdUrlLimit, DELETE_CONTACTS_ENDPOINT } = require('./config'); const { @@ -5,7 +6,6 @@ const { getDynamicErrorType, } = require('../../../adapters/utils/networkUtils'); const { isHttpStatusSuccess } = require('../../util'); -const { NetworkError, ConfigurationError } = require('../../util/errorTypes'); const tags = require('../../util/tags'); const { executeCommonValidations } = require('../../util/regulation-api'); diff --git a/src/v0/destinations/sendgrid/transform.js b/src/v0/destinations/sendgrid/transform.js index d2f5b38b70..5038fedf7b 100644 --- a/src/v0/destinations/sendgrid/transform.js +++ b/src/v0/destinations/sendgrid/transform.js @@ -1,4 +1,9 @@ const lodash = require('lodash'); +const { + ConfigurationError, + TransformationError, + InstrumentationError, +} = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { ErrorMessage, @@ -34,11 +39,6 @@ const { generatePayloadFromConfig, createOrUpdateContactPayloadBuilder, } = require('./util'); -const { - ConfigurationError, - TransformationError, - InstrumentationError, -} = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const responseBuilder = (payload, method, endpoint, apiKey) => { diff --git a/src/v0/destinations/sendgrid/util.js b/src/v0/destinations/sendgrid/util.js index fad227a65b..1df34bfe69 100644 --- a/src/v0/destinations/sendgrid/util.js +++ b/src/v0/destinations/sendgrid/util.js @@ -1,4 +1,9 @@ const get = require('get-value'); +const { + NetworkError, + ConfigurationError, + InstrumentationError, +} = require('@rudderstack/integrations-lib'); const logger = require('../../../logger'); const { isEmpty, @@ -21,7 +26,6 @@ const { processAxiosResponse, } = require('../../../adapters/utils/networkUtils'); const { httpGET } = require('../../../adapters/network'); -const { NetworkError, ConfigurationError, InstrumentationError } = require('../../util/errorTypes'); const { AUTH_CACHE_TTL, JSON_MIME_TYPE } = require('../../util/constant'); const { MAPPING_CONFIG, CONFIG_CATEGORIES } = require('./config'); diff --git a/src/v0/destinations/sendinblue/transform.js b/src/v0/destinations/sendinblue/transform.js index 151304db22..7663672f12 100644 --- a/src/v0/destinations/sendinblue/transform.js +++ b/src/v0/destinations/sendinblue/transform.js @@ -1,5 +1,6 @@ /* eslint-disable camelcase */ /* eslint-disable @typescript-eslint/naming-convention */ +const { TransformationError, InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { defaultRequestConfig, @@ -25,7 +26,6 @@ const { prepareTrackEventData, getListIds, } = require('./util'); -const { TransformationError, InstrumentationError } = require('../../util/errorTypes'); const responseBuilder = ( payload, diff --git a/src/v0/destinations/sendinblue/util.js b/src/v0/destinations/sendinblue/util.js index f184ee1ac1..9ad37fc9b7 100644 --- a/src/v0/destinations/sendinblue/util.js +++ b/src/v0/destinations/sendinblue/util.js @@ -1,3 +1,4 @@ +const { NetworkError, InstrumentationError } = require('@rudderstack/integrations-lib'); const { EMAIL_SUFFIX, getContactDetailsEndpoint } = require('./config'); const { getHashFromArray, @@ -12,7 +13,6 @@ const { processAxiosResponse, getDynamicErrorType, } = require('../../../adapters/utils/networkUtils'); -const { NetworkError, InstrumentationError } = require('../../util/errorTypes'); const tags = require('../../util/tags'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/destinations/serenytics/transform.js b/src/v0/destinations/serenytics/transform.js index ee7279e288..ee38f7d1a1 100644 --- a/src/v0/destinations/serenytics/transform.js +++ b/src/v0/destinations/serenytics/transform.js @@ -1,14 +1,14 @@ +const { + ConfigurationError, + TransformationError, + InstrumentationError, +} = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { ErrorMessage, simpleProcessRouterDest, getHashFromArrayWithDuplicate, } = require('../../util'); -const { - ConfigurationError, - TransformationError, - InstrumentationError, -} = require('../../util/errorTypes'); const { CONFIG_CATEGORIES, diff --git a/src/v0/destinations/serenytics/utils.js b/src/v0/destinations/serenytics/utils.js index bccce2585d..90ce374d5a 100644 --- a/src/v0/destinations/serenytics/utils.js +++ b/src/v0/destinations/serenytics/utils.js @@ -1,10 +1,10 @@ +const { ConfigurationError } = require('@rudderstack/integrations-lib'); const { constructPayload, extractCustomFields, defaultRequestConfig, defaultPostRequestConfig, } = require('../../util'); -const { ConfigurationError } = require('../../util/errorTypes'); const { MAPPING_CONFIG } = require('./config'); const checkStorageUrl = (STORAGE_URL, messageType) => { diff --git a/src/v0/destinations/sfmc/transform.js b/src/v0/destinations/sfmc/transform.js index 161720b2cc..7623d751f1 100644 --- a/src/v0/destinations/sfmc/transform.js +++ b/src/v0/destinations/sfmc/transform.js @@ -1,4 +1,11 @@ /* eslint-disable no-nested-ternary */ +const { + NetworkError, + ConfigurationError, + InstrumentationError, + isDefinedAndNotNull, + isEmpty, +} = require('@rudderstack/integrations-lib'); const myAxios = require('../../../util/myAxios'); const { EventType } = require('../../../constants'); const { CONFIG_CATEGORIES, MAPPING_CONFIG, ENDPOINTS } = require('./config'); @@ -12,14 +19,12 @@ const { flattenJson, toTitleCase, getHashFromArray, - isEmpty, simpleProcessRouterDest, } = require('../../util'); const { getDynamicErrorType, nodeSysErrorToStatus, } = require('../../../adapters/utils/networkUtils'); -const { NetworkError, ConfigurationError, InstrumentationError } = require('../../util/errorTypes'); const tags = require('../../util/tags'); const { JSON_MIME_TYPE } = require('../../util/constant'); @@ -217,10 +222,22 @@ const responseBuilderSimple = async (message, category, destination) => { } if (category.type === 'identify' && createOrUpdateContacts) { - throw new ConfigurationError('Creating or updating contacts is disabled'); + throw new ConfigurationError( + 'Creating or updating contacts is disabled. To enable this feature set "Do Not Create or Update Contacts" to false', + ); } - if (category.type === 'track' && hashMapExternalKey[message.event.toLowerCase()]) { + if (category.type === 'track') { + if (isEmpty(message.event)) { + throw new ConfigurationError('Event name is required for track events'); + } + if (typeof message.event !== 'string') { + throw new ConfigurationError('Event name must be a string'); + } + if (!isDefinedAndNotNull(hashMapExternalKey[message.event.toLowerCase()])) { + throw new ConfigurationError('Event not mapped for this track call'); + } + return responseBuilderForInsertData( message, hashMapExternalKey[message.event.toLowerCase()], @@ -233,7 +250,7 @@ const responseBuilderSimple = async (message, category, destination) => { ); } - throw new ConfigurationError('Event not mapped for this track call'); + throw new ConfigurationError(`Event type '${category.type}' not supported`); }; const processEvent = async (message, destination) => { @@ -270,4 +287,4 @@ const processRouterDest = async (inputs, reqMetadata) => { return respList; }; -module.exports = { process, processRouterDest }; +module.exports = { process, processRouterDest, responseBuilderSimple }; diff --git a/src/v0/destinations/sfmc/transform.test.js b/src/v0/destinations/sfmc/transform.test.js new file mode 100644 index 0000000000..c49c49017c --- /dev/null +++ b/src/v0/destinations/sfmc/transform.test.js @@ -0,0 +1,125 @@ +const { ConfigurationError } = require('@rudderstack/integrations-lib'); +const axios = require('axios'); +const MockAxiosAdapter = require('axios-mock-adapter'); +const { responseBuilderSimple } = require('./transform'); +beforeAll(() => { + const mock = new MockAxiosAdapter(axios); + mock + .onPost('https://yourSubDomain.auth.marketingcloudapis.com/v2/token') + .reply(200, '{"access_token":"yourAuthToken"}'); +}); + +describe('responseBuilderSimple', () => { + const destination = { + Config: { + clientId: 'yourClientId', + clientSecret: 'yourClientSecret', + subDomain: 'yourSubDomain', + createOrUpdateContacts: false, + externalKey: 'yourExternalKey', + eventToExternalKey: [{ from: 'purchase', to: 'purchaseKey' }], + eventToPrimaryKey: [{ from: 'purchase', to: 'primaryKey' }], + eventToUUID: [{ event: 'purchase', uuid: true }], + }, + }; + it('should return an array of two payloads for identify calls when createOrUpdateContacts is false', async () => { + const message = { + type: 'identify', + userId: '12345', + }; + + const category = { + type: 'identify', + name: 'Identify', + }; + + const response = await responseBuilderSimple(message, category, destination); + + expect(response).toHaveLength(2); + expect(response[0]).toHaveProperty('endpoint'); + expect(response[0]).toHaveProperty('method'); + expect(response[0]).toHaveProperty('body.JSON'); + expect(response[0]).toHaveProperty('headers'); + expect(response[1]).toHaveProperty('endpoint'); + expect(response[1]).toHaveProperty('method'); + expect(response[1]).toHaveProperty('body.JSON'); + expect(response[1]).toHaveProperty('headers'); + }); + + // Throws an error when event name is not provided for track calls + it('should throw an error when event name is not provided for track calls', async () => { + const message = { + type: 'track', + }; + + const category = { + type: 'track', + name: 'Track', + }; + + try { + await responseBuilderSimple(message, category, destination); + } catch (e) { + expect(e).toBeInstanceOf(ConfigurationError); + expect(e.message).toBe('Event name is required for track events'); + } + }); + + // Throws an error when event is not mapped for track calls + it('should throw an error when event is not mapped for track calls', async () => { + const message = { + type: 'track', + event: 'unmappedEvent', + }; + + const category = { + type: 'track', + name: 'Track', + }; + try { + await responseBuilderSimple(message, category, destination); + } catch (e) { + expect(e).toBeInstanceOf(ConfigurationError); + expect(e.message).toBe('Event not mapped for this track call'); + } + }); + + // Throws an error when event type is not supported + it('should throw an error when event type is not supported', async () => { + const message = { + type: 'unsupported', + }; + + const category = { + type: 'unsupported', + name: 'Unsupported', + }; + + try { + await responseBuilderSimple(message, category, destination); + } catch (e) { + expect(e).toBeInstanceOf(ConfigurationError); + expect(e.message).toBe("Event type 'unsupported' not supported"); + } + }); + + // Returns a payload for track calls when event is mapped and event name is a string + it('should return a payload for track calls when event is mapped and event name is a string', async () => { + const message = { + type: 'track', + event: 'purchase', + userId: '12345', + }; + + const category = { + type: 'track', + name: 'Track', + }; + + const response = await responseBuilderSimple(message, category, destination); + expect(response).toHaveProperty('endpoint'); + expect(response).toHaveProperty('method'); + expect(response).toHaveProperty('body.JSON'); + expect(response).toHaveProperty('headers'); + }); +}); diff --git a/src/v0/destinations/shynet/transform.js b/src/v0/destinations/shynet/transform.js index 833616a11f..565c0790d5 100644 --- a/src/v0/destinations/shynet/transform.js +++ b/src/v0/destinations/shynet/transform.js @@ -1,4 +1,5 @@ /* eslint-disable no-underscore-dangle */ +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { @@ -9,7 +10,6 @@ const { generateUUID, } = require('../../util'); const { JSON_MIME_TYPE } = require('../../util/constant'); -const { InstrumentationError } = require('../../util/errorTypes'); const { ConfigCategory, mappingConfig } = require('./config'); diff --git a/src/v0/destinations/signl4/transform.js b/src/v0/destinations/signl4/transform.js index 63dc10d73c..3a8b23b630 100644 --- a/src/v0/destinations/signl4/transform.js +++ b/src/v0/destinations/signl4/transform.js @@ -1,3 +1,8 @@ +const { + ConfigurationError, + TransformationError, + InstrumentationError, +} = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { BASE_URL } = require('./config'); const { populatePayload } = require('./utils'); @@ -7,11 +12,6 @@ const { simpleProcessRouterDest, removeUndefinedAndNullAndEmptyValues, } = require('../../util'); -const { - ConfigurationError, - TransformationError, - InstrumentationError, -} = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const responseBuilder = (payload, endpoint) => { diff --git a/src/v0/destinations/singular/transform.js b/src/v0/destinations/singular/transform.js index 749debb0b0..ff5d18db9a 100644 --- a/src/v0/destinations/singular/transform.js +++ b/src/v0/destinations/singular/transform.js @@ -1,3 +1,4 @@ +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { BASE_URL } = require('./config'); const { defaultRequestConfig, @@ -10,7 +11,6 @@ const { generateRevenuePayloadArray, isSessionEvent, } = require('./util'); -const { InstrumentationError } = require('../../util/errorTypes'); const responseBuilderSimple = (message, { Config }) => { const eventName = message.event; diff --git a/src/v0/destinations/singular/util.js b/src/v0/destinations/singular/util.js index 542b049a2e..4c5aeb8964 100644 --- a/src/v0/destinations/singular/util.js +++ b/src/v0/destinations/singular/util.js @@ -1,4 +1,5 @@ const lodash = require('lodash'); +const { TransformationError, InstrumentationError } = require('@rudderstack/integrations-lib'); const { CONFIG_CATEGORIES, MAPPING_CONFIG, @@ -20,7 +21,6 @@ const { isDefinedAndNotNull, isAppleFamily, } = require('../../util'); -const { TransformationError, InstrumentationError } = require('../../util/errorTypes'); /* All the fields listed inside properties which are not directly mapped, will be sent to 'e' as custom event attributes diff --git a/src/v0/destinations/slack/transform.js b/src/v0/destinations/slack/transform.js index 8db934d71f..41282c6887 100644 --- a/src/v0/destinations/slack/transform.js +++ b/src/v0/destinations/slack/transform.js @@ -1,5 +1,6 @@ /* eslint-disable no-nested-ternary, no-restricted-syntax, no-prototype-builtins */ const Handlebars = require('handlebars'); +const { InstrumentationError, ConfigurationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { stringifyJSON, @@ -17,7 +18,6 @@ const { simpleProcessRouterDest, isDefinedAndNotNull, } = require('../../util'); -const { InstrumentationError, ConfigurationError } = require('../../util/errorTypes'); // build the response to be sent to backend, url encoded header is required as slack accepts payload in this format // add the username and image for Rudder diff --git a/src/v0/destinations/snapchat_conversion/data/OrderCompletedConfig.json b/src/v0/destinations/snapchat_conversion/data/OrderCompletedConfig.json index dc5696e9a4..38e85ca2d8 100644 --- a/src/v0/destinations/snapchat_conversion/data/OrderCompletedConfig.json +++ b/src/v0/destinations/snapchat_conversion/data/OrderCompletedConfig.json @@ -6,7 +6,7 @@ }, { "destKey": "item_category", - "sourceKeys": "properties.item_category", + "sourceKeys": ["properties.item_category", "properties.category"], "required": false }, { diff --git a/src/v0/destinations/snapchat_conversion/transform.js b/src/v0/destinations/snapchat_conversion/transform.js index 49776935de..37d321a468 100644 --- a/src/v0/destinations/snapchat_conversion/transform.js +++ b/src/v0/destinations/snapchat_conversion/transform.js @@ -1,5 +1,6 @@ const get = require('get-value'); const moment = require('moment'); +const { InstrumentationError, ConfigurationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { @@ -33,7 +34,6 @@ const { channelMapping, generateBatchedPayloadForArray, } = require('./util'); -const { InstrumentationError, ConfigurationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); function buildResponse(apiKey, payload) { diff --git a/src/v0/destinations/snapchat_custom_audience/networkHandler.js b/src/v0/destinations/snapchat_custom_audience/networkHandler.js index 196f9a87fb..db36f6f518 100644 --- a/src/v0/destinations/snapchat_custom_audience/networkHandler.js +++ b/src/v0/destinations/snapchat_custom_audience/networkHandler.js @@ -1,3 +1,4 @@ +const { NetworkError, RetryableError, AbortedError } = require('@rudderstack/integrations-lib'); const { removeUndefinedValues, getAuthErrCategoryFromErrDetailsAndStCode } = require('../../util'); const { prepareProxyRequest, getPayloadData, httpSend } = require('../../../adapters/network'); const { isHttpStatusSuccess } = require('../../util/index'); @@ -7,7 +8,6 @@ const { getDynamicErrorType, processAxiosResponse, } = require('../../../adapters/utils/networkUtils'); -const { NetworkError, RetryableError, AbortedError } = require('../../util/errorTypes'); const { HTTP_STATUS_CODES } = require('../../util/constant'); const prepareProxyReq = (request) => { diff --git a/src/v0/destinations/snapchat_custom_audience/transform.js b/src/v0/destinations/snapchat_custom_audience/transform.js index 7938236594..f4cbeafb56 100644 --- a/src/v0/destinations/snapchat_custom_audience/transform.js +++ b/src/v0/destinations/snapchat_custom_audience/transform.js @@ -1,4 +1,5 @@ const sha256 = require('sha256'); +const { ConfigurationError } = require('@rudderstack/integrations-lib'); const { defaultRequestConfig, removeUndefinedAndNullValues, @@ -6,7 +7,6 @@ const { isDefinedAndNotNullAndNotEmpty, getAccessToken, } = require('../../util'); -const { ConfigurationError } = require('../../util/errorTypes'); const { BASE_URL, schemaType } = require('./config'); const { validatePayload, validateFields } = require('./utils'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/destinations/snapchat_custom_audience/utils.js b/src/v0/destinations/snapchat_custom_audience/utils.js index 4d20b27a09..bc4a2292da 100644 --- a/src/v0/destinations/snapchat_custom_audience/utils.js +++ b/src/v0/destinations/snapchat_custom_audience/utils.js @@ -1,4 +1,4 @@ -const { InstrumentationError } = require('../../util/errorTypes'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); /** * Verifies whether the input payload is in right format or not diff --git a/src/v0/destinations/splitio/transform.js b/src/v0/destinations/splitio/transform.js index 012c73a8b6..6641a62fe8 100644 --- a/src/v0/destinations/splitio/transform.js +++ b/src/v0/destinations/splitio/transform.js @@ -1,3 +1,4 @@ +const { TransformationError, InstrumentationError } = require('@rudderstack/integrations-lib'); const { CONFIG_CATEGORIES, MAPPING_CONFIG, @@ -18,7 +19,6 @@ const { simpleProcessRouterDest, ErrorMessage, } = require('../../util'); -const { TransformationError, InstrumentationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); function responseBuilderSimple(payload, category, destination) { diff --git a/src/v0/destinations/statsig/transform.js b/src/v0/destinations/statsig/transform.js index 1be72d4095..81658a255a 100644 --- a/src/v0/destinations/statsig/transform.js +++ b/src/v0/destinations/statsig/transform.js @@ -1,7 +1,7 @@ +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { defaultPostRequestConfig, defaultRequestConfig } = require('../../util'); const { ENDPOINT } = require('./config'); -const { InstrumentationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); function process(event) { diff --git a/src/v0/destinations/stormly/transform.js b/src/v0/destinations/stormly/transform.js index 756bfb8024..dc7a256583 100644 --- a/src/v0/destinations/stormly/transform.js +++ b/src/v0/destinations/stormly/transform.js @@ -1,6 +1,7 @@ /* eslint-disable no-nested-ternary */ const get = require('get-value'); const set = require('set-value'); +const { TransformationError, InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { defaultRequestConfig, @@ -12,7 +13,6 @@ const { getDestinationExternalID, } = require('../../util'); const { CONFIG_CATEGORIES, MAPPING_CONFIG } = require('./config'); -const { TransformationError, InstrumentationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const responseBuilder = (payload, endpoint, destination) => { @@ -40,7 +40,8 @@ const identifyResponseBuilder = (message, destination) => { const trackResponseBuilder = (message, destination) => { const { endpoint, name } = CONFIG_CATEGORIES.TRACK; - const groupId = getDestinationExternalID(message, 'stormlyGroupId') || message.properties?.groupId; + const groupId = + getDestinationExternalID(message, 'stormlyGroupId') || message.properties?.groupId; let payload = constructPayload(message, MAPPING_CONFIG[name]); if (groupId) { diff --git a/src/v0/destinations/tiktok_ads/data/TikTokTrack.json b/src/v0/destinations/tiktok_ads/data/TikTokTrack.json index b15223b999..cc5f4886e0 100644 --- a/src/v0/destinations/tiktok_ads/data/TikTokTrack.json +++ b/src/v0/destinations/tiktok_ads/data/TikTokTrack.json @@ -72,6 +72,11 @@ "sourceKeys": ["properties.context.ad", "context.ad"], "required": false }, + { + "destKey": "context.ad.callback", + "sourceKeys": "properties.clickId", + "required": false + }, { "destKey": "context.page", "sourceKeys": ["properties.context.page", "context.page"], diff --git a/src/v0/destinations/tiktok_ads/networkHandler.js b/src/v0/destinations/tiktok_ads/networkHandler.js index 1ec31e982a..ae93b1ec15 100644 --- a/src/v0/destinations/tiktok_ads/networkHandler.js +++ b/src/v0/destinations/tiktok_ads/networkHandler.js @@ -1,10 +1,10 @@ +const { NetworkError, ThrottledError, AbortedError } = require('@rudderstack/integrations-lib'); const { proxyRequest, prepareProxyRequest } = require('../../../adapters/network'); const { processAxiosResponse, getDynamicErrorType, } = require('../../../adapters/utils/networkUtils'); const { DESTINATION } = require('./config'); -const { NetworkError, ThrottledError, AbortedError } = require('../../util/errorTypes'); const { TAG_NAMES } = require('../../util/tags'); const { HTTP_STATUS_CODES } = require('../../util/constant'); diff --git a/src/v0/destinations/tiktok_ads/transform.js b/src/v0/destinations/tiktok_ads/transform.js index 4e99d83575..f0ed04a120 100644 --- a/src/v0/destinations/tiktok_ads/transform.js +++ b/src/v0/destinations/tiktok_ads/transform.js @@ -4,6 +4,7 @@ const _ = require('lodash'); const { SHA256 } = require('crypto-js'); const get = require('get-value'); const set = require('set-value'); +const { ConfigurationError, InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { constructPayload, @@ -29,7 +30,6 @@ const { MAX_BATCH_SIZE, PARTNER_NAME, } = require('./config'); -const { ConfigurationError, InstrumentationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const USER_EMAIL_KEY_PATH = 'context.user.email'; diff --git a/src/v0/destinations/tiktok_ads_offline_events/transform.js b/src/v0/destinations/tiktok_ads_offline_events/transform.js index 3539c856a3..945c31ea63 100644 --- a/src/v0/destinations/tiktok_ads_offline_events/transform.js +++ b/src/v0/destinations/tiktok_ads_offline_events/transform.js @@ -1,6 +1,7 @@ const { SHA256 } = require('crypto-js'); const set = require('set-value'); const lodash = require('lodash'); +const { ConfigurationError, InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { constructPayload, @@ -21,7 +22,6 @@ const { EVENT_NAME_MAPPING, PARTNER_NAME, } = require('./config'); -const { ConfigurationError, InstrumentationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const getContents = (message) => { diff --git a/src/v0/destinations/trengo/transform.js b/src/v0/destinations/trengo/transform.js index 14d1d8c84c..06e5496a1e 100644 --- a/src/v0/destinations/trengo/transform.js +++ b/src/v0/destinations/trengo/transform.js @@ -2,6 +2,13 @@ /* eslint-disable no-prototype-builtins */ const Handlebars = require('handlebars'); const get = require('get-value'); +const { + NetworkError, + ConfigurationError, + TransformationError, + InstrumentationError, + NetworkInstrumentationError, +} = require('@rudderstack/integrations-lib'); const myAxios = require('../../../util/myAxios'); const { EventType } = require('../../../constants'); const { EndPoints, BASE_URL } = require('./config'); @@ -17,13 +24,6 @@ const { getStringValueOfJSON, ErrorMessage, } = require('../../util'); -const { - NetworkError, - ConfigurationError, - TransformationError, - InstrumentationError, - NetworkInstrumentationError, -} = require('../../util/errorTypes'); const tags = require('../../util/tags'); const { getDynamicErrorType } = require('../../../adapters/utils/networkUtils'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/destinations/twitter_ads/transform.js b/src/v0/destinations/twitter_ads/transform.js index 363e61072e..268dca3636 100644 --- a/src/v0/destinations/twitter_ads/transform.js +++ b/src/v0/destinations/twitter_ads/transform.js @@ -1,5 +1,10 @@ const sha256 = require('sha256'); +const { + InstrumentationError, + OAuthSecretError, + ConfigurationError, +} = require('@rudderstack/integrations-lib'); const { constructPayload, defaultRequestConfig, @@ -11,11 +16,6 @@ const { const { EventType } = require('../../../constants'); const { ConfigCategories, mappingConfig, BASE_URL } = require('./config'); -const { - InstrumentationError, - OAuthSecretError, - ConfigurationError, -} = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const { getAuthHeaderForRequest } = require('./util'); diff --git a/src/v0/destinations/user/transform.js b/src/v0/destinations/user/transform.js index 6cde9c9b80..ed04f5ccd4 100644 --- a/src/v0/destinations/user/transform.js +++ b/src/v0/destinations/user/transform.js @@ -1,3 +1,8 @@ +const { + TransformationError, + InstrumentationError, + NetworkInstrumentationError, +} = require('@rudderstack/integrations-lib'); const { defaultRequestConfig, simpleProcessRouterDest, @@ -17,11 +22,6 @@ const { createOrUpdateUserPayloadBuilder, createEventOccurrencePayloadBuilder, } = require('./utils'); -const { - TransformationError, - InstrumentationError, - NetworkInstrumentationError, -} = require('../../util/errorTypes'); const { EventType } = require('../../../constants'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/destinations/user/utils.js b/src/v0/destinations/user/utils.js index 23dd74a30f..41ad173583 100644 --- a/src/v0/destinations/user/utils.js +++ b/src/v0/destinations/user/utils.js @@ -1,4 +1,8 @@ const get = require('get-value'); +const { + InstrumentationError, + NetworkInstrumentationError, +} = require('@rudderstack/integrations-lib'); const { getHashFromArray, constructPayload, @@ -19,7 +23,6 @@ const { groupSourceKeys, identifySourceKeys, } = require('./config'); -const { InstrumentationError, NetworkInstrumentationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const ACCEPT_HEADER_VAL = '*/*;version=2'; diff --git a/src/v0/destinations/userlist/transform.js b/src/v0/destinations/userlist/transform.js index 20b47c6a35..45d58edbbf 100644 --- a/src/v0/destinations/userlist/transform.js +++ b/src/v0/destinations/userlist/transform.js @@ -1,3 +1,4 @@ +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { defaultRequestConfig, @@ -9,7 +10,6 @@ const { const { endpoint } = require('./config'); -const { InstrumentationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); // ------------------------------------------------ diff --git a/src/v0/destinations/vero/transform.js b/src/v0/destinations/vero/transform.js index 7115ea425d..f489056681 100644 --- a/src/v0/destinations/vero/transform.js +++ b/src/v0/destinations/vero/transform.js @@ -1,5 +1,6 @@ const set = require('set-value'); const get = require('get-value'); +const { InstrumentationError, ConfigurationError } = require('@rudderstack/integrations-lib'); const { defaultRequestConfig, constructPayload, @@ -11,7 +12,6 @@ const { } = require('../../util'); const { EventType } = require('../../../constants'); const { CONFIG_CATEGORIES, MAPPING_CONFIG } = require('./config'); -const { InstrumentationError, ConfigurationError } = require('../../util/errorTypes'); // This function handles the common response payload for the supported calls const responseBuilderSimple = (message, category, destination) => { diff --git a/src/v0/destinations/webengage/transform.js b/src/v0/destinations/webengage/transform.js index 835a486eff..f18a7399ff 100644 --- a/src/v0/destinations/webengage/transform.js +++ b/src/v0/destinations/webengage/transform.js @@ -1,4 +1,5 @@ /* eslint-disable no-param-reassign */ +const { InstrumentationError, TransformationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { CONFIG_CATEGORIES, @@ -15,7 +16,6 @@ const { simpleProcessRouterDest, extractCustomFields, } = require('../../util'); -const { InstrumentationError, TransformationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const responseBuilder = (message, category, { Config }) => { diff --git a/src/v0/destinations/webhook/transform.js b/src/v0/destinations/webhook/transform.js index a4a7617f68..6a115f1c63 100644 --- a/src/v0/destinations/webhook/transform.js +++ b/src/v0/destinations/webhook/transform.js @@ -1,6 +1,7 @@ /* eslint-disable no-nested-ternary */ const get = require('get-value'); const set = require('set-value'); +const { ConfigurationError } = require('@rudderstack/integrations-lib'); const { defaultPostRequestConfig, defaultPutRequestConfig, @@ -17,7 +18,6 @@ const { } = require('../../util'); const { EventType } = require('../../../constants'); -const { ConfigurationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const getPropertyParams = (message) => { diff --git a/src/v0/destinations/woopra/transform.js b/src/v0/destinations/woopra/transform.js index 1414cbac23..9104884416 100644 --- a/src/v0/destinations/woopra/transform.js +++ b/src/v0/destinations/woopra/transform.js @@ -1,5 +1,6 @@ /* eslint-disable no-param-reassign */ const { set, get } = require('lodash'); +const { TransformationError, InstrumentationError } = require('@rudderstack/integrations-lib'); const { defaultRequestConfig, constructPayload, @@ -12,7 +13,6 @@ const { const { EventType } = require('../../../constants'); const { BASE_URL, mappingConfig, ConfigCategories } = require('./config'); const { refinePayload, getEvent } = require('./utils'); -const { TransformationError, InstrumentationError } = require('../../util/errorTypes'); const responseBuilder = (payload, endpoint, method, projectName) => { if (!payload) { diff --git a/src/v0/destinations/wootric/transform.js b/src/v0/destinations/wootric/transform.js index f89e63a5ed..f8b4274af7 100644 --- a/src/v0/destinations/wootric/transform.js +++ b/src/v0/destinations/wootric/transform.js @@ -1,3 +1,4 @@ +const { TransformationError, InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { defaultRequestConfig, @@ -19,7 +20,6 @@ const { createDeclinePayloadBuilder, } = require('./util'); const { PROPERTIES, END_USER_PROPERTIES } = require('./config'); -const { TransformationError, InstrumentationError } = require('../../util/errorTypes'); const responseBuilder = async (payload, endpoint, method, accessToken) => { if (payload) { diff --git a/src/v0/destinations/wootric/util.js b/src/v0/destinations/wootric/util.js index 207a0994bb..fce8a66586 100644 --- a/src/v0/destinations/wootric/util.js +++ b/src/v0/destinations/wootric/util.js @@ -1,4 +1,5 @@ const qs = require('qs'); +const { InstrumentationError, NetworkError } = require('@rudderstack/integrations-lib'); const { httpGET, httpPOST } = require('../../../adapters/network'); const { getDynamicErrorType, @@ -8,7 +9,6 @@ const { BASE_ENDPOINT, VERSION, ACCESS_TOKEN_CACHE_TTL_SECONDS } = require('./co const { constructPayload, isDefinedAndNotNullAndNotEmpty } = require('../../util'); const { CONFIG_CATEGORIES, MAPPING_CONFIG } = require('./config'); const Cache = require('../../util/cache'); -const { InstrumentationError, NetworkError } = require('../../util/errorTypes'); const tags = require('../../util/tags'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/destinations/yahoo_dsp/transform.js b/src/v0/destinations/yahoo_dsp/transform.js index 8b0875f1a0..4cd1eee73d 100644 --- a/src/v0/destinations/yahoo_dsp/transform.js +++ b/src/v0/destinations/yahoo_dsp/transform.js @@ -1,3 +1,4 @@ +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { BASE_ENDPOINT, ENDPOINTS, @@ -12,7 +13,6 @@ const { } = require('../../util'); const { getAccessToken, createPayload } = require('./util'); -const { InstrumentationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); /** diff --git a/src/v0/destinations/yahoo_dsp/util.js b/src/v0/destinations/yahoo_dsp/util.js index a069660bde..d41716935f 100644 --- a/src/v0/destinations/yahoo_dsp/util.js +++ b/src/v0/destinations/yahoo_dsp/util.js @@ -1,12 +1,12 @@ const qs = require('qs'); const sha256 = require('sha256'); +const { InstrumentationError, NetworkError } = require('@rudderstack/integrations-lib'); const { generateJWTToken } = require('../../../util/jwtTokenGenerator'); const { httpSend } = require('../../../adapters/network'); const { isDefinedAndNotNullAndNotEmpty } = require('../../util'); const { getDynamicErrorType } = require('../../../adapters/utils/networkUtils'); const { ACCESS_TOKEN_CACHE_TTL, AUDIENCE_ATTRIBUTE, DSP_SUPPORTED_OPERATION } = require('./config'); const Cache = require('../../util/cache'); -const { InstrumentationError, NetworkError } = require('../../util/errorTypes'); const tags = require('../../util/tags'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/destinations/zendesk/transform.js b/src/v0/destinations/zendesk/transform.js index 869e54c220..bf2bc01ed2 100644 --- a/src/v0/destinations/zendesk/transform.js +++ b/src/v0/destinations/zendesk/transform.js @@ -1,5 +1,10 @@ const get = require('get-value'); const set = require('set-value'); +const { + NetworkInstrumentationError, + InstrumentationError, + NetworkError, +} = require('@rudderstack/integrations-lib'); const myAxios = require('../../../util/myAxios'); const { EventType } = require('../../../constants'); @@ -26,11 +31,6 @@ const { const { getSourceName } = require('./util'); const logger = require('../../../logger'); const { httpGET } = require('../../../adapters/network'); -const { - NetworkInstrumentationError, - InstrumentationError, - NetworkError, -} = require('../../util/errorTypes'); const { getDynamicErrorType } = require('../../../adapters/utils/networkUtils'); const tags = require('../../util/tags'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/destinations/zendesk/util.js b/src/v0/destinations/zendesk/util.js index 0d03f73c19..29f3fc0602 100644 --- a/src/v0/destinations/zendesk/util.js +++ b/src/v0/destinations/zendesk/util.js @@ -1,4 +1,4 @@ -const { ConfigurationError } = require('../../util/errorTypes'); +const { ConfigurationError } = require('@rudderstack/integrations-lib'); /** * Get source name from config or return 'Rudder' as default source name diff --git a/src/v0/sources/appcenter/transform.js b/src/v0/sources/appcenter/transform.js index 3a98a6db3e..40399d92e2 100644 --- a/src/v0/sources/appcenter/transform.js +++ b/src/v0/sources/appcenter/transform.js @@ -1,5 +1,6 @@ const path = require('path'); const fs = require('fs'); +const { TransformationError } = require('@rudderstack/integrations-lib'); const { generateUUID } = require('../../util'); const Message = require('../message'); @@ -7,7 +8,6 @@ const mappingJson = JSON.parse(fs.readFileSync(path.resolve(__dirname, './mappin const { removeUndefinedAndNullValues } = require('../../util'); -const { TransformationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const processNormalEvent = (event) => { diff --git a/src/v0/sources/appsflyer/transform.js b/src/v0/sources/appsflyer/transform.js index 862e19acd0..1f21392b67 100644 --- a/src/v0/sources/appsflyer/transform.js +++ b/src/v0/sources/appsflyer/transform.js @@ -1,8 +1,8 @@ const path = require('path'); const fs = require('fs'); +const { TransformationError } = require('@rudderstack/integrations-lib'); const Message = require('../message'); const { generateUUID } = require('../../util'); -const { TransformationError } = require('../../util/errorTypes'); const mappingJson = JSON.parse(fs.readFileSync(path.resolve(__dirname, './mapping.json'), 'utf-8')); diff --git a/src/v0/sources/braze/transform.js b/src/v0/sources/braze/transform.js index 34158c8e68..e3d7200023 100644 --- a/src/v0/sources/braze/transform.js +++ b/src/v0/sources/braze/transform.js @@ -2,9 +2,9 @@ const set = require('set-value'); const get = require('get-value'); const path = require('path'); const fs = require('fs'); +const { TransformationError } = require('@rudderstack/integrations-lib'); const { formatTimeStamp, removeUndefinedAndNullValues } = require('../../util'); const Message = require('../message'); -const { TransformationError } = require('../../util/errorTypes'); // import mapping json using JSON.parse to preserve object key order const mapping = JSON.parse(fs.readFileSync(path.resolve(__dirname, './mapping.json'), 'utf-8')); diff --git a/src/v0/sources/canny/transform.js b/src/v0/sources/canny/transform.js index abc6f491b8..9188f5ac34 100644 --- a/src/v0/sources/canny/transform.js +++ b/src/v0/sources/canny/transform.js @@ -1,8 +1,8 @@ const sha256 = require('sha256'); +const { TransformationError } = require('@rudderstack/integrations-lib'); const Message = require('../message'); const { voterMapping, authorMapping, checkForRequiredFields } = require('./util'); const { logger } = require('../../../logger'); -const { TransformationError } = require('../../util/errorTypes'); const CannyOperation = { VOTE_CREATED: 'vote.created', diff --git a/src/v0/sources/canny/util.js b/src/v0/sources/canny/util.js index cd92c0c2af..549b7dcbbc 100644 --- a/src/v0/sources/canny/util.js +++ b/src/v0/sources/canny/util.js @@ -1,6 +1,6 @@ const path = require('path'); const fs = require('fs'); -const { TransformationError } = require('../../util/errorTypes'); +const { TransformationError } = require('@rudderstack/integrations-lib'); // import mapping json using JSON.parse to preserve object key order const voterMapping = JSON.parse( diff --git a/src/v0/sources/customerio/transform.js b/src/v0/sources/customerio/transform.js index 51c353dd3b..a2e69388b9 100644 --- a/src/v0/sources/customerio/transform.js +++ b/src/v0/sources/customerio/transform.js @@ -8,7 +8,6 @@ const Message = require('../message'); const { mappingConfig } = require('./config'); const { isDefinedAndNotNull } = require('../../util'); -// const { TransformationError } = require("../../util/errorTypes"); function process(event) { const message = new Message(`Customer.io`); @@ -35,7 +34,6 @@ function process(event) { message.setProperty('sentAt', validTimestamp); } - // when customer.io does not pass an associated userId, set the email address as anonymousId if ( (message.userId === null || message.userId === undefined) && diff --git a/src/v0/sources/gainsightpx/transform.js b/src/v0/sources/gainsightpx/transform.js index ca91765fa6..92f0a07456 100644 --- a/src/v0/sources/gainsightpx/transform.js +++ b/src/v0/sources/gainsightpx/transform.js @@ -1,4 +1,5 @@ const md5 = require('md5'); +const { TransformationError } = require('@rudderstack/integrations-lib'); const Message = require('../message'); const customMapping = require('./data/customMapping.json'); const identifyMapping = require('./data/identifyMapping.json'); @@ -9,7 +10,6 @@ const surveyMapping = require('./data/surveyMapping.json'); const featureMatchMapping = require('./data/featureMatchMapping.json'); const segmentIoMapping = require('./data/segmentIOMapping.json'); const { refinePayload, refineTraitPayload } = require('./utils'); -const { TransformationError } = require('../../util/errorTypes'); const buildIdentifyPayload = (event) => { let message = new Message(`GAINSIGHTPX`); diff --git a/src/v0/sources/iterable/transform.js b/src/v0/sources/iterable/transform.js index 275051815b..dc3fc72c3c 100644 --- a/src/v0/sources/iterable/transform.js +++ b/src/v0/sources/iterable/transform.js @@ -1,8 +1,8 @@ const path = require('path'); const fs = require('fs'); const md5 = require('md5'); +const { TransformationError } = require('@rudderstack/integrations-lib'); const Message = require('../message'); -const { TransformationError } = require('../../util/errorTypes'); // import mapping json using JSON.parse to preserve object key order const mapping = JSON.parse(fs.readFileSync(path.resolve(__dirname, './mapping.json'), 'utf-8')); diff --git a/src/v0/sources/mailmodo/transform.js b/src/v0/sources/mailmodo/transform.js index 8b36eafa1a..a4383fb440 100644 --- a/src/v0/sources/mailmodo/transform.js +++ b/src/v0/sources/mailmodo/transform.js @@ -1,9 +1,9 @@ const path = require('path'); const fs = require('fs'); const sha256 = require('sha256'); +const { TransformationError } = require('@rudderstack/integrations-lib'); const { flattenJson, removeUndefinedAndNullAndEmptyValues } = require('../../util'); const Message = require('../message'); -const { TransformationError } = require('../../util/errorTypes'); // import mapping json using JSON.parse to preserve object key order const mapping = JSON.parse(fs.readFileSync(path.resolve(__dirname, './mapping.json'), 'utf-8')); diff --git a/src/v0/sources/monday/transform.js b/src/v0/sources/monday/transform.js index 48cddec301..d63323605b 100644 --- a/src/v0/sources/monday/transform.js +++ b/src/v0/sources/monday/transform.js @@ -1,7 +1,7 @@ const sha256 = require('sha256'); +const { TransformationError } = require('@rudderstack/integrations-lib'); const Message = require('../message'); const { mapping, formEventName } = require('./util'); -const { TransformationError } = require('../../util/errorTypes'); const { generateUUID, removeUndefinedAndNullValues } = require('../../util'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/sources/shopify/util.js b/src/v0/sources/shopify/util.js index 2521e9cb9d..61501bdab6 100644 --- a/src/v0/sources/shopify/util.js +++ b/src/v0/sources/shopify/util.js @@ -2,6 +2,7 @@ /* eslint-disable @typescript-eslint/naming-convention */ const { v5 } = require('uuid'); const sha256 = require('sha256'); +const { TransformationError } = require('@rudderstack/integrations-lib'); const stats = require('../../../util/stats'); const { constructPayload, @@ -22,7 +23,6 @@ const { useRedisDatabase, maxTimeToIdentifyRSGeneratedCall, } = require('./config'); -const { TransformationError } = require('../../util/errorTypes'); const getDataFromRedis = async (key, metricMetadata) => { try { @@ -32,7 +32,10 @@ const getDataFromRedis = async (key, metricMetadata) => { ...metricMetadata, }); const redisData = await RedisDB.getVal(key); - if (redisData === null || (typeof redisData === "object" && Object.keys(redisData).length === 0)) { + if ( + redisData === null || + (typeof redisData === 'object' && Object.keys(redisData).length === 0) + ) { stats.increment('shopify_redis_no_val', { ...metricMetadata, }); diff --git a/src/v0/util/errorTypes/abortedError.js b/src/v0/util/errorTypes/abortedError.js deleted file mode 100644 index bf5896c8be..0000000000 --- a/src/v0/util/errorTypes/abortedError.js +++ /dev/null @@ -1,15 +0,0 @@ -const tags = require('../tags'); -const { BaseError } = require('./base'); - -class AbortedError extends BaseError { - constructor(message, statusCode, destResponse, authErrorCategory) { - const finalStatTags = { - [tags.TAG_NAMES.ERROR_CATEGORY]: tags.ERROR_CATEGORIES.NETWORK, - [tags.TAG_NAMES.ERROR_TYPE]: tags.ERROR_TYPES.ABORTED, - }; - - super(message, statusCode || 400, finalStatTags, destResponse, authErrorCategory); - } -} - -module.exports = AbortedError; diff --git a/src/v0/util/errorTypes/configurationError.js b/src/v0/util/errorTypes/configurationError.js deleted file mode 100644 index 59df3718e7..0000000000 --- a/src/v0/util/errorTypes/configurationError.js +++ /dev/null @@ -1,16 +0,0 @@ -const tags = require('../tags'); -const { BaseError } = require('./base'); - -class ConfigurationError extends BaseError { - constructor(message) { - const finalStatTags = { - [tags.TAG_NAMES.ERROR_CATEGORY]: tags.ERROR_CATEGORIES.DATA_VALIDATION, - [tags.TAG_NAMES.ERROR_TYPE]: tags.ERROR_TYPES.CONFIGURATION, - }; - - // TODO: Change this to a retryable error - super(message, 400, finalStatTags); - } -} - -module.exports = ConfigurationError; diff --git a/src/v0/util/errorTypes/filteredEventsError.js b/src/v0/util/errorTypes/filteredEventsError.js index 35a384f4e3..cb0236f342 100644 --- a/src/v0/util/errorTypes/filteredEventsError.js +++ b/src/v0/util/errorTypes/filteredEventsError.js @@ -1,13 +1,9 @@ -const tags = require('../tags'); const { BaseError } = require('./base'); const { HTTP_STATUS_CODES } = require('../constant'); class FilteredEventsError extends BaseError { constructor(message, statusCode = HTTP_STATUS_CODES.FILTER_EVENTS) { - const finalStatTags = { - [tags.TAG_NAMES.ERROR_CATEGORY]: tags.ERROR_CATEGORIES.TRANSFORMATION, - }; - super(message, statusCode, finalStatTags); + super(message, statusCode); } } diff --git a/src/v0/util/errorTypes/index.js b/src/v0/util/errorTypes/index.js index 2926306dcd..80268c3e77 100644 --- a/src/v0/util/errorTypes/index.js +++ b/src/v0/util/errorTypes/index.js @@ -1,37 +1,5 @@ -const { BaseError } = require('./base'); -const TransformationError = require('./transformationError'); -const ConfigurationError = require('./configurationError'); -const InstrumentationError = require('./instrumentationError'); -const PlatformError = require('./platformError'); -const OAuthSecretError = require('./oAuthSecretError'); -const NetworkError = require('./networkError'); -const ThrottledError = require('./throttledError'); -const RedisError = require('./redisError'); -const RetryableError = require('./retryableError'); -const InvalidAuthTokenError = require('./invalidAuthTokenError'); -const AbortedError = require('./abortedError'); -const UnhandledStatusCodeError = require('./unhandledStatusCodeError'); -const UnauthorizedError = require('./unauthorizedError'); -const NetworkInstrumentationError = require('./networkInstrumentationError'); -const UnsupportedEventError = require('./unsupportedEventError'); const FilteredEventsError = require('./filteredEventsError'); module.exports = { - BaseError, - TransformationError, - ConfigurationError, - InstrumentationError, - PlatformError, - OAuthSecretError, - NetworkError, - ThrottledError, - RetryableError, - InvalidAuthTokenError, - AbortedError, - UnhandledStatusCodeError, - UnauthorizedError, - NetworkInstrumentationError, - UnsupportedEventError, - RedisError, FilteredEventsError, }; diff --git a/src/v0/util/errorTypes/instrumentationError.js b/src/v0/util/errorTypes/instrumentationError.js deleted file mode 100644 index 74df966260..0000000000 --- a/src/v0/util/errorTypes/instrumentationError.js +++ /dev/null @@ -1,15 +0,0 @@ -const tags = require('../tags'); -const { BaseError } = require('./base'); - -class InstrumentationError extends BaseError { - constructor(message) { - const finalStatTags = { - [tags.TAG_NAMES.ERROR_CATEGORY]: tags.ERROR_CATEGORIES.DATA_VALIDATION, - [tags.TAG_NAMES.ERROR_TYPE]: tags.ERROR_TYPES.INSTRUMENTATION, - }; - - super(message, 400, finalStatTags); - } -} - -module.exports = InstrumentationError; diff --git a/src/v0/util/errorTypes/invalidAuthTokenError.js b/src/v0/util/errorTypes/invalidAuthTokenError.js deleted file mode 100644 index 6a78996c6e..0000000000 --- a/src/v0/util/errorTypes/invalidAuthTokenError.js +++ /dev/null @@ -1,16 +0,0 @@ -const tags = require('../tags'); -const { BaseError } = require('./base'); - -class InvalidAuthTokenError extends BaseError { - constructor(message, statusCode, destResponse, authErrorCategory) { - const finalStatTags = { - [tags.TAG_NAMES.ERROR_CATEGORY]: tags.ERROR_CATEGORIES.NETWORK, - [tags.TAG_NAMES.ERROR_TYPE]: tags.ERROR_TYPES.RETRYABLE, - [tags.TAG_NAMES.META]: tags.METADATA.INVALID_AUTH_TOKEN, - }; - - super(message, statusCode || 500, finalStatTags, destResponse, authErrorCategory); - } -} - -module.exports = InvalidAuthTokenError; diff --git a/src/v0/util/errorTypes/networkError.js b/src/v0/util/errorTypes/networkError.js deleted file mode 100644 index 3461efbbdd..0000000000 --- a/src/v0/util/errorTypes/networkError.js +++ /dev/null @@ -1,29 +0,0 @@ -const tags = require('../tags'); -const { BaseError } = require('./base'); - -const errorTypes = Object.values(tags.ERROR_TYPES); -const metaTypes = Object.values(tags.METADATA); -// To throw error when error type (abort, retry or throttle) has to be dynamically deduced -class NetworkError extends BaseError { - constructor(message, statusCode, statTags, destResponse, authErrorCategory) { - const finalStatTags = { - [tags.TAG_NAMES.ERROR_CATEGORY]: tags.ERROR_CATEGORIES.NETWORK, - [tags.TAG_NAMES.ERROR_TYPE]: tags.ERROR_TYPES.ABORTED, - }; - - // Allow specifying only error type and meta tags - if (statTags && typeof statTags === 'object' && !Array.isArray(statTags)) { - if (errorTypes.includes(statTags[tags.TAG_NAMES.ERROR_TYPE])) { - finalStatTags[tags.TAG_NAMES.ERROR_TYPE] = statTags[tags.TAG_NAMES.ERROR_TYPE]; - } - - if (metaTypes.includes(statTags[tags.TAG_NAMES.META])) { - finalStatTags[tags.TAG_NAMES.META] = statTags[tags.TAG_NAMES.META]; - } - } - - super(message, statusCode || 400, finalStatTags, destResponse, authErrorCategory); - } -} - -module.exports = NetworkError; diff --git a/src/v0/util/errorTypes/networkInstrumentationError.js b/src/v0/util/errorTypes/networkInstrumentationError.js deleted file mode 100644 index fb9acdfeb4..0000000000 --- a/src/v0/util/errorTypes/networkInstrumentationError.js +++ /dev/null @@ -1,16 +0,0 @@ -const tags = require('../tags'); -const { BaseError } = require('./base'); - -class NetworkInstrumentationError extends BaseError { - constructor(message, destResponse) { - const finalStatTags = { - [tags.TAG_NAMES.ERROR_CATEGORY]: tags.ERROR_CATEGORIES.NETWORK, - [tags.TAG_NAMES.ERROR_TYPE]: tags.ERROR_TYPES.ABORTED, - [tags.TAG_NAMES.META]: tags.METADATA.INSTRUMENTATION, - }; - - super(message, 400, finalStatTags, destResponse); - } -} - -module.exports = NetworkInstrumentationError; diff --git a/src/v0/util/errorTypes/oAuthSecretError.js b/src/v0/util/errorTypes/oAuthSecretError.js deleted file mode 100644 index dd8c51eaac..0000000000 --- a/src/v0/util/errorTypes/oAuthSecretError.js +++ /dev/null @@ -1,15 +0,0 @@ -const tags = require('../tags'); -const { BaseError } = require('./base'); - -class OAuthSecretError extends BaseError { - constructor(message) { - const finalStatTags = { - [tags.TAG_NAMES.ERROR_CATEGORY]: tags.ERROR_CATEGORIES.PLATFORM, - [tags.TAG_NAMES.ERROR_TYPE]: tags.ERROR_TYPES.OAUTH_SECRET, - }; - - super(message, 500, finalStatTags); - } -} - -module.exports = OAuthSecretError; diff --git a/src/v0/util/errorTypes/platformError.js b/src/v0/util/errorTypes/platformError.js deleted file mode 100644 index b04ef50c16..0000000000 --- a/src/v0/util/errorTypes/platformError.js +++ /dev/null @@ -1,14 +0,0 @@ -const tags = require('../tags'); -const { BaseError } = require('./base'); - -class PlatformError extends BaseError { - constructor(message) { - const finalStatTags = { - [tags.TAG_NAMES.ERROR_CATEGORY]: tags.ERROR_CATEGORIES.PLATFORM, - }; - - super(message, 400, finalStatTags); - } -} - -module.exports = PlatformError; diff --git a/src/v0/util/errorTypes/redisError.js b/src/v0/util/errorTypes/redisError.js deleted file mode 100644 index ec3d49ff2b..0000000000 --- a/src/v0/util/errorTypes/redisError.js +++ /dev/null @@ -1,15 +0,0 @@ -const tags = require('../tags'); -const { BaseError } = require('./base'); - -class RedisError extends BaseError { - constructor(message, statusCode) { - const finalStatTags = { - [tags.TAG_NAMES.ERROR_CATEGORY]: tags.ERROR_CATEGORIES.TRANSFORMATION, - [tags.TAG_NAMES.ERROR_TYPE]: tags.ERROR_TYPES.REDIS, - }; - - super(message, statusCode || 500, finalStatTags); - } -} - -module.exports = RedisError; diff --git a/src/v0/util/errorTypes/retryableError.js b/src/v0/util/errorTypes/retryableError.js deleted file mode 100644 index ba18424c76..0000000000 --- a/src/v0/util/errorTypes/retryableError.js +++ /dev/null @@ -1,15 +0,0 @@ -const tags = require('../tags'); -const { BaseError } = require('./base'); - -class RetryableError extends BaseError { - constructor(message, statusCode, destResponse, authErrorCategory) { - const finalStatTags = { - [tags.TAG_NAMES.ERROR_CATEGORY]: tags.ERROR_CATEGORIES.NETWORK, - [tags.TAG_NAMES.ERROR_TYPE]: tags.ERROR_TYPES.RETRYABLE, - }; - - super(message, statusCode || 500, finalStatTags, destResponse, authErrorCategory); - } -} - -module.exports = RetryableError; diff --git a/src/v0/util/errorTypes/throttledError.js b/src/v0/util/errorTypes/throttledError.js deleted file mode 100644 index 0e873c7892..0000000000 --- a/src/v0/util/errorTypes/throttledError.js +++ /dev/null @@ -1,15 +0,0 @@ -const tags = require('../tags'); -const { BaseError } = require('./base'); - -class ThrottledError extends BaseError { - constructor(message, destResponse) { - const finalStatTags = { - [tags.TAG_NAMES.ERROR_CATEGORY]: tags.ERROR_CATEGORIES.NETWORK, - [tags.TAG_NAMES.ERROR_TYPE]: tags.ERROR_TYPES.THROTTLED, - }; - - super(message, 429, finalStatTags, destResponse); - } -} - -module.exports = ThrottledError; diff --git a/src/v0/util/errorTypes/transformationError.js b/src/v0/util/errorTypes/transformationError.js deleted file mode 100644 index 0b28b61984..0000000000 --- a/src/v0/util/errorTypes/transformationError.js +++ /dev/null @@ -1,14 +0,0 @@ -const tags = require('../tags'); -const { BaseError } = require('./base'); - -class TransformationError extends BaseError { - constructor(message, statusCode, destResponse, authErrorCategory) { - const finalStatTags = { - [tags.TAG_NAMES.ERROR_CATEGORY]: tags.ERROR_CATEGORIES.TRANSFORMATION, - }; - - super(message, statusCode || 400, finalStatTags, destResponse, authErrorCategory); - } -} - -module.exports = TransformationError; diff --git a/src/v0/util/errorTypes/unauthorizedError.js b/src/v0/util/errorTypes/unauthorizedError.js deleted file mode 100644 index c9c35795b8..0000000000 --- a/src/v0/util/errorTypes/unauthorizedError.js +++ /dev/null @@ -1,16 +0,0 @@ -const tags = require('../tags'); -const { BaseError } = require('./base'); - -class UnauthorizedError extends BaseError { - constructor(message, statusCode, destResponse, authErrorCategory) { - const finalStatTags = { - [tags.TAG_NAMES.ERROR_CATEGORY]: tags.ERROR_CATEGORIES.NETWORK, - [tags.TAG_NAMES.ERROR_TYPE]: tags.ERROR_TYPES.ABORTED, - [tags.TAG_NAMES.META]: tags.METADATA.UNAUTHORIZED, - }; - - super(message, statusCode || 400, finalStatTags, destResponse, authErrorCategory); - } -} - -module.exports = UnauthorizedError; diff --git a/src/v0/util/errorTypes/unhandledStatusCodeError.js b/src/v0/util/errorTypes/unhandledStatusCodeError.js deleted file mode 100644 index fe35c01c1a..0000000000 --- a/src/v0/util/errorTypes/unhandledStatusCodeError.js +++ /dev/null @@ -1,16 +0,0 @@ -const tags = require('../tags'); -const { BaseError } = require('./base'); - -class UnhandledStatusCodeError extends BaseError { - constructor(message, destResponse) { - const finalStatTags = { - [tags.TAG_NAMES.ERROR_CATEGORY]: tags.ERROR_CATEGORIES.NETWORK, - [tags.TAG_NAMES.ERROR_TYPE]: tags.ERROR_TYPES.ABORTED, - [tags.TAG_NAMES.META]: tags.METADATA.UNHANDLED_STATUS_CODE, - }; - - super(message, 400, finalStatTags, destResponse); - } -} - -module.exports = UnhandledStatusCodeError; diff --git a/src/v0/util/errorTypes/unsupportedEventError.js b/src/v0/util/errorTypes/unsupportedEventError.js deleted file mode 100644 index c2e965b620..0000000000 --- a/src/v0/util/errorTypes/unsupportedEventError.js +++ /dev/null @@ -1,14 +0,0 @@ -const tags = require('../tags'); -const { BaseError } = require('./base'); - -class UnsupportedEventError extends BaseError { - constructor(message) { - const finalStatTags = { - [tags.TAG_NAMES.ERROR_CATEGORY]: tags.ERROR_CATEGORIES.PLATFORM, - [tags.TAG_NAMES.ERROR_TYPE]: tags.ERROR_TYPES.UNSUPPORTED, - }; - super(message, 400, finalStatTags); - } -} - -module.exports = UnsupportedEventError; diff --git a/src/v0/util/facebookUtils/index.js b/src/v0/util/facebookUtils/index.js index d39d1c4ce9..4c09518559 100644 --- a/src/v0/util/facebookUtils/index.js +++ b/src/v0/util/facebookUtils/index.js @@ -1,4 +1,5 @@ const sha256 = require('sha256'); +const { InstrumentationError, TransformationError } = require('@rudderstack/integrations-lib'); const { isObject, getIntegrationsObj, @@ -9,7 +10,6 @@ const { getFieldValueFromMessage, formatTimeStamp, } = require('../index'); -const { InstrumentationError, TransformationError } = require('../errorTypes'); /** This function transforms the payloads according to the config settings and adds, removes or hashes pii data. @param message --> the rudder payload diff --git a/src/v0/util/facebookUtils/networkHandler.js b/src/v0/util/facebookUtils/networkHandler.js index 87c2ced2b4..e0d69fa5c8 100644 --- a/src/v0/util/facebookUtils/networkHandler.js +++ b/src/v0/util/facebookUtils/networkHandler.js @@ -1,11 +1,11 @@ const { isEmpty } = require('lodash'); const get = require('get-value'); +const { NetworkError } = require('@rudderstack/integrations-lib'); const { processAxiosResponse, getDynamicErrorType, } = require('../../../adapters/utils/networkUtils'); const { prepareProxyRequest, proxyRequest } = require('../../../adapters/network'); -const { NetworkError } = require('../errorTypes'); const tags = require('../tags'); const { ErrorDetailsExtractorBuilder } = require('../../../util/error-extractor'); @@ -195,6 +195,9 @@ const errorDetailsMap = { .setMessage('There have been too many calls to this ad-account.') .build(), }, + 200: { + default: new ErrorDetailsExtractorBuilder().setStatus(403).setMessageField('message').build(), + }, }; const getErrorDetailsFromErrorMap = (error) => { diff --git a/src/v0/util/index.js b/src/v0/util/index.js index d6f6621220..fee1d7a96d 100644 --- a/src/v0/util/index.js +++ b/src/v0/util/index.js @@ -16,16 +16,16 @@ const uaParser = require('ua-parser-js'); const moment = require('moment-timezone'); const sha256 = require('sha256'); const crypto = require('crypto'); -const logger = require('../../logger'); -const stats = require('../../util/stats'); -const { DestCanonicalNames, DestHandlerMap } = require('../../constants/destinationCanonicalNames'); const { InstrumentationError, BaseError, PlatformError, TransformationError, OAuthSecretError, -} = require('./errorTypes'); +} = require('@rudderstack/integrations-lib'); +const logger = require('../../logger'); +const stats = require('../../util/stats'); +const { DestCanonicalNames, DestHandlerMap } = require('../../constants/destinationCanonicalNames'); const { client: errNotificationClient } = require('../../util/errorNotifier'); const { HTTP_STATUS_CODES } = require('./constant'); const { @@ -2083,6 +2083,31 @@ const IsGzipSupported = (reqMetadata = {}) => { return false; }; +/** + * Returns an array containing the values of the specified key from each object in the input array. + * If the input array is falsy (null, undefined, empty array), an empty array is returned. + * + * @param {Array} arr - The input array from which values will be extracted. + * @param {string} key - The key of the property whose values will be extracted from each object in the input array. + * @returns {Array} - A new array containing the values of the specified key from each object in the input array. + * + * @example + * const configArray = [ + * { name: 'John', age: 25 }, + * { name: 'Jane', age: 30 }, + * { name: 'Bob', age: 35 } + * ]; + * + * const result = parseConfigArray(configArray, 'name'); + * Output: ['John', 'Jane', 'Bob'] + */ +const parseConfigArray = (arr, key) => { + if (!arr) { + return []; + } + return arr.map((item) => item[key]); +}; + // ======================================================================== // EXPORTS // ======================================================================== @@ -2192,4 +2217,5 @@ module.exports = { isValidInteger, isNewStatusCodesAccepted, IsGzipSupported, + parseConfigArray, }; diff --git a/src/v0/util/regulation-api.js b/src/v0/util/regulation-api.js index 8a557858e0..238993ee81 100644 --- a/src/v0/util/regulation-api.js +++ b/src/v0/util/regulation-api.js @@ -1,4 +1,4 @@ -const { PlatformError } = require('./errorTypes'); +const { PlatformError } = require('@rudderstack/integrations-lib'); const RegulationApiUtils = { /** diff --git a/src/v1/destinations/campaign_manager/networkHandler.js b/src/v1/destinations/campaign_manager/networkHandler.js new file mode 100644 index 0000000000..b3b82c8cf3 --- /dev/null +++ b/src/v1/destinations/campaign_manager/networkHandler.js @@ -0,0 +1,117 @@ +/* eslint-disable no-param-reassign */ +/* eslint-disable no-restricted-syntax */ +const { NetworkError } = require('@rudderstack/integrations-lib'); +const { prepareProxyRequest, proxyRequest } = require('../../../adapters/network'); +const { isHttpStatusSuccess, getAuthErrCategoryFromStCode } = require('../../../v0/util/index'); + +const { + processAxiosResponse, + getDynamicErrorType, +} = require('../../../adapters/utils/networkUtils'); +const tags = require('../../../v0/util/tags'); + +function isEventRetryableAndExtractErrMsg(element, proxyOutputObj) { + let isRetryable = false; + let errorMsg = ''; + // success event + if (!element.errors) { + return isRetryable; + } + for (const err of element.errors) { + errorMsg += `${err.message}, `; + if (err.code === 'INTERNAL') { + isRetryable = true; + } + } + if (errorMsg) { + proxyOutputObj.error = errorMsg; + } + return isRetryable; +} + +function isEventAbortableAndExtractErrMsg(element, proxyOutputObj) { + let isAbortable = false; + let errorMsg = ''; + // success event + if (!element.errors) { + return isAbortable; + } + for (const err of element.errors) { + errorMsg += `${err.message}, `; + // if code is any of these, event is not retryable + if ( + err.code === 'PERMISSION_DENIED' || + err.code === 'INVALID_ARGUMENT' || + err.code === 'NOT_FOUND' + ) { + isAbortable = true; + } + } + if (errorMsg) { + proxyOutputObj.error = errorMsg; + } + return isAbortable; +} + +const responseHandler = (destinationResponse) => { + const message = `[CAMPAIGN_MANAGER Response V1 Handler] - Request Processed Successfully`; + const responseWithIndividualEvents = []; + const { response, status, rudderJobMetadata } = destinationResponse; + + if (isHttpStatusSuccess(status)) { + // check for Partial Event failures and Successes + const destPartialStatus = response.status; + + for (const [idx, element] of destPartialStatus.entries()) { + const proxyOutputObj = { + statusCode: 200, + metadata: rudderJobMetadata[idx], + error: 'success', + }; + // update status of partial event as per retriable or abortable + if (isEventRetryableAndExtractErrMsg(element, proxyOutputObj)) { + proxyOutputObj.statusCode = 500; + } else if (isEventAbortableAndExtractErrMsg(element, proxyOutputObj)) { + proxyOutputObj.statusCode = 400; + } + responseWithIndividualEvents.push(proxyOutputObj); + } + + return { + status, + message, + destinationResponse, + response: responseWithIndividualEvents, + }; + } + + // in case of failure status, populate response to maintain len(metadata)=len(response) + const errorMessage = response.error?.message || 'unknown error format'; + for (const metadata of rudderJobMetadata) { + responseWithIndividualEvents.push({ + statusCode: 500, + metadata, + error: errorMessage, + }); + } + + throw new NetworkError( + `Campaign Manager: Error transformer proxy v1 during CAMPAIGN_MANAGER response transformation`, + 500, + { + [tags.TAG_NAMES.ERROR_TYPE]: getDynamicErrorType(status), + }, + destinationResponse, + getAuthErrCategoryFromStCode(status), + responseWithIndividualEvents, + ); +}; + +function networkHandler() { + this.prepareProxy = prepareProxyRequest; + this.proxy = proxyRequest; + this.processAxiosResponse = processAxiosResponse; + this.responseHandler = responseHandler; +} + +module.exports = { networkHandler }; diff --git a/src/v0/sources/webhook/transform.js b/src/v1/sources/webhook/transform.js similarity index 81% rename from src/v0/sources/webhook/transform.js rename to src/v1/sources/webhook/transform.js index 3a756ef63b..fc13424b8a 100644 --- a/src/v0/sources/webhook/transform.js +++ b/src/v1/sources/webhook/transform.js @@ -1,4 +1,4 @@ -const { removeUndefinedAndNullValues, generateUUID } = require('../../util'); +const { removeUndefinedAndNullValues, generateUUID } = require('../../../v0/util'); function processEvent(event) { const payload = { @@ -10,7 +10,8 @@ function processEvent(event) { return payload; } -function process(event) { +function process(inputEvent) { + const { event } = inputEvent; const response = processEvent(event); return removeUndefinedAndNullValues(response); } diff --git a/src/warehouse/identity.js b/src/warehouse/identity.js index 4326dddfc6..c34a66a481 100644 --- a/src/warehouse/identity.js +++ b/src/warehouse/identity.js @@ -1,5 +1,5 @@ const _ = require('lodash'); -const { InstrumentationError } = require('../v0/util/errorTypes'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { getVersionedUtils } = require('./util'); const identityEnabledWarehouses = ['snowflake', 'bq']; diff --git a/src/warehouse/index.js b/src/warehouse/index.js index c12239c440..d88904b4a8 100644 --- a/src/warehouse/index.js +++ b/src/warehouse/index.js @@ -25,7 +25,7 @@ const whScreenColumnMappingRules = require('./config/WHScreenConfig.js'); const whGroupColumnMappingRules = require('./config/WHGroupConfig.js'); const whAliasColumnMappingRules = require('./config/WHAliasConfig.js'); const { isDataLakeProvider } = require('./config/helpers'); -const { InstrumentationError } = require('../v0/util/errorTypes'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const whExtractEventTableColumnMappingRules = require('./config/WHExtractEventTableConfig.js'); const maxColumnsInEvent = parseInt(process.env.WH_MAX_COLUMNS_IN_EVENT || '200', 10); diff --git a/src/warehouse/util.js b/src/warehouse/util.js index 91b49039f1..79981249e7 100644 --- a/src/warehouse/util.js +++ b/src/warehouse/util.js @@ -3,7 +3,7 @@ const get = require('get-value'); const v0 = require('./v0/util'); const v1 = require('./v1/util'); -const { PlatformError, InstrumentationError } = require('../v0/util/errorTypes'); +const { PlatformError, InstrumentationError } = require('@rudderstack/integrations-lib'); const minTimeInMs = Date.parse('0001-01-01T00:00:00Z'); const maxTimeInMs = Date.parse('9999-12-31T23:59:59.999Z'); diff --git a/src/warehouse/v1/util.js b/src/warehouse/v1/util.js index 8f44a17b8e..1c44a2385e 100644 --- a/src/warehouse/v1/util.js +++ b/src/warehouse/v1/util.js @@ -2,7 +2,7 @@ const _ = require('lodash'); const reservedANSIKeywordsMap = require('../config/ReservedKeywords.json'); const { isDataLakeProvider } = require('../config/helpers'); -const { TransformationError } = require('../../v0/util/errorTypes'); +const { TransformationError } = require('@rudderstack/integrations-lib'); function safeTableName(options, name = '') { const { provider } = options; diff --git a/test/__tests__/data/am_input.json b/test/__tests__/data/am_input.json index 3e5cde2cca..2eecfb1d2c 100644 --- a/test/__tests__/data/am_input.json +++ b/test/__tests__/data/am_input.json @@ -1074,9 +1074,7 @@ "CHILD_KEY_102": "value_103" }, "name_trait": "Company", - "value_trait": [ - "ABC" - ] + "value_trait": ["ABC"] }, "sentAt": "2020-10-20T07:54:58.983Z" }, @@ -4313,8 +4311,7 @@ "All": true }, "messageId": "1662393883248-509420bf-b812-4f8d-bdb2-8c811bfde87f", - "properties": { - }, + "properties": {}, "originalTimestamp": "2022-09-05T16:04:43.250Z", "type": "screen", "userId": "User Android" @@ -4842,5 +4839,105 @@ "userProvidedPageEventString": "Viewed {{context.page.title}} event." } } + }, + { + "message": { + "type": "screen", + "userId": "identified user id", + "anonymousId": "anon-id-new", + "event": "Screen View", + "properties": { + "prop1": "5" + }, + "context": { + "ip": "14.5.67.21", + "library": { + "name": "http" + } + }, + "timestamp": "2020-02-02T00:23:09.544Z" + }, + "destination": { + "Config": { + "apiKey": "abcde", + "useUserDefinedScreenEventName": true, + "userProvidedScreenEventString": "My {{ event }} event." + } + } + }, + { + "message": { + "type": "screen", + "userId": "identified user id", + "anonymousId": "anon-id-new", + "event": "Screen View", + "properties": { + "prop1": "5" + }, + "context": { + "ip": "14.5.67.21", + "library": { + "name": "http" + } + }, + "timestamp": "2020-02-02T00:23:09.544Z" + }, + "destination": { + "Config": { + "apiKey": "abcde", + "useUserDefinedScreenEventName": false, + "userProvidedScreenEventString": "My {{ event }} event." + } + } + }, + { + "message": { + "type": "screen", + "userId": "identified user id", + "anonymousId": "anon-id-new", + "event": "Screen same as event", + "properties": { + "prop1": "5" + }, + "context": { + "ip": "14.5.67.21", + "library": { + "name": "http" + } + }, + "timestamp": "2020-02-02T00:23:09.544Z" + }, + "destination": { + "Config": { + "apiKey": "abcde", + "useUserDefinedScreenEventName": true, + "userProvidedScreenEventString": "{{ event }}" + } + } + }, + { + "message": { + "type": "screen", + "userId": "identified user id", + "anonymousId": "anon-id-new", + "name": "Screen", + "properties": { + "prop1": "5" + }, + "context": { + "ip": "14.5.67.21", + "library": { + "name": "http" + } + }, + "timestamp": "2020-02-02T00:23:09.544Z" + }, + "destination": { + "Config": { + "apiKey": "abcde", + "useUserDefinedScreenEventName": true, + "userProvidedScreenEventString": "" + } + } } -] \ No newline at end of file +] diff --git a/test/__tests__/data/am_output.json b/test/__tests__/data/am_output.json index 34471f4922..6744a9dcef 100644 --- a/test/__tests__/data/am_output.json +++ b/test/__tests__/data/am_output.json @@ -757,9 +757,7 @@ "JSON_ARRAY": {}, "FORM": { "api_key": "abcde", - "identification": [ - "{\"group_type\":\"Company\",\"group_value\":\"ABC\"}" - ] + "identification": ["{\"group_type\":\"Company\",\"group_value\":\"ABC\"}"] } }, "files": {}, @@ -3944,7 +3942,7 @@ "id": "User Android", "userId": "User Android" }, - "event_type": "Viewed Screen", + "event_type": "Viewed Screen", "user_id": "User Android", "device_brand": "Google", "time": 1662393883250, @@ -4276,7 +4274,7 @@ "app_name": "RudderLabs JavaScript SDK", "app_version": "1.0.0", "language": "en-US", - "event_type": "Viewed Page", + "event_type": "Viewed Page", "event_properties": { "path": "/destinations/amplitude", "referrer": "", @@ -4311,5 +4309,161 @@ }, "files": {}, "userId": "00000000000000000000000000" + }, + { + "version": "1", + "type": "REST", + "method": "POST", + "endpoint": "https://api2.amplitude.com/2/httpapi", + "headers": { + "Content-Type": "application/json" + }, + "params": {}, + "body": { + "JSON": { + "api_key": "abcde", + "events": [ + { + "device_id": "anon-id-new", + "library": "rudderstack", + "event_properties": { + "prop1": "5", + "name": "Screen View" + }, + "event_type": "My Screen View event.", + "time": 1580602989544, + "user_id": "identified user id", + "user_properties": {}, + "session_id": -1, + "ip": "14.5.67.21" + } + ], + "options": { + "min_id_length": 1 + } + }, + "XML": {}, + "JSON_ARRAY": {}, + "FORM": {} + }, + "files": {}, + "userId": "anon-id-new" + }, + { + "version": "1", + "type": "REST", + "method": "POST", + "endpoint": "https://api2.amplitude.com/2/httpapi", + "headers": { + "Content-Type": "application/json" + }, + "params": {}, + "body": { + "JSON": { + "api_key": "abcde", + "events": [ + { + "device_id": "anon-id-new", + "library": "rudderstack", + "event_properties": { + "prop1": "5", + "name": "Screen View" + }, + "event_type": "Viewed Screen View Screen", + "time": 1580602989544, + "user_id": "identified user id", + "user_properties": {}, + "session_id": -1, + "ip": "14.5.67.21" + } + ], + "options": { + "min_id_length": 1 + } + }, + "XML": {}, + "JSON_ARRAY": {}, + "FORM": {} + }, + "files": {}, + "userId": "anon-id-new" + }, + { + "version": "1", + "type": "REST", + "method": "POST", + "endpoint": "https://api2.amplitude.com/2/httpapi", + "headers": { + "Content-Type": "application/json" + }, + "params": {}, + "body": { + "JSON": { + "api_key": "abcde", + "events": [ + { + "device_id": "anon-id-new", + "library": "rudderstack", + "event_properties": { + "prop1": "5", + "name": "Screen same as event" + }, + "event_type": "Screen same as event", + "time": 1580602989544, + "user_id": "identified user id", + "user_properties": {}, + "session_id": -1, + "ip": "14.5.67.21" + } + ], + "options": { + "min_id_length": 1 + } + }, + "XML": {}, + "JSON_ARRAY": {}, + "FORM": {} + }, + "files": {}, + "userId": "anon-id-new" + }, + { + "version": "1", + "type": "REST", + "method": "POST", + "endpoint": "https://api2.amplitude.com/2/httpapi", + "headers": { + "Content-Type": "application/json" + }, + "params": {}, + "body": { + "JSON": { + "api_key": "abcde", + "events": [ + { + "device_id": "anon-id-new", + "library": "rudderstack", + "event_properties": { + "prop1": "5", + "name": "Screen" + }, + "event_type": "Screen", + "time": 1580602989544, + "user_id": "identified user id", + "user_properties": {}, + "session_id": -1, + "ip": "14.5.67.21" + } + ], + "options": { + "min_id_length": 1 + } + }, + "XML": {}, + "JSON_ARRAY": {}, + "FORM": {} + }, + "files": {}, + "userId": "anon-id-new" } -] \ No newline at end of file +] diff --git a/test/__tests__/data/campaign_manager_proxy_input.json b/test/__tests__/data/campaign_manager_proxy_input.json deleted file mode 100644 index e7bf369d0c..0000000000 --- a/test/__tests__/data/campaign_manager_proxy_input.json +++ /dev/null @@ -1,96 +0,0 @@ -[ - { - "request": { - "body": { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://dfareporting.googleapis.com/dfareporting/v4/userprofiles/437689/conversions/batchupdate", - "headers": { - "Authorization": "Bearer dummyApiKey", - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "kind": "dfareporting#conversionsBatchInsertRequest", - "encryptionInfo": { - "kind": "dfareporting#encryptionInfo", - "encryptionSource": "AD_SERVING", - "encryptionEntityId": "3564523", - "encryptionEntityType": "DCM_ACCOUNT" - }, - "conversions": [ - { - "timestampMicros": "1668624722000000", - "floodlightConfigurationId": "213123123", - "ordinal": "string", - "floodlightActivityId": "456543345245", - "mobileDeviceId": "string", - "value": 7, - "encryptedUserIdCandidates": ["dfghjbnm"], - "gclid": "string", - "matchId": "string", - "dclid": "string", - "impressionId": "string", - "limitAdTracking": true, - "childDirectedTreatment": true - } - ] - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - } - } - }, - { - "request": { - "body": { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://dfareporting.googleapis.com/dfareporting/v4/userprofiles/437689/conversions/batchupdate", - "headers": { - "Authorization": "Bearer dummyApiKey", - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "kind": "dfareporting#conversionsBatchUpdateRequest", - "encryptionInfo": { - "kind": "dfareporting#encryptionInfo", - "encryptionSource": "AD_SERVING", - "encryptionEntityId": "3564523", - "encryptionEntityType": "DCM_ACCOUNT" - }, - "conversions": [ - { - "timestampMicros": "1668624722000000", - "floodlightConfigurationId": "213123123", - "ordinal": "string", - "floodlightActivityId": "456543345245", - "mobileDeviceId": "string", - "value": 7, - "encryptedUserIdCandidates": ["dfghjbnm"], - "gclid": "string", - "matchId": "string", - "dclid": "string", - "impressionId": "string", - "limitAdTracking": true, - "childDirectedTreatment": true - } - ] - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - } - } - } -] diff --git a/test/__tests__/data/campaign_manager_proxy_output.json b/test/__tests__/data/campaign_manager_proxy_output.json deleted file mode 100644 index c5dcc4559f..0000000000 --- a/test/__tests__/data/campaign_manager_proxy_output.json +++ /dev/null @@ -1,51 +0,0 @@ -[ - { - "output": { - "destinationResponse": { - "error": { - "code": 403, - "message": "The caller does not have permission", - "errors": [ - { - "message": "Invalid Credentials", - "domain": "global", - "reason": "authError", - "location": "Authorization", - "locationType": "header" - } - ], - "status": "PERMISSION_DENIED" - } - }, - "message": "Campaign Manager: Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project. during CAMPAIGN_MANAGER response transformation", - "statTags": { - "destType": "CAMPAIGN_MANAGER", - "errorAt": "proxy", - "scope": "exception", - "stage": "responseTransform" - }, - "status": 403 - } - }, - { - "output": { - "status": 200, - "message": "[CAMPAIGN_MANAGER Response Handler] - Request Processed Successfully", - "destinationResponse": { - "response": [ - { - "adjustmentType": "ENHANCEMENT", - "conversionAction": "customers/7693729833/conversionActions/874224905", - "adjustmentDateTime": "2021-01-01 12:32:45-08:00", - "gclidDateTimePair": { - "gclid": "1234", - "conversionDateTime": "2021-01-01 12:32:45-08:00" - }, - "orderId": "12345" - } - ], - "status": 200 - } - } - } -] diff --git a/test/__tests__/data/facebook_conversions.json b/test/__tests__/data/facebook_conversions.json index 62d0a49c0f..cc4d9a1421 100644 --- a/test/__tests__/data/facebook_conversions.json +++ b/test/__tests__/data/facebook_conversions.json @@ -120,7 +120,7 @@ "revenue": 400, "additional_bet_index": 0 }, - "timestamp": "2023-10-15T15:46:51.693229+05:30", + "timestamp": "2023-11-12T15:46:51.693229+05:30", "type": "track" }, "destination": { @@ -201,7 +201,7 @@ "revenue": 400, "additional_bet_index": 0 }, - "timestamp": "2023-10-15T15:46:51.693229+05:30", + "timestamp": "2023-11-12T15:46:51.693229+05:30", "type": "track" }, "destination": { @@ -241,7 +241,7 @@ "version": "1", "type": "REST", "method": "POST", - "endpoint": "https://graph.facebook.com/v17.0/dummyID/events?access_token=09876", + "endpoint": "https://graph.facebook.com/v18.0/dummyID/events?access_token=09876", "headers": {}, "params": {}, "body": { @@ -250,7 +250,7 @@ "JSON_ARRAY": {}, "FORM": { "data": [ - "{\"user_data\":{\"em\":\"48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08\",\"zp\":\"03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4\"},\"event_name\":\"spin_result\",\"event_time\":1697365011,\"action_source\":\"website\",\"custom_data\":{\"revenue\":400,\"additional_bet_index\":0,\"value\":400,\"currency\":\"USD\"}}" + "{\"user_data\":{\"em\":\"48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08\",\"zp\":\"03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4\"},\"event_name\":\"spin_result\",\"event_time\":1699784211,\"action_source\":\"website\",\"custom_data\":{\"revenue\":400,\"additional_bet_index\":0,\"value\":400,\"currency\":\"USD\"}}" ] } }, @@ -298,7 +298,7 @@ "revenue": 400, "additional_bet_index": 0 }, - "timestamp": "2023-10-15T15:46:51.693229+05:30", + "timestamp": "2023-11-12T15:46:51.693229+05:30", "type": "track" }, "destination": { @@ -338,7 +338,7 @@ "version": "1", "type": "REST", "method": "POST", - "endpoint": "https://graph.facebook.com/v17.0/dummyID/events?access_token=09876", + "endpoint": "https://graph.facebook.com/v18.0/dummyID/events?access_token=09876", "headers": {}, "params": {}, "body": { @@ -347,7 +347,7 @@ "JSON_ARRAY": {}, "FORM": { "data": [ - "{\"user_data\":{\"em\":\"48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08\",\"zp\":\"03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4\"},\"event_name\":\"Search\",\"event_time\":1697365011,\"action_source\":\"website\",\"custom_data\":{\"revenue\":400,\"additional_bet_index\":0,\"content_ids\":[],\"contents\":[],\"content_type\":\"product\",\"currency\":\"USD\",\"value\":400}}" + "{\"user_data\":{\"em\":\"48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08\",\"zp\":\"03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4\"},\"event_name\":\"Search\",\"event_time\":1699784211,\"action_source\":\"website\",\"custom_data\":{\"revenue\":400,\"additional_bet_index\":0,\"content_ids\":[],\"contents\":[],\"content_type\":\"product\",\"currency\":\"USD\",\"value\":400}}" ] } }, @@ -395,7 +395,7 @@ "revenue": 400, "additional_bet_index": 0 }, - "timestamp": "2023-10-15T15:46:51.693229+05:30", + "timestamp": "2023-11-12T15:46:51.693229+05:30", "type": "track" }, "destination": { @@ -435,7 +435,7 @@ "version": "1", "type": "REST", "method": "POST", - "endpoint": "https://graph.facebook.com/v17.0/dummyID/events?access_token=09876", + "endpoint": "https://graph.facebook.com/v18.0/dummyID/events?access_token=09876", "headers": {}, "params": {}, "body": { @@ -444,7 +444,7 @@ "JSON_ARRAY": {}, "FORM": { "data": [ - "{\"user_data\":{\"em\":\"48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08\",\"zp\":\"03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4\"},\"event_name\":\"AddToCart\",\"event_time\":1697365011,\"action_source\":\"website\",\"custom_data\":{\"revenue\":400,\"additional_bet_index\":0,\"content_ids\":[],\"contents\":[],\"content_type\":\"product\",\"currency\":\"USD\",\"value\":400}}" + "{\"user_data\":{\"em\":\"48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08\",\"zp\":\"03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4\"},\"event_name\":\"AddToCart\",\"event_time\":1699784211,\"action_source\":\"website\",\"custom_data\":{\"revenue\":400,\"additional_bet_index\":0,\"content_ids\":[],\"contents\":[],\"content_type\":\"product\",\"currency\":\"USD\",\"value\":400}}" ] } }, @@ -492,7 +492,7 @@ "revenue": 400, "additional_bet_index": 0 }, - "timestamp": "2023-10-15T15:46:51.693229+05:30", + "timestamp": "2023-11-12T15:46:51.693229+05:30", "type": "track" }, "destination": { @@ -532,7 +532,7 @@ "version": "1", "type": "REST", "method": "POST", - "endpoint": "https://graph.facebook.com/v17.0/dummyID/events?access_token=09876", + "endpoint": "https://graph.facebook.com/v18.0/dummyID/events?access_token=09876", "headers": {}, "params": {}, "body": { @@ -541,7 +541,7 @@ "JSON_ARRAY": {}, "FORM": { "data": [ - "{\"user_data\":{\"em\":\"48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08\",\"zp\":\"03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4\"},\"event_name\":\"ViewContent\",\"event_time\":1697365011,\"action_source\":\"website\",\"custom_data\":{\"revenue\":400,\"additional_bet_index\":0,\"content_ids\":[],\"contents\":[],\"content_type\":\"product\",\"currency\":\"USD\",\"value\":400}}" + "{\"user_data\":{\"em\":\"48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08\",\"zp\":\"03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4\"},\"event_name\":\"ViewContent\",\"event_time\":1699784211,\"action_source\":\"website\",\"custom_data\":{\"revenue\":400,\"additional_bet_index\":0,\"content_ids\":[],\"contents\":[],\"content_type\":\"product\",\"currency\":\"USD\",\"value\":400}}" ] } }, @@ -596,7 +596,7 @@ } ] }, - "timestamp": "2023-10-15T15:46:51.693229+05:30", + "timestamp": "2023-11-12T15:46:51.693229+05:30", "type": "track" }, "destination": { @@ -636,7 +636,7 @@ "version": "1", "type": "REST", "method": "POST", - "endpoint": "https://graph.facebook.com/v17.0/dummyID/events?access_token=09876", + "endpoint": "https://graph.facebook.com/v18.0/dummyID/events?access_token=09876", "headers": {}, "params": {}, "body": { @@ -645,7 +645,7 @@ "JSON_ARRAY": {}, "FORM": { "data": [ - "{\"user_data\":{\"em\":\"48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08\",\"zp\":\"03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4\"},\"event_name\":\"ViewContent\",\"event_time\":1697365011,\"action_source\":\"website\",\"custom_data\":{\"revenue\":400,\"additional_bet_index\":0,\"products[0].product_id\":1234,\"products[0].quantity\":5,\"products[0].price\":55,\"content_ids\":[1234],\"contents\":[{\"id\":1234,\"quantity\":5,\"item_price\":55}],\"content_type\":\"product\",\"currency\":\"USD\",\"value\":400}}" + "{\"user_data\":{\"em\":\"48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08\",\"zp\":\"03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4\"},\"event_name\":\"ViewContent\",\"event_time\":1699784211,\"action_source\":\"website\",\"custom_data\":{\"revenue\":400,\"additional_bet_index\":0,\"products\":[{\"product_id\":1234,\"quantity\":5,\"price\":55}],\"content_ids\":[1234],\"contents\":[{\"id\":1234,\"quantity\":5,\"item_price\":55}],\"content_type\":\"product\",\"currency\":\"USD\",\"value\":400}}" ] } }, @@ -694,7 +694,7 @@ "additional_bet_index": 0, "category": "randomCategory" }, - "timestamp": "2023-10-15T15:46:51.693229+05:30", + "timestamp": "2023-11-12T15:46:51.693229+05:30", "type": "track" }, "destination": { @@ -734,7 +734,7 @@ "version": "1", "type": "REST", "method": "POST", - "endpoint": "https://graph.facebook.com/v17.0/dummyID/events?access_token=09876", + "endpoint": "https://graph.facebook.com/v18.0/dummyID/events?access_token=09876", "headers": {}, "params": {}, "body": { @@ -743,7 +743,7 @@ "JSON_ARRAY": {}, "FORM": { "data": [ - "{\"user_data\":{\"em\":\"48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08\",\"zp\":\"03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4\"},\"event_name\":\"ViewContent\",\"event_time\":1697365011,\"action_source\":\"website\",\"custom_data\":{\"revenue\":400,\"additional_bet_index\":0,\"category\":\"randomCategory\",\"content_ids\":[\"randomCategory\"],\"contents\":[{\"id\":\"randomCategory\",\"quantity\":1}],\"content_type\":\"product_group\",\"content_category\":\"randomCategory\",\"currency\":\"USD\",\"value\":400}}" + "{\"user_data\":{\"em\":\"48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08\",\"zp\":\"03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4\"},\"event_name\":\"ViewContent\",\"event_time\":1699784211,\"action_source\":\"website\",\"custom_data\":{\"revenue\":400,\"additional_bet_index\":0,\"category\":\"randomCategory\",\"content_ids\":[\"randomCategory\"],\"contents\":[{\"id\":\"randomCategory\",\"quantity\":1}],\"content_type\":\"product_group\",\"content_category\":\"randomCategory\",\"currency\":\"USD\",\"value\":400}}" ] } }, @@ -791,7 +791,7 @@ "revenue": 400, "additional_bet_index": 0 }, - "timestamp": "2023-10-15T15:46:51.693229+05:30", + "timestamp": "2023-11-12T15:46:51.693229+05:30", "type": "track" }, "destination": { @@ -831,7 +831,7 @@ "version": "1", "type": "REST", "method": "POST", - "endpoint": "https://graph.facebook.com/v17.0/dummyID/events?access_token=09876", + "endpoint": "https://graph.facebook.com/v18.0/dummyID/events?access_token=09876", "headers": {}, "params": {}, "body": { @@ -840,7 +840,7 @@ "JSON_ARRAY": {}, "FORM": { "data": [ - "{\"user_data\":{\"em\":\"48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08\",\"zp\":\"03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4\"},\"event_name\":\"AddToWishlist\",\"event_time\":1697365011,\"action_source\":\"website\",\"custom_data\":{\"revenue\":400,\"additional_bet_index\":0,\"content_ids\":[],\"contents\":[],\"currency\":\"USD\",\"value\":400}}" + "{\"user_data\":{\"em\":\"48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08\",\"zp\":\"03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4\"},\"event_name\":\"AddToWishlist\",\"event_time\":1699784211,\"action_source\":\"website\",\"custom_data\":{\"revenue\":400,\"additional_bet_index\":0,\"content_ids\":[],\"contents\":[],\"currency\":\"USD\",\"value\":400}}" ] } }, @@ -888,7 +888,7 @@ "revenue": 400, "additional_bet_index": 0 }, - "timestamp": "2023-10-15T15:46:51.693229+05:30", + "timestamp": "2023-11-12T15:46:51.693229+05:30", "type": "track" }, "destination": { @@ -928,7 +928,7 @@ "version": "1", "type": "REST", "method": "POST", - "endpoint": "https://graph.facebook.com/v17.0/dummyID/events?access_token=09876", + "endpoint": "https://graph.facebook.com/v18.0/dummyID/events?access_token=09876", "headers": {}, "params": {}, "body": { @@ -937,7 +937,217 @@ "JSON_ARRAY": {}, "FORM": { "data": [ - "{\"user_data\":{\"em\":\"48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08\",\"zp\":\"03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4\"},\"event_name\":\"AddPaymentInfo\",\"event_time\":1697365011,\"action_source\":\"website\",\"custom_data\":{\"revenue\":400,\"additional_bet_index\":0,\"content_ids\":[],\"contents\":[],\"currency\":\"USD\",\"value\":400}}" + "{\"user_data\":{\"em\":\"48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08\",\"zp\":\"03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4\"},\"event_name\":\"AddPaymentInfo\",\"event_time\":1699784211,\"action_source\":\"website\",\"custom_data\":{\"revenue\":400,\"additional_bet_index\":0,\"content_ids\":[],\"contents\":[],\"currency\":\"USD\",\"value\":400}}" + ] + } + }, + "files": {} + } + }, + { + "description": "Track event with standard event order completed with delivery_category in products array", + "input": { + "message": { + "anonymousId": "c82cbdff-e5be-4009-ac78-cdeea09ab4b1", + "channel": "web", + "context": { + "device": { + "id": "df16bffa-5c3d-4fbb-9bce-3bab098129a7R", + "manufacturer": "Xiaomi", + "model": "Redmi 6", + "name": "xiaomi" + }, + "network": { + "carrier": "Banglalink" + }, + "os": { + "name": "android", + "version": "8.1.0" + }, + "screen": { + "height": "100", + "density": 50 + }, + "traits": { + "email": " aBc@gmail.com ", + "address": { + "zip": 1234 + }, + "anonymousId": "c82cbdff-e5be-4009-ac78-cdeea09ab4b1" + } + }, + "event": "order completed", + "integrations": { + "All": true + }, + "message_id": "a80f82be-9bdc-4a9f-b2a5-15621ee41df8", + "properties": { + "revenue": 400, + "additional_bet_index": 0, + "products": [ + { + "product_id": 1234, + "quantity": 5, + "price": 55, + "delivery_category": "home_delivery" + } + ] + }, + "timestamp": "2023-11-12T15:46:51.693229+05:30", + "type": "track" + }, + "destination": { + "Config": { + "limitedDataUsage": true, + "blacklistPiiProperties": [ + { + "blacklistPiiProperties": "", + "blacklistPiiHash": false + } + ], + "accessToken": "09876", + "datasetId": "dummyID", + "eventsToEvents": [ + { + "from": "", + "to": "" + } + ], + "eventCustomProperties": [ + { + "eventCustomProperties": "" + } + ], + "removeExternalId": true, + "whitelistPiiProperties": [ + { + "whitelistPiiProperties": "" + } + ], + "actionSource": "website" + }, + "Enabled": true + } + }, + "output": { + "version": "1", + "type": "REST", + "method": "POST", + "endpoint": "https://graph.facebook.com/v18.0/dummyID/events?access_token=09876", + "headers": {}, + "params": {}, + "body": { + "JSON": {}, + "XML": {}, + "JSON_ARRAY": {}, + "FORM": { + "data": [ + "{\"user_data\":{\"em\":\"48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08\",\"zp\":\"03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4\"},\"event_name\":\"Purchase\",\"event_time\":1699784211,\"action_source\":\"website\",\"custom_data\":{\"revenue\":400,\"additional_bet_index\":0,\"products\":[{\"product_id\":1234,\"quantity\":5,\"price\":55,\"delivery_category\":\"home_delivery\"}],\"content_ids\":[1234],\"contents\":[{\"id\":1234,\"quantity\":5,\"item_price\":55,\"delivery_category\":\"home_delivery\"}],\"content_type\":\"product\",\"currency\":\"USD\",\"value\":400,\"num_items\":1}}" + ] + } + }, + "files": {} + } + }, + { + "description": "Track event with standard event order completed with delivery_category in properties", + "input": { + "message": { + "anonymousId": "c82cbdff-e5be-4009-ac78-cdeea09ab4b1", + "channel": "web", + "context": { + "device": { + "id": "df16bffa-5c3d-4fbb-9bce-3bab098129a7R", + "manufacturer": "Xiaomi", + "model": "Redmi 6", + "name": "xiaomi" + }, + "network": { + "carrier": "Banglalink" + }, + "os": { + "name": "android", + "version": "8.1.0" + }, + "screen": { + "height": "100", + "density": 50 + }, + "traits": { + "email": " aBc@gmail.com ", + "address": { + "zip": 1234 + }, + "anonymousId": "c82cbdff-e5be-4009-ac78-cdeea09ab4b1" + } + }, + "event": "order completed", + "integrations": { + "All": true + }, + "message_id": "a80f82be-9bdc-4a9f-b2a5-15621ee41df8", + "properties": { + "revenue": 400, + "additional_bet_index": 0, + "delivery_category": "home_delivery", + "products": [ + { + "product_id": 1234, + "quantity": 5, + "price": 55 + } + ] + }, + "timestamp": "2023-11-12T15:46:51.693229+05:30", + "type": "track" + }, + "destination": { + "Config": { + "limitedDataUsage": true, + "blacklistPiiProperties": [ + { + "blacklistPiiProperties": "", + "blacklistPiiHash": false + } + ], + "accessToken": "09876", + "datasetId": "dummyID", + "eventsToEvents": [ + { + "from": "", + "to": "" + } + ], + "eventCustomProperties": [ + { + "eventCustomProperties": "" + } + ], + "removeExternalId": true, + "whitelistPiiProperties": [ + { + "whitelistPiiProperties": "" + } + ], + "actionSource": "website" + }, + "Enabled": true + } + }, + "output": { + "version": "1", + "type": "REST", + "method": "POST", + "endpoint": "https://graph.facebook.com/v18.0/dummyID/events?access_token=09876", + "headers": {}, + "params": {}, + "body": { + "JSON": {}, + "XML": {}, + "JSON_ARRAY": {}, + "FORM": { + "data": [ + "{\"user_data\":{\"em\":\"48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08\",\"zp\":\"03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4\"},\"event_name\":\"Purchase\",\"event_time\":1699784211,\"action_source\":\"website\",\"custom_data\":{\"revenue\":400,\"additional_bet_index\":0,\"delivery_category\":\"home_delivery\",\"products\":[{\"product_id\":1234,\"quantity\":5,\"price\":55}],\"content_ids\":[1234],\"contents\":[{\"id\":1234,\"quantity\":5,\"item_price\":55,\"delivery_category\":\"home_delivery\"}],\"content_type\":\"product\",\"currency\":\"USD\",\"value\":400,\"num_items\":1}}" ] } }, diff --git a/test/__tests__/data/facebook_conversions_router_input.json b/test/__tests__/data/facebook_conversions_router_input.json index 4abe66d3c4..b8865d124e 100644 --- a/test/__tests__/data/facebook_conversions_router_input.json +++ b/test/__tests__/data/facebook_conversions_router_input.json @@ -41,7 +41,7 @@ "revenue": 400, "additional_bet_index": 0 }, - "timestamp": "2023-10-15T15:46:51.693229+05:30", + "timestamp": "2023-11-12T15:46:51.693229+05:30", "type": "track" }, "destination": { @@ -119,7 +119,7 @@ "revenue": 400, "additional_bet_index": 0 }, - "timestamp": "2023-10-15T15:46:51.693229+05:30", + "timestamp": "2023-11-12T15:46:51.693229+05:30", "type": "track" }, "destination": { diff --git a/test/__tests__/data/facebook_conversions_router_output.json b/test/__tests__/data/facebook_conversions_router_output.json index d376a91027..542c173090 100644 --- a/test/__tests__/data/facebook_conversions_router_output.json +++ b/test/__tests__/data/facebook_conversions_router_output.json @@ -4,7 +4,7 @@ "version": "1", "type": "REST", "method": "POST", - "endpoint": "https://graph.facebook.com/v17.0/dummyID/events?access_token=09876", + "endpoint": "https://graph.facebook.com/v18.0/dummyID/events?access_token=09876", "headers": {}, "params": {}, "body": { @@ -13,7 +13,7 @@ "JSON_ARRAY": {}, "FORM": { "data": [ - "{\"user_data\":{\"em\":\"48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08\",\"zp\":\"03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4\"},\"event_name\":\"spin_result\",\"event_time\":1697365011,\"action_source\":\"website\",\"custom_data\":{\"revenue\":400,\"additional_bet_index\":0,\"value\":400,\"currency\":\"USD\"}}" + "{\"user_data\":{\"em\":\"48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08\",\"zp\":\"03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4\"},\"event_name\":\"spin_result\",\"event_time\":1699784211,\"action_source\":\"website\",\"custom_data\":{\"revenue\":400,\"additional_bet_index\":0,\"value\":400,\"currency\":\"USD\"}}" ] } }, @@ -64,7 +64,7 @@ "version": "1", "type": "REST", "method": "POST", - "endpoint": "https://graph.facebook.com/v17.0/dummyID/events?access_token=09876", + "endpoint": "https://graph.facebook.com/v18.0/dummyID/events?access_token=09876", "headers": {}, "params": {}, "body": { @@ -73,7 +73,7 @@ "JSON_ARRAY": {}, "FORM": { "data": [ - "{\"user_data\":{\"em\":\"48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08\",\"zp\":\"03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4\"},\"event_name\":\"Search\",\"event_time\":1697365011,\"action_source\":\"website\",\"custom_data\":{\"revenue\":400,\"additional_bet_index\":0,\"content_ids\":[],\"contents\":[],\"content_type\":\"product\",\"currency\":\"USD\",\"value\":400}}" + "{\"user_data\":{\"em\":\"48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08\",\"zp\":\"03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4\"},\"event_name\":\"Search\",\"event_time\":1699784211,\"action_source\":\"website\",\"custom_data\":{\"revenue\":400,\"additional_bet_index\":0,\"content_ids\":[],\"contents\":[],\"content_type\":\"product\",\"currency\":\"USD\",\"value\":400}}" ] } }, diff --git a/test/__tests__/data/sanity/active_campaign_output.json b/test/__tests__/data/sanity/active_campaign_output.json deleted file mode 100644 index 544f9b937f..0000000000 --- a/test/__tests__/data/sanity/active_campaign_output.json +++ /dev/null @@ -1,54 +0,0 @@ -[ - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://active.campaigns.rudder.com/api/3/contact/sync", - "headers": { - "Content-Type": "application/json", - "Api-Token": "dummyApiToken" - }, - "params": {}, - "body": { - "JSON": { - "contact": { - "email": "manashi@gmail.com", - "phone": 9090909000, - "firstName": null, - "lastName": null - }, - "apiKey": "dummyApiKey" - }, - "XML": {}, - "JSON_ARRAY": {}, - "FORM": {} - }, - "files": {} - }, - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://active.campaigns.rudder.com/api/3/contact/sync", - "headers": { - "Content-Type": "application/json", - "Api-Token": "dummyApiToken" - }, - "params": {}, - "body": { - "JSON": { - "contact": { - "email": "testkolkata@rudderlabs.com", - "phone": "570-690-4150", - "firstName": "Sajal", - "lastName": "Mohanta" - }, - "apiKey": "dummyApiKey" - }, - "XML": {}, - "JSON_ARRAY": {}, - "FORM": {} - }, - "files": {} - } -] diff --git a/test/__tests__/data/sanity/destination_config.json b/test/__tests__/data/sanity/destination_config.json deleted file mode 100644 index 1655eb2d66..0000000000 --- a/test/__tests__/data/sanity/destination_config.json +++ /dev/null @@ -1,154 +0,0 @@ -{ - "active_campaign": { - "config": { - "processor": { - "Config": { - "apiKey": "dummyApiKey", - "apiUrl": "https://active.campaigns.rudder.com", - "actid": "476550467", - "eventKey": "f8a866fddc721350fdc2fbbd2e5c43a6dddaaa03" - } - } - } - }, - "clevertap": { - "config": { - "processor": {}, - "router": {} - } - }, - "marketo": { - "config": { - "router": { - "Config": { - "accountId": "marketo_acct_id_success", - "clientId": "marketo_client_id_success", - "clientSecret": "marketo_client_secret_success", - "trackAnonymousEvents": true, - "customActivityPropertyMap": [ - { - "from": "name", - "to": "productName" - } - ], - "leadTraitMapping": [ - { - "from": "leadScore", - "to": "customLeadScore" - } - ], - "rudderEventsMapping": [ - { - "event": "Product Clicked", - "marketoPrimarykey": "name", - "marketoActivityId": "100001" - } - ] - }, - "secretConfig": {}, - "ID": "1mMy5cqbtfuaKZv1IhVQKnBdVwe", - "name": "Marketo", - "enabled": true, - "workspaceId": "1TSN08muJTZwH8iCDmnnRt1pmLd", - "deleted": false, - "createdAt": "2020-12-30T08:39:32.005Z", - "updatedAt": "2021-02-03T16:22:31.374Z", - "destinationDefinition": { - "config": { - "destConfig": { - "defaultConfig": [ - "accountId", - "clientId", - "clientSecret", - "trackAnonymousEvents", - "customActivityPropertyMap", - "rudderEventsMapping", - "leadTraitMapping" - ] - }, - "secretKeys": [ - "clientSecret" - ], - "excludeKeys": [], - "includeKeys": [], - "routerTransform": true, - "supportedSourceTypes": [ - "android", - "ios", - "web", - "unity", - "amp", - "cloud", - "reactnative" - ] - }, - "responseRules": { - "responseType": "JSON", - "rules": { - "retryable": [ - { - "success": "false", - "errors.0.code": 600 - }, - { - "success": "false", - "errors.0.code": 601 - }, - { - "success": "false", - "errors.0.code": 602 - }, - { - "success": "false", - "errors.0.code": 604 - }, - { - "success": "false", - "errors.0.code": 606 - }, - { - "success": "false", - "errors.0.code": 607 - }, - { - "success": "false", - "errors.0.code": 608 - }, - { - "success": "false", - "errors.0.code": 611 - } - ], - "abortable": [ - { - "success": "false", - "errors.0.code": 603 - }, - { - "success": "false", - "errors.0.code": 605 - }, - { - "success": "false", - "errors.0.code": 609 - }, - { - "success": "false", - "errors.0.code": 610 - } - ] - } - }, - "id": "1aIXqM806xAVm92nx07YwKbRrO9", - "name": "MARKETO", - "displayName": "Marketo", - "createdAt": "2020-04-09T09:24:31.794Z", - "updatedAt": "2021-01-11T11:03:28.103Z" - }, - "transformations": [], - "isConnectionEnabled": true, - "isProcessorEnabled": true - } - } - } -} diff --git a/test/__tests__/data/sanity/marketo_router_output.json b/test/__tests__/data/sanity/marketo_router_output.json deleted file mode 100644 index fbc395344a..0000000000 --- a/test/__tests__/data/sanity/marketo_router_output.json +++ /dev/null @@ -1,169 +0,0 @@ -[ - { - "batchedRequest": { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://marketo_acct_id_success.mktorest.com/rest/v1/activities/external.json", - "headers": { - "Authorization": "Bearer access_token_success", - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "input": [ - { - "activityDate": "2020-12-17T21:00:59.176Z", - "activityTypeId": 100001, - "attributes": [], - "leadId": 4, - "primaryAttributeValue": "Test Product" - } - ] - }, - "XML": {}, - "JSON_ARRAY": {}, - "FORM": {} - }, - "files": {} - }, - "metadata": [ - { - "jobId": 1 - } - ], - "batched": false, - "statusCode": 200, - "destination": { - "Config": { - "accountId": "marketo_acct_id_success", - "clientId": "marketo_client_id_success", - "clientSecret": "marketo_client_secret_success", - "trackAnonymousEvents": true, - "customActivityPropertyMap": [ - { - "from": "name", - "to": "productName" - } - ], - "rudderEventsMapping": [ - { - "event": "Product Clicked", - "marketoPrimarykey": "name", - "marketoActivityId": "100001" - } - ], - "leadTraitMapping": [ - { - "from": "leadScore", - "to": "customLeadScore" - } - ] - }, - "secretConfig": {}, - "ID": "1mMy5cqbtfuaKZv1IhVQKnBdVwe", - "name": "Marketo", - "enabled": true, - "workspaceId": "1TSN08muJTZwH8iCDmnnRt1pmLd", - "deleted": false, - "createdAt": "2020-12-30T08:39:32.005Z", - "updatedAt": "2021-02-03T16:22:31.374Z", - "destinationDefinition": { - "config": { - "destConfig": { - "defaultConfig": [ - "accountId", - "clientId", - "clientSecret", - "trackAnonymousEvents", - "customActivityPropertyMap", - "rudderEventsMapping", - "leadTraitMapping" - ] - }, - "secretKeys": [ - "clientSecret" - ], - "excludeKeys": [], - "includeKeys": [], - "routerTransform": true, - "supportedSourceTypes": [ - "android", - "ios", - "web", - "unity", - "amp", - "cloud", - "reactnative" - ] - }, - "responseRules": { - "responseType": "JSON", - "rules": { - "retryable": [ - { - "success": "false", - "errors.0.code": 600 - }, - { - "success": "false", - "errors.0.code": 601 - }, - { - "success": "false", - "errors.0.code": 602 - }, - { - "success": "false", - "errors.0.code": 604 - }, - { - "success": "false", - "errors.0.code": 606 - }, - { - "success": "false", - "errors.0.code": 607 - }, - { - "success": "false", - "errors.0.code": 608 - }, - { - "success": "false", - "errors.0.code": 611 - } - ], - "abortable": [ - { - "success": "false", - "errors.0.code": 603 - }, - { - "success": "false", - "errors.0.code": 605 - }, - { - "success": "false", - "errors.0.code": 609 - }, - { - "success": "false", - "errors.0.code": 610 - } - ] - } - }, - "id": "1aIXqM806xAVm92nx07YwKbRrO9", - "name": "MARKETO", - "displayName": "Marketo", - "createdAt": "2020-04-09T09:24:31.794Z", - "updatedAt": "2021-01-11T11:03:28.103Z" - }, - "transformations": [], - "isConnectionEnabled": true, - "isProcessorEnabled": true - } - } -] \ No newline at end of file diff --git a/test/__tests__/data/sanity/sanity_input.json b/test/__tests__/data/sanity/sanity_input.json deleted file mode 100644 index 9dd9961160..0000000000 --- a/test/__tests__/data/sanity/sanity_input.json +++ /dev/null @@ -1,185 +0,0 @@ -{ - "messages": [ - { - "type": "identify", - "event": "identify", - "sentAt": "2021-02-08T12:45:42.760Z", - "userId": "User_111", - "channel": "mobile", - "context": { - "os": { - "name": "iOS", - "version": "13.0" - }, - "app": { - "name": "MyApp", - "build": "1", - "version": "1.0", - "namespace": "com.rudderlabs.MyApp" - }, - "device": { - "id": "e2b94e2d-8327-429c-9d91-792a80d189c8", - "name": "iPhone 11 Pro Max", - "type": "iOS", - "model": "iPhone", - "manufacturer": "Apple" - }, - "locale": "en-US", - "screen": { - "width": 896, - "height": 414, - "density": 3 - }, - "traits": { - "age": 24, - "city": "Bangalore", - "name": "Manashi Mazumder", - "email": "manashi@gmail.com", - "phone": 9090909000, - "userId": "User_111", - "anonymousId": "e2b94e2d-8327-429c-9d91-792a80d189c8" - }, - "library": { - "name": "rudder-ios-library", - "version": "1.0.11" - }, - "network": { - "wifi": true, - "carrier": "unavailable", - "cellular": false, - "bluetooth": false - }, - "timezone": "Asia/Kolkata", - "userAgent": "unknown" - }, - "rudderId": "139d65bb-8a40-48c7-854c-06bbf44f686e", - "messageId": "1612788330-7e1e60a8-fb7e-437d-81c1-5b000318d0cb", - "anonymousId": "e2b94e2d-8327-429c-9d91-792a80d189c8", - "integrations": { - "All": true - }, - "originalTimestamp": "2021-02-08T12:45:30.717Z" - }, - { - "type": "identify", - "sentAt": "2021-04-15T19:43:53.393Z", - "userId": "sajal1234", - "channel": "web", - "context": { - "id": "ID101", - "ip": "0.0.0.0", - "os": { - "name": "", - "version": "" - }, - "app": { - "name": "RudderLabs JavaScript SDK", - "build": "1.0.0", - "version": "1.1.17", - "namespace": "com.rudderlabs.javascript" - }, - "page": { - "url": "www.rudderstack.com", - "path": "/path5", - "title": "JS Test", - "search": "My Page", - "tab_url": "https://odd-rat-19.loca.lt/Rectified.html", - "referrer": "www.google.com", - "initial_referrer": "$direct", - "referring_domain": "", - "initial_referring_domain": "" - }, - "event": "Sample Identify call", - "locale": "en-US", - "screen": { - "density": 2.75 - }, - "traits": { - "id": "ID101", - "city": "east greenwich", - "plan": "Open source", - "tags": ["x0002x", "y0004y", "t0001t"], - "email": "testkolkata@rudderlabs.com", - "event": "Sample Identify call", - "lists": [ - { - "id": 2, - "status": "unsubscribed" - }, - { - "id": 3, - "status": "unsubscribe" - } - ], - "phone": "570-690-4150", - "state": "RI", - "title": "Mr", - "logins": 5, - "mobile": "123456786", - "rating": "Hot", - "street": "19123 forest lane", - "company": { - "id": 378763009439, - "name": "Rudderlabs", - "industry": "IT", - "employee_count": 1200 - }, - "country": "USA", - "sent_at": "20210109134567", - "birthDay": "2021/04/15", - "category": "SampleIdentify", - "industry": "ITES", - "lastName": "Mohanta", - "timezone": "Berlin", - "Homephone": 9836543283, - "createdAt": "2021/04/15", - "fieldInfo": { - "state": "California", - "Address": "kolkata", - "listBox": ["Option1", "Option2"], - "CheckBox": ["Option1", "Option2", "Option3"], - "TextArea": "This is a sample text area field value . it is tested for Active Campaign. It should have more than 100 words. Lorem ipsum is a dummy sentence to fill up any area. And also , it is used to fill up dummy website. So, it is wriiten by simply wasting time. ", - "DateField": "1988-12-05", - "HiddenField": "Hidden", - "RadioButton": "Option1", - "multiChoice": "Option 1", - "DateTimeField": "2020-05-19T02:45:00-05:00" - }, - "firstName": "Sajal", - "isEnabled": true, - "timestamp": "1403743443", - "event_text": "identify", - "leadSource": "WEB", - "postalCode": "94115", - "received_at": "202101091347654", - "organizationId": 378763009439, - "original_timestamp": "1403743443" - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.1.17" - }, - "sent_at": "20210109134567", - "campaign": {}, - "timestamp": "1403743443", - "userAgent": "Mozilla/5.0 (Linux; Android 11; sdk_gphone_x86_arm Build/RSR1.201013.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/83.0.4103.106 Mobile Safari/537.36", - "event_text": "identify", - "externalId": [ - { - "id": "0035g000002XN5MAAW", - "type": "Salesforce-Contact" - } - ], - "received_at": "202101091347654", - "original_timestamp": "1403743443" - }, - "rudderId": "bc2402b7-6796-4fa5-9beb-bad3761fc961", - "messageId": "9d0df235-d354-4a81-8056-07dcb58081d7", - "anonymousId": "anonIDfromAndroid", - "integrations": { - "All": true - }, - "originalTimestamp": "2021-04-15T19:43:53.392Z" - } - ] -} diff --git a/test/__tests__/data/sanity/sanity_router_input.json b/test/__tests__/data/sanity/sanity_router_input.json deleted file mode 100644 index 16b8ccffad..0000000000 --- a/test/__tests__/data/sanity/sanity_router_input.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "messages": [ - { - "anonymousId": "anon_id_success", - "channel": "mobile", - "context": { - "app": { - "build": "1", - "name": "TestAppName", - "namespace": "com.android.sample", - "version": "1.0" - }, - "device": { - "id": "anon_id_success", - "manufacturer": "Google", - "model": "Android SDK built for x86", - "name": "generic_x86", - "type": "android" - }, - "library": { - "name": "com.rudderstack.android.sdk.core", - "version": "1.0.1-beta.1" - }, - "locale": "en-US", - "network": { - "carrier": "Android", - "bluetooth": false, - "cellular": true, - "wifi": true - }, - "os": { - "name": "Android", - "version": "8.1.0" - }, - "screen": { - "density": 420, - "height": 1794, - "width": 1080 - }, - "timezone": "Asia/Kolkata", - "traits": { - "anonymousId": "anon_id_success" - }, - "userAgent": "Dalvik/2.1.0 (Linux; U; Android 8.1.0; Android SDK built for x86 Build/OSM1.180201.007)" - }, - "event": "Product Clicked", - "integrations": { - "All": true - }, - "messageId": "id1", - "properties": { - "name": "Test Product" - }, - "originalTimestamp": "2020-12-17T21:00:59.176Z", - "type": "track", - "sentAt": "2020-03-12T09:05:03.421Z" - } - ] -} diff --git a/test/__tests__/data/sfmc_output.json b/test/__tests__/data/sfmc_output.json index 0271475e4a..aaaf23aea8 100644 --- a/test/__tests__/data/sfmc_output.json +++ b/test/__tests__/data/sfmc_output.json @@ -1,6 +1,6 @@ [ { - "error": "Creating or updating contacts is disabled" + "error": "Creating or updating contacts is disabled. To enable this feature set \"Do Not Create or Update Contacts\" to false" }, [ { diff --git a/test/__tests__/data/sfmc_router_output.json b/test/__tests__/data/sfmc_router_output.json index d207b792ee..beb90b5e13 100644 --- a/test/__tests__/data/sfmc_router_output.json +++ b/test/__tests__/data/sfmc_router_output.json @@ -37,7 +37,7 @@ }, "batched": false, "statusCode": 400, - "error": "Creating or updating contacts is disabled", + "error": "Creating or updating contacts is disabled. To enable this feature set \"Do Not Create or Update Contacts\" to false", "statTags": { "errorCategory": "dataValidation", "errorType": "configuration" diff --git a/test/__tests__/facebook_conversions.js b/test/__tests__/facebook_conversions.test.js similarity index 93% rename from test/__tests__/facebook_conversions.js rename to test/__tests__/facebook_conversions.test.js index a450952efe..5bb905b5c8 100644 --- a/test/__tests__/facebook_conversions.js +++ b/test/__tests__/facebook_conversions.test.js @@ -23,6 +23,8 @@ const outputRouterDataFile = fs.readFileSync( const inputRouterData = JSON.parse(inputRouterDataFile); const expectedRouterData = JSON.parse(outputRouterDataFile); +Date.now = jest.fn(() => new Date("2023-11-12T15:46:51.000Z")); // 2023-11-12T15:46:51.693229+05:30 + describe(`${name} Tests`, () => { describe("Processor", () => { testData.forEach((dataPoint, index) => { @@ -36,7 +38,7 @@ describe(`${name} Tests`, () => { }); }); }); - + describe("Router Tests", () => { it("Payload", async () => { const routerOutput = await transformer.processRouterDest(inputRouterData); diff --git a/test/__tests__/legacyRouter.test.ts b/test/__tests__/legacyRouter.test.ts index 768db08ca8..926f6e76d4 100644 --- a/test/__tests__/legacyRouter.test.ts +++ b/test/__tests__/legacyRouter.test.ts @@ -1,6 +1,6 @@ import fs from 'fs'; import path from 'path'; -import DestinationController from '../../src/controllers/destination'; +import { DestinationController } from '../../src/controllers/destination'; const destArg = process.argv.filter((x) => x.startsWith('--destName='))[0]; // send arguments on which destination const typeArg = process.argv.filter((x) => x.startsWith('--type='))[0]; // send argument on which function diff --git a/test/__tests__/sanity.test.js b/test/__tests__/sanity.test.js deleted file mode 100644 index ae5faa917c..0000000000 --- a/test/__tests__/sanity.test.js +++ /dev/null @@ -1,204 +0,0 @@ -jest.mock("axios"); -const name = "Sanity"; -const fs = require("fs"); -const path = require("path"); -const version = "v0"; -const { getDirectories } = require("./util"); -const { mockaxios } = require("../__mocks__/network"); - -// ******************************** -// Getting Started -// ******************************** -// sanity-folder-structure -// __tests__ -// | -// |--sanity.test.js -// |--data -// | | -// | |--sanity -// | | -// | {integration(s)}_output.json -// | {integration(s)}_router_output.json -// | sanity_input.json -// | sanity_router_input.json -// | destination_config.json - -// ------ destination_config.json ------ -// JSON to store the destination-config of all the destinations -// Each destination-config object has a config object storing the -// processor/ router (transform-at) configs -// ------------------------------------- -// If transformation is only done at processor -// only use the processor as key and store the -// destination definition as value. -// -// Format : -// { -// "clevertap": { -// "config": { -// "processor": { ...destination_definition }, -// "router": { ...destination_definition } -// } -// } -// .. -// .. -// } - -// ----- sanity_input.json ----- -// JSON to store the sanity input messages which will be -// used to test sanity for all the destination. -// -// Format: -// { -// "messages": [ -// { sanity_input_message_1}, -// { sanity_input_message_2}, -// { sanity_input_message_3} -// ... -// ] -// } - -// ----- sanity_router_input.json ----- -// JSON to store the sanity input messages which will be -// used to test sanity for all the destination. -// These inputs will be used for testing router -// transformation for all destination which support it. -// -// Format: -// { -// "messages": [ -// { router_sanity_input_message_1}, -// { router_sanity_input_message_2}, -// { router_sanity_input_message_3} -// ... -// ] -// } - -// ------ {integration(s)}_output.json ------ -// These are specific output for each of the destinations -// given the sanity input. We are using jest result matcher -// to check if the output is matching with the expected output. -// Example clevertap_output.json -// Format: -// [ -// {sanity_output_for_message_1}, -// {sanity_output_for_message_2}, -// .. -// ] - -// ------ {integration(s)}_router_output.json ------ -// These are specific output for each of the destinations -// given the router sanity input. -// ** CHECK IF THE PARTICULAR DESTINATION SUPPORTS ROUTER TRANSFORMATION ** -// Example clevertap_router_output.json -// Format: -// [ -// {router_sanity_output_for_message_1}, -// {router_sanity_output_for_message_2}, -// .. -// ] - -// Parsing all the destination names from /v0/destinations dir structure -// parsing it into an array of string. This keeping the destinations to test -// dynamic. -// const integrations = getDirectories( -// path.resolve(__dirname, `../${version}/destinations/`) -// ); -// For Testing Current: -// Uncomment this Line and comment the above 3 lines -const integrations = ["marketo"]; - -// Parsing the sanity input JSON which will be used for testing each destination -const processorSanityInput = JSON.parse( - fs.readFileSync(path.resolve(__dirname, `./data/sanity/sanity_input.json`)) -); - -// Parsing the sanity router input JSON which will be used for testing each destination -// which support it -const routerSanityInputRouter = JSON.parse( - fs.readFileSync( - path.resolve(__dirname, `./data/sanity/sanity_router_input.json`) - ) -); -// Parsing the destination config JSON from which we will get the destination definitions -// along with if the destination supports router-transformation -const destinationConfig = JSON.parse( - fs.readFileSync( - path.resolve(__dirname, `./data/sanity/destination_config.json`) - ) -); - -// Iterating each of the destinations -integrations.forEach(intg => { - // Getting the transformation object - const transformer = require(`../../src/${version}/destinations/${intg}/transform`); - // Getting the config for this particular destination - const { config } = destinationConfig[`${intg}`]; - // Where the ransformation is done at (processor, router ..) - Object.keys(config).forEach(processAt => { - // Depending on the case - switch (processAt) { - case "processor": - { - // Parsing the expected data for this particular destination - const expectedData = JSON.parse( - fs.readFileSync( - path.resolve(__dirname, `./data/sanity/${intg}_output.json`) - ) - ); - // For each of the messages we are processing using the transformer - processorSanityInput.messages.forEach((message, index) => { - // Building the event object with specified destination-definition - const event = { - message, - destination: config[`${processAt}`] - }; - // Sending the event to transformer and matching the result with expected output - it(`${name} - integration[Processor]: ${intg} payload:${index}`, async () => { - try { - const output = await transformer.process(event); - expect(output).toEqual(expectedData[index]); - } catch (error) { - expect(error.message).toEqual(expectedData[index].error); - } - }); - }); - } - break; - - case "router": - { - // Parsing the expected router output data for this particular destination - const expectedData = JSON.parse( - fs.readFileSync( - path.resolve( - __dirname, - `./data/sanity/${intg}_router_output.json` - ) - ) - ); - // For each of the messages we are processing using the router transformer - routerSanityInputRouter.messages.forEach((message, index) => { - // Building the event object with specified destination-definition - const events = [ - { - message, - metadata: { - jobId: 1 - }, - destination: config[`${processAt}`] - } - ]; - // Sending the event to router transformer of this destinationand matching the result with expected output - it(`${name} - integration(Router): ${intg} payload:${index}`, async () => { - const routerOutput = await transformer.processRouterDest(events); - expect(routerOutput[0]).toEqual(expectedData[index]); - }); - }); - } - break; - default: - throw new Error("Undefined Transform-At Config"); - } - }); -}); diff --git a/test/__tests__/user_transformation_ts.test.ts b/test/__tests__/user_transformation_ts.test.ts index 418c42fe33..971476e513 100644 --- a/test/__tests__/user_transformation_ts.test.ts +++ b/test/__tests__/user_transformation_ts.test.ts @@ -1,5 +1,5 @@ import fetch from 'node-fetch'; -import UserTransformService from '../../src/services/userTransform'; +import { UserTransformService } from '../../src/services/userTransform'; import { FeatureFlags, FEATURE_FILTER_CODE } from '../../src/middlewares/featureFlag'; jest.mock('node-fetch', () => jest.fn()); diff --git a/test/apitests/data_scenarios/cdk_v2/failure.json b/test/apitests/data_scenarios/cdk_v2/failure.json index f39d351b2d..1635a3f0db 100644 --- a/test/apitests/data_scenarios/cdk_v2/failure.json +++ b/test/apitests/data_scenarios/cdk_v2/failure.json @@ -646,7 +646,8 @@ "statusCode": 400, "error": "Action source must be one of app_android, app_ios, web, offline: Workflow: procWorkflow, Step: validateCommonFields, ChildStep: undefined, OriginalError: Action source must be one of app_android, app_ios, web, offline", "statTags": { - "errorCategory": "platform", + "errorCategory": "dataValidation", + "errorType": "instrumentation", "implementation": "cdkV2", "destType": "PINTEREST_TAG", "module": "destination", diff --git a/test/apitests/data_scenarios/source/failure.json b/test/apitests/data_scenarios/source/v0/failure.json similarity index 100% rename from test/apitests/data_scenarios/source/failure.json rename to test/apitests/data_scenarios/source/v0/failure.json diff --git a/test/apitests/data_scenarios/source/response_to_caller.json b/test/apitests/data_scenarios/source/v0/response_to_caller.json similarity index 100% rename from test/apitests/data_scenarios/source/response_to_caller.json rename to test/apitests/data_scenarios/source/v0/response_to_caller.json diff --git a/test/apitests/data_scenarios/source/successful.json b/test/apitests/data_scenarios/source/v0/successful.json similarity index 100% rename from test/apitests/data_scenarios/source/successful.json rename to test/apitests/data_scenarios/source/v0/successful.json diff --git a/test/apitests/data_scenarios/source/v1/failure.json b/test/apitests/data_scenarios/source/v1/failure.json new file mode 100644 index 0000000000..9bf77f9b53 --- /dev/null +++ b/test/apitests/data_scenarios/source/v1/failure.json @@ -0,0 +1,27 @@ +{ + "input": [ + { + "event": { + "anonymousId": "63767499ca6fb1b7c988d5bb", + "artist": "Gautam", + "genre": "Jazz", + "song": "Take Five" + }, + "source": { + "id": "source_id", + "config": { + "configField1": "configVal1" + } + } + } + ], + "output": [ + { + "statusCode": 500, + "error": "Cannot find module '../undefined/sources/NA_SOURCE/transform' from 'src/services/misc.ts'", + "statTags": { + "errorCategory": "transformation" + } + } + ] +} diff --git a/test/apitests/data_scenarios/source/v1/pipedream.json b/test/apitests/data_scenarios/source/v1/pipedream.json new file mode 100644 index 0000000000..1496471066 --- /dev/null +++ b/test/apitests/data_scenarios/source/v1/pipedream.json @@ -0,0 +1,49 @@ +{ + "input": [ + { + "event": { + "anonymousId": "63767499ca6fb1b7c988d5bb", + "artist": "Gautam", + "genre": "Jazz", + "song": "Take Five" + }, + "source": { + "id": "source_id", + "config": { + "configField1": "configVal1" + } + } + } + ], + "output": [ + { + "output": { + "batch": [ + { + "event": "pipedream_source_event", + "anonymousId": "63767499ca6fb1b7c988d5bb", + "context": { + "integration": { + "name": "PIPEDREAM" + }, + "library": { + "name": "unknown", + "version": "unknown" + } + }, + "integrations": { + "PIPEDREAM": false + }, + "type": "track", + "properties": { + "anonymousId": "63767499ca6fb1b7c988d5bb", + "artist": "Gautam", + "genre": "Jazz", + "song": "Take Five" + } + } + ] + } + } + ] +} diff --git a/test/apitests/data_scenarios/source/v1/successful.json b/test/apitests/data_scenarios/source/v1/successful.json new file mode 100644 index 0000000000..c42d723800 --- /dev/null +++ b/test/apitests/data_scenarios/source/v1/successful.json @@ -0,0 +1,38 @@ +{ + "input": [ + { + "event": { + "event": "Fulfillments Update", + "data": { + "fulfillment_id": "1234567890", + "status": "pending" + } + }, + "source": { + "id": "source_id", + "config": { + "configField1": "configVal1" + } + } + } + ], + "output": [ + { + "output": { + "batch": [ + { + "type": "track", + "event": "webhook_source_event", + "properties": { + "event": "Fulfillments Update", + "data": { + "fulfillment_id": "1234567890", + "status": "pending" + } + } + } + ] + } + } + ] +} diff --git a/test/apitests/service.api.test.ts b/test/apitests/service.api.test.ts index dfe7e10dd6..ee534d7b37 100644 --- a/test/apitests/service.api.test.ts +++ b/test/apitests/service.api.test.ts @@ -177,7 +177,7 @@ describe('Destination api tests', () => { describe('Source api tests', () => { test('(shopify) successful source transform', async () => { - const data = getDataFromPath('./data_scenarios/source/successful.json'); + const data = getDataFromPath('./data_scenarios/source/v0/successful.json'); const response = await request(server) .post('/v0/sources/shopify') .set('Accept', 'application/json') @@ -189,7 +189,7 @@ describe('Source api tests', () => { }); test('(shopify) failure source transform (shopify)', async () => { - const data = getDataFromPath('./data_scenarios/source/failure.json'); + const data = getDataFromPath('./data_scenarios/source/v0/failure.json'); const response = await request(server) .post('/v0/sources/shopify') .set('Accept', 'application/json') @@ -199,7 +199,7 @@ describe('Source api tests', () => { }); test('(shopify) success source transform (monday)', async () => { - const data = getDataFromPath('./data_scenarios/source/response_to_caller.json'); + const data = getDataFromPath('./data_scenarios/source/v0/response_to_caller.json'); const response = await request(server) .post('/v0/sources/monday') .set('Accept', 'application/json') @@ -207,6 +207,38 @@ describe('Source api tests', () => { expect(response.status).toEqual(200); expect(JSON.parse(response.text)).toEqual(data.output); }); + + test('(webhook) successful source transform for source present in v1 and server providing v0 endpoint', async () => { + const data = getDataFromPath('./data_scenarios/source/v1/successful.json'); + const response = await request(server) + .post('/v1/sources/webhook') + .set('Accept', 'application/json') + .send(data.input); + const parsedResp = JSON.parse(response.text); + delete parsedResp[0].output.batch[0].anonymousId; + expect(response.status).toEqual(200); + expect(parsedResp).toEqual(data.output); + }); + + test('(NA_SOURCE) failure source transform ', async () => { + const data = getDataFromPath('./data_scenarios/source/v1/failure.json'); + const response = await request(server) + .post('/v0/sources/NA_SOURCE') + .set('Accept', 'application/json') + .send(data.input); + expect(response.status).toEqual(200); + expect(JSON.parse(response.text)).toEqual(data.output); + }); + + test('(pipedream) success source transform for source present in v0 and server providing v1 endpoint', async () => { + const data = getDataFromPath('./data_scenarios/source/v1/pipedream.json'); + const response = await request(server) + .post('/v1/sources/pipedream') + .set('Accept', 'application/json') + .send(data.input); + expect(response.status).toEqual(200); + expect(JSON.parse(response.text)).toEqual(data.output); + }); }); describe('CDK V1 api tests', () => { diff --git a/test/controllerUtility/ctrl-utility.test.ts b/test/controllerUtility/ctrl-utility.test.ts index c3a668d7e7..bf9eef1846 100644 --- a/test/controllerUtility/ctrl-utility.test.ts +++ b/test/controllerUtility/ctrl-utility.test.ts @@ -1,5 +1,5 @@ import { ProcessorTransformationRequest, RouterTransformationRequestData } from '../../src/types'; -import ControllerUtility from '../../src/controllers/util'; +import { ControllerUtility } from '../../src/controllers/util'; type timestampTestCases = { caseName: string; diff --git a/test/integrations/destinations/adobe_analytics/processor/data.ts b/test/integrations/destinations/adobe_analytics/processor/data.ts index 378523ac3c..690639c057 100644 --- a/test/integrations/destinations/adobe_analytics/processor/data.ts +++ b/test/integrations/destinations/adobe_analytics/processor/data.ts @@ -1,7 +1,7 @@ export const data = [ { name: 'adobe_analytics', - description: 'Test 0', + description: 'Test 0: [ECom]: Product Viewed', feature: 'processor', module: 'destination', version: 'v0', @@ -31,7 +31,7 @@ export const data = [ referring_domain: 'google.com', search: 'estore bestseller', title: 'The best sellers offered by EStore', - url: 'https://www.estore.com/best-seller/1', + url: 'https://www.estore.com/best-seller/News & Sports?ik=123&ij=456', name: 'Best Seller', }, screen: { @@ -61,7 +61,7 @@ export const data = [ coupon: 'DISC21', currency: 'USD', position: 1, - url: 'https://www.website.com/product/path', + url: 'https://www.website.com/product/path?ik=123&ij=456', image_url: 'https://www.website.com/product/path.png', currencyMerch: 25, addressMerch: 'Delhi', @@ -170,7 +170,7 @@ export const data = [ JSON_ARRAY: {}, XML: { payload: - '17941080sales campaignwebUSD127.0.0.1en-USDalvik/2.1.0 (Linux; U; Android 9; Android SDK built for x86 Build/PSR1.180720.075)https://www.google.com/search?q=estore+bestsellert01t02roottval001Kolkata9935400932RudderLabs JavaScript SDKr15,faze90Rciaz,hummer,tharhttps://www.estore.com/best-seller/1Best Sellercustompropval1custompropval22020-01-09T10:01:53.558Zmktcloudid001prodViewGames;Game;11;148.39footlockerrudderstackpoc', + '17941080sales campaignwebUSD127.0.0.1en-USDalvik/2.1.0 (Linux; U; Android 9; Android SDK built for x86 Build/PSR1.180720.075)https://www.google.com/search?q=estore+bestsellert01t02roottval001Kolkata9935400932RudderLabs JavaScript SDKr15,faze90Rciaz,hummer,tharhttps://www.estore.com/best-seller/News%20&%20Sports?ik=123&ij=456Best Sellercustompropval1custompropval22020-01-09T10:01:53.558Zmktcloudid001prodViewGames;Game;11;148.39footlockerrudderstackpoc', }, FORM: {}, }, @@ -185,7 +185,7 @@ export const data = [ }, { name: 'adobe_analytics', - description: 'Test 1', + description: 'Test 1: [ECom]: Product Added', feature: 'processor', module: 'destination', version: 'v0', @@ -356,7 +356,7 @@ export const data = [ }, { name: 'adobe_analytics', - description: 'Test 2', + description: 'Test 2: [ECom]: Product Removed', feature: 'processor', module: 'destination', version: 'v0', @@ -527,7 +527,7 @@ export const data = [ }, { name: 'adobe_analytics', - description: 'Test 3', + description: 'Test 3: [ECom]: Cart Viewed', feature: 'processor', module: 'destination', version: 'v0', @@ -708,7 +708,7 @@ export const data = [ }, { name: 'adobe_analytics', - description: 'Test 4', + description: 'Test 4: [ECom]: Checkout started', feature: 'processor', module: 'destination', version: 'v0', @@ -896,7 +896,7 @@ export const data = [ }, { name: 'adobe_analytics', - description: 'Test 5', + description: 'Test 5: [ECom]: Order Completed', feature: 'processor', module: 'destination', version: 'v0', @@ -1085,7 +1085,7 @@ export const data = [ }, { name: 'adobe_analytics', - description: 'Test 6', + description: 'Test 6: Cart Opened', feature: 'processor', module: 'destination', version: 'v0', @@ -1265,7 +1265,7 @@ export const data = [ }, { name: 'adobe_analytics', - description: 'Test 7', + description: 'Test 7: [Custom] Watched Video', feature: 'processor', module: 'destination', version: 'v0', @@ -1285,7 +1285,7 @@ export const data = [ term: 'event data', content: 'Make sense of the modern data stack', }, - library: { name: 'RudderLabs JavaScript SDK', version: '2.9.1' }, + library: { name: 'RudderLabs JavaScript SDK ', version: '2.9.1' }, locale: 'en-US', page: { path: '/best-seller/1', @@ -1311,7 +1311,7 @@ export const data = [ traits: { roott01: 'roottval001' }, event: 'Watched Video', integrations: { All: true }, - properties: { plan: 'growth', video: 'TEDxGROWTH' }, + properties: { plan: 'growth', video: 'TEDxGROWTH&MARKETING' }, originalTimestamp: '2020-01-09T10:01:53.558Z', type: 'track', sentAt: '2020-01-09T10:02:03.257Z', @@ -1412,7 +1412,7 @@ export const data = [ JSON_ARRAY: {}, XML: { payload: - '17941080sales campaignweb127.0.0.1en-USDalvik/2.1.0 (Linux; U; Android 9; Android SDK built for x86 Build/PSR1.180720.075)https://www.google.com/search?q=estore+bestsellerroottval001RudderLabs JavaScript SDKTEDxGROWTHoWatched Videohttps://www.estore.com/best-seller/1growth2020-01-09T10:01:53.558Zmktcloudid001event1footlockerrudderstackpoc', + '17941080sales campaignweb127.0.0.1en-USDalvik/2.1.0 (Linux; U; Android 9; Android SDK built for x86 Build/PSR1.180720.075)https://www.google.com/search?q=estore+bestsellerroottval001RudderLabs JavaScript SDK <Custom>TEDxGROWTH&MARKETINGoWatched Videohttps://www.estore.com/best-seller/1growth2020-01-09T10:01:53.558Zmktcloudid001event1footlockerrudderstackpoc', }, FORM: {}, }, @@ -1427,7 +1427,7 @@ export const data = [ }, { name: 'adobe_analytics', - description: 'Test 8', + description: 'Test 8: Common Page Call', feature: 'processor', module: 'destination', version: 'v0', @@ -1597,7 +1597,7 @@ export const data = [ }, { name: 'adobe_analytics', - description: 'Test 9', + description: 'Test 9: Currency test event', feature: 'processor', module: 'destination', version: 'v0', @@ -1789,7 +1789,7 @@ export const data = [ }, { name: 'adobe_analytics', - description: 'Test 10', + description: 'Test 10: Override feature test', feature: 'processor', module: 'destination', version: 'v0', @@ -1988,7 +1988,7 @@ export const data = [ }, { name: 'adobe_analytics', - description: 'Test 11', + description: 'Test 11: Override hiers test', feature: 'processor', module: 'destination', version: 'v0', @@ -2188,7 +2188,7 @@ export const data = [ }, { name: 'adobe_analytics', - description: 'Test 12', + description: 'Test 12: product level eVaR', feature: 'processor', module: 'destination', version: 'v0', @@ -2390,7 +2390,7 @@ export const data = [ }, { name: 'adobe_analytics', - description: 'Test 13', + description: 'Test 13: [ERROR]: Invalid message type: Identify', feature: 'processor', module: 'destination', version: 'v0', @@ -2523,7 +2523,7 @@ export const data = [ }, { name: 'adobe_analytics', - description: 'Test 14', + description: 'Test 14: [ERROR]: Message Type is not present.', feature: 'processor', module: 'destination', version: 'v0', @@ -2697,7 +2697,8 @@ export const data = [ }, { name: 'adobe_analytics', - description: 'Test 15', + description: + 'Test 15: [ERROR]: The event is not a supported ECOM event or a mapped custom event.', feature: 'processor', module: 'destination', version: 'v0', @@ -2872,7 +2873,7 @@ export const data = [ }, { name: 'adobe_analytics', - description: 'Test 16', + description: 'Test 16: Test overrideEventName property', feature: 'processor', module: 'destination', version: 'v0', diff --git a/test/integrations/destinations/algolia/processor/data.ts b/test/integrations/destinations/algolia/processor/data.ts index f5c01e47e5..0cbdd8b31b 100644 --- a/test/integrations/destinations/algolia/processor/data.ts +++ b/test/integrations/destinations/algolia/processor/data.ts @@ -66,6 +66,13 @@ export const data = [ sentAt: '2019-10-14T09:03:22.563Z', }, destination: { + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + excludeKeys: [], + includeKeys: [], + }, + }, Config: { apiKey: 'dummyApiKey', applicationId: 'O2YARRI15I', @@ -77,6 +84,10 @@ export const data = [ ], }, }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], }, @@ -116,6 +127,10 @@ export const data = [ version: '1', }, statusCode: 200, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], }, @@ -197,7 +212,18 @@ export const data = [ }, sentAt: '2019-10-14T09:03:22.563Z', }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, destination: { + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + excludeKeys: [], + includeKeys: [], + }, + }, Config: { apiKey: 'dummyApiKey', applicationId: 'O2YARRI15I', @@ -250,6 +276,10 @@ export const data = [ version: '1', }, statusCode: 200, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], }, @@ -322,7 +352,18 @@ export const data = [ }, sentAt: '2019-10-14T09:03:22.563Z', }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, destination: { + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + excludeKeys: [], + includeKeys: [], + }, + }, Config: { apiKey: 'dummyApiKey', applicationId: 'O2YARRI15I', @@ -338,16 +379,23 @@ export const data = [ status: 200, body: [ { - error: 'Either filters or objectIds is required.', + error: + 'Either filters or objectIds is required.: Workflow: procWorkflow, Step: validateDestPayload, ChildStep: undefined, OriginalError: Either filters or objectIds is required.', statTags: { destType: 'ALGOLIA', errorCategory: 'dataValidation', errorType: 'instrumentation', feature: 'processor', - implementation: 'native', + implementation: 'cdkV2', module: 'destination', + destinationId: 'destId', + workspaceId: 'wspId', }, statusCode: 400, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], }, @@ -419,7 +467,18 @@ export const data = [ }, sentAt: '2019-10-14T09:03:22.563Z', }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, destination: { + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + excludeKeys: [], + includeKeys: [], + }, + }, Config: { apiKey: 'dummyApiKey', applicationId: 'O2YARRI15I', @@ -435,16 +494,23 @@ export const data = [ status: 200, body: [ { - error: 'eventType is mandatory for track call', + error: + 'eventType is mandatory for track call: Workflow: procWorkflow, Step: preparePayload, ChildStep: undefined, OriginalError: eventType is mandatory for track call', statTags: { destType: 'ALGOLIA', errorCategory: 'dataValidation', errorType: 'instrumentation', feature: 'processor', - implementation: 'native', + implementation: 'cdkV2', module: 'destination', + destinationId: 'destId', + workspaceId: 'wspId', }, statusCode: 400, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], }, @@ -526,7 +592,18 @@ export const data = [ }, sentAt: '2019-10-14T09:03:22.563Z', }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, destination: { + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + excludeKeys: [], + includeKeys: [], + }, + }, Config: { apiKey: 'dummyApiKey', applicationId: 'O2YARRI15I', @@ -548,16 +625,22 @@ export const data = [ body: [ { error: - 'for click eventType either both positions and queryId should be present or none', + 'for click eventType either both positions and queryId should be present or none: Workflow: procWorkflow, Step: validatePayloadForClickEvent, ChildStep: undefined, OriginalError: for click eventType either both positions and queryId should be present or none', statTags: { destType: 'ALGOLIA', errorCategory: 'dataValidation', errorType: 'instrumentation', feature: 'processor', - implementation: 'native', + implementation: 'cdkV2', module: 'destination', + destinationId: 'destId', + workspaceId: 'wspId', }, statusCode: 400, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], }, @@ -639,7 +722,18 @@ export const data = [ }, sentAt: '2019-10-14T09:03:22.563Z', }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, destination: { + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + excludeKeys: [], + includeKeys: [], + }, + }, Config: { apiKey: 'dummyApiKey', applicationId: 'O2YARRI15I', @@ -691,6 +785,10 @@ export const data = [ version: '1', }, statusCode: 200, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], }, @@ -772,7 +870,18 @@ export const data = [ }, sentAt: '2019-10-14T09:03:22.563Z', }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, destination: { + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + excludeKeys: [], + includeKeys: [], + }, + }, Config: { apiKey: 'dummyApiKey', applicationId: 'O2YARRI15I', @@ -794,16 +903,22 @@ export const data = [ body: [ { error: - 'for click eventType either both positions and queryId should be present or none', + 'for click eventType either both positions and queryId should be present or none: Workflow: procWorkflow, Step: validatePayloadForClickEvent, ChildStep: undefined, OriginalError: for click eventType either both positions and queryId should be present or none', statTags: { destType: 'ALGOLIA', errorCategory: 'dataValidation', errorType: 'instrumentation', feature: 'processor', - implementation: 'native', + implementation: 'cdkV2', module: 'destination', + destinationId: 'destId', + workspaceId: 'wspId', }, statusCode: 400, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], }, @@ -885,7 +1000,18 @@ export const data = [ }, sentAt: '2019-10-14T09:03:22.563Z', }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, destination: { + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + excludeKeys: [], + includeKeys: [], + }, + }, Config: { apiKey: 'dummyApiKey', applicationId: 'O2YARRI15I', @@ -906,16 +1032,23 @@ export const data = [ status: 200, body: [ { - error: 'eventType can be either click, view or conversion', + error: + 'eventType can be either click, view or conversion: Workflow: procWorkflow, Step: preparePayload, ChildStep: undefined, OriginalError: eventType can be either click, view or conversion', statTags: { destType: 'ALGOLIA', errorCategory: 'dataValidation', errorType: 'instrumentation', feature: 'processor', - implementation: 'native', + implementation: 'cdkV2', module: 'destination', + destinationId: 'destId', + workspaceId: 'wspId', }, statusCode: 400, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], }, @@ -997,7 +1130,18 @@ export const data = [ }, sentAt: '2019-10-14T09:03:22.563Z', }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, destination: { + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + excludeKeys: [], + includeKeys: [], + }, + }, Config: { apiKey: 'dummyApiKey', applicationId: 'O2YARRI15I', @@ -1012,16 +1156,23 @@ export const data = [ status: 200, body: [ { - error: 'eventType is mandatory for track call', + error: + 'eventType is mandatory for track call: Workflow: procWorkflow, Step: preparePayload, ChildStep: undefined, OriginalError: eventType is mandatory for track call', statTags: { destType: 'ALGOLIA', errorCategory: 'dataValidation', errorType: 'instrumentation', feature: 'processor', - implementation: 'native', + implementation: 'cdkV2', module: 'destination', + destinationId: 'destId', + workspaceId: 'wspId', }, statusCode: 400, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], }, @@ -1092,7 +1243,18 @@ export const data = [ }, sentAt: '2019-10-14T09:03:22.563Z', }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, destination: { + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + excludeKeys: [], + includeKeys: [], + }, + }, Config: { apiKey: 'dummyApiKey', applicationId: 'O2YARRI15I', @@ -1113,16 +1275,24 @@ export const data = [ status: 200, body: [ { - error: 'Missing required value from "properties.index"', + error: + 'Missing required value from "properties.index": Workflow: procWorkflow, Step: preparePayload, ChildStep: undefined, OriginalError: Missing required value from "properties.index"', statTags: { destType: 'ALGOLIA', errorCategory: 'dataValidation', errorType: 'instrumentation', feature: 'processor', - implementation: 'native', + implementation: 'cdkV2', module: 'destination', + + destinationId: 'destId', + workspaceId: 'wspId', }, statusCode: 400, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], }, @@ -1193,7 +1363,18 @@ export const data = [ }, sentAt: '2019-10-14T09:03:22.563Z', }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, destination: { + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + excludeKeys: [], + includeKeys: [], + }, + }, Config: { apiKey: 'dummyApiKey', applicationId: 'O2YARRI15I', @@ -1214,16 +1395,23 @@ export const data = [ status: 200, body: [ { - error: 'event name should be a string', + error: + 'event name should be a string: Workflow: procWorkflow, Step: validateInput, ChildStep: undefined, OriginalError: event name should be a string', statTags: { destType: 'ALGOLIA', errorCategory: 'dataValidation', errorType: 'instrumentation', feature: 'processor', - implementation: 'native', + implementation: 'cdkV2', module: 'destination', + destinationId: 'destId', + workspaceId: 'wspId', }, statusCode: 400, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], }, diff --git a/test/integrations/destinations/autopilot/processor/data.ts b/test/integrations/destinations/autopilot/processor/data.ts index 8ae3e28671..135e3e22f7 100644 --- a/test/integrations/destinations/autopilot/processor/data.ts +++ b/test/integrations/destinations/autopilot/processor/data.ts @@ -17,7 +17,7 @@ export const data = [ Name: 'AUTOPILOT', DisplayName: 'Autopilot', Config: { - cdkEnabled: true, + cdkV2Enabled: true, excludeKeys: [], includeKeys: [], }, @@ -85,6 +85,10 @@ export const data = [ type: 'identify', userId: 'user12345', }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], }, @@ -123,6 +127,10 @@ export const data = [ userId: 'ac7722c2-ccb6-4ae2-baf6-1effe861f4cd', }, statusCode: 200, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], }, @@ -146,7 +154,7 @@ export const data = [ Name: 'AUTOPILOT', DisplayName: 'Autopilot', Config: { - cdkEnabled: true, + cdkV2Enabled: true, excludeKeys: [], includeKeys: [], }, @@ -219,6 +227,10 @@ export const data = [ type: 'track', userId: 'user12345', }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], }, @@ -255,6 +267,10 @@ export const data = [ userId: 'ac7722c2-ccb6-4ae2-baf6-1effe861f4cd', }, statusCode: 200, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], }, @@ -278,7 +294,7 @@ export const data = [ Name: 'AUTOPILOT', DisplayName: 'Autopilot', Config: { - cdkEnabled: true, + cdkV2Enabled: true, excludeKeys: [], includeKeys: [], }, @@ -365,7 +381,8 @@ export const data = [ body: [ { statusCode: 400, - error: 'Bad event. Original error: message type "page" not supported for "autopilot"', + error: + 'message type page is not supported: Workflow: procWorkflow, Step: validateInput, ChildStep: undefined, OriginalError: message type page is not supported', metadata: { destinationId: 'destId', workspaceId: 'wspId', @@ -375,7 +392,7 @@ export const data = [ errorType: 'instrumentation', destType: 'AUTOPILOT', module: 'destination', - implementation: 'cdkV1', + implementation: 'cdkV2', feature: 'processor', destinationId: 'destId', workspaceId: 'wspId', @@ -403,7 +420,7 @@ export const data = [ Name: 'AUTOPILOT', DisplayName: 'Autopilot', Config: { - cdkEnabled: true, + cdkV2Enabled: true, excludeKeys: [], includeKeys: [], }, @@ -489,16 +506,18 @@ export const data = [ body: [ { statusCode: 400, - error: 'Unknown error occurred. Original error: Email is required for track calls', + error: + 'Email is required for track calls: Workflow: procWorkflow, Step: preparePayloadForTrack, ChildStep: undefined, OriginalError: Email is required for track calls', metadata: { destinationId: 'destId', workspaceId: 'wspId', }, statTags: { - errorCategory: 'transformation', + errorCategory: 'dataValidation', + errorType: 'instrumentation', destType: 'AUTOPILOT', module: 'destination', - implementation: 'cdkV1', + implementation: 'cdkV2', feature: 'processor', destinationId: 'destId', workspaceId: 'wspId', @@ -526,7 +545,7 @@ export const data = [ Name: 'AUTOPILOT', DisplayName: 'Autopilot', Config: { - cdkEnabled: true, + cdkV2Enabled: true, excludeKeys: [], includeKeys: [], }, @@ -612,16 +631,17 @@ export const data = [ { statusCode: 400, error: - 'Unknown error occurred. Original error: "type" is a required field and it must be a string', + 'message Type is not present. Aborting message.: Workflow: procWorkflow, Step: validateInput, ChildStep: undefined, OriginalError: message Type is not present. Aborting message.', metadata: { destinationId: 'destId', workspaceId: 'wspId', }, statTags: { - errorCategory: 'transformation', + errorCategory: 'dataValidation', + errorType: 'instrumentation', destType: 'AUTOPILOT', module: 'destination', - implementation: 'cdkV1', + implementation: 'cdkV2', destinationId: 'destId', workspaceId: 'wspId', feature: 'processor', @@ -649,7 +669,7 @@ export const data = [ Name: 'AUTOPILOT', DisplayName: 'Autopilot', Config: { - cdkEnabled: true, + cdkV2Enabled: true, excludeKeys: [], includeKeys: [], }, @@ -736,7 +756,8 @@ export const data = [ body: [ { statusCode: 400, - error: 'Bad event. Original error: message type "group" not supported for "autopilot"', + error: + 'message type group is not supported: Workflow: procWorkflow, Step: validateInput, ChildStep: undefined, OriginalError: message type group is not supported', metadata: { destinationId: 'destId', workspaceId: 'wspId', @@ -746,7 +767,7 @@ export const data = [ errorType: 'instrumentation', destType: 'AUTOPILOT', module: 'destination', - implementation: 'cdkV1', + implementation: 'cdkV2', destinationId: 'destId', workspaceId: 'wspId', feature: 'processor', @@ -774,7 +795,7 @@ export const data = [ Name: 'AUTOPILOT', DisplayName: 'Autopilot', Config: { - cdkEnabled: true, + cdkV2Enabled: true, excludeKeys: [], includeKeys: [], }, @@ -906,7 +927,7 @@ export const data = [ Name: 'AUTOPILOT', DisplayName: 'Autopilot', Config: { - cdkEnabled: true, + cdkV2Enabled: true, excludeKeys: [], includeKeys: [], }, @@ -993,16 +1014,17 @@ export const data = [ { statusCode: 400, error: - 'Unknown error occurred. Original error: "type" is a required field and it must be a string', + 'message Type is not present. Aborting message.: Workflow: procWorkflow, Step: validateInput, ChildStep: undefined, OriginalError: message Type is not present. Aborting message.', metadata: { destinationId: 'destId', workspaceId: 'wspId', }, statTags: { - errorCategory: 'transformation', + errorCategory: 'dataValidation', + errorType: 'instrumentation', destType: 'AUTOPILOT', module: 'destination', - implementation: 'cdkV1', + implementation: 'cdkV2', destinationId: 'destId', workspaceId: 'wspId', feature: 'processor', @@ -1030,7 +1052,7 @@ export const data = [ Name: 'AUTOPILOT', DisplayName: 'Autopilot', Config: { - cdkEnabled: true, + cdkV2Enabled: true, excludeKeys: [], includeKeys: [], }, @@ -1110,7 +1132,8 @@ export const data = [ body: [ { statusCode: 400, - error: 'Bad event. Original error: message type "group" not supported for "autopilot"', + error: + 'message type group is not supported: Workflow: procWorkflow, Step: validateInput, ChildStep: undefined, OriginalError: message type group is not supported', metadata: { destinationId: 'destId', workspaceId: 'wspId', @@ -1120,7 +1143,7 @@ export const data = [ errorType: 'instrumentation', destType: 'AUTOPILOT', module: 'destination', - implementation: 'cdkV1', + implementation: 'cdkV2', destinationId: 'destId', workspaceId: 'wspId', feature: 'processor', @@ -1148,7 +1171,7 @@ export const data = [ Name: 'AUTOPILOT', DisplayName: 'Autopilot', Config: { - cdkEnabled: true, + cdkV2Enabled: true, excludeKeys: [], includeKeys: [], }, @@ -1228,7 +1251,8 @@ export const data = [ body: [ { statusCode: 400, - error: 'Bad event. Original error: message type "Tals" not supported for "autopilot"', + error: + 'message type Tals is not supported: Workflow: procWorkflow, Step: validateInput, ChildStep: undefined, OriginalError: message type Tals is not supported', metadata: { destinationId: 'destId', workspaceId: 'wspId', @@ -1238,7 +1262,7 @@ export const data = [ errorType: 'instrumentation', destType: 'AUTOPILOT', module: 'destination', - implementation: 'cdkV1', + implementation: 'cdkV2', destinationId: 'destId', workspaceId: 'wspId', feature: 'processor', diff --git a/test/integrations/destinations/campaign_manager/dataDelivery/data.ts b/test/integrations/destinations/campaign_manager/dataDelivery/data.ts new file mode 100644 index 0000000000..601ad56401 --- /dev/null +++ b/test/integrations/destinations/campaign_manager/dataDelivery/data.ts @@ -0,0 +1,604 @@ +export const data = [ + { + name: 'campaign_manager', + description: 'Sucess insert request V0', + feature: 'dataDelivery', + module: 'destination', + version: 'v0', + input: { + request: { + body: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: + 'https://dfareporting.googleapis.com/dfareporting/v4/userprofiles/437689/conversions/batchinsert', + headers: { + Authorization: 'Bearer dummyApiKey', + 'Content-Type': 'application/json', + }, + params: {}, + body: { + JSON: { + kind: 'dfareporting#conversionsBatchInsertRequest', + encryptionInfo: { + kind: 'dfareporting#encryptionInfo', + encryptionSource: 'AD_SERVING', + encryptionEntityId: '3564523', + encryptionEntityType: 'DCM_ACCOUNT', + }, + conversions: [ + { + timestampMicros: '1668624722000000', + floodlightConfigurationId: '213123123', + ordinal: '1', + floodlightActivityId: '456543345245', + value: 7, + gclid: '123', + limitAdTracking: true, + childDirectedTreatment: true, + }, + ], + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + }, + method: 'POST', + }, + }, + output: { + response: { + status: 200, + body: { + output: { + status: 200, + message: '[CAMPAIGN_MANAGER Response Handler] - Request Processed Successfully', + destinationResponse: { + response: { + hasFailures: false, + status: [ + { + conversion: { + timestampMicros: '1668624722000000', + floodlightConfigurationId: '213123123', + ordinal: '1', + floodlightActivityId: '456543345245', + value: 7, + gclid: '123', + limitAdTracking: true, + childDirectedTreatment: true, + }, + kind: 'dfareporting#conversionStatus', + }, + ], + kind: 'dfareporting#conversionsBatchInsertResponse', + }, + status: 200, + }, + }, + }, + }, + }, + }, + { + name: 'campaign_manager', + description: 'Failure insert request', + feature: 'dataDelivery', + module: 'destination', + version: 'v0', + input: { + request: { + body: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: + 'https://dfareporting.googleapis.com/dfareporting/v4/userprofiles/437690/conversions/batchinsert', + headers: { + Authorization: 'Bearer dummyApiKey', + 'Content-Type': 'application/json', + }, + params: {}, + body: { + JSON: { + kind: 'dfareporting#conversionsBatchInsertRequest', + encryptionInfo: { + kind: 'dfareporting#encryptionInfo', + encryptionSource: 'AD_SERVING', + encryptionEntityId: '3564523', + encryptionEntityType: 'DCM_ACCOUNT', + }, + conversions: [ + { + timestampMicros: '1668624722000000', + floodlightConfigurationId: '213123123', + ordinal: '1', + floodlightActivityId: '456543345245', + value: 7, + gclid: '123', + limitAdTracking: true, + childDirectedTreatment: true, + }, + ], + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + }, + method: 'POST', + }, + }, + output: { + response: { + status: 400, + body: { + output: { + status: 400, + message: 'Campaign Manager: Aborting during CAMPAIGN_MANAGER response transformation', + statTags: { + errorCategory: 'network', + errorType: 'aborted', + destType: 'CAMPAIGN_MANAGER', + module: 'destination', + implementation: 'native', + feature: 'dataDelivery', + destinationId: 'Non-determininable', + workspaceId: 'Non-determininable', + }, + destinationResponse: { + response: { + hasFailures: true, + status: [ + { + conversion: { + timestampMicros: '1668624722000000', + floodlightConfigurationId: '213123123', + ordinal: '1', + floodlightActivityId: '456543345245', + value: 7, + gclid: '123', + limitAdTracking: true, + childDirectedTreatment: true, + }, + errors: [ + { + code: 'NOT_FOUND', + message: 'Floodlight config id: 213123123 was not found.', + kind: 'dfareporting#conversionError', + }, + ], + kind: 'dfareporting#conversionStatus', + }, + ], + kind: 'dfareporting#conversionsBatchInsertResponse', + }, + status: 200, + }, + }, + }, + }, + }, + }, + { + name: 'campaign_manager', + description: 'Failure insert request Aborted', + feature: 'dataDelivery', + module: 'destination', + version: 'v0', + input: { + request: { + body: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: + 'https://dfareporting.googleapis.com/dfareporting/v4/userprofiles/437691/conversions/batchinsert', + headers: { + Authorization: 'Bearer dummyApiKey', + 'Content-Type': 'application/json', + }, + params: {}, + body: { + JSON: { + kind: 'dfareporting#conversionsBatchInsertRequest', + encryptionInfo: { + kind: 'dfareporting#encryptionInfo', + encryptionSource: 'AD_SERVING', + encryptionEntityId: '3564523', + encryptionEntityType: 'DCM_ACCOUNT', + }, + conversions: [ + { + timestampMicros: '1668624722000000', + floodlightConfigurationId: '213123123', + ordinal: '1', + floodlightActivityId: '456543345245', + value: 7, + gclid: '123', + limitAdTracking: true, + childDirectedTreatment: true, + }, + ], + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + }, + method: 'POST', + }, + }, + output: { + response: { + status: 400, + body: { + output: { + status: 400, + message: 'Campaign Manager: Aborting during CAMPAIGN_MANAGER response transformation', + statTags: { + errorCategory: 'network', + errorType: 'aborted', + destType: 'CAMPAIGN_MANAGER', + module: 'destination', + implementation: 'native', + feature: 'dataDelivery', + destinationId: 'Non-determininable', + workspaceId: 'Non-determininable', + }, + destinationResponse: { + response: { + hasFailures: true, + status: [ + { + conversion: { + timestampMicros: '1668624722000000', + floodlightConfigurationId: '213123123', + ordinal: '1', + floodlightActivityId: '456543345245', + value: 7, + gclid: '123', + limitAdTracking: true, + childDirectedTreatment: true, + }, + errors: [ + { + code: 'INVALID_ARGUMENT', + message: 'Floodlight config id: 213123123 was not found.', + kind: 'dfareporting#conversionError', + }, + ], + kind: 'dfareporting#conversionStatus', + }, + ], + kind: 'dfareporting#conversionsBatchInsertResponse', + }, + status: 200, + }, + }, + }, + }, + }, + }, + { + name: 'campaign_manager', + description: 'Sucess and fail insert request v1', + feature: 'dataDelivery', + module: 'destination', + version: 'v1', + input: { + request: { + body: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: + 'https://dfareporting.googleapis.com/dfareporting/v4/userprofiles/437692/conversions/batchinsert', + headers: { + Authorization: 'Bearer dummyApiKey', + 'Content-Type': 'application/json', + }, + params: {}, + body: { + JSON: { + kind: 'dfareporting#conversionsBatchInsertRequest', + conversions: [ + { + timestampMicros: '1668624722000000', + floodlightConfigurationId: '213123123', + ordinal: '1', + floodlightActivityId: '456543345245', + value: 7, + gclid: '123', + limitAdTracking: true, + childDirectedTreatment: true, + }, + { + timestampMicros: '1668624722000000', + floodlightConfigurationId: '213123123', + ordinal: '1', + floodlightActivityId: '456543345245', + value: 8, + gclid: '123', + limitAdTracking: true, + childDirectedTreatment: true, + }, + ], + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + metadata: [ + { + jobId: 2, + attemptNum: 0, + userId: '', + sourceId: '2Vsge2uWYdrLfG7pZb5Y82eo4lr', + destinationId: '2RHh08uOsXqE9KvCDg3hoaeuK2L', + workspaceId: '2Csl0lSTbuM3qyHdaOQB2GcDH8o', + secret: { + access_token: 'secret', + refresh_token: 'refresh', + developer_token: 'developer_Token', + }, + }, + { + jobId: 3, + attemptNum: 1, + userId: '', + sourceId: '2Vsge2uWYdrLfG7pZb5Y82eo4lr', + destinationId: '2RHh08uOsXqE9KvCDg3hoaeuK2L', + workspaceId: '2Csl0lSTbuM3qyHdaOQB2GcDH8o', + secret: { + access_token: 'secret', + refresh_token: 'refresh', + developer_token: 'developer_Token', + }, + }, + ], + files: {}, + }, + method: 'POST', + }, + }, + output: { + response: { + status: 200, + body: { + output: { + status: 200, + message: '[CAMPAIGN_MANAGER Response V1 Handler] - Request Processed Successfully', + destinationResponse: { + response: { + hasFailures: true, + status: [ + { + conversion: { + timestampMicros: '1668624722000000', + floodlightConfigurationId: '213123123', + ordinal: '1', + floodlightActivityId: '456543345245', + value: 7, + gclid: '123', + limitAdTracking: true, + childDirectedTreatment: true, + }, + kind: 'dfareporting#conversionStatus', + errors: [ + { + code: 'INVALID_ARGUMENT', + kind: 'dfareporting#conversionError', + message: 'Floodlight config id: 213123123 was not found.', + }, + ], + }, + { + conversion: { + timestampMicros: '1668624722000000', + floodlightConfigurationId: '213123123', + ordinal: '1', + floodlightActivityId: '456543345245', + value: 8, + gclid: '123', + limitAdTracking: true, + childDirectedTreatment: true, + }, + kind: 'dfareporting#conversionStatus', + }, + ], + kind: 'dfareporting#conversionsBatchInsertResponse', + }, + status: 200, + rudderJobMetadata: [ + { + jobId: 2, + attemptNum: 0, + userId: '', + sourceId: '2Vsge2uWYdrLfG7pZb5Y82eo4lr', + destinationId: '2RHh08uOsXqE9KvCDg3hoaeuK2L', + workspaceId: '2Csl0lSTbuM3qyHdaOQB2GcDH8o', + secret: { + access_token: 'secret', + refresh_token: 'refresh', + developer_token: 'developer_Token', + }, + }, + { + jobId: 3, + attemptNum: 1, + userId: '', + sourceId: '2Vsge2uWYdrLfG7pZb5Y82eo4lr', + destinationId: '2RHh08uOsXqE9KvCDg3hoaeuK2L', + workspaceId: '2Csl0lSTbuM3qyHdaOQB2GcDH8o', + secret: { + access_token: 'secret', + refresh_token: 'refresh', + developer_token: 'developer_Token', + }, + }, + ], + }, + response: [ + { + error: 'Floodlight config id: 213123123 was not found., ', + statusCode: 400, + metadata: { + attemptNum: 0, + destinationId: '2RHh08uOsXqE9KvCDg3hoaeuK2L', + jobId: 2, + secret: { + access_token: 'secret', + developer_token: 'developer_Token', + refresh_token: 'refresh', + }, + sourceId: '2Vsge2uWYdrLfG7pZb5Y82eo4lr', + userId: '', + workspaceId: '2Csl0lSTbuM3qyHdaOQB2GcDH8o', + }, + }, + { + error: 'success', + metadata: { + attemptNum: 1, + destinationId: '2RHh08uOsXqE9KvCDg3hoaeuK2L', + jobId: 3, + secret: { + access_token: 'secret', + developer_token: 'developer_Token', + refresh_token: 'refresh', + }, + sourceId: '2Vsge2uWYdrLfG7pZb5Y82eo4lr', + userId: '', + workspaceId: '2Csl0lSTbuM3qyHdaOQB2GcDH8o', + }, + statusCode: 200, + }, + ], + }, + }, + }, + }, + }, + { + name: 'campaign_manager', + description: 'Sucess insert request v1', + feature: 'dataDelivery', + module: 'destination', + version: 'v1', + input: { + request: { + body: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: + 'https://dfareporting.googleapis.com/dfareporting/v4/userprofiles/43770/conversions/batchinsert', + headers: { + Authorization: 'Bearer dummyApiKey', + 'Content-Type': 'application/json', + }, + params: {}, + body: { + JSON: { + kind: 'dfareporting#conversionsBatchInsertRequest', + encryptionInfo: { + kind: 'dfareporting#encryptionInfo', + encryptionSource: 'AD_SERVING', + encryptionEntityId: '3564523', + encryptionEntityType: 'DCM_ACCOUNT', + }, + conversions: [ + { + timestampMicros: '1668624722000000', + floodlightConfigurationId: '213123123', + ordinal: '1', + floodlightActivityId: '456543345245', + value: 7, + gclid: '123', + limitAdTracking: true, + childDirectedTreatment: true, + }, + ], + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + metadata: { + jobId: 2, + attemptNum: 0, + userId: '', + sourceId: '2Vsge2uWYdrLfG7pZb5Y82eo4lr', + destinationId: '2RHh08uOsXqE9KvCDg3hoaeuK2L', + workspaceId: '2Csl0lSTbuM3qyHdaOQB2GcDH8o', + secret: { + access_token: 'secret', + refresh_token: 'refresh', + developer_token: 'developer_Token', + }, + }, + files: {}, + }, + method: 'POST', + }, + }, + output: { + response: { + status: 200, + body: { + output: { + status: 200, + message: '[CAMPAIGN_MANAGER Response V1 Handler] - Request Processed Successfully', + destinationResponse: { + response: { + hasFailures: false, + status: [ + { + conversion: { + timestampMicros: '1668624722000000', + floodlightConfigurationId: '213123123', + ordinal: '1', + floodlightActivityId: '456543345245', + value: 7, + gclid: '123', + limitAdTracking: true, + childDirectedTreatment: true, + }, + kind: 'dfareporting#conversionStatus', + }, + ], + kind: 'dfareporting#conversionsBatchInsertResponse', + }, + status: 200, + rudderJobMetadata: { + jobId: 2, + attemptNum: 0, + userId: '', + sourceId: '2Vsge2uWYdrLfG7pZb5Y82eo4lr', + destinationId: '2RHh08uOsXqE9KvCDg3hoaeuK2L', + workspaceId: '2Csl0lSTbuM3qyHdaOQB2GcDH8o', + secret: { + access_token: 'secret', + refresh_token: 'refresh', + developer_token: 'developer_Token', + }, + }, + }, + response: [ + { + error: 'success', + statusCode: 200, + }, + ], + }, + }, + }, + }, + }, +]; diff --git a/test/integrations/destinations/campaign_manager/network.ts b/test/integrations/destinations/campaign_manager/network.ts new file mode 100644 index 0000000000..ddecbaf8fa --- /dev/null +++ b/test/integrations/destinations/campaign_manager/network.ts @@ -0,0 +1,311 @@ +const Data = [ + { + httpReq: { + method: 'post', + url: 'https://dfareporting.googleapis.com/dfareporting/v4/userprofiles/437689/conversions/batchinsert', + data: { + kind: 'dfareporting#conversionsBatchInsertRequest', + encryptionInfo: { + kind: 'dfareporting#encryptionInfo', + encryptionSource: 'AD_SERVING', + encryptionEntityId: '3564523', + encryptionEntityType: 'DCM_ACCOUNT', + }, + conversions: [ + { + timestampMicros: '1668624722000000', + floodlightConfigurationId: '213123123', + ordinal: '1', + floodlightActivityId: '456543345245', + value: 7, + gclid: '123', + limitAdTracking: true, + childDirectedTreatment: true, + }, + ], + }, + headers: { + Authorization: 'Bearer dummyApiKey', + 'Content-Type': 'application/json', + }, + }, + httpRes: { + data: { + hasFailures: false, + status: [ + { + conversion: { + timestampMicros: '1668624722000000', + floodlightConfigurationId: '213123123', + ordinal: '1', + floodlightActivityId: '456543345245', + value: 7, + gclid: '123', + limitAdTracking: true, + childDirectedTreatment: true, + }, + kind: 'dfareporting#conversionStatus', + }, + ], + kind: 'dfareporting#conversionsBatchInsertResponse', + }, + status: 200, + statusText: 'OK', + }, + }, + { + httpReq: { + method: 'post', + url: 'https://dfareporting.googleapis.com/dfareporting/v4/userprofiles/437690/conversions/batchinsert', + data: { + kind: 'dfareporting#conversionsBatchInsertRequest', + encryptionInfo: { + kind: 'dfareporting#encryptionInfo', + encryptionSource: 'AD_SERVING', + encryptionEntityId: '3564523', + encryptionEntityType: 'DCM_ACCOUNT', + }, + conversions: [ + { + timestampMicros: '1668624722000000', + floodlightConfigurationId: '213123123', + ordinal: '1', + floodlightActivityId: '456543345245', + value: 7, + gclid: '123', + limitAdTracking: true, + childDirectedTreatment: true, + }, + ], + }, + headers: { + Authorization: 'Bearer dummyApiKey', + 'Content-Type': 'application/json', + }, + }, + httpRes: { + data: { + hasFailures: true, + status: [ + { + conversion: { + timestampMicros: '1668624722000000', + floodlightConfigurationId: '213123123', + ordinal: '1', + floodlightActivityId: '456543345245', + value: 7, + gclid: '123', + limitAdTracking: true, + childDirectedTreatment: true, + }, + errors: [ + { + code: 'NOT_FOUND', + message: 'Floodlight config id: 213123123 was not found.', + kind: 'dfareporting#conversionError', + }, + ], + kind: 'dfareporting#conversionStatus', + }, + ], + kind: 'dfareporting#conversionsBatchInsertResponse', + }, + status: 200, + statusText: 'OK', + }, + }, + { + httpReq: { + method: 'post', + url: 'https://dfareporting.googleapis.com/dfareporting/v4/userprofiles/43770/conversions/batchinsert', + data: { + kind: 'dfareporting#conversionsBatchInsertRequest', + encryptionInfo: { + kind: 'dfareporting#encryptionInfo', + encryptionSource: 'AD_SERVING', + encryptionEntityId: '3564523', + encryptionEntityType: 'DCM_ACCOUNT', + }, + conversions: [ + { + timestampMicros: '1668624722000000', + floodlightConfigurationId: '213123123', + ordinal: '1', + floodlightActivityId: '456543345245', + value: 7, + gclid: '123', + limitAdTracking: true, + childDirectedTreatment: true, + }, + ], + }, + headers: { + Authorization: 'Bearer dummyApiKey', + 'Content-Type': 'application/json', + }, + }, + httpRes: { + data: { + hasFailures: false, + status: [ + { + conversion: { + timestampMicros: '1668624722000000', + floodlightConfigurationId: '213123123', + ordinal: '1', + floodlightActivityId: '456543345245', + value: 7, + gclid: '123', + limitAdTracking: true, + childDirectedTreatment: true, + }, + kind: 'dfareporting#conversionStatus', + }, + ], + kind: 'dfareporting#conversionsBatchInsertResponse', + }, + status: 200, + statusText: 'OK', + }, + }, + { + httpReq: { + method: 'post', + url: 'https://dfareporting.googleapis.com/dfareporting/v4/userprofiles/437692/conversions/batchinsert', + data: { + kind: 'dfareporting#conversionsBatchInsertRequest', + conversions: [ + { + timestampMicros: '1668624722000000', + floodlightConfigurationId: '213123123', + ordinal: '1', + floodlightActivityId: '456543345245', + value: 7, + gclid: '123', + limitAdTracking: true, + childDirectedTreatment: true, + }, + { + timestampMicros: '1668624722000000', + floodlightConfigurationId: '213123123', + ordinal: '1', + floodlightActivityId: '456543345245', + value: 8, + gclid: '123', + limitAdTracking: true, + childDirectedTreatment: true, + }, + ], + }, + headers: { + Authorization: 'Bearer dummyApiKey', + 'Content-Type': 'application/json', + }, + }, + httpRes: { + data: { + hasFailures: true, + status: [ + { + conversion: { + timestampMicros: '1668624722000000', + floodlightConfigurationId: '213123123', + ordinal: '1', + floodlightActivityId: '456543345245', + value: 7, + gclid: '123', + limitAdTracking: true, + childDirectedTreatment: true, + }, + errors: [ + { + code: 'INVALID_ARGUMENT', + message: 'Floodlight config id: 213123123 was not found.', + kind: 'dfareporting#conversionError', + }, + ], + kind: 'dfareporting#conversionStatus', + }, + { + conversion: { + timestampMicros: '1668624722000000', + floodlightConfigurationId: '213123123', + ordinal: '1', + floodlightActivityId: '456543345245', + value: 8, + gclid: '123', + limitAdTracking: true, + childDirectedTreatment: true, + }, + kind: 'dfareporting#conversionStatus', + }, + ], + kind: 'dfareporting#conversionsBatchInsertResponse', + }, + status: 200, + statusText: 'OK', + }, + }, + { + httpReq: { + method: 'post', + url: 'https://dfareporting.googleapis.com/dfareporting/v4/userprofiles/437691/conversions/batchinsert', + data: { + kind: 'dfareporting#conversionsBatchInsertRequest', + encryptionInfo: { + kind: 'dfareporting#encryptionInfo', + encryptionSource: 'AD_SERVING', + encryptionEntityId: '3564523', + encryptionEntityType: 'DCM_ACCOUNT', + }, + conversions: [ + { + timestampMicros: '1668624722000000', + floodlightConfigurationId: '213123123', + ordinal: '1', + floodlightActivityId: '456543345245', + value: 7, + gclid: '123', + limitAdTracking: true, + childDirectedTreatment: true, + }, + ], + }, + headers: { + Authorization: 'Bearer dummyApiKey', + 'Content-Type': 'application/json', + }, + }, + httpRes: { + data: { + hasFailures: true, + status: [ + { + conversion: { + timestampMicros: '1668624722000000', + floodlightConfigurationId: '213123123', + ordinal: '1', + floodlightActivityId: '456543345245', + value: 7, + gclid: '123', + limitAdTracking: true, + childDirectedTreatment: true, + }, + errors: [ + { + code: 'INVALID_ARGUMENT', + message: 'Floodlight config id: 213123123 was not found.', + kind: 'dfareporting#conversionError', + }, + ], + kind: 'dfareporting#conversionStatus', + }, + ], + kind: 'dfareporting#conversionsBatchInsertResponse', + }, + status: 200, + statusText: 'OK', + }, + }, +]; +export const networkCallsData = [...Data]; diff --git a/test/integrations/destinations/campaign_manager/router/data.ts b/test/integrations/destinations/campaign_manager/router/data.ts index 95372e1925..2ab1813cf8 100644 --- a/test/integrations/destinations/campaign_manager/router/data.ts +++ b/test/integrations/destinations/campaign_manager/router/data.ts @@ -1,7 +1,7 @@ export const data = [ { name: 'campaign_manager', - description: 'Test 0', + description: 'Batch Different Type Requests', feature: 'router', module: 'destination', version: 'v0', @@ -77,7 +77,7 @@ export const data = [ properties: { profileId: 437689, floodlightConfigurationId: '213123123', - ordinal: 'string', + ordinal: '1', quantity: '455678', floodlightActivityId: '456543345245', value: 7, @@ -167,7 +167,7 @@ export const data = [ properties: { profileId: 437689, floodlightConfigurationId: '213123123', - ordinal: 'string', + ordinal: '2', floodlightActivityId: '456543345245', quantity: '455678', value: 7, @@ -256,16 +256,11 @@ export const data = [ properties: { profileId: 437689, floodlightConfigurationId: '213123123', - ordinal: 'string', + ordinal: '3', floodlightActivityId: '456543345245', - mobileDeviceId: 'string', value: 7, encryptedUserIdCandidates: ['dfghjbnm'], - gclid: 'string', - matchId: 'string', - dclid: 'string', quantity: '455678', - impressionId: 'string', limitAdTracking: true, childDirectedTreatment: true, encryptionInfo: { @@ -322,7 +317,7 @@ export const data = [ treatmentForUnderage: false, timestampMicros: '1668624722903000', floodlightConfigurationId: '213123123', - ordinal: 'string', + ordinal: '1', quantity: '455678', floodlightActivityId: '456543345245', value: 7, @@ -348,7 +343,7 @@ export const data = [ jobId: 1, }, ], - batched: false, + batched: true, statusCode: 200, destination: { Config: { @@ -387,7 +382,7 @@ export const data = [ treatmentForUnderage: false, timestampMicros: '1668624722903000', floodlightConfigurationId: '213123123', - ordinal: 'string', + ordinal: '2', quantity: '455678', floodlightActivityId: '456543345245', value: 7, @@ -411,7 +406,7 @@ export const data = [ jobId: 2, }, ], - batched: false, + batched: true, statusCode: 200, destination: { Config: { @@ -461,4 +456,802 @@ export const data = [ }, }, }, + { + name: 'campaign_manager', + description: 'Batch Sucessful BatchInsert Request', + feature: 'router', + module: 'destination', + version: 'v0', + input: { + request: { + body: { + input: [ + { + metadata: { + secret: { + access_token: 'dummyApiToken', + refresh_token: 'efgh5678', + developer_token: 'ijkl91011', + }, + jobId: 4, + }, + destination: { + Config: { + treatmentForUnderage: false, + limitAdTracking: false, + childDirectedTreatment: false, + nonPersonalizedAd: false, + rudderAccountId: '2EOknn1JNH7WK1MfNku4fGYKkRK', + }, + }, + message: { + channel: 'web', + event: 'Promotion Clicked', + originalTimestamp: '2022-11-17T00:22:02.903+05:30', + properties: { + profileId: 437689, + matchId: '123', + floodlightConfigurationId: '213123123', + quantity: '455678', + ordinal: '1', + floodlightActivityId: '456543345245', + value: 7, + limitAdTracking: true, + childDirectedTreatment: true, + requestType: 'batchinsert', + }, + type: 'track', + anonymousId: 'randomId', + integrations: { + All: true, + }, + name: 'ApplicationLoaded', + sentAt: '2022-11-17T00:22:02.903+05:30', + }, + }, + { + metadata: { + secret: { + access_token: 'dummyApiToken', + refresh_token: 'efgh5678', + developer_token: 'ijkl91011', + }, + jobId: 5, + }, + destination: { + Config: { + treatmentForUnderage: false, + limitAdTracking: false, + childDirectedTreatment: false, + nonPersonalizedAd: false, + rudderAccountId: '2EOknn1JNH7WK1MfNku4fGYKkRK', + }, + }, + message: { + channel: 'web', + event: 'Promotion Clicked', + type: 'track', + originalTimestamp: '2022-11-17T00:22:02.903+05:30', + properties: { + profileId: 437689, + floodlightConfigurationId: '213123123', + ordinal: '1', + floodlightActivityId: '456543345245', + quantity: '455678', + value: 7, + matchId: '111', + limitAdTracking: true, + childDirectedTreatment: true, + requestType: 'batchinsert', + }, + anonymousId: 'randomId', + integrations: { + All: true, + }, + name: 'ApplicationLoaded', + sentAt: '2022-11-17T00:22:02.903+05:30', + }, + }, + { + metadata: { + secret: { + access_token: 'dummyApiToken', + refresh_token: 'efgh5678', + developer_token: 'ijkl91011', + }, + jobId: 6, + }, + destination: { + Config: { + treatmentForUnderage: false, + limitAdTracking: false, + childDirectedTreatment: false, + nonPersonalizedAd: false, + rudderAccountId: '2EOknn1JNH7WK1MfNku4fGYKkRK', + }, + }, + message: { + channel: 'web', + event: 'Promotion Clicked', + type: 'track', + originalTimestamp: '2022-11-17T00:22:02.903+05:30', + properties: { + profileId: 437689, + floodlightConfigurationId: '213123123', + floodlightActivityId: '456543345245', + value: 7, + gclid: '123', + ordinal: '1', + quantity: '455678', + limitAdTracking: true, + childDirectedTreatment: true, + requestType: 'batchinsert', + }, + anonymousId: 'randomId', + integrations: { + All: true, + }, + name: 'ApplicationLoaded', + sentAt: '2022-11-17T00:22:02.903+05:30', + }, + }, + ], + destType: 'campaign_manager', + }, + method: 'POST', + }, + }, + output: { + response: { + status: 200, + body: { + output: [ + { + batchedRequest: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: + 'https://dfareporting.googleapis.com/dfareporting/v4/userprofiles/437689/conversions/batchinsert', + headers: { + Authorization: 'Bearer dummyApiToken', + 'Content-Type': 'application/json', + }, + params: {}, + body: { + JSON: { + kind: 'dfareporting#conversionsBatchInsertRequest', + conversions: [ + { + floodlightConfigurationId: '213123123', + ordinal: '1', + timestampMicros: '1668624722903000', + floodlightActivityId: '456543345245', + quantity: '455678', + value: 7, + matchId: '123', + limitAdTracking: true, + childDirectedTreatment: true, + nonPersonalizedAd: false, + treatmentForUnderage: false, + }, + { + floodlightConfigurationId: '213123123', + ordinal: '1', + timestampMicros: '1668624722903000', + floodlightActivityId: '456543345245', + quantity: '455678', + value: 7, + matchId: '111', + limitAdTracking: true, + childDirectedTreatment: true, + nonPersonalizedAd: false, + treatmentForUnderage: false, + }, + { + floodlightConfigurationId: '213123123', + ordinal: '1', + timestampMicros: '1668624722903000', + floodlightActivityId: '456543345245', + quantity: '455678', + value: 7, + gclid: '123', + limitAdTracking: true, + childDirectedTreatment: true, + nonPersonalizedAd: false, + treatmentForUnderage: false, + }, + ], + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + }, + metadata: [ + { + secret: { + access_token: 'dummyApiToken', + refresh_token: 'efgh5678', + developer_token: 'ijkl91011', + }, + jobId: 4, + }, + { + secret: { + access_token: 'dummyApiToken', + refresh_token: 'efgh5678', + developer_token: 'ijkl91011', + }, + jobId: 5, + }, + { + secret: { + access_token: 'dummyApiToken', + refresh_token: 'efgh5678', + developer_token: 'ijkl91011', + }, + jobId: 6, + }, + ], + batched: true, + statusCode: 200, + destination: { + Config: { + treatmentForUnderage: false, + limitAdTracking: false, + childDirectedTreatment: false, + nonPersonalizedAd: false, + rudderAccountId: '2EOknn1JNH7WK1MfNku4fGYKkRK', + }, + }, + }, + ], + }, + }, + }, + }, + { + name: 'campaign_manager', + description: 'Batch Sucessful BatchInsert and BatchUpdate Request', + feature: 'router', + module: 'destination', + version: 'v0', + input: { + request: { + body: { + input: [ + { + metadata: { + secret: { + access_token: 'dummyApiToken', + refresh_token: 'efgh5678', + developer_token: 'ijkl91011', + }, + jobId: 4, + }, + destination: { + Config: { + treatmentForUnderage: false, + limitAdTracking: false, + childDirectedTreatment: false, + nonPersonalizedAd: false, + rudderAccountId: '2EOknn1JNH7WK1MfNku4fGYKkRK', + }, + }, + message: { + channel: 'web', + event: 'Promotion Clicked', + originalTimestamp: '2022-11-17T00:22:02.903+05:30', + properties: { + profileId: 437689, + matchId: '123', + floodlightConfigurationId: '213123123', + quantity: '455678', + ordinal: '1', + floodlightActivityId: '456543345245', + value: 7, + limitAdTracking: true, + childDirectedTreatment: true, + requestType: 'batchupdate', + }, + type: 'track', + anonymousId: 'randomId', + integrations: { + All: true, + }, + name: 'ApplicationLoaded', + sentAt: '2022-11-17T00:22:02.903+05:30', + }, + }, + { + metadata: { + secret: { + access_token: 'dummyApiToken', + refresh_token: 'efgh5678', + developer_token: 'ijkl91011', + }, + jobId: 5, + }, + destination: { + Config: { + treatmentForUnderage: false, + limitAdTracking: false, + childDirectedTreatment: false, + nonPersonalizedAd: false, + rudderAccountId: '2EOknn1JNH7WK1MfNku4fGYKkRK', + }, + }, + message: { + channel: 'web', + event: 'Promotion Clicked', + type: 'track', + originalTimestamp: '2022-11-17T00:22:02.903+05:30', + properties: { + profileId: 437689, + floodlightConfigurationId: '213123123', + ordinal: '1', + floodlightActivityId: '456543345245', + quantity: '455678', + value: 7, + matchId: '111', + limitAdTracking: true, + childDirectedTreatment: true, + requestType: 'batchupdate', + }, + anonymousId: 'randomId', + integrations: { + All: true, + }, + name: 'ApplicationLoaded', + sentAt: '2022-11-17T00:22:02.903+05:30', + }, + }, + { + metadata: { + secret: { + access_token: 'dummyApiToken', + refresh_token: 'efgh5678', + developer_token: 'ijkl91011', + }, + jobId: 6, + }, + destination: { + Config: { + treatmentForUnderage: false, + limitAdTracking: false, + childDirectedTreatment: false, + nonPersonalizedAd: false, + rudderAccountId: '2EOknn1JNH7WK1MfNku4fGYKkRK', + }, + }, + message: { + channel: 'web', + event: 'Promotion Clicked', + type: 'track', + originalTimestamp: '2022-11-17T00:22:02.903+05:30', + properties: { + profileId: 437689, + floodlightConfigurationId: '213123123', + floodlightActivityId: '456543345245', + value: 7, + gclid: '123', + ordinal: '1', + quantity: '455678', + limitAdTracking: true, + childDirectedTreatment: true, + requestType: 'batchinsert', + }, + anonymousId: 'randomId', + integrations: { + All: true, + }, + name: 'ApplicationLoaded', + sentAt: '2022-11-17T00:22:02.903+05:30', + }, + }, + ], + destType: 'campaign_manager', + }, + method: 'POST', + }, + }, + output: { + response: { + status: 200, + body: { + output: [ + { + batchedRequest: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: + 'https://dfareporting.googleapis.com/dfareporting/v4/userprofiles/437689/conversions/batchupdate', + headers: { + Authorization: 'Bearer dummyApiToken', + 'Content-Type': 'application/json', + }, + params: {}, + body: { + JSON: { + kind: 'dfareporting#conversionsBatchUpdateRequest', + conversions: [ + { + floodlightConfigurationId: '213123123', + ordinal: '1', + timestampMicros: '1668624722903000', + floodlightActivityId: '456543345245', + quantity: '455678', + value: 7, + matchId: '123', + nonPersonalizedAd: false, + treatmentForUnderage: false, + }, + { + floodlightConfigurationId: '213123123', + ordinal: '1', + timestampMicros: '1668624722903000', + floodlightActivityId: '456543345245', + quantity: '455678', + value: 7, + matchId: '111', + nonPersonalizedAd: false, + treatmentForUnderage: false, + }, + ], + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + }, + metadata: [ + { + secret: { + access_token: 'dummyApiToken', + refresh_token: 'efgh5678', + developer_token: 'ijkl91011', + }, + jobId: 4, + }, + { + secret: { + access_token: 'dummyApiToken', + refresh_token: 'efgh5678', + developer_token: 'ijkl91011', + }, + jobId: 5, + }, + ], + batched: true, + statusCode: 200, + destination: { + Config: { + treatmentForUnderage: false, + limitAdTracking: false, + childDirectedTreatment: false, + nonPersonalizedAd: false, + rudderAccountId: '2EOknn1JNH7WK1MfNku4fGYKkRK', + }, + }, + }, + { + batchedRequest: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: + 'https://dfareporting.googleapis.com/dfareporting/v4/userprofiles/437689/conversions/batchinsert', + headers: { + Authorization: 'Bearer dummyApiToken', + 'Content-Type': 'application/json', + }, + params: {}, + body: { + JSON: { + kind: 'dfareporting#conversionsBatchInsertRequest', + conversions: [ + { + floodlightConfigurationId: '213123123', + ordinal: '1', + timestampMicros: '1668624722903000', + floodlightActivityId: '456543345245', + quantity: '455678', + value: 7, + gclid: '123', + limitAdTracking: true, + childDirectedTreatment: true, + nonPersonalizedAd: false, + treatmentForUnderage: false, + }, + ], + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + }, + metadata: [ + { + secret: { + access_token: 'dummyApiToken', + refresh_token: 'efgh5678', + developer_token: 'ijkl91011', + }, + jobId: 6, + }, + ], + batched: true, + statusCode: 200, + destination: { + Config: { + treatmentForUnderage: false, + limitAdTracking: false, + childDirectedTreatment: false, + nonPersonalizedAd: false, + rudderAccountId: '2EOknn1JNH7WK1MfNku4fGYKkRK', + }, + }, + }, + ], + }, + }, + }, + }, + { + name: 'campaign_manager', + description: 'Entire Batch has data instrumentation', + feature: 'router', + module: 'destination', + version: 'v0', + input: { + request: { + body: { + input: [ + { + metadata: { + secret: { + access_token: 'dummyApiToken', + refresh_token: 'efgh5678', + developer_token: 'ijkl91011', + }, + jobId: 4, + }, + destination: { + Config: { + treatmentForUnderage: false, + limitAdTracking: false, + childDirectedTreatment: false, + nonPersonalizedAd: false, + rudderAccountId: '2EOknn1JNH7WK1MfNku4fGYKkRK', + }, + }, + message: { + channel: 'web', + event: 'Promotion Clicked', + originalTimestamp: '2022-11-17T00:22:02.903+05:30', + properties: { + profileId: 437689, + floodlightConfigurationId: '213123123', + quantity: '455678', + ordinal: '1', + floodlightActivityId: '456543345245', + value: 7, + limitAdTracking: true, + childDirectedTreatment: true, + requestType: 'batchupdate', + }, + type: 'track', + anonymousId: 'randomId', + integrations: { + All: true, + }, + name: 'ApplicationLoaded', + sentAt: '2022-11-17T00:22:02.903+05:30', + }, + }, + { + metadata: { + secret: { + access_token: 'dummyApiToken', + refresh_token: 'efgh5678', + developer_token: 'ijkl91011', + }, + jobId: 5, + }, + destination: { + Config: { + treatmentForUnderage: false, + limitAdTracking: false, + childDirectedTreatment: false, + nonPersonalizedAd: false, + rudderAccountId: '2EOknn1JNH7WK1MfNku4fGYKkRK', + }, + }, + message: { + channel: 'web', + event: 'Promotion Clicked', + type: 'track', + originalTimestamp: '2022-11-17T00:22:02.903+05:30', + properties: { + profileId: 437689, + floodlightConfigurationId: '213123123', + ordinal: '1', + floodlightActivityId: '456543345245', + quantity: '455678', + value: 7, + limitAdTracking: true, + childDirectedTreatment: true, + requestType: 'batchupdate', + }, + anonymousId: 'randomId', + integrations: { + All: true, + }, + name: 'ApplicationLoaded', + sentAt: '2022-11-17T00:22:02.903+05:30', + }, + }, + { + metadata: { + secret: { + access_token: 'dummyApiToken', + refresh_token: 'efgh5678', + developer_token: 'ijkl91011', + }, + jobId: 6, + }, + destination: { + Config: { + treatmentForUnderage: false, + limitAdTracking: false, + childDirectedTreatment: false, + nonPersonalizedAd: false, + rudderAccountId: '2EOknn1JNH7WK1MfNku4fGYKkRK', + }, + }, + message: { + channel: 'web', + event: 'Promotion Clicked', + type: 'track', + originalTimestamp: '2022-11-17T00:22:02.903+05:30', + properties: { + profileId: 437689, + floodlightConfigurationId: '213123123', + floodlightActivityId: '456543345245', + value: 7, + + ordinal: '1', + quantity: '455678', + limitAdTracking: true, + childDirectedTreatment: true, + requestType: 'batchinsert', + }, + anonymousId: 'randomId', + integrations: { + All: true, + }, + name: 'ApplicationLoaded', + sentAt: '2022-11-17T00:22:02.903+05:30', + }, + }, + ], + destType: 'campaign_manager', + }, + method: 'POST', + }, + }, + output: { + response: { + status: 200, + body: { + output: [ + { + metadata: [ + { + secret: { + access_token: 'dummyApiToken', + refresh_token: 'efgh5678', + developer_token: 'ijkl91011', + }, + jobId: 4, + }, + ], + batched: false, + statusCode: 400, + error: + '[CAMPAIGN MANAGER (DCM)]: Atleast one of encryptedUserId,encryptedUserIdCandidates, matchId, mobileDeviceId, gclid, dclid, impressionId.', + statTags: { + errorCategory: 'dataValidation', + errorType: 'instrumentation', + destType: 'CAMPAIGN_MANAGER', + module: 'destination', + implementation: 'native', + feature: 'router', + }, + destination: { + Config: { + treatmentForUnderage: false, + limitAdTracking: false, + childDirectedTreatment: false, + nonPersonalizedAd: false, + rudderAccountId: '2EOknn1JNH7WK1MfNku4fGYKkRK', + }, + }, + }, + { + metadata: [ + { + secret: { + access_token: 'dummyApiToken', + refresh_token: 'efgh5678', + developer_token: 'ijkl91011', + }, + jobId: 5, + }, + ], + batched: false, + statusCode: 400, + error: + '[CAMPAIGN MANAGER (DCM)]: Atleast one of encryptedUserId,encryptedUserIdCandidates, matchId, mobileDeviceId, gclid, dclid, impressionId.', + statTags: { + errorCategory: 'dataValidation', + errorType: 'instrumentation', + destType: 'CAMPAIGN_MANAGER', + module: 'destination', + implementation: 'native', + feature: 'router', + }, + destination: { + Config: { + treatmentForUnderage: false, + limitAdTracking: false, + childDirectedTreatment: false, + nonPersonalizedAd: false, + rudderAccountId: '2EOknn1JNH7WK1MfNku4fGYKkRK', + }, + }, + }, + { + metadata: [ + { + secret: { + access_token: 'dummyApiToken', + refresh_token: 'efgh5678', + developer_token: 'ijkl91011', + }, + jobId: 6, + }, + ], + batched: false, + statusCode: 400, + error: + '[CAMPAIGN MANAGER (DCM)]: Atleast one of encryptedUserId,encryptedUserIdCandidates, matchId, mobileDeviceId, gclid, dclid, impressionId.', + statTags: { + errorCategory: 'dataValidation', + errorType: 'instrumentation', + destType: 'CAMPAIGN_MANAGER', + module: 'destination', + implementation: 'native', + feature: 'router', + }, + destination: { + Config: { + treatmentForUnderage: false, + limitAdTracking: false, + childDirectedTreatment: false, + nonPersonalizedAd: false, + rudderAccountId: '2EOknn1JNH7WK1MfNku4fGYKkRK', + }, + }, + }, + ], + }, + }, + }, + }, ]; diff --git a/test/integrations/destinations/dcm_floodlight/processor/data.ts b/test/integrations/destinations/dcm_floodlight/processor/data.ts new file mode 100644 index 0000000000..e4b582a3f7 --- /dev/null +++ b/test/integrations/destinations/dcm_floodlight/processor/data.ts @@ -0,0 +1,5003 @@ +export const data = [ + { + name: 'dcm_floodlight', + description: 'Test 0', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + advertiserId: '22448662', + activityTag: '', + groupTag: '', + conversionEvents: [ + { + customVariables: [ + { + from: 'rudder1', + to: '1', + }, + { + from: 'rudder2', + to: '2', + }, + ], + eventName: 'Product viewed', + floodlightActivityTag: 'signu01', + floodlightGroupTag: 'conv01', + salesTag: false, + }, + { + customVariables: [ + { + from: '', + to: '', + }, + ], + eventName: 'Order Complete', + floodlightActivityTag: 'signu01', + floodlightGroupTag: 'conv02', + salesTag: false, + }, + ], + }, + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + }, + message: { + anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', + userId: '1234', + type: 'track', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + device: { + adTrackingEnabled: 'true', + advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', + id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', + manufacturer: 'Google', + model: 'AOSP on IA Emulator', + name: 'generic_x86_arm', + type: 'ios', + attTrackingStatus: 3, + }, + ip: '0.0.0.0', + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + locale: 'en-US', + os: { + name: 'iOS', + version: '14.4.1', + }, + screen: { + density: 2, + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', + }, + event: 'Product viewed', + properties: { + orderId: 111, + quantity: 2, + revenue: 800, + rudder1: 'rudder-v1', + rudder2: 'rudder-v2', + }, + integrations: { + All: true, + 'DCM Floodlight': { + COPPA: 'false', + GDPR: '1', + npa: true, + }, + }, + messageId: 'ea5cfab2-3961-4d8a-8187-3d1858c90a9f', + originalTimestamp: '2020-01-17T04:53:51.185Z', + receivedAt: '2020-01-17T10:23:52.688+05:30', + sentAt: '2020-01-17T04:53:52.667Z', + timestamp: '2020-01-17T10:23:51.206+05:30', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'GET', + endpoint: + 'https://ad.doubleclick.net/ddm/activity/src=22448662;cat=signu01;type=conv01;dc_rdid=T0T0T072-5e28-45a1-9eda-ce22a3e36d1a;ord=ea5cfab2-3961-4d8a-8187-3d1858c90a9f;dc_lat=1;tag_for_child_directed_treatment=0;tfua=1;npa=1;u1=rudder-v1;u2=rudder-v2', + headers: { + 'User-Agent': + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', + }, + params: {}, + body: { + JSON: {}, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'dcm_floodlight', + description: 'Test 1', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + activityTag: '', + advertiserId: '12649566', + conversionEvents: [ + { + customVariables: [ + { + from: '', + to: '', + }, + ], + eventName: 'Sign up Completed', + floodlightActivityTag: 'signu0', + floodlightGroupTag: 'conv01', + salesTag: false, + }, + { + customVariables: [ + { + from: 'rudder1', + to: '1', + }, + { + from: 'akash2', + to: '2', + }, + ], + eventName: 'Order Complete', + floodlightActivityTag: 'order0', + floodlightGroupTag: 'conv000', + salesTag: false, + }, + { + customVariables: [ + { + from: '', + to: '', + }, + ], + eventName: 'Checkout Started', + floodlightActivityTag: 'check0', + floodlightGroupTag: 'conv00', + salesTag: true, + }, + ], + groupTag: '', + }, + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + }, + message: { + anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', + userId: '1234', + type: 'track', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + device: { + adTrackingEnabled: 'true', + advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', + id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', + manufacturer: 'Google', + model: 'AOSP on IA Emulator', + name: 'generic_x86_arm', + type: 'ios', + attTrackingStatus: 3, + }, + ip: '0.0.0.0', + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + locale: 'en-US', + os: { + name: 'iOS', + version: '14.4.1', + }, + screen: { + density: 2, + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', + }, + event: 'Sign up Completed', + properties: { + orderId: 111, + quantity: 2, + revenue: 800, + }, + integrations: { + All: true, + 'DCM Floodlight': { + COPPA: 'false', + GDPR: '1', + npa: true, + }, + }, + messageId: 'ea5cfab2-3961-4d8a-8187-3d1858c90a9f', + originalTimestamp: '2020-01-17T04:53:51.185Z', + receivedAt: '2020-01-17T10:23:52.688+05:30', + sentAt: '2020-01-17T04:53:52.667Z', + timestamp: '2020-01-17T10:23:51.206+05:30', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'GET', + endpoint: + 'https://ad.doubleclick.net/ddm/activity/src=12649566;cat=signu0;type=conv01;dc_rdid=T0T0T072-5e28-45a1-9eda-ce22a3e36d1a;ord=ea5cfab2-3961-4d8a-8187-3d1858c90a9f;dc_lat=1;tag_for_child_directed_treatment=0;tfua=1;npa=1', + headers: { + 'User-Agent': + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', + }, + params: {}, + body: { + JSON: {}, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'dcm_floodlight', + description: 'Test 2', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + activityTag: '', + advertiserId: '12649566', + conversionEvents: [ + { + customVariables: [ + { + from: '', + to: '', + }, + ], + eventName: 'Sign up Completed', + floodlightActivityTag: 'signu0', + floodlightGroupTag: 'conv01', + salesTag: false, + }, + { + customVariables: [ + { + from: 'rudder1', + to: '1', + }, + { + from: 'akash2', + to: '2', + }, + ], + eventName: 'Order Complete', + floodlightActivityTag: 'order0', + floodlightGroupTag: 'conv000', + salesTag: false, + }, + { + customVariables: [ + { + from: '', + to: '', + }, + ], + eventName: 'Checkout Started', + floodlightActivityTag: 'check0', + floodlightGroupTag: 'conv00', + salesTag: true, + }, + ], + groupTag: '', + }, + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + }, + message: { + anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', + userId: '1234', + type: 'track', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + device: { + adTrackingEnabled: 'true', + advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', + id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', + manufacturer: 'Google', + model: 'AOSP on IA Emulator', + name: 'generic_x86_arm', + type: 'ios', + attTrackingStatus: 3, + }, + ip: '0.0.0.0', + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + locale: 'en-US', + os: { + name: 'iOS', + version: '14.4.1', + }, + screen: { + density: 2, + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', + }, + event: 'Order Complete', + properties: { + orderId: 111, + quantity: 2, + revenue: 800, + rudder1: 'rudder-v1', + akash2: 'akash-v2', + }, + integrations: { + All: true, + 'DCM Floodlight': { + COPPA: 'false', + GDPR: '1', + npa: true, + }, + }, + messageId: 'ea5cfab2-3961-4d8a-8187-3d1858c90a9f', + originalTimestamp: '2020-01-17T04:53:51.185Z', + receivedAt: '2020-01-17T10:23:52.688+05:30', + sentAt: '2020-01-17T04:53:52.667Z', + timestamp: '2020-01-17T10:23:51.206+05:30', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'GET', + endpoint: + 'https://ad.doubleclick.net/ddm/activity/src=12649566;cat=order0;type=conv000;dc_rdid=T0T0T072-5e28-45a1-9eda-ce22a3e36d1a;ord=ea5cfab2-3961-4d8a-8187-3d1858c90a9f;dc_lat=1;tag_for_child_directed_treatment=0;tfua=1;npa=1;u1=rudder-v1;u2=akash-v2', + headers: { + 'User-Agent': + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', + }, + params: {}, + body: { + JSON: {}, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'dcm_floodlight', + description: 'Test 3', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + activityTag: '', + advertiserId: '12649566', + conversionEvents: [ + { + customVariables: [ + { + from: '', + to: '', + }, + ], + eventName: 'Sign up Completed', + floodlightActivityTag: 'signu0', + floodlightGroupTag: 'conv01', + salesTag: false, + }, + { + customVariables: [ + { + from: 'rudder1', + to: '1', + }, + { + from: 'akash2', + to: '2', + }, + ], + eventName: 'Order Complete', + floodlightActivityTag: 'order0', + floodlightGroupTag: 'conv000', + salesTag: false, + }, + { + customVariables: [ + { + from: '', + to: '', + }, + ], + eventName: 'Checkout Started', + floodlightActivityTag: 'check0', + floodlightGroupTag: 'conv00', + salesTag: true, + }, + ], + groupTag: '', + }, + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + }, + message: { + anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', + userId: '1234', + type: 'track', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + device: { + adTrackingEnabled: 'true', + advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', + id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', + manufacturer: 'Google', + model: 'AOSP on IA Emulator', + name: 'generic_x86_arm', + type: 'ios', + attTrackingStatus: 3, + }, + ip: '0.0.0.0', + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + locale: 'en-US', + os: { + name: 'iOS', + version: '14.4.1', + }, + screen: { + density: 2, + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', + }, + event: 'Checkout Started', + properties: { + orderId: 111, + quantity: 2, + revenue: 800, + }, + integrations: { + All: true, + 'DCM Floodlight': { + COPPA: 'false', + GDPR: '1', + npa: true, + }, + }, + messageId: 'ea5cfab2-3961-4d8a-8187-3d1858c90a9f', + originalTimestamp: '2020-01-17T04:53:51.185Z', + receivedAt: '2020-01-17T10:23:52.688+05:30', + sentAt: '2020-01-17T04:53:52.667Z', + timestamp: '2020-01-17T10:23:51.206+05:30', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'GET', + endpoint: + 'https://ad.doubleclick.net/ddm/activity/src=12649566;cat=check0;type=conv00;dc_rdid=T0T0T072-5e28-45a1-9eda-ce22a3e36d1a;ord=111;qty=2;cost=800;dc_lat=1;tag_for_child_directed_treatment=0;tfua=1;npa=1', + headers: { + 'User-Agent': + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', + }, + params: {}, + body: { + JSON: {}, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'dcm_floodlight', + description: 'Test 4', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + activityTag: '', + advertiserId: '12649566', + conversionEvents: [ + { + customVariables: [ + { + from: '', + to: '', + }, + ], + eventName: 'Sign up Completed', + floodlightActivityTag: 'signu0', + floodlightGroupTag: 'conv01', + salesTag: false, + }, + { + customVariables: [ + { + from: 'rudder1', + to: '1', + }, + { + from: 'akash1', + to: '2', + }, + ], + eventName: 'Order Complete', + floodlightActivityTag: 'order0', + floodlightGroupTag: 'conv000', + salesTag: false, + }, + { + customVariables: [ + { + from: '', + to: '', + }, + ], + eventName: 'Checkout Started', + floodlightActivityTag: 'check0', + floodlightGroupTag: 'conv00', + salesTag: true, + }, + { + customVariables: [ + { + from: 'rudder2', + to: '1', + }, + { + from: 'akash2', + to: '2', + }, + { + from: 'friendlyName2', + to: '3', + }, + { + from: 'name2', + to: '4', + }, + ], + eventName: 'Purchase', + floodlightActivityTag: 'Pur0', + floodlightGroupTag: 'conv111', + salesTag: false, + }, + ], + groupTag: '', + }, + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + }, + message: { + anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', + userId: '1234', + type: 'track', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + device: { + adTrackingEnabled: 'true', + advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', + id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', + manufacturer: 'Google', + model: 'AOSP on IA Emulator', + name: 'generic_x86_arm', + type: 'ios', + attTrackingStatus: 3, + }, + ip: '0.0.0.0', + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + locale: 'en-US', + os: { + name: 'iOS', + version: '14.4.1', + }, + screen: { + density: 2, + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', + }, + event: 'Purchase', + properties: { + orderId: 111, + quantity: 999999, + revenue: 800, + products: [ + { + sku: '45790-32', + url: 'https://www.example.com/product/path', + name: 'Monopoly: 3rd Edition', + price: 19, + category: 'Games', + quantity: 1, + image_url: 'https:///www.example.com/product/path.jpg', + product_id: '507f1f77bcf86cd799439011', + }, + { + sku: '46493-32', + name: 'Uno Card Game', + price: 3, + category: 'Games', + quantity: 2, + product_id: '505bd76785ebb509fc183733', + }, + ], + rudder2: 'rudder2', + akash2: 'akash2', + friendlyName2: 'friendlyName2', + name2: 'name2', + }, + integrations: { + All: true, + 'DCM Floodlight': { + COPPA: 'false', + GDPR: '1', + npa: true, + }, + }, + messageId: 'ea5cfab2-3961-4d8a-8187-3d1858c90a9f', + originalTimestamp: '2020-01-17T04:53:51.185Z', + receivedAt: '2020-01-17T10:23:52.688+05:30', + sentAt: '2020-01-17T04:53:52.667Z', + timestamp: '2020-01-17T10:23:51.206+05:30', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'GET', + endpoint: + 'https://ad.doubleclick.net/ddm/activity/src=12649566;cat=Pur0;type=conv111;dc_rdid=T0T0T072-5e28-45a1-9eda-ce22a3e36d1a;ord=ea5cfab2-3961-4d8a-8187-3d1858c90a9f;dc_lat=1;tag_for_child_directed_treatment=0;tfua=1;npa=1;u1=rudder2;u2=akash2;u3=friendlyName2;u4=name2', + headers: { + 'User-Agent': + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', + }, + params: {}, + body: { + JSON: {}, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'dcm_floodlight', + description: 'Test 5', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + activityTag: '', + advertiserId: '12649566', + conversionEvents: [ + { + customVariables: [ + { + from: '', + to: '', + }, + ], + eventName: 'Sign up Completed', + floodlightActivityTag: 'signu0', + floodlightGroupTag: 'conv01', + salesTag: false, + }, + { + customVariables: [ + { + from: 'rudder1', + to: '1', + }, + { + from: 'akash1', + to: '2', + }, + ], + eventName: 'Order Complete', + floodlightActivityTag: 'order0', + floodlightGroupTag: 'conv000', + salesTag: false, + }, + { + customVariables: [ + { + from: '', + to: '', + }, + ], + eventName: 'Checkout Started', + floodlightActivityTag: 'check0', + floodlightGroupTag: 'conv00', + salesTag: true, + }, + { + customVariables: [ + { + from: 'rudder2', + to: '1', + }, + { + from: 'akash2', + to: '2', + }, + { + from: 'friendlyName2', + to: '3', + }, + { + from: 'name2', + to: '4', + }, + ], + eventName: 'Purchase', + floodlightActivityTag: 'Pur0', + floodlightGroupTag: 'conv111', + salesTag: false, + }, + ], + groupTag: '', + }, + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + }, + message: { + anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', + userId: '1234', + type: 'track', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + device: { + adTrackingEnabled: 'true', + id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', + manufacturer: 'Google', + model: 'AOSP on IA Emulator', + name: 'generic_x86_arm', + type: 'ios', + attTrackingStatus: 3, + }, + ip: '0.0.0.0', + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + locale: 'en-US', + os: { + name: 'iOS', + version: '14.4.1', + }, + screen: { + density: 2, + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', + }, + event: 'Sign up Completed', + properties: { + orderId: 111, + quantity: 999999, + revenue: 800, + products: [ + { + sku: '45790-32', + url: 'https://www.example.com/product/path', + name: 'Monopoly: 3rd Edition', + price: 19, + category: 'Games', + quantity: 1, + image_url: 'https:///www.example.com/product/path.jpg', + product_id: '507f1f77bcf86cd799439011', + }, + { + sku: '46493-32', + name: 'Uno Card Game', + price: 3, + category: 'Games', + quantity: 2, + product_id: '505bd76785ebb509fc183733', + }, + ], + }, + integrations: { + All: true, + 'DCM Floodlight': { + COPPA: 'false', + GDPR: '1', + npa: true, + }, + }, + messageId: 'ea5cfab2-3961-4d8a-8187-3d1858c90a9f', + originalTimestamp: '2020-01-17T04:53:51.185Z', + receivedAt: '2020-01-17T10:23:52.688+05:30', + sentAt: '2020-01-17T04:53:52.667Z', + timestamp: '2020-01-17T10:23:51.206+05:30', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 400, + error: + 'advertisingId is required: Workflow: procWorkflow, Step: validateInput, ChildStep: undefined, OriginalError: advertisingId is required', + statTags: { + errorCategory: 'dataValidation', + errorType: 'instrumentation', + implementation: 'cdkV2', + destType: 'DCM_FLOODLIGHT', + module: 'destination', + feature: 'processor', + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + }, + { + name: 'dcm_floodlight', + description: 'Test 6', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + activityTag: '', + advertiserId: '12649566', + conversionEvents: [ + { + customVariables: [ + { + to: '', + from: '', + }, + ], + eventName: 'Sign up Completed', + floodlightActivityTag: 'signu0', + floodlightGroupTag: 'conv01', + salesTag: false, + }, + { + customVariables: [ + { + from: 'rudder1', + to: '1', + }, + { + from: 'akash1', + to: '2', + }, + ], + eventName: 'Order Complete', + floodlightActivityTag: 'order0', + floodlightGroupTag: 'conv000', + salesTag: false, + }, + { + customVariables: [ + { + from: '', + to: '', + }, + ], + eventName: 'Checkout Started', + floodlightActivityTag: 'check0', + floodlightGroupTag: 'conv00', + salesTag: true, + }, + { + customVariables: [ + { + to: '1', + from: 'rudder2', + }, + { + to: '2', + from: 'akash2', + }, + { + to: '3', + from: 'friendlyName2', + }, + { + to: '4', + from: 'name2', + }, + ], + eventName: 'Purchase', + floodlightActivityTag: 'Pur0', + floodlightGroupTag: 'conv111', + salesTag: false, + }, + ], + groupTag: '', + }, + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + }, + message: { + anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', + userId: '1234', + type: 'track', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + device: { + adTrackingEnabled: 'true', + advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', + id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', + manufacturer: 'Google', + model: 'AOSP on IA Emulator', + name: 'generic_x86_arm', + type: 'ios', + attTrackingStatus: 3, + }, + ip: '0.0.0.0', + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + locale: 'en-US', + os: { + name: 'iOS', + version: '14.4.1', + }, + screen: { + density: 2, + }, + }, + event: 'Sign up Completed', + properties: { + orderId: 111, + quantity: 999999, + revenue: 800, + products: [ + { + sku: '45790-32', + url: 'https://www.example.com/product/path', + name: 'Monopoly: 3rd Edition', + price: 19, + category: 'Games', + quantity: 1, + image_url: 'https:///www.example.com/product/path.jpg', + product_id: '507f1f77bcf86cd799439011', + }, + { + sku: '46493-32', + name: 'Uno Card Game', + price: 3, + category: 'Games', + quantity: 2, + product_id: '505bd76785ebb509fc183733', + }, + ], + }, + integrations: { + All: true, + 'DCM Floodlight': { + COPPA: 'false', + GDPR: '1', + npa: true, + }, + }, + messageId: 'ea5cfab2-3961-4d8a-8187-3d1858c90a9f', + originalTimestamp: '2020-01-17T04:53:51.185Z', + receivedAt: '2020-01-17T10:23:52.688+05:30', + sentAt: '2020-01-17T04:53:52.667Z', + timestamp: '2020-01-17T10:23:51.206+05:30', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 400, + error: + 'track:: userAgent is required: Workflow: procWorkflow, Step: validateInput, ChildStep: undefined, OriginalError: track:: userAgent is required', + statTags: { + errorCategory: 'dataValidation', + errorType: 'instrumentation', + implementation: 'cdkV2', + destType: 'DCM_FLOODLIGHT', + module: 'destination', + feature: 'processor', + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + }, + { + name: 'dcm_floodlight', + description: 'Test 7', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + advertiserId: '12649566', + activityTag: 'check0', + groupTag: 'conv00', + conversionEvents: [ + { + customVariables: [ + { + to: '', + from: '', + }, + ], + eventName: 'Sign up Completed', + floodlightActivityTag: 'signu0', + floodlightGroupTag: 'conv01', + salesTag: false, + }, + { + customVariables: [ + { + to: '1', + from: 'rudder1', + }, + { + to: '2', + from: 'akash1', + }, + ], + eventName: 'Order Complete', + floodlightActivityTag: 'order0', + floodlightGroupTag: 'conv000', + salesTag: false, + }, + { + customVariables: [ + { + to: '1', + from: 'akash1', + }, + ], + eventName: 'Checkout Started', + floodlightActivityTag: '', + floodlightGroupTag: '', + salesTag: true, + }, + { + customVariables: [ + { + to: '1', + from: 'rudder2', + }, + { + to: '2', + from: 'akash2', + }, + { + to: '3', + from: 'friendlyName2', + }, + { + to: '4', + from: 'name2', + }, + ], + eventName: 'Purchase', + floodlightActivityTag: 'Pur0', + floodlightGroupTag: 'conv111', + salesTag: false, + }, + ], + }, + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + }, + message: { + anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', + userId: '1234', + type: 'track', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + device: { + adTrackingEnabled: 'true', + advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', + id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', + manufacturer: 'Google', + model: 'AOSP on IA Emulator', + name: 'generic_x86_arm', + type: 'ios', + attTrackingStatus: 3, + }, + ip: '0.0.0.0', + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + locale: 'en-US', + os: { + name: 'iOS', + version: '14.4.1', + }, + screen: { + density: 2, + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', + }, + event: 'Checkout Started', + properties: { + orderId: 111, + quantity: 999999, + revenue: 800, + products: [ + { + sku: '45790-32', + url: 'https://www.example.com/product/path', + name: 'Monopoly: 3rd Edition', + price: 19, + category: 'Games', + quantity: 1, + image_url: 'https:///www.example.com/product/path.jpg', + product_id: '507f1f77bcf86cd799439011', + }, + { + sku: '46493-32', + name: 'Uno Card Game', + price: 3, + category: 'Games', + quantity: 2, + product_id: '505bd76785ebb509fc183733', + }, + ], + akash1: 'akash-v1', + }, + integrations: { + All: true, + 'DCM Floodlight': { + COPPA: 'false', + GDPR: '1', + npa: true, + }, + }, + messageId: 'ea5cfab2-3961-4d8a-8187-3d1858c90a9f', + originalTimestamp: '2020-01-17T04:53:51.185Z', + receivedAt: '2020-01-17T10:23:52.688+05:30', + sentAt: '2020-01-17T04:53:52.667Z', + timestamp: '2020-01-17T10:23:51.206+05:30', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'GET', + endpoint: + 'https://ad.doubleclick.net/ddm/activity/src=12649566;cat=check0;type=conv00;dc_rdid=T0T0T072-5e28-45a1-9eda-ce22a3e36d1a;ord=111;qty=3;cost=800;dc_lat=1;tag_for_child_directed_treatment=0;tfua=1;npa=1;u1=akash-v1', + headers: { + 'User-Agent': + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', + }, + params: {}, + body: { + JSON: {}, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'dcm_floodlight', + description: 'Test 8', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + advertiserId: '12649566', + activityTag: 'check0', + groupTag: 'conv00', + conversionEvents: [ + { + customVariables: [ + { + to: '', + from: '', + }, + ], + eventName: 'Sign up Completed', + floodlightActivityTag: 'signu0', + floodlightGroupTag: 'conv01', + salesTag: false, + }, + { + customVariables: [ + { + to: '1', + from: 'rudder1', + }, + { + to: '2', + from: 'akash1', + }, + ], + eventName: 'Order Complete', + floodlightActivityTag: 'order0', + floodlightGroupTag: 'conv000', + salesTag: false, + }, + { + eventName: 'Checkout Started', + floodlightActivityTag: '', + floodlightGroupTag: '', + salesTag: true, + }, + { + customVariables: [ + { + to: '1', + from: 'rudder2', + }, + { + to: '2', + from: 'akash2', + }, + { + to: '3', + from: 'friendlyName2', + }, + { + to: '4', + from: 'name2', + }, + ], + eventName: 'Purchase', + floodlightActivityTag: 'Pur0', + floodlightGroupTag: 'conv111', + salesTag: false, + }, + ], + }, + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + }, + message: { + anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', + userId: '1234', + type: 'track', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + device: { + adTrackingEnabled: 'true', + advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', + id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', + manufacturer: 'Google', + model: 'AOSP on IA Emulator', + name: 'generic_x86_arm', + type: 'ios', + attTrackingStatus: 3, + }, + ip: '0.0.0.0', + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + locale: 'en-US', + os: { + name: 'iOS', + version: '14.4.1', + }, + screen: { + density: 2, + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', + }, + event: 'Checkout Started', + properties: { + orderId: 111, + quantity: 999999, + revenue: 800, + products: [ + { + sku: '45790-32', + url: 'https://www.example.com/product/path', + name: 'Monopoly: 3rd Edition', + price: 19, + category: 'Games', + quantity: 1, + image_url: 'https:///www.example.com/product/path.jpg', + product_id: '507f1f77bcf86cd799439011', + }, + { + sku: '46493-32', + name: 'Uno Card Game', + price: 3, + category: 'Games', + quantity: 2, + product_id: '505bd76785ebb509fc183733', + }, + ], + }, + integrations: { + All: true, + 'DCM Floodlight': { + COPPA: 'false', + GDPR: '1', + npa: true, + }, + }, + messageId: 'ea5cfab2-3961-4d8a-8187-3d1858c90a9f', + originalTimestamp: '2020-01-17T04:53:51.185Z', + receivedAt: '2020-01-17T10:23:52.688+05:30', + sentAt: '2020-01-17T04:53:52.667Z', + timestamp: '2020-01-17T10:23:51.206+05:30', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'GET', + endpoint: + 'https://ad.doubleclick.net/ddm/activity/src=12649566;cat=check0;type=conv00;dc_rdid=T0T0T072-5e28-45a1-9eda-ce22a3e36d1a;ord=111;qty=3;cost=800;dc_lat=1;tag_for_child_directed_treatment=0;tfua=1;npa=1', + headers: { + 'User-Agent': + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', + }, + params: {}, + body: { + JSON: {}, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'dcm_floodlight', + description: 'Test 9', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + advertiserId: '12649566', + activityTag: 'check0', + groupTag: 'conv00', + conversionEvents: [ + { + customVariables: [ + { + to: '', + from: '', + }, + ], + eventName: 'Sign up Completed', + floodlightActivityTag: 'signu0', + floodlightGroupTag: 'conv01', + salesTag: false, + }, + { + customVariables: [ + { + to: '1', + from: 'rudder1', + }, + { + to: '2', + from: 'akash1', + }, + ], + eventName: 'Order Complete', + floodlightActivityTag: 'order0', + floodlightGroupTag: 'conv000', + salesTag: false, + }, + { + eventName: 'Checkout Started', + floodlightActivityTag: '', + floodlightGroupTag: '', + salesTag: true, + }, + { + customVariables: [ + { + to: '1', + from: 'rudder2', + }, + { + to: '2', + from: 'akash2', + }, + { + to: '3', + from: 'friendlyName2', + }, + { + to: '4', + from: 'name2', + }, + ], + eventName: 'Purchase', + floodlightActivityTag: 'Pur0', + floodlightGroupTag: 'conv111', + salesTag: false, + }, + ], + }, + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + }, + message: { + anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', + userId: '1234', + type: 'track', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + device: { + adTrackingEnabled: 'true', + advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', + id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', + manufacturer: 'Google', + model: 'AOSP on IA Emulator', + name: 'generic_x86_arm', + type: 'ios', + attTrackingStatus: 3, + }, + ip: '0.0.0.0', + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + locale: 'en-US', + os: { + name: 'iOS', + version: '14.4.1', + }, + screen: { + density: 2, + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', + }, + event: 'Sample event', + properties: { + orderId: 111, + quantity: 999999, + revenue: 800, + products: [ + { + sku: '45790-32', + url: 'https://www.example.com/product/path', + name: 'Monopoly: 3rd Edition', + price: 19, + category: 'Games', + quantity: 1, + image_url: 'https:///www.example.com/product/path.jpg', + product_id: '507f1f77bcf86cd799439011', + }, + { + sku: '46493-32', + name: 'Uno Card Game', + price: 3, + category: 'Games', + quantity: 2, + product_id: '505bd76785ebb509fc183733', + }, + ], + }, + integrations: { + All: true, + 'DCM Floodlight': { + COPPA: 'false', + GDPR: '1', + npa: true, + }, + }, + messageId: 'ea5cfab2-3961-4d8a-8187-3d1858c90a9f', + originalTimestamp: '2020-01-17T04:53:51.185Z', + receivedAt: '2020-01-17T10:23:52.688+05:30', + sentAt: '2020-01-17T04:53:52.667Z', + timestamp: '2020-01-17T10:23:51.206+05:30', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 400, + error: + 'track:: Conversion event not found: Workflow: procWorkflow, Step: handleConversionEvents, ChildStep: undefined, OriginalError: track:: Conversion event not found', + statTags: { + errorCategory: 'dataValidation', + errorType: 'instrumentation', + implementation: 'cdkV2', + destType: 'DCM_FLOODLIGHT', + module: 'destination', + feature: 'processor', + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + }, + { + name: 'dcm_floodlight', + description: 'Test 10', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + advertiserId: '12649566', + activityTag: 'check0', + groupTag: 'conv00', + conversionEvents: [ + { + customVariables: [ + { + to: '', + from: '', + }, + ], + eventName: 'Sign up Completed', + floodlightActivityTag: 'signu0', + floodlightGroupTag: 'conv01', + salesTag: false, + }, + { + customVariables: [ + { + to: '1', + from: 'rudder1', + }, + { + to: '2', + from: 'akash1', + }, + ], + eventName: 'Order Complete', + floodlightActivityTag: 'order0', + floodlightGroupTag: 'conv000', + salesTag: false, + }, + { + eventName: 'Checkout Started', + floodlightActivityTag: '', + floodlightGroupTag: '', + salesTag: true, + }, + { + customVariables: [ + { + to: '1', + from: 'rudder2', + }, + { + to: '2', + from: 'akash2', + }, + { + to: '3', + from: 'friendlyName2', + }, + { + to: '4', + from: 'name2', + }, + ], + eventName: 'Purchase', + floodlightActivityTag: 'Pur0', + floodlightGroupTag: 'conv111', + salesTag: false, + }, + ], + }, + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + }, + message: { + anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', + userId: '1234', + type: 'track', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + device: { + adTrackingEnabled: 'true', + advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', + id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', + manufacturer: 'Google', + model: 'AOSP on IA Emulator', + name: 'generic_x86_arm', + type: 'ios', + attTrackingStatus: 3, + }, + ip: '0.0.0.0', + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + locale: 'en-US', + os: { + name: 'iOS', + version: '14.4.1', + }, + screen: { + density: 2, + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', + }, + event: 'Checkout Started', + properties: { + orderId: 111, + quantity: 999999, + revenue: 800, + products: [ + { + sku: '45790-32', + url: 'https://www.example.com/product/path', + name: 'Monopoly: 3rd Edition', + price: 19, + category: 'Games', + quantity: 1, + image_url: 'https:///www.example.com/product/path.jpg', + product_id: '507f1f77bcf86cd799439011', + }, + ], + }, + integrations: { + All: true, + 'DCM Floodlight': { + COPPA: 'false', + GDPR: '1', + npa: true, + }, + }, + messageId: 'ea5cfab2-3961-4d8a-8187-3d1858c90a9f', + originalTimestamp: '2020-01-17T04:53:51.185Z', + receivedAt: '2020-01-17T10:23:52.688+05:30', + sentAt: '2020-01-17T04:53:52.667Z', + timestamp: '2020-01-17T10:23:51.206+05:30', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'GET', + endpoint: + 'https://ad.doubleclick.net/ddm/activity/src=12649566;cat=check0;type=conv00;dc_rdid=T0T0T072-5e28-45a1-9eda-ce22a3e36d1a;ord=111;qty=1;cost=800;dc_lat=1;tag_for_child_directed_treatment=0;tfua=1;npa=1', + headers: { + 'User-Agent': + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', + }, + params: {}, + body: { + JSON: {}, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'dcm_floodlight', + description: 'Test 11', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + advertiserId: '12649566', + activityTag: 'check0', + groupTag: 'conv00', + conversionEvents: [ + { + customVariables: [ + { + to: '', + from: '', + }, + ], + eventName: 'Sign up Completed', + floodlightActivityTag: 'signu0', + floodlightGroupTag: 'conv01', + salesTag: false, + }, + { + customVariables: [ + { + to: '1', + from: 'rudder1', + }, + { + to: '2', + from: 'akash1', + }, + ], + eventName: 'Order Complete', + floodlightActivityTag: 'order0', + floodlightGroupTag: 'conv000', + salesTag: false, + }, + { + eventName: 'Checkout Started', + floodlightActivityTag: '', + floodlightGroupTag: '', + salesTag: true, + }, + { + customVariables: [ + { + to: '1', + from: 'rudder2', + }, + { + to: '2', + from: 'akash2', + }, + { + to: '3', + from: 'friendlyName2', + }, + { + to: '4', + from: 'name2', + }, + ], + eventName: 'Purchase', + floodlightActivityTag: 'Pur0', + floodlightGroupTag: 'conv111', + salesTag: false, + }, + ], + }, + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + }, + message: { + anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', + userId: '1234', + type: 'track', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + device: { + adTrackingEnabled: 'true', + advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', + id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', + manufacturer: 'Google', + model: 'AOSP on IA Emulator', + name: 'generic_x86_arm', + type: 'ios', + attTrackingStatus: 3, + }, + ip: '0.0.0.0', + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + locale: 'en-US', + os: { + name: 'iOS', + version: '14.4.1', + }, + screen: { + density: 2, + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', + }, + event: 'Checkout Started', + properties: { + orderId: 111, + revenue: 800, + products: [ + { + sku: '45790-32', + url: 'https://www.example.com/product/path', + name: 'Monopoly: 3rd Edition', + price: 19, + category: 'Games', + quantity: 4, + image_url: 'https:///www.example.com/product/path.jpg', + product_id: '507f1f77bcf86cd799439011', + }, + { + sku: '46493-32', + name: 'Uno Card Game', + price: 3, + category: 'Games', + quantity: 2, + product_id: '505bd76785ebb509fc183733', + }, + ], + }, + integrations: { + All: true, + 'DCM Floodlight': { + COPPA: 'false', + GDPR: '1', + npa: true, + }, + }, + messageId: 'ea5cfab2-3961-4d8a-8187-3d1858c90a9f', + originalTimestamp: '2020-01-17T04:53:51.185Z', + receivedAt: '2020-01-17T10:23:52.688+05:30', + sentAt: '2020-01-17T04:53:52.667Z', + timestamp: '2020-01-17T10:23:51.206+05:30', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'GET', + endpoint: + 'https://ad.doubleclick.net/ddm/activity/src=12649566;cat=check0;type=conv00;dc_rdid=T0T0T072-5e28-45a1-9eda-ce22a3e36d1a;ord=111;qty=6;cost=800;dc_lat=1;tag_for_child_directed_treatment=0;tfua=1;npa=1', + headers: { + 'User-Agent': + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', + }, + params: {}, + body: { + JSON: {}, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'dcm_floodlight', + description: 'Test 12', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + advertiserId: '12649566', + activityTag: 'check0', + groupTag: 'conv00', + conversionEvents: [ + { + customVariables: [ + { + to: '', + from: '', + }, + ], + eventName: 'Sign up Completed', + floodlightActivityTag: 'signu0', + floodlightGroupTag: 'conv01', + salesTag: false, + }, + { + customVariables: [ + { + to: '1', + from: 'rudder1', + }, + { + to: '2', + from: 'akash1', + }, + ], + eventName: 'Order Complete', + floodlightActivityTag: 'order0', + floodlightGroupTag: 'conv000', + salesTag: false, + }, + { + eventName: 'Checkout Started', + floodlightActivityTag: '', + floodlightGroupTag: '', + salesTag: true, + }, + { + customVariables: [ + { + to: '1', + from: 'rudder2', + }, + { + to: '2', + from: 'akash2', + }, + { + to: '3', + from: 'friendlyName2', + }, + { + to: '4', + from: 'name2', + }, + ], + eventName: 'Purchase', + floodlightActivityTag: 'Pur0', + floodlightGroupTag: 'conv111', + salesTag: false, + }, + ], + }, + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + }, + message: { + anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', + userId: '1234', + type: 'track', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + device: { + adTrackingEnabled: 'true', + advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', + id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', + manufacturer: 'Google', + model: 'AOSP on IA Emulator', + name: 'generic_x86_arm', + type: 'ios', + attTrackingStatus: 3, + }, + ip: '0.0.0.0', + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + locale: 'en-US', + os: { + name: 'iOS', + version: '14.4.1', + }, + screen: { + density: 2, + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', + }, + event: 'Checkout Started', + properties: { + orderId: 111, + quantity: 999999, + revenue: 800, + }, + integrations: { + All: true, + 'DCM Floodlight': { + COPPA: 'false', + GDPR: '1', + npa: true, + }, + }, + messageId: 'ea5cfab2-3961-4d8a-8187-3d1858c90a9f', + originalTimestamp: '2020-01-17T04:53:51.185Z', + receivedAt: '2020-01-17T10:23:52.688+05:30', + sentAt: '2020-01-17T04:53:52.667Z', + timestamp: '2020-01-17T10:23:51.206+05:30', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'GET', + endpoint: + 'https://ad.doubleclick.net/ddm/activity/src=12649566;cat=check0;type=conv00;dc_rdid=T0T0T072-5e28-45a1-9eda-ce22a3e36d1a;ord=111;qty=999999;cost=800;dc_lat=1;tag_for_child_directed_treatment=0;tfua=1;npa=1', + headers: { + 'User-Agent': + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', + }, + params: {}, + body: { + JSON: {}, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'dcm_floodlight', + description: 'Test 13', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + advertiserId: '12649566', + activityTag: 'check0', + groupTag: 'conv00', + conversionEvents: [ + { + customVariables: [ + { + to: '', + from: '', + }, + ], + eventName: 'Sign up Completed', + floodlightActivityTag: 'signu0', + floodlightGroupTag: 'conv01', + salesTag: false, + }, + { + customVariables: [ + { + to: '1', + from: 'rudder1', + }, + { + to: '2', + from: 'akash1', + }, + ], + eventName: 'Order Complete', + floodlightActivityTag: 'order0', + floodlightGroupTag: 'conv000', + salesTag: false, + }, + { + eventName: 'Checkout Started', + floodlightActivityTag: '', + floodlightGroupTag: '', + salesTag: true, + }, + { + customVariables: [ + { + to: '1', + from: 'rudder2', + }, + { + to: '2', + from: 'akash2', + }, + { + to: '3', + from: 'friendlyName2', + }, + { + to: '4', + from: 'name2', + }, + ], + eventName: 'Purchase', + floodlightActivityTag: 'Pur0', + floodlightGroupTag: 'conv111', + salesTag: false, + }, + ], + }, + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + }, + message: { + anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', + userId: '1234', + type: 'track', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + device: { + adTrackingEnabled: 'true', + advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', + id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', + manufacturer: 'Google', + model: 'AOSP on IA Emulator', + name: 'generic_x86_arm', + type: 'ios', + attTrackingStatus: 3, + }, + ip: '0.0.0.0', + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + locale: 'en-US', + os: { + name: 'iOS', + version: '14.4.1', + }, + screen: { + density: 2, + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', + }, + event: 'OrDeR complete', + properties: { + orderId: 111, + quantity: 999999, + revenue: 800, + rudder1: 'rudder-v1', + akash1: 'akash-v1', + }, + integrations: { + All: true, + 'DCM Floodlight': { + COPPA: 'false', + GDPR: '1', + npa: true, + }, + }, + messageId: 'ea5cfab2-3961-4d8a-8187-3d1858c90a9f', + originalTimestamp: '2020-01-17T04:53:51.185Z', + receivedAt: '2020-01-17T10:23:52.688+05:30', + sentAt: '2020-01-17T04:53:52.667Z', + timestamp: '2020-01-17T10:23:51.206+05:30', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'GET', + endpoint: + 'https://ad.doubleclick.net/ddm/activity/src=12649566;cat=order0;type=conv000;dc_rdid=T0T0T072-5e28-45a1-9eda-ce22a3e36d1a;ord=ea5cfab2-3961-4d8a-8187-3d1858c90a9f;dc_lat=1;tag_for_child_directed_treatment=0;tfua=1;npa=1;u1=rudder-v1;u2=akash-v1', + headers: { + 'User-Agent': + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', + }, + params: {}, + body: { + JSON: {}, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'dcm_floodlight', + description: 'Test 14', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + advertiserId: '12649566', + activityTag: 'check0', + groupTag: 'conv00', + conversionEvents: [ + { + customVariables: [ + { + to: '', + from: '', + }, + ], + eventName: 'Sign up Completed', + floodlightActivityTag: 'signu0', + floodlightGroupTag: 'conv01', + salesTag: false, + }, + { + customVariables: [ + { + to: '1', + from: 'rudder1', + }, + { + to: '2', + from: 'akash1', + }, + ], + eventName: 'Order Complete', + floodlightActivityTag: 'order0', + floodlightGroupTag: 'conv000', + salesTag: false, + }, + { + eventName: 'Checkout Started', + floodlightActivityTag: '', + floodlightGroupTag: '', + salesTag: true, + }, + { + customVariables: [ + { + to: '1', + from: 'rudder2', + }, + { + to: '2', + from: 'akash2', + }, + { + to: '3', + from: 'friendlyName2', + }, + { + to: '4', + from: 'name2', + }, + ], + eventName: 'Purchase', + floodlightActivityTag: 'Pur0', + floodlightGroupTag: 'conv111', + salesTag: false, + }, + ], + }, + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + }, + message: { + anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', + userId: '1234', + type: 'track', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + device: { + adTrackingEnabled: 'true', + advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', + id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', + manufacturer: 'Google', + model: 'AOSP on IA Emulator', + name: 'generic_x86_arm', + type: 'ios', + attTrackingStatus: 3, + }, + ip: '0.0.0.0', + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + locale: 'en-US', + os: { + name: 'iOS', + version: '14.4.1', + }, + screen: { + density: 2, + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', + }, + event: 'Order complete', + properties: { + orderId: 111, + quantity: 999999, + revenue: 800, + rudder1: 'rudder-v1', + akash1: 'akash-v1', + }, + integrations: { + All: true, + 'DCM Floodlight': {}, + }, + messageId: 'ea5cfab2-3961-4d8a-8187-3d1858c90a9f', + originalTimestamp: '2020-01-17T04:53:51.185Z', + receivedAt: '2020-01-17T10:23:52.688+05:30', + sentAt: '2020-01-17T04:53:52.667Z', + timestamp: '2020-01-17T10:23:51.206+05:30', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'GET', + endpoint: + 'https://ad.doubleclick.net/ddm/activity/src=12649566;cat=order0;type=conv000;dc_rdid=T0T0T072-5e28-45a1-9eda-ce22a3e36d1a;ord=ea5cfab2-3961-4d8a-8187-3d1858c90a9f;dc_lat=1;u1=rudder-v1;u2=akash-v1', + headers: { + 'User-Agent': + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', + }, + params: {}, + body: { + JSON: {}, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'dcm_floodlight', + description: 'Test 15', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + advertiserId: '12649566', + activityTag: 'check0', + groupTag: 'conv00', + conversionEvents: [ + { + customVariables: [ + { + to: '', + from: '', + }, + ], + eventName: 'Sign up Completed', + floodlightActivityTag: 'signu0', + floodlightGroupTag: 'conv01', + salesTag: false, + }, + { + customVariables: [ + { + to: '1', + from: 'rudder1', + }, + { + to: '2', + from: 'akash1', + }, + ], + eventName: 'Order Complete', + floodlightActivityTag: 'order0', + floodlightGroupTag: 'conv000', + salesTag: false, + }, + { + eventName: 'Checkout Started', + floodlightActivityTag: '', + floodlightGroupTag: '', + salesTag: true, + }, + { + customVariables: [ + { + to: '1', + from: 'rudder2', + }, + { + to: '2', + from: 'akash2', + }, + { + to: '3', + from: 'friendlyName2', + }, + { + to: '4', + from: 'name2', + }, + ], + eventName: 'Purchase', + floodlightActivityTag: 'Pur0', + floodlightGroupTag: 'conv111', + salesTag: false, + }, + ], + }, + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + }, + message: { + anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', + userId: '1234', + type: 'track', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + device: { + adTrackingEnabled: 'true', + advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', + id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', + manufacturer: 'Google', + model: 'AOSP on IA Emulator', + name: 'generic_x86_arm', + type: 'ios', + attTrackingStatus: 3, + }, + ip: '0.0.0.0', + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + locale: 'en-US', + os: { + name: 'iOS', + version: '14.4.1', + }, + screen: { + density: 2, + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', + }, + event: 'Order complete', + properties: { + orderId: 111, + quantity: 999999, + revenue: 800, + rudder1: 100, + akash1: 5987, + }, + messageId: 'ea5cfab2-3961-4d8a-8187-3d1858c90a9f', + originalTimestamp: '2020-01-17T04:53:51.185Z', + receivedAt: '2020-01-17T10:23:52.688+05:30', + sentAt: '2020-01-17T04:53:52.667Z', + timestamp: '2020-01-17T10:23:51.206+05:30', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'GET', + endpoint: + 'https://ad.doubleclick.net/ddm/activity/src=12649566;cat=order0;type=conv000;dc_rdid=T0T0T072-5e28-45a1-9eda-ce22a3e36d1a;ord=ea5cfab2-3961-4d8a-8187-3d1858c90a9f;dc_lat=1;u1=100;u2=5987', + headers: { + 'User-Agent': + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', + }, + params: {}, + body: { + JSON: {}, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'dcm_floodlight', + description: 'Test 16', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + advertiserId: '12649566', + activityTag: 'check0', + groupTag: 'conv00', + conversionEvents: [ + { + customVariables: [ + { + to: '', + from: '', + }, + ], + eventName: 'Sign up Completed', + floodlightActivityTag: 'signu0', + floodlightGroupTag: 'conv01', + salesTag: false, + }, + { + customVariables: [ + { + to: '1', + from: 'rudder1', + }, + { + to: '2', + from: 'akash1', + }, + ], + eventName: 'Order Complete', + floodlightActivityTag: 'order0', + floodlightGroupTag: 'conv000', + salesTag: false, + }, + { + eventName: 'Checkout Started', + floodlightActivityTag: '', + floodlightGroupTag: '', + salesTag: true, + }, + { + customVariables: [ + { + to: '1', + from: 'rudder2', + }, + { + to: '2', + from: 'akash2', + }, + { + to: '3', + from: 'friendlyName2', + }, + { + to: '4', + from: 'name2', + }, + ], + eventName: 'Purchase', + floodlightActivityTag: 'Pur0', + floodlightGroupTag: 'conv111', + salesTag: false, + }, + ], + }, + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + }, + message: { + anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', + userId: '1234', + type: 'track', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + device: { + adTrackingEnabled: true, + advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', + id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', + manufacturer: 'Google', + model: 'AOSP on IA Emulator', + name: 'generic_x86_arm', + type: 'ios', + attTrackingStatus: 3, + }, + ip: '0.0.0.0', + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + locale: 'en-US', + os: { + name: 'iOS', + version: '14.4.1', + }, + screen: { + density: 2, + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', + }, + event: 'Order complete', + properties: { + orderId: 111, + quantity: 999999, + revenue: 800, + rudder1: 'rudder-v1', + akash1: 'akash-v1', + }, + integrations: { + All: true, + 'DCM Floodlight': { + COPPA: 1, + GDPR: 1, + npa: true, + }, + }, + messageId: 'ea5cfab2-3961-4d8a-8187-3d1858c90a9f', + originalTimestamp: '2020-01-17T04:53:51.185Z', + receivedAt: '2020-01-17T10:23:52.688+05:30', + sentAt: '2020-01-17T04:53:52.667Z', + timestamp: '2020-01-17T10:23:51.206+05:30', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'GET', + endpoint: + 'https://ad.doubleclick.net/ddm/activity/src=12649566;cat=order0;type=conv000;dc_rdid=T0T0T072-5e28-45a1-9eda-ce22a3e36d1a;ord=ea5cfab2-3961-4d8a-8187-3d1858c90a9f;dc_lat=1;tag_for_child_directed_treatment=1;tfua=1;npa=1;u1=rudder-v1;u2=akash-v1', + headers: { + 'User-Agent': + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', + }, + params: {}, + body: { + JSON: {}, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'dcm_floodlight', + description: 'Test 17', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + advertiserId: '12649566', + activityTag: 'check0', + groupTag: 'conv00', + conversionEvents: [ + { + customVariables: [ + { + to: '', + from: '', + }, + ], + eventName: 'Sign up Completed', + floodlightActivityTag: 'signu0', + floodlightGroupTag: 'conv01', + salesTag: false, + }, + { + customVariables: [ + { + to: '1', + from: 'rudder1', + }, + { + to: '2', + from: 'akash1', + }, + ], + eventName: 'Order Complete', + floodlightActivityTag: 'order0', + floodlightGroupTag: 'conv000', + salesTag: false, + }, + { + eventName: 'Checkout Started', + floodlightActivityTag: '', + floodlightGroupTag: '', + salesTag: true, + }, + { + customVariables: [ + { + to: '1', + from: 'rudder2', + }, + { + to: '2', + from: 'akash2', + }, + { + to: '3', + from: 'friendlyName2', + }, + { + to: '4', + from: 'name2', + }, + ], + eventName: 'Purchase', + floodlightActivityTag: 'Pur0', + floodlightGroupTag: 'conv111', + salesTag: false, + }, + ], + }, + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + }, + message: { + anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', + userId: '1234', + type: 'track', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + device: { + adTrackingEnabled: true, + advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', + id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', + manufacturer: 'Google', + model: 'AOSP on IA Emulator', + name: 'generic_x86_arm', + type: 'ios', + attTrackingStatus: 3, + }, + ip: '0.0.0.0', + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + locale: 'en-US', + os: { + name: 'iOS', + version: '14.4.1', + }, + screen: { + density: 2, + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', + }, + event: 'Order complete', + properties: { + orderId: 111, + quantity: 999999, + revenue: 800, + }, + integrations: { + All: true, + 'DCM Floodlight': { + COPPA: 'Yes', + GDPR: '1', + npa: true, + }, + }, + messageId: 'ea5cfab2-3961-4d8a-8187-3d1858c90a9f', + originalTimestamp: '2020-01-17T04:53:51.185Z', + receivedAt: '2020-01-17T10:23:52.688+05:30', + sentAt: '2020-01-17T04:53:52.667Z', + timestamp: '2020-01-17T10:23:51.206+05:30', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 400, + error: + 'COPPA: valid parameters are [1|true] or [0|false]: Workflow: procWorkflow, Step: handleIntegrationsObject, ChildStep: undefined, OriginalError: COPPA: valid parameters are [1|true] or [0|false]', + statTags: { + errorCategory: 'dataValidation', + errorType: 'instrumentation', + implementation: 'cdkV2', + destType: 'DCM_FLOODLIGHT', + module: 'destination', + feature: 'processor', + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + }, + { + name: 'dcm_floodlight', + description: 'Test 18', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + advertiserId: '12649566', + activityTag: 'check0', + groupTag: 'conv00', + conversionEvents: [ + { + customVariables: [ + { + to: '', + from: '', + }, + ], + eventName: 'Sign up Completed', + floodlightActivityTag: 'signu0', + floodlightGroupTag: 'conv01', + salesTag: false, + }, + { + customVariables: [ + { + to: '1', + from: 'rudder1', + }, + { + to: '2', + from: 'akash1', + }, + ], + eventName: 'Order Complete', + floodlightActivityTag: 'order0', + floodlightGroupTag: 'conv000', + salesTag: false, + }, + { + eventName: 'Checkout Started', + floodlightActivityTag: '', + floodlightGroupTag: '', + salesTag: true, + }, + { + customVariables: [ + { + to: '1', + from: 'rudder2', + }, + { + to: '2', + from: 'akash2', + }, + { + to: '3', + from: 'friendlyName2', + }, + { + to: '4', + from: 'name2', + }, + ], + eventName: 'Purchase', + floodlightActivityTag: 'Pur0', + floodlightGroupTag: 'conv111', + salesTag: false, + }, + ], + }, + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + }, + message: { + anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', + userId: '1234', + type: 'track', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + device: { + adTrackingEnabled: true, + advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', + id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', + manufacturer: 'Google', + model: 'AOSP on IA Emulator', + name: 'generic_x86_arm', + type: 'ios', + attTrackingStatus: 3, + }, + ip: '0.0.0.0', + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + locale: 'en-US', + os: { + name: 'iOS', + version: '14.4.1', + }, + screen: { + density: 2, + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', + }, + event: 'Order complete', + properties: { + orderId: 111, + quantity: 999999, + revenue: 800, + }, + integrations: { + All: true, + 'DCM Floodlight': { + COPPA: 'false', + GDPR: 'Yes', + npa: true, + }, + }, + messageId: 'ea5cfab2-3961-4d8a-8187-3d1858c90a9f', + originalTimestamp: '2020-01-17T04:53:51.185Z', + receivedAt: '2020-01-17T10:23:52.688+05:30', + sentAt: '2020-01-17T04:53:52.667Z', + timestamp: '2020-01-17T10:23:51.206+05:30', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 400, + error: + 'GDPR: valid parameters are [1|true] or [0|false]: Workflow: procWorkflow, Step: handleIntegrationsObject, ChildStep: undefined, OriginalError: GDPR: valid parameters are [1|true] or [0|false]', + statTags: { + errorCategory: 'dataValidation', + errorType: 'instrumentation', + implementation: 'cdkV2', + destType: 'DCM_FLOODLIGHT', + module: 'destination', + feature: 'processor', + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + }, + { + name: 'dcm_floodlight', + description: 'Test 19', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + advertiserId: '12649566', + activityTag: 'check0', + groupTag: 'conv00', + conversionEvents: [ + { + customVariables: [ + { + to: '', + from: '', + }, + ], + eventName: 'Sign up Completed', + floodlightActivityTag: 'signu0', + floodlightGroupTag: 'conv01', + salesTag: false, + }, + { + customVariables: [ + { + to: '1', + from: 'rudder1', + }, + { + to: '2', + from: 'akash1', + }, + ], + eventName: 'Order Complete', + floodlightActivityTag: 'order0', + floodlightGroupTag: 'conv000', + salesTag: false, + }, + { + eventName: 'Checkout Started', + floodlightActivityTag: '', + floodlightGroupTag: '', + salesTag: true, + }, + { + customVariables: [ + { + to: '1', + from: 'rudder2', + }, + { + to: '2', + from: 'akash2', + }, + { + to: '3', + from: 'friendlyName2', + }, + { + to: '4', + from: 'name2', + }, + ], + eventName: 'Purchase', + floodlightActivityTag: 'Pur0', + floodlightGroupTag: 'conv111', + salesTag: false, + }, + ], + }, + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + }, + message: { + anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', + userId: '1234', + type: 'track', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + device: { + adTrackingEnabled: true, + advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', + id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', + manufacturer: 'Google', + model: 'AOSP on IA Emulator', + name: 'generic_x86_arm', + type: 'ios', + attTrackingStatus: 3, + }, + ip: '0.0.0.0', + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + locale: 'en-US', + os: { + name: 'iOS', + version: '14.4.1', + }, + screen: { + density: 2, + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', + }, + event: 'Order complete', + properties: { + orderId: 111, + quantity: 999999, + revenue: 800, + }, + integrations: { + All: true, + 'DCM Floodlight': { + COPPA: 'false', + GDPR: '1', + npa: 'No', + }, + }, + messageId: 'ea5cfab2-3961-4d8a-8187-3d1858c90a9f', + originalTimestamp: '2020-01-17T04:53:51.185Z', + receivedAt: '2020-01-17T10:23:52.688+05:30', + sentAt: '2020-01-17T04:53:52.667Z', + timestamp: '2020-01-17T10:23:51.206+05:30', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 400, + error: + 'npa: valid parameters are [1|true] or [0|false]: Workflow: procWorkflow, Step: handleIntegrationsObject, ChildStep: undefined, OriginalError: npa: valid parameters are [1|true] or [0|false]', + statTags: { + errorCategory: 'dataValidation', + errorType: 'instrumentation', + implementation: 'cdkV2', + destType: 'DCM_FLOODLIGHT', + module: 'destination', + feature: 'processor', + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + }, + { + name: 'dcm_floodlight', + description: 'Test 20', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + advertiserId: '12649566', + activityTag: 'check0', + groupTag: 'conv00', + conversionEvents: [ + { + customVariables: [ + { + to: '', + from: '', + }, + ], + eventName: 'Sign up Completed', + floodlightActivityTag: 'signu0', + floodlightGroupTag: 'conv01', + salesTag: false, + }, + { + customVariables: [ + { + to: '1', + from: 'rudder1', + }, + { + to: '2', + from: 'akash1', + }, + ], + eventName: 'Order Complete', + floodlightActivityTag: 'order0', + floodlightGroupTag: 'conv000', + salesTag: false, + }, + { + eventName: 'Checkout Started', + floodlightActivityTag: '', + floodlightGroupTag: '', + salesTag: true, + }, + { + customVariables: [ + { + to: '1', + from: 'rudder2', + }, + { + to: '2', + from: 'akash2', + }, + { + to: '3', + from: 'friendlyName2', + }, + { + to: '4', + from: 'name2', + }, + ], + eventName: 'Purchase', + floodlightActivityTag: 'Pur0', + floodlightGroupTag: 'conv111', + salesTag: false, + }, + ], + }, + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + }, + message: { + anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', + userId: '1234', + type: 'track', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + device: { + adTrackingEnabled: 'Yes', + advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', + id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', + manufacturer: 'Google', + model: 'AOSP on IA Emulator', + name: 'generic_x86_arm', + type: 'ios', + attTrackingStatus: 3, + }, + ip: '0.0.0.0', + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + locale: 'en-US', + os: { + name: 'iOS', + version: '14.4.1', + }, + screen: { + density: 2, + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', + }, + event: 'Order complete', + properties: { + orderId: 111, + quantity: 999999, + revenue: 800, + }, + integrations: { + All: true, + 'DCM Floodlight': { + COPPA: 'false', + GDPR: '1', + npa: 'true', + }, + }, + messageId: 'ea5cfab2-3961-4d8a-8187-3d1858c90a9f', + originalTimestamp: '2020-01-17T04:53:51.185Z', + receivedAt: '2020-01-17T10:23:52.688+05:30', + sentAt: '2020-01-17T04:53:52.667Z', + timestamp: '2020-01-17T10:23:51.206+05:30', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 400, + error: + 'dc_lat: valid parameters are [1|true] or [0|false]: Workflow: procWorkflow, Step: cleanPayload, ChildStep: undefined, OriginalError: dc_lat: valid parameters are [1|true] or [0|false]', + statTags: { + errorCategory: 'dataValidation', + errorType: 'instrumentation', + implementation: 'cdkV2', + destType: 'DCM_FLOODLIGHT', + module: 'destination', + feature: 'processor', + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + }, + { + name: 'dcm_floodlight', + description: 'Test 21', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + advertiserId: '12649566', + activityTag: 'check0', + groupTag: 'conv00', + conversionEvents: [ + { + customVariables: [ + { + to: '', + from: '', + }, + ], + eventName: 'Sign up Completed', + floodlightActivityTag: 'signu0', + floodlightGroupTag: 'conv01', + salesTag: false, + }, + { + customVariables: [ + { + to: '1', + from: 'rudder1', + }, + { + to: '2', + from: 'akash1', + }, + ], + eventName: 'Order Complete', + floodlightActivityTag: 'order0', + floodlightGroupTag: 'conv000', + salesTag: false, + }, + { + eventName: 'Checkout Started', + floodlightActivityTag: '', + floodlightGroupTag: '', + salesTag: true, + }, + { + customVariables: [ + { + to: '1', + from: 'rudder2', + }, + { + to: '2', + from: 'akash2', + }, + { + to: '3', + from: 'friendlyName2', + }, + { + to: '4', + from: 'name2', + }, + ], + eventName: 'Purchase', + floodlightActivityTag: 'Pur0', + floodlightGroupTag: 'conv111', + salesTag: false, + }, + ], + }, + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + }, + message: { + anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', + userId: '1234', + type: 'page', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + device: { + adTrackingEnabled: 'Yes', + advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', + id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', + manufacturer: 'Google', + model: 'AOSP on IA Emulator', + name: 'generic_x86_arm', + type: 'ios', + attTrackingStatus: 3, + }, + ip: '0.0.0.0', + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + locale: 'en-US', + os: { + name: 'iOS', + version: '14.4.1', + }, + screen: { + density: 2, + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', + }, + properties: { + orderId: 111, + quantity: 999999, + revenue: 800, + }, + integrations: { + All: true, + 'DCM Floodlight': { + COPPA: 'false', + GDPR: '1', + npa: 'true', + }, + }, + messageId: 'ea5cfab2-3961-4d8a-8187-3d1858c90a9f', + originalTimestamp: '2020-01-17T04:53:51.185Z', + receivedAt: '2020-01-17T10:23:52.688+05:30', + sentAt: '2020-01-17T04:53:52.667Z', + timestamp: '2020-01-17T10:23:51.206+05:30', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 400, + error: + 'page:: Conversion event not found: Workflow: procWorkflow, Step: handleConversionEvents, ChildStep: undefined, OriginalError: page:: Conversion event not found', + statTags: { + errorCategory: 'dataValidation', + errorType: 'instrumentation', + implementation: 'cdkV2', + destType: 'DCM_FLOODLIGHT', + module: 'destination', + feature: 'processor', + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + }, + { + name: 'dcm_floodlight', + description: 'Test 22', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + advertiserId: '12649566', + activityTag: 'check0', + groupTag: 'conv00', + conversionEvents: [ + { + customVariables: [ + { + to: '', + from: '', + }, + ], + eventName: 'Viewed Sign up Completed Page', + floodlightActivityTag: 'signu0', + floodlightGroupTag: 'conv01', + salesTag: false, + }, + { + customVariables: [ + { + to: '1', + from: 'rudder1', + }, + { + to: '2', + from: 'akash1', + }, + ], + eventName: 'Order Complete', + floodlightActivityTag: 'order0', + floodlightGroupTag: 'conv000', + salesTag: false, + }, + { + eventName: 'Checkout Started', + floodlightActivityTag: '', + floodlightGroupTag: '', + salesTag: true, + }, + { + customVariables: [ + { + to: '1', + from: 'rudder2', + }, + { + to: '2', + from: 'akash2', + }, + { + to: '3', + from: 'friendlyName2', + }, + { + to: '4', + from: 'name2', + }, + ], + eventName: 'Purchase', + floodlightActivityTag: 'Pur0', + floodlightGroupTag: 'conv111', + salesTag: false, + }, + ], + }, + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + }, + message: { + anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', + userId: '1234', + type: 'page', + channel: 'web', + name: 'Sign up Completed', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + device: { + adTrackingEnabled: 'true', + advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', + id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', + manufacturer: 'Google', + model: 'AOSP on IA Emulator', + name: 'generic_x86_arm', + type: 'ios', + attTrackingStatus: 3, + }, + ip: '0.0.0.0', + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + locale: 'en-US', + os: { + name: 'iOS', + version: '14.4.1', + }, + screen: { + density: 2, + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', + }, + properties: { + orderId: 111, + quantity: 999999, + revenue: 800, + }, + integrations: { + All: true, + 'DCM Floodlight': { + COPPA: 'false', + GDPR: '1', + npa: 'true', + }, + }, + messageId: 'ea5cfab2-3961-4d8a-8187-3d1858c90a9f', + originalTimestamp: '2020-01-17T04:53:51.185Z', + receivedAt: '2020-01-17T10:23:52.688+05:30', + sentAt: '2020-01-17T04:53:52.667Z', + timestamp: '2020-01-17T10:23:51.206+05:30', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'GET', + endpoint: + 'https://ad.doubleclick.net/ddm/activity/src=12649566;cat=signu0;type=conv01;dc_rdid=T0T0T072-5e28-45a1-9eda-ce22a3e36d1a;ord=ea5cfab2-3961-4d8a-8187-3d1858c90a9f;dc_lat=1;tag_for_child_directed_treatment=0;tfua=1;npa=1', + headers: { + 'User-Agent': + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', + }, + params: {}, + body: { + JSON: {}, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'dcm_floodlight', + description: 'Test 23', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + advertiserId: '22448662', + activityTag: '', + groupTag: '', + conversionEvents: [ + { + customVariables: [ + { + from: 'rudder1', + to: '1', + }, + { + from: 'rudder2', + to: '2', + }, + ], + eventName: 'Product viewed', + floodlightActivityTag: 'signu01', + floodlightGroupTag: 'conv01', + salesTag: false, + }, + { + customVariables: [ + { + from: '', + to: '', + }, + ], + eventName: 'Order Complete', + floodlightActivityTag: 'signu01', + floodlightGroupTag: 'conv02', + salesTag: false, + }, + ], + }, + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + }, + message: { + anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', + userId: '1234', + type: 'track', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + device: { + adTrackingEnabled: 'true', + advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', + id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', + manufacturer: 'Google', + model: 'AOSP on IA Emulator', + name: 'generic_x86_arm', + type: 'ios', + attTrackingStatus: 3, + }, + ip: '0.0.0.0', + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + locale: 'en-US', + os: { + name: 'iOS', + version: '14.4.1', + }, + screen: { + density: 2, + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', + }, + event: 'Product viewed', + properties: { + orderId: 111, + quantity: 2, + revenue: 800, + }, + integrations: { + All: true, + 'DCM Floodlight': { + COPPA: 'false', + GDPR: '1', + npa: true, + }, + }, + messageId: 'ea5cfab2-3961-4d8a-8187-3d1858c90a9f', + originalTimestamp: '2020-01-17T04:53:51.185Z', + receivedAt: '2020-01-17T10:23:52.688+05:30', + sentAt: '2020-01-17T04:53:52.667Z', + timestamp: '2020-01-17T10:23:51.206+05:30', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'GET', + endpoint: + 'https://ad.doubleclick.net/ddm/activity/src=22448662;cat=signu01;type=conv01;dc_rdid=T0T0T072-5e28-45a1-9eda-ce22a3e36d1a;ord=ea5cfab2-3961-4d8a-8187-3d1858c90a9f;dc_lat=1;tag_for_child_directed_treatment=0;tfua=1;npa=1', + headers: { + 'User-Agent': + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', + }, + params: {}, + body: { + JSON: {}, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'dcm_floodlight', + description: 'Test 24', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + activityTag: '', + advertiserId: '12649566', + conversionEvents: [ + { + customVariables: [ + { + from: '', + to: '', + }, + ], + eventName: 'Sign up Completed', + floodlightActivityTag: 'signu0', + floodlightGroupTag: 'conv01', + salesTag: false, + }, + { + customVariables: [ + { + from: 'rudder1', + to: '1', + }, + { + from: 'akash1', + to: '2', + }, + ], + eventName: 'Order Complete', + floodlightActivityTag: 'order0', + floodlightGroupTag: 'conv000', + salesTag: false, + }, + { + customVariables: [ + { + from: '', + to: '', + }, + ], + eventName: 'Checkout Started', + floodlightActivityTag: 'check0', + floodlightGroupTag: 'conv00', + salesTag: true, + }, + { + customVariables: [ + { + to: '1', + from: 'rudder2', + }, + { + to: '2', + from: 'akash2', + }, + { + to: '3', + from: 'friendlyName2', + }, + { + to: '4', + from: 'name2', + }, + ], + eventName: 'Purchase', + floodlightActivityTag: 'Pur0', + floodlightGroupTag: 'conv111', + salesTag: false, + }, + ], + groupTag: '', + }, + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + }, + message: { + anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', + userId: '1234', + type: 'track', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + device: { + adTrackingEnabled: 'true', + advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', + id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', + manufacturer: 'Google', + model: 'AOSP on IA Emulator', + name: 'generic_x86_arm', + type: 'ios', + attTrackingStatus: 3, + }, + ip: '0.0.0.0', + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + locale: 'en-US', + os: { + name: 'iOS', + version: '14.4.1', + }, + screen: { + density: 2, + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', + }, + event: 'Purchase', + properties: { + orderId: 111, + quantity: 999999, + revenue: 800, + products: [ + { + sku: '45790-32', + url: 'https://www.example.com/product/path', + name: 'Monopoly: 3rd Edition', + price: 19, + category: 'Games', + quantity: 1, + image_url: 'https:///www.example.com/product/path.jpg', + product_id: '507f1f77bcf86cd799439011', + }, + { + sku: '46493-32', + name: 'Uno Card Game', + price: 3, + category: 'Games', + quantity: 2, + product_id: '505bd76785ebb509fc183733', + }, + ], + rudder2: 0, + akash2: 'akash2', + friendlyName2: false, + name2: '1234', + }, + integrations: { + All: true, + 'DCM Floodlight': { + COPPA: 'false', + GDPR: '1', + npa: true, + }, + }, + messageId: 'ea5cfab2-3961-4d8a-8187-3d1858c90a9f', + originalTimestamp: '2020-01-17T04:53:51.185Z', + receivedAt: '2020-01-17T10:23:52.688+05:30', + sentAt: '2020-01-17T04:53:52.667Z', + timestamp: '2020-01-17T10:23:51.206+05:30', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'GET', + endpoint: + 'https://ad.doubleclick.net/ddm/activity/src=12649566;cat=Pur0;type=conv111;dc_rdid=T0T0T072-5e28-45a1-9eda-ce22a3e36d1a;ord=ea5cfab2-3961-4d8a-8187-3d1858c90a9f;dc_lat=1;tag_for_child_directed_treatment=0;tfua=1;npa=1;u1=0;u2=akash2;u4=1234', + headers: { + 'User-Agent': + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', + }, + params: {}, + body: { + JSON: {}, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'dcm_floodlight', + description: 'Test 25', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + advertiserId: '12649566', + activityTag: 'check0', + groupTag: 'conv00', + conversionEvents: [ + { + customVariables: [ + { + to: '', + from: '', + }, + ], + eventName: 'Viewed Page', + floodlightActivityTag: 'signu0', + floodlightGroupTag: 'conv01', + salesTag: false, + }, + { + customVariables: [ + { + to: '1', + from: 'rudder1', + }, + { + to: '2', + from: 'akash1', + }, + ], + eventName: 'Order Complete', + floodlightActivityTag: 'order0', + floodlightGroupTag: 'conv000', + salesTag: false, + }, + { + eventName: 'Checkout Started', + floodlightActivityTag: '', + floodlightGroupTag: '', + salesTag: true, + }, + { + customVariables: [ + { + to: '1', + from: 'rudder2', + }, + { + to: '2', + from: 'akash2', + }, + { + to: '3', + from: 'friendlyName2', + }, + { + to: '4', + from: 'name2', + }, + ], + eventName: 'Purchase', + floodlightActivityTag: 'Pur0', + floodlightGroupTag: 'conv111', + salesTag: false, + }, + ], + }, + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + }, + message: { + anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', + userId: '1234', + type: 'page', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + device: { + adTrackingEnabled: 'true', + advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', + id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', + manufacturer: 'Google', + model: 'AOSP on IA Emulator', + name: 'generic_x86_arm', + type: 'ios', + attTrackingStatus: 3, + }, + ip: '0.0.0.0', + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + locale: 'en-US', + os: { + name: 'iOS', + version: '14.4.1', + }, + screen: { + density: 2, + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', + }, + properties: { + orderId: 111, + quantity: 999999, + revenue: 800, + }, + integrations: { + All: true, + 'DCM Floodlight': { + COPPA: 'false', + GDPR: '1', + npa: 'true', + }, + }, + messageId: 'ea5cfab2-3961-4d8a-8187-3d1858c90a9f', + originalTimestamp: '2020-01-17T04:53:51.185Z', + receivedAt: '2020-01-17T10:23:52.688+05:30', + sentAt: '2020-01-17T04:53:52.667Z', + timestamp: '2020-01-17T10:23:51.206+05:30', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'GET', + endpoint: + 'https://ad.doubleclick.net/ddm/activity/src=12649566;cat=signu0;type=conv01;dc_rdid=T0T0T072-5e28-45a1-9eda-ce22a3e36d1a;ord=ea5cfab2-3961-4d8a-8187-3d1858c90a9f;dc_lat=1;tag_for_child_directed_treatment=0;tfua=1;npa=1', + headers: { + 'User-Agent': + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', + }, + params: {}, + body: { + JSON: {}, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'dcm_floodlight', + description: 'Test 26', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + activityTag: '', + advertiserId: '12649566', + conversionEvents: [ + { + customVariables: [ + { + to: '', + from: '', + }, + ], + eventName: 'Sign up Completed', + floodlightActivityTag: 'signu0', + floodlightGroupTag: 'conv01', + salesTag: false, + }, + { + customVariables: [ + { + to: '1', + from: 'rudder1', + }, + { + to: '2', + from: 'akash1', + }, + ], + eventName: 'Order Complete', + floodlightActivityTag: 'order0', + floodlightGroupTag: 'conv000', + salesTag: false, + }, + { + customVariables: [ + { + to: '', + from: '', + }, + ], + eventName: 'Checkout Started', + floodlightActivityTag: 'check0', + floodlightGroupTag: 'conv00', + salesTag: true, + }, + { + customVariables: [ + { + to: '1', + from: 'rudder2', + }, + { + to: '2', + from: 'akash2', + }, + { + to: '3', + from: 'friendlyName2', + }, + { + to: '4', + from: 'name2', + }, + ], + eventName: 'Purchase', + floodlightActivityTag: 'Pur0', + floodlightGroupTag: 'conv111', + salesTag: false, + }, + ], + groupTag: '', + }, + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + }, + message: { + anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', + userId: '1234', + type: 'track', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + device: { + adTrackingEnabled: 'true', + advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', + id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', + manufacturer: 'Google', + model: 'AOSP on IA Emulator', + name: 'generic_x86_arm', + type: 'ios', + attTrackingStatus: 3, + brand: 'Google2', + }, + ip: '0.0.0.0', + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + locale: 'en-US', + os: { + name: 'iOS', + version: '14.4.1', + }, + screen: { + density: 2, + }, + traits: { + name2: 'traits-v1', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', + }, + event: 'Purchase', + properties: { + orderId: 111, + quantity: 999999, + revenue: 800, + products: [ + { + sku: '45790-32', + url: 'https://www.example.com/product/path', + name: 'Monopoly: 3rd Edition', + price: 19, + category: 'Games', + quantity: 1, + image_url: 'https:///www.example.com/product/path.jpg', + product_id: '507f1f77bcf86cd799439011', + }, + { + sku: '46493-32', + name: 'Uno Card Game', + price: 3, + category: 'Games', + quantity: 2, + product_id: '505bd76785ebb509fc183733', + }, + ], + rudder2: '0', + akash2: 'akash2', + friendlyName2: false, + }, + integrations: { + All: true, + 'DCM Floodlight': { + COPPA: 'false', + GDPR: '1', + npa: true, + }, + }, + messageId: 'ea5cfab2-3961-4d8a-8187-3d1858c90a9f', + originalTimestamp: '2020-01-17T04:53:51.185Z', + receivedAt: '2020-01-17T10:23:52.688+05:30', + sentAt: '2020-01-17T04:53:52.667Z', + timestamp: '2020-01-17T10:23:51.206+05:30', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'GET', + endpoint: + 'https://ad.doubleclick.net/ddm/activity/src=12649566;cat=Pur0;type=conv111;dc_rdid=T0T0T072-5e28-45a1-9eda-ce22a3e36d1a;ord=ea5cfab2-3961-4d8a-8187-3d1858c90a9f;dc_lat=1;tag_for_child_directed_treatment=0;tfua=1;npa=1;u1=0;u2=akash2;u4=traits-v1', + headers: { + 'User-Agent': + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', + }, + params: {}, + body: { + JSON: {}, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 200, + }, + ], + }, + }, + }, +]; diff --git a/test/integrations/destinations/dynamic_yield/processor/data.ts b/test/integrations/destinations/dynamic_yield/processor/data.ts new file mode 100644 index 0000000000..f72f1574f7 --- /dev/null +++ b/test/integrations/destinations/dynamic_yield/processor/data.ts @@ -0,0 +1,1041 @@ +export const data = [ + { + name: 'dynamic_yield', + description: 'Identify call without hashed email 21313123', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + anonymousId: '507f191e810c19729de860ea', + context: { + ip: '54.100.200.255', + sessionId: '16733896350494', + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.115 Safari/537.36', + }, + integrations: { + All: true, + }, + receivedAt: '2015-02-23T22:28:55.387Z', + sentAt: '2015-02-23T22:28:55.111Z', + timestamp: '2015-02-23T22:28:55.111Z', + traits: { + email: 'peter@example.com', + }, + type: 'identify', + userId: 'user0', + version: '1', + }, + destination: { + Config: { + apiKey: 'dummyApiKey', + hashEmail: true, + }, + DestinationDefinition: { Config: { cdkV2Enabled: true } }, + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 200, + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://dy-api.com/v2/collect/user/event', + headers: { + 'Content-Type': 'application/json', + 'DY-API-Key': 'dummyApiKey', + }, + params: {}, + body: { + JSON: { + user: { id: 'user0' }, + session: { custom: '16733896350494' }, + context: { device: { ip: '54.100.200.255' } }, + events: [ + { + name: 'Identify User', + properties: { + dyType: 'identify-v1', + hashedEmail: + 'f111db891a36b76df28abc74867e6c7248f796e045117f0cff27b6e2be25d2df', + }, + }, + ], + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + }, + ], + }, + }, + }, + { + name: 'dynamic_yield', + description: 'Identify call with hashed email', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + anonymousId: '507f191e810c19729de860ea', + context: { + ip: '54.100.200.255', + sessionId: '16733896350494', + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.115 Safari/537.36', + }, + integrations: { + All: true, + }, + receivedAt: '2015-02-23T22:28:55.387Z', + sentAt: '2015-02-23T22:28:55.111Z', + timestamp: '2015-02-23T22:28:55.111Z', + traits: { + email: 'f111db891a36b76df28abc74867e6c7248f796e045117f0cff27b6e2be25d2df', + }, + type: 'identify', + userId: 'user0', + version: '1', + }, + destination: { + Config: { + apiKey: 'dummyApiKey', + hashEmail: false, + }, + DestinationDefinition: { Config: { cdkV2Enabled: true } }, + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 200, + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://dy-api.com/v2/collect/user/event', + headers: { + 'Content-Type': 'application/json', + 'DY-API-Key': 'dummyApiKey', + }, + params: {}, + body: { + JSON: { + user: { id: 'user0' }, + session: { custom: '16733896350494' }, + context: { device: { ip: '54.100.200.255' } }, + events: [ + { + name: 'Identify User', + properties: { + dyType: 'identify-v1', + hashedEmail: + 'f111db891a36b76df28abc74867e6c7248f796e045117f0cff27b6e2be25d2df', + }, + }, + ], + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + }, + ], + }, + }, + }, + { + name: 'dynamic_yield', + description: 'Track call with Product Added event', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + context: { + traits: { + email: 'testone@gmail.com', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36', + ip: '54.100.200.255', + }, + type: 'track', + session_id: '16733896350494', + originalTimestamp: '2019-10-14T09:03:17.562Z', + anonymousId: '123456', + event: 'Product Added', + userId: 'testuserId1', + properties: { + product_id: '123', + sku: 'item-34454ga', + category: 'Games', + name: 'Game', + brand: 'Gamepro', + variant: '111', + price: 39.95, + quantity: 1, + coupon: 'DISC21', + position: 1, + url: 'https://www.website.com/product/path', + image_url: 'https://www.website.com/product/path.png', + }, + integrations: { + All: true, + }, + sentAt: '2019-10-14T09:03:22.563Z', + }, + destination: { + Config: { + apiKey: 'dummyApiKey', + hashEmail: false, + }, + DestinationDefinition: { Config: { cdkV2Enabled: true } }, + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 200, + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://dy-api.com/v2/collect/user/event', + headers: { + 'Content-Type': 'application/json', + 'DY-API-Key': 'dummyApiKey', + }, + params: {}, + body: { + JSON: { + user: { id: 'testuserId1' }, + session: { custom: '16733896350494' }, + context: { device: { ip: '54.100.200.255' } }, + events: [ + { + name: 'Add to Cart', + properties: { + dyType: 'add-to-cart-v1', + value: 39.95, + productId: 'item-34454ga', + quantity: 1, + }, + }, + ], + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + }, + ], + }, + }, + }, + { + name: 'dynamic_yield', + description: 'Identify call without email', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + anonymousId: '507f191e810c19729de860ea', + context: { + ip: '54.100.200.255', + sessionId: '16733896350494', + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.115 Safari/537.36', + }, + integrations: { + All: true, + }, + receivedAt: '2015-02-23T22:28:55.387Z', + sentAt: '2015-02-23T22:28:55.111Z', + timestamp: '2015-02-23T22:28:55.111Z', + traits: {}, + type: 'identify', + userId: 'user0', + version: '1', + }, + destination: { + Config: { + apiKey: 'dummyApiKey', + hashEmail: false, + }, + DestinationDefinition: { Config: { cdkV2Enabled: true } }, + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 200, + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://dy-api.com/v2/collect/user/event', + headers: { + 'Content-Type': 'application/json', + 'DY-API-Key': 'dummyApiKey', + }, + params: {}, + body: { + JSON: { + user: { id: 'user0' }, + session: { custom: '16733896350494' }, + context: { device: { ip: '54.100.200.255' } }, + events: [ + { + name: 'Identify User', + properties: { + dyType: 'identify-v1', + cuid: 'user0', + cuidType: 'userId', + }, + }, + ], + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + }, + ], + }, + }, + }, + { + name: 'dynamic_yield', + description: 'Track call with Product Removed event', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + context: { + traits: { + email: 'testone@gmail.com', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36', + ip: '54.100.200.255', + }, + type: 'track', + session_id: '16733896350494', + originalTimestamp: '2019-10-14T09:03:17.562Z', + anonymousId: '123456', + event: 'Product Removed', + userId: 'testuserId1', + properties: { + product_id: '123', + sku: 'item-34454ga', + category: 'Games', + name: 'Game', + brand: 'Gamepro', + variant: '111', + price: 39.95, + quantity: 1, + coupon: 'DISC21', + position: 1, + url: 'https://www.website.com/product/path', + image_url: 'https://www.website.com/product/path.png', + }, + integrations: { + All: true, + }, + sentAt: '2019-10-14T09:03:22.563Z', + }, + destination: { + Config: { + apiKey: 'dummyApiKey', + hashEmail: false, + }, + DestinationDefinition: { Config: { cdkV2Enabled: true } }, + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 200, + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://dy-api.com/v2/collect/user/event', + headers: { + 'Content-Type': 'application/json', + 'DY-API-Key': 'dummyApiKey', + }, + params: {}, + body: { + JSON: { + user: { id: 'testuserId1' }, + session: { custom: '16733896350494' }, + context: { device: { ip: '54.100.200.255' } }, + events: [ + { + name: 'Remove from Cart', + properties: { + dyType: 'remove-from-cart-v1', + value: 39.95, + productId: 'item-34454ga', + quantity: 1, + }, + }, + ], + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + }, + ], + }, + }, + }, + { + name: 'dynamic_yield', + description: 'Track call with Product Added to Wishlist event', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + context: { + traits: { + email: 'testone@gmail.com', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36', + ip: '54.100.200.255', + }, + type: 'track', + session_id: '16733896350494', + originalTimestamp: '2019-10-14T09:03:17.562Z', + anonymousId: '123456', + event: 'Product Added to Wishlist', + userId: 'testuserId1', + properties: { + product_id: '123', + sku: 'item-34454ga', + category: 'Games', + name: 'Game', + brand: 'Gamepro', + variant: '111', + price: 39.95, + quantity: 1, + coupon: 'DISC21', + position: 1, + url: 'https://www.website.com/product/path', + image_url: 'https://www.website.com/product/path.png', + }, + integrations: { + All: true, + }, + sentAt: '2019-10-14T09:03:22.563Z', + }, + destination: { + Config: { + apiKey: 'dummyApiKey', + hashEmail: false, + }, + DestinationDefinition: { Config: { cdkV2Enabled: true } }, + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 200, + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://dy-api.com/v2/collect/user/event', + headers: { + 'Content-Type': 'application/json', + 'DY-API-Key': 'dummyApiKey', + }, + params: {}, + body: { + JSON: { + user: { id: 'testuserId1' }, + session: { custom: '16733896350494' }, + context: { device: { ip: '54.100.200.255' } }, + events: [ + { + name: 'Add to Wishlist', + properties: { + dyType: 'add-to-wishlist-v1', + value: 39.95, + productId: 'item-34454ga', + quantity: 1, + }, + }, + ], + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + }, + ], + }, + }, + }, + { + name: 'dynamic_yield', + description: 'Track call with order completed event', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + context: { + traits: { + email: 'testone@gmail.com', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36', + ip: '54.100.200.255', + }, + type: 'track', + session_id: '16733896350494', + originalTimestamp: '2019-10-14T09:03:17.562Z', + anonymousId: '123456', + event: 'Order Completed', + userId: 'testuserId1', + properties: { + checkout_id: '12345', + order_id: '1234', + affiliation: 'Apple Store', + total: 20, + revenue: 15, + shipping: 4, + tax: 1, + discount: 1.5, + coupon: 'ImagePro', + currency: 'USD', + products: [ + { + product_id: '123', + sku: 'G-32', + name: 'Monopoly', + price: 14, + quantity: 1, + category: 'Games', + url: 'https://www.website.com/product/path', + image_url: 'https://www.website.com/product/path.jpg', + }, + { + product_id: '345', + sku: 'F-32', + name: 'UNO', + price: 3.45, + quantity: 2, + category: 'Games', + }, + ], + }, + integrations: { + All: true, + }, + sentAt: '2019-10-14T09:03:22.563Z', + }, + destination: { + Config: { + apiKey: 'dummyApiKey', + hashEmail: false, + }, + DestinationDefinition: { Config: { cdkV2Enabled: true } }, + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 200, + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://dy-api.com/v2/collect/user/event', + headers: { + 'Content-Type': 'application/json', + 'DY-API-Key': 'dummyApiKey', + }, + params: {}, + body: { + JSON: { + user: { id: 'testuserId1' }, + session: { custom: '16733896350494' }, + context: { device: { ip: '54.100.200.255' } }, + events: [ + { + name: 'Purchase', + properties: { + dyType: 'purchase-v1', + uniqueTransactionId: '1234', + value: 15, + currency: 'USD', + cart: [ + { + itemPrice: 14, + productId: 'G-32', + quantity: 1, + }, + { + itemPrice: 3.45, + productId: 'F-32', + quantity: 2, + }, + ], + }, + }, + ], + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + }, + ], + }, + }, + }, + { + name: 'dynamic_yield', + description: 'Unsupported group call check', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + anonymousId: '507f191e810c19729de860ea', + context: { + ip: '54.100.200.255', + sessionId: '16733896350494', + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.115 Safari/537.36', + }, + integrations: { + All: true, + }, + receivedAt: '2015-02-23T22:28:55.387Z', + sentAt: '2015-02-23T22:28:55.111Z', + timestamp: '2015-02-23T22:28:55.111Z', + traits: { + email: 'peter@example.com', + }, + type: 'group', + userId: 'user0', + version: '1', + }, + destination: { + Config: { + apiKey: 'dummyApiKey', + }, + DestinationDefinition: { Config: { cdkV2Enabled: true } }, + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 400, + error: + 'message type group is not supported: Workflow: procWorkflow, Step: validateInput, ChildStep: undefined, OriginalError: message type group is not supported', + statTags: { + destType: 'DYNAMIC_YIELD', + destinationId: 'destId', + errorCategory: 'dataValidation', + errorType: 'instrumentation', + feature: 'processor', + implementation: 'cdkV2', + module: 'destination', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + }, + { + name: 'dynamic_yield', + description: 'Event type not present', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + anonymousId: '507f191e810c19729de860ea', + context: { + ip: '54.100.200.255', + sessionId: '16733896350494', + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.115 Safari/537.36', + }, + integrations: { + All: true, + }, + receivedAt: '2015-02-23T22:28:55.387Z', + sentAt: '2015-02-23T22:28:55.111Z', + timestamp: '2015-02-23T22:28:55.111Z', + traits: { + email: 'peter@example.com', + }, + userId: 'user0', + version: '1', + }, + destination: { + Config: { + apiKey: 'dummyApiKey', + }, + DestinationDefinition: { Config: { cdkV2Enabled: true } }, + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 400, + error: + 'message Type is not present. Aborting message.: Workflow: procWorkflow, Step: validateInput, ChildStep: undefined, OriginalError: message Type is not present. Aborting message.', + statTags: { + destType: 'DYNAMIC_YIELD', + destinationId: 'destId', + errorCategory: 'dataValidation', + errorType: 'instrumentation', + feature: 'processor', + implementation: 'cdkV2', + module: 'destination', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + }, + { + name: 'dynamic_yield', + description: 'API Key not present', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + anonymousId: '507f191e810c19729de860ea', + type: 'identify', + context: { + ip: '54.100.200.255', + sessionId: '16733896350494', + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.115 Safari/537.36', + }, + integrations: { + All: true, + }, + receivedAt: '2015-02-23T22:28:55.387Z', + sentAt: '2015-02-23T22:28:55.111Z', + timestamp: '2015-02-23T22:28:55.111Z', + traits: { + email: 'peter@example.com', + }, + userId: 'user0', + version: '1', + }, + destination: { + Config: {}, + DestinationDefinition: { Config: { cdkV2Enabled: true } }, + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 400, + error: + 'Api Key is not present: Workflow: procWorkflow, Step: validateInput, ChildStep: undefined, OriginalError: Api Key is not present', + statTags: { + destType: 'DYNAMIC_YIELD', + destinationId: 'destId', + errorCategory: 'dataValidation', + errorType: 'instrumentation', + feature: 'processor', + implementation: 'cdkV2', + module: 'destination', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + }, + { + name: 'dynamic_yield', + description: 'Event is not there in input', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + context: { + traits: { + email: 'testone@gmail.com', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36', + ip: '54.100.200.255', + }, + type: 'track', + session_id: '16733896350494', + originalTimestamp: '2019-10-14T09:03:17.562Z', + anonymousId: '123456', + userId: 'testuserId1', + properties: { + product_id: '123', + sku: 'item-34454ga', + category: 'Games', + name: 'Game', + brand: 'Gamepro', + variant: '111', + price: 39.95, + quantity: 1, + coupon: 'DISC21', + position: 1, + url: 'https://www.website.com/product/path', + image_url: 'https://www.website.com/product/path.png', + }, + integrations: { + All: true, + }, + sentAt: '2019-10-14T09:03:22.563Z', + }, + destination: { + Config: { + apiKey: 'dummyApiKey', + }, + DestinationDefinition: { Config: { cdkV2Enabled: true } }, + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 400, + error: + 'event is not present. Aborting.: Workflow: procWorkflow, Step: validateInputForTrack, ChildStep: undefined, OriginalError: event is not present. Aborting.', + statTags: { + destType: 'DYNAMIC_YIELD', + destinationId: 'destId', + errorCategory: 'dataValidation', + errorType: 'instrumentation', + feature: 'processor', + implementation: 'cdkV2', + module: 'destination', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + }, +]; diff --git a/test/integrations/destinations/eloqua/processor/data.ts b/test/integrations/destinations/eloqua/processor/data.ts new file mode 100644 index 0000000000..50aad5639a --- /dev/null +++ b/test/integrations/destinations/eloqua/processor/data.ts @@ -0,0 +1,460 @@ +export const data = [ + { + name: 'eloqua', + description: 'identify payload pass', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + type: 'identify', + traits: { + C_FirstName: 'Test User', + C_patient_id1: 1, + C_MobilePhone: '+008822773355', + C_City: 'Scranton', + C_date_of_birth_1life1: '22/12/01', + }, + userId: 'testUser1234@keeptesting.com', + context: { + sources: { + job_id: '2RVkqlV1adBiIpj33kWlQzchMP1/Syncher', + version: 'v1.28.0', + job_run_id: 'cja699onfuet3te5obc0', + task_run_id: 'cja699onfuet3te5obcg', + }, + externalId: [ + { + id: 'testUser1234@keeptesting.com', + type: 'ELOQUA-contacts', + identifierType: 'C_EmailAddress', + }, + ], + mappedToDestination: 'true', + }, + recordId: '1', + rudderId: '3606d3c7-8741-4245-a254-450e137d3866', + messageId: '40def17a-1b6a-4d2d-a851-2a8d96f913bd', + }, + destination: { + Config: { + customerAccountId: '89236978', + customerId: '78678678', + audienceId: '564567', + hashEmail: false, + }, + DestinationDefinition: { Config: { cdkV2Enabled: true } }, + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: '', + headers: {}, + params: {}, + body: { + JSON: { + identifierFieldName: 'C_EmailAddress', + data: { + C_FirstName: 'Test User', + C_patient_id1: '1', + C_MobilePhone: '+008822773355', + C_City: 'Scranton', + C_date_of_birth_1life1: '22/12/01', + C_EmailAddress: 'testUser1234@keeptesting.com', + }, + customObjectId: 'contacts', + type: 'identify', + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + statusCode: 200, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + }, + { + name: 'eloqua', + description: 'type not correect', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + type: 'audiencelist', + traits: { + C_FirstName: 'Test User', + C_patient_id1: 1, + C_MobilePhone: '+008822773355', + C_City: 'Scranton', + C_date_of_birth_1life1: '22/12/01', + }, + userId: 'testUser1234@keeptesting.com', + context: { + sources: { + job_id: '2RVkqlV1adBiIpj33kWlQzchMP1/Syncher', + version: 'v1.28.0', + job_run_id: 'cja699onfuet3te5obc0', + task_run_id: 'cja699onfuet3te5obcg', + }, + externalId: [ + { + id: 'testUser1234@keeptesting.com', + type: 'ELOQUA-contacts', + identifierType: 'C_EmailAddress', + }, + ], + mappedToDestination: 'true', + }, + recordId: '1', + rudderId: '3606d3c7-8741-4245-a254-450e137d3866', + messageId: '40def17a-1b6a-4d2d-a851-2a8d96f913bd', + }, + destination: { + Config: { + customerAccountId: '89236978', + customerId: '78678678', + audienceId: '564567', + hashEmail: false, + }, + DestinationDefinition: { Config: { cdkV2Enabled: true } }, + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: + 'Event type audiencelist is not supported. Aborting message.: Workflow: procWorkflow, Step: validateInput, ChildStep: undefined, OriginalError: Event type audiencelist is not supported. Aborting message.', + statTags: { + destType: 'ELOQUA', + destinationId: 'destId', + errorCategory: 'dataValidation', + errorType: 'instrumentation', + feature: 'processor', + implementation: 'cdkV2', + module: 'destination', + workspaceId: 'wspId', + }, + statusCode: 400, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + }, + { + name: 'eloqua', + description: 'trits not correect', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + type: 'identify', + userId: 'testUser1234@keeptesting.com', + context: { + sources: { + job_id: '2RVkqlV1adBiIpj33kWlQzchMP1/Syncher', + version: 'v1.28.0', + job_run_id: 'cja699onfuet3te5obc0', + task_run_id: 'cja699onfuet3te5obcg', + }, + externalId: [ + { + id: 'testUser1234@keeptesting.com', + type: 'ELOQUA-contacts', + identifierType: 'C_EmailAddress', + }, + ], + mappedToDestination: 'true', + }, + recordId: '1', + rudderId: '3606d3c7-8741-4245-a254-450e137d3866', + messageId: '40def17a-1b6a-4d2d-a851-2a8d96f913bd', + }, + destination: { + Config: { + customerAccountId: '89236978', + customerId: '78678678', + audienceId: '564567', + hashEmail: false, + }, + DestinationDefinition: { Config: { cdkV2Enabled: true } }, + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: + 'Message traits/properties not present. Aborting message.: Workflow: procWorkflow, Step: validateInput, ChildStep: undefined, OriginalError: Message traits/properties not present. Aborting message.', + statTags: { + destType: 'ELOQUA', + destinationId: 'destId', + errorCategory: 'dataValidation', + errorType: 'instrumentation', + feature: 'processor', + implementation: 'cdkV2', + module: 'destination', + workspaceId: 'wspId', + }, + statusCode: 400, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + }, + { + name: 'eloqua', + description: 'identify payload pass 2', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + type: 'identify', + traits: { + C_FirstName: 'Test User', + C_patient_id1: 1, + C_MobilePhone: '+008822773355', + C_City: 'Scranton', + C_date_of_birth_1life1: '22/12/01', + }, + userId: 'testUser1234@keeptesting.com', + context: { + sources: { + job_id: '2RVkqlV1adBiIpj33kWlQzchMP1/Syncher', + version: 'v1.28.0', + job_run_id: 'cja699onfuet3te5obc0', + task_run_id: 'cja699onfuet3te5obcg', + }, + externalId: [ + { + id: 'testUser1234@keeptesting.com', + type: 'ELOQUA-contacts', + identifierType: 'C_EmailAddress', + }, + ], + mappedToDestination: 'true', + }, + recordId: '1', + rudderId: '3606d3c7-8741-4245-a254-450e137d3866', + messageId: '40def17a-1b6a-4d2d-a851-2a8d96f913bd', + }, + destination: { + Config: { + customerAccountId: '89236978', + customerId: '78678678', + audienceId: '564567', + hashEmail: false, + }, + DestinationDefinition: { Config: { cdkV2Enabled: true } }, + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: '', + headers: {}, + params: {}, + body: { + JSON: { + identifierFieldName: 'C_EmailAddress', + data: { + C_FirstName: 'Test User', + C_patient_id1: '1', + C_MobilePhone: '+008822773355', + C_City: 'Scranton', + C_date_of_birth_1life1: '22/12/01', + C_EmailAddress: 'testUser1234@keeptesting.com', + }, + customObjectId: 'contacts', + type: 'identify', + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + statusCode: 200, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + }, + { + name: 'eloqua', + description: 'track payload pass', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + type: 'track', + properties: { + key11: 'Test User', + key21: 1, + contactID11: '+008822773355', + }, + userId: 'testUser1234@keeptesting.com', + channel: 'sources', + context: { + sources: { + job_id: '2RVkqlV1adBiIpj33kWlQzchMP1/Syncher', + version: 'v1.28.0', + job_run_id: 'cja699onfuet3te5obc0', + task_run_id: 'cja699onfuet3te5obcg', + }, + externalId: [ + { + id: 'testUser1234@keeptesting.com', + type: 'ELOQUA-172', + identifierType: 'contactID1', + }, + ], + mappedToDestination: 'true', + }, + recordId: '1', + rudderId: '3606d3c7-8741-4245-a254-450e137d3866', + messageId: '40def17a-1b6a-4d2d-a851-2a8d96f913bd', + }, + destination: { + Config: { + customerAccountId: '89236978', + customerId: '78678678', + audienceId: '564567', + hashEmail: false, + }, + DestinationDefinition: { Config: { cdkV2Enabled: true } }, + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: '', + headers: {}, + params: {}, + body: { + JSON: { + identifierFieldName: 'contactID1', + data: { + key11: 'Test User', + key21: '1', + contactID11: '+008822773355', + contactID1: 'testUser1234@keeptesting.com', + }, + customObjectId: '172', + type: 'track', + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + statusCode: 200, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + }, +]; diff --git a/test/integrations/destinations/facebook_pixel/dataDelivery/data.ts b/test/integrations/destinations/facebook_pixel/dataDelivery/data.ts index d560658341..eb9ce344e0 100644 --- a/test/integrations/destinations/facebook_pixel/dataDelivery/data.ts +++ b/test/integrations/destinations/facebook_pixel/dataDelivery/data.ts @@ -1,3 +1,5 @@ +import { VERSION } from '../../../../../src/v0/destinations/facebook_pixel/config'; + export const data = [ { name: 'facebook_pixel', @@ -24,8 +26,7 @@ export const data = [ userId: '', headers: {}, version: '1', - endpoint: - 'https://graph.facebook.com/v17.0/1234567891234567/events?access_token=invalid_access_token', + endpoint: `https://graph.facebook.com/${VERSION}/1234567891234567/events?access_token=invalid_access_token`, params: { destination: 'facebook_pixel', }, @@ -89,8 +90,7 @@ export const data = [ userId: '', headers: {}, version: '1', - endpoint: - 'https://graph.facebook.com/v17.0/1234567891234567/events?access_token=my_access_token', + endpoint: `https://graph.facebook.com/${VERSION}/1234567891234567/events?access_token=my_access_token`, params: { destination: 'facebook_pixel', }, @@ -139,8 +139,7 @@ export const data = [ userId: '', headers: {}, version: '1', - endpoint: - 'https://graph.facebook.com/v17.0/1234567891234567/events?access_token=invalid_timestamp_correct_access_token', + endpoint: `https://graph.facebook.com/${VERSION}/1234567891234567/events?access_token=invalid_timestamp_correct_access_token`, params: { destination: 'facebook_pixel', }, @@ -209,8 +208,7 @@ export const data = [ userId: '', headers: {}, version: '1', - endpoint: - 'https://graph.facebook.com/v17.0/1234567891234567/events?access_token=throttled_valid_access_token', + endpoint: `https://graph.facebook.com/${VERSION}/1234567891234567/events?access_token=throttled_valid_access_token`, params: { destination: 'facebook_pixel', }, @@ -274,8 +272,7 @@ export const data = [ userId: '', headers: {}, version: '1', - endpoint: - 'https://graph.facebook.com/v17.0/1234567891234567/events?access_token=invalid_account_id_valid_access_token', + endpoint: `https://graph.facebook.com/${VERSION}/1234567891234567/events?access_token=invalid_account_id_valid_access_token`, params: { destination: 'facebook_pixel', }, @@ -342,8 +339,7 @@ export const data = [ userId: '', headers: {}, version: '1', - endpoint: - 'https://graph.facebook.com/v17.0/1234567891234567/events?access_token=not_found_access_token', + endpoint: `https://graph.facebook.com/${VERSION}/1234567891234567/events?access_token=not_found_access_token`, params: { destination: 'facebook_pixel', }, @@ -411,8 +407,7 @@ export const data = [ userId: '', headers: {}, version: '1', - endpoint: - 'https://graph.facebook.com/v17.0/1234567891234570/events?access_token=valid_access_token', + endpoint: `https://graph.facebook.com/${VERSION}/1234567891234570/events?access_token=valid_access_token`, }, method: 'POST', }, @@ -477,8 +472,7 @@ export const data = [ userId: '', headers: {}, version: '1', - endpoint: - 'https://graph.facebook.com/v17.0/1234567891234571/events?access_token=valid_access_token', + endpoint: `https://graph.facebook.com/${VERSION}/1234567891234571/events?access_token=valid_access_token`, }, method: 'POST', }, @@ -543,8 +537,7 @@ export const data = [ userId: '', headers: {}, version: '1', - endpoint: - 'https://graph.facebook.com/v17.0/1234567891234572/events?access_token=valid_access_token_unhandled_response', + endpoint: `https://graph.facebook.com/${VERSION}/1234567891234572/events?access_token=valid_access_token_unhandled_response`, }, method: 'POST', }, diff --git a/test/integrations/destinations/facebook_pixel/network.ts b/test/integrations/destinations/facebook_pixel/network.ts index a63970c4c6..05b3a05fd0 100644 --- a/test/integrations/destinations/facebook_pixel/network.ts +++ b/test/integrations/destinations/facebook_pixel/network.ts @@ -1,10 +1,11 @@ import { data } from './dataDelivery/data'; import { getFormData } from '../../../../src/adapters/network'; +import { VERSION } from '../../../../src/v0/destinations/facebook_pixel/config'; export const networkCallsData = [ { httpReq: { - url: 'https://graph.facebook.com/v17.0/1234567891234567/events?access_token=invalid_access_token', + url: `https://graph.facebook.com/${VERSION}/1234567891234567/events?access_token=invalid_access_token`, data: getFormData(data[0].input.request.body.body.FORM).toString(), params: { destination: 'facebook_pixel' }, headers: { 'User-Agent': 'RudderLabs' }, @@ -24,7 +25,7 @@ export const networkCallsData = [ }, { httpReq: { - url: 'https://graph.facebook.com/v17.0/1234567891234567/events?access_token=invalid_timestamp_correct_access_token', + url: `https://graph.facebook.com/${VERSION}/1234567891234567/events?access_token=invalid_timestamp_correct_access_token`, data: getFormData(data[2].input.request.body.body.FORM).toString(), params: { destination: 'facebook_pixel' }, headers: { 'User-Agent': 'RudderLabs' }, @@ -49,7 +50,7 @@ export const networkCallsData = [ }, { httpReq: { - url: 'https://graph.facebook.com/v17.0/1234567891234567/events?access_token=throttled_valid_access_token', + url: `https://graph.facebook.com/${VERSION}/1234567891234567/events?access_token=throttled_valid_access_token`, data: getFormData(data[3].input.request.body.body.FORM).toString(), params: { destination: 'facebook_pixel' }, headers: { 'User-Agent': 'RudderLabs' }, @@ -69,7 +70,7 @@ export const networkCallsData = [ }, { httpReq: { - url: 'https://graph.facebook.com/v17.0/1234567891234567/events?access_token=invalid_account_id_valid_access_token', + url: `https://graph.facebook.com/${VERSION}/1234567891234567/events?access_token=invalid_account_id_valid_access_token`, data: getFormData(data[4].input.request.body.body.FORM).toString(), params: { destination: 'facebook_pixel' }, headers: { 'User-Agent': 'RudderLabs' }, @@ -91,7 +92,7 @@ export const networkCallsData = [ }, { httpReq: { - url: 'https://graph.facebook.com/v17.0/1234567891234567/events?access_token=not_found_access_token', + url: `https://graph.facebook.com/${VERSION}/1234567891234567/events?access_token=not_found_access_token`, data: getFormData(data[5].input.request.body.body.FORM).toString(), params: { destination: 'facebook_pixel' }, headers: { 'User-Agent': 'RudderLabs' }, @@ -112,7 +113,7 @@ export const networkCallsData = [ }, { httpReq: { - url: 'https://graph.facebook.com/v17.0/1234567891234570/events?access_token=valid_access_token', + url: `https://graph.facebook.com/${VERSION}/1234567891234570/events?access_token=valid_access_token`, data: getFormData(data[6].input.request.body.body.FORM).toString(), params: { destination: 'facebook_pixel' }, headers: { 'User-Agent': 'RudderLabs' }, @@ -133,7 +134,7 @@ export const networkCallsData = [ }, { httpReq: { - url: 'https://graph.facebook.com/v17.0/1234567891234571/events?access_token=valid_access_token', + url: `https://graph.facebook.com/${VERSION}/1234567891234571/events?access_token=valid_access_token`, data: getFormData(data[7].input.request.body.body.FORM).toString(), params: { destination: 'facebook_pixel' }, headers: { 'User-Agent': 'RudderLabs' }, @@ -154,7 +155,7 @@ export const networkCallsData = [ }, { httpReq: { - url: 'https://graph.facebook.com/v17.0/1234567891234572/events?access_token=valid_access_token_unhandled_response', + url: `https://graph.facebook.com/${VERSION}/1234567891234572/events?access_token=valid_access_token_unhandled_response`, data: getFormData(data[8].input.request.body.body.FORM).toString(), params: { destination: 'facebook_pixel' }, headers: { 'User-Agent': 'RudderLabs' }, @@ -175,7 +176,7 @@ export const networkCallsData = [ }, { httpReq: { - url: 'https://graph.facebook.com/v17.0/1234567891234567/events?access_token=my_access_token', + url: `https://graph.facebook.com/${VERSION}/1234567891234567/events?access_token=my_access_token`, data: getFormData(data[1].input.request.body.body.FORM).toString(), params: { destination: 'facebook_pixel' }, headers: { 'User-Agent': 'RudderLabs' }, diff --git a/test/integrations/destinations/facebook_pixel/processor/data.ts b/test/integrations/destinations/facebook_pixel/processor/data.ts index d5d0a8ec96..557bc7066c 100644 --- a/test/integrations/destinations/facebook_pixel/processor/data.ts +++ b/test/integrations/destinations/facebook_pixel/processor/data.ts @@ -1,3 +1,5 @@ +import { VERSION } from '../../../../../src/v0/destinations/facebook_pixel/config'; + export const mockFns = (_) => { // @ts-ignore jest.useFakeTimers().setSystemTime(new Date('2023-10-15')); @@ -106,7 +108,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/dummyPixelId/events?access_token=09876', + endpoint: `https://graph.facebook.com/${VERSION}/dummyPixelId/events?access_token=09876`, headers: {}, params: {}, body: { @@ -445,7 +447,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/dummyPixelId/events?access_token=09876', + endpoint: `https://graph.facebook.com/${VERSION}/dummyPixelId/events?access_token=09876`, headers: {}, params: {}, body: { @@ -569,7 +571,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/dummyPixelId/events?access_token=09876', + endpoint: `https://graph.facebook.com/${VERSION}/dummyPixelId/events?access_token=09876`, headers: {}, params: {}, body: { @@ -688,7 +690,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/dummyPixelId/events?access_token=09876', + endpoint: `https://graph.facebook.com/${VERSION}/dummyPixelId/events?access_token=09876`, headers: {}, params: {}, body: { @@ -807,7 +809,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/dummyPixelId/events?access_token=09876', + endpoint: `https://graph.facebook.com/${VERSION}/dummyPixelId/events?access_token=09876`, headers: {}, params: {}, body: { @@ -927,7 +929,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/dummyPixelId/events?access_token=09876', + endpoint: `https://graph.facebook.com/${VERSION}/dummyPixelId/events?access_token=09876`, headers: {}, params: {}, body: { @@ -1047,7 +1049,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/dummyPixelId/events?access_token=09876', + endpoint: `https://graph.facebook.com/${VERSION}/dummyPixelId/events?access_token=09876`, headers: {}, params: {}, body: { @@ -1166,7 +1168,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/dummyPixelId/events?access_token=09876', + endpoint: `https://graph.facebook.com/${VERSION}/dummyPixelId/events?access_token=09876`, headers: {}, params: {}, body: { @@ -1284,7 +1286,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/dummyPixelId/events?access_token=09876', + endpoint: `https://graph.facebook.com/${VERSION}/dummyPixelId/events?access_token=09876`, headers: {}, params: {}, body: { @@ -1419,7 +1421,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/dummyPixelId/events?access_token=09876', + endpoint: `https://graph.facebook.com/${VERSION}/dummyPixelId/events?access_token=09876`, headers: {}, params: {}, body: { @@ -1554,7 +1556,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/dummyPixelId/events?access_token=09876', + endpoint: `https://graph.facebook.com/${VERSION}/dummyPixelId/events?access_token=09876`, headers: {}, params: {}, body: { @@ -1705,7 +1707,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/dummyPixelId/events?access_token=09876', + endpoint: `https://graph.facebook.com/${VERSION}/dummyPixelId/events?access_token=09876`, headers: {}, params: {}, body: { @@ -1855,7 +1857,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/dummyPixelId/events?access_token=09876', + endpoint: `https://graph.facebook.com/${VERSION}/dummyPixelId/events?access_token=09876`, headers: {}, params: {}, body: { @@ -1984,7 +1986,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/dummyPixelId/events?access_token=09876', + endpoint: `https://graph.facebook.com/${VERSION}/dummyPixelId/events?access_token=09876`, headers: {}, params: {}, body: { @@ -2106,7 +2108,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/dummyPixelId/events?access_token=09876', + endpoint: `https://graph.facebook.com/${VERSION}/dummyPixelId/events?access_token=09876`, headers: {}, params: {}, body: { @@ -2249,7 +2251,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/dummyPixelId/events?access_token=09876', + endpoint: `https://graph.facebook.com/${VERSION}/dummyPixelId/events?access_token=09876`, headers: {}, params: {}, body: { @@ -2392,7 +2394,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/dummyPixelId/events?access_token=09876', + endpoint: `https://graph.facebook.com/${VERSION}/dummyPixelId/events?access_token=09876`, headers: {}, params: {}, body: { @@ -2516,7 +2518,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/dummyPixelId/events?access_token=09876', + endpoint: `https://graph.facebook.com/${VERSION}/dummyPixelId/events?access_token=09876`, headers: {}, params: {}, body: { @@ -2640,7 +2642,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/dummyPixelId/events?access_token=09876', + endpoint: `https://graph.facebook.com/${VERSION}/dummyPixelId/events?access_token=09876`, headers: {}, params: {}, body: { @@ -2768,7 +2770,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/dummyPixelId/events?access_token=09876', + endpoint: `https://graph.facebook.com/${VERSION}/dummyPixelId/events?access_token=09876`, headers: {}, params: {}, body: { @@ -2893,7 +2895,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/dummyPixelId/events?access_token=09876', + endpoint: `https://graph.facebook.com/${VERSION}/dummyPixelId/events?access_token=09876`, headers: {}, params: {}, body: { @@ -3014,7 +3016,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/dummyPixelId/events?access_token=09876', + endpoint: `https://graph.facebook.com/${VERSION}/dummyPixelId/events?access_token=09876`, headers: {}, params: {}, body: { @@ -3133,7 +3135,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/dummyPixelId/events?access_token=09876', + endpoint: `https://graph.facebook.com/${VERSION}/dummyPixelId/events?access_token=09876`, headers: {}, params: {}, body: { @@ -3282,7 +3284,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/dummyPixelId/events?access_token=09876', + endpoint: `https://graph.facebook.com/${VERSION}/dummyPixelId/events?access_token=09876`, headers: {}, params: {}, body: { @@ -3510,7 +3512,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/dummyPixelId/events?access_token=09876', + endpoint: `https://graph.facebook.com/${VERSION}/dummyPixelId/events?access_token=09876`, headers: {}, params: {}, body: { @@ -3631,7 +3633,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/dummyPixelId/events?access_token=09876', + endpoint: `https://graph.facebook.com/${VERSION}/dummyPixelId/events?access_token=09876`, headers: {}, params: {}, body: { @@ -3884,7 +3886,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/dummyPixelId/events?access_token=09876', + endpoint: `https://graph.facebook.com/${VERSION}/dummyPixelId/events?access_token=09876`, headers: {}, params: {}, body: { @@ -4027,7 +4029,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/dummyPixelId/events?access_token=09876', + endpoint: `https://graph.facebook.com/${VERSION}/dummyPixelId/events?access_token=09876`, headers: {}, params: {}, body: { @@ -4289,7 +4291,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/dummyPixelId/events?access_token=09876', + endpoint: `https://graph.facebook.com/${VERSION}/dummyPixelId/events?access_token=09876`, headers: {}, params: {}, body: { @@ -4752,7 +4754,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/dummyPixelId/events?access_token=09876', + endpoint: `https://graph.facebook.com/${VERSION}/dummyPixelId/events?access_token=09876`, headers: {}, params: {}, body: { @@ -4897,7 +4899,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/dummyPixelId/events?access_token=09876', + endpoint: `https://graph.facebook.com/${VERSION}/dummyPixelId/events?access_token=09876`, headers: {}, params: {}, body: { @@ -5178,7 +5180,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/dummyPixelId/events?access_token=09876', + endpoint: `https://graph.facebook.com/${VERSION}/dummyPixelId/events?access_token=09876`, headers: {}, params: {}, body: { @@ -5310,7 +5312,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/dummyPixelId/events?access_token=09876', + endpoint: `https://graph.facebook.com/${VERSION}/dummyPixelId/events?access_token=09876`, headers: {}, params: {}, body: { @@ -5440,7 +5442,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/dummyPixelId/events?access_token=09876', + endpoint: `https://graph.facebook.com/${VERSION}/dummyPixelId/events?access_token=09876`, headers: {}, params: {}, body: { @@ -6032,8 +6034,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: - 'https://graph.facebook.com/v17.0/dummyPixelId/events?access_token=dummyAccessToken', + endpoint: `https://graph.facebook.com/${VERSION}/dummyPixelId/events?access_token=dummyAccessToken`, headers: {}, params: {}, body: { @@ -6058,4 +6059,405 @@ export const data = [ }, }, }, + { + name: 'facebook_pixel', + description: 'Test 48', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + traits: { + email: 'test@rudderstack.com', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36', + locale: 'en-US', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + }, + type: 'track', + messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', + originalTimestamp: '2023-10-14T15:46:51.693229+05:30', + anonymousId: '00000000000000000000000000', + userId: '12345', + event: 'order completed', + properties: { + category: ['clothing', 'fishing'], + order_id: 'rudderstackorder1', + total: 99.99, + revenue: 12.24, + shipping: 13.99, + tax: 20.99, + currency: 'INR', + products: [ + { + quantity: 1, + price: 24.75, + name: 'my product', + sku: 'p-298', + delivery_category: 'home_delivery', + }, + { + quantity: 3, + price: 24.75, + name: 'other product', + sku: 'p-299', + delivery_category: 'home_delivery', + }, + ], + }, + integrations: { + All: true, + }, + sentAt: '2019-10-14T11:15:53.296Z', + }, + destination: { + Config: { + blacklistPiiProperties: [ + { + blacklistPiiProperties: '', + blacklistPiiHash: true, + }, + ], + categoryToContent: [ + { + from: 'clothing', + to: 'product', + }, + ], + accessToken: '09876', + pixelId: 'dummyPixelId', + eventsToEvents: [ + { + from: '', + to: '', + }, + ], + eventCustomProperties: [ + { + eventCustomProperties: '', + }, + ], + valueFieldIdentifier: 'properties.price', + advancedMapping: false, + whitelistPiiProperties: [ + { + whitelistPiiProperties: '', + }, + ], + }, + Enabled: true, + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: `https://graph.facebook.com/${VERSION}/dummyPixelId/events?access_token=09876`, + headers: {}, + params: {}, + body: { + JSON: {}, + JSON_ARRAY: {}, + XML: {}, + FORM: { + data: [ + '{"user_data":{"external_id":"5994471abb01112afcc18159f6cc74b4f511b99806da59b3caf5a9c173cacfc5","em":"1c5e54849f5c711ce38fa60716fbbe44bff478f9ca250897b39cdfc2438cd1bd","client_user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36"},"event_name":"Purchase","event_time":1697278611,"event_id":"ec5481b6-a926-4d2e-b293-0b3a77c4d3be","action_source":"website","custom_data":{"category[0]":"clothing","category[1]":"fishing","order_id":"rudderstackorder1","total":99.99,"revenue":12.24,"shipping":13.99,"tax":20.99,"currency":"INR","products[0].quantity":1,"products[0].price":24.75,"products[0].name":"my product","products[0].sku":"p-298","products[0].delivery_category":"home_delivery","products[1].quantity":3,"products[1].price":24.75,"products[1].name":"other product","products[1].sku":"p-299","products[1].delivery_category":"home_delivery","content_category":"clothing,fishing","content_ids":["p-298","p-299"],"content_type":"product","value":12.24,"contents":[{"id":"p-298","quantity":1,"item_price":24.75,"delivery_category":"home_delivery"},{"id":"p-299","quantity":3,"item_price":24.75,"delivery_category":"home_delivery"}],"num_items":2}}', + ], + }, + }, + files: {}, + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'facebook_pixel', + description: 'Test 49', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + anonymousId: 'c82cbdff-e5be-4009-ac78-cdeea09ab4b1', + channel: 'mobile', + destination_props: { + Fb: { + app_id: 'RudderFbApp', + }, + }, + context: { + device: { + id: 'df16bffa-5c3d-4fbb-9bce-3bab098129a7R', + manufacturer: 'Xiaomi', + model: 'Redmi 6', + name: 'xiaomi', + }, + network: { + carrier: 'Banglalink', + }, + os: { + name: 'android', + version: '8.1.0', + }, + screen: { + height: '100', + density: 50, + }, + traits: { + email: ' aBc@gmail.com ', + address: { + zip: 1234, + }, + anonymousId: 'c82cbdff-e5be-4009-ac78-cdeea09ab4b1', + }, + }, + event: 'spin_result', + integrations: { + All: true, + }, + message_id: 'a80f82be-9bdc-4a9f-b2a5-15621ee41df8', + properties: { + revenue: 400, + additional_bet_index: 0, + content_ids: ['prod1', 'prod2'], + }, + timestamp: '2023-10-14T00:00:00.693229+05:30', + type: 'track', + }, + destination: { + Config: { + limitedDataUsage: true, + blacklistPiiProperties: [ + { + blacklistPiiProperties: '', + blacklistPiiHash: false, + }, + ], + accessToken: '09876', + pixelId: 'dummyPixelId', + eventsToEvents: [ + { + from: '', + to: '', + }, + ], + eventCustomProperties: [ + { + eventCustomProperties: '', + }, + ], + removeExternalId: true, + valueFieldIdentifier: '', + advancedMapping: false, + whitelistPiiProperties: [ + { + whitelistPiiProperties: '', + }, + ], + }, + Enabled: true, + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: `https://graph.facebook.com/${VERSION}/dummyPixelId/events?access_token=09876`, + headers: {}, + params: {}, + body: { + JSON: {}, + JSON_ARRAY: {}, + XML: {}, + FORM: { + data: [ + '{"user_data":{"em":"48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08","zp":"03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4"},"event_name":"spin_result","event_time":1697221800,"action_source":"app","custom_data":{"additional_bet_index":0,"value":400,"content_ids":["prod1","prod2"]}}', + ], + }, + }, + files: {}, + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'facebook_pixel', + description: 'Test 50', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + anonymousId: 'c82cbdff-e5be-4009-ac78-cdeea09ab4b1', + channel: 'mobile', + destination_props: { + Fb: { + app_id: 'RudderFbApp', + }, + }, + context: { + device: { + id: 'df16bffa-5c3d-4fbb-9bce-3bab098129a7R', + manufacturer: 'Xiaomi', + model: 'Redmi 6', + name: 'xiaomi', + }, + network: { + carrier: 'Banglalink', + }, + os: { + name: 'android', + version: '8.1.0', + }, + screen: { + height: '100', + density: 50, + }, + traits: { + email: ' aBc@gmail.com ', + address: { + zip: 1234, + }, + anonymousId: 'c82cbdff-e5be-4009-ac78-cdeea09ab4b1', + }, + }, + event: 'spin_result', + integrations: { + All: true, + }, + message_id: 'a80f82be-9bdc-4a9f-b2a5-15621ee41df8', + properties: { + revenue: 400, + additional_bet_index: 0, + contents: [ + { + id: 'prod1', + quantity: 5, + item_price: 55, + }, + ], + }, + timestamp: '2023-10-14T00:00:00.693229+05:30', + type: 'track', + }, + destination: { + Config: { + limitedDataUsage: true, + blacklistPiiProperties: [ + { + blacklistPiiProperties: '', + blacklistPiiHash: false, + }, + ], + accessToken: '09876', + pixelId: 'dummyPixelId', + eventsToEvents: [ + { + from: '', + to: '', + }, + ], + eventCustomProperties: [ + { + eventCustomProperties: '', + }, + ], + removeExternalId: true, + valueFieldIdentifier: '', + advancedMapping: false, + whitelistPiiProperties: [ + { + whitelistPiiProperties: '', + }, + ], + }, + Enabled: true, + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: `https://graph.facebook.com/${VERSION}/dummyPixelId/events?access_token=09876`, + headers: {}, + params: {}, + body: { + JSON: {}, + JSON_ARRAY: {}, + XML: {}, + FORM: { + data: [ + '{"user_data":{"em":"48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08","zp":"03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4"},"event_name":"spin_result","event_time":1697221800,"action_source":"app","custom_data":{"additional_bet_index":0,"value":400,"contents":[{"id":"prod1","quantity":5,"item_price":55}]}}', + ], + }, + }, + files: {}, + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, ].map((d) => ({ ...d, mockFns })); diff --git a/test/integrations/destinations/facebook_pixel/router/data.ts b/test/integrations/destinations/facebook_pixel/router/data.ts index ef6b9f8635..ee2f6968b1 100644 --- a/test/integrations/destinations/facebook_pixel/router/data.ts +++ b/test/integrations/destinations/facebook_pixel/router/data.ts @@ -1,3 +1,5 @@ +import { VERSION } from '../../../../../src/v0/destinations/facebook_pixel/config'; + export const mockFns = (_) => { // @ts-ignore jest.useFakeTimers().setSystemTime(new Date('2023-10-15')); @@ -193,7 +195,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/dummyPixelId/events?access_token=09876', + endpoint: `https://graph.facebook.com/${VERSION}/dummyPixelId/events?access_token=09876`, headers: {}, params: {}, body: { @@ -254,7 +256,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/dummyPixelId/events?access_token=09876', + endpoint: `https://graph.facebook.com/${VERSION}/dummyPixelId/events?access_token=09876`, headers: {}, params: {}, body: { diff --git a/test/integrations/destinations/fb/dataDelivery/data.ts b/test/integrations/destinations/fb/dataDelivery/data.ts index c50cffee80..f9405ba4b3 100644 --- a/test/integrations/destinations/fb/dataDelivery/data.ts +++ b/test/integrations/destinations/fb/dataDelivery/data.ts @@ -1,357 +1,372 @@ +import { VERSION } from '../../../../../src/v0/destinations/fb/config'; + export const data = [ { - "name": "fb", - "description": "Test 0", - "feature": "dataDelivery", - "module": "destination", - "version": "v0", - "input": { - "request": { - "body": { - "body": { - "XML": {}, - "JSON_ARRAY": {}, - "FORM": { - "event": "CUSTOM_APP_EVENTS", - "advertiser_id": "df16bffa-5c3d-4fbb-9bce-3bab098129a7R", - "ud[em]": "48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08", - "ud[fn]": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08", - "ud[ge]": "62c66a7a5dd70c3146618063c344e531e6d4b59e379808443ce962b3abd63c5a", - "ud[ln]": "3547cb112ac4489af2310c0626cdba6f3097a2ad5a3b42ddd3b59c76c7a079a3", - "ud[ph]": "588211a01b10feacbf7988d97a06e86c18af5259a7f457fd8759b7f7409a7d1f", - "extinfo": "[\"a2\",\"\",\"\",\"\",\"8.1.0\",\"Redmi 6\",\"\",\"\",\"Banglalink\",640,480,\"1.23\",0,0,0,\"Europe/Berlin\"]", - "app_user_id": "c82cbdff-e5be-4009-ac78-cdeea09ab4b1", - "custom_events": "[{\"_logTime\":1567333011693,\"_eventName\":\"spin_result\",\"_valueToSum\":400,\"fb_currency\":\"GBP\",\"additional_bet_index\":0,\"battle_id\":\"N/A\",\"bet_amount\":9,\"bet_level\":1,\"bet_multiplier\":1,\"coin_balance\":9466052,\"current_module_name\":\"CasinoGameModule\",\"days_in_game\":0,\"extra_param\":\"N/A\",\"fb_profile\":\"0\",\"featureGameType\":\"N/A\",\"game_fps\":30,\"game_id\":\"fireEagleBase\",\"game_name\":\"FireEagleSlots\",\"gem_balance\":0,\"graphicsQuality\":\"HD\",\"idfa\":\"2bf99787-33d2-4ae2-a76a-c49672f97252\",\"internetReachability\":\"ReachableViaLocalAreaNetwork\",\"isLowEndDevice\":\"False\",\"is_auto_spin\":\"False\",\"is_turbo\":\"False\",\"isf\":\"False\",\"ishighroller\":\"False\",\"jackpot_win_amount\":90,\"jackpot_win_type\":\"Silver\",\"level\":6,\"lifetime_gem_balance\":0,\"no_of_spin\":1,\"player_total_battles\":0,\"player_total_shields\":0,\"start_date\":\"2019-08-01\",\"total_payments\":0,\"tournament_id\":\"T1561970819\",\"userId\":\"c82cbdff-e5be-4009-ac78-cdeea09ab4b1\",\"versionSessionCount\":2,\"win_amount\":0,\"fb_content_id\":[\"123\",\"345\",\"567\"]}]", - "advertiser_tracking_enabled": "0", - "application_tracking_enabled": "0" + name: 'fb', + description: 'Test 0', + feature: 'dataDelivery', + module: 'destination', + version: 'v0', + input: { + request: { + body: { + body: { + XML: {}, + JSON_ARRAY: {}, + FORM: { + event: 'CUSTOM_APP_EVENTS', + advertiser_id: 'df16bffa-5c3d-4fbb-9bce-3bab098129a7R', + 'ud[em]': '48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08', + 'ud[fn]': '9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08', + 'ud[ge]': '62c66a7a5dd70c3146618063c344e531e6d4b59e379808443ce962b3abd63c5a', + 'ud[ln]': '3547cb112ac4489af2310c0626cdba6f3097a2ad5a3b42ddd3b59c76c7a079a3', + 'ud[ph]': '588211a01b10feacbf7988d97a06e86c18af5259a7f457fd8759b7f7409a7d1f', + extinfo: + '["a2","","","","8.1.0","Redmi 6","","","Banglalink",640,480,"1.23",0,0,0,"Europe/Berlin"]', + app_user_id: 'c82cbdff-e5be-4009-ac78-cdeea09ab4b1', + custom_events: + '[{"_logTime":1567333011693,"_eventName":"spin_result","_valueToSum":400,"fb_currency":"GBP","additional_bet_index":0,"battle_id":"N/A","bet_amount":9,"bet_level":1,"bet_multiplier":1,"coin_balance":9466052,"current_module_name":"CasinoGameModule","days_in_game":0,"extra_param":"N/A","fb_profile":"0","featureGameType":"N/A","game_fps":30,"game_id":"fireEagleBase","game_name":"FireEagleSlots","gem_balance":0,"graphicsQuality":"HD","idfa":"2bf99787-33d2-4ae2-a76a-c49672f97252","internetReachability":"ReachableViaLocalAreaNetwork","isLowEndDevice":"False","is_auto_spin":"False","is_turbo":"False","isf":"False","ishighroller":"False","jackpot_win_amount":90,"jackpot_win_type":"Silver","level":6,"lifetime_gem_balance":0,"no_of_spin":1,"player_total_battles":0,"player_total_shields":0,"start_date":"2019-08-01","total_payments":0,"tournament_id":"T1561970819","userId":"c82cbdff-e5be-4009-ac78-cdeea09ab4b1","versionSessionCount":2,"win_amount":0,"fb_content_id":["123","345","567"]}]', + advertiser_tracking_enabled: '0', + application_tracking_enabled: '0', }, - "JSON": {} + JSON: {}, + }, + endpoint: `https://graph.facebook.com/${VERSION}/RudderFbApp/activities?access_token=invalid_access_token`, + files: {}, + headers: { + 'x-forwarded-for': '1.2.3.4', }, - "endpoint": "https://graph.facebook.com/v17.0/RudderFbApp/activities?access_token=invalid_access_token", - "files": {}, - "headers": { - "x-forwarded-for": "1.2.3.4" + method: 'POST', + statusCode: 200, + type: 'REST', + userId: 'c82cbdff-e5be-4009-ac78-cdeea09ab4b1', + version: '1', + params: { + destination: 'fb', }, - "method": "POST", - "statusCode": 200, - "type": "REST", - "userId": "c82cbdff-e5be-4009-ac78-cdeea09ab4b1", - "version": "1", - "params": { - "destination": "fb" - } }, - "method": "POST" - } + method: 'POST', + }, }, - "output": { - "response": { - "status": 400, - "body": { - "output": { - "status": 400, - "message": "Invalid OAuth 2.0 access token", - "destinationResponse": { - "error": { - "message": "The access token could not be decrypted", - "type": "OAuthException", - "code": 190, - "fbtrace_id": "fbpixel_trace_id" + output: { + response: { + status: 400, + body: { + output: { + status: 400, + message: 'Invalid OAuth 2.0 access token', + destinationResponse: { + error: { + message: 'The access token could not be decrypted', + type: 'OAuthException', + code: 190, + fbtrace_id: 'fbpixel_trace_id', }, - "status": 500 + status: 500, }, - "statTags": { - "destType": "FB", - "errorCategory": "network", - "destinationId": "Non-determininable", - "workspaceId": "Non-determininable", - "errorType": "aborted", - "feature": "dataDelivery", - "implementation": "native", - "module": "destination" - } - } - } - } - } + statTags: { + destType: 'FB', + errorCategory: 'network', + destinationId: 'Non-determininable', + workspaceId: 'Non-determininable', + errorType: 'aborted', + feature: 'dataDelivery', + implementation: 'native', + module: 'destination', + }, + }, + }, + }, + }, }, { - "name": "fb", - "description": "Test 1", - "feature": "dataDelivery", - "module": "destination", - "version": "v0", - "input": { - "request": { - "body": { - "body": { - "XML": {}, - "JSON_ARRAY": {}, - "FORM": { - "event": "CUSTOM_APP_EVENTS", - "advertiser_id": "df16bffa-5c3d-4fbb-9bce-3bab098129a7R", - "ud[em]": "48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08", - "ud[fn]": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08", - "ud[ge]": "62c66a7a5dd70c3146618063c344e531e6d4b59e379808443ce962b3abd63c5a", - "ud[ln]": "3547cb112ac4489af2310c0626cdba6f3097a2ad5a3b42ddd3b59c76c7a079a3", - "ud[ph]": "588211a01b10feacbf7988d97a06e86c18af5259a7f457fd8759b7f7409a7d1f", - "extinfo": "[\"a2\",\"\",\"\",\"\",\"8.1.0\",\"Redmi 6\",\"\",\"\",\"Banglalink\",640,480,\"1.23\",0,0,0,\"Europe/Berlin\"]", - "app_user_id": "c82cbdff-e5be-4009-ac78-cdeea09ab4b1", - "custom_events": "[{\"_logTime\":1567333011693,\"_eventName\":\"spin_result\",\"_valueToSum\":400,\"fb_currency\":\"GBP\",\"additional_bet_index\":0,\"battle_id\":\"N/A\",\"bet_amount\":9,\"bet_level\":1,\"bet_multiplier\":1,\"coin_balance\":9466052,\"current_module_name\":\"CasinoGameModule\",\"days_in_game\":0,\"extra_param\":\"N/A\",\"fb_profile\":\"0\",\"featureGameType\":\"N/A\",\"game_fps\":30,\"game_id\":\"fireEagleBase\",\"game_name\":\"FireEagleSlots\",\"gem_balance\":0,\"graphicsQuality\":\"HD\",\"idfa\":\"2bf99787-33d2-4ae2-a76a-c49672f97252\",\"internetReachability\":\"ReachableViaLocalAreaNetwork\",\"isLowEndDevice\":\"False\",\"is_auto_spin\":\"False\",\"is_turbo\":\"False\",\"isf\":\"False\",\"ishighroller\":\"False\",\"jackpot_win_amount\":90,\"jackpot_win_type\":\"Silver\",\"level\":6,\"lifetime_gem_balance\":0,\"no_of_spin\":1,\"player_total_battles\":0,\"player_total_shields\":0,\"start_date\":\"2019-08-01\",\"total_payments\":0,\"tournament_id\":\"T1561970819\",\"userId\":\"c82cbdff-e5be-4009-ac78-cdeea09ab4b1\",\"versionSessionCount\":2,\"win_amount\":0,\"fb_content_id\":[\"123\",\"345\",\"567\"]}]", - "advertiser_tracking_enabled": "0", - "application_tracking_enabled": "0" + name: 'fb', + description: 'Test 1', + feature: 'dataDelivery', + module: 'destination', + version: 'v0', + input: { + request: { + body: { + body: { + XML: {}, + JSON_ARRAY: {}, + FORM: { + event: 'CUSTOM_APP_EVENTS', + advertiser_id: 'df16bffa-5c3d-4fbb-9bce-3bab098129a7R', + 'ud[em]': '48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08', + 'ud[fn]': '9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08', + 'ud[ge]': '62c66a7a5dd70c3146618063c344e531e6d4b59e379808443ce962b3abd63c5a', + 'ud[ln]': '3547cb112ac4489af2310c0626cdba6f3097a2ad5a3b42ddd3b59c76c7a079a3', + 'ud[ph]': '588211a01b10feacbf7988d97a06e86c18af5259a7f457fd8759b7f7409a7d1f', + extinfo: + '["a2","","","","8.1.0","Redmi 6","","","Banglalink",640,480,"1.23",0,0,0,"Europe/Berlin"]', + app_user_id: 'c82cbdff-e5be-4009-ac78-cdeea09ab4b1', + custom_events: + '[{"_logTime":1567333011693,"_eventName":"spin_result","_valueToSum":400,"fb_currency":"GBP","additional_bet_index":0,"battle_id":"N/A","bet_amount":9,"bet_level":1,"bet_multiplier":1,"coin_balance":9466052,"current_module_name":"CasinoGameModule","days_in_game":0,"extra_param":"N/A","fb_profile":"0","featureGameType":"N/A","game_fps":30,"game_id":"fireEagleBase","game_name":"FireEagleSlots","gem_balance":0,"graphicsQuality":"HD","idfa":"2bf99787-33d2-4ae2-a76a-c49672f97252","internetReachability":"ReachableViaLocalAreaNetwork","isLowEndDevice":"False","is_auto_spin":"False","is_turbo":"False","isf":"False","ishighroller":"False","jackpot_win_amount":90,"jackpot_win_type":"Silver","level":6,"lifetime_gem_balance":0,"no_of_spin":1,"player_total_battles":0,"player_total_shields":0,"start_date":"2019-08-01","total_payments":0,"tournament_id":"T1561970819","userId":"c82cbdff-e5be-4009-ac78-cdeea09ab4b1","versionSessionCount":2,"win_amount":0,"fb_content_id":["123","345","567"]}]', + advertiser_tracking_enabled: '0', + application_tracking_enabled: '0', }, - "JSON": {} + JSON: {}, }, - "endpoint": "https://graph.facebook.com/v17.0/RudderFbApp/activities?access_token=my_access_token", - "files": {}, - "headers": { - "x-forwarded-for": "1.2.3.4" + endpoint: `https://graph.facebook.com/${VERSION}/RudderFbApp/activities?access_token=my_access_token`, + files: {}, + headers: { + 'x-forwarded-for': '1.2.3.4', + }, + method: 'POST', + statusCode: 200, + type: 'REST', + userId: 'c82cbdff-e5be-4009-ac78-cdeea09ab4b1', + version: '1', + params: { + destination: 'fb', }, - "method": "POST", - "statusCode": 200, - "type": "REST", - "userId": "c82cbdff-e5be-4009-ac78-cdeea09ab4b1", - "version": "1", - "params": { - "destination": "fb" - } }, - "method": "POST" - } + method: 'POST', + }, + }, + output: { + response: { + status: 200, + body: { + output: { + status: 200, + message: 'Request Processed Successfully', + destinationResponse: { + events_received: 1, + fbtrace_id: 'facebook_trace_id', + }, + }, + }, + }, }, - "output": { - "response": { - "status": 200, - "body": { - "output": { - "status": 200, - "message": "Request Processed Successfully", - "destinationResponse": { - "events_received": 1, - "fbtrace_id": "facebook_trace_id" - } - } - } - } - } }, { - "name": "fb", - "description": "Test 2", - "feature": "dataDelivery", - "module": "destination", - "version": "v0", - "input": { - "request": { - "body": { - "body": { - "XML": {}, - "JSON_ARRAY": {}, - "FORM": { - "event": "CUSTOM_APP_EVENTS", - "advertiser_id": "df16bffa-5c3d-4fbb-9bce-3bab098129a7R", - "ud[em]": "48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08", - "ud[fn]": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08", - "ud[ge]": "62c66a7a5dd70c3146618063c344e531e6d4b59e379808443ce962b3abd63c5a", - "ud[ln]": "3547cb112ac4489af2310c0626cdba6f3097a2ad5a3b42ddd3b59c76c7a079a3", - "ud[ph]": "588211a01b10feacbf7988d97a06e86c18af5259a7f457fd8759b7f7409a7d1f", - "extinfo": "[\"a2\",\"\",\"\",\"\",\"8.1.0\",\"Redmi 6\",\"\",\"\",\"Banglalink\",640,480,\"1.23\",0,0,0,\"Europe/Berlin\"]", - "app_user_id": "c82cbdff-e5be-4009-ac78-cdeea09ab4b1", - "custom_events": "[{\"_logTime\":1567333011693,\"_eventName\":\"spin_result\",\"_valueToSum\":400,\"fb_currency\":\"GBP\",\"additional_bet_index\":0,\"battle_id\":\"N/A\",\"bet_amount\":9,\"bet_level\":1,\"bet_multiplier\":1,\"coin_balance\":9466052,\"current_module_name\":\"CasinoGameModule\",\"days_in_game\":0,\"extra_param\":\"N/A\",\"fb_profile\":\"0\",\"featureGameType\":\"N/A\",\"game_fps\":30,\"game_id\":\"fireEagleBase\",\"game_name\":\"FireEagleSlots\",\"gem_balance\":0,\"graphicsQuality\":\"HD\",\"idfa\":\"2bf99787-33d2-4ae2-a76a-c49672f97252\",\"internetReachability\":\"ReachableViaLocalAreaNetwork\",\"isLowEndDevice\":\"False\",\"is_auto_spin\":\"False\",\"is_turbo\":\"False\",\"isf\":\"False\",\"ishighroller\":\"False\",\"jackpot_win_amount\":90,\"jackpot_win_type\":\"Silver\",\"level\":6,\"lifetime_gem_balance\":0,\"no_of_spin\":1,\"player_total_battles\":0,\"player_total_shields\":0,\"start_date\":\"2019-08-01\",\"total_payments\":0,\"tournament_id\":\"T1561970819\",\"userId\":\"c82cbdff-e5be-4009-ac78-cdeea09ab4b1\",\"versionSessionCount\":2,\"win_amount\":0,\"fb_content_id\":[\"123\",\"345\",\"567\"]}]", - "advertiser_tracking_enabled": "0", - "application_tracking_enabled": "0" + name: 'fb', + description: 'Test 2', + feature: 'dataDelivery', + module: 'destination', + version: 'v0', + input: { + request: { + body: { + body: { + XML: {}, + JSON_ARRAY: {}, + FORM: { + event: 'CUSTOM_APP_EVENTS', + advertiser_id: 'df16bffa-5c3d-4fbb-9bce-3bab098129a7R', + 'ud[em]': '48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08', + 'ud[fn]': '9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08', + 'ud[ge]': '62c66a7a5dd70c3146618063c344e531e6d4b59e379808443ce962b3abd63c5a', + 'ud[ln]': '3547cb112ac4489af2310c0626cdba6f3097a2ad5a3b42ddd3b59c76c7a079a3', + 'ud[ph]': '588211a01b10feacbf7988d97a06e86c18af5259a7f457fd8759b7f7409a7d1f', + extinfo: + '["a2","","","","8.1.0","Redmi 6","","","Banglalink",640,480,"1.23",0,0,0,"Europe/Berlin"]', + app_user_id: 'c82cbdff-e5be-4009-ac78-cdeea09ab4b1', + custom_events: + '[{"_logTime":1567333011693,"_eventName":"spin_result","_valueToSum":400,"fb_currency":"GBP","additional_bet_index":0,"battle_id":"N/A","bet_amount":9,"bet_level":1,"bet_multiplier":1,"coin_balance":9466052,"current_module_name":"CasinoGameModule","days_in_game":0,"extra_param":"N/A","fb_profile":"0","featureGameType":"N/A","game_fps":30,"game_id":"fireEagleBase","game_name":"FireEagleSlots","gem_balance":0,"graphicsQuality":"HD","idfa":"2bf99787-33d2-4ae2-a76a-c49672f97252","internetReachability":"ReachableViaLocalAreaNetwork","isLowEndDevice":"False","is_auto_spin":"False","is_turbo":"False","isf":"False","ishighroller":"False","jackpot_win_amount":90,"jackpot_win_type":"Silver","level":6,"lifetime_gem_balance":0,"no_of_spin":1,"player_total_battles":0,"player_total_shields":0,"start_date":"2019-08-01","total_payments":0,"tournament_id":"T1561970819","userId":"c82cbdff-e5be-4009-ac78-cdeea09ab4b1","versionSessionCount":2,"win_amount":0,"fb_content_id":["123","345","567"]}]', + advertiser_tracking_enabled: '0', + application_tracking_enabled: '0', }, - "JSON": {} + JSON: {}, + }, + endpoint: `https://graph.facebook.com/${VERSION}/1234567891234567/events?access_token=invalid_timestamp_correct_access_token`, + files: {}, + headers: { + 'x-forwarded-for': '1.2.3.4', }, - "endpoint": "https://graph.facebook.com/v17.0/1234567891234567/events?access_token=invalid_timestamp_correct_access_token", - "files": {}, - "headers": { - "x-forwarded-for": "1.2.3.4" + method: 'POST', + statusCode: 200, + type: 'REST', + userId: 'c82cbdff-e5be-4009-ac78-cdeea09ab4b1', + version: '1', + params: { + destination: 'fb', }, - "method": "POST", - "statusCode": 200, - "type": "REST", - "userId": "c82cbdff-e5be-4009-ac78-cdeea09ab4b1", - "version": "1", - "params": { - "destination": "fb" - } }, - "method": "POST" - } + method: 'POST', + }, }, - "output": { - "response": { - "status": 400, - "body": { - "output": { - "status": 400, - "message": "Event Timestamp Too Old", - "destinationResponse": { - "error": { - "message": "Invalid parameter", - "type": "OAuthException", - "code": 100, - "error_subcode": 2804003, - "is_transient": false, - "error_user_title": "Event Timestamp Too Old", - "error_user_msg": "The timestamp for this event is too far in the past. Events need to be sent from your server within 7 days of when they occurred. Enter a timestamp that has occurred within the last 7 days.", - "fbtrace_id": "A6UyEgg_HdoiRX9duxcBOjb" + output: { + response: { + status: 400, + body: { + output: { + status: 400, + message: 'Event Timestamp Too Old', + destinationResponse: { + error: { + message: 'Invalid parameter', + type: 'OAuthException', + code: 100, + error_subcode: 2804003, + is_transient: false, + error_user_title: 'Event Timestamp Too Old', + error_user_msg: + 'The timestamp for this event is too far in the past. Events need to be sent from your server within 7 days of when they occurred. Enter a timestamp that has occurred within the last 7 days.', + fbtrace_id: 'A6UyEgg_HdoiRX9duxcBOjb', }, - "status": 400 + status: 400, }, - "statTags": { - "destType": "FB", - "errorCategory": "network", - "destinationId": "Non-determininable", - "workspaceId": "Non-determininable", - "errorType": "aborted", - "feature": "dataDelivery", - "implementation": "native", - "module": "destination" - } - } - } - } - } + statTags: { + destType: 'FB', + errorCategory: 'network', + destinationId: 'Non-determininable', + workspaceId: 'Non-determininable', + errorType: 'aborted', + feature: 'dataDelivery', + implementation: 'native', + module: 'destination', + }, + }, + }, + }, + }, }, { - "name": "fb", - "description": "Test 3", - "feature": "dataDelivery", - "module": "destination", - "version": "v0", - "input": { - "request": { - "body": { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://graph.facebook.com/v17.0/1234567891234567/events?access_token=throttled_valid_access_token", - "headers": {}, - "body": { - "JSON": {}, - "XML": {}, - "JSON_ARRAY": {}, - "FORM": { - "extinfo": "[\"a2\",\"\",\"\",\"\",\"8.1.0\",\"Redmi 6\",\"\",\"\",\"Banglalink\",0,100,\"50.00\",0,0,0,\"\"]", - "custom_events": "[{\"_logTime\":1567333011693,\"_eventName\":\"Viewed Screen\",\"fb_description\":\"Main.1233\"}]", - "ud[em]": "48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08", - "advertiser_tracking_enabled": "0", - "application_tracking_enabled": "0", - "event": "CUSTOM_APP_EVENTS" - } + name: 'fb', + description: 'Test 3', + feature: 'dataDelivery', + module: 'destination', + version: 'v0', + input: { + request: { + body: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: `https://graph.facebook.com/${VERSION}/1234567891234567/events?access_token=throttled_valid_access_token`, + headers: {}, + body: { + JSON: {}, + XML: {}, + JSON_ARRAY: {}, + FORM: { + extinfo: + '["a2","","","","8.1.0","Redmi 6","","","Banglalink",0,100,"50.00",0,0,0,""]', + custom_events: + '[{"_logTime":1567333011693,"_eventName":"Viewed Screen","fb_description":"Main.1233"}]', + 'ud[em]': '48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08', + advertiser_tracking_enabled: '0', + application_tracking_enabled: '0', + event: 'CUSTOM_APP_EVENTS', + }, + }, + files: {}, + userId: 'c82cbdff-e5be-4009-ac78-cdeea09ab4b1', + statusCode: 200, + params: { + destination: 'fb', }, - "files": {}, - "userId": "c82cbdff-e5be-4009-ac78-cdeea09ab4b1", - "statusCode": 200, - "params": { - "destination": "fb" - } }, - "method": "POST" - } + method: 'POST', + }, }, - "output": { - "response": { - "status": 429, - "body": { - "output": { - "status": 429, - "message": "API User Too Many Calls", - "destinationResponse": { - "error": { - "message": "User request limit reached", - "type": "OAuthException", - "code": 17, - "fbtrace_id": "facebook_px_trace_id_4" + output: { + response: { + status: 429, + body: { + output: { + status: 429, + message: 'API User Too Many Calls', + destinationResponse: { + error: { + message: 'User request limit reached', + type: 'OAuthException', + code: 17, + fbtrace_id: 'facebook_px_trace_id_4', }, - "status": 500 + status: 500, + }, + statTags: { + destType: 'FB', + errorCategory: 'network', + destinationId: 'Non-determininable', + workspaceId: 'Non-determininable', + errorType: 'throttled', + feature: 'dataDelivery', + implementation: 'native', + module: 'destination', }, - "statTags": { - "destType": "FB", - "errorCategory": "network", - "destinationId": "Non-determininable", - "workspaceId": "Non-determininable", - "errorType": "throttled", - "feature": "dataDelivery", - "implementation": "native", - "module": "destination" - } - } - } - } - } + }, + }, + }, + }, }, { - "name": "fb", - "description": "Test 4", - "feature": "dataDelivery", - "module": "destination", - "version": "v0", - "input": { - "request": { - "body": { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://graph.facebook.com/v17.0/1234567891234567/events?access_token=invalid_account_id_valid_access_token", - "headers": {}, - "body": { - "JSON": {}, - "XML": {}, - "JSON_ARRAY": {}, - "FORM": { - "extinfo": "[\"a2\",\"\",\"\",\"\",\"8.1.0\",\"Redmi 6\",\"\",\"\",\"Banglalink\",0,100,\"50.00\",0,0,0,\"\"]", - "custom_events": "[{\"_logTime\":1567333011693,\"_eventName\":\"Viewed Screen\",\"fb_description\":\"Main.1233\"}]", - "ud[em]": "48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08", - "advertiser_tracking_enabled": "0", - "application_tracking_enabled": "0", - "event": "CUSTOM_APP_EVENTS" - } + name: 'fb', + description: 'Test 4', + feature: 'dataDelivery', + module: 'destination', + version: 'v0', + input: { + request: { + body: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: `https://graph.facebook.com/${VERSION}/1234567891234567/events?access_token=invalid_account_id_valid_access_token`, + headers: {}, + body: { + JSON: {}, + XML: {}, + JSON_ARRAY: {}, + FORM: { + extinfo: + '["a2","","","","8.1.0","Redmi 6","","","Banglalink",0,100,"50.00",0,0,0,""]', + custom_events: + '[{"_logTime":1567333011693,"_eventName":"Viewed Screen","fb_description":"Main.1233"}]', + 'ud[em]': '48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08', + advertiser_tracking_enabled: '0', + application_tracking_enabled: '0', + event: 'CUSTOM_APP_EVENTS', + }, + }, + files: {}, + userId: 'c82cbdff-e5be-4009-ac78-cdeea09ab4b1', + statusCode: 200, + params: { + destination: 'fb', }, - "files": {}, - "userId": "c82cbdff-e5be-4009-ac78-cdeea09ab4b1", - "statusCode": 200, - "params": { - "destination": "fb" - } }, - "method": "POST" - } + method: 'POST', + }, }, - "output": { - "response": { - "status": 400, - "body": { - "output": { - "status": 400, - "message": "Object with ID 'PIXEL_ID' / 'DATASET_ID' / 'AUDIENCE_ID' does not exist, cannot be loaded due to missing permissions, or does not support this operation", - "destinationResponse": { - "error": { - "message": "Unsupported post request. Object with ID '1234567891234569' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api", - "type": "GraphMethodException", - "code": 100, - "error_subcode": 33, - "fbtrace_id": "facebook_px_trace_id_5" + output: { + response: { + status: 400, + body: { + output: { + status: 400, + message: + "Object with ID 'PIXEL_ID' / 'DATASET_ID' / 'AUDIENCE_ID' does not exist, cannot be loaded due to missing permissions, or does not support this operation", + destinationResponse: { + error: { + message: + "Unsupported post request. Object with ID '1234567891234569' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api", + type: 'GraphMethodException', + code: 100, + error_subcode: 33, + fbtrace_id: 'facebook_px_trace_id_5', }, - "status": 400 + status: 400, }, - "statTags": { - "destType": "FB", - "errorCategory": "network", - "destinationId": "Non-determininable", - "workspaceId": "Non-determininable", - "errorType": "aborted", - "feature": "dataDelivery", - "implementation": "native", - "module": "destination" - } - } - } - } - } - } -] \ No newline at end of file + statTags: { + destType: 'FB', + errorCategory: 'network', + destinationId: 'Non-determininable', + workspaceId: 'Non-determininable', + errorType: 'aborted', + feature: 'dataDelivery', + implementation: 'native', + module: 'destination', + }, + }, + }, + }, + }, + }, +]; diff --git a/test/integrations/destinations/fb/network.ts b/test/integrations/destinations/fb/network.ts index 07a84a7e66..1a2f114d74 100644 --- a/test/integrations/destinations/fb/network.ts +++ b/test/integrations/destinations/fb/network.ts @@ -2,6 +2,7 @@ import { cloneDeep } from 'lodash'; import { getFormData } from '../../../../src/adapters/network'; import * as fbPixelNw from '../facebook_pixel/network'; import { data } from './dataDelivery/data'; +import { VERSION } from '../../../../src/v0/destinations/fb/config'; const fbPixelTcs = data .filter((_, i) => [2, 3, 4].includes(i)) @@ -19,7 +20,7 @@ const fbPixelTcs = data export const networkCallsData = [ { httpReq: { - url: 'https://graph.facebook.com/v17.0/RudderFbApp/activities?access_token=invalid_access_token', + url: `https://graph.facebook.com/${VERSION}/RudderFbApp/activities?access_token=invalid_access_token`, data: getFormData(data[0].input.request.body.body.FORM).toString(), params: { destination: 'fb' }, headers: { 'User-Agent': 'RudderLabs' }, @@ -39,7 +40,7 @@ export const networkCallsData = [ }, { httpReq: { - url: 'https://graph.facebook.com/v17.0/RudderFbApp/activities?access_token=my_access_token', + url: `https://graph.facebook.com/${VERSION}/RudderFbApp/activities?access_token=my_access_token`, data: getFormData(data[1].input.request.body.body.FORM).toString(), params: { destination: 'fb' }, headers: { 'x-forwarded-for': '1.2.3.4', 'User-Agent': 'RudderLabs' }, diff --git a/test/integrations/destinations/fb/processor/data.ts b/test/integrations/destinations/fb/processor/data.ts index 9b57f3ef78..a437b90855 100644 --- a/test/integrations/destinations/fb/processor/data.ts +++ b/test/integrations/destinations/fb/processor/data.ts @@ -1,3 +1,5 @@ +import { VERSION } from '../../../../../src/v0/destinations/fb/config'; + export const data = [ { name: 'fb', @@ -618,7 +620,7 @@ export const data = [ }, JSON: {}, }, - endpoint: 'https://graph.facebook.com/v17.0/RudderFbApp/activities', + endpoint: `https://graph.facebook.com/${VERSION}/RudderFbApp/activities`, files: {}, headers: { 'x-forwarded-for': '1.2.3.4', @@ -803,7 +805,7 @@ export const data = [ }, JSON: {}, }, - endpoint: 'https://graph.facebook.com/v17.0/RudderFbApp/activities', + endpoint: `https://graph.facebook.com/${VERSION}/RudderFbApp/activities`, files: {}, headers: { 'x-forwarded-for': '1.2.3.4', @@ -893,7 +895,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/RudderFbApp/activities', + endpoint: `https://graph.facebook.com/${VERSION}/RudderFbApp/activities`, headers: {}, params: {}, body: { @@ -993,7 +995,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/RudderFbApp/activities', + endpoint: `https://graph.facebook.com/${VERSION}/RudderFbApp/activities`, headers: {}, params: {}, body: { @@ -1177,7 +1179,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/RudderFbApp/activities', + endpoint: `https://graph.facebook.com/${VERSION}/RudderFbApp/activities`, headers: {}, params: {}, body: { @@ -1277,7 +1279,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/RudderFbApp/activities', + endpoint: `https://graph.facebook.com/${VERSION}/RudderFbApp/activities`, headers: {}, params: {}, body: { @@ -1377,7 +1379,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/RudderFbApp/activities', + endpoint: `https://graph.facebook.com/${VERSION}/RudderFbApp/activities`, headers: {}, params: {}, body: { @@ -1551,7 +1553,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/RudderFbApp/activities', + endpoint: `https://graph.facebook.com/${VERSION}/RudderFbApp/activities`, headers: {}, params: {}, body: { @@ -1731,7 +1733,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/RudderFbApp/activities', + endpoint: `https://graph.facebook.com/${VERSION}/RudderFbApp/activities`, headers: {}, params: {}, body: { @@ -1831,7 +1833,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/RudderFbApp/activities', + endpoint: `https://graph.facebook.com/${VERSION}/RudderFbApp/activities`, headers: { 'x-forwarded-for': '2.3.4.5', }, @@ -2153,7 +2155,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/RudderFbApp/activities', + endpoint: `https://graph.facebook.com/${VERSION}/RudderFbApp/activities`, headers: {}, params: {}, body: { diff --git a/test/integrations/destinations/fb_custom_audience/dataDelivery/data.ts b/test/integrations/destinations/fb_custom_audience/dataDelivery/data.ts index ddb081ba87..3066dae887 100644 --- a/test/integrations/destinations/fb_custom_audience/dataDelivery/data.ts +++ b/test/integrations/destinations/fb_custom_audience/dataDelivery/data.ts @@ -1,617 +1,575 @@ +import { getEndPoint } from '../../../../../src/v0/destinations/fb_custom_audience/config'; + export const data = [ - { - name: 'fb_custom_audience', - description: 'successfully adding users to audience', - feature: 'dataDelivery', - module: 'destination', - version: 'v0', - input: { - request: { - body: { - version: '1', - type: 'REST', - method: 'DELETE', - endpoint: 'https://graph.facebook.com/v17.0/aud1/users', - headers: { - "test-dest-response-key": "successResponse" - }, - params: { - access_token: 'ABC', - payload: { - is_raw: true, - data_source: { - sub_type: 'ANYTHING', - }, - schema: [ - 'EMAIL', - 'DOBM', - 'DOBD', - 'DOBY', - 'PHONE', - 'GEN', - 'FI', - 'MADID', - 'ZIP', - 'ST', - 'COUNTRY', - ], - data: [ - [ - 'shrouti@abc.com', - '2', - '13', - '2013', - '@09432457768', - 'f', - 'Ms.', - 'ABC', - 'ZIP ', - '123abc ', - 'IN', - ], - ], - }, - }, - userId: '', - body: { - JSON: {}, - XML: {}, - JSON_ARRAY: {}, - FORM: {}, - }, - files: {}, - } + { + name: 'fb_custom_audience', + description: 'successfully adding users to audience', + feature: 'dataDelivery', + module: 'destination', + version: 'v0', + input: { + request: { + body: { + version: '1', + type: 'REST', + method: 'DELETE', + endpoint: getEndPoint('aud1'), + headers: { + 'test-dest-response-key': 'successResponse', + }, + params: { + access_token: 'ABC', + payload: { + is_raw: true, + data_source: { + sub_type: 'ANYTHING', + }, + schema: [ + 'EMAIL', + 'DOBM', + 'DOBD', + 'DOBY', + 'PHONE', + 'GEN', + 'FI', + 'MADID', + 'ZIP', + 'ST', + 'COUNTRY', + ], + data: [ + [ + 'shrouti@abc.com', + '2', + '13', + '2013', + '@09432457768', + 'f', + 'Ms.', + 'ABC', + 'ZIP ', + '123abc ', + 'IN', + ], + ], }, + }, + userId: '', + body: { + JSON: {}, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, }, - output: { - response: { - status: 200, - body: { - output: { - status: 200, - message: 'Request Processed Successfully', - destinationResponse: { - audience_id: 'aud1', - invalid_entry_samples: {}, - num_invalid_entries: 0, - num_received: 4, - session_id: '123' - } - } - } + }, + }, + output: { + response: { + status: 200, + body: { + output: { + status: 200, + message: 'Request Processed Successfully', + destinationResponse: { + audience_id: 'aud1', + invalid_entry_samples: {}, + num_invalid_entries: 0, + num_received: 4, + session_id: '123', }, + }, }, + }, }, - { - name: 'fb_custom_audience', - description: 'user addition failed due to missing permission', - feature: 'dataDelivery', - module: 'destination', - version: 'v0', - input: { - request: { - body: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/aud1/users', - headers: { - "test-dest-response-key": "permissionMissingError" - }, - params: { - access_token: 'BCD', - payload: { - is_raw: true, - data_source: { - sub_type: 'ANYTHING', - }, - schema: [ - 'DOBM', - 'DOBD', - 'DOBY', - 'PHONE', - 'GEN', - 'FI', - 'MADID', - 'ZIP', - 'ST', - 'COUNTRY', - ], - data: [ - [ - '2', - '13', - '2013', - '@09432457768', - 'f', - 'Ms.', - 'ABC', - 'ZIP ', - '123abc ', - 'IN', - ], - ], - }, - }, - body: { - JSON: {}, - XML: {}, - JSON_ARRAY: {}, - FORM: {}, - }, - files: {}, - } + }, + { + name: 'fb_custom_audience', + description: 'user addition failed due to missing permission', + feature: 'dataDelivery', + module: 'destination', + version: 'v0', + input: { + request: { + body: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: getEndPoint('aud1'), + headers: { + 'test-dest-response-key': 'permissionMissingError', + }, + params: { + access_token: 'BCD', + payload: { + is_raw: true, + data_source: { + sub_type: 'ANYTHING', + }, + schema: [ + 'DOBM', + 'DOBD', + 'DOBY', + 'PHONE', + 'GEN', + 'FI', + 'MADID', + 'ZIP', + 'ST', + 'COUNTRY', + ], + data: [ + ['2', '13', '2013', '@09432457768', 'f', 'Ms.', 'ABC', 'ZIP ', '123abc ', 'IN'], + ], }, + }, + body: { + JSON: {}, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, }, - output: { - response: { - status: 400, - body: { - output: { - destinationResponse: { - error: { - code: 294, - message: "Missing permission. Please make sure you have ads_management permission and the application is included in the allowlist", - type: "GraphMethodException", - }, - status: 400, - - }, - message: "Missing permission. Please make sure you have ads_management permission and the application is included in the allowlist", - statTags: { - destType: "FB_CUSTOM_AUDIENCE", - destinationId: "Non-determininable", - errorCategory: "network", - errorType: "aborted", - feature: "dataDelivery", - implementation: "native", - module: "destination", - workspaceId: "Non-determininable", - }, - "status": 400, - }, - }, + }, + }, + output: { + response: { + status: 400, + body: { + output: { + destinationResponse: { + error: { + code: 294, + message: + 'Missing permission. Please make sure you have ads_management permission and the application is included in the allowlist', + type: 'GraphMethodException', + }, + status: 400, }, + message: + 'Missing permission. Please make sure you have ads_management permission and the application is included in the allowlist', + statTags: { + destType: 'FB_CUSTOM_AUDIENCE', + destinationId: 'Non-determininable', + errorCategory: 'network', + errorType: 'aborted', + feature: 'dataDelivery', + implementation: 'native', + module: 'destination', + workspaceId: 'Non-determininable', + }, + status: 400, + }, }, + }, }, - { - name: 'fb_custom_audience', - description: 'user addition failed due to unavailable audience error', - feature: 'dataDelivery', - module: 'destination', - version: 'v0', - input: { - request: { - body: { - version: '1', - type: 'REST', - method: 'DELETE', - endpoint: 'https://graph.facebook.com/v17.0/aud1/users', - headers: { - "test-dest-response-key": "audienceUnavailableError" - }, - params: { - access_token: 'ABC', - payload: { - is_raw: true, - data_source: { - sub_type: 'ANYTHING', - }, - schema: [ - 'DOBY', - 'PHONE', - 'GEN', - 'FI', - 'MADID', - 'ZIP', - 'ST', - 'COUNTRY', - ], - data: [ - [ - '2013', - '@09432457768', - 'f', - 'Ms.', - 'ABC', - 'ZIP ', - '123abc ', - 'IN', - ], - ], - }, - }, - body: { - JSON: {}, - XML: {}, - JSON_ARRAY: {}, - FORM: {}, - }, - files: {}, - } + }, + { + name: 'fb_custom_audience', + description: 'user addition failed due to unavailable audience error', + feature: 'dataDelivery', + module: 'destination', + version: 'v0', + input: { + request: { + body: { + version: '1', + type: 'REST', + method: 'DELETE', + endpoint: getEndPoint('aud1'), + headers: { + 'test-dest-response-key': 'audienceUnavailableError', + }, + params: { + access_token: 'ABC', + payload: { + is_raw: true, + data_source: { + sub_type: 'ANYTHING', + }, + schema: ['DOBY', 'PHONE', 'GEN', 'FI', 'MADID', 'ZIP', 'ST', 'COUNTRY'], + data: [['2013', '@09432457768', 'f', 'Ms.', 'ABC', 'ZIP ', '123abc ', 'IN']], }, + }, + body: { + JSON: {}, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, }, - output: { - response: { - status: 400, - body: { - output: { - destinationResponse: { - error: { - code: 1487301, - message: "Custom Audience Unavailable: The custom audience you are trying to use has not been shared with your ad account", - type: "GraphMethodException", - }, - status: 400, - - }, - message: "Custom Audience Unavailable: The custom audience you are trying to use has not been shared with your ad account", - statTags: { - destType: "FB_CUSTOM_AUDIENCE", - destinationId: "Non-determininable", - errorCategory: "network", - errorType: "aborted", - feature: "dataDelivery", - implementation: "native", - module: "destination", - workspaceId: "Non-determininable", - }, - "status": 400, - }, - }, + }, + }, + output: { + response: { + status: 400, + body: { + output: { + destinationResponse: { + error: { + code: 1487301, + message: + 'Custom Audience Unavailable: The custom audience you are trying to use has not been shared with your ad account', + type: 'GraphMethodException', + }, + status: 400, }, + message: + 'Custom Audience Unavailable: The custom audience you are trying to use has not been shared with your ad account', + statTags: { + destType: 'FB_CUSTOM_AUDIENCE', + destinationId: 'Non-determininable', + errorCategory: 'network', + errorType: 'aborted', + feature: 'dataDelivery', + implementation: 'native', + module: 'destination', + workspaceId: 'Non-determininable', + }, + status: 400, + }, }, + }, }, - { - name: 'fb_custom_audience', - description: 'user addition failed because the custom audience has been deleted', - feature: 'dataDelivery', - module: 'destination', - version: 'v0', - input: { - request: { - body: { - version: '1', - type: 'REST', - method: 'DELETE', - endpoint: 'https://graph.facebook.com/v17.0/aud1/users', - headers: { - "test-dest-response-key": "audienceDeletedError" - }, - params: { - access_token: 'ABC', - payload: { - is_raw: true, - data_source: { - sub_type: 'ANYTHING', - }, - schema: [ - 'DOBY', - 'PHONE', - 'GEN', - 'FI', - 'MADID', - 'ZIP', - 'ST', - 'COUNTRY', - ], - data: [ - [ - '2013', - '@09432457768', - 'f', - 'Ms.', - 'ABC', - 'ZIP ', - '123abc ', - 'IN', - ], - ], - }, - }, - body: { - JSON: {}, - XML: {}, - JSON_ARRAY: {}, - FORM: {}, - }, - files: {}, - } + }, + { + name: 'fb_custom_audience', + description: 'user addition failed because the custom audience has been deleted', + feature: 'dataDelivery', + module: 'destination', + version: 'v0', + input: { + request: { + body: { + version: '1', + type: 'REST', + method: 'DELETE', + endpoint: getEndPoint('aud1'), + headers: { + 'test-dest-response-key': 'audienceDeletedError', + }, + params: { + access_token: 'ABC', + payload: { + is_raw: true, + data_source: { + sub_type: 'ANYTHING', + }, + schema: ['DOBY', 'PHONE', 'GEN', 'FI', 'MADID', 'ZIP', 'ST', 'COUNTRY'], + data: [['2013', '@09432457768', 'f', 'Ms.', 'ABC', 'ZIP ', '123abc ', 'IN']], }, + }, + body: { + JSON: {}, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, }, - output: { - response: { - status: 400, - body: { - output: { - destinationResponse: { - error: { - code: 1487366, - message: "Custom Audience Has Been Deleted", - type: "GraphMethodException", - }, - status: 400, - - }, - message: "Custom Audience Has Been Deleted", - statTags: { - destType: "FB_CUSTOM_AUDIENCE", - destinationId: "Non-determininable", - errorCategory: "network", - errorType: "aborted", - feature: "dataDelivery", - implementation: "native", - module: "destination", - workspaceId: "Non-determininable", - }, - "status": 400, - }, - }, + }, + }, + output: { + response: { + status: 400, + body: { + output: { + destinationResponse: { + error: { + code: 1487366, + message: 'Custom Audience Has Been Deleted', + type: 'GraphMethodException', + }, + status: 400, + }, + message: 'Custom Audience Has Been Deleted', + statTags: { + destType: 'FB_CUSTOM_AUDIENCE', + destinationId: 'Non-determininable', + errorCategory: 'network', + errorType: 'aborted', + feature: 'dataDelivery', + implementation: 'native', + module: 'destination', + workspaceId: 'Non-determininable', }, + status: 400, + }, }, + }, }, - { - name: 'fb_custom_audience', - description: 'Failed to update the custom audience for unknown reason', - feature: 'dataDelivery', - module: 'destination', - version: 'v0', - input: { - request: { - body: { - version: '1', - type: 'REST', - method: 'DELETE', - endpoint: 'https://graph.facebook.com/v17.0/aud1/users', - headers: { - "test-dest-response-key": "failedToUpdateAudienceError" - }, - params: { - access_token: 'ABC', - payload: { - is_raw: true, - data_source: { - sub_type: 'ANYTHING', - }, - schema: [ - 'DOBY', - 'PHONE', - 'GEN', - 'FI', - 'MADID', - 'ZIP', - 'ST', - 'COUNTRY', - ], - data: [ - [ - '2013', - '@09432457768', - 'f', - 'Ms.', - 'ABC', - 'ZIP ', - '123abc ', - 'IN', - ], - ], - }, - }, - body: { - JSON: {}, - XML: {}, - JSON_ARRAY: {}, - FORM: {}, - }, - files: {}, - } + }, + { + name: 'fb_custom_audience', + description: 'Failed to update the custom audience for unknown reason', + feature: 'dataDelivery', + module: 'destination', + version: 'v0', + input: { + request: { + body: { + version: '1', + type: 'REST', + method: 'DELETE', + endpoint: getEndPoint('aud1'), + headers: { + 'test-dest-response-key': 'failedToUpdateAudienceError', + }, + params: { + access_token: 'ABC', + payload: { + is_raw: true, + data_source: { + sub_type: 'ANYTHING', + }, + schema: ['DOBY', 'PHONE', 'GEN', 'FI', 'MADID', 'ZIP', 'ST', 'COUNTRY'], + data: [['2013', '@09432457768', 'f', 'Ms.', 'ABC', 'ZIP ', '123abc ', 'IN']], }, + }, + body: { + JSON: {}, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, }, - output: { - response: { - status: 400, - body: { - output: { - destinationResponse: { - error: { - code: 2650, - message: "Failed to update the custom audience", - type: "GraphMethodException", - }, - status: 400, - - }, - message: "Failed to update the custom audience", - statTags: { - destType: "FB_CUSTOM_AUDIENCE", - destinationId: "Non-determininable", - errorCategory: "network", - errorType: "aborted", - feature: "dataDelivery", - implementation: "native", - module: "destination", - workspaceId: "Non-determininable", - }, - "status": 400, - }, - }, + }, + }, + output: { + response: { + status: 400, + body: { + output: { + destinationResponse: { + error: { + code: 2650, + message: 'Failed to update the custom audience', + type: 'GraphMethodException', + }, + status: 400, + }, + message: 'Failed to update the custom audience', + statTags: { + destType: 'FB_CUSTOM_AUDIENCE', + destinationId: 'Non-determininable', + errorCategory: 'network', + errorType: 'aborted', + feature: 'dataDelivery', + implementation: 'native', + module: 'destination', + workspaceId: 'Non-determininable', }, + status: 400, + }, }, + }, }, - { - name: 'fb_custom_audience', - description: 'Failed to update the custom audience as excessive number of parameters were passed in the request', - feature: 'dataDelivery', - module: 'destination', - version: 'v0', - input: { - request: { - body: { - version: '1', - type: 'REST', - method: 'DELETE', - endpoint: 'https://graph.facebook.com/v17.0/aud1/users', - headers: { - "test-dest-response-key": "parameterExceededError" - }, - params: { - access_token: 'ABC', - payload: { - is_raw: true, - data_source: { - sub_type: 'ANYTHING', - }, - schema: [ - 'DOBY', - 'PHONE', - 'GEN', - 'FI', - 'MADID', - 'ZIP', - 'ST', - 'COUNTRY', - ], - data: [ - [ - '2013', - '@09432457768', - 'f', - 'Ms.', - 'ABC', - 'ZIP ', - '123abc ', - 'IN', - ], - ], - }, - }, - body: { - JSON: {}, - XML: {}, - JSON_ARRAY: {}, - FORM: {}, - }, - files: {}, - } + }, + { + name: 'fb_custom_audience', + description: + 'Failed to update the custom audience as excessive number of parameters were passed in the request', + feature: 'dataDelivery', + module: 'destination', + version: 'v0', + input: { + request: { + body: { + version: '1', + type: 'REST', + method: 'DELETE', + endpoint: getEndPoint('aud1'), + headers: { + 'test-dest-response-key': 'parameterExceededError', + }, + params: { + access_token: 'ABC', + payload: { + is_raw: true, + data_source: { + sub_type: 'ANYTHING', + }, + schema: ['DOBY', 'PHONE', 'GEN', 'FI', 'MADID', 'ZIP', 'ST', 'COUNTRY'], + data: [['2013', '@09432457768', 'f', 'Ms.', 'ABC', 'ZIP ', '123abc ', 'IN']], }, + }, + body: { + JSON: {}, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, }, - output: { - response: { - status: 400, - body: { - output: { - destinationResponse: { - error: { - code: 105, - message: "The number of parameters exceeded the maximum for this operation", - type: "GraphMethodException", - }, - status: 400, - - }, - message: "The number of parameters exceeded the maximum for this operation", - statTags: { - destType: "FB_CUSTOM_AUDIENCE", - destinationId: "Non-determininable", - errorCategory: "network", - errorType: "aborted", - feature: "dataDelivery", - implementation: "native", - module: "destination", - workspaceId: "Non-determininable", - }, - "status": 400, - }, - }, + }, + }, + output: { + response: { + status: 400, + body: { + output: { + destinationResponse: { + error: { + code: 105, + message: 'The number of parameters exceeded the maximum for this operation', + type: 'GraphMethodException', + }, + status: 400, }, + message: 'The number of parameters exceeded the maximum for this operation', + statTags: { + destType: 'FB_CUSTOM_AUDIENCE', + destinationId: 'Non-determininable', + errorCategory: 'network', + errorType: 'aborted', + feature: 'dataDelivery', + implementation: 'native', + module: 'destination', + workspaceId: 'Non-determininable', + }, + status: 400, + }, }, + }, }, - { - name: 'fb_custom_audience', - description: 'user update request is throttled due to too many calls to the ad account', - feature: 'dataDelivery', - module: 'destination', - version: 'v0', - input: { - request: { - body: { - version: '1', - type: 'REST', - method: 'DELETE', - endpoint: 'https://graph.facebook.com/v17.0/aud1/users', - headers: { - "test-dest-response-key": "tooManyCallsError" - }, - params: { - access_token: 'ABC', - payload: { - is_raw: true, - data_source: { - sub_type: 'ANYTHING', - }, - schema: [ - 'DOBY', - 'PHONE', - 'GEN', - 'FI', - 'MADID', - 'ZIP', - 'ST', - 'COUNTRY', - ], - data: [ - [ - '2013', - '@09432457768', - 'f', - 'Ms.', - 'ABC', - 'ZIP ', - '123abc ', - 'IN', - ], - ], - }, - }, - body: { - JSON: {}, - XML: {}, - JSON_ARRAY: {}, - FORM: {}, - }, - files: {}, - } + }, + { + name: 'fb_custom_audience', + description: 'user update request is throttled due to too many calls to the ad account', + feature: 'dataDelivery', + module: 'destination', + version: 'v0', + input: { + request: { + body: { + version: '1', + type: 'REST', + method: 'DELETE', + endpoint: getEndPoint('aud1'), + headers: { + 'test-dest-response-key': 'tooManyCallsError', + }, + params: { + access_token: 'ABC', + payload: { + is_raw: true, + data_source: { + sub_type: 'ANYTHING', + }, + schema: ['DOBY', 'PHONE', 'GEN', 'FI', 'MADID', 'ZIP', 'ST', 'COUNTRY'], + data: [['2013', '@09432457768', 'f', 'Ms.', 'ABC', 'ZIP ', '123abc ', 'IN']], }, + }, + body: { + JSON: {}, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, }, - output: { - response: { - status: 429, - body: { - output: { - destinationResponse: { - error: { - code: 80003, - message: "There have been too many calls to this ad-account.", - type: "GraphMethodException", - }, - status: 429, - - }, - message: "There have been too many calls to this ad-account.", - statTags: { - destType: "FB_CUSTOM_AUDIENCE", - destinationId: "Non-determininable", - errorCategory: "network", - errorType: "throttled", - feature: "dataDelivery", - implementation: "native", - module: "destination", - workspaceId: "Non-determininable", - }, - "status": 429, - }, - }, + }, + }, + output: { + response: { + status: 429, + body: { + output: { + destinationResponse: { + error: { + code: 80003, + message: 'There have been too many calls to this ad-account.', + type: 'GraphMethodException', + }, + status: 429, + }, + message: 'There have been too many calls to this ad-account.', + statTags: { + destType: 'FB_CUSTOM_AUDIENCE', + destinationId: 'Non-determininable', + errorCategory: 'network', + errorType: 'throttled', + feature: 'dataDelivery', + implementation: 'native', + module: 'destination', + workspaceId: 'Non-determininable', + }, + status: 429, + }, + }, + }, + }, + }, + { + name: 'fb_custom_audience', + description: 'user having permission issue while updating audience', + feature: 'dataDelivery', + module: 'destination', + version: 'v0', + input: { + request: { + body: { + version: '1', + type: 'REST', + method: 'DELETE', + endpoint: getEndPoint('aud1'), + headers: { + 'test-dest-response-key': 'code200PermissionError', + }, + params: { + access_token: 'ABC', + payload: { + is_raw: true, + data_source: { + sub_type: 'ANYTHING', + }, + schema: ['DOBY', 'PHONE', 'GEN', 'FI', 'MADID', 'ZIP', 'ST', 'COUNTRY'], + data: [['2013', '@09432457768', 'f', 'Ms.', 'ABC', 'ZIP ', '123abc ', 'IN']], }, + }, + body: { + JSON: {}, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, }, - } -] \ No newline at end of file + }, + }, + output: { + response: { + status: 403, + body: { + output: { + destinationResponse: { + error: { + code: 200, + fbtrace_id: 'AFfWqjY-_y2Q92DsyJ4DQ6f', + message: '(#200) The current user can not update audience 23861283180290489', + type: 'OAuthException', + }, + status: 403, + }, + message: '(#200) The current user can not update audience 23861283180290489', + statTags: { + destType: 'FB_CUSTOM_AUDIENCE', + destinationId: 'Non-determininable', + errorCategory: 'network', + errorType: 'aborted', + feature: 'dataDelivery', + implementation: 'native', + module: 'destination', + workspaceId: 'Non-determininable', + }, + status: 403, + }, + }, + }, + }, + }, +]; diff --git a/test/integrations/destinations/fb_custom_audience/network.ts b/test/integrations/destinations/fb_custom_audience/network.ts index 2c19a6fe0d..bbdc1ffc28 100644 --- a/test/integrations/destinations/fb_custom_audience/network.ts +++ b/test/integrations/destinations/fb_custom_audience/network.ts @@ -1,456 +1,483 @@ +import { getEndPoint } from '../../../../src/v0/destinations/fb_custom_audience/config'; + export const networkCallsData = [ - { - httpReq: { - version: '1', - type: 'REST', - method: 'DELETE', - endpoint: 'https://graph.facebook.com/v17.0/aud1/users', - headers: { - 'test-dest-response-key': 'successResponse' - }, - params: { - access_token: 'ABC', - payload: { - is_raw: true, - data_source: { - sub_type: 'ANYTHING', - }, - schema: [ - 'EMAIL', - 'DOBM', - 'DOBD', - 'DOBY', - 'PHONE', - 'GEN', - 'FI', - 'MADID', - 'ZIP', - 'ST', - 'COUNTRY', - ], - data: [ - [ - 'shrouti@abc.com', - '2', - '13', - '2013', - '@09432457768', - 'f', - 'Ms.', - 'ABC', - 'ZIP ', - '123abc ', - 'IN', - ], - ], - }, - }, - userId: '', - body: { - JSON: {}, - XML: {}, - JSON_ARRAY: {}, - FORM: {}, - }, - files: {}, + { + httpReq: { + version: '1', + type: 'REST', + method: 'DELETE', + endpoint: getEndPoint('aud1'), + headers: { + 'test-dest-response-key': 'successResponse', + }, + params: { + access_token: 'ABC', + payload: { + is_raw: true, + data_source: { + sub_type: 'ANYTHING', + }, + schema: [ + 'EMAIL', + 'DOBM', + 'DOBD', + 'DOBY', + 'PHONE', + 'GEN', + 'FI', + 'MADID', + 'ZIP', + 'ST', + 'COUNTRY', + ], + data: [ + [ + 'shrouti@abc.com', + '2', + '13', + '2013', + '@09432457768', + 'f', + 'Ms.', + 'ABC', + 'ZIP ', + '123abc ', + 'IN', + ], + ], }, - httpRes: { - "data": { - "audience_id": "aud1", - "session_id": "123", - "num_received": 4, - "num_invalid_entries": 0, - "invalid_entry_samples": {} - }, - "status": 200 - } + }, + userId: '', + body: { + JSON: {}, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, }, - { - httpReq: { - version: '1', - type: 'REST', - method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/aud1/users', - headers: { - 'test-dest-response-key': 'permissionMissingError' - }, - params: { - access_token: 'BCD', - payload: { - is_raw: true, - data_source: { - sub_type: 'ANYTHING', - }, - schema: [ - 'DOBM', - 'DOBD', - 'DOBY', - 'PHONE', - 'GEN', - 'FI', - 'MADID', - 'ZIP', - 'ST', - 'COUNTRY', - ], - data: [ - [ - '2', - '13', - '2013', - '@09432457768', - 'f', - 'Ms.', - 'ABC', - 'ZIP ', - '123abc ', - 'IN', - ], - ], - }, - }, - userId: '', - body: { - JSON: {}, - XML: {}, - JSON_ARRAY: {}, - FORM: {}, - }, - files: {}, + httpRes: { + data: { + audience_id: 'aud1', + session_id: '123', + num_received: 4, + num_invalid_entries: 0, + invalid_entry_samples: {}, + }, + status: 200, + }, + }, + { + httpReq: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: getEndPoint('aud1'), + headers: { + 'test-dest-response-key': 'permissionMissingError', + }, + params: { + access_token: 'BCD', + payload: { + is_raw: true, + data_source: { + sub_type: 'ANYTHING', + }, + schema: ['DOBM', 'DOBD', 'DOBY', 'PHONE', 'GEN', 'FI', 'MADID', 'ZIP', 'ST', 'COUNTRY'], + data: [['2', '13', '2013', '@09432457768', 'f', 'Ms.', 'ABC', 'ZIP ', '123abc ', 'IN']], + }, + }, + userId: '', + body: { + JSON: {}, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, + }, + httpRes: { + data: { + error: { + code: 294, + message: + 'Missing permission. Please make sure you have ads_management permission and the application is included in the allowlist', + type: 'GraphMethodException', + }, + }, + status: 400, + }, + }, + { + httpReq: { + version: '1', + type: 'REST', + method: 'DELETE', + endpoint: getEndPoint('aud1'), + headers: { + 'test-dest-response-key': 'audienceUnavailableError', + }, + params: { + access_token: 'ABC', + payload: { + is_raw: true, + data_source: { + sub_type: 'ANYTHING', + }, + schema: ['DOBY', 'PHONE', 'GEN', 'FI', 'MADID', 'ZIP', 'ST', 'COUNTRY'], + data: [['2013', '@09432457768', 'f', 'Ms.', 'ABC', 'ZIP ', '123abc ', 'IN']], + }, + }, + userId: '', + body: { + JSON: {}, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, + }, + httpRes: { + data: { + error: { + code: 1487301, + message: + 'Custom Audience Unavailable: The custom audience you are trying to use has not been shared with your ad account', + type: 'GraphMethodException', + }, + }, + status: 400, + }, + }, + { + httpReq: { + version: '1', + type: 'REST', + method: 'DELETE', + endpoint: getEndPoint('aud1'), + headers: { + 'test-dest-response-key': 'audienceDeletedError', + }, + params: { + access_token: 'ABC', + payload: { + is_raw: true, + data_source: { + sub_type: 'ANYTHING', + }, + schema: [ + 'EMAIL', + 'DOBM', + 'DOBD', + 'DOBY', + 'PHONE', + 'GEN', + 'FI', + 'MADID', + 'ZIP', + 'ST', + 'COUNTRY', + ], + data: [ + [ + 'shrouti@abc.com', + '2', + '13', + '2013', + '@09432457768', + 'f', + 'Ms.', + 'ABC', + 'ZIP ', + '123abc ', + 'IN', + ], + ], }, - httpRes: { - data: { - error: { - code: 294, - message: "Missing permission. Please make sure you have ads_management permission and the application is included in the allowlist", - type: "GraphMethodException", - } - }, - "status": 400 - } + }, + userId: '', + body: { + JSON: {}, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, }, - { - httpReq: { - version: '1', - type: 'REST', - method: 'DELETE', - endpoint: 'https://graph.facebook.com/v17.0/aud1/users', - headers: { - 'test-dest-response-key': 'audienceUnavailableError' - }, - params: { - access_token: 'ABC', - payload: { - is_raw: true, - data_source: { - sub_type: 'ANYTHING', - }, - schema: [ - 'DOBY', - 'PHONE', - 'GEN', - 'FI', - 'MADID', - 'ZIP', - 'ST', - 'COUNTRY', - ], - data: [ - [ - '2013', - '@09432457768', - 'f', - 'Ms.', - 'ABC', - 'ZIP ', - '123abc ', - 'IN', - ], - ], - }, - }, - userId: '', - body: { - JSON: {}, - XML: {}, - JSON_ARRAY: {}, - FORM: {}, - }, - files: {}, + httpRes: { + data: { + error: { + code: 1487366, + message: 'Custom Audience Has Been Deleted', + type: 'GraphMethodException', }, - httpRes: { - data: { - error: { - code: 1487301, - message: "Custom Audience Unavailable: The custom audience you are trying to use has not been shared with your ad account", - type: "GraphMethodException", - } - }, - "status": 400 - } + }, + status: 400, }, - { - httpReq: { - version: '1', - type: 'REST', - method: 'DELETE', - endpoint: 'https://graph.facebook.com/v17.0/aud1/users', - headers: { - 'test-dest-response-key': 'audienceDeletedError' - }, - params: { - access_token: 'ABC', - payload: { - is_raw: true, - data_source: { - sub_type: 'ANYTHING', - }, - schema: [ - 'EMAIL', - 'DOBM', - 'DOBD', - 'DOBY', - 'PHONE', - 'GEN', - 'FI', - 'MADID', - 'ZIP', - 'ST', - 'COUNTRY', - ], - data: [ - [ - 'shrouti@abc.com', - '2', - '13', - '2013', - '@09432457768', - 'f', - 'Ms.', - 'ABC', - 'ZIP ', - '123abc ', - 'IN', - ], - ], - }, - }, - userId: '', - body: { - JSON: {}, - XML: {}, - JSON_ARRAY: {}, - FORM: {}, - }, - files: {}, + }, + { + httpReq: { + version: '1', + type: 'REST', + method: 'DELETE', + endpoint: getEndPoint('aud1'), + headers: { + 'test-dest-response-key': 'failedToUpdateAudienceError', + }, + params: { + access_token: 'ABC', + payload: { + is_raw: true, + data_source: { + sub_type: 'ANYTHING', + }, + schema: [ + 'EMAIL', + 'DOBM', + 'DOBD', + 'DOBY', + 'PHONE', + 'GEN', + 'FI', + 'MADID', + 'ZIP', + 'ST', + 'COUNTRY', + ], + data: [ + [ + 'shrouti@abc.com', + '2', + '13', + '2013', + '@09432457768', + 'f', + 'Ms.', + 'ABC', + 'ZIP ', + '123abc ', + 'IN', + ], + ], }, - httpRes: { - data: { - error: { - code: 1487366, - message: "Custom Audience Has Been Deleted", - type: "GraphMethodException", - } - }, - "status": 400 - } + }, + userId: '', + body: { + JSON: {}, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, }, - { - httpReq: { - version: '1', - type: 'REST', - method: 'DELETE', - endpoint: 'https://graph.facebook.com/v17.0/aud1/users', - headers: { - 'test-dest-response-key': 'failedToUpdateAudienceError' - }, - params: { - access_token: 'ABC', - payload: { - is_raw: true, - data_source: { - sub_type: 'ANYTHING', - }, - schema: [ - 'EMAIL', - 'DOBM', - 'DOBD', - 'DOBY', - 'PHONE', - 'GEN', - 'FI', - 'MADID', - 'ZIP', - 'ST', - 'COUNTRY', - ], - data: [ - [ - 'shrouti@abc.com', - '2', - '13', - '2013', - '@09432457768', - 'f', - 'Ms.', - 'ABC', - 'ZIP ', - '123abc ', - 'IN', - ], - ], - }, - }, - userId: '', - body: { - JSON: {}, - XML: {}, - JSON_ARRAY: {}, - FORM: {}, - }, - files: {}, + httpRes: { + data: { + error: { + code: 2650, + message: 'Failed to update the custom audience', + type: 'GraphMethodException', }, - httpRes: { - data: { - error: { - code: 2650, - message: "Failed to update the custom audience", - type: "GraphMethodException", - } - }, - "status": 400 - } + }, + status: 400, }, - { - httpReq: { - version: '1', - type: 'REST', - method: 'DELETE', - endpoint: 'https://graph.facebook.com/v17.0/aud1/users', - headers: { - 'test-dest-response-key': 'parameterExceededError' - }, - params: { - access_token: 'ABC', - payload: { - is_raw: true, - data_source: { - sub_type: 'ANYTHING', - }, - schema: [ - 'EMAIL', - 'DOBM', - 'DOBD', - 'DOBY', - 'PHONE', - 'GEN', - 'FI', - 'MADID', - 'ZIP', - 'ST', - 'COUNTRY', - ], - data: [ - [ - 'shrouti@abc.com', - '2', - '13', - '2013', - '@09432457768', - 'f', - 'Ms.', - 'ABC', - 'ZIP ', - '123abc ', - 'IN', - ], - ], - }, - }, - userId: '', - body: { - JSON: {}, - XML: {}, - JSON_ARRAY: {}, - FORM: {}, - }, - files: {}, + }, + { + httpReq: { + version: '1', + type: 'REST', + method: 'DELETE', + endpoint: getEndPoint('aud1'), + headers: { + 'test-dest-response-key': 'parameterExceededError', + }, + params: { + access_token: 'ABC', + payload: { + is_raw: true, + data_source: { + sub_type: 'ANYTHING', + }, + schema: [ + 'EMAIL', + 'DOBM', + 'DOBD', + 'DOBY', + 'PHONE', + 'GEN', + 'FI', + 'MADID', + 'ZIP', + 'ST', + 'COUNTRY', + ], + data: [ + [ + 'shrouti@abc.com', + '2', + '13', + '2013', + '@09432457768', + 'f', + 'Ms.', + 'ABC', + 'ZIP ', + '123abc ', + 'IN', + ], + ], }, - httpRes: { - data: { - error: { - code: 105, - message: "The number of parameters exceeded the maximum for this operation", - type: "GraphMethodException", - } - }, - "status": 400 - } + }, + userId: '', + body: { + JSON: {}, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, }, - { - httpReq: { - version: '1', - type: 'REST', - method: 'DELETE', - endpoint: 'https://graph.facebook.com/v17.0/aud1/users', - headers: { - 'test-dest-response-key': 'tooManyCallsError' - }, - params: { - access_token: 'ABC', - payload: { - is_raw: true, - data_source: { - sub_type: 'ANYTHING', - }, - schema: [ - 'EMAIL', - 'DOBM', - 'DOBD', - 'DOBY', - 'PHONE', - 'GEN', - 'FI', - 'MADID', - 'ZIP', - 'ST', - 'COUNTRY', - ], - data: [ - [ - 'shrouti@abc.com', - '2', - '13', - '2013', - '@09432457768', - 'f', - 'Ms.', - 'ABC', - 'ZIP ', - '123abc ', - 'IN', - ], - ], - }, - }, - userId: '', - body: { - JSON: {}, - XML: {}, - JSON_ARRAY: {}, - FORM: {}, - }, - files: {}, + httpRes: { + data: { + error: { + code: 105, + message: 'The number of parameters exceeded the maximum for this operation', + type: 'GraphMethodException', }, - httpRes: { - data: { - error: { - code: 80003, - message: "There have been too many calls to this ad-account.", - type: "GraphMethodException", - } - }, - "status": 429 - } - } -]; \ No newline at end of file + }, + status: 400, + }, + }, + { + httpReq: { + version: '1', + type: 'REST', + method: 'DELETE', + endpoint: getEndPoint('aud1'), + headers: { + 'test-dest-response-key': 'tooManyCallsError', + }, + params: { + access_token: 'ABC', + payload: { + is_raw: true, + data_source: { + sub_type: 'ANYTHING', + }, + schema: [ + 'EMAIL', + 'DOBM', + 'DOBD', + 'DOBY', + 'PHONE', + 'GEN', + 'FI', + 'MADID', + 'ZIP', + 'ST', + 'COUNTRY', + ], + data: [ + [ + 'shrouti@abc.com', + '2', + '13', + '2013', + '@09432457768', + 'f', + 'Ms.', + 'ABC', + 'ZIP ', + '123abc ', + 'IN', + ], + ], + }, + }, + userId: '', + body: { + JSON: {}, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, + }, + httpRes: { + data: { + error: { + code: 80003, + message: 'There have been too many calls to this ad-account.', + type: 'GraphMethodException', + }, + }, + status: 429, + }, + }, + { + httpReq: { + version: '1', + type: 'REST', + method: 'DELETE', + endpoint: getEndPoint('aud1'), + headers: { + 'test-dest-response-key': 'code200PermissionError', + }, + params: { + access_token: 'ABC', + payload: { + is_raw: true, + data_source: { + sub_type: 'ANYTHING', + }, + schema: [ + 'EMAIL', + 'DOBM', + 'DOBD', + 'DOBY', + 'PHONE', + 'GEN', + 'FI', + 'MADID', + 'ZIP', + 'ST', + 'COUNTRY', + ], + data: [ + [ + 'shrouti@abc.com', + '2', + '13', + '2013', + '@09432457768', + 'f', + 'Ms.', + 'ABC', + 'ZIP ', + '123abc ', + 'IN', + ], + ], + }, + }, + userId: '', + body: { + JSON: {}, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, + }, + httpRes: { + data: { + error: { + code: 200, + fbtrace_id: 'AFfWqjY-_y2Q92DsyJ4DQ6f', + message: '(#200) The current user can not update audience 23861283180290489', + type: 'OAuthException', + }, + }, + status: 403, + }, + }, +]; diff --git a/test/integrations/destinations/fb_custom_audience/processor/data.ts b/test/integrations/destinations/fb_custom_audience/processor/data.ts index 17dcda3a98..4f892f6fef 100644 --- a/test/integrations/destinations/fb_custom_audience/processor/data.ts +++ b/test/integrations/destinations/fb_custom_audience/processor/data.ts @@ -1,3 +1,5 @@ +import { getEndPoint } from '../../../../../src/v0/destinations/fb_custom_audience/config'; + export const data = [ { name: 'fb_custom_audience', @@ -552,7 +554,7 @@ export const data = [ version: '1', type: 'REST', method: 'DELETE', - endpoint: 'https://graph.facebook.com/v17.0/aud1/users', + endpoint: getEndPoint('aud1'), headers: {}, params: { access_token: 'ABC', @@ -607,7 +609,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/aud1/users', + endpoint: getEndPoint('aud1'), headers: {}, params: { access_token: 'ABC', @@ -763,7 +765,7 @@ export const data = [ version: '1', type: 'REST', method: 'DELETE', - endpoint: 'https://graph.facebook.com/v17.0/aud1/users', + endpoint: getEndPoint('aud1'), headers: {}, params: { access_token: 'ABC', @@ -818,7 +820,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/aud1/users', + endpoint: getEndPoint('aud1'), headers: {}, userId: '', params: { @@ -963,7 +965,7 @@ export const data = [ version: '1', type: 'REST', method: 'DELETE', - endpoint: 'https://graph.facebook.com/v17.0/aud1/users', + endpoint: getEndPoint('aud1'), headers: {}, params: { access_token: 'ABC', @@ -993,7 +995,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/aud1/users', + endpoint: getEndPoint('aud1'), headers: {}, params: { access_token: 'ABC', @@ -1123,7 +1125,7 @@ export const data = [ version: '1', type: 'REST', method: 'DELETE', - endpoint: 'https://graph.facebook.com/v17.0/aud1/users', + endpoint: getEndPoint('aud1'), headers: {}, params: { access_token: 'ABC', @@ -1179,7 +1181,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/aud1/users', + endpoint: getEndPoint('aud1'), headers: {}, params: { access_token: 'ABC', @@ -1336,7 +1338,7 @@ export const data = [ version: '1', type: 'REST', method: 'DELETE', - endpoint: 'https://graph.facebook.com/v17.0/aud1/users', + endpoint: getEndPoint('aud1'), headers: {}, userId: '', params: { @@ -1391,7 +1393,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/aud1/users', + endpoint: getEndPoint('aud1'), headers: {}, params: { access_token: 'ABC', @@ -1547,7 +1549,7 @@ export const data = [ version: '1', type: 'REST', method: 'DELETE', - endpoint: 'https://graph.facebook.com/v17.0/aud1/users', + endpoint: getEndPoint('aud1'), headers: {}, params: { access_token: 'ABC', @@ -1602,7 +1604,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/aud1/users', + endpoint: getEndPoint('aud1'), headers: {}, params: { access_token: 'ABC', @@ -1758,7 +1760,7 @@ export const data = [ version: '1', type: 'REST', method: 'DELETE', - endpoint: 'https://graph.facebook.com/v17.0/aud1/users', + endpoint: getEndPoint('aud1'), headers: {}, userId: '', params: { @@ -1813,7 +1815,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/aud1/users', + endpoint: getEndPoint('aud1'), headers: {}, userId: '', params: { @@ -1955,7 +1957,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/aud1/users', + endpoint: getEndPoint('aud1'), headers: {}, userId: '', params: { @@ -2097,7 +2099,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/aud1/users', + endpoint: getEndPoint('aud1'), headers: {}, userId: '', params: { @@ -2226,7 +2228,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/aud1/users', + endpoint: getEndPoint('aud1'), headers: {}, params: { access_token: 'ABC', @@ -28302,7 +28304,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/aud1/users', + endpoint: getEndPoint('aud1'), headers: {}, params: { access_token: 'ABC', @@ -34844,7 +34846,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/aud1/users', + endpoint: getEndPoint('aud1'), headers: {}, params: { access_token: 'ABC', @@ -41386,7 +41388,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/aud1/users', + endpoint: getEndPoint('aud1'), headers: {}, params: { access_token: 'ABC', @@ -47902,7 +47904,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/aud1/users', + endpoint: getEndPoint('aud1'), headers: {}, params: { access_token: 'ABC', diff --git a/test/integrations/destinations/fb_custom_audience/router/data.ts b/test/integrations/destinations/fb_custom_audience/router/data.ts index c458b45c91..efefb80a89 100644 --- a/test/integrations/destinations/fb_custom_audience/router/data.ts +++ b/test/integrations/destinations/fb_custom_audience/router/data.ts @@ -1,3 +1,5 @@ +import { getEndPoint } from '../../../../../src/v0/destinations/fb_custom_audience/config'; + export const data = [ { name: 'fb_custom_audience', @@ -189,7 +191,7 @@ export const data = [ version: '1', type: 'REST', method: 'DELETE', - endpoint: 'https://graph.facebook.com/v17.0/aud1/users', + endpoint: getEndPoint('aud1'), headers: {}, params: { access_token: 'ABC', @@ -241,7 +243,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/aud1/users', + endpoint: getEndPoint('aud1'), headers: {}, params: { access_token: 'ABC', @@ -332,7 +334,7 @@ export const data = [ version: '1', type: 'REST', method: 'DELETE', - endpoint: 'https://graph.facebook.com/v17.0/aud1/users', + endpoint: getEndPoint('aud1'), headers: {}, params: { access_token: 'ABC', @@ -383,7 +385,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/aud1/users', + endpoint: getEndPoint('aud1'), headers: {}, params: { access_token: 'ABC', @@ -26748,7 +26750,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/23848494844100489/users', + endpoint: getEndPoint('23848494844100489'), headers: {}, params: { access_token: 'ABC', @@ -26874,7 +26876,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/aud1/users', + endpoint: getEndPoint('aud1'), headers: {}, params: { access_token: 'ABC', @@ -33409,7 +33411,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/aud1/users', + endpoint: getEndPoint('aud1'), headers: {}, params: { access_token: 'ABC', @@ -39944,7 +39946,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/aud1/users', + endpoint: getEndPoint('aud1'), headers: {}, params: { access_token: 'ABC', @@ -46453,7 +46455,7 @@ export const data = [ version: '1', type: 'REST', method: 'POST', - endpoint: 'https://graph.facebook.com/v17.0/aud1/users', + endpoint: getEndPoint('aud1'), headers: {}, params: { access_token: 'ABC', diff --git a/test/integrations/destinations/fullstory/processor/data.ts b/test/integrations/destinations/fullstory/processor/data.ts new file mode 100644 index 0000000000..d206b4a84f --- /dev/null +++ b/test/integrations/destinations/fullstory/processor/data.ts @@ -0,0 +1,462 @@ +export const data = [ + { + name: 'fullstory', + description: 'Complete track event', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + anonymousId: '78c53c15-32a1-4b65-adac-bec2d7bb8fab', + channel: 'web', + context: { + app: { + name: 'RSPM', + version: '1.9.0', + }, + campaign: { + name: 'sales campaign', + source: 'google', + medium: 'medium', + term: 'event data', + content: 'Make sense of the modern data stack', + }, + ip: '192.0.2.0', + library: { + name: 'RudderLabs JavaScript SDK', + version: '2.9.1', + }, + locale: 'en-US', + device: { + manufacturer: 'Nokia', + model: 'N2023', + }, + page: { + path: '/best-seller/1', + initial_referrer: 'https://www.google.com/search', + initial_referring_domain: 'google.com', + referrer: 'https://www.google.com/search?q=estore+bestseller', + referring_domain: 'google.com', + search: 'estore bestseller', + title: 'The best sellers offered by EStore', + url: 'https://www.estore.com/best-seller/1', + }, + screen: { + density: 420, + height: 1794, + width: 1080, + innerHeight: 200, + innerWidth: 100, + }, + userAgent: + 'Dalvik/2.1.0 (Linux; U; Android 9; Android SDK built for x86 Build/PSR1.180720.075)', + }, + event: 'Product Reviewed', + integrations: { + All: true, + }, + messageId: '1578564113557-af022c68-429e-4af4-b99b-2b9174056383', + properties: { + userId: 'u001', + sessionId: 's001', + review_id: 'review_id_1', + product_id: 'product_id_1', + rating: 5, + review_body: 'Sample Review Body', + latitude: 44.56, + longitude: 54.46, + region: 'Atlas', + city: 'NY', + country: 'USA', + }, + originalTimestamp: '2020-01-09T10:01:53.558Z', + type: 'track', + sentAt: '2020-01-09T10:02:03.257Z', + }, + destination: { + ID: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', + Name: 'Fullstory', + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + Config: { + apiKey: 'dummyfullstoryAPIKey', + }, + Enabled: true, + Transformations: [], + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + body: { + JSON: { + name: 'Product Reviewed', + properties: { + userId: 'u001', + sessionId: 's001', + review_id: 'review_id_1', + product_id: 'product_id_1', + rating: 5, + review_body: 'Sample Review Body', + latitude: 44.56, + longitude: 54.46, + region: 'Atlas', + city: 'NY', + country: 'USA', + }, + timestamp: '2020-01-09T10:01:53.558Z', + context: { + browser: { + url: 'https://www.estore.com/best-seller/1', + user_agent: + 'Dalvik/2.1.0 (Linux; U; Android 9; Android SDK built for x86 Build/PSR1.180720.075)', + initial_referrer: 'https://www.google.com/search', + }, + mobile: { + app_name: 'RSPM', + app_version: '1.9.0', + }, + device: { + manufacturer: 'Nokia', + model: 'N2023', + }, + location: { + ip_address: '192.0.2.0', + latitude: 44.56, + longitude: 54.46, + city: 'NY', + region: 'Atlas', + country: 'USA', + }, + }, + session: { + id: 's001', + }, + user: { + id: 'u001', + }, + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://api.fullstory.com/v2/events', + headers: { + authorization: 'Basic dummyfullstoryAPIKey', + 'content-type': 'application/json', + }, + params: {}, + files: {}, + userId: '', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'fullstory', + description: 'Missing event name', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + channel: 'web', + context: { + device: { + manufacturer: 'Nokia', + model: 'N2023', + }, + userAgent: + 'Dalvik/2.1.0 (Linux; U; Android 9; Android SDK built for x86 Build/PSR1.180720.075)', + }, + integrations: { + All: true, + }, + properties: { + userId: 'u001', + latitude: 44.56, + longitude: 54.46, + region: 'Atlas', + city: 'NY', + country: 'USA', + }, + originalTimestamp: '2020-01-09T10:01:53.558Z', + type: 'track', + sentAt: '2020-01-09T10:02:03.257Z', + }, + destination: { + ID: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', + Name: 'Fullstory', + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + Config: { + apiKey: 'dummyfullstoryAPIKey', + }, + Enabled: true, + Transformations: [], + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 400, + error: + 'event is required for track call: Workflow: procWorkflow, Step: validateEventName, ChildStep: undefined, OriginalError: event is required for track call', + statTags: { + errorCategory: 'dataValidation', + errorType: 'instrumentation', + implementation: 'cdkV2', + destType: 'FULLSTORY', + module: 'destination', + feature: 'processor', + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + }, + { + name: 'fullstory', + description: 'Complete identify event', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + userId: 'dummy-user001', + channel: 'web', + context: { + traits: { + company: 'Initech', + address: { + country: 'USA', + state: 'CA', + street: '101 dummy street', + }, + email: 'dummyuser@domain.com', + name: 'dummy user', + phone: '099-999-9999', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36', + }, + integrations: { + All: true, + }, + originalTimestamp: '2020-01-27T12:20:55.301Z', + receivedAt: '2020-01-27T17:50:58.657+05:30', + request_ip: '14.98.244.60', + sentAt: '2020-01-27T12:20:56.849Z', + timestamp: '2020-01-27T17:50:57.109+05:30', + type: 'identify', + }, + destination: { + ID: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', + Name: 'Fullstory', + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + Config: { + apiKey: 'fullstoryAPIKey', + }, + Enabled: true, + Transformations: [], + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + body: { + JSON: { + properties: { + company: 'Initech', + address: { + country: 'USA', + state: 'CA', + street: '101 dummy street', + }, + email: 'dummyuser@domain.com', + name: 'dummy user', + phone: '099-999-9999', + }, + uid: 'dummy-user001', + email: 'dummyuser@domain.com', + display_name: 'dummy user', + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://api.fullstory.com/v2/users', + headers: { + authorization: 'Basic fullstoryAPIKey', + 'content-type': 'application/json', + }, + params: {}, + files: {}, + userId: '', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'fullstory', + description: 'Identify event with needed traits', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + userId: 'dummy-user001', + channel: 'web', + context: { + traits: { + email: 'dummyuser@domain.com', + name: 'dummy user', + phone: '099-999-9999', + }, + }, + timestamp: '2020-01-27T17:50:57.109+05:30', + type: 'identify', + }, + destination: { + ID: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', + Name: 'Fullstory', + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + Config: { + apiKey: 'fullstoryAPIKey', + }, + Enabled: true, + Transformations: [], + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + body: { + JSON: { + properties: { + email: 'dummyuser@domain.com', + name: 'dummy user', + phone: '099-999-9999', + }, + uid: 'dummy-user001', + email: 'dummyuser@domain.com', + display_name: 'dummy user', + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://api.fullstory.com/v2/users', + headers: { + authorization: 'Basic fullstoryAPIKey', + 'content-type': 'application/json', + }, + params: {}, + files: {}, + userId: '', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 200, + }, + ], + }, + }, + }, +]; diff --git a/test/integrations/destinations/gladly/network.ts b/test/integrations/destinations/gladly/network.ts new file mode 100644 index 0000000000..8c1c228738 --- /dev/null +++ b/test/integrations/destinations/gladly/network.ts @@ -0,0 +1,120 @@ +const deleteNwData = [ + { + httpReq: { + method: 'get', + url: 'https://rudderlabs.us-uat.gladly.qa/api/v1/customer-profiles?email=test%40rudderlabs.com', + headers: { + 'Content-Type': 'application/json', + Authorization: 'Basic dGVzdFVzZXJOYW1lOnRlc3RBcGlUb2tlbg==', + }, + }, + httpRes: { + data: [], + status: 200, + }, + }, + { + httpReq: { + method: 'get', + url: 'https://rudderlabs.us-uat.gladly.qa/api/v1/customer-profiles?email=test%2B2%40rudderlabs.com', + headers: { + 'Content-Type': 'application/json', + Authorization: 'Basic dGVzdFVzZXJOYW1lOnRlc3RBcGlUb2tlbg==', + }, + }, + httpRes: { + data: [ + { + emails: [ + { + normalized: 'test+2@rudderstack.com', + original: 'test+2@rudderlabs.com', + }, + ], + externalCustomerId: 'externalCustomer@2', + name: 'Test Rudderstack', + phones: [], + id: 'user@2', + }, + ], + status: 200, + }, + }, + { + httpReq: { + method: 'get', + url: 'https://rudderlabs.us-uat.gladly.qa/api/v1/customer-profiles?phoneNumber=%2B91%209999999988', + headers: { + 'Content-Type': 'application/json', + Authorization: 'Basic dGVzdFVzZXJOYW1lOnRlc3RBcGlUb2tlbg==', + }, + }, + httpRes: { + data: [ + { + emails: [ + { + normalized: 'test+3@rudderstack.com', + original: 'test+3@rudderlabs.com', + }, + ], + externalCustomerId: 'externalCustomer@3', + name: 'Test Rudderstack', + phones: [], + id: 'user@3', + }, + { + emails: [ + { + normalized: 'test+4@rudderstack.com', + original: 'test+4@rudderlabs.com', + }, + ], + externalCustomerId: 'externalCustomer@4', + name: 'Test Rudderstack', + phones: [], + id: 'user@4', + }, + ], + status: 200, + }, + }, + { + httpReq: { + method: 'get', + url: 'https://rudderlabs.us-uat.gladly.qa/api/v1/customer-profiles?email=test6%40rudderlabs.com', + headers: { + 'Content-Type': 'application/json', + Authorization: 'Basic dGVzdFVzZXJOYW1lOnRlc3RBcGlUb2tlbg==', + }, + }, + httpRes: { + data: [], + status: 200, + }, + }, + { + httpReq: { + method: 'get', + url: 'https://rudderlabs.us-uat.gladly.qa/api/v1/customer-profiles?email=abc', + headers: { + 'Content-Type': 'application/json', + Authorization: 'Basic dGVzdFVzZXJOYW1lOnRlc3RBcGlUb2tlbg==', + }, + }, + httpRes: { + data: { + errors: [ + { + attr: 'email', + code: 'invalid', + detail: 'invalid email address', + }, + ], + }, + status: 400, + }, + }, +]; + +export const networkCallsData = [...deleteNwData]; diff --git a/test/integrations/destinations/gladly/processor/data.ts b/test/integrations/destinations/gladly/processor/data.ts new file mode 100644 index 0000000000..e81af999fb --- /dev/null +++ b/test/integrations/destinations/gladly/processor/data.ts @@ -0,0 +1,809 @@ +export const data = [ + { + name: 'gladly', + description: 'No message type', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + userId: 'user@1', + channel: 'web', + context: { + traits: { + age: 23, + email: 'adc@test.com', + firstName: 'Test', + }, + }, + originalTimestamp: '2023-11-10T14:42:44.724Z', + timestamp: '2023-11-22T10:12:44.757+05:30', + }, + destination: { + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + Config: { + apiToken: 'testApiToken', + userName: 'testUserName', + domain: 'rudderlabs.us-uat.gladly.qa', + }, + }, + metadata: { + jobId: 1, + }, + }, + ], + method: 'POST', + }, + }, + output: { + response: { + status: 200, + body: [ + { + metadata: { + jobId: 1, + }, + statusCode: 400, + error: + 'message Type is not present. Aborting: Workflow: procWorkflow, Step: validateInput, ChildStep: undefined, OriginalError: message Type is not present. Aborting', + statTags: { + errorCategory: 'dataValidation', + errorType: 'instrumentation', + destType: 'GLADLY', + module: 'destination', + implementation: 'cdkV2', + feature: 'processor', + }, + }, + ], + }, + }, + }, + { + name: 'gladly', + description: 'Unsupported message type', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + userId: 'user@1', + channel: 'web', + context: { + traits: { + age: 23, + email: 'adc@test.com', + firstName: 'Test', + }, + }, + event: 'Product Viewed', + type: 'track', + originalTimestamp: '2023-11-10T14:42:44.724Z', + timestamp: '2023-11-22T10:12:44.757+05:30', + }, + destination: { + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + Config: { + apiToken: 'testApiToken', + userName: 'testUserName', + domain: 'rudderlabs.us-uat.gladly.qa', + }, + }, + metadata: { + jobId: 2, + }, + }, + ], + method: 'POST', + }, + }, + output: { + response: { + status: 200, + body: [ + { + metadata: { + jobId: 2, + }, + statusCode: 400, + error: + 'message type track is not supported: Workflow: procWorkflow, Step: validateInput, ChildStep: undefined, OriginalError: message type track is not supported', + statTags: { + errorCategory: 'dataValidation', + errorType: 'instrumentation', + destType: 'GLADLY', + module: 'destination', + implementation: 'cdkV2', + feature: 'processor', + }, + }, + ], + }, + }, + }, + { + name: 'gladly', + description: 'Missing config', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + userId: 'user@1', + channel: 'web', + context: { + traits: { + age: 23, + email: 'adc@test.com', + firstName: 'Test', + }, + }, + type: 'identify', + originalTimestamp: '2023-11-10T14:42:44.724Z', + timestamp: '2023-11-22T10:12:44.757+05:30', + }, + destination: { + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + Config: { + apiToken: 'testApiToken', + domain: 'rudderlabs.us-uat.gladly.qa', + }, + }, + metadata: { + jobId: 3, + }, + }, + ], + method: 'POST', + }, + }, + output: { + response: { + status: 200, + body: [ + { + metadata: { + jobId: 3, + }, + statusCode: 400, + error: + 'User Name is not present. Aborting: Workflow: procWorkflow, Step: validateInput, ChildStep: undefined, OriginalError: User Name is not present. Aborting', + statTags: { + errorCategory: 'dataValidation', + errorType: 'configuration', + destType: 'GLADLY', + module: 'destination', + implementation: 'cdkV2', + feature: 'processor', + }, + }, + ], + }, + }, + }, + { + name: 'gladly', + description: 'Create customer with email as lookup field', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + userId: 'externalCustomer@1', + channel: 'web', + context: { + traits: { + age: 23, + email: 'test@rudderlabs.com', + phone: '+91 9999999999', + firstName: 'Test', + lastName: 'Rudderlabs', + address: 'california usa', + }, + externalId: [ + { + id: 'user@1', + type: 'GladlyCustomerId', + }, + ], + }, + type: 'identify', + originalTimestamp: '2023-11-10T14:42:44.724Z', + timestamp: '2023-11-22T10:12:44.757+05:30', + }, + destination: { + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + Config: { + apiToken: 'testApiToken', + userName: 'testUserName', + domain: 'rudderlabs.us-uat.gladly.qa', + }, + }, + metadata: { + jobId: 4, + }, + }, + ], + method: 'POST', + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + body: { + JSON: { + address: 'california usa', + customAttributes: { age: 23 }, + emails: [{ original: 'test@rudderlabs.com' }], + externalCustomerId: 'externalCustomer@1', + id: 'user@1', + phones: [{ original: '+91 9999999999' }], + }, + XML: {}, + FORM: {}, + JSON_ARRAY: {}, + }, + endpoint: 'https://rudderlabs.us-uat.gladly.qa/api/v1/customer-profiles', + headers: { + Authorization: 'Basic dGVzdFVzZXJOYW1lOnRlc3RBcGlUb2tlbg==', + 'Content-Type': 'application/json', + }, + userId: '', + version: '1', + type: 'REST', + method: 'POST', + files: {}, + params: {}, + }, + metadata: { jobId: 4 }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'gladly', + description: 'Update customer with email as lookup field', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + userId: 'externalCustomer@2', + channel: 'web', + context: { + traits: { + age: 23, + email: 'test+2@rudderlabs.com', + phone: '+91 9999999998', + firstName: 'Test', + lastName: 'Rudderstack', + address: 'New York, USA', + }, + externalId: [ + { + id: 'user@2', + type: 'GladlyCustomerId', + }, + ], + }, + type: 'identify', + originalTimestamp: '2023-11-10T14:42:44.724Z', + timestamp: '2023-11-22T10:12:44.757+05:30', + }, + destination: { + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + Config: { + apiToken: 'testApiToken', + userName: 'testUserName', + domain: 'rudderlabs.us-uat.gladly.qa', + }, + }, + metadata: { + jobId: 5, + }, + }, + ], + method: 'POST', + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + body: { + JSON: { + address: 'New York, USA', + customAttributes: { age: 23 }, + emails: [{ original: 'test+2@rudderlabs.com' }], + externalCustomerId: 'externalCustomer@2', + phones: [{ original: '+91 9999999998' }], + }, + XML: {}, + FORM: {}, + JSON_ARRAY: {}, + }, + endpoint: 'https://rudderlabs.us-uat.gladly.qa/api/v1/customer-profiles/user@2', + headers: { + Authorization: 'Basic dGVzdFVzZXJOYW1lOnRlc3RBcGlUb2tlbg==', + 'Content-Type': 'application/json', + }, + userId: '', + version: '1', + type: 'REST', + method: 'PATCH', + files: {}, + params: {}, + }, + metadata: { jobId: 5 }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'gladly', + description: 'Update customer with phone as lookup field', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + userId: 'externalCustomer@3', + channel: 'web', + context: { + traits: { + phone: '+91 9999999988', + firstName: 'Test', + lastName: 'Rudderstack', + address: 'New York, USA', + }, + externalId: [ + { + id: 'user@3', + type: 'GladlyCustomerId', + }, + ], + }, + type: 'identify', + originalTimestamp: '2023-11-10T14:42:44.724Z', + timestamp: '2023-11-22T10:12:44.757+05:30', + }, + destination: { + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + Config: { + apiToken: 'testApiToken', + userName: 'testUserName', + domain: 'rudderlabs.us-uat.gladly.qa', + }, + }, + metadata: { + jobId: 6, + }, + }, + ], + method: 'POST', + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + body: { + JSON: { + address: 'New York, USA', + externalCustomerId: 'externalCustomer@3', + phones: [{ original: '+91 9999999988' }], + }, + XML: {}, + FORM: {}, + JSON_ARRAY: {}, + }, + endpoint: 'https://rudderlabs.us-uat.gladly.qa/api/v1/customer-profiles/user@3', + headers: { + Authorization: 'Basic dGVzdFVzZXJOYW1lOnRlc3RBcGlUb2tlbg==', + 'Content-Type': 'application/json', + }, + userId: '', + version: '1', + type: 'REST', + method: 'PATCH', + files: {}, + params: {}, + }, + metadata: { jobId: 6 }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'gladly', + description: 'Required values are not present in payload to create or update customer', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + channel: 'web', + context: { + traits: { + firstName: 'Test', + lastName: 'Rudderstack', + address: 'New York, USA', + }, + }, + type: 'identify', + anonymousId: '78c53c15-32a1-4b65-adac-bec2d7bb8fab', + originalTimestamp: '2023-11-10T14:42:44.724Z', + timestamp: '2023-11-22T10:12:44.757+05:30', + }, + destination: { + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + Config: { + apiToken: 'testApiToken', + userName: 'testUserName', + domain: 'rudderlabs.us-uat.gladly.qa', + }, + }, + metadata: { + jobId: 7, + }, + }, + ], + method: 'POST', + }, + }, + output: { + response: { + status: 200, + body: [ + { + metadata: { + jobId: 7, + }, + statusCode: 400, + error: + 'One of phone, email, userId or GladlyCustomerId is required for an identify call: Workflow: procWorkflow, Step: validatePayload, ChildStep: undefined, OriginalError: One of phone, email, userId or GladlyCustomerId is required for an identify call', + statTags: { + errorCategory: 'dataValidation', + errorType: 'instrumentation', + destType: 'GLADLY', + module: 'destination', + implementation: 'cdkV2', + feature: 'processor', + }, + }, + ], + }, + }, + }, + { + name: 'gladly', + description: 'Multiple emails and phones are present in payload', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + userId: 'externalCustomer@6', + channel: 'web', + context: { + traits: { + age: 23, + email: [ + 'test6@rudderlabs.com', + 'test6home@rudderlabs.com', + 'test6office@rudderlabs.com', + ], + phone: ['+91 8888888888', '+91 8888888889'], + firstName: 'Test', + lastName: 'Rudderlabs', + address: 'Germany', + }, + externalId: [ + { + id: 'user@6', + type: 'GladlyCustomerId', + }, + ], + }, + type: 'identify', + originalTimestamp: '2023-11-10T14:42:44.724Z', + timestamp: '2023-11-22T10:12:44.757+05:30', + }, + destination: { + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + Config: { + apiToken: 'testApiToken', + userName: 'testUserName', + domain: 'rudderlabs.us-uat.gladly.qa', + }, + }, + metadata: { + jobId: 8, + }, + }, + ], + method: 'POST', + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + body: { + JSON: { + address: 'Germany', + customAttributes: { age: 23 }, + emails: [ + { original: 'test6@rudderlabs.com' }, + { original: 'test6home@rudderlabs.com' }, + { original: 'test6office@rudderlabs.com' }, + ], + externalCustomerId: 'externalCustomer@6', + id: 'user@6', + phones: [{ original: '+91 8888888888' }, { original: '+91 8888888889' }], + }, + XML: {}, + FORM: {}, + JSON_ARRAY: {}, + }, + endpoint: 'https://rudderlabs.us-uat.gladly.qa/api/v1/customer-profiles', + headers: { + Authorization: 'Basic dGVzdFVzZXJOYW1lOnRlc3RBcGlUb2tlbg==', + 'Content-Type': 'application/json', + }, + userId: '', + version: '1', + type: 'REST', + method: 'POST', + files: {}, + params: {}, + }, + metadata: { jobId: 8 }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'gladly', + description: 'Create customer with only GladlyCustomerId', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + channel: 'web', + context: { + traits: { + firstName: 'Test', + lastName: 'Undefined', + address: 'India', + isProUser: true, + }, + externalId: [ + { + id: 'user@9', + type: 'GladlyCustomerId', + }, + ], + }, + type: 'identify', + originalTimestamp: '2023-11-10T14:42:44.724Z', + timestamp: '2023-11-22T10:12:44.757+05:30', + }, + destination: { + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + Config: { + apiToken: 'testApiToken', + userName: 'testUserName', + domain: 'rudderlabs.us-uat.gladly.qa', + }, + }, + metadata: { + jobId: 9, + }, + }, + ], + method: 'POST', + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + body: { + JSON: { + address: 'India', + customAttributes: { isProUser: true }, + id: 'user@9', + }, + XML: {}, + FORM: {}, + JSON_ARRAY: {}, + }, + endpoint: 'https://rudderlabs.us-uat.gladly.qa/api/v1/customer-profiles', + headers: { + Authorization: 'Basic dGVzdFVzZXJOYW1lOnRlc3RBcGlUb2tlbg==', + 'Content-Type': 'application/json', + }, + userId: '', + version: '1', + type: 'REST', + method: 'POST', + files: {}, + params: {}, + }, + metadata: { jobId: 9 }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'gladly', + description: 'Create customer with invalid lookup field value', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + channel: 'web', + context: { + traits: { + firstName: 'Test', + lastName: 'Undefined', + address: 'Pakistan', + email: 'abc', + }, + externalId: [ + { + id: 'user@10', + type: 'GladlyCustomerId', + }, + ], + }, + type: 'identify', + originalTimestamp: '2023-11-10T14:42:44.724Z', + timestamp: '2023-11-22T10:12:44.757+05:30', + }, + destination: { + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + Config: { + apiToken: 'testApiToken', + userName: 'testUserName', + domain: 'rudderlabs.us-uat.gladly.qa', + }, + }, + metadata: { + jobId: 10, + }, + }, + ], + method: 'POST', + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + body: { + JSON: { + address: 'Pakistan', + emails: [{ original: 'abc' }], + id: 'user@10', + }, + XML: {}, + FORM: {}, + JSON_ARRAY: {}, + }, + endpoint: 'https://rudderlabs.us-uat.gladly.qa/api/v1/customer-profiles', + headers: { + Authorization: 'Basic dGVzdFVzZXJOYW1lOnRlc3RBcGlUb2tlbg==', + 'Content-Type': 'application/json', + }, + userId: '', + version: '1', + type: 'REST', + method: 'POST', + files: {}, + params: {}, + }, + metadata: { jobId: 10 }, + statusCode: 200, + }, + ], + }, + }, + }, +]; diff --git a/test/integrations/destinations/gladly/router/data.ts b/test/integrations/destinations/gladly/router/data.ts new file mode 100644 index 0000000000..413c92e247 --- /dev/null +++ b/test/integrations/destinations/gladly/router/data.ts @@ -0,0 +1,604 @@ +export const data = [ + { + name: 'gladly', + description: 'Gladly router tests', + feature: 'router', + module: 'destination', + version: 'v0', + input: { + request: { + body: { + input: [ + { + message: { + userId: 'externalCustomer@1', + channel: 'web', + context: { + traits: { + age: 23, + email: 'test@rudderlabs.com', + phone: '+91 9999999999', + firstName: 'Test', + lastName: 'Rudderlabs', + address: 'california usa', + }, + externalId: [ + { + id: 'user@1', + type: 'GladlyCustomerId', + }, + ], + }, + type: 'identify', + originalTimestamp: '2023-11-10T14:42:44.724Z', + timestamp: '2023-11-22T10:12:44.75705:30', + }, + destination: { + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + Config: { + apiToken: 'testApiToken', + userName: 'testUserName', + domain: 'rudderlabs.us-uat.gladly.qa', + }, + }, + metadata: { + jobId: 1, + }, + }, + { + message: { + userId: 'externalCustomer@2', + channel: 'web', + context: { + traits: { + age: 23, + email: 'test+2@rudderlabs.com', + phone: '+91 9999999998', + firstName: 'Test', + lastName: 'Rudderstack', + address: 'New York, USA', + }, + externalId: [ + { + id: 'user@2', + type: 'GladlyCustomerId', + }, + ], + }, + type: 'identify', + originalTimestamp: '2023-11-10T14:42:44.724Z', + timestamp: '2023-11-22T10:12:44.75705:30', + }, + destination: { + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + Config: { + apiToken: 'testApiToken', + userName: 'testUserName', + domain: 'rudderlabs.us-uat.gladly.qa', + }, + }, + metadata: { + jobId: 2, + }, + }, + { + message: { + userId: 'externalCustomer@3', + channel: 'web', + context: { + traits: { + phone: '+91 9999999988', + firstName: 'Test', + lastName: 'Rudderstack', + address: 'New York, USA', + }, + externalId: [ + { + id: 'user@3', + type: 'GladlyCustomerId', + }, + ], + }, + type: 'identify', + originalTimestamp: '2023-11-10T14:42:44.724Z', + timestamp: '2023-11-22T10:12:44.75705:30', + }, + destination: { + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + Config: { + apiToken: 'testApiToken', + userName: 'testUserName', + domain: 'rudderlabs.us-uat.gladly.qa', + }, + }, + metadata: { + jobId: 3, + }, + }, + ], + destType: 'gladly', + }, + method: 'POST', + }, + }, + output: { + response: { + status: 200, + body: { + output: [ + { + batched: false, + batchedRequest: { + body: { + FORM: {}, + JSON: { + address: 'california usa', + customAttributes: { + age: 23, + }, + emails: [ + { + original: 'test@rudderlabs.com', + }, + ], + externalCustomerId: 'externalCustomer@1', + id: 'user@1', + phones: [ + { + original: '+91 9999999999', + }, + ], + }, + JSON_ARRAY: {}, + XML: {}, + }, + endpoint: 'https://rudderlabs.us-uat.gladly.qa/api/v1/customer-profiles', + files: {}, + headers: { + Authorization: 'Basic dGVzdFVzZXJOYW1lOnRlc3RBcGlUb2tlbg==', + 'Content-Type': 'application/json', + }, + method: 'POST', + params: {}, + type: 'REST', + version: '1', + }, + destination: { + Config: { + apiToken: 'testApiToken', + domain: 'rudderlabs.us-uat.gladly.qa', + userName: 'testUserName', + }, + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + }, + metadata: [ + { + jobId: 1, + }, + ], + statusCode: 200, + }, + { + batched: false, + batchedRequest: { + body: { + FORM: {}, + JSON: { + address: 'New York, USA', + customAttributes: { + age: 23, + }, + emails: [ + { + original: 'test+2@rudderlabs.com', + }, + ], + externalCustomerId: 'externalCustomer@2', + phones: [ + { + original: '+91 9999999998', + }, + ], + }, + JSON_ARRAY: {}, + XML: {}, + }, + endpoint: 'https://rudderlabs.us-uat.gladly.qa/api/v1/customer-profiles/user@2', + files: {}, + headers: { + Authorization: 'Basic dGVzdFVzZXJOYW1lOnRlc3RBcGlUb2tlbg==', + 'Content-Type': 'application/json', + }, + method: 'PATCH', + params: {}, + type: 'REST', + version: '1', + }, + destination: { + Config: { + apiToken: 'testApiToken', + domain: 'rudderlabs.us-uat.gladly.qa', + userName: 'testUserName', + }, + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + }, + metadata: [ + { + jobId: 2, + }, + ], + statusCode: 200, + }, + { + batched: false, + batchedRequest: { + body: { + FORM: {}, + JSON: { + address: 'New York, USA', + externalCustomerId: 'externalCustomer@3', + phones: [ + { + original: '+91 9999999988', + }, + ], + }, + JSON_ARRAY: {}, + XML: {}, + }, + endpoint: 'https://rudderlabs.us-uat.gladly.qa/api/v1/customer-profiles/user@3', + files: {}, + headers: { + Authorization: 'Basic dGVzdFVzZXJOYW1lOnRlc3RBcGlUb2tlbg==', + 'Content-Type': 'application/json', + }, + method: 'PATCH', + params: {}, + type: 'REST', + version: '1', + }, + destination: { + Config: { + apiToken: 'testApiToken', + domain: 'rudderlabs.us-uat.gladly.qa', + userName: 'testUserName', + }, + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + }, + metadata: [ + { + jobId: 3, + }, + ], + statusCode: 200, + }, + ], + }, + }, + }, + }, + { + name: 'gladly', + description: 'Gladly rETL tests', + feature: 'router', + module: 'destination', + version: 'v0', + input: { + request: { + body: { + input: [ + { + message: { + userId: 'externalCustomer@1', + channel: 'web', + context: { + externalId: [ + { + id: 'externalCustomer@1', + identifierType: 'externalCustomerId', + }, + ], + mappedToDestination: true, + }, + traits: { + id: 'user@1', + emails: ['test@rudderlabs.com'], + phones: ['+91 9999999999'], + firstName: 'Test', + lastName: 'Rudderlabs', + address: 'california usa', + }, + type: 'identify', + originalTimestamp: '2023-11-10T14:42:44.724Z', + timestamp: '2023-11-22T10:12:44.75705:30', + }, + destination: { + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + Config: { + apiToken: 'testApiToken', + userName: 'testUserName', + domain: 'rudderlabs.us-uat.gladly.qa', + }, + }, + metadata: { + jobId: 1, + }, + }, + { + message: { + userId: 'externalCustomer@2', + channel: 'web', + context: { + externalId: [ + { + id: 'externalCustomer@2', + identifierType: 'externalCustomerId', + }, + ], + mappedToDestination: true, + }, + traits: { + id: 'user@2', + emails: 'test+2@rudderlabs.com', + phones: '+91 9999999998', + firstName: 'Test', + lastName: 'Rudderstack', + address: 'New York, USA', + }, + type: 'identify', + originalTimestamp: '2023-11-10T14:42:44.724Z', + timestamp: '2023-11-22T10:12:44.75705:30', + }, + destination: { + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + Config: { + apiToken: 'testApiToken', + userName: 'testUserName', + domain: 'rudderlabs.us-uat.gladly.qa', + }, + }, + metadata: { + jobId: 2, + }, + }, + { + message: { + userId: 'externalCustomer@3', + channel: 'web', + context: { + externalId: [ + { + id: 'externalCustomer@3', + identifierType: 'externalCustomerId', + }, + ], + mappedToDestination: true, + }, + traits: { + id: 'user@3', + phones: '+91 9999999988', + firstName: 'Test', + lastName: 'Rudderstack', + address: 'New York, USA', + }, + type: 'identify', + originalTimestamp: '2023-11-10T14:42:44.724Z', + timestamp: '2023-11-22T10:12:44.75705:30', + }, + destination: { + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + Config: { + apiToken: 'testApiToken', + userName: 'testUserName', + domain: 'rudderlabs.us-uat.gladly.qa', + }, + }, + metadata: { + jobId: 3, + }, + }, + ], + destType: 'gladly', + }, + method: 'POST', + }, + }, + output: { + response: { + status: 200, + body: { + output: [ + { + batched: false, + batchedRequest: { + body: { + FORM: {}, + JSON: { + address: 'california usa', + emails: [ + { + original: 'test@rudderlabs.com', + }, + ], + externalCustomerId: 'externalCustomer@1', + id: 'user@1', + phones: [ + { + original: '+91 9999999999', + }, + ], + }, + JSON_ARRAY: {}, + XML: {}, + }, + endpoint: 'https://rudderlabs.us-uat.gladly.qa/api/v1/customer-profiles', + files: {}, + headers: { + Authorization: 'Basic dGVzdFVzZXJOYW1lOnRlc3RBcGlUb2tlbg==', + 'Content-Type': 'application/json', + }, + method: 'POST', + params: {}, + type: 'REST', + version: '1', + }, + destination: { + Config: { + apiToken: 'testApiToken', + domain: 'rudderlabs.us-uat.gladly.qa', + userName: 'testUserName', + }, + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + }, + metadata: [ + { + jobId: 1, + }, + ], + statusCode: 200, + }, + { + batched: false, + batchedRequest: { + body: { + FORM: {}, + JSON: { + address: 'New York, USA', + emails: [ + { + original: 'test+2@rudderlabs.com', + }, + ], + externalCustomerId: 'externalCustomer@2', + phones: [ + { + original: '+91 9999999998', + }, + ], + }, + JSON_ARRAY: {}, + XML: {}, + }, + endpoint: 'https://rudderlabs.us-uat.gladly.qa/api/v1/customer-profiles/user@2', + files: {}, + headers: { + Authorization: 'Basic dGVzdFVzZXJOYW1lOnRlc3RBcGlUb2tlbg==', + 'Content-Type': 'application/json', + }, + method: 'PATCH', + params: {}, + type: 'REST', + version: '1', + }, + destination: { + Config: { + apiToken: 'testApiToken', + domain: 'rudderlabs.us-uat.gladly.qa', + userName: 'testUserName', + }, + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + }, + metadata: [ + { + jobId: 2, + }, + ], + statusCode: 200, + }, + { + batched: false, + batchedRequest: { + body: { + FORM: {}, + JSON: { + address: 'New York, USA', + externalCustomerId: 'externalCustomer@3', + phones: [ + { + original: '+91 9999999988', + }, + ], + }, + JSON_ARRAY: {}, + XML: {}, + }, + endpoint: 'https://rudderlabs.us-uat.gladly.qa/api/v1/customer-profiles/user@3', + files: {}, + headers: { + Authorization: 'Basic dGVzdFVzZXJOYW1lOnRlc3RBcGlUb2tlbg==', + 'Content-Type': 'application/json', + }, + method: 'PATCH', + params: {}, + type: 'REST', + version: '1', + }, + destination: { + Config: { + apiToken: 'testApiToken', + domain: 'rudderlabs.us-uat.gladly.qa', + userName: 'testUserName', + }, + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + }, + metadata: [ + { + jobId: 3, + }, + ], + statusCode: 200, + }, + ], + }, + }, + }, + }, +]; diff --git a/test/integrations/destinations/heap/processor/data.ts b/test/integrations/destinations/heap/processor/data.ts index be4f9c87bf..6efa45435c 100644 --- a/test/integrations/destinations/heap/processor/data.ts +++ b/test/integrations/destinations/heap/processor/data.ts @@ -15,7 +15,7 @@ export const data = [ }, DestinationDefinition: { Config: { - cdkEnabled: true, + cdkV2Enabled: true, }, DisplayName: 'Heap.io', ID: '1WTbl0l5GjOQKOvfmcGwk0T49kV', @@ -26,6 +26,10 @@ export const data = [ Name: 'heap test', Transformations: [], }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, message: { anonymousId: 'sampath', channel: 'web', @@ -104,6 +108,10 @@ export const data = [ userId: 'sampath', }, statusCode: 200, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], }, @@ -125,7 +133,7 @@ export const data = [ }, DestinationDefinition: { Config: { - cdkEnabled: true, + cdkV2Enabled: true, }, DisplayName: 'Heap.io', ID: '1WTbl0l5GjOQKOvfmcGwk0T49kV', @@ -136,6 +144,10 @@ export const data = [ Name: 'heap test', Transformations: [], }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, message: { anonymousId: 'sampath', channel: 'web', @@ -221,6 +233,10 @@ export const data = [ userId: 'sampath', }, statusCode: 200, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], }, @@ -242,7 +258,7 @@ export const data = [ }, DestinationDefinition: { Config: { - cdkEnabled: false, + cdkV2Enabled: false, }, DisplayName: 'Heap.io', ID: '1WTbl0l5GjOQKOvfmcGwk0T49kV', @@ -253,6 +269,10 @@ export const data = [ Name: 'heap test', Transformations: [], }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, message: { anonymousId: 'sampath', channel: 'web', @@ -311,8 +331,14 @@ export const data = [ feature: 'processor', implementation: 'native', module: 'destination', + destinationId: 'destId', + workspaceId: 'wspId', }, statusCode: 400, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], }, @@ -334,7 +360,7 @@ export const data = [ }, DestinationDefinition: { Config: { - cdkEnabled: false, + cdkV2Enabled: false, }, DisplayName: 'Heap.io', ID: '1WTbl0l5GjOQKOvfmcGwk0T49kV', @@ -345,6 +371,10 @@ export const data = [ Name: 'heap test', Transformations: [], }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, message: { anonymousId: 'sampath', channel: 'web', @@ -403,6 +433,8 @@ export const data = [ { error: 'message type page not supported for heap', statTags: { + destinationId: 'destId', + workspaceId: 'wspId', destType: 'HEAP', errorCategory: 'dataValidation', errorType: 'instrumentation', @@ -411,6 +443,10 @@ export const data = [ module: 'destination', }, statusCode: 400, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], }, @@ -432,7 +468,7 @@ export const data = [ }, DestinationDefinition: { Config: { - cdkEnabled: true, + cdkV2Enabled: true, }, DisplayName: 'Heap.io', ID: '1WTbl0l5GjOQKOvfmcGwk0T49kV', @@ -443,6 +479,10 @@ export const data = [ Name: 'heap test', Transformations: [], }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, message: { anonymousId: 'sampath', channel: 'web', @@ -530,6 +570,10 @@ export const data = [ userId: 'sampath', }, statusCode: 200, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], }, @@ -551,7 +595,7 @@ export const data = [ }, DestinationDefinition: { Config: { - cdkEnabled: true, + cdkV2Enabled: true, }, DisplayName: 'Heap.io', ID: '1WTbl0l5GjOQKOvfmcGwk0T49kV', @@ -562,6 +606,10 @@ export const data = [ Name: 'heap test', Transformations: [], }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, message: { anonymousId: 'sampath', channel: 'web', @@ -649,6 +697,10 @@ export const data = [ userId: 'sampath', }, statusCode: 200, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], }, @@ -670,7 +722,7 @@ export const data = [ }, DestinationDefinition: { Config: { - cdkEnabled: true, + cdkV2Enabled: true, }, DisplayName: 'Heap.io', ID: '1WTbl0l5GjOQKOvfmcGwk0T49kV', @@ -681,6 +733,10 @@ export const data = [ Name: 'heap test', Transformations: [], }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, message: { anonymousId: 'sampath', channel: 'web', @@ -771,6 +827,10 @@ export const data = [ userId: 'sampath', }, statusCode: 200, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], }, @@ -792,7 +852,7 @@ export const data = [ }, DestinationDefinition: { Config: { - cdkEnabled: true, + cdkV2Enabled: true, }, DisplayName: 'Heap.io', ID: '1WTbl0l5GjOQKOvfmcGwk0T49kV', @@ -803,6 +863,10 @@ export const data = [ Name: 'heap test', Transformations: [], }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, message: { anonymousId: 'sampath', channel: 'web', @@ -888,6 +952,10 @@ export const data = [ userId: 'sampath', }, statusCode: 200, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], }, diff --git a/test/integrations/destinations/kochava/processor/data.ts b/test/integrations/destinations/kochava/processor/data.ts index d17e9795ff..06b5667c2a 100644 --- a/test/integrations/destinations/kochava/processor/data.ts +++ b/test/integrations/destinations/kochava/processor/data.ts @@ -12,7 +12,7 @@ export const data = [ destination: { Config: { apiKey: '' }, DestinationDefinition: { - Config: { cdkEnabled: true }, + Config: { cdkV2Enabled: true }, DisplayName: 'Kochava', ID: '1WTpBSTiL3iAUHUdW7rHT4sawgU', Name: 'KOCHAVA', @@ -22,6 +22,10 @@ export const data = [ Name: 'kochava test', Transformations: [], }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, message: { anonymousId: 'sampath', channel: 'web', @@ -103,6 +107,10 @@ export const data = [ userId: 'sampath', }, statusCode: 200, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], }, @@ -144,12 +152,13 @@ export const data = [ sentAt: '2019-10-14T09:03:22.563Z', }, metadata: { - destinationId: '1WTpIHpH7NTBgjeiUPW1kCUgZGI', + destinationId: 'destId', + workspaceId: 'wspId', }, destination: { Config: { apiKey: '' }, DestinationDefinition: { - Config: { cdkEnabled: true }, + Config: { cdkV2Enabled: true }, DisplayName: 'Kochava', ID: '1WTpBSTiL3iAUHUdW7rHT4sawgU', Name: 'KOCHAVA', @@ -170,18 +179,21 @@ export const data = [ status: 200, body: [ { - error: 'Bad event. Original error: message type "identify" not supported for "kochava"', + error: + 'message type identify is not supported: Workflow: procWorkflow, Step: validateInput, ChildStep: undefined, OriginalError: message type identify is not supported', metadata: { - destinationId: '1WTpIHpH7NTBgjeiUPW1kCUgZGI', + destinationId: 'destId', + workspaceId: 'wspId', }, statTags: { destType: 'KOCHAVA', errorCategory: 'dataValidation', - destinationId: '1WTpIHpH7NTBgjeiUPW1kCUgZGI', + destinationId: 'destId', errorType: 'instrumentation', feature: 'processor', - implementation: 'cdkV1', + implementation: 'cdkV2', module: 'destination', + workspaceId: 'wspId', }, statusCode: 400, }, @@ -225,10 +237,14 @@ export const data = [ integrations: { All: true }, sentAt: '2019-10-14T09:03:22.563Z', }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, destination: { Config: { apiKey: '' }, DestinationDefinition: { - Config: { cdkEnabled: true }, + Config: { cdkV2Enabled: true }, DisplayName: 'Kochava', ID: '1WTpBSTiL3iAUHUdW7rHT4sawgU', Name: 'KOCHAVA', @@ -288,6 +304,10 @@ export const data = [ userId: '00000000000000000000000000', }, statusCode: 200, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], }, @@ -329,10 +349,14 @@ export const data = [ integrations: { All: true }, sentAt: '2019-10-14T09:03:22.563Z', }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, destination: { Config: { apiKey: '' }, DestinationDefinition: { - Config: { cdkEnabled: true }, + Config: { cdkV2Enabled: true }, DisplayName: 'Kochava', ID: '1WTpBSTiL3iAUHUdW7rHT4sawgU', Name: 'KOCHAVA', @@ -392,6 +416,10 @@ export const data = [ userId: '00000000000000000000000000', }, statusCode: 200, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], }, @@ -444,10 +472,14 @@ export const data = [ type: 'screen', sentAt: '2020-03-12T09:05:13.042Z', }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, destination: { Config: { apiKey: '' }, DestinationDefinition: { - Config: { cdkEnabled: true }, + Config: { cdkV2Enabled: true }, DisplayName: 'Kochava', ID: '1WTpBSTiL3iAUHUdW7rHT4sawgU', Name: 'KOCHAVA', @@ -511,6 +543,10 @@ export const data = [ userId: '5094f5704b9cf2b3', }, statusCode: 200, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], }, @@ -564,10 +600,14 @@ export const data = [ type: 'screen', sentAt: '2020-03-12T09:05:13.042Z', }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, destination: { Config: { apiKey: '' }, DestinationDefinition: { - Config: { cdkEnabled: true }, + Config: { cdkV2Enabled: true }, DisplayName: 'Kochava', ID: '1WTpBSTiL3iAUHUdW7rHT4sawgU', Name: 'KOCHAVA', @@ -631,6 +671,10 @@ export const data = [ userId: '5094f5704b9cf2b3', }, statusCode: 200, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], }, @@ -687,7 +731,7 @@ export const data = [ destination: { Config: { apiKey: '' }, DestinationDefinition: { - Config: { cdkEnabled: true }, + Config: { cdkV2Enabled: true }, DisplayName: 'Kochava', ID: '1WTpBSTiL3iAUHUdW7rHT4sawgU', Name: 'KOCHAVA', @@ -697,6 +741,10 @@ export const data = [ Name: 'kochava test', Transformations: [], }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], method: 'POST', @@ -750,6 +798,10 @@ export const data = [ userId: '5094f5704b9cf2b3', }, statusCode: 200, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], }, @@ -800,10 +852,14 @@ export const data = [ type: 'screen', sentAt: '2020-03-12T09:05:13.042Z', }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, destination: { Config: { apiKey: '' }, DestinationDefinition: { - Config: { cdkEnabled: true }, + Config: { cdkV2Enabled: true }, DisplayName: 'Kochava', ID: '1WTpBSTiL3iAUHUdW7rHT4sawgU', Name: 'KOCHAVA', @@ -862,6 +918,10 @@ export const data = [ userId: '5094f5704b9cf2b3', }, statusCode: 200, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], }, @@ -914,7 +974,7 @@ export const data = [ destination: { Config: { apiKey: '' }, DestinationDefinition: { - Config: { cdkEnabled: true }, + Config: { cdkV2Enabled: true }, DisplayName: 'Kochava', ID: '1WTpBSTiL3iAUHUdW7rHT4sawgU', Name: 'KOCHAVA', @@ -924,6 +984,10 @@ export const data = [ Name: 'kochava test', Transformations: [], }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], method: 'POST', @@ -972,6 +1036,10 @@ export const data = [ userId: '5094f5704b9cf2b3', }, statusCode: 200, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], }, @@ -1012,10 +1080,14 @@ export const data = [ integrations: { All: true }, sentAt: '2019-10-14T09:03:22.563Z', }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, destination: { Config: { apiKey: '' }, DestinationDefinition: { - Config: { cdkEnabled: true }, + Config: { cdkV2Enabled: true }, DisplayName: 'Kochava', ID: '1WTpBSTiL3iAUHUdW7rHT4sawgU', Name: 'KOCHAVA', @@ -1074,6 +1146,10 @@ export const data = [ userId: '00000000000000000000000000', }, statusCode: 200, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], }, @@ -1115,10 +1191,14 @@ export const data = [ integrations: { All: true }, sentAt: '2019-10-14T09:03:22.563Z', }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, destination: { Config: { apiKey: '' }, DestinationDefinition: { - Config: { cdkEnabled: true }, + Config: { cdkV2Enabled: true }, DisplayName: 'Kochava', ID: '1WTpBSTiL3iAUHUdW7rHT4sawgU', Name: 'KOCHAVA', @@ -1182,6 +1262,10 @@ export const data = [ userId: '00000000000000000000000000', }, statusCode: 200, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], }, @@ -1222,10 +1306,14 @@ export const data = [ integrations: { All: true }, sentAt: '2019-10-14T09:03:22.563Z', }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, destination: { Config: { apiKey: '' }, DestinationDefinition: { - Config: { cdkEnabled: true }, + Config: { cdkV2Enabled: true }, DisplayName: 'Kochava', ID: '1WTpBSTiL3iAUHUdW7rHT4sawgU', Name: 'KOCHAVA', @@ -1289,6 +1377,10 @@ export const data = [ userId: '00000000000000000000000000', }, statusCode: 200, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], }, @@ -1329,10 +1421,14 @@ export const data = [ integrations: { All: true }, sentAt: '2019-10-14T09:03:22.563Z', }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, destination: { Config: { apiKey: '' }, DestinationDefinition: { - Config: { cdkEnabled: true }, + Config: { cdkV2Enabled: true }, DisplayName: 'Kochava', ID: '1WTpBSTiL3iAUHUdW7rHT4sawgU', Name: 'KOCHAVA', @@ -1396,6 +1492,10 @@ export const data = [ userId: '00000000000000000000000000', }, statusCode: 200, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], }, diff --git a/test/integrations/destinations/launchdarkly_audience/processor/data.ts b/test/integrations/destinations/launchdarkly_audience/processor/data.ts new file mode 100644 index 0000000000..b26cf60f4c --- /dev/null +++ b/test/integrations/destinations/launchdarkly_audience/processor/data.ts @@ -0,0 +1,611 @@ +export const data = [ + { + name: 'launchdarkly_audience', + description: 'Unsupported event type', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + userId: 'user123', + type: 'abc', + properties: { + listData: { + add: [ + { + identifier: 'alex@email.com', + }, + { + identifier: 'ryan@email.com', + }, + { + identifier: 'van@email.com', + }, + ], + }, + }, + context: { + ip: '14.5.67.21', + library: { + name: 'http', + }, + }, + timestamp: '2020-02-02T00:23:09.544Z', + }, + destination: { + Config: { + audienceId: 'test-audienceId', + audienceName: 'test-audienceName', + accessToken: 'test-accessToken', + clientSideId: 'test-clientSideId', + }, + DestinationDefinition: { Config: { cdkV2Enabled: true } }, + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 400, + error: + 'Event type abc is not supported. Aborting message.: Workflow: procWorkflow, Step: validateInput, ChildStep: undefined, OriginalError: Event type abc is not supported. Aborting message.', + statTags: { + destType: 'LAUNCHDARKLY_AUDIENCE', + errorCategory: 'dataValidation', + errorType: 'instrumentation', + feature: 'processor', + implementation: 'cdkV2', + module: 'destination', + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + }, + { + name: 'launchdarkly_audience', + description: 'List data is not passed', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + userId: 'user123', + type: 'audiencelist', + properties: {}, + context: { + ip: '14.5.67.21', + library: { + name: 'http', + }, + }, + timestamp: '2020-02-02T00:23:09.544Z', + }, + destination: { + Config: { + audienceId: 'test-audienceId', + audienceName: 'test-audienceName', + accessToken: 'test-accessToken', + clientSideId: 'test-clientSideId', + }, + DestinationDefinition: { Config: { cdkV2Enabled: true } }, + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 400, + error: + '`listData` is not present inside properties. Aborting message.: Workflow: procWorkflow, Step: validateInput, ChildStep: undefined, OriginalError: `listData` is not present inside properties. Aborting message.', + statTags: { + destType: 'LAUNCHDARKLY_AUDIENCE', + errorCategory: 'dataValidation', + errorType: 'instrumentation', + feature: 'processor', + implementation: 'cdkV2', + module: 'destination', + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + }, + { + name: 'launchdarkly_audience', + description: 'List data is empty', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + userId: 'user123', + type: 'audiencelist', + properties: { + listData: {}, + }, + context: { + ip: '14.5.67.21', + library: { + name: 'http', + }, + }, + timestamp: '2020-02-02T00:23:09.544Z', + }, + destination: { + Config: { + audienceId: 'test-audienceId', + audienceName: 'test-audienceName', + accessToken: 'test-accessToken', + clientSideId: 'test-clientSideId', + }, + DestinationDefinition: { Config: { cdkV2Enabled: true } }, + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 400, + error: + '`listData` is empty. Aborting message.: Workflow: procWorkflow, Step: validateInput, ChildStep: undefined, OriginalError: `listData` is empty. Aborting message.', + statTags: { + destType: 'LAUNCHDARKLY_AUDIENCE', + errorCategory: 'dataValidation', + errorType: 'instrumentation', + feature: 'processor', + implementation: 'cdkV2', + module: 'destination', + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + }, + { + name: 'launchdarkly_audience', + description: 'Unsupported action type', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + userId: 'user123', + type: 'audiencelist', + properties: { + listData: { + update: [ + { + identifier: 'alex@email.com', + }, + ], + }, + }, + context: { + ip: '14.5.67.21', + library: { + name: 'http', + }, + }, + timestamp: '2020-02-02T00:23:09.544Z', + }, + destination: { + Config: { + audienceId: 'test-audienceId', + audienceName: 'test-audienceName', + accessToken: 'test-accessToken', + clientSideId: 'test-clientSideId', + }, + DestinationDefinition: { Config: { cdkV2Enabled: true } }, + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 400, + error: + 'Unsupported action type. Aborting message.: Workflow: procWorkflow, Step: validateInput, ChildStep: undefined, OriginalError: Unsupported action type. Aborting message.', + statTags: { + destType: 'LAUNCHDARKLY_AUDIENCE', + errorCategory: 'dataValidation', + errorType: 'instrumentation', + feature: 'processor', + implementation: 'cdkV2', + module: 'destination', + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + }, + { + name: 'launchdarkly_audience', + description: 'Add members to the audience list', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + userId: 'user123', + type: 'audiencelist', + properties: { + listData: { + add: [ + { + identifier: 'alex@email.com', + }, + { + identifier: 'ryan@email.com', + }, + { + identifier: 'van@email.com', + }, + ], + }, + }, + context: { + ip: '14.5.67.21', + library: { + name: 'http', + }, + }, + timestamp: '2020-02-02T00:23:09.544Z', + }, + destination: { + Config: { + audienceId: 'test-audienceId', + audienceName: 'test-audienceName', + accessToken: 'test-accessToken', + clientSideId: 'test-clientSideId', + }, + DestinationDefinition: { Config: { cdkV2Enabled: true } }, + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 200, + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://app.launchdarkly.com/api/v2/segment-targets/rudderstack', + headers: { + Authorization: 'test-accessToken', + 'Content-Type': 'application/json', + }, + params: {}, + body: { + JSON: { + environmentId: 'test-clientSideId', + cohortId: 'test-audienceId', + cohortName: 'test-audienceName', + listData: { + add: [ + { + id: 'alex@email.com', + }, + { + id: 'ryan@email.com', + }, + { + id: 'van@email.com', + }, + ], + remove: [], + }, + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + }, + ], + }, + }, + }, + { + name: 'launchdarkly_audience', + description: 'Remove members from the audience list', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + userId: 'user123', + type: 'audiencelist', + properties: { + listData: { + remove: [ + { + identifier: 'alex@email.com', + }, + { + identifier: 'ryan@email.com', + }, + { + identifier: 'van@email.com', + }, + ], + }, + }, + context: { + ip: '14.5.67.21', + library: { + name: 'http', + }, + }, + timestamp: '2020-02-02T00:23:09.544Z', + }, + destination: { + Config: { + audienceId: 'test-audienceId', + audienceName: 'test-audienceName', + accessToken: 'test-accessToken', + clientSideId: 'test-clientSideId', + }, + DestinationDefinition: { Config: { cdkV2Enabled: true } }, + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 200, + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://app.launchdarkly.com/api/v2/segment-targets/rudderstack', + headers: { + Authorization: 'test-accessToken', + 'Content-Type': 'application/json', + }, + params: {}, + body: { + JSON: { + environmentId: 'test-clientSideId', + cohortId: 'test-audienceId', + cohortName: 'test-audienceName', + listData: { + remove: [ + { + id: 'alex@email.com', + }, + { + id: 'ryan@email.com', + }, + { + id: 'van@email.com', + }, + ], + add: [], + }, + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + }, + ], + }, + }, + }, + { + name: 'launchdarkly_audience', + description: 'Add/Remove members', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + userId: 'user123', + type: 'audiencelist', + properties: { + listData: { + add: [ + { + identifier: 'alex@email.com', + }, + { + userId: 'user1', + }, + ], + remove: [ + { + identifier: 'ryan@email.com', + }, + { + identifier: 'van@email.com', + }, + ], + }, + }, + context: { + ip: '14.5.67.21', + library: { + name: 'http', + }, + }, + timestamp: '2020-02-02T00:23:09.544Z', + }, + destination: { + Config: { + audienceId: 'test-audienceId', + audienceName: 'test-audienceName', + accessToken: 'test-accessToken', + clientSideId: 'test-clientSideId', + }, + DestinationDefinition: { Config: { cdkV2Enabled: true } }, + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 200, + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://app.launchdarkly.com/api/v2/segment-targets/rudderstack', + headers: { + Authorization: 'test-accessToken', + 'Content-Type': 'application/json', + }, + params: {}, + body: { + JSON: { + environmentId: 'test-clientSideId', + cohortId: 'test-audienceId', + cohortName: 'test-audienceName', + listData: { + add: [ + { + id: 'alex@email.com', + }, + ], + remove: [ + { + id: 'ryan@email.com', + }, + { + id: 'van@email.com', + }, + ], + }, + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + }, + ], + }, + }, + }, +]; diff --git a/test/integrations/destinations/lytics/processor/data.ts b/test/integrations/destinations/lytics/processor/data.ts index e04b1aa413..344eecc3cd 100644 --- a/test/integrations/destinations/lytics/processor/data.ts +++ b/test/integrations/destinations/lytics/processor/data.ts @@ -112,12 +112,16 @@ export const data = [ userId: 'rudder123', }, destination: { - DestinationDefinition: { Config: { cdkEnabled: true } }, + DestinationDefinition: { Config: { cdkV2Enabled: true } }, Config: { apiKey: 'dummyApiKey', stream: 'default' }, Enabled: true, Transformations: [], IsProcessorEnabled: true, }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], method: 'POST', @@ -197,6 +201,10 @@ export const data = [ files: {}, userId: '', }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, statusCode: 200, }, ], @@ -255,12 +263,16 @@ export const data = [ userId: 'rudder123', }, destination: { - DestinationDefinition: { Config: { cdkEnabled: true } }, + DestinationDefinition: { Config: { cdkV2Enabled: true } }, Config: { apiKey: 'dummyApiKey', stream: 'default' }, Enabled: true, Transformations: [], IsProcessorEnabled: true, }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], method: 'POST', @@ -295,6 +307,10 @@ export const data = [ files: {}, userId: '', }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, statusCode: 200, }, ], @@ -361,12 +377,16 @@ export const data = [ userId: 'rudder123', }, destination: { - DestinationDefinition: { Config: { cdkEnabled: true } }, + DestinationDefinition: { Config: { cdkV2Enabled: true } }, Config: { apiKey: 'dummyApiKey', stream: 'default' }, Enabled: true, Transformations: [], IsProcessorEnabled: true, }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], method: 'POST', @@ -401,6 +421,10 @@ export const data = [ files: {}, userId: '', }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, statusCode: 200, }, ], @@ -459,12 +483,17 @@ export const data = [ userId: 'rudder123', }, destination: { - DestinationDefinition: { Config: { cdkEnabled: true } }, + ID: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', + DestinationDefinition: { Config: { cdkV2Enabled: true } }, Config: { apiKey: 'dummyApiKey', stream: 'default' }, Enabled: true, Transformations: [], IsProcessorEnabled: true, }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], method: 'POST', @@ -500,6 +529,10 @@ export const data = [ userId: '', }, statusCode: 200, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], }, @@ -557,12 +590,16 @@ export const data = [ userId: 'rudder123', }, destination: { - DestinationDefinition: { Config: { cdkEnabled: true } }, + DestinationDefinition: { Config: { cdkV2Enabled: true } }, Config: { apiKey: 'dummyApiKey', stream: 'default' }, Enabled: true, Transformations: [], IsProcessorEnabled: true, }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], method: 'POST', @@ -598,6 +635,10 @@ export const data = [ userId: '', }, statusCode: 200, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], }, @@ -655,12 +696,16 @@ export const data = [ userId: 'rudder123', }, destination: { - DestinationDefinition: { Config: { cdkEnabled: true } }, + DestinationDefinition: { Config: { cdkV2Enabled: true } }, Config: { apiKey: 'dummyApiKey', stream: 'default' }, Enabled: true, Transformations: [], IsProcessorEnabled: true, }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], method: 'POST', @@ -696,6 +741,10 @@ export const data = [ userId: '', }, statusCode: 200, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], }, @@ -753,7 +802,7 @@ export const data = [ }, metadata: { destinationID: 'ewksfdgDFSdvzsdmwsdfvcxj' }, destination: { - DestinationDefinition: { Config: { cdkEnabled: true } }, + DestinationDefinition: { Config: { cdkV2Enabled: true } }, Config: { apiKey: 'dummyApiKey', stream: 'default' }, Enabled: true, Transformations: [], @@ -771,13 +820,14 @@ export const data = [ body: [ { error: - 'Unknown error occurred. Original error: "type" is a required field and it must be a string', + 'message Type is not present. Aborting message.: Workflow: procWorkflow, Step: validateInput, ChildStep: undefined, OriginalError: message Type is not present. Aborting message.', metadata: { destinationID: 'ewksfdgDFSdvzsdmwsdfvcxj' }, statTags: { destType: 'LYTICS', - errorCategory: 'transformation', + errorCategory: 'dataValidation', + errorType: 'instrumentation', feature: 'processor', - implementation: 'cdkV1', + implementation: 'cdkV2', module: 'destination', }, statusCode: 400, @@ -839,7 +889,7 @@ export const data = [ }, metadata: { destinationID: 'ewksfdgDFSdvzsdmwsdfvcxj' }, destination: { - DestinationDefinition: { Config: { cdkEnabled: true } }, + DestinationDefinition: { Config: { cdkV2Enabled: true } }, Config: { apiKey: 'dummyApiKey', stream: 'default' }, Enabled: true, Transformations: [], @@ -856,14 +906,15 @@ export const data = [ status: 200, body: [ { - error: 'Bad event. Original error: message type "gone" not supported for "lytics"', + error: + 'message type gone is not supported: Workflow: procWorkflow, Step: validateInput, ChildStep: undefined, OriginalError: message type gone is not supported', metadata: { destinationID: 'ewksfdgDFSdvzsdmwsdfvcxj' }, statTags: { destType: 'LYTICS', errorCategory: 'dataValidation', errorType: 'instrumentation', feature: 'processor', - implementation: 'cdkV1', + implementation: 'cdkV2', module: 'destination', }, statusCode: 400, @@ -984,12 +1035,16 @@ export const data = [ userId: 'rudder123', }, destination: { - DestinationDefinition: { Config: { cdkEnabled: true } }, + DestinationDefinition: { Config: { cdkV2Enabled: true } }, Config: { apiKey: 'dummyApiKey', stream: 'default' }, Enabled: true, Transformations: [], IsProcessorEnabled: true, }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], method: 'POST', @@ -1070,6 +1125,10 @@ export const data = [ userId: '', }, statusCode: 200, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], }, @@ -1119,12 +1178,16 @@ export const data = [ destination_props: { AF: { af_uid: 'afUid' } }, }, destination: { - DestinationDefinition: { Config: { cdkEnabled: true } }, + DestinationDefinition: { Config: { cdkV2Enabled: true } }, Config: { apiKey: 'dummyApiKey', stream: 'default' }, Enabled: true, Transformations: [], IsProcessorEnabled: true, }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], method: 'POST', @@ -1160,6 +1223,10 @@ export const data = [ userId: '', }, statusCode: 200, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], }, @@ -1209,12 +1276,16 @@ export const data = [ destination_props: { AF: { af_uid: 'afUid' } }, }, destination: { - DestinationDefinition: { Config: { cdkEnabled: true } }, + DestinationDefinition: { Config: { cdkV2Enabled: true } }, Config: { apiKey: 'dummyApiKey', stream: 'default' }, Enabled: true, Transformations: [], IsProcessorEnabled: true, }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], method: 'POST', @@ -1250,6 +1321,10 @@ export const data = [ userId: '', }, statusCode: 200, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], }, @@ -1309,12 +1384,16 @@ export const data = [ userId: 'rudder123', }, destination: { - DestinationDefinition: { Config: { cdkEnabled: true } }, + DestinationDefinition: { Config: { cdkV2Enabled: true } }, Config: { apiKey: 'dummyApiKey', stream: 'default' }, Enabled: true, Transformations: [], IsProcessorEnabled: true, }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], method: 'POST', @@ -1352,6 +1431,10 @@ export const data = [ userId: '', }, statusCode: 200, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], }, diff --git a/test/integrations/destinations/moengage/processor/data.ts b/test/integrations/destinations/moengage/processor/data.ts index 50b0361381..1ce8705f53 100644 --- a/test/integrations/destinations/moengage/processor/data.ts +++ b/test/integrations/destinations/moengage/processor/data.ts @@ -2777,4 +2777,105 @@ export const data = [ }, }, }, + { + name: 'moengage', + description: + 'when identify is sent without context, the event should not throw internal server error', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + type: 'identify', + event: 'identify', + sentAt: '2023-11-22T03:42:40.346Z', + userId: 'userId16', + channel: 'mobile', + rudderId: 'dummy-rudderId', + timestamp: '2023-11-22T03:42:31.470Z', + receivedAt: '2023-11-22T03:42:43.281Z', + request_ip: '114.122.233.48', + anonymousId: 'anon-dummyId-1', + integrations: { + All: true, + }, + originalTimestamp: '2023-11-22T03:42:28.535Z', + }, + destination: { + ID: '1iuTZs6eEZVMm6GjRBe6bNShaL3', + Name: 'MoEngage Testing', + DestinationDefinition: { + ID: '1iu4802Tx27kNC4KNYYou6D8jzL', + Name: 'MOENGAGE', + DisplayName: 'MoEngage', + Config: { + destConfig: { defaultConfig: ['apiId', 'apiKey', 'region'] }, + excludeKeys: [], + includeKeys: [], + supportedSourceTypes: [ + 'android', + 'ios', + 'web', + 'unity', + 'amp', + 'cloud', + 'reactnative', + ], + }, + }, + Config: { + apiId: 'W0ZHNMPI2O4KHJ48ZILZACRA', + apiKey: 'dummyApiKey', + eventDelivery: false, + eventDeliveryTS: 1602757086384, + region: 'US', + }, + Enabled: true, + Transformations: [], + IsProcessorEnabled: true, + }, + }, + ], + method: 'POST', + }, + pathSuffix: '', + }, + output: { + response: { + status: 200, + body: [ + { + output: { + body: { + FORM: {}, + JSON: { + attributes: {}, + customer_id: 'userId16', + type: 'customer', + }, + JSON_ARRAY: {}, + XML: {}, + }, + endpoint: 'https://api-01.moengage.com/v1/customer/W0ZHNMPI2O4KHJ48ZILZACRA', + files: {}, + headers: { + Authorization: 'Basic VzBaSE5NUEkyTzRLSEo0OFpJTFpBQ1JBOmR1bW15QXBpS2V5', + 'Content-Type': 'application/json', + 'MOE-APPKEY': 'W0ZHNMPI2O4KHJ48ZILZACRA', + }, + method: 'POST', + params: {}, + type: 'REST', + userId: 'anon-dummyId-1', + version: '1', + }, + statusCode: 200, + }, + ], + }, + }, + }, ]; diff --git a/test/integrations/destinations/mp/common.ts b/test/integrations/destinations/mp/common.ts index ad12566cc6..76ed25a760 100644 --- a/test/integrations/destinations/mp/common.ts +++ b/test/integrations/destinations/mp/common.ts @@ -20,4 +20,42 @@ const sampleDestination = { Transformations: [], }; -export { sampleDestination, defaultMockFns }; +const destinationWithSetOnceProperty = { + Config: { + apiSecret: 'dummySecret', + dataResidency: 'us', + identityMergeApi: 'simplified', + setOnceProperties: [ + { + property: 'nationality', + }, + { + property: 'firstName', + }, + { + property: 'address.city', + }, + ], + superProperties: [ + { + property: 'random', + }, + ], + token: 'dummyToken', + useNativeSDK: false, + useNewMapping: false, + userDeletionApi: 'engage', + whitelistedEvents: [], + }, + DestinationDefinition: { + DisplayName: 'Kiss Metrics', + ID: '1WhbSZ6uA3H5ChVifHpfL2H6sie', + Name: 'MIXPANEL', + }, + Enabled: true, + ID: '1WhcOCGgj9asZu850HvugU2C3Aq', + Name: 'Kiss Metrics', + Transformations: [], +}; + +export { sampleDestination, defaultMockFns, destinationWithSetOnceProperty }; diff --git a/test/integrations/destinations/mp/processor/data.ts b/test/integrations/destinations/mp/processor/data.ts index 2745c09ecc..a6ba51ee78 100644 --- a/test/integrations/destinations/mp/processor/data.ts +++ b/test/integrations/destinations/mp/processor/data.ts @@ -1,5 +1,5 @@ import { overrideDestination } from '../../../testUtils'; -import { sampleDestination, defaultMockFns } from '../common'; +import { sampleDestination, defaultMockFns, destinationWithSetOnceProperty } from '../common'; export const data = [ { @@ -5852,4 +5852,273 @@ export const data = [ }, }, }, + { + name: 'mp', + description: 'Test Set Once Property', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + description: 'Alias: with property beyond and within exclusion list', + destination: destinationWithSetOnceProperty, + message: { + anonymousId: 'e6ab2c5e-2cda-44a9-a962-e2f67df78bca', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.5', + }, + ip: '0.0.0.0', + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.5', + }, + locale: 'en-GB', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + traits: { + address: { + city: 'Disney', + }, + country: 'USA', + email: 'TestSanity@disney.com', + firstName: 'Mickey test', + lastName: 'VarChange', + createdAt: '2020-01-23T08:54:02.362Z', + nationality: 'USA', + random: 'superProp', + }, + page: { + path: '/destinations/mixpanel', + referrer: '', + search: '', + title: '', + url: 'https://docs.rudderstack.com/destinations/mixpanel', + category: 'destination', + initial_referrer: 'https://docs.rudderstack.com', + initial_referring_domain: 'docs.rudderstack.com', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36', + }, + integrations: { + All: true, + }, + page: { + path: '/destinations/mixpanel', + referrer: '', + search: '', + title: '', + url: 'https://docs.rudderstack.com/destinations/mixpanel', + category: 'destination', + initial_referrer: 'https://docs.rudderstack.com', + initial_referring_domain: 'docs.rudderstack.com', + }, + request_ip: '[::1]:53709', + type: 'identify', + userId: 'Santiy', + }, + }, + ], + method: 'POST', + }, + pathSuffix: '', + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://api.mixpanel.com/engage/', + headers: {}, + params: {}, + body: { + JSON: {}, + JSON_ARRAY: { + batch: + '[{"$set_once":{"$first_name":"Mickey test","$city":"Disney","nationality":"USA"},"$token":"dummyToken","$distinct_id":"Santiy"}]', + }, + XML: {}, + FORM: {}, + }, + files: {}, + userId: 'Santiy', + }, + statusCode: 200, + }, + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://api.mixpanel.com/engage/', + headers: {}, + params: {}, + body: { + JSON: {}, + JSON_ARRAY: { + batch: + '[{"$set":{"$created":"2020-01-23T08:54:02.362Z","$email":"TestSanity@disney.com","$country_code":"USA","$initial_referrer":"https://docs.rudderstack.com","$initial_referring_domain":"docs.rudderstack.com","random":"superProp","$lastName":"VarChange","$browser":"Chrome","$browser_version":"79.0.3945.117"},"$token":"dummyToken","$distinct_id":"Santiy","$ip":"0.0.0.0","$time":null}]', + }, + XML: {}, + FORM: {}, + }, + files: {}, + userId: 'Santiy', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'mp', + description: 'Test Set Once Property with anonymousId', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + description: 'Alias: with property beyond and within exclusion list', + destination: destinationWithSetOnceProperty, + message: { + anonymousId: 'dummyAnnonymousId', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.5', + }, + ip: '0.0.0.0', + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.5', + }, + locale: 'en-GB', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + traits: { + address: { + city: 'Disney', + }, + country: 'USA', + email: 'TestSanity@disney.com', + firstName: 'Mickey test', + lastName: 'VarChange', + createdAt: '2020-01-23T08:54:02.362Z', + nationality: 'USA', + random: 'superProp', + }, + page: { + path: '/destinations/mixpanel', + referrer: '', + search: '', + title: '', + url: 'https://docs.rudderstack.com/destinations/mixpanel', + category: 'destination', + initial_referrer: 'https://docs.rudderstack.com', + initial_referring_domain: 'docs.rudderstack.com', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36', + }, + integrations: { + All: true, + }, + page: { + path: '/destinations/mixpanel', + referrer: '', + search: '', + title: '', + url: 'https://docs.rudderstack.com/destinations/mixpanel', + category: 'destination', + initial_referrer: 'https://docs.rudderstack.com', + initial_referring_domain: 'docs.rudderstack.com', + }, + request_ip: '[::1]:53709', + type: 'identify', + }, + }, + ], + method: 'POST', + }, + pathSuffix: '', + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://api.mixpanel.com/engage/', + headers: {}, + params: {}, + body: { + JSON: {}, + JSON_ARRAY: { + batch: + '[{"$set_once":{"$first_name":"Mickey test","$city":"Disney","nationality":"USA"},"$token":"dummyToken","$distinct_id":"$device:dummyAnnonymousId"}]', + }, + XML: {}, + FORM: {}, + }, + files: {}, + userId: 'dummyAnnonymousId', + }, + statusCode: 200, + }, + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://api.mixpanel.com/engage/', + headers: {}, + params: {}, + body: { + JSON: {}, + JSON_ARRAY: { + batch: + '[{"$set":{"$created":"2020-01-23T08:54:02.362Z","$email":"TestSanity@disney.com","$country_code":"USA","$initial_referrer":"https://docs.rudderstack.com","$initial_referring_domain":"docs.rudderstack.com","random":"superProp","$lastName":"VarChange","$browser":"Chrome","$browser_version":"79.0.3945.117"},"$token":"dummyToken","$distinct_id":"$device:dummyAnnonymousId","$ip":"0.0.0.0","$time":null}]', + }, + XML: {}, + FORM: {}, + }, + files: {}, + userId: 'dummyAnnonymousId', + }, + statusCode: 200, + }, + ], + }, + }, + }, ]; diff --git a/test/integrations/destinations/new_relic/processor/data.ts b/test/integrations/destinations/new_relic/processor/data.ts new file mode 100644 index 0000000000..7eb4099e3b --- /dev/null +++ b/test/integrations/destinations/new_relic/processor/data.ts @@ -0,0 +1,882 @@ +export const data = [ + { + name: 'new_relic', + description: 'Test 0', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + event: 'first', + userId: 'identified user id', + type: 'track', + anonymousId: 'anon-id-new', + context: { + traits: { + trait1: 'new-val', + }, + ip: '14.5.67.21', + library: { + name: 'http', + }, + }, + properties: { + abc: '123', + key: { + abc: 123, + }, + array: [ + { + abc: 123, + }, + { + def: 123, + }, + ], + }, + timestamp: '2020-02-02T00:23:09.544Z', + sentAt: '2020-02-02T00:23:09.544Z', + originalTimestamp: '2020-02-02T00:23:09.544Z', + }, + destination: { + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + Config: { + accountId: '12345', + insertKey: '11111122702j2a2U2K2C7H', + customEventType: '', + sendDeviceContext: true, + sendUserIdanonymousId: true, + dataCenter: 'us', + }, + Enabled: true, + Transformations: [], + IsProcessorEnabled: true, + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://insights-collector.newrelic.com/v1/accounts/12345/events', + headers: { + 'Api-Key': '11111122702j2a2U2K2C7H', + 'Content-Type': 'application/json', + }, + params: {}, + body: { + JSON: { + event: 'first', + abc: '123', + 'key.abc': 123, + 'array[0].abc': 123, + 'array[1].def': 123, + timestamp: 1580602989, + eventType: 'rudderstack', + userId: 'identified user id', + anonymousId: 'anon-id-new', + 'traits.trait1': 'new-val', + ip: '14.5.67.21', + 'library.name': 'http', + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'new_relic', + description: 'Test 1', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + event: 'second', + userId: 'identified user id', + type: 'track', + anonymousId: 'anon-id-new', + context: { + traits: { + trait1: 'new-val', + }, + ip: '14.5.67.21', + library: { + name: 'http', + }, + }, + properties: { + abc: '123', + key: { + abc: 123, + }, + array: [ + { + abc: 123, + }, + { + def: 'test', + }, + ], + }, + timestamp: '2020-02-02T00:23:09.544Z', + sentAt: '2020-02-02T00:23:09.544Z', + originalTimestamp: '2020-02-02T00:23:09.544Z', + }, + destination: { + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + Config: { + accountId: '12345', + insertKey: '11111122702j2a2U2K2C7H', + customEventType: '', + sendDeviceContext: false, + sendUserIdanonymousId: false, + dataCenter: 'us', + }, + Enabled: true, + Transformations: [], + IsProcessorEnabled: true, + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://insights-collector.newrelic.com/v1/accounts/12345/events', + headers: { + 'Api-Key': '11111122702j2a2U2K2C7H', + 'Content-Type': 'application/json', + }, + params: {}, + body: { + JSON: { + event: 'second', + abc: '123', + 'key.abc': 123, + 'array[0].abc': 123, + 'array[1].def': 'test', + timestamp: 1580602989, + eventType: 'rudderstack', + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'new_relic', + description: 'Test 2', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + event: 'test', + userId: 'identified user id', + type: 'track', + anonymousId: 'anon-id-new', + context: { + traits: { + trait1: 'new-val', + }, + ip: '14.5.67.21', + library: { + name: 'http', + }, + }, + properties: { + abc: '123', + key: { + abc: 123, + }, + array: [ + { + abc: 123, + }, + { + def: 123, + }, + ], + }, + timestamp: '2020-02-02T00:23:09.544Z', + sentAt: '2020-02-02T00:23:09.544Z', + originalTimestamp: '2020-02-02T00:23:09.544Z', + }, + destination: { + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + Config: { + accountId: '12345', + insertKey: '11111122702j2a2U2K2C7H', + customEventType: 'rudder-testing', + sendDeviceContext: false, + sendUserIdanonymousId: false, + dataCenter: 'us', + }, + Enabled: true, + Transformations: [], + IsProcessorEnabled: true, + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://insights-collector.newrelic.com/v1/accounts/12345/events', + headers: { + 'Api-Key': '11111122702j2a2U2K2C7H', + 'Content-Type': 'application/json', + }, + params: {}, + body: { + JSON: { + event: 'test', + abc: '123', + 'key.abc': 123, + 'array[0].abc': 123, + 'array[1].def': 123, + timestamp: 1580602989, + eventType: 'rudder-testing', + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'new_relic', + description: 'Test 3', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + event: 'first', + userId: 'identified user id', + type: 'track', + anonymousId: 'anon-id-new', + context: { + traits: { + trait1: 'new-val', + }, + ip: '14.5.67.21', + library: { + name: 'http', + }, + }, + properties: { + abc: '123', + key: { + abc: 123, + }, + array: [ + { + abc: 123, + }, + { + def: 123, + }, + ], + }, + timestamp: '2020-02-02T00:23:09.544Z', + sentAt: '2020-02-02T00:23:09.544Z', + originalTimestamp: '2020-02-02T00:23:09.544Z', + }, + destination: { + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + Config: { + accountId: '12345', + insertKey: '11111122702j2a2U2K2C7H', + customEventType: '', + sendDeviceContext: true, + sendUserIdanonymousId: true, + dataCenter: 'eu', + }, + Enabled: true, + Transformations: [], + IsProcessorEnabled: true, + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://insights-collector.eu01.nr-data.net/v1/accounts/12345/events', + headers: { + 'Api-Key': '11111122702j2a2U2K2C7H', + 'Content-Type': 'application/json', + }, + params: {}, + body: { + JSON: { + event: 'first', + abc: '123', + 'key.abc': 123, + 'array[0].abc': 123, + 'array[1].def': 123, + timestamp: 1580602989, + eventType: 'rudderstack', + userId: 'identified user id', + anonymousId: 'anon-id-new', + 'traits.trait1': 'new-val', + ip: '14.5.67.21', + 'library.name': 'http', + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'new_relic', + description: 'Test 4', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + event: 'second', + userId: 'identified user id', + type: 'track', + anonymousId: 'anon-id-new', + context: { + traits: { + trait1: 'new-val', + }, + ip: '14.5.67.21', + library: { + name: 'http', + }, + }, + properties: { + abc: '123', + key: { + abc: 123, + }, + array: [ + { + abc: 123, + }, + { + def: 'test', + }, + ], + }, + timestamp: '2020-02-02T00:23:09.544Z', + sentAt: '2020-02-02T00:23:09.544Z', + originalTimestamp: '2020-02-02T00:23:09.544Z', + }, + destination: { + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + Config: { + accountId: '12345', + insertKey: '11111122702j2a2U2K2C7H', + customEventType: '', + sendDeviceContext: false, + sendUserIdanonymousId: false, + dataCenter: 'eu', + }, + Enabled: true, + Transformations: [], + IsProcessorEnabled: true, + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://insights-collector.eu01.nr-data.net/v1/accounts/12345/events', + headers: { + 'Api-Key': '11111122702j2a2U2K2C7H', + 'Content-Type': 'application/json', + }, + params: {}, + body: { + JSON: { + event: 'second', + abc: '123', + 'key.abc': 123, + 'array[0].abc': 123, + 'array[1].def': 'test', + timestamp: 1580602989, + eventType: 'rudderstack', + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'new_relic', + description: 'Test 5', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + event: 'test', + userId: 'identified user id', + type: 'track', + anonymousId: 'anon-id-new', + context: { + traits: { + trait1: 'new-val', + }, + ip: '14.5.67.21', + library: { + name: 'http', + }, + }, + properties: { + abc: '123', + key: { + abc: 123, + }, + array: [ + { + abc: 123, + }, + { + def: 123, + }, + ], + }, + timestamp: '2020-02-02T00:23:09.544Z', + sentAt: '2020-02-02T00:23:09.544Z', + originalTimestamp: '2020-02-02T00:23:09.544Z', + }, + destination: { + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + Config: { + accountId: '12345', + insertKey: '11111122702j2a2U2K2C7H', + customEventType: 'rudder-testing', + sendDeviceContext: false, + sendUserIdanonymousId: true, + dataCenter: 'eu', + }, + Enabled: true, + Transformations: [], + IsProcessorEnabled: true, + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://insights-collector.eu01.nr-data.net/v1/accounts/12345/events', + headers: { + 'Api-Key': '11111122702j2a2U2K2C7H', + 'Content-Type': 'application/json', + }, + params: {}, + body: { + JSON: { + event: 'test', + abc: '123', + 'key.abc': 123, + 'array[0].abc': 123, + 'array[1].def': 123, + timestamp: 1580602989, + eventType: 'rudder-testing', + userId: 'identified user id', + anonymousId: 'anon-id-new', + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'new_relic', + description: 'Test 6', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + event: 'test', + type: 'track', + anonymousId: 'anon-id-new', + context: { + traits: { + trait1: 'new-val', + }, + ip: '14.5.67.21', + library: { + name: 'http', + }, + }, + properties: { + abc: '123', + key: { + abc: 123, + }, + array: [ + { + abc: 123, + }, + { + def: 123, + }, + ], + }, + timestamp: '2020-02-02T00:23:09.544Z', + sentAt: '2020-02-02T00:23:09.544Z', + originalTimestamp: '2020-02-02T00:23:09.544Z', + }, + destination: { + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + Config: { + accountId: '12345', + insertKey: '11111122702j2a2U2K2C7H', + customEventType: '', + sendDeviceContext: true, + sendUserIdanonymousId: true, + dataCenter: 'us', + }, + Enabled: true, + Transformations: [], + IsProcessorEnabled: true, + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://insights-collector.newrelic.com/v1/accounts/12345/events', + headers: { + 'Api-Key': '11111122702j2a2U2K2C7H', + 'Content-Type': 'application/json', + }, + params: {}, + body: { + JSON: { + event: 'test', + abc: '123', + 'key.abc': 123, + 'array[0].abc': 123, + 'array[1].def': 123, + timestamp: 1580602989, + eventType: 'rudderstack', + anonymousId: 'anon-id-new', + 'traits.trait1': 'new-val', + ip: '14.5.67.21', + 'library.name': 'http', + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'new_relic', + description: 'Test 7', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + event: 'first', + userId: 'identified user id', + type: 'identify', + anonymousId: 'anon-id-new', + context: { + traits: { + trait1: 'new-val', + }, + ip: '14.5.67.21', + library: { + name: 'http', + }, + }, + traits: { + abc: '123', + key: { + abc: 123, + }, + array: [ + { + abc: 123, + }, + { + def: 123, + }, + ], + }, + timestamp: '2020-02-02T00:23:09.544Z', + sentAt: '2020-02-02T00:23:09.544Z', + originalTimestamp: '2020-02-02T00:23:09.544Z', + }, + destination: { + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + Config: { + accountId: '12345', + insertKey: '11111122702j2a2U2K2C7H', + customEventType: '', + sendDeviceContext: true, + sendUserIdanonymousId: true, + dataCenter: 'us', + }, + Enabled: true, + Transformations: [], + IsProcessorEnabled: true, + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + statusCode: 400, + error: + 'message type identify is not supported: Workflow: procWorkflow, Step: validateInput, ChildStep: undefined, OriginalError: message type identify is not supported', + statTags: { + errorCategory: 'dataValidation', + errorType: 'instrumentation', + implementation: 'cdkV2', + destType: 'NEW_RELIC', + module: 'destination', + feature: 'processor', + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + }, +]; diff --git a/test/integrations/destinations/optimizely_fullstack/processor/data.ts b/test/integrations/destinations/optimizely_fullstack/processor/data.ts index 09749178ee..52fbdfe5fe 100644 --- a/test/integrations/destinations/optimizely_fullstack/processor/data.ts +++ b/test/integrations/destinations/optimizely_fullstack/processor/data.ts @@ -55,7 +55,8 @@ export const data = [ 'Data File Url is not present. Aborting: Workflow: procWorkflow, Step: validateInput, ChildStep: undefined, OriginalError: Data File Url is not present. Aborting', statTags: { destType: 'OPTIMIZELY_FULLSTACK', - errorCategory: 'platform', + errorCategory: 'dataValidation', + errorType: 'configuration', feature: 'processor', implementation: 'cdkV2', module: 'destination', @@ -121,7 +122,8 @@ export const data = [ 'Variation ID is not present in the integrations object: Workflow: procWorkflow, Step: validateInputForIdentify, ChildStep: undefined, OriginalError: Variation ID is not present in the integrations object', statTags: { destType: 'OPTIMIZELY_FULLSTACK', - errorCategory: 'platform', + errorCategory: 'dataValidation', + errorType: 'instrumentation', feature: 'processor', implementation: 'cdkV2', module: 'destination', @@ -186,7 +188,8 @@ export const data = [ 'Account ID is not present. Aborting: Workflow: procWorkflow, Step: validateInput, ChildStep: undefined, OriginalError: Account ID is not present. Aborting', statTags: { destType: 'OPTIMIZELY_FULLSTACK', - errorCategory: 'platform', + errorCategory: 'dataValidation', + errorType: 'configuration', feature: 'processor', implementation: 'cdkV2', module: 'destination', @@ -251,7 +254,8 @@ export const data = [ 'Campaign ID is not present. Aborting: Workflow: procWorkflow, Step: validateInput, ChildStep: undefined, OriginalError: Campaign ID is not present. Aborting', statTags: { destType: 'OPTIMIZELY_FULLSTACK', - errorCategory: 'platform', + errorCategory: 'dataValidation', + errorType: 'configuration', feature: 'processor', implementation: 'cdkV2', module: 'destination', @@ -316,7 +320,8 @@ export const data = [ 'Experiment ID is not present. Aborting: Workflow: procWorkflow, Step: validateInput, ChildStep: undefined, OriginalError: Experiment ID is not present. Aborting', statTags: { destType: 'OPTIMIZELY_FULLSTACK', - errorCategory: 'platform', + errorCategory: 'dataValidation', + errorType: 'configuration', feature: 'processor', implementation: 'cdkV2', module: 'destination', @@ -388,7 +393,8 @@ export const data = [ "Both 'Track Categorized Pages' and 'Track Named Pages' toggles are disabled in webapp. Please enable at one of them to send page/screen events to Optimizely.: Workflow: procWorkflow, Step: validateInputForPageAndScreen, ChildStep: undefined, OriginalError: Both 'Track Categorized Pages' and 'Track Named Pages' toggles are disabled in webapp. Please enable at one of them to send page/screen events to Optimizely.", statTags: { destType: 'OPTIMIZELY_FULLSTACK', - errorCategory: 'platform', + errorCategory: 'dataValidation', + errorType: 'configuration', feature: 'processor', implementation: 'cdkV2', module: 'destination', @@ -467,7 +473,8 @@ export const data = [ "UserId is required for event tracking when the 'Track Known Users' setting is enabled. Please include a 'userId' in your event payload: Workflow: procWorkflow, Step: validateInput, ChildStep: undefined, OriginalError: UserId is required for event tracking when the 'Track Known Users' setting is enabled. Please include a 'userId' in your event payload", statTags: { destType: 'OPTIMIZELY_FULLSTACK', - errorCategory: 'platform', + errorCategory: 'dataValidation', + errorType: 'configuration', feature: 'processor', implementation: 'cdkV2', module: 'destination', @@ -530,7 +537,8 @@ export const data = [ 'Event is not present. Aborting.: Workflow: procWorkflow, Step: validateInputForTrack, ChildStep: undefined, OriginalError: Event is not present. Aborting.', statTags: { destType: 'OPTIMIZELY_FULLSTACK', - errorCategory: 'platform', + errorCategory: 'dataValidation', + errorType: 'instrumentation', feature: 'processor', implementation: 'cdkV2', module: 'destination', @@ -591,15 +599,16 @@ export const data = [ body: [ { error: - '{"message":"Data File Lookup Failed due to {\\"code\\":\\"document_not_found\\",\\"message\\":\\"document_not_found\\"}: Workflow: procWorkflow, Step: dataFile, ChildStep: undefined, OriginalError: Data File Lookup Failed due to {\\"code\\":\\"document_not_found\\",\\"message\\":\\"document_not_found\\"}","destinationResponse":{"code":"document_not_found","message":"document_not_found"}}', + '{"message":"{\\"message\\":\\"Data File Lookup Failed due to {\\\\\\"code\\\\\\":\\\\\\"document_not_found\\\\\\",\\\\\\"message\\\\\\":\\\\\\"document_not_found\\\\\\"}: Workflow: procWorkflow, Step: dataFile, ChildStep: undefined, OriginalError: Data File Lookup Failed due to {\\\\\\"code\\\\\\":\\\\\\"document_not_found\\\\\\",\\\\\\"message\\\\\\":\\\\\\"document_not_found\\\\\\"}\\",\\"destinationResponse\\":{\\"code\\":\\"document_not_found\\",\\"message\\":\\"document_not_found\\"}}","destinationResponse":{"code":"document_not_found","message":"document_not_found"}}', statTags: { destType: 'OPTIMIZELY_FULLSTACK', - errorCategory: 'platform', + errorCategory: 'network', + errorType: 'aborted', feature: 'processor', implementation: 'cdkV2', module: 'destination', }, - statusCode: 400, + statusCode: 404, metadata: { jobId: 10, }, @@ -670,7 +679,8 @@ export const data = [ "Event 'product_added' is not present in data file. Make sure event exists in Optimizely.: Workflow: procWorkflow, Step: prepareTrackPayload, ChildStep: optimizelyEvent, OriginalError: Event 'product_added' is not present in data file. Make sure event exists in Optimizely.", statTags: { destType: 'OPTIMIZELY_FULLSTACK', - errorCategory: 'platform', + errorCategory: 'dataValidation', + errorType: 'instrumentation', feature: 'processor', implementation: 'cdkV2', module: 'destination', @@ -1162,7 +1172,8 @@ export const data = [ metadata: { jobId: 15 }, statTags: { destType: 'OPTIMIZELY_FULLSTACK', - errorCategory: 'platform', + errorCategory: 'dataValidation', + errorType: 'instrumentation', feature: 'processor', implementation: 'cdkV2', module: 'destination', diff --git a/test/integrations/destinations/ortto/processor/data.ts b/test/integrations/destinations/ortto/processor/data.ts index 9c3d00b874..e7c71c7355 100644 --- a/test/integrations/destinations/ortto/processor/data.ts +++ b/test/integrations/destinations/ortto/processor/data.ts @@ -347,7 +347,8 @@ export const data = [ { statTags: { destType: 'ORTTO', - errorCategory: 'platform', + errorCategory: 'dataValidation', + errorType: 'instrumentation', feature: 'processor', implementation: 'cdkV2', module: 'destination', @@ -505,7 +506,8 @@ export const data = [ { statTags: { destType: 'ORTTO', - errorCategory: 'platform', + errorCategory: 'dataValidation', + errorType: 'instrumentation', feature: 'processor', implementation: 'cdkV2', module: 'destination', @@ -667,7 +669,8 @@ export const data = [ { statTags: { destType: 'ORTTO', - errorCategory: 'platform', + errorCategory: 'dataValidation', + errorType: 'configuration', feature: 'processor', implementation: 'cdkV2', module: 'destination', @@ -829,7 +832,8 @@ export const data = [ { statTags: { destType: 'ORTTO', - errorCategory: 'platform', + errorCategory: 'dataValidation', + errorType: 'configuration', feature: 'processor', implementation: 'cdkV2', module: 'destination', @@ -1216,7 +1220,8 @@ export const data = [ { statTags: { destType: 'ORTTO', - errorCategory: 'platform', + errorCategory: 'dataValidation', + errorType: 'instrumentation', feature: 'processor', implementation: 'cdkV2', module: 'destination', diff --git a/test/integrations/destinations/pinterest_tag/processor/data.ts b/test/integrations/destinations/pinterest_tag/processor/data.ts index c7f482aadd..17ab83b2e9 100644 --- a/test/integrations/destinations/pinterest_tag/processor/data.ts +++ b/test/integrations/destinations/pinterest_tag/processor/data.ts @@ -44,6 +44,7 @@ export const data = [ order_id: '50314b8e9bcf000000000000', requestIP: '123.0.0.0', optOutType: 'LDP', + clickId: 'dummy_clickId', products: [ { sku: '45790-32', @@ -132,6 +133,7 @@ export const data = [ '6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090', ], client_user_agent: 'chrome', + click_id: 'dummy_clickId', ge: ['1b16b1df538ba12dc3f97edbb85caa7050d46c148134290feba80f8236c83db9'], }, custom_data: { @@ -562,7 +564,8 @@ export const data = [ metadata: { destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq' }, statTags: { destType: 'PINTEREST_TAG', - errorCategory: 'platform', + errorCategory: 'dataValidation', + errorType: 'configuration', feature: 'processor', implementation: 'cdkV2', module: 'destination', @@ -679,7 +682,8 @@ export const data = [ 'It is required at least one of em, hashed_maids or pair of client_ip_address and client_user_agent: Workflow: procWorkflow, Step: validateUserFields, ChildStep: undefined, OriginalError: It is required at least one of em, hashed_maids or pair of client_ip_address and client_user_agent', statTags: { destType: 'PINTEREST_TAG', - errorCategory: 'platform', + errorCategory: 'dataValidation', + errorType: 'instrumentation', feature: 'processor', implementation: 'cdkV2', module: 'destination', @@ -958,7 +962,8 @@ export const data = [ metadata: { destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq' }, statTags: { destType: 'PINTEREST_TAG', - errorCategory: 'platform', + errorCategory: 'dataValidation', + errorType: 'configuration', feature: 'processor', implementation: 'cdkV2', module: 'destination', @@ -1077,7 +1082,8 @@ export const data = [ metadata: { destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq' }, statTags: { destType: 'PINTEREST_TAG', - errorCategory: 'platform', + errorCategory: 'dataValidation', + errorType: 'instrumentation', feature: 'processor', implementation: 'cdkV2', module: 'destination', @@ -1197,7 +1203,8 @@ export const data = [ 'Action source must be one of app_android, app_ios, web, offline: Workflow: procWorkflow, Step: validateCommonFields, ChildStep: undefined, OriginalError: Action source must be one of app_android, app_ios, web, offline', statTags: { destType: 'PINTEREST_TAG', - errorCategory: 'platform', + errorCategory: 'dataValidation', + errorType: 'instrumentation', feature: 'processor', implementation: 'cdkV2', module: 'destination', @@ -3234,7 +3241,8 @@ export const data = [ metadata: { destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq' }, statTags: { destType: 'PINTEREST_TAG', - errorCategory: 'platform', + errorCategory: 'dataValidation', + errorType: 'configuration', feature: 'processor', implementation: 'cdkV2', module: 'destination', @@ -3321,7 +3329,8 @@ export const data = [ metadata: { destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq' }, statTags: { destType: 'PINTEREST_TAG', - errorCategory: 'platform', + errorCategory: 'dataValidation', + errorType: 'configuration', feature: 'processor', implementation: 'cdkV2', module: 'destination', @@ -3474,4 +3483,90 @@ export const data = [ }, }, }, + { + name: 'pinterest_tag', + description: 'Test 26', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + type: 'track', + channel: 'web', + sentAt: '2020-08-14T05:30:30.118Z', + context: { + source: 'test', + userAgent: 'chrome', + traits: { + anonymousId: '50be5c78-6c3f-4b60-be84-97805a316fb1', + email: 'abc@gmail.com', + phone: '+1234589947', + ge: 'male', + db: '19950715', + lastname: 'Rudderlabs', + firstName: 'Test', + address: { city: 'Kolkata', state: 'WB', zip: '700114', country: 'IN' }, + }, + device: { advertisingId: 'abc123' }, + library: { name: 'rudder-sdk-ruby-sync', version: '1.0.6' }, + }, + messageId: '7208bbb6-2c4e-45bb-bf5b-ad426f3593e9', + timestamp: '2020-08-14T05:30:30.118Z', + anonymousId: '50be5c78-6c3f-4b60-be84-97805a316fb1', + integrations: { All: true }, + }, + destination: { + DestinationDefinition: { Config: { cdkV2Enabled: true } }, + ID: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', + Name: 'PINTEREST_TAG', + Config: { + sendAsTestEvent: false, + tagId: '123456789', + apiVersion: 'newApi', + adAccountId: 'accountId123', + conversionToken: 'conversionToken123', + appId: '429047995', + enhancedMatch: true, + enableDeduplication: true, + deduplicationKey: 'messageId', + sendingUnHashedData: true, + sendAsCustomEvent: false, + customProperties: [{ properties: 'presentclass' }, { properties: 'presentgrade' }], + eventsMapping: [{ from: 'ABC Searched', to: 'WatchVideo' }], + }, + Enabled: true, + Transformations: [], + }, + metadata: { destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq' }, + }, + ], + method: 'POST', + }, + pathSuffix: '', + }, + output: { + response: { + status: 200, + body: [ + { + error: + 'event_name could not be mapped. Aborting.: Workflow: procWorkflow, Step: validateInputForTrack, ChildStep: undefined, OriginalError: event_name could not be mapped. Aborting.', + metadata: { destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq' }, + statTags: { + destType: 'PINTEREST_TAG', + errorCategory: 'dataValidation', + errorType: 'instrumentation', + feature: 'processor', + implementation: 'cdkV2', + module: 'destination', + }, + statusCode: 400, + }, + ], + }, + }, + }, ]; diff --git a/test/integrations/destinations/salesforce/dataDelivery/data.ts b/test/integrations/destinations/salesforce/dataDelivery/data.ts index 504159cc6f..c53ce58f9e 100644 --- a/test/integrations/destinations/salesforce/dataDelivery/data.ts +++ b/test/integrations/destinations/salesforce/dataDelivery/data.ts @@ -119,6 +119,7 @@ export const data = [ body: { output: { status: 500, + authErrorCategory: 'REFRESH_TOKEN', message: 'Salesforce Request Failed - due to "INVALID_SESSION_ID", (Retryable) during Salesforce Response Handling', destinationResponse: { @@ -128,12 +129,12 @@ export const data = [ errorCode: 'INVALID_SESSION_ID', }, ], - status: 401, rudderJobMetadata: { destInfo: { authKey: '2HezPl1w11opbFSxnLDEgZ7kWTf', }, }, + status: 401, }, statTags: { destType: 'SALESFORCE', diff --git a/test/integrations/destinations/salesforce/processor/data.ts b/test/integrations/destinations/salesforce/processor/data.ts index ad0dbb6843..4ccc8cca79 100644 --- a/test/integrations/destinations/salesforce/processor/data.ts +++ b/test/integrations/destinations/salesforce/processor/data.ts @@ -1381,4 +1381,132 @@ export const data = [ }, }, }, + { + name: 'salesforce', + description: 'Test 10', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + initialAccessToken: '7fiy1FKcO9sohsxq1v6J88sg', + password: 'dummyPassword2', + userName: 'test.c97-qvpd@force.com.test', + sandbox: true, + }, + DestinationDefinition: { + DisplayName: 'Salesforce', + ID: '1T96GHZ0YZ1qQSLULHCoJkow9KC', + Name: 'SALESFORCE', + }, + Enabled: true, + ID: '1ut7LcVW1QC56y2EoTNo7ZwBWSY', + Name: 'Test SF', + Transformations: [], + }, + metadata: { + secret: { + access_token: 'dummyAccessToken', + instance_url: 'http://dummyurl.com', + }, + }, + message: { + anonymousId: '1e7673da-9473-49c6-97f7-da848ecafa76', + channel: 'web', + context: { + mappedToDestination: true, + externalId: [ + { + id: 'a005g0000383kmUAAQ', + type: 'SALESFORCE-custom_object__c', + identifierType: 'Id', + }, + ], + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + ip: '0.0.0.0', + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + locale: 'en-US', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + traits: { + email: 'john@rs.com', + firstname: 'john doe', + Id: 'some-id', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36', + }, + integrations: { + All: true, + }, + messageId: 'f19c35da-e9de-4c6e-b6e5-9e60cccc12c8', + originalTimestamp: '2020-01-27T12:20:55.301Z', + receivedAt: '2020-01-27T17:50:58.657+05:30', + request_ip: '14.98.244.60', + sentAt: '2020-01-27T12:20:56.849Z', + timestamp: '2020-01-27T17:50:57.109+05:30', + type: 'identify', + userId: '1e7673da-9473-49c6-97f7-da848ecafa76', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + statusCode: 200, + metadata: { + secret: { + access_token: 'dummyAccessToken', + instance_url: 'http://dummyurl.com', + }, + }, + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: + 'http://dummyurl.com/services/data/v50.0/sobjects/custom_object__c/a005g0000383kmUAAQ?_HttpMethod=PATCH', + headers: { + 'Content-Type': 'application/json', + Authorization: 'Bearer dummyAccessToken', + }, + params: {}, + body: { + JSON: { + email: 'john@rs.com', + firstname: 'john doe', + }, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + }, + ], + }, + }, + }, ]; diff --git a/test/integrations/destinations/snapchat_conversion/processor/data.ts b/test/integrations/destinations/snapchat_conversion/processor/data.ts index ed38673d95..b0d14208cc 100644 --- a/test/integrations/destinations/snapchat_conversion/processor/data.ts +++ b/test/integrations/destinations/snapchat_conversion/processor/data.ts @@ -4291,6 +4291,315 @@ export const data = [ }, }, }, + { + name: 'snapchat_conversion', + description: 'Test Case for Order Completed event category', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', + originalTimestamp: '2022-04-22T10:57:58Z', + channel: 'mobile', + anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', + context: { + traits: { + email: 'test@email.com', + phone: '+91 2111111 ', + }, + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + device: { + advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', + id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', + manufacturer: 'Google', + name: 'generic_x86_arm', + type: 'ios', + attTrackingStatus: 3, + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + locale: 'en-US', + os: { + name: 'iOS', + version: '14.4.1', + }, + screen: { + density: 2, + }, + externalId: [ + { + type: 'ga4AppInstanceId', + id: 'f0dd99v4f979fb997ce453373900f891', + }, + ], + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', + }, + type: 'track', + event: 'Order Completed', + properties: { + brands: ['brand01', 'brand02'], + products: [ + { + product_id: '123', + price: '14', + quantity: 1, + }, + { + product_id: '124', + price: 14, + quantity: 3, + }, + ], + category: 'shoes', + }, + integrations: { + All: true, + }, + sentAt: '2022-04-22T10:57:58Z', + }, + destination: { + DestinationDefinition: { + Config: { + cdkV2Enabled: false, + }, + }, + Config: { + apiKey: 'dummyApiKey', + pixelId: 'dummyPixelId', + appId: 'dhfeih44f', + snapAppId: 'hfhdhfd', + }, + }, + metadata: { + jobId: 31, + destinationId: 'd2', + workspaceId: 'w2', + }, + }, + ], + method: 'POST', + }, + }, + output: { + response: { + status: 200, + body: [ + { + metadata: { + jobId: 31, + destinationId: 'd2', + workspaceId: 'w2', + }, + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://tr.snapchat.com/v2/conversion', + headers: { + Authorization: 'Bearer dummyApiKey', + 'Content-Type': 'application/json', + }, + params: {}, + body: { + JSON: { + event_type: 'PURCHASE', + item_ids: ['123', '124'], + brands: ['brand01', 'brand02'], + item_category: 'shoes', + price: '56', + hashed_email: '73062d872926c2a556f17b36f50e328ddf9bff9d403939bd14b6c3b7f5a33fc2', + hashed_phone_number: + 'bc77d64d7045fe44795ed926df37231a0cfb6ec6b74588c512790e9f143cc492', + hashed_mobile_ad_id: + 'f9779d734aaee50f16ee0011260bae7048f1d9a128c62b6a661077875701edd2', + hashed_idfv: '54bd0b26a3d39dad90f5149db49b9fd9ba885f8e35d1d94cae69273f5e657b9f', + user_agent: + 'mozilla/5.0 (macintosh; intel mac os x 10_15_2) applewebkit/537.36 (khtml, like gecko) chrome/79.0.3945.88 safari/537.36', + timestamp: '1650625078', + event_conversion_type: 'MOBILE_APP', + snap_app_id: 'hfhdhfd', + app_id: 'dhfeih44f', + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'snapchat_conversion', + description: 'Test Case for Order Completed event with both category and item_category', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', + originalTimestamp: '2022-04-22T10:57:58Z', + channel: 'mobile', + anonymousId: 'ea5cfab2-3961-4d8a-8187-3d1858c99090', + context: { + traits: { + email: 'test@email.com', + phone: '+91 2111111 ', + }, + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + device: { + advertisingId: 'T0T0T072-5e28-45a1-9eda-ce22a3e36d1a', + id: '3f034872-5e28-45a1-9eda-ce22a3e36d1a', + manufacturer: 'Google', + name: 'generic_x86_arm', + type: 'ios', + attTrackingStatus: 3, + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + locale: 'en-US', + os: { + name: 'iOS', + version: '14.4.1', + }, + screen: { + density: 2, + }, + externalId: [ + { + type: 'ga4AppInstanceId', + id: 'f0dd99v4f979fb997ce453373900f891', + }, + ], + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', + }, + type: 'track', + event: 'Order Completed', + properties: { + brands: ['brand01', 'brand02'], + products: [ + { + product_id: '123', + price: '14', + quantity: 1, + }, + { + product_id: '124', + price: 14, + quantity: 3, + }, + ], + category: 'shoes', + item_category: 'glass', + }, + integrations: { + All: true, + }, + sentAt: '2022-04-22T10:57:58Z', + }, + destination: { + DestinationDefinition: { + Config: { + cdkV2Enabled: false, + }, + }, + Config: { + apiKey: 'dummyApiKey', + pixelId: 'dummyPixelId', + appId: 'dhfeih44f', + snapAppId: 'hfhdhfd', + }, + }, + metadata: { + jobId: 31, + destinationId: 'd2', + workspaceId: 'w2', + }, + }, + ], + method: 'POST', + }, + }, + output: { + response: { + status: 200, + body: [ + { + metadata: { + jobId: 31, + destinationId: 'd2', + workspaceId: 'w2', + }, + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://tr.snapchat.com/v2/conversion', + headers: { + Authorization: 'Bearer dummyApiKey', + 'Content-Type': 'application/json', + }, + params: {}, + body: { + JSON: { + event_type: 'PURCHASE', + item_ids: ['123', '124'], + brands: ['brand01', 'brand02'], + item_category: 'glass', + price: '56', + hashed_email: '73062d872926c2a556f17b36f50e328ddf9bff9d403939bd14b6c3b7f5a33fc2', + hashed_phone_number: + 'bc77d64d7045fe44795ed926df37231a0cfb6ec6b74588c512790e9f143cc492', + hashed_mobile_ad_id: + 'f9779d734aaee50f16ee0011260bae7048f1d9a128c62b6a661077875701edd2', + hashed_idfv: '54bd0b26a3d39dad90f5149db49b9fd9ba885f8e35d1d94cae69273f5e657b9f', + user_agent: + 'mozilla/5.0 (macintosh; intel mac os x 10_15_2) applewebkit/537.36 (khtml, like gecko) chrome/79.0.3945.88 safari/537.36', + timestamp: '1650625078', + event_conversion_type: 'MOBILE_APP', + snap_app_id: 'hfhdhfd', + app_id: 'dhfeih44f', + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, ].map((tc) => ({ ...tc, mockFns: (_) => { diff --git a/test/integrations/destinations/tiktok_ads/processor/data.ts b/test/integrations/destinations/tiktok_ads/processor/data.ts index 38fec1e1e0..453a875af2 100644 --- a/test/integrations/destinations/tiktok_ads/processor/data.ts +++ b/test/integrations/destinations/tiktok_ads/processor/data.ts @@ -1,4690 +1,4663 @@ export const data = [ - { - "name": "tiktok_ads", - "description": "Test 0", - "feature": "processor", - "module": "destination", - "version": "v0", - "input": { - "request": { - "body": [ - { - "message": { - "anonymousId": "21e13f4bc7ceddad", - "channel": "web", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.0.0" - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.0.0" - }, - "userAgent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", - "ip": "13.57.97.131", - "locale": "en-US", - "os": { - "name": "", - "version": "" - }, - "screen": { - "density": 2 - }, - "externalId": [ - { - "type": "tiktokExternalId", - "id": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" - } - ] - }, - "messageId": "84e26acc-56a5-4835-8233-591137fca468", - "session_id": "3049dc4c-5a95-4ccd-a3e7-d74a7e411f22", - "originalTimestamp": "2019-10-14T09:03:17.562Z", - "timestamp": "2020-09-17T19:49:27Z", - "type": "track", - "event": "checkout step completed", - "properties": { - "eventId": "1616318632825_357", - "contents": [ - { - "price": 8, - "quantity": 2, - "content_type": "socks", - "content_id": "1077218" - }, - { - "price": 30, - "quantity": 1, - "content_type": "dress", - "content_id": "1197218" - } - ], - "currency": "USD", - "value": 46, - "context": { - "ad": { - "callback": "123ATXSfe" - }, - "page": { - "url": "http://demo.mywebsite.com/purchase", - "referrer": "http://demo.mywebsite.com" - }, - "user": { - "phone_number": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", - "email": "dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f" - } - } - }, - "integrations": { - "All": true - }, - "sentAt": "2019-10-14T09:03:22.563Z" - }, - "destination": { - "Config": { - "accessToken": "dummyAccessToken", - "pixelCode": "A1T8T4UYGVIQA8ORZMX9", - "hashUserProperties": false - } - } - } - ] - } - }, - "output": { - "response": { - "status": 200, - "body": [ - { - "output": { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://business-api.tiktok.com/open_api/v1.3/pixel/track/", - "headers": { - "Access-Token": "dummyAccessToken", - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "pixel_code": "A1T8T4UYGVIQA8ORZMX9", - "event": "CompletePayment", - "event_id": "1616318632825_357", - "timestamp": "2020-09-17T19:49:27Z", - "properties": { - "contents": [ - { - "price": 8, - "quantity": 2, - "content_type": "socks", - "content_id": "1077218" - }, - { - "price": 30, - "quantity": 1, - "content_type": "dress", - "content_id": "1197218" - } - ], - "currency": "USD", - "value": 46 - }, - "context": { - "ad": { - "callback": "123ATXSfe" - }, - "page": { - "url": "http://demo.mywebsite.com/purchase", - "referrer": "http://demo.mywebsite.com" - }, - "user": { - "phone_number": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", - "email": "dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f", - "external_id": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" - }, - "ip": "13.57.97.131", - "user_agent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion" - }, - "partner_name": "RudderStack" - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {}, - "userId": "" - }, - "statusCode": 200 - } - ] - } - } - }, - { - "name": "tiktok_ads", - "description": "Test 1", - "feature": "processor", - "module": "destination", - "version": "v0", - "input": { - "request": { - "body": [ - { - "message": { - "anonymousId": "21e13f4bc7ceddad", - "channel": "web", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.0.0" - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.0.0" - }, - "userAgent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", - "locale": "en-US", - "ip": "13.57.97.131", - "os": { - "name": "", - "version": "" - }, - "screen": { - "density": 2 - }, - "externalId": [ - { - "type": "tiktokExternalId", - "id": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" - } - ] - }, - "messageId": "84e26acc-56a5-4835-8233-591137fca468", - "session_id": "3049dc4c-5a95-4ccd-a3e7-d74a7e411f22", - "originalTimestamp": "2019-10-14T09:03:17.562Z", - "timestamp": "2020-09-17T19:49:27Z", - "type": "track", - "event": "checkout started", - "properties": { - "eventId": "1616318632825_357", - "context": { - "ad": { - "callback": "123ATXSfe" - }, - "page": { - "url": "http://demo.mywebsite.com/purchase", - "referrer": "http://demo.mywebsite.com" - }, - "user": { - "phone_number": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", - "email": "dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f" - } - }, - "contents": [ - { - "price": 8, - "quantity": 2, - "content_type": "socks", - "content_id": "1077218" - }, - { - "price": 30, - "quantity": 1, - "content_type": "dress", - "content_id": "1197218" - } - ], - "currency": "USD", - "value": 46 - }, - "integrations": { - "All": true - }, - "sentAt": "2019-10-14T09:03:22.563Z" - }, - "destination": { - "Config": { - "accessToken": "dummyAccessToken", - "pixelCode": "A1T8T4UYGVIQA8ORZMX9", - "hashUserProperties": false - } - } - } - ] - } - }, - "output": { - "response": { - "status": 200, - "body": [ - { - "output": { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://business-api.tiktok.com/open_api/v1.3/pixel/track/", - "headers": { - "Access-Token": "dummyAccessToken", - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "pixel_code": "A1T8T4UYGVIQA8ORZMX9", - "event": "InitiateCheckout", - "event_id": "1616318632825_357", - "timestamp": "2020-09-17T19:49:27Z", - "properties": { - "contents": [ - { - "price": 8, - "quantity": 2, - "content_type": "socks", - "content_id": "1077218" - }, - { - "price": 30, - "quantity": 1, - "content_type": "dress", - "content_id": "1197218" - } - ], - "currency": "USD", - "value": 46 - }, - "context": { - "ad": { - "callback": "123ATXSfe" - }, - "page": { - "url": "http://demo.mywebsite.com/purchase", - "referrer": "http://demo.mywebsite.com" - }, - "user": { - "phone_number": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", - "email": "dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f", - "external_id": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" - }, - "ip": "13.57.97.131", - "user_agent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion" - }, - "partner_name": "RudderStack" - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {}, - "userId": "" - }, - "statusCode": 200 - } - ] - } - } - }, - { - "name": "tiktok_ads", - "description": "Test 2", - "feature": "processor", - "module": "destination", - "version": "v0", - "input": { - "request": { - "body": [ - { - "message": { - "anonymousId": "21e13f4bc7ceddad", - "channel": "web", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.0.0" - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.0.0" - }, - "locale": "en-US", - "os": { - "name": "", - "version": "" - }, - "screen": { - "density": 2 - }, - "externalId": [ - { - "type": "tiktokExternalId", - "id": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" - } - ] - }, - "messageId": "84e26acc-56a5-4835-8233-591137fca468", - "session_id": "3049dc4c-5a95-4ccd-a3e7-d74a7e411f22", - "originalTimestamp": "2019-10-14T09:03:17.562Z", - "timestamp": "2020-09-17T19:49:27Z", - "type": "track", - "event": "Product Added to Wishlist", - "properties": { - "eventId": "1616318632825_357", - "testEventCode": "sample rudder test_event_code", - "context": { - "ad": { - "callback": "123ATXSfe" - }, - "page": { - "url": "http://demo.mywebsite.com/purchase", - "referrer": "http://demo.mywebsite.com" - }, - "user": { - "phone_number": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", - "email": "dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f" - } - }, - "contents": [ - { - "price": 8, - "quantity": 2, - "content_type": "socks", - "content_id": "1077218" - }, - { - "price": 30, - "quantity": 1, - "content_type": "dress", - "content_id": "1197218" - } - ], - "currency": "USD", - "value": 46 - }, - "integrations": { - "All": true - }, - "sentAt": "2019-10-14T09:03:22.563Z" - }, - "destination": { - "Config": { - "accessToken": "dummyAccessToken", - "pixelCode": "A1T8T4UYGVIQA8ORZMX9", - "hashUserProperties": false - } - } - } - ] - } - }, - "output": { - "response": { - "status": 200, - "body": [ - { - "output": { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://business-api.tiktok.com/open_api/v1.3/pixel/track/", - "headers": { - "Access-Token": "dummyAccessToken", - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "pixel_code": "A1T8T4UYGVIQA8ORZMX9", - "event": "AddToWishlist", - "event_id": "1616318632825_357", - "timestamp": "2020-09-17T19:49:27Z", - "test_event_code": "sample rudder test_event_code", - "properties": { - "contents": [ - { - "price": 8, - "quantity": 2, - "content_type": "socks", - "content_id": "1077218" - }, - { - "price": 30, - "quantity": 1, - "content_type": "dress", - "content_id": "1197218" - } - ], - "currency": "USD", - "value": 46 - }, - "context": { - "ad": { - "callback": "123ATXSfe" - }, - "page": { - "url": "http://demo.mywebsite.com/purchase", - "referrer": "http://demo.mywebsite.com" - }, - "user": { - "phone_number": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", - "email": "dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f", - "external_id": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" - } - }, - "partner_name": "RudderStack" - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {}, - "userId": "" - }, - "statusCode": 200 - } - ] - } - } - }, - { - "name": "tiktok_ads", - "description": "Test 3", - "feature": "processor", - "module": "destination", - "version": "v0", - "input": { - "request": { - "body": [ - { - "message": { - "anonymousId": "21e13f4bc7ceddad", - "channel": "web", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.0.0" - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.0.0" - }, - "userAgent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", - "locale": "en-US", - "ip": "13.57.97.131", - "os": { - "name": "", - "version": "" - }, - "screen": { - "density": 2 - }, - "externalId": [ - { - "type": "tiktokExternalId", - "id": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" - } - ] - }, - "messageId": "84e26acc-56a5-4835-8233-591137fca468", - "session_id": "3049dc4c-5a95-4ccd-a3e7-d74a7e411f22", - "originalTimestamp": "2019-10-14T09:03:17.562Z", - "timestamp": "2020-09-17T19:49:27Z", - "type": "track", - "event": "Product Added to Wishlist1", - "properties": { - "eventId": "1616318632825_357", - "testEventCode": "sample rudder test_event_code", - "context": { - "ad": { - "callback": "123ATXSfe" - }, - "page": { - "url": "http://demo.mywebsite.com/purchase", - "referrer": "http://demo.mywebsite.com" - }, - "user": { - "phone_number": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", - "email": "dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f" - } - }, - "contents": [ - { - "price": 8, - "quantity": 2, - "content_type": "socks", - "content_id": "1077218" - }, - { - "price": 30, - "quantity": 1, - "content_type": "dress", - "content_id": "1197218" - } - ], - "currency": "USD", - "value": 46 - }, - "integrations": { - "All": true - }, - "sentAt": "2019-10-14T09:03:22.563Z" - }, - "destination": { - "Config": { - "accessToken": "dummyAccessToken", - "pixelCode": "A1T8T4UYGVIQA8ORZMX9", - "hashUserProperties": false - } - } - } - ] - } - }, - "output": { - "response": { - "status": 200, - "body": [ - { - "statusCode": 400, - "error": "Event name (product added to wishlist1) is not valid, must be mapped to one of standard events", - "statTags": { - "errorCategory": "dataValidation", - "errorType": "instrumentation", - "destType": "TIKTOK_ADS", - "module": "destination", - "implementation": "native", - "feature": "processor" - } - } - ] - } - } - }, - { - "name": "tiktok_ads", - "description": "Test 4", - "feature": "processor", - "module": "destination", - "version": "v0", - "input": { - "request": { - "body": [ - { - "message": { - "anonymousId": "21e13f4bc7ceddad", - "channel": "web", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.0.0" - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.0.0" - }, - "userAgent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", - "locale": "en-US", - "ip": "13.57.97.131", - "os": { - "name": "", - "version": "" - }, - "screen": { - "density": 2 - }, - "externalId": [ - { - "type": "tiktokExternalId", - "id": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" - } - ] - }, - "messageId": "84e26acc-56a5-4835-8233-591137fca468", - "session_id": "3049dc4c-5a95-4ccd-a3e7-d74a7e411f22", - "originalTimestamp": "2019-10-14T09:03:17.562Z", - "timestamp": "2020-09-17T19:49:27Z", - "type": "track", - "event": "Product Added to Wishlist", - "properties": { - "eventId": "1616318632825_357", - "testEventCode": "sample rudder test_event_code", - "context": { - "ad": { - "callback": "123ATXSfe" - }, - "page": { - "url": "http://demo.mywebsite.com/purchase", - "referrer": "http://demo.mywebsite.com" - }, - "user": { - "phone_number": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", - "email": "dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f" - } - }, - "contents": [ - { - "price": 8, - "quantity": 2, - "content_type": "socks", - "content_id": "1077218" - }, - { - "price": 30, - "quantity": 1, - "content_type": "dress", - "content_id": "1197218" - } - ], - "currency": "USD", - "value": 46 - }, - "integrations": { - "All": true - }, - "sentAt": "2019-10-14T09:03:22.563Z" - }, - "destination": { - "Config": { - "accessToken": "dummyAccessToken", - "pixelCode": "A1T8T4UYGVIQA8ORZMX9", - "hashUserProperties": false - } - } - } - ] - } - }, - "output": { - "response": { - "status": 200, - "body": [ - { - "output": { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://business-api.tiktok.com/open_api/v1.3/pixel/track/", - "headers": { - "Access-Token": "dummyAccessToken", - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "pixel_code": "A1T8T4UYGVIQA8ORZMX9", - "event": "AddToWishlist", - "event_id": "1616318632825_357", - "timestamp": "2020-09-17T19:49:27Z", - "test_event_code": "sample rudder test_event_code", - "properties": { - "contents": [ - { - "price": 8, - "quantity": 2, - "content_type": "socks", - "content_id": "1077218" - }, - { - "price": 30, - "quantity": 1, - "content_type": "dress", - "content_id": "1197218" - } - ], - "currency": "USD", - "value": 46 - }, - "context": { - "ad": { - "callback": "123ATXSfe" - }, - "page": { - "url": "http://demo.mywebsite.com/purchase", - "referrer": "http://demo.mywebsite.com" - }, - "user": { - "phone_number": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", - "email": "dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f", - "external_id": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" - }, - "ip": "13.57.97.131", - "user_agent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion" - }, - "partner_name": "RudderStack" - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {}, - "userId": "" - }, - "statusCode": 200 - } - ] - } - } - }, - { - "name": "tiktok_ads", - "description": "Test 5", - "feature": "processor", - "module": "destination", - "version": "v0", - "input": { - "request": { - "body": [ - { - "message": { - "anonymousId": "21e13f4bc7ceddad", - "channel": "web", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.0.0" - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.0.0" - }, - "userAgent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", - "locale": "en-US", - "ip": "13.57.97.131", - "os": { - "name": "", - "version": "" - }, - "screen": { - "density": 2 - }, - "externalId": [ - { - "type": "tiktokExternalId", - "id": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" - } - ] - }, - "messageId": "84e26acc-56a5-4835-8233-591137fca468", - "session_id": "3049dc4c-5a95-4ccd-a3e7-d74a7e411f22", - "originalTimestamp": "2019-10-14T09:03:17.562Z", - "timestamp": "2020-09-17T19:49:27Z", - "type": "track", - "event": "Product Added to Wishlist", - "properties": { - "eventId": "1616318632825_357", - "testEventCode": "sample rudder test_event_code", - "context": { - "ad": { - "callback": "123ATXSfe" - }, - "page": { - "url": "http://demo.mywebsite.com/purchase", - "referrer": "http://demo.mywebsite.com" - }, - "user": { - "phone_number": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", - "email": "dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f" - } - }, - "contents": [ - { - "price": 8, - "quantity": 2, - "content_type": "socks", - "content_id": "1077218" - }, - { - "price": 30, - "quantity": 1, - "content_type": "dress", - "content_id": "1197218" - } - ], - "currency": "USD", - "value": 46 - }, - "integrations": { - "All": true - }, - "sentAt": "2019-10-14T09:03:22.563Z" - }, - "destination": { - "Config": { - "accessToken": "dummyAccessToken", - "pixelCode": "A1T8T4UYGVIQA8ORZMX9", - "hashUserProperties": false - } - } - } - ] - } - }, - "output": { - "response": { - "status": 200, - "body": [ - { - "output": { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://business-api.tiktok.com/open_api/v1.3/pixel/track/", - "headers": { - "Access-Token": "dummyAccessToken", - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "pixel_code": "A1T8T4UYGVIQA8ORZMX9", - "event": "AddToWishlist", - "event_id": "1616318632825_357", - "timestamp": "2020-09-17T19:49:27Z", - "test_event_code": "sample rudder test_event_code", - "properties": { - "contents": [ - { - "price": 8, - "quantity": 2, - "content_type": "socks", - "content_id": "1077218" - }, - { - "price": 30, - "quantity": 1, - "content_type": "dress", - "content_id": "1197218" - } - ], - "currency": "USD", - "value": 46 - }, - "context": { - "ad": { - "callback": "123ATXSfe" - }, - "page": { - "url": "http://demo.mywebsite.com/purchase", - "referrer": "http://demo.mywebsite.com" - }, - "user": { - "phone_number": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", - "email": "dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f", - "external_id": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" - }, - "ip": "13.57.97.131", - "user_agent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion" - }, - "partner_name": "RudderStack" - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {}, - "userId": "" - }, - "statusCode": 200 - } - ] - } - } - }, - { - "name": "tiktok_ads", - "description": "Test 6", - "feature": "processor", - "module": "destination", - "version": "v0", - "input": { - "request": { - "body": [ - { - "message": { - "anonymousId": "21e13f4bc7ceddad", - "channel": "web", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.0.0" - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.0.0" - }, - "userAgent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", - "locale": "en-US", - "ip": "13.57.97.131", - "os": { - "name": "", - "version": "" - }, - "screen": { - "density": 2 - }, - "externalId": [ - { - "type": "tiktokExternalId", - "id": "1234" - } - ] - }, - "messageId": "84e26acc-56a5-4835-8233-591137fca468", - "session_id": "3049dc4c-5a95-4ccd-a3e7-d74a7e411f22", - "originalTimestamp": "2019-10-14T09:03:17.562Z", - "timestamp": "2020-09-17T19:49:27Z", - "type": "track", - "event": "SubscriBe", - "properties": { - "eventId": "1616318632825_357", - "testEventCode": "", - "context": { - "ad": { - "callback": "123ATXSfe" - }, - "page": { - "url": "http://demo.mywebsite.com/purchase", - "referrer": "http://demo.mywebsite.com" - }, - "user": { - "phone_number": "+868987675687", - "email": "sample@sample.com" - } - }, - "contents": [ - { - "price": 8, - "quantity": 2, - "content_type": "socks", - "content_id": "1077218" - }, - { - "price": 30, - "quantity": 1, - "content_type": "dress", - "content_id": "1197218" - } - ], - "currency": "USD", - "value": 46 - }, - "integrations": { - "All": true - }, - "sentAt": "2019-10-14T09:03:22.563Z" - }, - "destination": { - "Config": { - "accessToken": "dummyAccessToken", - "pixelCode": "A1T8T4UYGVIQA8ORZMX9", - "hashUserProperties": true - } - } - } - ] - } - }, - "output": { - "response": { - "status": 200, - "body": [ - { - "output": { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://business-api.tiktok.com/open_api/v1.3/pixel/track/", - "headers": { - "Access-Token": "dummyAccessToken", - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "pixel_code": "A1T8T4UYGVIQA8ORZMX9", - "event": "Subscribe", - "event_id": "1616318632825_357", - "timestamp": "2020-09-17T19:49:27Z", - "properties": { - "contents": [ - { - "price": 8, - "quantity": 2, - "content_type": "socks", - "content_id": "1077218" - }, - { - "price": 30, - "quantity": 1, - "content_type": "dress", - "content_id": "1197218" - } - ], - "currency": "USD", - "value": 46 - }, - "context": { - "ad": { - "callback": "123ATXSfe" - }, - "page": { - "url": "http://demo.mywebsite.com/purchase", - "referrer": "http://demo.mywebsite.com" - }, - "user": { - "phone_number": "1d96e70d2bf54087e33586457cde2790825bee7b1a3b05d26481cb12ec8e63fd", - "email": "774efc08cebab8c50c0f0eb2d3a2d2e560872a64f6c1617314c4f03b1c3d4dfa", - "external_id": "03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4" - }, - "ip": "13.57.97.131", - "user_agent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion" - }, - "partner_name": "RudderStack" - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {}, - "userId": "" - }, - "statusCode": 200 - } - ] - } - } - }, - { - "name": "tiktok_ads", - "description": "Test 7", - "feature": "processor", - "module": "destination", - "version": "v0", - "input": { - "request": { - "body": [ - { - "message": { - "anonymousId": "21e13f4bc7ceddad", - "channel": "web", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.0.0" - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.0.0" - }, - "userAgent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", - "locale": "en-US", - "ip": "13.57.97.131", - "os": { - "name": "", - "version": "" - }, - "screen": { - "density": 2 - }, - "externalId": [ - { - "type": "tiktokExternalId", - "id": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" - } - ] - }, - "messageId": "84e26acc-56a5-4835-8233-591137fca468", - "session_id": "3049dc4c-5a95-4ccd-a3e7-d74a7e411f22", - "originalTimestamp": "2019-10-14T09:03:17.562Z", - "timestamp": "2020-09-17T19:49:27Z", - "type": "track", - "event": "payment info entered", - "properties": { - "eventId": "1616318632825_357", - "context": { - "ad": { - "callback": "123ATXSfe" - }, - "page": { - "url": "http://demo.mywebsite.com/purchase", - "referrer": "http://demo.mywebsite.com" - }, - "user": { - "phone_number": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", - "email": "dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f" - } - }, - "contents": [ - { - "price": 8, - "quantity": 2, - "content_type": "socks", - "content_id": "1077218" - }, - { - "price": 30, - "quantity": 1, - "content_type": "dress", - "content_id": "1197218" - } - ], - "currency": "USD", - "value": 46 - }, - "integrations": { - "All": true - }, - "sentAt": "2019-10-14T09:03:22.563Z" - }, - "destination": { - "Config": { - "accessToken": "dummyAccessToken", - "pixelCode": "A1T8T4UYGVIQA8ORZMX9", - "hashUserProperties": false - } - } - } - ] - } - }, - "output": { - "response": { - "status": 200, - "body": [ - { - "output": { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://business-api.tiktok.com/open_api/v1.3/pixel/track/", - "headers": { - "Access-Token": "dummyAccessToken", - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "pixel_code": "A1T8T4UYGVIQA8ORZMX9", - "event": "AddPaymentInfo", - "event_id": "1616318632825_357", - "timestamp": "2020-09-17T19:49:27Z", - "properties": { - "contents": [ - { - "price": 8, - "quantity": 2, - "content_type": "socks", - "content_id": "1077218" - }, - { - "price": 30, - "quantity": 1, - "content_type": "dress", - "content_id": "1197218" - } - ], - "currency": "USD", - "value": 46 - }, - "context": { - "ad": { - "callback": "123ATXSfe" - }, - "page": { - "url": "http://demo.mywebsite.com/purchase", - "referrer": "http://demo.mywebsite.com" - }, - "user": { - "phone_number": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", - "email": "dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f", - "external_id": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" - }, - "ip": "13.57.97.131", - "user_agent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion" - }, - "partner_name": "RudderStack" - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {}, - "userId": "" - }, - "statusCode": 200 - } - ] - } - } - }, - { - "name": "tiktok_ads", - "description": "Test 8", - "feature": "processor", - "module": "destination", - "version": "v0", - "input": { - "request": { - "body": [ - { - "message": { - "anonymousId": "21e13f4bc7ceddad", - "channel": "web", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.0.0" - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.0.0" - }, - "userAgent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", - "locale": "en-US", - "ip": "13.57.97.131", - "os": { - "name": "", - "version": "" - }, - "screen": { - "density": 2 - }, - "externalId": [ - { - "type": "tiktokExternalId", - "id": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" - } - ] - }, - "messageId": "84e26acc-56a5-4835-8233-591137fca468", - "session_id": "3049dc4c-5a95-4ccd-a3e7-d74a7e411f22", - "originalTimestamp": "2019-10-14T09:03:17.562Z", - "timestamp": "2020-09-17T19:49:27Z", - "type": "track", - "properties": { - "eventId": "1616318632825_357", - "context": { - "ad": { - "callback": "123ATXSfe" - }, - "page": { - "url": "http://demo.mywebsite.com/purchase", - "referrer": "http://demo.mywebsite.com" - }, - "user": { - "phone_number": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", - "email": "dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f" - } - }, - "contents": [ - { - "price": 8, - "quantity": 2, - "content_type": "socks", - "content_id": "1077218" - }, - { - "price": 30, - "quantity": 1, - "content_type": "dress", - "content_id": "1197218" - } - ], - "currency": "USD", - "value": 46 - }, - "integrations": { - "All": true - }, - "sentAt": "2019-10-14T09:03:22.563Z" - }, - "destination": { - "Config": { - "accessToken": "dummyAccessToken", - "pixelCode": "A1T8T4UYGVIQA8ORZMX9", - "hashUserProperties": false - } - } - } - ] - } - }, - "output": { - "response": { - "status": 200, - "body": [ - { - "statusCode": 400, - "error": "Event name is required", - "statTags": { - "errorCategory": "dataValidation", - "errorType": "instrumentation", - "destType": "TIKTOK_ADS", - "module": "destination", - "implementation": "native", - "feature": "processor" - } - } - ] - } - } - }, - { - "name": "tiktok_ads", - "description": "Test 9", - "feature": "processor", - "module": "destination", - "version": "v0", - "input": { - "request": { - "body": [ - { - "message": { - "anonymousId": "21e13f4bc7ceddad", - "channel": "web", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.0.0" - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.0.0" - }, - "userAgent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", - "locale": "en-US", - "ip": "13.57.97.131", - "os": { - "name": "", - "version": "" - }, - "screen": { - "density": 2 - }, - "externalId": [ - { - "type": "tiktokExternalId", - "id": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" - } - ] - }, - "messageId": "84e26acc-56a5-4835-8233-591137fca468", - "session_id": "3049dc4c-5a95-4ccd-a3e7-d74a7e411f22", - "originalTimestamp": "2019-10-14T09:03:17.562Z", - "timestamp": "2020-09-17T19:49:27Z", - "properties": { - "eventId": "1616318632825_357", - "context": { - "ad": { - "callback": "123ATXSfe" - }, - "page": { - "url": "http://demo.mywebsite.com/purchase", - "referrer": "http://demo.mywebsite.com" - }, - "user": { - "phone_number": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", - "email": "dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f" - } - }, - "contents": [ - { - "price": 8, - "quantity": 2, - "content_type": "socks", - "content_id": "1077218" - }, - { - "price": 30, - "quantity": 1, - "content_type": "dress", - "content_id": "1197218" - } - ], - "currency": "USD", - "value": 46 - }, - "integrations": { - "All": true - }, - "sentAt": "2019-10-14T09:03:22.563Z" - }, - "destination": { - "Config": { - "accessToken": "dummyAccessToken", - "pixelCode": "A1T8T4UYGVIQA8ORZMX9", - "hashUserProperties": false - } - } - } - ] - } - }, - "output": { - "response": { - "status": 200, - "body": [ - { - "statusCode": 400, - "error": "Event type is required", - "statTags": { - "errorCategory": "dataValidation", - "errorType": "instrumentation", - "destType": "TIKTOK_ADS", - "module": "destination", - "implementation": "native", - "feature": "processor" - } - } - ] - } - } - }, - { - "name": "tiktok_ads", - "description": "Test 10", - "feature": "processor", - "module": "destination", - "version": "v0", - "input": { - "request": { - "body": [ - { - "message": { - "anonymousId": "21e13f4bc7ceddad", - "channel": "web", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.0.0" - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.0.0" - }, - "userAgent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", - "locale": "en-US", - "ip": "13.57.97.131", - "os": { - "name": "", - "version": "" - }, - "screen": { - "density": 2 - }, - "externalId": [ - { - "type": "tiktokExternalId", - "id": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" - } - ] - }, - "messageId": "84e26acc-56a5-4835-8233-591137fca468", - "session_id": "3049dc4c-5a95-4ccd-a3e7-d74a7e411f22", - "originalTimestamp": "2019-10-14T09:03:17.562Z", - "type": "track", - "event": "payment info entered", - "properties": { - "eventId": "1616318632825_357", - "context": { - "ad": { - "callback": "123ATXSfe" - }, - "page": { - "url": "http://demo.mywebsite.com/purchase", - "referrer": "http://demo.mywebsite.com" - }, - "user": { - "phone_number": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", - "email": "dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f" - } - }, - "contents": [ - { - "price": 8, - "quantity": 2, - "content_type": "socks", - "content_id": "1077218" - }, - { - "price": 30, - "quantity": 1, - "content_type": "dress", - "content_id": "1197218" - } - ], - "currency": "USD", - "value": 46 - }, - "integrations": { - "All": true - }, - "sentAt": "2019-10-14T09:03:22.563Z" - }, - "destination": { - "Config": { - "accessToken": "dummyAccessToken", - "pixelCode": "A1T8T4UYGVIQA8ORZMX9", - "hashUserProperties": false - } - } - } - ] - } - }, - "output": { - "response": { - "status": 200, - "body": [ - { - "output": { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://business-api.tiktok.com/open_api/v1.3/pixel/track/", - "headers": { - "Access-Token": "dummyAccessToken", - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "pixel_code": "A1T8T4UYGVIQA8ORZMX9", - "event": "AddPaymentInfo", - "event_id": "1616318632825_357", - "properties": { - "contents": [ - { - "price": 8, - "quantity": 2, - "content_type": "socks", - "content_id": "1077218" - }, - { - "price": 30, - "quantity": 1, - "content_type": "dress", - "content_id": "1197218" - } - ], - "currency": "USD", - "value": 46 - }, - "context": { - "ad": { - "callback": "123ATXSfe" - }, - "page": { - "url": "http://demo.mywebsite.com/purchase", - "referrer": "http://demo.mywebsite.com" - }, - "user": { - "phone_number": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", - "email": "dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f", - "external_id": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" - }, - "ip": "13.57.97.131", - "user_agent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion" - }, - "partner_name": "RudderStack" - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {}, - "userId": "" - }, - "statusCode": 200 - } - ] - } - } - }, - { - "name": "tiktok_ads", - "description": "Test 11", - "feature": "processor", - "module": "destination", - "version": "v0", - "input": { - "request": { - "body": [ - { - "message": { - "anonymousId": "21e13f4bc7ceddad", - "channel": "web", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.0.0" - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.0.0" - }, - "userAgent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", - "locale": "en-US", - "ip": "13.57.97.131", - "os": { - "name": "", - "version": "" - }, - "screen": { - "density": 2 - }, - "externalId": [ - { - "type": "tiktokExternalId", - "id": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" - } - ] - }, - "messageId": "84e26acc-56a5-4835-8233-591137fca468", - "session_id": "3049dc4c-5a95-4ccd-a3e7-d74a7e411f22", - "originalTimestamp": "2019-10-14T09:03:17.562Z", - "timestamp": "2020-09-17T19:49:27Z", - "type": "track", - "event": "submitform", - "properties": { - "eventId": "16163186328257", - "context": { - "ad": { - "callback": "123ATXSfe" - }, - "page": { - "url": "http://demo.mywebsite.com/purchase", - "referrer": "http://demo.mywebsite.com" - }, - "user": { - "phone_number": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", - "email": "dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f" - } - }, - "contents": [ - { - "price": 8, - "quantity": 2, - "content_type": "socks", - "content_id": "1077218" - }, - { - "price": 30, - "quantity": 1, - "content_type": "dress", - "content_id": "1197218" - } - ], - "currency": "USD", - "value": 46 - }, - "integrations": { - "All": true - }, - "sentAt": "2019-10-14T09:03:22.563Z" - }, - "destination": { - "Config": { - "accessToken": "dummyAccessToken", - "pixelCode": "A1T8T4UYGVIQA8ORZMX9", - "hashUserProperties": false - } - } - } - ] - } - }, - "output": { - "response": { - "status": 200, - "body": [ - { - "output": { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://business-api.tiktok.com/open_api/v1.3/pixel/track/", - "headers": { - "Access-Token": "dummyAccessToken", - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "pixel_code": "A1T8T4UYGVIQA8ORZMX9", - "event": "SubmitForm", - "event_id": "16163186328257", - "timestamp": "2020-09-17T19:49:27Z", - "properties": { - "contents": [ - { - "price": 8, - "quantity": 2, - "content_type": "socks", - "content_id": "1077218" - }, - { - "price": 30, - "quantity": 1, - "content_type": "dress", - "content_id": "1197218" - } - ], - "currency": "USD", - "value": 46 - }, - "context": { - "ad": { - "callback": "123ATXSfe" - }, - "page": { - "url": "http://demo.mywebsite.com/purchase", - "referrer": "http://demo.mywebsite.com" - }, - "user": { - "phone_number": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", - "email": "dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f", - "external_id": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" - }, - "ip": "13.57.97.131", - "user_agent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion" - }, - "partner_name": "RudderStack" - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {}, - "userId": "" - }, - "statusCode": 200 - } - ] - } - } - }, - { - "name": "tiktok_ads", - "description": "Test 12", - "feature": "processor", - "module": "destination", - "version": "v0", - "input": { - "request": { - "body": [ - { - "message": { - "anonymousId": "21e13f4bc7ceddad", - "channel": "web", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.0.0" - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.0.0" - }, - "userAgent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", - "locale": "en-US", - "ip": "13.57.97.131", - "os": { - "name": "", - "version": "" - }, - "screen": { - "density": 2 - }, - "externalId": [ - { - "type": "tiktokExternalId", - "id": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" - } - ] - }, - "messageId": "84e26acc-56a5-4835-8233-591137fca468", - "session_id": "3049dc4c-5a95-4ccd-a3e7-d74a7e411f22", - "originalTimestamp": "2019-10-14T09:03:17.562Z", - "timestamp": "2020-09-17T19:49:27Z", - "type": "track", - "event": "submitform", - "properties": { - "eventId": "16163186328257", - "context": { - "ad": { - "callback": "123ATXSfe" - }, - "page": { - "url": "http://demo.mywebsite.com/purchase", - "referrer": "http://demo.mywebsite.com" - }, - "user": { - "phone_number": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", - "email": "dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f" - }, - "userAgent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", - "ip": "13.57.97.131" - } - }, - "integrations": { - "All": true - }, - "sentAt": "2019-10-14T09:03:22.563Z" - }, - "destination": { - "Config": { - "accessToken": "dummyAccessToken", - "pixelCode": "A1T8T4UYGVIQA8ORZMX9", - "hashUserProperties": false - } - } - } - ] - } - }, - "output": { - "response": { - "status": 200, - "body": [ - { - "output": { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://business-api.tiktok.com/open_api/v1.3/pixel/track/", - "headers": { - "Access-Token": "dummyAccessToken", - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "pixel_code": "A1T8T4UYGVIQA8ORZMX9", - "event": "SubmitForm", - "event_id": "16163186328257", - "timestamp": "2020-09-17T19:49:27Z", - "context": { - "ad": { - "callback": "123ATXSfe" - }, - "page": { - "url": "http://demo.mywebsite.com/purchase", - "referrer": "http://demo.mywebsite.com" - }, - "user": { - "phone_number": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", - "email": "dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f", - "external_id": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" - }, - "ip": "13.57.97.131", - "user_agent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion" - }, - "partner_name": "RudderStack" - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {}, - "userId": "" - }, - "statusCode": 200 - } - ] - } - } - }, - { - "name": "tiktok_ads", - "description": "Test 13", - "feature": "processor", - "module": "destination", - "version": "v0", - "input": { - "request": { - "body": [ - { - "message": { - "anonymousId": "21e13f4bc7ceddad", - "channel": "web", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.0.0" - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.0.0" - }, - "userAgent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", - "locale": "en-US", - "ip": "13.57.97.131", - "os": { - "name": "", - "version": "" - }, - "screen": { - "density": 2 - }, - "externalId": [ - { - "type": "tiktokExternalId", - "id": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" - } - ] - }, - "messageId": "84e26acc-56a5-4835-8233-591137fca468", - "session_id": "3049dc4c-5a95-4ccd-a3e7-d74a7e411f22", - "originalTimestamp": "2019-10-14T09:03:17.562Z", - "timestamp": "2020-09-17T19:49:27Z", - "type": "track", - "event": "contact", - "properties": { - "eventId": "16163186328257", - "context": { - "ad": { - "callback": "123ATXSfe" - }, - "page": { - "url": "http://demo.mywebsite.com/purchase", - "referrer": "http://demo.mywebsite.com" - }, - "user": { - "phone_number": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", - "email": "dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f" - } - }, - "contents": [ - { - "price": 8, - "quantity": 2, - "content_type": "socks", - "content_id": "1077218" - }, - { - "price": 30, - "quantity": 1, - "content_type": "dress", - "content_id": "1197218" - } - ], - "currency": "USD", - "value": 46 - }, - "integrations": { - "All": true - }, - "sentAt": "2019-10-14T09:03:22.563Z" - }, - "destination": { - "Config": { - "accessToken": "dummyAccessToken", - "pixelCode": "A1T8T4UYGVIQA8ORZMX9", - "hashUserProperties": false - } - } - } - ] - } - }, - "output": { - "response": { - "status": 200, - "body": [ - { - "output": { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://business-api.tiktok.com/open_api/v1.3/pixel/track/", - "headers": { - "Access-Token": "dummyAccessToken", - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "pixel_code": "A1T8T4UYGVIQA8ORZMX9", - "event": "Contact", - "event_id": "16163186328257", - "timestamp": "2020-09-17T19:49:27Z", - "properties": { - "contents": [ - { - "price": 8, - "quantity": 2, - "content_type": "socks", - "content_id": "1077218" - }, - { - "price": 30, - "quantity": 1, - "content_type": "dress", - "content_id": "1197218" - } - ], - "currency": "USD", - "value": 46 - }, - "context": { - "ad": { - "callback": "123ATXSfe" - }, - "page": { - "url": "http://demo.mywebsite.com/purchase", - "referrer": "http://demo.mywebsite.com" - }, - "user": { - "phone_number": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", - "email": "dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f", - "external_id": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" - }, - "ip": "13.57.97.131", - "user_agent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion" - }, - "partner_name": "RudderStack" - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {}, - "userId": "" - }, - "statusCode": 200 - } - ] - } - } - }, - { - "name": "tiktok_ads", - "description": "Test 14", - "feature": "processor", - "module": "destination", - "version": "v0", - "input": { - "request": { - "body": [ - { - "message": { - "anonymousId": "21e13f4bc7ceddad", - "channel": "web", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.0.0" - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.0.0" - }, - "userAgent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", - "locale": "en-US", - "ip": "13.57.97.131", - "os": { - "name": "", - "version": "" - }, - "screen": { - "density": 2 - }, - "externalId": [ - { - "type": "tiktokExternalId", - "id": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" - } - ] - }, - "messageId": "84e26acc-56a5-4835-8233-591137fca468", - "session_id": "3049dc4c-5a95-4ccd-a3e7-d74a7e411f22", - "originalTimestamp": "2019-10-14T09:03:17.562Z", - "timestamp": "2020-09-17T19:49:27Z", - "type": "identify", - "event": "contact", - "properties": { - "eventId": "16163186328257", - "context": { - "ad": { - "callback": "123ATXSfe" - }, - "page": { - "url": "http://demo.mywebsite.com/purchase", - "referrer": "http://demo.mywebsite.com" - }, - "user": { - "phone_number": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", - "email": "dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f" - } - }, - "contents": [ - { - "price": 8, - "quantity": 2, - "content_type": "socks", - "content_id": "1077218" - }, - { - "price": 30, - "quantity": 1, - "content_type": "dress", - "content_id": "1197218" - } - ], - "currency": "USD", - "value": 46 - }, - "integrations": { - "All": true - }, - "sentAt": "2019-10-14T09:03:22.563Z" - }, - "destination": { - "Config": { - "accessToken": "dummyAccessToken", - "pixelCode": "A1T8T4UYGVIQA8ORZMX9", - "hashUserProperties": false - } - } - } - ] - } - }, - "output": { - "response": { - "status": 200, - "body": [ - { - "statusCode": 400, - "error": "Event type identify is not supported", - "statTags": { - "errorCategory": "dataValidation", - "errorType": "instrumentation", - "destType": "TIKTOK_ADS", - "module": "destination", - "implementation": "native", - "feature": "processor" - } - } - ] - } - } - }, - { - "name": "tiktok_ads", - "description": "Test 15", - "feature": "processor", - "module": "destination", - "version": "v0", - "input": { - "request": { - "body": [ - { - "message": { - "anonymousId": "21e13f4bc7ceddad", - "channel": "web", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.0.0" - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.0.0" - }, - "userAgent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", - "locale": "en-US", - "ip": "13.57.97.131", - "os": { - "name": "", - "version": "" - }, - "screen": { - "density": 2 - }, - "externalId": [ - { - "type": "tiktokExternalId", - "id": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" - } - ] - }, - "messageId": "84e26acc-56a5-4835-8233-591137fca468", - "session_id": "3049dc4c-5a95-4ccd-a3e7-d74a7e411f22", - "originalTimestamp": "2019-10-14T09:03:17.562Z", - "timestamp": "2020-09-17T19:49:27Z", - "type": "track", - "event": "checkout step completed", - "properties": { - "eventId": "1616318632825_357", - "context": { - "ad": { - "callback": "123ATXSfe" - }, - "page": { - "url": "http://demo.mywebsite.com/purchase", - "referrer": "http://demo.mywebsite.com" - }, - "user": { - "phone_number": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", - "email": "dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f" - } - }, - "contents": [ - { - "price": 8, - "quantity": 2, - "content_type": "socks", - "content_id": "1077218" - }, - { - "price": 30, - "quantity": 1, - "content_type": "dress", - "content_id": "1197218" - } - ], - "currency": "USD", - "value": 46 - }, - "integrations": { - "All": true - }, - "sentAt": "2019-10-14T09:03:22.563Z" - }, - "destination": { - "Config": { - "accessToken": "dummyAccessToken", - "pixelCode": "A1T8T4UYGVIQA8ORZMX9", - "hashUserProperties": false - } - } - } - ] - } - }, - "output": { - "response": { - "status": 200, - "body": [ - { - "output": { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://business-api.tiktok.com/open_api/v1.3/pixel/track/", - "headers": { - "Access-Token": "dummyAccessToken", - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "pixel_code": "A1T8T4UYGVIQA8ORZMX9", - "event": "CompletePayment", - "event_id": "1616318632825_357", - "timestamp": "2020-09-17T19:49:27Z", - "properties": { - "contents": [ - { - "price": 8, - "quantity": 2, - "content_type": "socks", - "content_id": "1077218" - }, - { - "price": 30, - "quantity": 1, - "content_type": "dress", - "content_id": "1197218" - } - ], - "currency": "USD", - "value": 46 - }, - "context": { - "ad": { - "callback": "123ATXSfe" - }, - "page": { - "url": "http://demo.mywebsite.com/purchase", - "referrer": "http://demo.mywebsite.com" - }, - "user": { - "phone_number": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", - "email": "dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f", - "external_id": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" - }, - "ip": "13.57.97.131", - "user_agent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion" - }, - "partner_name": "RudderStack" - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {}, - "userId": "" - }, - "statusCode": 200 - } - ] - } - } - }, - { - "name": "tiktok_ads", - "description": "Test 16", - "feature": "processor", - "module": "destination", - "version": "v0", - "input": { - "request": { - "body": [ - { - "message": { - "anonymousId": "21e13f4bc7ceddad", - "channel": "web", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.0.0" - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.0.0" - }, - "userAgent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", - "locale": "en-US", - "ip": "13.57.97.131", - "os": { - "name": "", - "version": "" - }, - "screen": { - "density": 2 - }, - "externalId": [ - { - "type": "tiktokExternalId", - "id": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" - } - ] - }, - "messageId": "84e26acc-56a5-4835-8233-591137fca468", - "session_id": "3049dc4c-5a95-4ccd-a3e7-d74a7e411f22", - "originalTimestamp": "2019-10-14T09:03:17.562Z", - "timestamp": "2020-09-17T19:49:27Z", - "type": "track", - "event": "order completed", - "properties": { - "eventId": "1616318632825_357", - "context": { - "ad": { - "callback": "123ATXSfe" - }, - "page": { - "url": "http://demo.mywebsite.com/purchase", - "referrer": "http://demo.mywebsite.com" - }, - "user": { - "phone_number": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", - "email": "dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f" - } - }, - "contents": [ - { - "price": 8, - "quantity": 2, - "content_type": "socks", - "content_id": "1077218" - }, - { - "price": 30, - "quantity": 1, - "content_type": "dress", - "content_id": "1197218" - } - ], - "currency": "USD", - "value": 46 - }, - "integrations": { - "All": true - }, - "sentAt": "2019-10-14T09:03:22.563Z" - }, - "destination": { - "Config": { - "accessToken": "dummyAccessToken", - "pixelCode": "A1T8T4UYGVIQA8ORZMX9", - "hashUserProperties": false - } - } - } - ] - } - }, - "output": { - "response": { - "status": 200, - "body": [ - { - "output": { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://business-api.tiktok.com/open_api/v1.3/pixel/track/", - "headers": { - "Access-Token": "dummyAccessToken", - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "pixel_code": "A1T8T4UYGVIQA8ORZMX9", - "event": "PlaceAnOrder", - "event_id": "1616318632825_357", - "timestamp": "2020-09-17T19:49:27Z", - "properties": { - "contents": [ - { - "price": 8, - "quantity": 2, - "content_type": "socks", - "content_id": "1077218" - }, - { - "price": 30, - "quantity": 1, - "content_type": "dress", - "content_id": "1197218" - } - ], - "currency": "USD", - "value": 46 - }, - "context": { - "ad": { - "callback": "123ATXSfe" - }, - "page": { - "url": "http://demo.mywebsite.com/purchase", - "referrer": "http://demo.mywebsite.com" - }, - "user": { - "phone_number": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", - "email": "dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f", - "external_id": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" - }, - "ip": "13.57.97.131", - "user_agent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion" - }, - "partner_name": "RudderStack" - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {}, - "userId": "" - }, - "statusCode": 200 - } - ] - } - } - }, - { - "name": "tiktok_ads", - "description": "Test 17", - "feature": "processor", - "module": "destination", - "version": "v0", - "input": { - "request": { - "body": [ - { - "message": { - "anonymousId": "21e13f4bc7ceddad", - "channel": "web", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.0.0" - }, - "traits": { - "email": "user@sample.com", - "phone": "+919912345678" - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.0.0" - }, - "userAgent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", - "locale": "en-US", - "ip": "13.57.97.131", - "os": { - "name": "", - "version": "" - }, - "screen": { - "density": 2 - }, - "externalId": [ - { - "type": "tiktokExternalId", - "id": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" - } - ] - }, - "messageId": "84e26acc-56a5-4835-8233-591137fca468", - "session_id": "3049dc4c-5a95-4ccd-a3e7-d74a7e411f22", - "originalTimestamp": "2019-10-14T09:03:17.562Z", - "timestamp": "2020-09-17T19:49:27Z", - "type": "track", - "event": "SubscriBe", - "properties": { - "eventId": "1616318632825_357", - "testEventCode": "TEST0000000011", - "context": { - "ad": { - "callback": "123ATXSfe" - }, - "page": { - "url": "http://demo.mywebsite.com/purchase", - "referrer": "http://demo.mywebsite.com" - }, - "user": { - "phone_number": "+918987674657", - "email": "sample@rudder.com" - } - }, - "contents": [ - { - "price": 8, - "quantity": 2, - "content_type": "socks", - "content_id": "1077218" - }, - { - "price": 30, - "quantity": 1, - "content_type": "dress", - "content_id": "1197218" - } - ], - "currency": "USD", - "value": 46 - }, - "integrations": { - "All": true - }, - "sentAt": "2019-10-14T09:03:22.563Z" - }, - "destination": { - "Config": { - "accessToken": "dummyAccessToken", - "pixelCode": "A1T8T4UYGVIQA8ORZMX9", - "hashUserProperties": true - } - } - } - ] - } - }, - "output": { - "response": { - "status": 200, - "body": [ - { - "output": { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://business-api.tiktok.com/open_api/v1.3/pixel/track/", - "headers": { - "Access-Token": "dummyAccessToken", - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "pixel_code": "A1T8T4UYGVIQA8ORZMX9", - "event": "Subscribe", - "event_id": "1616318632825_357", - "timestamp": "2020-09-17T19:49:27Z", - "test_event_code": "TEST0000000011", - "properties": { - "contents": [ - { - "price": 8, - "quantity": 2, - "content_type": "socks", - "content_id": "1077218" - }, - { - "price": 30, - "quantity": 1, - "content_type": "dress", - "content_id": "1197218" - } - ], - "currency": "USD", - "value": 46 - }, - "context": { - "ad": { - "callback": "123ATXSfe" - }, - "page": { - "url": "http://demo.mywebsite.com/purchase", - "referrer": "http://demo.mywebsite.com" - }, - "user": { - "phone_number": "1b6abcebb79b2208929967160ba291656f3fcd4f00e93b6a846c1e56c0e177c6", - "email": "02e47a94635c1ffd6f6a69fe2c7a92dbfbb9d5e2ebddb54810520b34989b66a7", - "external_id": "f0f3ec74bbef8580d7de80624dea93c05d828c748715199fe71bc7f5a67aa8b3" - }, - "ip": "13.57.97.131", - "user_agent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion" - }, - "partner_name": "RudderStack" - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {}, - "userId": "" - }, - "statusCode": 200 - } - ] - } - } - }, - { - "name": "tiktok_ads", - "description": "Test 18", - "feature": "processor", - "module": "destination", - "version": "v0", - "input": { - "request": { - "body": [ - { - "message": { - "anonymousId": "21e13f4bc7ceddad", - "channel": "web", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.0.0" - }, - "traits": { - "email": "user@sample.com", - "phone": "+919912345678" - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.0.0" - }, - "userAgent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", - "locale": "en-US", - "ip": "13.57.97.131", - "os": { - "name": "", - "version": "" - }, - "screen": { - "density": 2 - }, - "externalId": [ - { - "type": "tiktokExternalId", - "id": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" - } - ] - }, - "messageId": "84e26acc-56a5-4835-8233-591137fca468", - "session_id": "3049dc4c-5a95-4ccd-a3e7-d74a7e411f22", - "originalTimestamp": "2019-10-14T09:03:17.562Z", - "timestamp": "2020-09-17T19:49:27Z", - "type": "track", - "event": "SubscriBe", - "properties": { - "eventId": "1616318632825_357", - "testEventCode": "TEST0000000011", - "context": { - "ad": { - "callback": "123ATXSfe" - }, - "page": { - "url": "http://demo.mywebsite.com/purchase", - "referrer": "http://demo.mywebsite.com" - }, - "user": { - "phone_number": "", - "email": "" - } - }, - "contents": [ - { - "price": 8, - "quantity": 2, - "content_type": "socks", - "content_id": "1077218" - }, - { - "price": 30, - "quantity": 1, - "content_type": "dress", - "content_id": "1197218" - } - ], - "currency": "USD", - "value": 46 - }, - "integrations": { - "All": true - }, - "sentAt": "2019-10-14T09:03:22.563Z" - }, - "destination": { - "Config": { - "accessToken": "dummyAccessToken", - "pixelCode": "A1T8T4UYGVIQA8ORZMX9", - "hashUserProperties": true - } - } - } - ] - } - }, - "output": { - "response": { - "status": 200, - "body": [ - { - "output": { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://business-api.tiktok.com/open_api/v1.3/pixel/track/", - "headers": { - "Access-Token": "dummyAccessToken", - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "pixel_code": "A1T8T4UYGVIQA8ORZMX9", - "event": "Subscribe", - "event_id": "1616318632825_357", - "timestamp": "2020-09-17T19:49:27Z", - "test_event_code": "TEST0000000011", - "properties": { - "contents": [ - { - "price": 8, - "quantity": 2, - "content_type": "socks", - "content_id": "1077218" - }, - { - "price": 30, - "quantity": 1, - "content_type": "dress", - "content_id": "1197218" - } - ], - "currency": "USD", - "value": 46 - }, - "context": { - "ad": { - "callback": "123ATXSfe" - }, - "page": { - "url": "http://demo.mywebsite.com/purchase", - "referrer": "http://demo.mywebsite.com" - }, - "user": { - "phone_number": "241102c24fa8a642e3d1346a31fbce3dd312563c015ae577a2253cb8652581eb", - "email": "a344da1fac6201ed1c1f20a07e1b55bb896a5ac0abd269c1e9daf1afbbffca3b", - "external_id": "f0f3ec74bbef8580d7de80624dea93c05d828c748715199fe71bc7f5a67aa8b3" - }, - "ip": "13.57.97.131", - "user_agent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion" - }, - "partner_name": "RudderStack" - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {}, - "userId": "" - }, - "statusCode": 200 - } - ] - } - } - }, - { - "name": "tiktok_ads", - "description": "Test 19", - "feature": "processor", - "module": "destination", - "version": "v0", - "input": { - "request": { - "body": [ - { - "message": { - "anonymousId": "21e13f4bc7ceddad", - "channel": "web", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.0.0" - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.0.0" - }, - "userAgent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", - "ip": "13.57.97.131", - "locale": "en-US", - "os": { - "name": "", - "version": "" - }, - "screen": { - "density": 2 - }, - "ad": { - "callback": "999ATXSfe" - }, - "page": { - "url": "http://rudder.mywebsite.com/purchase", - "referrer": "http://rudder.mywebsite.com" - }, - "externalId": [ - { - "type": "tiktokExternalId", - "id": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" - } - ] - }, - "messageId": "84e26acc-56a5-4835-8233-591137fca468", - "session_id": "3049dc4c-5a95-4ccd-a3e7-d74a7e411f22", - "originalTimestamp": "2019-10-14T09:03:17.562Z", - "timestamp": "2020-09-17T19:49:27Z", - "type": "track", - "event": "checkout step completed", - "properties": { - "eventId": "1616318632825_357", - "contents": [ - { - "price": 8, - "quantity": 2, - "content_type": "socks", - "content_id": "1077218" - }, - { - "price": 30, - "quantity": 1, - "content_type": "dress", - "content_id": "1197218" - } - ], - "currency": "USD", - "value": 46, - "context": { - "user": { - "phone_number": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", - "email": "dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f" - } - } - }, - "integrations": { - "All": true - }, - "sentAt": "2019-10-14T09:03:22.563Z" - }, - "destination": { - "Config": { - "accessToken": "dummyAccessToken", - "pixelCode": "A1T8T4UYGVIQA8ORZMX9", - "hashUserProperties": false - } - } - } - ] - } - }, - "output": { - "response": { - "status": 200, - "body": [ - { - "output": { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://business-api.tiktok.com/open_api/v1.3/pixel/track/", - "headers": { - "Access-Token": "dummyAccessToken", - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "pixel_code": "A1T8T4UYGVIQA8ORZMX9", - "event": "CompletePayment", - "event_id": "1616318632825_357", - "timestamp": "2020-09-17T19:49:27Z", - "properties": { - "contents": [ - { - "price": 8, - "quantity": 2, - "content_type": "socks", - "content_id": "1077218" - }, - { - "price": 30, - "quantity": 1, - "content_type": "dress", - "content_id": "1197218" - } - ], - "currency": "USD", - "value": 46 - }, - "context": { - "ad": { - "callback": "999ATXSfe" - }, - "page": { - "url": "http://rudder.mywebsite.com/purchase", - "referrer": "http://rudder.mywebsite.com" - }, - "user": { - "phone_number": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", - "email": "dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f", - "external_id": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" - }, - "ip": "13.57.97.131", - "user_agent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion" - }, - "partner_name": "RudderStack" - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {}, - "userId": "" - }, - "statusCode": 200 - } - ] - } - } - }, - { - "name": "tiktok_ads", - "description": "Test 20", - "feature": "processor", - "module": "destination", - "version": "v0", - "input": { - "request": { - "body": [ - { - "message": { - "anonymousId": "21e13f4bc7ceddad", - "channel": "web", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.0.0" - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.0.0" - }, - "userAgent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", - "ip": "13.57.97.131", - "locale": "en-US", - "os": { - "name": "", - "version": "" - }, - "screen": { - "density": 2 - }, - "externalId": [ - { - "type": "tiktokExternalId", - "id": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" - } - ] - }, - "messageId": "84e26acc-56a5-4835-8233-591137fca468", - "session_id": "3049dc4c-5a95-4ccd-a3e7-d74a7e411f22", - "originalTimestamp": "2019-10-14T09:03:17.562Z", - "timestamp": "2020-09-17T19:49:27Z", - "type": "track", - "event": "abc", - "properties": { - "eventId": "1616318632825_357", - "contents": [ - { - "price": 8, - "quantity": 2, - "content_type": "socks", - "content_id": "1077218" - }, - { - "price": 30, - "quantity": 1, - "content_type": "dress", - "content_id": "1197218" - } - ], - "currency": "USD", - "value": 46, - "context": { - "ad": { - "callback": "123ATXSfe" - }, - "page": { - "url": "http://demo.mywebsite.com/purchase", - "referrer": "http://demo.mywebsite.com" - }, - "user": { - "phone_number": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", - "email": "dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f" - } - } - }, - "integrations": { - "All": true - }, - "sentAt": "2019-10-14T09:03:22.563Z" - }, - "destination": { - "Config": { - "accessToken": "dummyAccessToken", - "pixelCode": "A1T8T4UYGVIQA8ORZMX9", - "hashUserProperties": false, - "eventsToStandard": [ - { - "from": "abc", - "to": "download" - }, - { - "from": "abc", - "to": "search" - }, - { - "from": "def", - "to": "search" - } - ] - } - } - } - ] - } - }, - "output": { - "response": { - "status": 200, - "body": [ - { - "output": { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://business-api.tiktok.com/open_api/v1.3/pixel/track/", - "headers": { - "Access-Token": "dummyAccessToken", - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "pixel_code": "A1T8T4UYGVIQA8ORZMX9", - "event": "download", - "event_id": "1616318632825_357", - "timestamp": "2020-09-17T19:49:27Z", - "properties": { - "contents": [ - { - "price": 8, - "quantity": 2, - "content_type": "socks", - "content_id": "1077218" - }, - { - "price": 30, - "quantity": 1, - "content_type": "dress", - "content_id": "1197218" - } - ], - "currency": "USD", - "value": 46 - }, - "context": { - "ad": { - "callback": "123ATXSfe" - }, - "page": { - "url": "http://demo.mywebsite.com/purchase", - "referrer": "http://demo.mywebsite.com" - }, - "user": { - "phone_number": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", - "email": "dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f", - "external_id": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" - }, - "ip": "13.57.97.131", - "user_agent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion" - }, - "partner_name": "RudderStack" - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {}, - "userId": "" - }, - "statusCode": 200 - }, - { - "output": { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://business-api.tiktok.com/open_api/v1.3/pixel/track/", - "headers": { - "Access-Token": "dummyAccessToken", - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "pixel_code": "A1T8T4UYGVIQA8ORZMX9", - "event": "search", - "event_id": "1616318632825_357", - "timestamp": "2020-09-17T19:49:27Z", - "properties": { - "contents": [ - { - "price": 8, - "quantity": 2, - "content_type": "socks", - "content_id": "1077218" - }, - { - "price": 30, - "quantity": 1, - "content_type": "dress", - "content_id": "1197218" - } - ], - "currency": "USD", - "value": 46 - }, - "context": { - "ad": { - "callback": "123ATXSfe" - }, - "page": { - "url": "http://demo.mywebsite.com/purchase", - "referrer": "http://demo.mywebsite.com" - }, - "user": { - "phone_number": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", - "email": "dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f", - "external_id": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" - }, - "ip": "13.57.97.131", - "user_agent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion" - }, - "partner_name": "RudderStack" - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {}, - "userId": "" - }, - "statusCode": 200 - } - ] - } - } - }, - { - "name": "tiktok_ads", - "description": "Test 21", - "feature": "processor", - "module": "destination", - "version": "v0", - "input": { - "request": { - "body": [ - { - "message": { - "anonymousId": "21e13f4bc7ceddad", - "channel": "web", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.0.0" - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.0.0" - }, - "userAgent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", - "ip": "13.57.97.131", - "locale": "en-US", - "os": { - "name": "", - "version": "" - }, - "screen": { - "density": 2 - }, - "externalId": [ - { - "type": "tiktokExternalId", - "id": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" - } - ] - }, - "messageId": "84e26acc-56a5-4835-8233-591137fca468", - "session_id": "3049dc4c-5a95-4ccd-a3e7-d74a7e411f22", - "originalTimestamp": "2019-10-14T09:03:17.562Z", - "timestamp": "2020-09-17T19:49:27Z", - "type": "track", - "event": "abc", - "properties": { - "eventId": "1616318632825_357", - "contents": [ - { - "price": 8, - "quantity": 2, - "content_type": "socks", - "content_id": "1077218" - }, - { - "price": 30, - "quantity": 1, - "content_type": "dress", - "content_id": "1197218" - } - ], - "currency": "USD", - "value": 46, - "context": { - "ad": { - "callback": "123ATXSfe" - }, - "page": { - "url": "http://demo.mywebsite.com/purchase", - "referrer": "http://demo.mywebsite.com" - }, - "user": { - "phone_number": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", - "email": "dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f" - } - } - }, - "integrations": { - "All": true - }, - "sentAt": "2019-10-14T09:03:22.563Z" - }, - "destination": { - "Config": { - "accessToken": "dummyAccessToken", - "pixelCode": "A1T8T4UYGVIQA8ORZMX9", - "hashUserProperties": false, - "eventsToStandard": [ - { - "from": "def", - "to": "download" - } - ] - } - } - } - ] - } - }, - "output": { - "response": { - "status": 200, - "body": [ - { - "statusCode": 400, - "error": "Event name (abc) is not valid, must be mapped to one of standard events", - "statTags": { - "errorCategory": "dataValidation", - "errorType": "instrumentation", - "destType": "TIKTOK_ADS", - "module": "destination", - "implementation": "native", - "feature": "processor" - } - } - ] - } - } - }, - { - "name": "tiktok_ads", - "description": "Test 22", - "feature": "processor", - "module": "destination", - "version": "v0", - "input": { - "request": { - "body": [ - { - "message": { - "anonymousId": "21e13f4bc7ceddad", - "channel": "web", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.0.0" - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.0.0" - }, - "userAgent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", - "ip": "13.57.97.131", - "locale": "en-US", - "os": { - "name": "", - "version": "" - }, - "screen": { - "density": 2 - }, - "externalId": [ - { - "type": "tiktokExternalId", - "id": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" - } - ] - }, - "messageId": "84e26acc-56a5-4835-8233-591137fca468", - "session_id": "3049dc4c-5a95-4ccd-a3e7-d74a7e411f22", - "originalTimestamp": "2019-10-14T09:03:17.562Z", - "timestamp": "2020-09-17T19:49:27Z", - "type": "track", - "event": "abc", - "properties": { - "eventId": "1616318632825_357", - "contents": [ - { - "price": 8, - "quantity": 2, - "content_type": "socks", - "content_id": "1077218" - }, - { - "price": 30, - "quantity": 1, - "content_type": "dress", - "content_id": "1197218" - } - ], - "currency": "USD", - "value": 46, - "context": { - "ad": { - "callback": "123ATXSfe" - }, - "page": { - "url": "http://demo.mywebsite.com/purchase", - "referrer": "http://demo.mywebsite.com" - }, - "user": { - "phone_number": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", - "email": "dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f" - } - } - }, - "integrations": { - "All": true - }, - "sentAt": "2019-10-14T09:03:22.563Z" - }, - "destination": { - "Config": { - "accessToken": "dummyAccessToken", - "pixelCode": "A1T8T4UYGVIQA8ORZMX9", - "hashUserProperties": false, - "eventsToStandard": [ - { - "from": "abc", - "to": "download" - }, - { - "from": "def", - "to": "download" - } - ] - } - } - } - ] - } - }, - "output": { - "response": { - "status": 200, - "body": [ - { - "output": { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://business-api.tiktok.com/open_api/v1.3/pixel/track/", - "headers": { - "Access-Token": "dummyAccessToken", - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "pixel_code": "A1T8T4UYGVIQA8ORZMX9", - "event": "download", - "event_id": "1616318632825_357", - "timestamp": "2020-09-17T19:49:27Z", - "properties": { - "contents": [ - { - "price": 8, - "quantity": 2, - "content_type": "socks", - "content_id": "1077218" - }, - { - "price": 30, - "quantity": 1, - "content_type": "dress", - "content_id": "1197218" - } - ], - "currency": "USD", - "value": 46 - }, - "context": { - "ad": { - "callback": "123ATXSfe" - }, - "page": { - "url": "http://demo.mywebsite.com/purchase", - "referrer": "http://demo.mywebsite.com" - }, - "user": { - "phone_number": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", - "email": "dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f", - "external_id": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" - }, - "ip": "13.57.97.131", - "user_agent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion" - }, - "partner_name": "RudderStack" - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {}, - "userId": "" - }, - "statusCode": 200 - } - ] - } - } - }, - { - "name": "tiktok_ads", - "description": "Test 23", - "feature": "processor", - "module": "destination", - "version": "v0", - "input": { - "request": { - "body": [ - { - "message": { - "anonymousId": "21e13f4bc7ceddad", - "channel": "web", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.0.0" - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.0.0" - }, - "userAgent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", - "ip": "13.57.97.131", - "locale": "en-US", - "os": { - "name": "", - "version": "" - }, - "screen": { - "density": 2 - }, - "externalId": [ - { - "type": "tiktokExternalId", - "id": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" - } - ] - }, - "messageId": "84e26acc-56a5-4835-8233-591137fca468", - "session_id": "3049dc4c-5a95-4ccd-a3e7-d74a7e411f22", - "originalTimestamp": "2019-10-14T09:03:17.562Z", - "timestamp": "2020-09-17T19:49:27Z", - "type": "track", - "event": "abc", - "properties": { - "eventId": "1616318632825_357", - "contents": [ - { - "price": 8, - "quantity": 2, - "content_type": "socks", - "content_id": "1077218" - }, - { - "price": 30, - "quantity": 1, - "content_type": "dress", - "content_id": "1197218" - } - ], - "currency": "USD", - "value": 46, - "context": { - "ad": { - "callback": "123ATXSfe" - }, - "page": { - "url": "http://demo.mywebsite.com/purchase", - "referrer": "http://demo.mywebsite.com" - }, - "user": { - "phone_number": "+371234567890123", - "email": "sample@sample.com" - } - } - }, - "integrations": { - "All": true - }, - "sentAt": "2019-10-14T09:03:22.563Z" - }, - "destination": { - "Config": { - "accessToken": "dummyAccessToken", - "pixelCode": "A1T8T4UYGVIQA8ORZMX9", - "hashUserProperties": true, - "eventsToStandard": [ - { - "from": "abc", - "to": "download" - }, - { - "from": "def", - "to": "download" - } - ] - } - } - } - ] - } - }, - "output": { - "response": { - "status": 200, - "body": [ - { - "output": { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://business-api.tiktok.com/open_api/v1.3/pixel/track/", - "headers": { - "Access-Token": "dummyAccessToken", - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "pixel_code": "A1T8T4UYGVIQA8ORZMX9", - "event": "download", - "event_id": "1616318632825_357", - "timestamp": "2020-09-17T19:49:27Z", - "properties": { - "contents": [ - { - "price": 8, - "quantity": 2, - "content_type": "socks", - "content_id": "1077218" - }, - { - "price": 30, - "quantity": 1, - "content_type": "dress", - "content_id": "1197218" - } - ], - "currency": "USD", - "value": 46 - }, - "context": { - "ad": { - "callback": "123ATXSfe" - }, - "page": { - "url": "http://demo.mywebsite.com/purchase", - "referrer": "http://demo.mywebsite.com" - }, - "user": { - "phone_number": "6080191ec608e10062e9257702cbca694cfe1bfa53944ba5701119d8f8b99ad6", - "email": "774efc08cebab8c50c0f0eb2d3a2d2e560872a64f6c1617314c4f03b1c3d4dfa", - "external_id": "f0f3ec74bbef8580d7de80624dea93c05d828c748715199fe71bc7f5a67aa8b3" - }, - "ip": "13.57.97.131", - "user_agent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion" - }, - "partner_name": "RudderStack" - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {}, - "userId": "" - }, - "statusCode": 200 - } - ] - } - } - }, - { - "name": "tiktok_ads", - "description": "Test 24", - "feature": "processor", - "module": "destination", - "version": "v0", - "input": { - "request": { - "body": [ - { - "message": { - "anonymousId": "21e13f4bc7ceddad", - "channel": "web", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.0.0" - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.0.0" - }, - "userAgent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", - "ip": "13.57.97.131", - "locale": "en-US", - "os": { - "name": "", - "version": "" - }, - "screen": { - "density": 2 - }, - "externalId": [ - { - "type": "tiktokExternalId", - "id": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" - } - ] - }, - "messageId": "84e26acc-56a5-4835-8233-591137fca468", - "session_id": "3049dc4c-5a95-4ccd-a3e7-d74a7e411f22", - "originalTimestamp": "2019-10-14T09:03:17.562Z", - "timestamp": "2020-09-17T19:49:27Z", - "type": "track", - "event": "abc", - "properties": { - "eventId": "1616318632825_357", - "contents": [ - { - "price": 8, - "quantity": 2, - "content_type": "socks", - "content_id": "1077218" - }, - { - "price": 30, - "quantity": 1, - "content_type": "dress", - "content_id": "1197218" - } - ], - "currency": "USD", - "value": 46, - "context": { - "ad": { - "callback": "123ATXSfe" - }, - "page": { - "url": "http://demo.mywebsite.com/purchase", - "referrer": "http://demo.mywebsite.com" - }, - "user": { - "phone_number": "+3712345678", - "email": "sample@sample.com" - } - } - }, - "integrations": { - "All": true - }, - "sentAt": "2019-10-14T09:03:22.563Z" - }, - "destination": { - "Config": { - "accessToken": "dummyAccessToken", - "pixelCode": "A1T8T4UYGVIQA8ORZMX9", - "hashUserProperties": true, - "eventsToStandard": [ - { - "from": "abc", - "to": "download" - }, - { - "from": "def", - "to": "download" - } - ] - } - } - } - ] - } - }, - "output": { - "response": { - "status": 200, - "body": [ - { - "output": { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://business-api.tiktok.com/open_api/v1.3/pixel/track/", - "headers": { - "Access-Token": "dummyAccessToken", - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "pixel_code": "A1T8T4UYGVIQA8ORZMX9", - "event": "download", - "event_id": "1616318632825_357", - "timestamp": "2020-09-17T19:49:27Z", - "properties": { - "contents": [ - { - "price": 8, - "quantity": 2, - "content_type": "socks", - "content_id": "1077218" - }, - { - "price": 30, - "quantity": 1, - "content_type": "dress", - "content_id": "1197218" - } - ], - "currency": "USD", - "value": 46 - }, - "context": { - "ad": { - "callback": "123ATXSfe" - }, - "page": { - "url": "http://demo.mywebsite.com/purchase", - "referrer": "http://demo.mywebsite.com" - }, - "user": { - "phone_number": "6e6c1bb39126b3ecf537e62847909b1372a1a22de9b28d85960e12c78f322035", - "email": "774efc08cebab8c50c0f0eb2d3a2d2e560872a64f6c1617314c4f03b1c3d4dfa", - "external_id": "f0f3ec74bbef8580d7de80624dea93c05d828c748715199fe71bc7f5a67aa8b3" - }, - "ip": "13.57.97.131", - "user_agent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion" - }, - "partner_name": "RudderStack" - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {}, - "userId": "" - }, - "statusCode": 200 - } - ] - } - } - }, - { - "name": "tiktok_ads", - "description": "Test 25", - "feature": "processor", - "module": "destination", - "version": "v0", - "input": { - "request": { - "body": [ - { - "message": { - "anonymousId": "21e13f4bc7ceddad", - "channel": "web", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.0.0" - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.0.0" - }, - "userAgent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", - "ip": "13.57.97.131", - "locale": "en-US", - "os": { - "name": "", - "version": "" - }, - "screen": { - "density": 2 - }, - "externalId": [ - { - "type": "tiktokExternalId", - "id": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" - } - ] - }, - "messageId": "84e26acc-56a5-4835-8233-591137fca468", - "session_id": "3049dc4c-5a95-4ccd-a3e7-d74a7e411f22", - "originalTimestamp": "2019-10-14T09:03:17.562Z", - "timestamp": "2020-09-17T19:49:27Z", - "type": "track", - "event": "checkout step completed", - "properties": { - "eventId": "1616318632825_357", - "contents": [ - { - "price": 8, - "quantity": 2, - "content_type": "socks", - "content_id": "1077218" - }, - { - "price": 30, - "quantity": 1, - "content_type": "dress", - "content_id": "1197218" - } - ], - "products": [ - { - "product_id": 123, - "sku": "G-32", - "name": "Monopoly", - "price": 14, - "quantity": 1, - "category": "Games", - "url": "https://www.website.com/product/path", - "image_url": "https://www.website.com/product/path.jpg" - }, - { - "product_id": "345", - "sku": "F-32", - "name": "UNO", - "price": 3.45, - "quantity": 2, - "category": "Games" - } - ], - "currency": "USD", - "value": 46, - "context": { - "ad": { - "callback": "123ATXSfe" - }, - "page": { - "url": "http://demo.mywebsite.com/purchase", - "referrer": "http://demo.mywebsite.com" - }, - "user": { - "phone_number": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", - "email": "dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f" - } - } - }, - "integrations": { - "All": true - }, - "sentAt": "2019-10-14T09:03:22.563Z" - }, - "destination": { - "Config": { - "accessToken": "dummyAccessToken", - "pixelCode": "A1T8T4UYGVIQA8ORZMX9", - "hashUserProperties": false - } - } - } - ] - } - }, - "output": { - "response": { - "status": 200, - "body": [ - { - "output": { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://business-api.tiktok.com/open_api/v1.3/pixel/track/", - "headers": { - "Access-Token": "dummyAccessToken", - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "pixel_code": "A1T8T4UYGVIQA8ORZMX9", - "event": "CompletePayment", - "event_id": "1616318632825_357", - "timestamp": "2020-09-17T19:49:27Z", - "properties": { - "contents": [ - { - "price": 8, - "quantity": 2, - "content_type": "socks", - "content_id": "1077218" - }, - { - "price": 30, - "quantity": 1, - "content_type": "dress", - "content_id": "1197218" - } - ], - "currency": "USD", - "value": 46 - }, - "context": { - "ad": { - "callback": "123ATXSfe" - }, - "page": { - "url": "http://demo.mywebsite.com/purchase", - "referrer": "http://demo.mywebsite.com" - }, - "user": { - "phone_number": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", - "email": "dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f", - "external_id": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" - }, - "ip": "13.57.97.131", - "user_agent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion" - }, - "partner_name": "RudderStack" - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {}, - "userId": "" - }, - "statusCode": 200 - } - ] - } - } - }, - { - "name": "tiktok_ads", - "description": "Test 26", - "feature": "processor", - "module": "destination", - "version": "v0", - "input": { - "request": { - "body": [ - { - "message": { - "anonymousId": "21e13f4bc7ceddad", - "channel": "web", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.0.0" - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.0.0" - }, - "userAgent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", - "ip": "13.57.97.131", - "locale": "en-US", - "os": { - "name": "", - "version": "" - }, - "screen": { - "density": 2 - }, - "externalId": [ - { - "type": "tiktokExternalId", - "id": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" - } - ] - }, - "messageId": "84e26acc-56a5-4835-8233-591137fca468", - "session_id": "3049dc4c-5a95-4ccd-a3e7-d74a7e411f22", - "originalTimestamp": "2019-10-14T09:03:17.562Z", - "timestamp": "2020-09-17T19:49:27Z", - "type": "track", - "event": "checkout step completed", - "properties": { - "eventId": "1616318632825_357", - "products": [ - { - "product_id": 123, - "sku": "G-32", - "name": "Monopoly", - "price": 14, - "quantity": 1, - "contentType": "product_group", - "category": "Games", - "url": "https://www.website.com/product/path", - "image_url": "https://www.website.com/product/path.jpg" - }, - { - "product_id": 345, - "sku": "F-32", - "name": "UNO", - "price": 3.45, - "contentType": "product_group", - "quantity": 2 - } - ], - "currency": "USD", - "value": 46, - "context": { - "ad": { - "callback": "123ATXSfe" - }, - "page": { - "url": "http://demo.mywebsite.com/purchase", - "referrer": "http://demo.mywebsite.com" - }, - "user": { - "phone_number": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", - "email": "dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f" - } - } - }, - "integrations": { - "All": true - }, - "sentAt": "2019-10-14T09:03:22.563Z" - }, - "destination": { - "Config": { - "accessToken": "dummyAccessToken", - "pixelCode": "A1T8T4UYGVIQA8ORZMX9", - "hashUserProperties": false - } - } - } - ] - } - }, - "output": { - "response": { - "status": 200, - "body": [ - { - "output": { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://business-api.tiktok.com/open_api/v1.3/pixel/track/", - "headers": { - "Access-Token": "dummyAccessToken", - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "pixel_code": "A1T8T4UYGVIQA8ORZMX9", - "event": "CompletePayment", - "event_id": "1616318632825_357", - "timestamp": "2020-09-17T19:49:27Z", - "properties": { - "currency": "USD", - "value": 46, - "contents": [ - { - "content_type": "product_group", - "content_id": "123", - "content_category": "Games", - "content_name": "Monopoly", - "price": 14, - "quantity": 1 - }, - { - "content_type": "product_group", - "content_id": "345", - "content_name": "UNO", - "price": 3.45, - "quantity": 2 - } - ] - }, - "context": { - "ad": { - "callback": "123ATXSfe" - }, - "page": { - "url": "http://demo.mywebsite.com/purchase", - "referrer": "http://demo.mywebsite.com" - }, - "user": { - "phone_number": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", - "email": "dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f", - "external_id": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" - }, - "ip": "13.57.97.131", - "user_agent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion" - }, - "partner_name": "RudderStack" - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {}, - "userId": "" - }, - "statusCode": 200 - } - ] - } - } - }, - { - "name": "tiktok_ads", - "description": "Test 27", - "feature": "processor", - "module": "destination", - "version": "v0", - "input": { - "request": { - "body": [ - { - "message": { - "anonymousId": "21e13f4bc7ceddad", - "channel": "web", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.0.0" - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.0.0" - }, - "userAgent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", - "ip": "13.57.97.131", - "locale": "en-US", - "os": { - "name": "", - "version": "" - }, - "screen": { - "density": 2 - }, - "externalId": [ - { - "type": "tiktokExternalId", - "id": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" - } - ] - }, - "messageId": "84e26acc-56a5-4835-8233-591137fca468", - "session_id": "3049dc4c-5a95-4ccd-a3e7-d74a7e411f22", - "originalTimestamp": "2019-10-14T09:03:17.562Z", - "timestamp": "2020-09-17T19:49:27Z", - "type": "track", - "event": "checkout step completed", - "properties": { - "eventId": "1616318632825_357", - "products": [ - { - "contentType": "product_group", - "product_id": "123", - "sku": "G-32", - "name": "Monopoly", - "price": 14, - "quantity": 1, - "category": "Games", - "url": "https://www.website.com/product/path", - "image_url": "https://www.website.com/product/path.jpg" - }, - { - "contentType": "product_group", - "product_id": "345", - "sku": "F-32", - "name": "UNO", - "price": 3.45, - "quantity": 2, - "category": "Games" - } - ], - "currency": "USD", - "value": 46, - "context": { - "ad": { - "callback": "123ATXSfe" - }, - "page": { - "url": "http://demo.mywebsite.com/purchase", - "referrer": "http://demo.mywebsite.com" - }, - "user": { - "phone_number": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", - "email": "dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f" - } - } - }, - "integrations": { - "All": true - }, - "sentAt": "2019-10-14T09:03:22.563Z" - }, - "destination": { - "Config": { - "accessToken": "dummyAccessToken", - "pixelCode": "A1T8T4UYGVIQA8ORZMX9", - "hashUserProperties": false - } - } - } - ] - } - }, - "output": { - "response": { - "status": 200, - "body": [ - { - "output": { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://business-api.tiktok.com/open_api/v1.3/pixel/track/", - "headers": { - "Access-Token": "dummyAccessToken", - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "pixel_code": "A1T8T4UYGVIQA8ORZMX9", - "event": "CompletePayment", - "event_id": "1616318632825_357", - "timestamp": "2020-09-17T19:49:27Z", - "properties": { - "currency": "USD", - "value": 46, - "contents": [ - { - "content_type": "product_group", - "content_id": "123", - "content_category": "Games", - "content_name": "Monopoly", - "price": 14, - "quantity": 1 - }, - { - "content_type": "product_group", - "content_id": "345", - "content_category": "Games", - "content_name": "UNO", - "price": 3.45, - "quantity": 2 - } - ] - }, - "context": { - "ad": { - "callback": "123ATXSfe" - }, - "page": { - "url": "http://demo.mywebsite.com/purchase", - "referrer": "http://demo.mywebsite.com" - }, - "user": { - "phone_number": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", - "email": "dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f", - "external_id": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" - }, - "ip": "13.57.97.131", - "user_agent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion" - }, - "partner_name": "RudderStack" - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {}, - "userId": "" - }, - "statusCode": 200 - } - ] - } - } - }, - { - "name": "tiktok_ads", - "description": "Test 28", - "feature": "processor", - "module": "destination", - "version": "v0", - "input": { - "request": { - "body": [ - { - "message": { - "anonymousId": "21e13f4bc7ceddad", - "channel": "web", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.0.0" - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.0.0" - }, - "userAgent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", - "ip": "13.57.97.131", - "locale": "en-US", - "os": { - "name": "", - "version": "" - }, - "screen": { - "density": 2 - }, - "externalId": [ - { - "type": "tiktokExternalId", - "id": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" - } - ] - }, - "messageId": "84e26acc-56a5-4835-8233-591137fca468", - "session_id": "3049dc4c-5a95-4ccd-a3e7-d74a7e411f22", - "originalTimestamp": "2019-10-14T09:03:17.562Z", - "timestamp": "2020-09-17T19:49:27Z", - "type": "track", - "event": "checkout step completed", - "properties": { - "category": "Urban", - "status": "processed", - "name": "games", - "contentType": "product_group", - "productId": "qqw21221341234", - "eventId": "1616318632825_357", - "products": [ - { - "product_id": "123", - "sku": "G-32", - "name": "Monopoly", - "price": 14, - "quantity": 1, - "category": "Games", - "url": "https://www.website.com/product/path", - "image_url": "https://www.website.com/product/path.jpg" - }, - { - "product_id": "345", - "sku": "F-32", - "name": "UNO", - "price": 3.45, - "quantity": 2, - "category": "Games" - } - ], - "currency": "USD", - "value": 46, - "context": { - "ad": { - "callback": "123ATXSfe" - }, - "page": { - "url": "http://demo.mywebsite.com/purchase", - "referrer": "http://demo.mywebsite.com" - }, - "user": { - "phone_number": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", - "email": "dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f" - } - } - }, - "integrations": { - "All": true - }, - "sentAt": "2019-10-14T09:03:22.563Z" - }, - "destination": { - "Config": { - "accessToken": "dummyAccessToken", - "pixelCode": "A1T8T4UYGVIQA8ORZMX9", - "hashUserProperties": false - } - } - } - ] - } - }, - "output": { - "response": { - "status": 200, - "body": [ - { - "output": { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://business-api.tiktok.com/open_api/v1.3/pixel/track/", - "headers": { - "Access-Token": "dummyAccessToken", - "Content-Type": "application/json" - }, - "params": {}, - "body": { - "JSON": { - "pixel_code": "A1T8T4UYGVIQA8ORZMX9", - "event": "CompletePayment", - "event_id": "1616318632825_357", - "timestamp": "2020-09-17T19:49:27Z", - "properties": { - "content_category": "Urban", - "status": "processed", - "content_name": "games", - "content_id": "qqw21221341234", - "content_type": "product_group", - "currency": "USD", - "value": 46, - "contents": [ - { - "content_type": "product_group", - "content_id": "123", - "content_category": "Games", - "content_name": "Monopoly", - "price": 14, - "quantity": 1 - }, - { - "content_type": "product_group", - "content_id": "345", - "content_category": "Games", - "content_name": "UNO", - "price": 3.45, - "quantity": 2 - } - ] - }, - "context": { - "ad": { - "callback": "123ATXSfe" - }, - "page": { - "url": "http://demo.mywebsite.com/purchase", - "referrer": "http://demo.mywebsite.com" - }, - "user": { - "phone_number": "2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea", - "email": "dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f", - "external_id": "f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc" - }, - "ip": "13.57.97.131", - "user_agent": "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion" - }, - "partner_name": "RudderStack" - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {}, - "userId": "" - }, - "statusCode": 200 - } - ] - } - } - } -] \ No newline at end of file + { + name: 'tiktok_ads', + description: 'Test 0', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + anonymousId: '21e13f4bc7ceddad', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + userAgent: + 'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion', + ip: '13.57.97.131', + locale: 'en-US', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + externalId: [ + { + type: 'tiktokExternalId', + id: 'f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc', + }, + ], + }, + messageId: '84e26acc-56a5-4835-8233-591137fca468', + session_id: '3049dc4c-5a95-4ccd-a3e7-d74a7e411f22', + originalTimestamp: '2019-10-14T09:03:17.562Z', + timestamp: '2020-09-17T19:49:27Z', + type: 'track', + event: 'checkout step completed', + properties: { + eventId: '1616318632825_357', + contents: [ + { + price: 8, + quantity: 2, + content_type: 'socks', + content_id: '1077218', + }, + { + price: 30, + quantity: 1, + content_type: 'dress', + content_id: '1197218', + }, + ], + clickId: 'dummyclickId', + currency: 'USD', + value: 46, + context: { + ad: { + callback: '123ATXSfe', + }, + page: { + url: 'http://demo.mywebsite.com/purchase', + referrer: 'http://demo.mywebsite.com', + }, + user: { + phone_number: + '2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea', + email: 'dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f', + }, + }, + }, + integrations: { + All: true, + }, + sentAt: '2019-10-14T09:03:22.563Z', + }, + destination: { + Config: { + accessToken: 'dummyAccessToken', + pixelCode: 'A1T8T4UYGVIQA8ORZMX9', + hashUserProperties: false, + }, + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://business-api.tiktok.com/open_api/v1.3/pixel/track/', + headers: { + 'Access-Token': 'dummyAccessToken', + 'Content-Type': 'application/json', + }, + params: {}, + body: { + JSON: { + pixel_code: 'A1T8T4UYGVIQA8ORZMX9', + event: 'CompletePayment', + event_id: '1616318632825_357', + timestamp: '2020-09-17T19:49:27Z', + properties: { + contents: [ + { + price: 8, + quantity: 2, + content_type: 'socks', + content_id: '1077218', + }, + { + price: 30, + quantity: 1, + content_type: 'dress', + content_id: '1197218', + }, + ], + currency: 'USD', + value: 46, + }, + context: { + ad: { + callback: 'dummyclickId', + }, + page: { + url: 'http://demo.mywebsite.com/purchase', + referrer: 'http://demo.mywebsite.com', + }, + user: { + phone_number: + '2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea', + email: 'dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f', + external_id: + 'f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc', + }, + ip: '13.57.97.131', + user_agent: + 'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion', + }, + partner_name: 'RudderStack', + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'tiktok_ads', + description: 'Test 1', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + anonymousId: '21e13f4bc7ceddad', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + userAgent: + 'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion', + locale: 'en-US', + ip: '13.57.97.131', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + externalId: [ + { + type: 'tiktokExternalId', + id: 'f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc', + }, + ], + }, + messageId: '84e26acc-56a5-4835-8233-591137fca468', + session_id: '3049dc4c-5a95-4ccd-a3e7-d74a7e411f22', + originalTimestamp: '2019-10-14T09:03:17.562Z', + timestamp: '2020-09-17T19:49:27Z', + type: 'track', + event: 'checkout started', + properties: { + eventId: '1616318632825_357', + context: { + page: { + url: 'http://demo.mywebsite.com/purchase', + referrer: 'http://demo.mywebsite.com', + }, + user: { + phone_number: + '2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea', + email: 'dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f', + }, + }, + contents: [ + { + price: 8, + quantity: 2, + content_type: 'socks', + content_id: '1077218', + }, + { + price: 30, + quantity: 1, + content_type: 'dress', + content_id: '1197218', + }, + ], + currency: 'USD', + value: 46, + }, + integrations: { + All: true, + }, + sentAt: '2019-10-14T09:03:22.563Z', + }, + destination: { + Config: { + accessToken: 'dummyAccessToken', + pixelCode: 'A1T8T4UYGVIQA8ORZMX9', + hashUserProperties: false, + }, + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://business-api.tiktok.com/open_api/v1.3/pixel/track/', + headers: { + 'Access-Token': 'dummyAccessToken', + 'Content-Type': 'application/json', + }, + params: {}, + body: { + JSON: { + pixel_code: 'A1T8T4UYGVIQA8ORZMX9', + event: 'InitiateCheckout', + event_id: '1616318632825_357', + timestamp: '2020-09-17T19:49:27Z', + properties: { + contents: [ + { + price: 8, + quantity: 2, + content_type: 'socks', + content_id: '1077218', + }, + { + price: 30, + quantity: 1, + content_type: 'dress', + content_id: '1197218', + }, + ], + currency: 'USD', + value: 46, + }, + context: { + page: { + url: 'http://demo.mywebsite.com/purchase', + referrer: 'http://demo.mywebsite.com', + }, + user: { + phone_number: + '2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea', + email: 'dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f', + external_id: + 'f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc', + }, + ip: '13.57.97.131', + user_agent: + 'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion', + }, + partner_name: 'RudderStack', + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'tiktok_ads', + description: 'Test 2', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + anonymousId: '21e13f4bc7ceddad', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + locale: 'en-US', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + externalId: [ + { + type: 'tiktokExternalId', + id: 'f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc', + }, + ], + }, + messageId: '84e26acc-56a5-4835-8233-591137fca468', + session_id: '3049dc4c-5a95-4ccd-a3e7-d74a7e411f22', + originalTimestamp: '2019-10-14T09:03:17.562Z', + timestamp: '2020-09-17T19:49:27Z', + type: 'track', + event: 'Product Added to Wishlist', + properties: { + eventId: '1616318632825_357', + testEventCode: 'sample rudder test_event_code', + context: { + page: { + url: 'http://demo.mywebsite.com/purchase', + referrer: 'http://demo.mywebsite.com', + }, + user: { + phone_number: + '2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea', + email: 'dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f', + }, + }, + contents: [ + { + price: 8, + quantity: 2, + content_type: 'socks', + content_id: '1077218', + }, + { + price: 30, + quantity: 1, + content_type: 'dress', + content_id: '1197218', + }, + ], + currency: 'USD', + value: 46, + }, + integrations: { + All: true, + }, + sentAt: '2019-10-14T09:03:22.563Z', + }, + destination: { + Config: { + accessToken: 'dummyAccessToken', + pixelCode: 'A1T8T4UYGVIQA8ORZMX9', + hashUserProperties: false, + }, + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://business-api.tiktok.com/open_api/v1.3/pixel/track/', + headers: { + 'Access-Token': 'dummyAccessToken', + 'Content-Type': 'application/json', + }, + params: {}, + body: { + JSON: { + pixel_code: 'A1T8T4UYGVIQA8ORZMX9', + event: 'AddToWishlist', + event_id: '1616318632825_357', + timestamp: '2020-09-17T19:49:27Z', + test_event_code: 'sample rudder test_event_code', + properties: { + contents: [ + { + price: 8, + quantity: 2, + content_type: 'socks', + content_id: '1077218', + }, + { + price: 30, + quantity: 1, + content_type: 'dress', + content_id: '1197218', + }, + ], + currency: 'USD', + value: 46, + }, + context: { + page: { + url: 'http://demo.mywebsite.com/purchase', + referrer: 'http://demo.mywebsite.com', + }, + user: { + phone_number: + '2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea', + email: 'dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f', + external_id: + 'f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc', + }, + }, + partner_name: 'RudderStack', + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'tiktok_ads', + description: 'Test 3', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + anonymousId: '21e13f4bc7ceddad', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + userAgent: + 'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion', + locale: 'en-US', + ip: '13.57.97.131', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + externalId: [ + { + type: 'tiktokExternalId', + id: 'f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc', + }, + ], + }, + messageId: '84e26acc-56a5-4835-8233-591137fca468', + session_id: '3049dc4c-5a95-4ccd-a3e7-d74a7e411f22', + originalTimestamp: '2019-10-14T09:03:17.562Z', + timestamp: '2020-09-17T19:49:27Z', + type: 'track', + event: 'Product Added to Wishlist1', + properties: { + eventId: '1616318632825_357', + testEventCode: 'sample rudder test_event_code', + context: { + page: { + url: 'http://demo.mywebsite.com/purchase', + referrer: 'http://demo.mywebsite.com', + }, + user: { + phone_number: + '2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea', + email: 'dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f', + }, + }, + contents: [ + { + price: 8, + quantity: 2, + content_type: 'socks', + content_id: '1077218', + }, + { + price: 30, + quantity: 1, + content_type: 'dress', + content_id: '1197218', + }, + ], + currency: 'USD', + value: 46, + }, + integrations: { + All: true, + }, + sentAt: '2019-10-14T09:03:22.563Z', + }, + destination: { + Config: { + accessToken: 'dummyAccessToken', + pixelCode: 'A1T8T4UYGVIQA8ORZMX9', + hashUserProperties: false, + }, + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + statusCode: 400, + error: + 'Event name (product added to wishlist1) is not valid, must be mapped to one of standard events', + statTags: { + errorCategory: 'dataValidation', + errorType: 'instrumentation', + destType: 'TIKTOK_ADS', + module: 'destination', + implementation: 'native', + feature: 'processor', + }, + }, + ], + }, + }, + }, + { + name: 'tiktok_ads', + description: 'Test 4', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + anonymousId: '21e13f4bc7ceddad', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + userAgent: + 'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion', + locale: 'en-US', + ip: '13.57.97.131', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + externalId: [ + { + type: 'tiktokExternalId', + id: 'f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc', + }, + ], + }, + messageId: '84e26acc-56a5-4835-8233-591137fca468', + session_id: '3049dc4c-5a95-4ccd-a3e7-d74a7e411f22', + originalTimestamp: '2019-10-14T09:03:17.562Z', + timestamp: '2020-09-17T19:49:27Z', + type: 'track', + event: 'Product Added to Wishlist', + properties: { + eventId: '1616318632825_357', + testEventCode: 'sample rudder test_event_code', + context: { + page: { + url: 'http://demo.mywebsite.com/purchase', + referrer: 'http://demo.mywebsite.com', + }, + user: { + phone_number: + '2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea', + email: 'dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f', + }, + }, + contents: [ + { + price: 8, + quantity: 2, + content_type: 'socks', + content_id: '1077218', + }, + { + price: 30, + quantity: 1, + content_type: 'dress', + content_id: '1197218', + }, + ], + currency: 'USD', + value: 46, + }, + integrations: { + All: true, + }, + sentAt: '2019-10-14T09:03:22.563Z', + }, + destination: { + Config: { + accessToken: 'dummyAccessToken', + pixelCode: 'A1T8T4UYGVIQA8ORZMX9', + hashUserProperties: false, + }, + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://business-api.tiktok.com/open_api/v1.3/pixel/track/', + headers: { + 'Access-Token': 'dummyAccessToken', + 'Content-Type': 'application/json', + }, + params: {}, + body: { + JSON: { + pixel_code: 'A1T8T4UYGVIQA8ORZMX9', + event: 'AddToWishlist', + event_id: '1616318632825_357', + timestamp: '2020-09-17T19:49:27Z', + test_event_code: 'sample rudder test_event_code', + properties: { + contents: [ + { + price: 8, + quantity: 2, + content_type: 'socks', + content_id: '1077218', + }, + { + price: 30, + quantity: 1, + content_type: 'dress', + content_id: '1197218', + }, + ], + currency: 'USD', + value: 46, + }, + context: { + page: { + url: 'http://demo.mywebsite.com/purchase', + referrer: 'http://demo.mywebsite.com', + }, + user: { + phone_number: + '2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea', + email: 'dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f', + external_id: + 'f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc', + }, + ip: '13.57.97.131', + user_agent: + 'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion', + }, + partner_name: 'RudderStack', + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'tiktok_ads', + description: 'Test 5', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + anonymousId: '21e13f4bc7ceddad', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + userAgent: + 'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion', + locale: 'en-US', + ip: '13.57.97.131', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + externalId: [ + { + type: 'tiktokExternalId', + id: 'f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc', + }, + ], + }, + messageId: '84e26acc-56a5-4835-8233-591137fca468', + session_id: '3049dc4c-5a95-4ccd-a3e7-d74a7e411f22', + originalTimestamp: '2019-10-14T09:03:17.562Z', + timestamp: '2020-09-17T19:49:27Z', + type: 'track', + event: 'Product Added to Wishlist', + properties: { + eventId: '1616318632825_357', + testEventCode: 'sample rudder test_event_code', + context: { + page: { + url: 'http://demo.mywebsite.com/purchase', + referrer: 'http://demo.mywebsite.com', + }, + user: { + phone_number: + '2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea', + email: 'dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f', + }, + }, + contents: [ + { + price: 8, + quantity: 2, + content_type: 'socks', + content_id: '1077218', + }, + { + price: 30, + quantity: 1, + content_type: 'dress', + content_id: '1197218', + }, + ], + currency: 'USD', + value: 46, + }, + integrations: { + All: true, + }, + sentAt: '2019-10-14T09:03:22.563Z', + }, + destination: { + Config: { + accessToken: 'dummyAccessToken', + pixelCode: 'A1T8T4UYGVIQA8ORZMX9', + hashUserProperties: false, + }, + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://business-api.tiktok.com/open_api/v1.3/pixel/track/', + headers: { + 'Access-Token': 'dummyAccessToken', + 'Content-Type': 'application/json', + }, + params: {}, + body: { + JSON: { + pixel_code: 'A1T8T4UYGVIQA8ORZMX9', + event: 'AddToWishlist', + event_id: '1616318632825_357', + timestamp: '2020-09-17T19:49:27Z', + test_event_code: 'sample rudder test_event_code', + properties: { + contents: [ + { + price: 8, + quantity: 2, + content_type: 'socks', + content_id: '1077218', + }, + { + price: 30, + quantity: 1, + content_type: 'dress', + content_id: '1197218', + }, + ], + currency: 'USD', + value: 46, + }, + context: { + page: { + url: 'http://demo.mywebsite.com/purchase', + referrer: 'http://demo.mywebsite.com', + }, + user: { + phone_number: + '2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea', + email: 'dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f', + external_id: + 'f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc', + }, + ip: '13.57.97.131', + user_agent: + 'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion', + }, + partner_name: 'RudderStack', + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'tiktok_ads', + description: 'Test 6', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + anonymousId: '21e13f4bc7ceddad', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + userAgent: + 'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion', + locale: 'en-US', + ip: '13.57.97.131', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + externalId: [ + { + type: 'tiktokExternalId', + id: '1234', + }, + ], + }, + messageId: '84e26acc-56a5-4835-8233-591137fca468', + session_id: '3049dc4c-5a95-4ccd-a3e7-d74a7e411f22', + originalTimestamp: '2019-10-14T09:03:17.562Z', + timestamp: '2020-09-17T19:49:27Z', + type: 'track', + event: 'SubscriBe', + properties: { + eventId: '1616318632825_357', + testEventCode: '', + context: { + page: { + url: 'http://demo.mywebsite.com/purchase', + referrer: 'http://demo.mywebsite.com', + }, + user: { + phone_number: '+868987675687', + email: 'sample@sample.com', + }, + }, + contents: [ + { + price: 8, + quantity: 2, + content_type: 'socks', + content_id: '1077218', + }, + { + price: 30, + quantity: 1, + content_type: 'dress', + content_id: '1197218', + }, + ], + currency: 'USD', + value: 46, + }, + integrations: { + All: true, + }, + sentAt: '2019-10-14T09:03:22.563Z', + }, + destination: { + Config: { + accessToken: 'dummyAccessToken', + pixelCode: 'A1T8T4UYGVIQA8ORZMX9', + hashUserProperties: true, + }, + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://business-api.tiktok.com/open_api/v1.3/pixel/track/', + headers: { + 'Access-Token': 'dummyAccessToken', + 'Content-Type': 'application/json', + }, + params: {}, + body: { + JSON: { + pixel_code: 'A1T8T4UYGVIQA8ORZMX9', + event: 'Subscribe', + event_id: '1616318632825_357', + timestamp: '2020-09-17T19:49:27Z', + properties: { + contents: [ + { + price: 8, + quantity: 2, + content_type: 'socks', + content_id: '1077218', + }, + { + price: 30, + quantity: 1, + content_type: 'dress', + content_id: '1197218', + }, + ], + currency: 'USD', + value: 46, + }, + context: { + page: { + url: 'http://demo.mywebsite.com/purchase', + referrer: 'http://demo.mywebsite.com', + }, + user: { + phone_number: + '1d96e70d2bf54087e33586457cde2790825bee7b1a3b05d26481cb12ec8e63fd', + email: '774efc08cebab8c50c0f0eb2d3a2d2e560872a64f6c1617314c4f03b1c3d4dfa', + external_id: + '03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4', + }, + ip: '13.57.97.131', + user_agent: + 'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion', + }, + partner_name: 'RudderStack', + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'tiktok_ads', + description: 'Test 7', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + anonymousId: '21e13f4bc7ceddad', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + userAgent: + 'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion', + locale: 'en-US', + ip: '13.57.97.131', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + externalId: [ + { + type: 'tiktokExternalId', + id: 'f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc', + }, + ], + }, + messageId: '84e26acc-56a5-4835-8233-591137fca468', + session_id: '3049dc4c-5a95-4ccd-a3e7-d74a7e411f22', + originalTimestamp: '2019-10-14T09:03:17.562Z', + timestamp: '2020-09-17T19:49:27Z', + type: 'track', + event: 'payment info entered', + properties: { + eventId: '1616318632825_357', + context: { + page: { + url: 'http://demo.mywebsite.com/purchase', + referrer: 'http://demo.mywebsite.com', + }, + user: { + phone_number: + '2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea', + email: 'dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f', + }, + }, + contents: [ + { + price: 8, + quantity: 2, + content_type: 'socks', + content_id: '1077218', + }, + { + price: 30, + quantity: 1, + content_type: 'dress', + content_id: '1197218', + }, + ], + currency: 'USD', + value: 46, + }, + integrations: { + All: true, + }, + sentAt: '2019-10-14T09:03:22.563Z', + }, + destination: { + Config: { + accessToken: 'dummyAccessToken', + pixelCode: 'A1T8T4UYGVIQA8ORZMX9', + hashUserProperties: false, + }, + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://business-api.tiktok.com/open_api/v1.3/pixel/track/', + headers: { + 'Access-Token': 'dummyAccessToken', + 'Content-Type': 'application/json', + }, + params: {}, + body: { + JSON: { + pixel_code: 'A1T8T4UYGVIQA8ORZMX9', + event: 'AddPaymentInfo', + event_id: '1616318632825_357', + timestamp: '2020-09-17T19:49:27Z', + properties: { + contents: [ + { + price: 8, + quantity: 2, + content_type: 'socks', + content_id: '1077218', + }, + { + price: 30, + quantity: 1, + content_type: 'dress', + content_id: '1197218', + }, + ], + currency: 'USD', + value: 46, + }, + context: { + page: { + url: 'http://demo.mywebsite.com/purchase', + referrer: 'http://demo.mywebsite.com', + }, + user: { + phone_number: + '2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea', + email: 'dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f', + external_id: + 'f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc', + }, + ip: '13.57.97.131', + user_agent: + 'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion', + }, + partner_name: 'RudderStack', + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'tiktok_ads', + description: 'Test 8', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + anonymousId: '21e13f4bc7ceddad', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + userAgent: + 'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion', + locale: 'en-US', + ip: '13.57.97.131', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + externalId: [ + { + type: 'tiktokExternalId', + id: 'f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc', + }, + ], + }, + messageId: '84e26acc-56a5-4835-8233-591137fca468', + session_id: '3049dc4c-5a95-4ccd-a3e7-d74a7e411f22', + originalTimestamp: '2019-10-14T09:03:17.562Z', + timestamp: '2020-09-17T19:49:27Z', + type: 'track', + properties: { + eventId: '1616318632825_357', + context: { + page: { + url: 'http://demo.mywebsite.com/purchase', + referrer: 'http://demo.mywebsite.com', + }, + user: { + phone_number: + '2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea', + email: 'dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f', + }, + }, + contents: [ + { + price: 8, + quantity: 2, + content_type: 'socks', + content_id: '1077218', + }, + { + price: 30, + quantity: 1, + content_type: 'dress', + content_id: '1197218', + }, + ], + currency: 'USD', + value: 46, + }, + integrations: { + All: true, + }, + sentAt: '2019-10-14T09:03:22.563Z', + }, + destination: { + Config: { + accessToken: 'dummyAccessToken', + pixelCode: 'A1T8T4UYGVIQA8ORZMX9', + hashUserProperties: false, + }, + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + statusCode: 400, + error: 'Event name is required', + statTags: { + errorCategory: 'dataValidation', + errorType: 'instrumentation', + destType: 'TIKTOK_ADS', + module: 'destination', + implementation: 'native', + feature: 'processor', + }, + }, + ], + }, + }, + }, + { + name: 'tiktok_ads', + description: 'Test 9', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + anonymousId: '21e13f4bc7ceddad', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + userAgent: + 'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion', + locale: 'en-US', + ip: '13.57.97.131', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + externalId: [ + { + type: 'tiktokExternalId', + id: 'f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc', + }, + ], + }, + messageId: '84e26acc-56a5-4835-8233-591137fca468', + session_id: '3049dc4c-5a95-4ccd-a3e7-d74a7e411f22', + originalTimestamp: '2019-10-14T09:03:17.562Z', + timestamp: '2020-09-17T19:49:27Z', + properties: { + eventId: '1616318632825_357', + context: { + page: { + url: 'http://demo.mywebsite.com/purchase', + referrer: 'http://demo.mywebsite.com', + }, + user: { + phone_number: + '2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea', + email: 'dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f', + }, + }, + contents: [ + { + price: 8, + quantity: 2, + content_type: 'socks', + content_id: '1077218', + }, + { + price: 30, + quantity: 1, + content_type: 'dress', + content_id: '1197218', + }, + ], + currency: 'USD', + value: 46, + }, + integrations: { + All: true, + }, + sentAt: '2019-10-14T09:03:22.563Z', + }, + destination: { + Config: { + accessToken: 'dummyAccessToken', + pixelCode: 'A1T8T4UYGVIQA8ORZMX9', + hashUserProperties: false, + }, + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + statusCode: 400, + error: 'Event type is required', + statTags: { + errorCategory: 'dataValidation', + errorType: 'instrumentation', + destType: 'TIKTOK_ADS', + module: 'destination', + implementation: 'native', + feature: 'processor', + }, + }, + ], + }, + }, + }, + { + name: 'tiktok_ads', + description: 'Test 10', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + anonymousId: '21e13f4bc7ceddad', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + userAgent: + 'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion', + locale: 'en-US', + ip: '13.57.97.131', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + externalId: [ + { + type: 'tiktokExternalId', + id: 'f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc', + }, + ], + }, + messageId: '84e26acc-56a5-4835-8233-591137fca468', + session_id: '3049dc4c-5a95-4ccd-a3e7-d74a7e411f22', + originalTimestamp: '2019-10-14T09:03:17.562Z', + type: 'track', + event: 'payment info entered', + properties: { + eventId: '1616318632825_357', + context: { + page: { + url: 'http://demo.mywebsite.com/purchase', + referrer: 'http://demo.mywebsite.com', + }, + user: { + phone_number: + '2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea', + email: 'dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f', + }, + }, + contents: [ + { + price: 8, + quantity: 2, + content_type: 'socks', + content_id: '1077218', + }, + { + price: 30, + quantity: 1, + content_type: 'dress', + content_id: '1197218', + }, + ], + currency: 'USD', + value: 46, + }, + integrations: { + All: true, + }, + sentAt: '2019-10-14T09:03:22.563Z', + }, + destination: { + Config: { + accessToken: 'dummyAccessToken', + pixelCode: 'A1T8T4UYGVIQA8ORZMX9', + hashUserProperties: false, + }, + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://business-api.tiktok.com/open_api/v1.3/pixel/track/', + headers: { + 'Access-Token': 'dummyAccessToken', + 'Content-Type': 'application/json', + }, + params: {}, + body: { + JSON: { + pixel_code: 'A1T8T4UYGVIQA8ORZMX9', + event: 'AddPaymentInfo', + event_id: '1616318632825_357', + properties: { + contents: [ + { + price: 8, + quantity: 2, + content_type: 'socks', + content_id: '1077218', + }, + { + price: 30, + quantity: 1, + content_type: 'dress', + content_id: '1197218', + }, + ], + currency: 'USD', + value: 46, + }, + context: { + page: { + url: 'http://demo.mywebsite.com/purchase', + referrer: 'http://demo.mywebsite.com', + }, + user: { + phone_number: + '2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea', + email: 'dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f', + external_id: + 'f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc', + }, + ip: '13.57.97.131', + user_agent: + 'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion', + }, + partner_name: 'RudderStack', + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'tiktok_ads', + description: 'Test 11', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + anonymousId: '21e13f4bc7ceddad', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + userAgent: + 'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion', + locale: 'en-US', + ip: '13.57.97.131', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + externalId: [ + { + type: 'tiktokExternalId', + id: 'f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc', + }, + ], + }, + messageId: '84e26acc-56a5-4835-8233-591137fca468', + session_id: '3049dc4c-5a95-4ccd-a3e7-d74a7e411f22', + originalTimestamp: '2019-10-14T09:03:17.562Z', + timestamp: '2020-09-17T19:49:27Z', + type: 'track', + event: 'submitform', + properties: { + eventId: '16163186328257', + context: { + page: { + url: 'http://demo.mywebsite.com/purchase', + referrer: 'http://demo.mywebsite.com', + }, + user: { + phone_number: + '2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea', + email: 'dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f', + }, + }, + contents: [ + { + price: 8, + quantity: 2, + content_type: 'socks', + content_id: '1077218', + }, + { + price: 30, + quantity: 1, + content_type: 'dress', + content_id: '1197218', + }, + ], + currency: 'USD', + value: 46, + }, + integrations: { + All: true, + }, + sentAt: '2019-10-14T09:03:22.563Z', + }, + destination: { + Config: { + accessToken: 'dummyAccessToken', + pixelCode: 'A1T8T4UYGVIQA8ORZMX9', + hashUserProperties: false, + }, + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://business-api.tiktok.com/open_api/v1.3/pixel/track/', + headers: { + 'Access-Token': 'dummyAccessToken', + 'Content-Type': 'application/json', + }, + params: {}, + body: { + JSON: { + pixel_code: 'A1T8T4UYGVIQA8ORZMX9', + event: 'SubmitForm', + event_id: '16163186328257', + timestamp: '2020-09-17T19:49:27Z', + properties: { + contents: [ + { + price: 8, + quantity: 2, + content_type: 'socks', + content_id: '1077218', + }, + { + price: 30, + quantity: 1, + content_type: 'dress', + content_id: '1197218', + }, + ], + currency: 'USD', + value: 46, + }, + context: { + page: { + url: 'http://demo.mywebsite.com/purchase', + referrer: 'http://demo.mywebsite.com', + }, + user: { + phone_number: + '2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea', + email: 'dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f', + external_id: + 'f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc', + }, + ip: '13.57.97.131', + user_agent: + 'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion', + }, + partner_name: 'RudderStack', + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'tiktok_ads', + description: 'Test 12', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + anonymousId: '21e13f4bc7ceddad', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + userAgent: + 'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion', + locale: 'en-US', + ip: '13.57.97.131', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + externalId: [ + { + type: 'tiktokExternalId', + id: 'f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc', + }, + ], + }, + messageId: '84e26acc-56a5-4835-8233-591137fca468', + session_id: '3049dc4c-5a95-4ccd-a3e7-d74a7e411f22', + originalTimestamp: '2019-10-14T09:03:17.562Z', + timestamp: '2020-09-17T19:49:27Z', + type: 'track', + event: 'submitform', + properties: { + eventId: '16163186328257', + context: { + page: { + url: 'http://demo.mywebsite.com/purchase', + referrer: 'http://demo.mywebsite.com', + }, + user: { + phone_number: + '2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea', + email: 'dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f', + }, + userAgent: + 'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion', + ip: '13.57.97.131', + }, + }, + integrations: { + All: true, + }, + sentAt: '2019-10-14T09:03:22.563Z', + }, + destination: { + Config: { + accessToken: 'dummyAccessToken', + pixelCode: 'A1T8T4UYGVIQA8ORZMX9', + hashUserProperties: false, + }, + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://business-api.tiktok.com/open_api/v1.3/pixel/track/', + headers: { + 'Access-Token': 'dummyAccessToken', + 'Content-Type': 'application/json', + }, + params: {}, + body: { + JSON: { + pixel_code: 'A1T8T4UYGVIQA8ORZMX9', + event: 'SubmitForm', + event_id: '16163186328257', + timestamp: '2020-09-17T19:49:27Z', + context: { + page: { + url: 'http://demo.mywebsite.com/purchase', + referrer: 'http://demo.mywebsite.com', + }, + user: { + phone_number: + '2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea', + email: 'dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f', + external_id: + 'f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc', + }, + ip: '13.57.97.131', + user_agent: + 'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion', + }, + partner_name: 'RudderStack', + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'tiktok_ads', + description: 'Test 13', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + anonymousId: '21e13f4bc7ceddad', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + userAgent: + 'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion', + locale: 'en-US', + ip: '13.57.97.131', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + externalId: [ + { + type: 'tiktokExternalId', + id: 'f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc', + }, + ], + }, + messageId: '84e26acc-56a5-4835-8233-591137fca468', + session_id: '3049dc4c-5a95-4ccd-a3e7-d74a7e411f22', + originalTimestamp: '2019-10-14T09:03:17.562Z', + timestamp: '2020-09-17T19:49:27Z', + type: 'track', + event: 'contact', + properties: { + eventId: '16163186328257', + context: { + page: { + url: 'http://demo.mywebsite.com/purchase', + referrer: 'http://demo.mywebsite.com', + }, + user: { + phone_number: + '2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea', + email: 'dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f', + }, + }, + contents: [ + { + price: 8, + quantity: 2, + content_type: 'socks', + content_id: '1077218', + }, + { + price: 30, + quantity: 1, + content_type: 'dress', + content_id: '1197218', + }, + ], + currency: 'USD', + value: 46, + }, + integrations: { + All: true, + }, + sentAt: '2019-10-14T09:03:22.563Z', + }, + destination: { + Config: { + accessToken: 'dummyAccessToken', + pixelCode: 'A1T8T4UYGVIQA8ORZMX9', + hashUserProperties: false, + }, + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://business-api.tiktok.com/open_api/v1.3/pixel/track/', + headers: { + 'Access-Token': 'dummyAccessToken', + 'Content-Type': 'application/json', + }, + params: {}, + body: { + JSON: { + pixel_code: 'A1T8T4UYGVIQA8ORZMX9', + event: 'Contact', + event_id: '16163186328257', + timestamp: '2020-09-17T19:49:27Z', + properties: { + contents: [ + { + price: 8, + quantity: 2, + content_type: 'socks', + content_id: '1077218', + }, + { + price: 30, + quantity: 1, + content_type: 'dress', + content_id: '1197218', + }, + ], + currency: 'USD', + value: 46, + }, + context: { + page: { + url: 'http://demo.mywebsite.com/purchase', + referrer: 'http://demo.mywebsite.com', + }, + user: { + phone_number: + '2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea', + email: 'dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f', + external_id: + 'f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc', + }, + ip: '13.57.97.131', + user_agent: + 'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion', + }, + partner_name: 'RudderStack', + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'tiktok_ads', + description: 'Test 14', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + anonymousId: '21e13f4bc7ceddad', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + userAgent: + 'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion', + locale: 'en-US', + ip: '13.57.97.131', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + externalId: [ + { + type: 'tiktokExternalId', + id: 'f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc', + }, + ], + }, + messageId: '84e26acc-56a5-4835-8233-591137fca468', + session_id: '3049dc4c-5a95-4ccd-a3e7-d74a7e411f22', + originalTimestamp: '2019-10-14T09:03:17.562Z', + timestamp: '2020-09-17T19:49:27Z', + type: 'identify', + event: 'contact', + properties: { + eventId: '16163186328257', + context: { + page: { + url: 'http://demo.mywebsite.com/purchase', + referrer: 'http://demo.mywebsite.com', + }, + user: { + phone_number: + '2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea', + email: 'dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f', + }, + }, + contents: [ + { + price: 8, + quantity: 2, + content_type: 'socks', + content_id: '1077218', + }, + { + price: 30, + quantity: 1, + content_type: 'dress', + content_id: '1197218', + }, + ], + currency: 'USD', + value: 46, + }, + integrations: { + All: true, + }, + sentAt: '2019-10-14T09:03:22.563Z', + }, + destination: { + Config: { + accessToken: 'dummyAccessToken', + pixelCode: 'A1T8T4UYGVIQA8ORZMX9', + hashUserProperties: false, + }, + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + statusCode: 400, + error: 'Event type identify is not supported', + statTags: { + errorCategory: 'dataValidation', + errorType: 'instrumentation', + destType: 'TIKTOK_ADS', + module: 'destination', + implementation: 'native', + feature: 'processor', + }, + }, + ], + }, + }, + }, + { + name: 'tiktok_ads', + description: 'Test 15', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + anonymousId: '21e13f4bc7ceddad', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + userAgent: + 'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion', + locale: 'en-US', + ip: '13.57.97.131', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + externalId: [ + { + type: 'tiktokExternalId', + id: 'f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc', + }, + ], + }, + messageId: '84e26acc-56a5-4835-8233-591137fca468', + session_id: '3049dc4c-5a95-4ccd-a3e7-d74a7e411f22', + originalTimestamp: '2019-10-14T09:03:17.562Z', + timestamp: '2020-09-17T19:49:27Z', + type: 'track', + event: 'checkout step completed', + properties: { + eventId: '1616318632825_357', + context: { + page: { + url: 'http://demo.mywebsite.com/purchase', + referrer: 'http://demo.mywebsite.com', + }, + user: { + phone_number: + '2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea', + email: 'dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f', + }, + }, + contents: [ + { + price: 8, + quantity: 2, + content_type: 'socks', + content_id: '1077218', + }, + { + price: 30, + quantity: 1, + content_type: 'dress', + content_id: '1197218', + }, + ], + currency: 'USD', + value: 46, + }, + integrations: { + All: true, + }, + sentAt: '2019-10-14T09:03:22.563Z', + }, + destination: { + Config: { + accessToken: 'dummyAccessToken', + pixelCode: 'A1T8T4UYGVIQA8ORZMX9', + hashUserProperties: false, + }, + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://business-api.tiktok.com/open_api/v1.3/pixel/track/', + headers: { + 'Access-Token': 'dummyAccessToken', + 'Content-Type': 'application/json', + }, + params: {}, + body: { + JSON: { + pixel_code: 'A1T8T4UYGVIQA8ORZMX9', + event: 'CompletePayment', + event_id: '1616318632825_357', + timestamp: '2020-09-17T19:49:27Z', + properties: { + contents: [ + { + price: 8, + quantity: 2, + content_type: 'socks', + content_id: '1077218', + }, + { + price: 30, + quantity: 1, + content_type: 'dress', + content_id: '1197218', + }, + ], + currency: 'USD', + value: 46, + }, + context: { + page: { + url: 'http://demo.mywebsite.com/purchase', + referrer: 'http://demo.mywebsite.com', + }, + user: { + phone_number: + '2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea', + email: 'dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f', + external_id: + 'f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc', + }, + ip: '13.57.97.131', + user_agent: + 'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion', + }, + partner_name: 'RudderStack', + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'tiktok_ads', + description: 'Test 16', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + anonymousId: '21e13f4bc7ceddad', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + userAgent: + 'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion', + locale: 'en-US', + ip: '13.57.97.131', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + externalId: [ + { + type: 'tiktokExternalId', + id: 'f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc', + }, + ], + }, + messageId: '84e26acc-56a5-4835-8233-591137fca468', + session_id: '3049dc4c-5a95-4ccd-a3e7-d74a7e411f22', + originalTimestamp: '2019-10-14T09:03:17.562Z', + timestamp: '2020-09-17T19:49:27Z', + type: 'track', + event: 'order completed', + properties: { + eventId: '1616318632825_357', + context: { + page: { + url: 'http://demo.mywebsite.com/purchase', + referrer: 'http://demo.mywebsite.com', + }, + user: { + phone_number: + '2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea', + email: 'dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f', + }, + }, + contents: [ + { + price: 8, + quantity: 2, + content_type: 'socks', + content_id: '1077218', + }, + { + price: 30, + quantity: 1, + content_type: 'dress', + content_id: '1197218', + }, + ], + currency: 'USD', + value: 46, + }, + integrations: { + All: true, + }, + sentAt: '2019-10-14T09:03:22.563Z', + }, + destination: { + Config: { + accessToken: 'dummyAccessToken', + pixelCode: 'A1T8T4UYGVIQA8ORZMX9', + hashUserProperties: false, + }, + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://business-api.tiktok.com/open_api/v1.3/pixel/track/', + headers: { + 'Access-Token': 'dummyAccessToken', + 'Content-Type': 'application/json', + }, + params: {}, + body: { + JSON: { + pixel_code: 'A1T8T4UYGVIQA8ORZMX9', + event: 'PlaceAnOrder', + event_id: '1616318632825_357', + timestamp: '2020-09-17T19:49:27Z', + properties: { + contents: [ + { + price: 8, + quantity: 2, + content_type: 'socks', + content_id: '1077218', + }, + { + price: 30, + quantity: 1, + content_type: 'dress', + content_id: '1197218', + }, + ], + currency: 'USD', + value: 46, + }, + context: { + page: { + url: 'http://demo.mywebsite.com/purchase', + referrer: 'http://demo.mywebsite.com', + }, + user: { + phone_number: + '2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea', + email: 'dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f', + external_id: + 'f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc', + }, + ip: '13.57.97.131', + user_agent: + 'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion', + }, + partner_name: 'RudderStack', + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'tiktok_ads', + description: 'Test 17', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + anonymousId: '21e13f4bc7ceddad', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + traits: { + email: 'user@sample.com', + phone: '+919912345678', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + userAgent: + 'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion', + locale: 'en-US', + ip: '13.57.97.131', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + externalId: [ + { + type: 'tiktokExternalId', + id: 'f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc', + }, + ], + }, + messageId: '84e26acc-56a5-4835-8233-591137fca468', + session_id: '3049dc4c-5a95-4ccd-a3e7-d74a7e411f22', + originalTimestamp: '2019-10-14T09:03:17.562Z', + timestamp: '2020-09-17T19:49:27Z', + type: 'track', + event: 'SubscriBe', + properties: { + eventId: '1616318632825_357', + testEventCode: 'TEST0000000011', + context: { + page: { + url: 'http://demo.mywebsite.com/purchase', + referrer: 'http://demo.mywebsite.com', + }, + user: { + phone_number: '+918987674657', + email: 'sample@rudder.com', + }, + }, + contents: [ + { + price: 8, + quantity: 2, + content_type: 'socks', + content_id: '1077218', + }, + { + price: 30, + quantity: 1, + content_type: 'dress', + content_id: '1197218', + }, + ], + currency: 'USD', + value: 46, + }, + integrations: { + All: true, + }, + sentAt: '2019-10-14T09:03:22.563Z', + }, + destination: { + Config: { + accessToken: 'dummyAccessToken', + pixelCode: 'A1T8T4UYGVIQA8ORZMX9', + hashUserProperties: true, + }, + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://business-api.tiktok.com/open_api/v1.3/pixel/track/', + headers: { + 'Access-Token': 'dummyAccessToken', + 'Content-Type': 'application/json', + }, + params: {}, + body: { + JSON: { + pixel_code: 'A1T8T4UYGVIQA8ORZMX9', + event: 'Subscribe', + event_id: '1616318632825_357', + timestamp: '2020-09-17T19:49:27Z', + test_event_code: 'TEST0000000011', + properties: { + contents: [ + { + price: 8, + quantity: 2, + content_type: 'socks', + content_id: '1077218', + }, + { + price: 30, + quantity: 1, + content_type: 'dress', + content_id: '1197218', + }, + ], + currency: 'USD', + value: 46, + }, + context: { + page: { + url: 'http://demo.mywebsite.com/purchase', + referrer: 'http://demo.mywebsite.com', + }, + user: { + phone_number: + '1b6abcebb79b2208929967160ba291656f3fcd4f00e93b6a846c1e56c0e177c6', + email: '02e47a94635c1ffd6f6a69fe2c7a92dbfbb9d5e2ebddb54810520b34989b66a7', + external_id: + 'f0f3ec74bbef8580d7de80624dea93c05d828c748715199fe71bc7f5a67aa8b3', + }, + ip: '13.57.97.131', + user_agent: + 'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion', + }, + partner_name: 'RudderStack', + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'tiktok_ads', + description: 'Test 18', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + anonymousId: '21e13f4bc7ceddad', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + traits: { + email: 'user@sample.com', + phone: '+919912345678', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + userAgent: + 'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion', + locale: 'en-US', + ip: '13.57.97.131', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + externalId: [ + { + type: 'tiktokExternalId', + id: 'f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc', + }, + ], + }, + messageId: '84e26acc-56a5-4835-8233-591137fca468', + session_id: '3049dc4c-5a95-4ccd-a3e7-d74a7e411f22', + originalTimestamp: '2019-10-14T09:03:17.562Z', + timestamp: '2020-09-17T19:49:27Z', + type: 'track', + event: 'SubscriBe', + properties: { + eventId: '1616318632825_357', + testEventCode: 'TEST0000000011', + context: { + page: { + url: 'http://demo.mywebsite.com/purchase', + referrer: 'http://demo.mywebsite.com', + }, + user: { + phone_number: '', + email: '', + }, + }, + contents: [ + { + price: 8, + quantity: 2, + content_type: 'socks', + content_id: '1077218', + }, + { + price: 30, + quantity: 1, + content_type: 'dress', + content_id: '1197218', + }, + ], + currency: 'USD', + value: 46, + }, + integrations: { + All: true, + }, + sentAt: '2019-10-14T09:03:22.563Z', + }, + destination: { + Config: { + accessToken: 'dummyAccessToken', + pixelCode: 'A1T8T4UYGVIQA8ORZMX9', + hashUserProperties: true, + }, + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://business-api.tiktok.com/open_api/v1.3/pixel/track/', + headers: { + 'Access-Token': 'dummyAccessToken', + 'Content-Type': 'application/json', + }, + params: {}, + body: { + JSON: { + pixel_code: 'A1T8T4UYGVIQA8ORZMX9', + event: 'Subscribe', + event_id: '1616318632825_357', + timestamp: '2020-09-17T19:49:27Z', + test_event_code: 'TEST0000000011', + properties: { + contents: [ + { + price: 8, + quantity: 2, + content_type: 'socks', + content_id: '1077218', + }, + { + price: 30, + quantity: 1, + content_type: 'dress', + content_id: '1197218', + }, + ], + currency: 'USD', + value: 46, + }, + context: { + page: { + url: 'http://demo.mywebsite.com/purchase', + referrer: 'http://demo.mywebsite.com', + }, + user: { + phone_number: + '241102c24fa8a642e3d1346a31fbce3dd312563c015ae577a2253cb8652581eb', + email: 'a344da1fac6201ed1c1f20a07e1b55bb896a5ac0abd269c1e9daf1afbbffca3b', + external_id: + 'f0f3ec74bbef8580d7de80624dea93c05d828c748715199fe71bc7f5a67aa8b3', + }, + ip: '13.57.97.131', + user_agent: + 'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion', + }, + partner_name: 'RudderStack', + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'tiktok_ads', + description: 'Test 19', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + anonymousId: '21e13f4bc7ceddad', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + userAgent: + 'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion', + ip: '13.57.97.131', + locale: 'en-US', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + page: { + url: 'http://rudder.mywebsite.com/purchase', + referrer: 'http://rudder.mywebsite.com', + }, + externalId: [ + { + type: 'tiktokExternalId', + id: 'f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc', + }, + ], + }, + messageId: '84e26acc-56a5-4835-8233-591137fca468', + session_id: '3049dc4c-5a95-4ccd-a3e7-d74a7e411f22', + originalTimestamp: '2019-10-14T09:03:17.562Z', + timestamp: '2020-09-17T19:49:27Z', + type: 'track', + event: 'checkout step completed', + properties: { + eventId: '1616318632825_357', + contents: [ + { + price: 8, + quantity: 2, + content_type: 'socks', + content_id: '1077218', + }, + { + price: 30, + quantity: 1, + content_type: 'dress', + content_id: '1197218', + }, + ], + currency: 'USD', + value: 46, + context: { + user: { + phone_number: + '2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea', + email: 'dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f', + }, + }, + }, + integrations: { + All: true, + }, + sentAt: '2019-10-14T09:03:22.563Z', + }, + destination: { + Config: { + accessToken: 'dummyAccessToken', + pixelCode: 'A1T8T4UYGVIQA8ORZMX9', + hashUserProperties: false, + }, + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://business-api.tiktok.com/open_api/v1.3/pixel/track/', + headers: { + 'Access-Token': 'dummyAccessToken', + 'Content-Type': 'application/json', + }, + params: {}, + body: { + JSON: { + pixel_code: 'A1T8T4UYGVIQA8ORZMX9', + event: 'CompletePayment', + event_id: '1616318632825_357', + timestamp: '2020-09-17T19:49:27Z', + properties: { + contents: [ + { + price: 8, + quantity: 2, + content_type: 'socks', + content_id: '1077218', + }, + { + price: 30, + quantity: 1, + content_type: 'dress', + content_id: '1197218', + }, + ], + currency: 'USD', + value: 46, + }, + context: { + page: { + url: 'http://rudder.mywebsite.com/purchase', + referrer: 'http://rudder.mywebsite.com', + }, + user: { + phone_number: + '2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea', + email: 'dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f', + external_id: + 'f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc', + }, + ip: '13.57.97.131', + user_agent: + 'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion', + }, + partner_name: 'RudderStack', + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'tiktok_ads', + description: 'Test 20', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + anonymousId: '21e13f4bc7ceddad', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + userAgent: + 'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion', + ip: '13.57.97.131', + locale: 'en-US', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + externalId: [ + { + type: 'tiktokExternalId', + id: 'f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc', + }, + ], + }, + messageId: '84e26acc-56a5-4835-8233-591137fca468', + session_id: '3049dc4c-5a95-4ccd-a3e7-d74a7e411f22', + originalTimestamp: '2019-10-14T09:03:17.562Z', + timestamp: '2020-09-17T19:49:27Z', + type: 'track', + event: 'abc', + properties: { + eventId: '1616318632825_357', + contents: [ + { + price: 8, + quantity: 2, + content_type: 'socks', + content_id: '1077218', + }, + { + price: 30, + quantity: 1, + content_type: 'dress', + content_id: '1197218', + }, + ], + currency: 'USD', + value: 46, + context: { + page: { + url: 'http://demo.mywebsite.com/purchase', + referrer: 'http://demo.mywebsite.com', + }, + user: { + phone_number: + '2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea', + email: 'dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f', + }, + }, + }, + integrations: { + All: true, + }, + sentAt: '2019-10-14T09:03:22.563Z', + }, + destination: { + Config: { + accessToken: 'dummyAccessToken', + pixelCode: 'A1T8T4UYGVIQA8ORZMX9', + hashUserProperties: false, + eventsToStandard: [ + { + from: 'abc', + to: 'download', + }, + { + from: 'abc', + to: 'search', + }, + { + from: 'def', + to: 'search', + }, + ], + }, + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://business-api.tiktok.com/open_api/v1.3/pixel/track/', + headers: { + 'Access-Token': 'dummyAccessToken', + 'Content-Type': 'application/json', + }, + params: {}, + body: { + JSON: { + pixel_code: 'A1T8T4UYGVIQA8ORZMX9', + event: 'download', + event_id: '1616318632825_357', + timestamp: '2020-09-17T19:49:27Z', + properties: { + contents: [ + { + price: 8, + quantity: 2, + content_type: 'socks', + content_id: '1077218', + }, + { + price: 30, + quantity: 1, + content_type: 'dress', + content_id: '1197218', + }, + ], + currency: 'USD', + value: 46, + }, + context: { + page: { + url: 'http://demo.mywebsite.com/purchase', + referrer: 'http://demo.mywebsite.com', + }, + user: { + phone_number: + '2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea', + email: 'dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f', + external_id: + 'f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc', + }, + ip: '13.57.97.131', + user_agent: + 'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion', + }, + partner_name: 'RudderStack', + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + statusCode: 200, + }, + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://business-api.tiktok.com/open_api/v1.3/pixel/track/', + headers: { + 'Access-Token': 'dummyAccessToken', + 'Content-Type': 'application/json', + }, + params: {}, + body: { + JSON: { + pixel_code: 'A1T8T4UYGVIQA8ORZMX9', + event: 'search', + event_id: '1616318632825_357', + timestamp: '2020-09-17T19:49:27Z', + properties: { + contents: [ + { + price: 8, + quantity: 2, + content_type: 'socks', + content_id: '1077218', + }, + { + price: 30, + quantity: 1, + content_type: 'dress', + content_id: '1197218', + }, + ], + currency: 'USD', + value: 46, + }, + context: { + page: { + url: 'http://demo.mywebsite.com/purchase', + referrer: 'http://demo.mywebsite.com', + }, + user: { + phone_number: + '2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea', + email: 'dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f', + external_id: + 'f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc', + }, + ip: '13.57.97.131', + user_agent: + 'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion', + }, + partner_name: 'RudderStack', + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'tiktok_ads', + description: 'Test 21', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + anonymousId: '21e13f4bc7ceddad', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + userAgent: + 'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion', + ip: '13.57.97.131', + locale: 'en-US', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + externalId: [ + { + type: 'tiktokExternalId', + id: 'f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc', + }, + ], + }, + messageId: '84e26acc-56a5-4835-8233-591137fca468', + session_id: '3049dc4c-5a95-4ccd-a3e7-d74a7e411f22', + originalTimestamp: '2019-10-14T09:03:17.562Z', + timestamp: '2020-09-17T19:49:27Z', + type: 'track', + event: 'abc', + properties: { + eventId: '1616318632825_357', + contents: [ + { + price: 8, + quantity: 2, + content_type: 'socks', + content_id: '1077218', + }, + { + price: 30, + quantity: 1, + content_type: 'dress', + content_id: '1197218', + }, + ], + currency: 'USD', + value: 46, + context: { + page: { + url: 'http://demo.mywebsite.com/purchase', + referrer: 'http://demo.mywebsite.com', + }, + user: { + phone_number: + '2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea', + email: 'dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f', + }, + }, + }, + integrations: { + All: true, + }, + sentAt: '2019-10-14T09:03:22.563Z', + }, + destination: { + Config: { + accessToken: 'dummyAccessToken', + pixelCode: 'A1T8T4UYGVIQA8ORZMX9', + hashUserProperties: false, + eventsToStandard: [ + { + from: 'def', + to: 'download', + }, + ], + }, + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + statusCode: 400, + error: 'Event name (abc) is not valid, must be mapped to one of standard events', + statTags: { + errorCategory: 'dataValidation', + errorType: 'instrumentation', + destType: 'TIKTOK_ADS', + module: 'destination', + implementation: 'native', + feature: 'processor', + }, + }, + ], + }, + }, + }, + { + name: 'tiktok_ads', + description: 'Test 22', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + anonymousId: '21e13f4bc7ceddad', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + userAgent: + 'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion', + ip: '13.57.97.131', + locale: 'en-US', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + externalId: [ + { + type: 'tiktokExternalId', + id: 'f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc', + }, + ], + }, + messageId: '84e26acc-56a5-4835-8233-591137fca468', + session_id: '3049dc4c-5a95-4ccd-a3e7-d74a7e411f22', + originalTimestamp: '2019-10-14T09:03:17.562Z', + timestamp: '2020-09-17T19:49:27Z', + type: 'track', + event: 'abc', + properties: { + eventId: '1616318632825_357', + contents: [ + { + price: 8, + quantity: 2, + content_type: 'socks', + content_id: '1077218', + }, + { + price: 30, + quantity: 1, + content_type: 'dress', + content_id: '1197218', + }, + ], + currency: 'USD', + value: 46, + context: { + page: { + url: 'http://demo.mywebsite.com/purchase', + referrer: 'http://demo.mywebsite.com', + }, + user: { + phone_number: + '2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea', + email: 'dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f', + }, + }, + }, + integrations: { + All: true, + }, + sentAt: '2019-10-14T09:03:22.563Z', + }, + destination: { + Config: { + accessToken: 'dummyAccessToken', + pixelCode: 'A1T8T4UYGVIQA8ORZMX9', + hashUserProperties: false, + eventsToStandard: [ + { + from: 'abc', + to: 'download', + }, + { + from: 'def', + to: 'download', + }, + ], + }, + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://business-api.tiktok.com/open_api/v1.3/pixel/track/', + headers: { + 'Access-Token': 'dummyAccessToken', + 'Content-Type': 'application/json', + }, + params: {}, + body: { + JSON: { + pixel_code: 'A1T8T4UYGVIQA8ORZMX9', + event: 'download', + event_id: '1616318632825_357', + timestamp: '2020-09-17T19:49:27Z', + properties: { + contents: [ + { + price: 8, + quantity: 2, + content_type: 'socks', + content_id: '1077218', + }, + { + price: 30, + quantity: 1, + content_type: 'dress', + content_id: '1197218', + }, + ], + currency: 'USD', + value: 46, + }, + context: { + page: { + url: 'http://demo.mywebsite.com/purchase', + referrer: 'http://demo.mywebsite.com', + }, + user: { + phone_number: + '2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea', + email: 'dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f', + external_id: + 'f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc', + }, + ip: '13.57.97.131', + user_agent: + 'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion', + }, + partner_name: 'RudderStack', + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'tiktok_ads', + description: 'Test 23', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + anonymousId: '21e13f4bc7ceddad', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + userAgent: + 'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion', + ip: '13.57.97.131', + locale: 'en-US', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + externalId: [ + { + type: 'tiktokExternalId', + id: 'f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc', + }, + ], + }, + messageId: '84e26acc-56a5-4835-8233-591137fca468', + session_id: '3049dc4c-5a95-4ccd-a3e7-d74a7e411f22', + originalTimestamp: '2019-10-14T09:03:17.562Z', + timestamp: '2020-09-17T19:49:27Z', + type: 'track', + event: 'abc', + properties: { + eventId: '1616318632825_357', + contents: [ + { + price: 8, + quantity: 2, + content_type: 'socks', + content_id: '1077218', + }, + { + price: 30, + quantity: 1, + content_type: 'dress', + content_id: '1197218', + }, + ], + currency: 'USD', + value: 46, + context: { + page: { + url: 'http://demo.mywebsite.com/purchase', + referrer: 'http://demo.mywebsite.com', + }, + user: { + phone_number: '+371234567890123', + email: 'sample@sample.com', + }, + }, + }, + integrations: { + All: true, + }, + sentAt: '2019-10-14T09:03:22.563Z', + }, + destination: { + Config: { + accessToken: 'dummyAccessToken', + pixelCode: 'A1T8T4UYGVIQA8ORZMX9', + hashUserProperties: true, + eventsToStandard: [ + { + from: 'abc', + to: 'download', + }, + { + from: 'def', + to: 'download', + }, + ], + }, + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://business-api.tiktok.com/open_api/v1.3/pixel/track/', + headers: { + 'Access-Token': 'dummyAccessToken', + 'Content-Type': 'application/json', + }, + params: {}, + body: { + JSON: { + pixel_code: 'A1T8T4UYGVIQA8ORZMX9', + event: 'download', + event_id: '1616318632825_357', + timestamp: '2020-09-17T19:49:27Z', + properties: { + contents: [ + { + price: 8, + quantity: 2, + content_type: 'socks', + content_id: '1077218', + }, + { + price: 30, + quantity: 1, + content_type: 'dress', + content_id: '1197218', + }, + ], + currency: 'USD', + value: 46, + }, + context: { + page: { + url: 'http://demo.mywebsite.com/purchase', + referrer: 'http://demo.mywebsite.com', + }, + user: { + phone_number: + '6080191ec608e10062e9257702cbca694cfe1bfa53944ba5701119d8f8b99ad6', + email: '774efc08cebab8c50c0f0eb2d3a2d2e560872a64f6c1617314c4f03b1c3d4dfa', + external_id: + 'f0f3ec74bbef8580d7de80624dea93c05d828c748715199fe71bc7f5a67aa8b3', + }, + ip: '13.57.97.131', + user_agent: + 'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion', + }, + partner_name: 'RudderStack', + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'tiktok_ads', + description: 'Test 24', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + anonymousId: '21e13f4bc7ceddad', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + userAgent: + 'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion', + ip: '13.57.97.131', + locale: 'en-US', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + externalId: [ + { + type: 'tiktokExternalId', + id: 'f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc', + }, + ], + }, + messageId: '84e26acc-56a5-4835-8233-591137fca468', + session_id: '3049dc4c-5a95-4ccd-a3e7-d74a7e411f22', + originalTimestamp: '2019-10-14T09:03:17.562Z', + timestamp: '2020-09-17T19:49:27Z', + type: 'track', + event: 'abc', + properties: { + eventId: '1616318632825_357', + contents: [ + { + price: 8, + quantity: 2, + content_type: 'socks', + content_id: '1077218', + }, + { + price: 30, + quantity: 1, + content_type: 'dress', + content_id: '1197218', + }, + ], + currency: 'USD', + value: 46, + context: { + page: { + url: 'http://demo.mywebsite.com/purchase', + referrer: 'http://demo.mywebsite.com', + }, + user: { + phone_number: '+3712345678', + email: 'sample@sample.com', + }, + }, + }, + integrations: { + All: true, + }, + sentAt: '2019-10-14T09:03:22.563Z', + }, + destination: { + Config: { + accessToken: 'dummyAccessToken', + pixelCode: 'A1T8T4UYGVIQA8ORZMX9', + hashUserProperties: true, + eventsToStandard: [ + { + from: 'abc', + to: 'download', + }, + { + from: 'def', + to: 'download', + }, + ], + }, + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://business-api.tiktok.com/open_api/v1.3/pixel/track/', + headers: { + 'Access-Token': 'dummyAccessToken', + 'Content-Type': 'application/json', + }, + params: {}, + body: { + JSON: { + pixel_code: 'A1T8T4UYGVIQA8ORZMX9', + event: 'download', + event_id: '1616318632825_357', + timestamp: '2020-09-17T19:49:27Z', + properties: { + contents: [ + { + price: 8, + quantity: 2, + content_type: 'socks', + content_id: '1077218', + }, + { + price: 30, + quantity: 1, + content_type: 'dress', + content_id: '1197218', + }, + ], + currency: 'USD', + value: 46, + }, + context: { + page: { + url: 'http://demo.mywebsite.com/purchase', + referrer: 'http://demo.mywebsite.com', + }, + user: { + phone_number: + '6e6c1bb39126b3ecf537e62847909b1372a1a22de9b28d85960e12c78f322035', + email: '774efc08cebab8c50c0f0eb2d3a2d2e560872a64f6c1617314c4f03b1c3d4dfa', + external_id: + 'f0f3ec74bbef8580d7de80624dea93c05d828c748715199fe71bc7f5a67aa8b3', + }, + ip: '13.57.97.131', + user_agent: + 'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion', + }, + partner_name: 'RudderStack', + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'tiktok_ads', + description: 'Test 25', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + anonymousId: '21e13f4bc7ceddad', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + userAgent: + 'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion', + ip: '13.57.97.131', + locale: 'en-US', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + externalId: [ + { + type: 'tiktokExternalId', + id: 'f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc', + }, + ], + }, + messageId: '84e26acc-56a5-4835-8233-591137fca468', + session_id: '3049dc4c-5a95-4ccd-a3e7-d74a7e411f22', + originalTimestamp: '2019-10-14T09:03:17.562Z', + timestamp: '2020-09-17T19:49:27Z', + type: 'track', + event: 'checkout step completed', + properties: { + eventId: '1616318632825_357', + contents: [ + { + price: 8, + quantity: 2, + content_type: 'socks', + content_id: '1077218', + }, + { + price: 30, + quantity: 1, + content_type: 'dress', + content_id: '1197218', + }, + ], + products: [ + { + product_id: 123, + sku: 'G-32', + name: 'Monopoly', + price: 14, + quantity: 1, + category: 'Games', + url: 'https://www.website.com/product/path', + image_url: 'https://www.website.com/product/path.jpg', + }, + { + product_id: '345', + sku: 'F-32', + name: 'UNO', + price: 3.45, + quantity: 2, + category: 'Games', + }, + ], + currency: 'USD', + value: 46, + context: { + page: { + url: 'http://demo.mywebsite.com/purchase', + referrer: 'http://demo.mywebsite.com', + }, + user: { + phone_number: + '2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea', + email: 'dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f', + }, + }, + }, + integrations: { + All: true, + }, + sentAt: '2019-10-14T09:03:22.563Z', + }, + destination: { + Config: { + accessToken: 'dummyAccessToken', + pixelCode: 'A1T8T4UYGVIQA8ORZMX9', + hashUserProperties: false, + }, + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://business-api.tiktok.com/open_api/v1.3/pixel/track/', + headers: { + 'Access-Token': 'dummyAccessToken', + 'Content-Type': 'application/json', + }, + params: {}, + body: { + JSON: { + pixel_code: 'A1T8T4UYGVIQA8ORZMX9', + event: 'CompletePayment', + event_id: '1616318632825_357', + timestamp: '2020-09-17T19:49:27Z', + properties: { + contents: [ + { + price: 8, + quantity: 2, + content_type: 'socks', + content_id: '1077218', + }, + { + price: 30, + quantity: 1, + content_type: 'dress', + content_id: '1197218', + }, + ], + currency: 'USD', + value: 46, + }, + context: { + page: { + url: 'http://demo.mywebsite.com/purchase', + referrer: 'http://demo.mywebsite.com', + }, + user: { + phone_number: + '2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea', + email: 'dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f', + external_id: + 'f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc', + }, + ip: '13.57.97.131', + user_agent: + 'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion', + }, + partner_name: 'RudderStack', + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'tiktok_ads', + description: 'Test 26', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + anonymousId: '21e13f4bc7ceddad', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + userAgent: + 'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion', + ip: '13.57.97.131', + locale: 'en-US', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + externalId: [ + { + type: 'tiktokExternalId', + id: 'f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc', + }, + ], + }, + messageId: '84e26acc-56a5-4835-8233-591137fca468', + session_id: '3049dc4c-5a95-4ccd-a3e7-d74a7e411f22', + originalTimestamp: '2019-10-14T09:03:17.562Z', + timestamp: '2020-09-17T19:49:27Z', + type: 'track', + event: 'checkout step completed', + properties: { + eventId: '1616318632825_357', + products: [ + { + product_id: 123, + sku: 'G-32', + name: 'Monopoly', + price: 14, + quantity: 1, + contentType: 'product_group', + category: 'Games', + url: 'https://www.website.com/product/path', + image_url: 'https://www.website.com/product/path.jpg', + }, + { + product_id: 345, + sku: 'F-32', + name: 'UNO', + price: 3.45, + contentType: 'product_group', + quantity: 2, + }, + ], + currency: 'USD', + value: 46, + context: { + page: { + url: 'http://demo.mywebsite.com/purchase', + referrer: 'http://demo.mywebsite.com', + }, + user: { + phone_number: + '2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea', + email: 'dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f', + }, + }, + }, + integrations: { + All: true, + }, + sentAt: '2019-10-14T09:03:22.563Z', + }, + destination: { + Config: { + accessToken: 'dummyAccessToken', + pixelCode: 'A1T8T4UYGVIQA8ORZMX9', + hashUserProperties: false, + }, + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://business-api.tiktok.com/open_api/v1.3/pixel/track/', + headers: { + 'Access-Token': 'dummyAccessToken', + 'Content-Type': 'application/json', + }, + params: {}, + body: { + JSON: { + pixel_code: 'A1T8T4UYGVIQA8ORZMX9', + event: 'CompletePayment', + event_id: '1616318632825_357', + timestamp: '2020-09-17T19:49:27Z', + properties: { + currency: 'USD', + value: 46, + contents: [ + { + content_type: 'product_group', + content_id: '123', + content_category: 'Games', + content_name: 'Monopoly', + price: 14, + quantity: 1, + }, + { + content_type: 'product_group', + content_id: '345', + content_name: 'UNO', + price: 3.45, + quantity: 2, + }, + ], + }, + context: { + page: { + url: 'http://demo.mywebsite.com/purchase', + referrer: 'http://demo.mywebsite.com', + }, + user: { + phone_number: + '2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea', + email: 'dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f', + external_id: + 'f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc', + }, + ip: '13.57.97.131', + user_agent: + 'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion', + }, + partner_name: 'RudderStack', + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'tiktok_ads', + description: 'Test 27', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + anonymousId: '21e13f4bc7ceddad', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + userAgent: + 'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion', + ip: '13.57.97.131', + locale: 'en-US', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + externalId: [ + { + type: 'tiktokExternalId', + id: 'f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc', + }, + ], + }, + messageId: '84e26acc-56a5-4835-8233-591137fca468', + session_id: '3049dc4c-5a95-4ccd-a3e7-d74a7e411f22', + originalTimestamp: '2019-10-14T09:03:17.562Z', + timestamp: '2020-09-17T19:49:27Z', + type: 'track', + event: 'checkout step completed', + properties: { + eventId: '1616318632825_357', + products: [ + { + contentType: 'product_group', + product_id: '123', + sku: 'G-32', + name: 'Monopoly', + price: 14, + quantity: 1, + category: 'Games', + url: 'https://www.website.com/product/path', + image_url: 'https://www.website.com/product/path.jpg', + }, + { + contentType: 'product_group', + product_id: '345', + sku: 'F-32', + name: 'UNO', + price: 3.45, + quantity: 2, + category: 'Games', + }, + ], + currency: 'USD', + value: 46, + context: { + page: { + url: 'http://demo.mywebsite.com/purchase', + referrer: 'http://demo.mywebsite.com', + }, + user: { + phone_number: + '2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea', + email: 'dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f', + }, + }, + }, + integrations: { + All: true, + }, + sentAt: '2019-10-14T09:03:22.563Z', + }, + destination: { + Config: { + accessToken: 'dummyAccessToken', + pixelCode: 'A1T8T4UYGVIQA8ORZMX9', + hashUserProperties: false, + }, + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://business-api.tiktok.com/open_api/v1.3/pixel/track/', + headers: { + 'Access-Token': 'dummyAccessToken', + 'Content-Type': 'application/json', + }, + params: {}, + body: { + JSON: { + pixel_code: 'A1T8T4UYGVIQA8ORZMX9', + event: 'CompletePayment', + event_id: '1616318632825_357', + timestamp: '2020-09-17T19:49:27Z', + properties: { + currency: 'USD', + value: 46, + contents: [ + { + content_type: 'product_group', + content_id: '123', + content_category: 'Games', + content_name: 'Monopoly', + price: 14, + quantity: 1, + }, + { + content_type: 'product_group', + content_id: '345', + content_category: 'Games', + content_name: 'UNO', + price: 3.45, + quantity: 2, + }, + ], + }, + context: { + page: { + url: 'http://demo.mywebsite.com/purchase', + referrer: 'http://demo.mywebsite.com', + }, + user: { + phone_number: + '2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea', + email: 'dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f', + external_id: + 'f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc', + }, + ip: '13.57.97.131', + user_agent: + 'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion', + }, + partner_name: 'RudderStack', + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'tiktok_ads', + description: 'Test 28', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + anonymousId: '21e13f4bc7ceddad', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + userAgent: + 'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion', + ip: '13.57.97.131', + locale: 'en-US', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + externalId: [ + { + type: 'tiktokExternalId', + id: 'f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc', + }, + ], + }, + messageId: '84e26acc-56a5-4835-8233-591137fca468', + session_id: '3049dc4c-5a95-4ccd-a3e7-d74a7e411f22', + originalTimestamp: '2019-10-14T09:03:17.562Z', + timestamp: '2020-09-17T19:49:27Z', + type: 'track', + event: 'checkout step completed', + properties: { + category: 'Urban', + status: 'processed', + name: 'games', + contentType: 'product_group', + productId: 'qqw21221341234', + eventId: '1616318632825_357', + products: [ + { + product_id: '123', + sku: 'G-32', + name: 'Monopoly', + price: 14, + quantity: 1, + category: 'Games', + url: 'https://www.website.com/product/path', + image_url: 'https://www.website.com/product/path.jpg', + }, + { + product_id: '345', + sku: 'F-32', + name: 'UNO', + price: 3.45, + quantity: 2, + category: 'Games', + }, + ], + currency: 'USD', + value: 46, + context: { + page: { + url: 'http://demo.mywebsite.com/purchase', + referrer: 'http://demo.mywebsite.com', + }, + user: { + phone_number: + '2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea', + email: 'dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f', + }, + }, + }, + integrations: { + All: true, + }, + sentAt: '2019-10-14T09:03:22.563Z', + }, + destination: { + Config: { + accessToken: 'dummyAccessToken', + pixelCode: 'A1T8T4UYGVIQA8ORZMX9', + hashUserProperties: false, + }, + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://business-api.tiktok.com/open_api/v1.3/pixel/track/', + headers: { + 'Access-Token': 'dummyAccessToken', + 'Content-Type': 'application/json', + }, + params: {}, + body: { + JSON: { + pixel_code: 'A1T8T4UYGVIQA8ORZMX9', + event: 'CompletePayment', + event_id: '1616318632825_357', + timestamp: '2020-09-17T19:49:27Z', + properties: { + content_category: 'Urban', + status: 'processed', + content_name: 'games', + content_id: 'qqw21221341234', + content_type: 'product_group', + currency: 'USD', + value: 46, + contents: [ + { + content_type: 'product_group', + content_id: '123', + content_category: 'Games', + content_name: 'Monopoly', + price: 14, + quantity: 1, + }, + { + content_type: 'product_group', + content_id: '345', + content_category: 'Games', + content_name: 'UNO', + price: 3.45, + quantity: 2, + }, + ], + }, + context: { + page: { + url: 'http://demo.mywebsite.com/purchase', + referrer: 'http://demo.mywebsite.com', + }, + user: { + phone_number: + '2f9d2b4df907e5c9a7b3434351b55700167b998a83dc479b825096486ffcf4ea', + email: 'dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f', + external_id: + 'f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc', + }, + ip: '13.57.97.131', + user_agent: + 'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion', + }, + partner_name: 'RudderStack', + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, +]; diff --git a/test/integrations/destinations/tiktok_ads/router/data.ts b/test/integrations/destinations/tiktok_ads/router/data.ts index 60bb5628ca..a8c233c7a8 100644 --- a/test/integrations/destinations/tiktok_ads/router/data.ts +++ b/test/integrations/destinations/tiktok_ads/router/data.ts @@ -52,6 +52,7 @@ export const data = [ event: 'checkout step completed', properties: { eventId: '1616318632825_357', + clickId: 'dummyClickId', contents: [ { price: 8, @@ -69,9 +70,6 @@ export const data = [ currency: 'USD', value: 46.0, context: { - ad: { - callback: '123ATXSfe', - }, page: { url: 'http://demo.mywebsite.com/purchase', referrer: 'http://demo.mywebsite.com', @@ -141,9 +139,6 @@ export const data = [ properties: { eventId: '1616318632825_357', context: { - ad: { - callback: '123ATXSfe', - }, page: { url: 'http://demo.mywebsite.com/purchase', referrer: 'http://demo.mywebsite.com', @@ -229,9 +224,6 @@ export const data = [ properties: { eventId: '1616318632825_357', context: { - ad: { - callback: '123ATXSfe', - }, page: { url: 'http://demo.mywebsite.com/purchase', referrer: 'http://demo.mywebsite.com', @@ -320,9 +312,6 @@ export const data = [ properties: { eventId: '1616318632825_357', context: { - ad: { - callback: '123ATXSfe', - }, page: { url: 'http://demo.mywebsite.com/purchase', referrer: 'http://demo.mywebsite.com', @@ -421,7 +410,7 @@ export const data = [ }, context: { ad: { - callback: '123ATXSfe', + callback: 'dummyClickId', }, page: { url: 'http://demo.mywebsite.com/purchase', @@ -446,9 +435,6 @@ export const data = [ type: 'track', timestamp: '2020-09-17T19:49:27Z', context: { - ad: { - callback: '123ATXSfe', - }, ip: '13.57.97.131', page: { url: 'http://demo.mywebsite.com/purchase', @@ -490,9 +476,6 @@ export const data = [ type: 'track', timestamp: '2020-09-17T19:49:27Z', context: { - ad: { - callback: '123ATXSfe', - }, ip: '13.57.97.131', page: { url: 'http://demo.mywebsite.com/purchase', @@ -534,9 +517,6 @@ export const data = [ type: 'track', timestamp: '2020-09-17T19:49:27Z', context: { - ad: { - callback: '123ATXSfe', - }, ip: '13.57.97.131', page: { url: 'http://demo.mywebsite.com/purchase', @@ -662,9 +642,6 @@ export const data = [ eventId: '1616318632825_357', testEventCode: 'sample rudder test_event_code', context: { - ad: { - callback: '123ATXSfe', - }, page: { url: 'http://demo.mywebsite.com/purchase', referrer: 'http://demo.mywebsite.com', @@ -729,9 +706,6 @@ export const data = [ FORM: {}, JSON: { context: { - ad: { - callback: '123ATXSfe', - }, ip: '13.57.97.131', page: { referrer: 'http://demo.mywebsite.com', diff --git a/test/integrations/destinations/userlist/processor/data.ts b/test/integrations/destinations/userlist/processor/data.ts new file mode 100644 index 0000000000..f07006b186 --- /dev/null +++ b/test/integrations/destinations/userlist/processor/data.ts @@ -0,0 +1,894 @@ +export const data = [ + { + name: 'userlist', + description: 'Test 0', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + Config: { + pushKey: 'userlist-push-key', + }, + }, + message: { + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + traits: { + anonymousId: '123456', + email: 'test@rudderstack.com', + address: { + city: 'kolkata', + country: 'India', + postalCode: 712136, + state: 'WB', + street: '', + }, + ip: '0.0.0.0', + age: 26, + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36', + locale: 'en-US', + ip: '0.0.0.0', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + }, + user_properties: { + prop1: 'val1', + prop2: 'val2', + }, + type: 'identify', + messageId: '84e26acc-56a5-4835-8233-591137fca468', + originalTimestamp: '2019-10-14T09:03:17.562Z', + anonymousId: '123456', + userId: '123456', + integrations: { + All: true, + }, + traits: { + anonymousId: 'anon-id', + email: 'test@gmail.com', + address: { + city: 'NY', + country: 'USA', + postalCode: 712136, + state: 'CA', + street: '', + }, + }, + sentAt: '2019-10-14T09:03:22.563Z', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + body: { + XML: {}, + JSON_ARRAY: {}, + JSON: { + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + traits: { + anonymousId: '123456', + email: 'test@rudderstack.com', + address: { + city: 'kolkata', + country: 'India', + postalCode: 712136, + state: 'WB', + street: '', + }, + ip: '0.0.0.0', + age: 26, + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36', + locale: 'en-US', + ip: '0.0.0.0', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + }, + user_properties: { + prop1: 'val1', + prop2: 'val2', + }, + type: 'identify', + messageId: '84e26acc-56a5-4835-8233-591137fca468', + originalTimestamp: '2019-10-14T09:03:17.562Z', + anonymousId: '123456', + userId: '123456', + integrations: { + All: true, + }, + traits: { + anonymousId: 'anon-id', + email: 'test@gmail.com', + address: { + city: 'NY', + country: 'USA', + postalCode: 712136, + state: 'CA', + street: '', + }, + }, + sentAt: '2019-10-14T09:03:22.563Z', + }, + FORM: {}, + }, + files: {}, + endpoint: 'https://incoming.userlist.com/rudderstack/events', + headers: { + Authorization: 'Push userlist-push-key', + 'Content-Type': 'application/json', + }, + version: '1', + params: {}, + type: 'REST', + method: 'POST', + userId: '', + }, + statusCode: 200, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + }, + { + name: 'userlist', + description: 'Test 1', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + Config: { + pushKey: 'userlist-push-key', + }, + }, + message: { + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.1.5', + }, + traits: { + name: 'Shehan Study', + category: 'SampleIdentify', + email: 'test@rudderstack.com', + plan: 'Open source', + logins: 5, + createdAt: 1599264000, + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.1.5', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36', + locale: 'en-US', + os: { + name: '', + version: '', + }, + screen: { + density: 0.8999999761581421, + }, + campaign: { + source: 'google', + medium: 'medium', + term: 'keyword', + content: 'some content', + name: 'some campaign', + test: 'other value', + }, + page: { + path: '/html/sajal.html', + referrer: '', + search: + '?utm_source=google&utm_medium=medium&utm_term=keyword&utm_content=some%20content&utm_campaign=some%20campaign&utm_test=other%20value', + title: '', + url: 'http://localhost:9116/html/sajal.html?utm_source=google&utm_medium=medium&utm_term=keyword&utm_content=some%20content&utm_campaign=some%20campaign&utm_test=other%20value', + }, + }, + type: 'group', + messageId: 'e5034df0-a404-47b4-a463-76df99934fea', + originalTimestamp: '2020-10-20T07:54:58.983Z', + anonymousId: 'my-anonymous-id-new', + userId: 'sampleusrRudder3', + integrations: { + All: true, + }, + groupId: 'Sample_groupId23', + traits: { + KEY_3: { + CHILD_KEY_92: 'value_95', + CHILD_KEY_102: 'value_103', + }, + KEY_2: { + CHILD_KEY_92: 'value_95', + CHILD_KEY_102: 'value_103', + }, + name_trait: 'Company', + value_trait: ['Comapny-ABC'], + }, + sentAt: '2020-10-20T07:54:58.983Z', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + body: { + XML: {}, + JSON_ARRAY: {}, + JSON: { + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.1.5', + }, + traits: { + name: 'Shehan Study', + category: 'SampleIdentify', + email: 'test@rudderstack.com', + plan: 'Open source', + logins: 5, + createdAt: 1599264000, + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.1.5', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36', + locale: 'en-US', + os: { + name: '', + version: '', + }, + screen: { + density: 0.8999999761581421, + }, + campaign: { + source: 'google', + medium: 'medium', + term: 'keyword', + content: 'some content', + name: 'some campaign', + test: 'other value', + }, + page: { + path: '/html/sajal.html', + referrer: '', + search: + '?utm_source=google&utm_medium=medium&utm_term=keyword&utm_content=some%20content&utm_campaign=some%20campaign&utm_test=other%20value', + title: '', + url: 'http://localhost:9116/html/sajal.html?utm_source=google&utm_medium=medium&utm_term=keyword&utm_content=some%20content&utm_campaign=some%20campaign&utm_test=other%20value', + }, + }, + type: 'group', + messageId: 'e5034df0-a404-47b4-a463-76df99934fea', + originalTimestamp: '2020-10-20T07:54:58.983Z', + anonymousId: 'my-anonymous-id-new', + userId: 'sampleusrRudder3', + integrations: { + All: true, + }, + groupId: 'Sample_groupId23', + traits: { + KEY_3: { + CHILD_KEY_92: 'value_95', + CHILD_KEY_102: 'value_103', + }, + KEY_2: { + CHILD_KEY_92: 'value_95', + CHILD_KEY_102: 'value_103', + }, + name_trait: 'Company', + value_trait: ['Comapny-ABC'], + }, + sentAt: '2020-10-20T07:54:58.983Z', + }, + FORM: {}, + }, + files: {}, + endpoint: 'https://incoming.userlist.com/rudderstack/events', + headers: { + Authorization: 'Push userlist-push-key', + 'Content-Type': 'application/json', + }, + version: '1', + params: {}, + type: 'REST', + method: 'POST', + userId: '', + }, + statusCode: 200, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + }, + { + name: 'userlist', + description: 'Test 2', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + Config: { + pushKey: 'userlist-push-key', + }, + }, + message: { + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + traits: { + email: 'test@rudderstack.com', + anonymousId: '12345', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36', + locale: 'en-US', + ip: '0.0.0.0', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + }, + type: 'track', + messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', + originalTimestamp: '2019-10-14T11:15:18.300Z', + anonymousId: '00000000000000000000000000', + userId: '12345', + event: 'test track event', + properties: { + user_actual_role: 'system_admin', + user_actual_id: 12345, + user_time_spent: 50000, + }, + integrations: { + All: true, + }, + sentAt: '2019-10-14T11:15:53.296Z', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + body: { + XML: {}, + JSON_ARRAY: {}, + JSON: { + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + traits: { + email: 'test@rudderstack.com', + anonymousId: '12345', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36', + locale: 'en-US', + ip: '0.0.0.0', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + }, + type: 'track', + messageId: 'ec5481b6-a926-4d2e-b293-0b3a77c4d3be', + originalTimestamp: '2019-10-14T11:15:18.300Z', + anonymousId: '00000000000000000000000000', + userId: '12345', + event: 'test track event', + properties: { + user_actual_role: 'system_admin', + user_actual_id: 12345, + user_time_spent: 50000, + }, + integrations: { + All: true, + }, + sentAt: '2019-10-14T11:15:53.296Z', + }, + FORM: {}, + }, + files: {}, + endpoint: 'https://incoming.userlist.com/rudderstack/events', + headers: { + Authorization: 'Push userlist-push-key', + 'Content-Type': 'application/json', + }, + version: '1', + params: {}, + type: 'REST', + method: 'POST', + userId: '', + }, + statusCode: 200, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + }, + { + name: 'userlist', + description: 'Test 2', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + Config: { + pushKey: 'userlist-push-key', + }, + }, + message: { + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + traits: { + anonymousId: '123456', + email: 'test@rudderstack.com', + address: { + city: 'kolkata', + country: 'India', + postalCode: 712136, + state: 'WB', + street: '', + }, + ip: '0.0.0.0', + age: 26, + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36', + locale: 'en-US', + ip: '0.0.0.0', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + }, + user_properties: { + prop1: 'val1', + prop2: 'val2', + }, + type: 'identify', + messageId: '84e26acc-56a5-4835-8233-591137fca468', + originalTimestamp: '2019-10-14T09:03:17.562Z', + anonymousId: '123456', + integrations: { + All: true, + }, + traits: { + anonymousId: 'anon-id', + email: 'test@gmail.com', + address: { + city: 'NY', + country: 'USA', + postalCode: 712136, + state: 'CA', + street: '', + }, + }, + sentAt: '2019-10-14T09:03:22.563Z', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + statusCode: 400, + error: + 'userId is required: Workflow: procWorkflow, Step: preparePayload, ChildStep: undefined, OriginalError: userId is required', + statTags: { + errorCategory: 'dataValidation', + errorType: 'instrumentation', + destType: 'USERLIST', + module: 'destination', + implementation: 'cdkV2', + destinationId: 'destId', + workspaceId: 'wspId', + feature: 'processor', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + }, + { + name: 'userlist', + description: 'Test 2', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + Config: { + pushKey: 'userlist-push-key', + }, + }, + message: { + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + traits: { + anonymousId: '123456', + email: 'test@rudderstack.com', + address: { + city: 'kolkata', + country: 'India', + postalCode: 712136, + state: 'WB', + street: '', + }, + ip: '0.0.0.0', + age: 26, + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36', + locale: 'en-US', + ip: '0.0.0.0', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + }, + user_properties: { + prop1: 'val1', + prop2: 'val2', + }, + type: 'identify', + messageId: '84e26acc-56a5-4835-8233-591137fca468', + originalTimestamp: '2019-10-14T09:03:17.562Z', + anonymousId: '123456', + integrations: { + All: true, + }, + traits: { + anonymousId: 'anon-id', + email: 'test@gmail.com', + address: { + city: 'NY', + country: 'USA', + postalCode: 712136, + state: 'CA', + street: '', + }, + }, + sentAt: '2019-10-14T09:03:22.563Z', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + statusCode: 400, + error: + 'userId is required: Workflow: procWorkflow, Step: preparePayload, ChildStep: undefined, OriginalError: userId is required', + statTags: { + errorCategory: 'dataValidation', + errorType: 'instrumentation', + destType: 'USERLIST', + module: 'destination', + implementation: 'cdkV2', + destinationId: 'destId', + workspaceId: 'wspId', + feature: 'processor', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + }, + { + name: 'userlist', + description: 'Test 2', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + Config: { + pushKey: 'userlist-push-key', + }, + }, + message: { + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + traits: { + anonymousId: '123456', + email: 'test@rudderstack.com', + address: { + city: 'kolkata', + country: 'India', + postalCode: 712136, + state: 'WB', + street: '', + }, + ip: '0.0.0.0', + age: 26, + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36', + locale: 'en-US', + ip: '0.0.0.0', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + }, + user_properties: { + prop1: 'val1', + prop2: 'val2', + }, + type: 'page', + messageId: '84e26acc-56a5-4835-8233-591137fca468', + originalTimestamp: '2019-10-14T09:03:17.562Z', + anonymousId: '123456', + integrations: { + All: true, + }, + traits: { + anonymousId: 'anon-id', + email: 'test@gmail.com', + address: { + city: 'NY', + country: 'USA', + postalCode: 712136, + state: 'CA', + street: '', + }, + }, + sentAt: '2019-10-14T09:03:22.563Z', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + statusCode: 400, + error: + 'message type page is not supported: Workflow: procWorkflow, Step: validateInput, ChildStep: undefined, OriginalError: message type page is not supported', + statTags: { + errorCategory: 'dataValidation', + errorType: 'instrumentation', + destType: 'USERLIST', + module: 'destination', + implementation: 'cdkV2', + destinationId: 'destId', + workspaceId: 'wspId', + feature: 'processor', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + }, +]; diff --git a/test/integrations/destinations/vitally/processor/data.ts b/test/integrations/destinations/vitally/processor/data.ts new file mode 100644 index 0000000000..2c3fdd3297 --- /dev/null +++ b/test/integrations/destinations/vitally/processor/data.ts @@ -0,0 +1,300 @@ +export const data = [ + { + name: 'vitally', + description: 'Test 0', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + apiKeyVitally: 'abc123', + }, + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + }, + message: { + userId: '0220c056-934e-11ed-a1eb-0242ac120002', + event: 'this is a track event', + type: 'track', + properties: { + thing: 'amazing!', + }, + originalTimestamp: '2023-01-13T09:03:17.562Z', + sentAt: '2023-01-13T09:03:17.562Z', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + body: { + FORM: {}, + JSON_ARRAY: {}, + XML: {}, + JSON: { + userId: '0220c056-934e-11ed-a1eb-0242ac120002', + event: 'this is a track event', + type: 'track', + properties: { + thing: 'amazing!', + }, + originalTimestamp: '2023-01-13T09:03:17.562Z', + sentAt: '2023-01-13T09:03:17.562Z', + }, + }, + endpoint: 'https://api.vitally.io/rudderstack', + files: {}, + params: {}, + type: 'REST', + version: '1', + method: 'POST', + userId: '', + headers: { + authorization: 'Basic abc123', + 'content-type': 'application/json', + }, + }, + statusCode: 200, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + }, + { + name: 'vitally', + description: 'Test 1', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + apiKeyVitally: 'abc123', + }, + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + }, + message: { + userId: '0220c056-934e-11ed-a1eb-0242ac120002', + type: 'identify', + traits: { + name: 'Johnny Appleseed', + }, + originalTimestamp: '2023-01-13T09:03:17.562Z', + sentAt: '2023-01-13T09:03:17.562Z', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + body: { + FORM: {}, + JSON_ARRAY: {}, + XML: {}, + JSON: { + userId: '0220c056-934e-11ed-a1eb-0242ac120002', + type: 'identify', + traits: { + name: 'Johnny Appleseed', + }, + originalTimestamp: '2023-01-13T09:03:17.562Z', + sentAt: '2023-01-13T09:03:17.562Z', + }, + }, + endpoint: 'https://api.vitally.io/rudderstack', + files: {}, + params: {}, + type: 'REST', + version: '1', + method: 'POST', + userId: '', + headers: { + authorization: 'Basic abc123', + 'content-type': 'application/json', + }, + }, + statusCode: 200, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + }, + { + name: 'vitally', + description: 'Test 1', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + apiKeyVitally: 'abc123', + }, + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + }, + message: { + userId: '0220c056-934e-11ed-a1eb-0242ac120002', + type: 'group', + groupId: '5de17322-934e-11ed-a1eb-0242ac120002', + originalTimestamp: '2023-01-13T09:03:17.562Z', + sentAt: '2023-01-13T09:03:17.562Z', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + body: { + FORM: {}, + JSON_ARRAY: {}, + XML: {}, + JSON: { + userId: '0220c056-934e-11ed-a1eb-0242ac120002', + type: 'group', + groupId: '5de17322-934e-11ed-a1eb-0242ac120002', + originalTimestamp: '2023-01-13T09:03:17.562Z', + sentAt: '2023-01-13T09:03:17.562Z', + }, + }, + endpoint: 'https://api.vitally.io/rudderstack', + files: {}, + params: {}, + type: 'REST', + version: '1', + method: 'POST', + userId: '', + headers: { + authorization: 'Basic abc123', + 'content-type': 'application/json', + }, + }, + statusCode: 200, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + }, + + { + name: 'vitally', + description: 'Test 1', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + apiKeyVitally: 'abc123', + }, + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + }, + }, + message: { + userId: '0220c056-934e-11ed-a1eb-0242ac120002', + type: 'page', + groupId: '5de17322-934e-11ed-a1eb-0242ac120002', + originalTimestamp: '2023-01-13T09:03:17.562Z', + sentAt: '2023-01-13T09:03:17.562Z', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + statusCode: 400, + error: + 'message type page is not supported: Workflow: procWorkflow, Step: validateInput, ChildStep: undefined, OriginalError: message type page is not supported', + statTags: { + errorCategory: 'dataValidation', + errorType: 'instrumentation', + destType: 'VITALLY', + module: 'destination', + implementation: 'cdkV2', + destinationId: 'destId', + workspaceId: 'wspId', + feature: 'processor', + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + }, +]; diff --git a/test/integrations/destinations/zapier/data.ts b/test/integrations/destinations/zapier/data.ts index 6dbabd26d8..122ffd2d1d 100644 --- a/test/integrations/destinations/zapier/data.ts +++ b/test/integrations/destinations/zapier/data.ts @@ -41,10 +41,14 @@ export const data = [ originalTimestamp: '2020-04-17T14:42:44.724Z', sentAt: '2020-04-17T14:42:44.724Z', }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, destination: { DestinationDefinition: { Config: { - cdkEnabled: true, + cdkV2Enabled: true, }, }, Config: { @@ -116,6 +120,10 @@ export const data = [ userId: '', }, statusCode: 200, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], }, @@ -163,10 +171,14 @@ export const data = [ originalTimestamp: '2020-04-17T14:42:44.724Z', sentAt: '2020-04-17T14:42:44.724Z', }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, destination: { DestinationDefinition: { Config: { - cdkEnabled: true, + cdkV2Enabled: true, }, }, Config: { @@ -247,6 +259,10 @@ export const data = [ userId: '', }, statusCode: 200, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], }, @@ -294,10 +310,14 @@ export const data = [ originalTimestamp: '2020-04-17T14:42:44.724Z', sentAt: '2020-04-17T14:42:44.724Z', }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, destination: { DestinationDefinition: { Config: { - cdkEnabled: true, + cdkV2Enabled: true, }, }, Config: { @@ -387,6 +407,10 @@ export const data = [ userId: '', }, statusCode: 200, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], }, @@ -434,10 +458,14 @@ export const data = [ originalTimestamp: '2020-04-17T14:42:44.724Z', sentAt: '2020-04-17T14:42:44.724Z', }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, destination: { DestinationDefinition: { Config: { - cdkEnabled: true, + cdkV2Enabled: true, }, }, Config: { @@ -527,6 +555,10 @@ export const data = [ userId: '', }, statusCode: 200, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], }, @@ -574,10 +606,14 @@ export const data = [ originalTimestamp: '2020-04-17T14:42:44.724Z', sentAt: '2020-04-17T14:42:44.724Z', }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, destination: { DestinationDefinition: { Config: { - cdkEnabled: true, + cdkV2Enabled: true, }, }, Config: { @@ -658,6 +694,10 @@ export const data = [ userId: '', }, statusCode: 200, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, }, ], },