Skip to content

Commit

Permalink
chore(release): pull hotfix-release/v1.45.2 into main (#2736)
Browse files Browse the repository at this point in the history
  • Loading branch information
chandumlg authored Oct 17, 2023
2 parents 022a816 + e58127c commit 9aa28c0
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 6 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.45.2](https://github.com/rudderlabs/rudder-transformer/compare/v1.45.1...v1.45.2) (2023-10-17)


### Bug Fixes

* add event metadata to 298 status code responses ([f0493dc](https://github.com/rudderlabs/rudder-transformer/commit/f0493dccfd47bfe1897ebcec27141e2df31393c0))

### [1.45.1](https://github.com/rudderlabs/rudder-transformer/compare/v1.45.0...v1.45.1) (2023-10-17)


Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rudder-transformer",
"version": "1.45.1",
"version": "1.45.2",
"description": "",
"homepage": "https://github.com/rudderlabs/rudder-transformer#readme",
"bugs": {
Expand Down
14 changes: 11 additions & 3 deletions src/services/userTransform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
ProcessorTransformationResponse,
UserTransformationResponse,
UserTransformationServiceResponse,
MessageIdMetadataMap,
} from '../types/index';
import {
RespStatusError,
Expand Down Expand Up @@ -49,8 +50,15 @@ export default class UserTransformService {
const eventsToProcess = destEvents as ProcessorTransformationRequest[];
const transformationVersionId =
eventsToProcess[0]?.destination?.Transformations[0]?.VersionID;
const messageIds = eventsToProcess.map((ev) => ev.metadata?.messageId);
const messageIdsSet = new Set<string>(messageIds);
const messageIds: string[] = [];
const messageIdsSet = new Set<string>();
const messageIdMetadataMap: MessageIdMetadataMap = {};
eventsToProcess.forEach((ev) => {
messageIds.push(ev.metadata?.messageId);
messageIdsSet.add(ev.metadata?.messageId);
messageIdMetadataMap[ev.metadata?.messageId] = ev.metadata;
});

const messageIdsInOutputSet = new Set<string>();

const commonMetadata = {
Expand Down Expand Up @@ -125,7 +133,7 @@ export default class UserTransformService {
const droppedEvents = messageIdsNotInOutput.map((id) => ({
statusCode: HTTP_CUSTOM_STATUS_CODES.FILTERED,
metadata: {
...commonMetadata,
...(isEmpty(messageIdMetadataMap[id]) ? commonMetadata : messageIdMetadataMap[id]),
messageId: id,
messageIds: null,
},
Expand Down
5 changes: 5 additions & 0 deletions src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ type Metadata = {
transformationId: string;
};

type MessageIdMetadataMap {
[key: string]: Metadata;
}

type UserTransformationInput = {
VersionID: string;
ID: string;
Expand Down Expand Up @@ -223,6 +227,7 @@ type ComparatorInput = {

export {
Metadata,
MessageIdMetadataMap,
UserTransformationLibrary,
ProcessorTransformationRequest,
ProcessorTransformationResponse,
Expand Down

0 comments on commit 9aa28c0

Please sign in to comment.