From 6c11be97cc3b86df70e1b9d82dd7c4d3771b814c Mon Sep 17 00:00:00 2001 From: Will Date: Thu, 17 Oct 2024 04:59:12 +0100 Subject: [PATCH 1/3] Should filter out falsey reserved attributes from Intercom destination (#3767) * Should filter out reserved attributes from Intercom destination even if they are falsey * Fix presence check to allow null values --------- Co-authored-by: Manish Kumar <144022547+manish339k@users.noreply.github.com> --- src/cdk/v2/destinations/intercom/utils.js | 2 +- src/cdk/v2/destinations/intercom/utils.test.js | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/cdk/v2/destinations/intercom/utils.js b/src/cdk/v2/destinations/intercom/utils.js index 22af726e84..a75f8155af 100644 --- a/src/cdk/v2/destinations/intercom/utils.js +++ b/src/cdk/v2/destinations/intercom/utils.js @@ -257,7 +257,7 @@ const filterCustomAttributes = (payload, type, destination, message) => { let customAttributes = { ...get(payload, 'custom_attributes') }; if (customAttributes) { ReservedAttributesList.forEach((trait) => { - if (customAttributes[trait]) delete customAttributes[trait]; + if (trait in customAttributes) delete customAttributes[trait]; }); if (isDefinedAndNotNull(customAttributes) && Object.keys(customAttributes).length > 0) { customAttributes = diff --git a/src/cdk/v2/destinations/intercom/utils.test.js b/src/cdk/v2/destinations/intercom/utils.test.js index c2bf3f8e89..e2c1fb9a07 100644 --- a/src/cdk/v2/destinations/intercom/utils.test.js +++ b/src/cdk/v2/destinations/intercom/utils.test.js @@ -318,6 +318,18 @@ describe('filterCustomAttributes utility test', () => { expect(result).toBeUndefined(); }); + it('Should filter out custom attributes that are reserved attributes and that are false', () => { + const payload = { custom_attributes: { unsubscribedFromEmails: false } }; + const result = filterCustomAttributes(payload, 'user', { Config: { apiVersion: 'v2' } }); + expect(result).toBeUndefined(); + }); + + it('Should filter out custom attributes that are reserved attributes and that are null', () => { + const payload = { custom_attributes: { unsubscribedFromEmails: null } }; + const result = filterCustomAttributes(payload, 'user', { Config: { apiVersion: 'v2' } }); + expect(result).toBeUndefined(); + }); + it('Should return a flattened object when custom attributes are not null, not reserved attributes and nested', () => { const payload = { custom_attributes: { source: 'rudder-js-sdk', data: { nestedAttribute: 'nestedValue' } }, From b33eadca7000d7364a8c22c9627e96135270a6a0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 17 Oct 2024 10:26:21 +0530 Subject: [PATCH 2/3] chore(deps): bump koa and @types/koa (#3709) Bumps [koa](https://github.com/koajs/koa) and [@types/koa](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/koa). These dependencies needed to be updated together. Updates `koa` from 2.15.0 to 2.15.3 - [Changelog](https://github.com/koajs/koa/blob/2.15.3/History.md) - [Commits](https://github.com/koajs/koa/compare/2.15.0...2.15.3) Updates `@types/koa` from 2.13.12 to 2.15.0 - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/koa) --- updated-dependencies: - dependency-name: koa dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: "@types/koa" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Yashasvi Bajpai <33063622+yashasvibajpai@users.noreply.github.com> --- package-lock.json | 14 ++++++++------ package.json | 4 ++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index a4295bd74c..d3b578f685 100644 --- a/package-lock.json +++ b/package-lock.json @@ -47,7 +47,7 @@ "json-size": "^1.0.0", "jsontoxml": "^1.0.1", "jstoxml": "^5.0.2", - "koa": "^2.14.1", + "koa": "^2.15.3", "koa-bodyparser": "^4.4.0", "koa2-swagger-ui": "^5.7.0", "libphonenumber-js": "^1.11.1", @@ -83,7 +83,7 @@ "@types/fast-json-stable-stringify": "^2.1.0", "@types/jest": "^29.5.1", "@types/jsonpath": "^0.2.4", - "@types/koa": "^2.13.6", + "@types/koa": "^2.15.0", "@types/koa-bodyparser": "^4.3.10", "@types/lodash": "^4.14.197", "@types/node": "^20.2.5", @@ -7791,8 +7791,9 @@ "license": "MIT" }, "node_modules/@types/koa": { - "version": "2.13.12", - "license": "MIT", + "version": "2.15.0", + "resolved": "https://registry.npmjs.org/@types/koa/-/koa-2.15.0.tgz", + "integrity": "sha512-7QFsywoE5URbuVnG3loe03QXuGajrnotr3gQkXcEBShORai23MePfFYdhz90FEtBBpkyIYQbVD+evKtloCgX3g==", "dependencies": { "@types/accepts": "*", "@types/content-disposition": "*", @@ -16327,8 +16328,9 @@ } }, "node_modules/koa": { - "version": "2.15.0", - "license": "MIT", + "version": "2.15.3", + "resolved": "https://registry.npmjs.org/koa/-/koa-2.15.3.tgz", + "integrity": "sha512-j/8tY9j5t+GVMLeioLaxweJiKUayFhlGqNTzf2ZGwL0ZCQijd2RLHK0SLW5Tsko8YyyqCZC2cojIb0/s62qTAg==", "dependencies": { "accepts": "^1.3.5", "cache-content-type": "^1.0.0", diff --git a/package.json b/package.json index 6b41457633..f5d44d8e2b 100644 --- a/package.json +++ b/package.json @@ -92,7 +92,7 @@ "json-size": "^1.0.0", "jsontoxml": "^1.0.1", "jstoxml": "^5.0.2", - "koa": "^2.14.1", + "koa": "^2.15.3", "koa-bodyparser": "^4.4.0", "koa2-swagger-ui": "^5.7.0", "libphonenumber-js": "^1.11.1", @@ -128,7 +128,7 @@ "@types/fast-json-stable-stringify": "^2.1.0", "@types/jest": "^29.5.1", "@types/jsonpath": "^0.2.4", - "@types/koa": "^2.13.6", + "@types/koa": "^2.15.0", "@types/koa-bodyparser": "^4.3.10", "@types/lodash": "^4.14.197", "@types/node": "^20.2.5", From d730dafbbd2de30b67c35db8ca05396a98a8d2e0 Mon Sep 17 00:00:00 2001 From: Akash Chetty Date: Thu, 17 Oct 2024 12:12:42 +0530 Subject: [PATCH 3/3] fix: populate source destination info env set properly (#3806) --- src/warehouse/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/warehouse/index.js b/src/warehouse/index.js index 4afa8f72c2..3491a257da 100644 --- a/src/warehouse/index.js +++ b/src/warehouse/index.js @@ -30,7 +30,7 @@ const whExtractEventTableColumnMappingRules = require('./config/WHExtractEventTa const maxColumnsInEvent = parseInt(process.env.WH_MAX_COLUMNS_IN_EVENT || '200', 10); const WH_POPULATE_SRC_DEST_INFO_IN_CONTEXT = - process.env.WH_POPULATE_SRC_DEST_INFO_IN_CONTEXT || true; + process.env.WH_POPULATE_SRC_DEST_INFO_IN_CONTEXT !== 'false'; const getDataType = (key, val, options, jsonKey = false) => { const type = typeof val;