From fa620e00db13b7bcdc599cb99966395cfbe53f96 Mon Sep 17 00:00:00 2001 From: Dilip Kola Date: Wed, 16 Oct 2024 10:40:39 +0530 Subject: [PATCH 1/2] fix: heap userId extraction --- .../v2/destinations/heap/procWorkflow.yaml | 4 +- .../destinations/heap/processor/data.ts | 118 ++++++++++++++++++ 2 files changed, 120 insertions(+), 2 deletions(-) diff --git a/src/cdk/v2/destinations/heap/procWorkflow.yaml b/src/cdk/v2/destinations/heap/procWorkflow.yaml index ac12e7e02a..6e038bc66d 100644 --- a/src/cdk/v2/destinations/heap/procWorkflow.yaml +++ b/src/cdk/v2/destinations/heap/procWorkflow.yaml @@ -22,7 +22,7 @@ steps: $.assert(.message.traits ?? .message.context.traits, "traits are required"); $.context.endpoint = 'https://heapanalytics.com/api/add_user_properties'; $.context.payload = .message.({ - identity: {{{{$.getGenericPaths("userId")}}}}, + identity: {{{{$.getGenericPaths("userId", "||")}}}}, properties: $.flattenJson(.traits ?? .context.traits){~["idempotencyKey"]}, app_id: ^.destination.Config.appId }) @@ -32,7 +32,7 @@ steps: $.assert(.message.event, "event is required"); $.context.endpoint = 'https://heapanalytics.com/api/track'; $.context.payload = .message.({ - identity: {{{{$.getGenericPaths("userId")}}}}, + identity: {{{{$.getGenericPaths("userId", "||")}}}}, properties: $.flattenJson(.properties){~["idempotencyKey"]}, app_id: ^.destination.Config.appId, event: .event, diff --git a/test/integrations/destinations/heap/processor/data.ts b/test/integrations/destinations/heap/processor/data.ts index f503134148..cb1aeb7563 100644 --- a/test/integrations/destinations/heap/processor/data.ts +++ b/test/integrations/destinations/heap/processor/data.ts @@ -117,6 +117,124 @@ export const data = [ }, }, }, + { + name: 'heap', + description: 'Blank user id', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + appId: '', + }, + DestinationDefinition: { + Config: { + cdkV2Enabled: true, + }, + DisplayName: 'Heap.io', + ID: '1WTbl0l5GjOQKOvfmcGwk0T49kV', + Name: 'HEAP', + }, + Enabled: true, + ID: '1WTcDSEOE437e4ePH10BJNELXmE', + Name: 'heap test', + Transformations: [], + }, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + message: { + userId: '', + anonymousId: 'sampath', + channel: 'web', + context: { + 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, + }, + 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', + }, + integrations: { + All: true, + }, + traits: { + anonymousId: 'sampath', + email: 'sampath@gmail.com', + }, + messageId: 'fca2e71a-5d30-48e1-ba45-761c16e3820f', + originalTimestamp: '2020-01-16T13:21:59.076Z', + receivedAt: '2020-01-16T18:52:03.871+05:30', + request_ip: '[::1]:62312', + sentAt: '2020-01-16T13:22:03.85Z', + timestamp: '2020-01-16T18:51:59.097+05:30', + type: 'identify', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://heapanalytics.com/api/add_user_properties', + headers: { + 'Content-Type': 'application/json', + Accept: 'application/json', + }, + params: {}, + body: { + JSON: { + identity: 'sampath', + properties: { + anonymousId: 'sampath', + email: 'sampath@gmail.com', + }, + app_id: '', + }, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, + userId: 'sampath', + }, + statusCode: 200, + metadata: { + destinationId: 'destId', + workspaceId: 'wspId', + }, + }, + ], + }, + }, + }, { name: 'heap', description: 'Test 1', From 369e7cab0b2f28a6ff289c8ba8d430714577e78e Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Wed, 16 Oct 2024 09:47:01 +0000 Subject: [PATCH 2/2] chore(release): 1.82.1 --- CHANGELOG.md | 7 +++++++ package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b832a7602..a81c5b5fee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +### [1.82.1](https://github.com/rudderlabs/rudder-transformer/compare/v1.82.0...v1.82.1) (2024-10-16) + + +### Bug Fixes + +* heap userId extraction ([fa620e0](https://github.com/rudderlabs/rudder-transformer/commit/fa620e00db13b7bcdc599cb99966395cfbe53f96)) + ## [1.82.0](https://github.com/rudderlabs/rudder-transformer/compare/v1.81.0...v1.82.0) (2024-10-09) diff --git a/package-lock.json b/package-lock.json index 7502bbf5bf..a4295bd74c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "rudder-transformer", - "version": "1.82.0", + "version": "1.82.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "rudder-transformer", - "version": "1.82.0", + "version": "1.82.1", "license": "ISC", "dependencies": { "@amplitude/ua-parser-js": "0.7.24", diff --git a/package.json b/package.json index ca39df7ff3..6b41457633 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rudder-transformer", - "version": "1.82.0", + "version": "1.82.1", "description": "", "homepage": "https://github.com/rudderlabs/rudder-transformer#readme", "bugs": {