Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:rudderlabs/rudder-transformer in…
Browse files Browse the repository at this point in the history
…to chore.format-standard
  • Loading branch information
Sai Sankeerth committed Feb 22, 2024
2 parents d963897 + 6b44fe4 commit 6418d7b
Show file tree
Hide file tree
Showing 73 changed files with 4,859 additions and 1,386 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/create-hotfix-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 == 'koladilip' || 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 == 'koladilip' || github.triggering_actor == 'shrouti1507' || github.triggering_actor == 'anantjain45823' || github.triggering_actor == 'chandumlg' || github.triggering_actor == 'mihir-4116' || github.triggering_actor == 'sanpj2292')
if: github.ref == 'refs/heads/main' && (github.actor == 'ItsSudip' || github.actor == 'krishna2020' || github.actor == 'koladilip' || github.actor == 'saikumarrs' || github.actor == 'sandeepdsvs' || github.actor == 'shrouti1507' || github.actor == 'anantjain45823' || github.actor == 'chandumlg' || github.actor == 'mihir-4116' || github.actor == 'utsabc') && (github.triggering_actor == 'ItsSudip' || github.triggering_actor == 'krishna2020' || github.triggering_actor == 'saikumarrs' || github.triggering_actor == 'sandeepdsvs' || github.triggering_actor == 'koladilip' || github.triggering_actor == 'shrouti1507' || github.triggering_actor == 'anantjain45823' || github.triggering_actor == 'chandumlg' || github.triggering_actor == 'mihir-4116' || github.triggering_actor == 'sanpj2292' || github.triggering_actor == 'utsabc')
steps:
- name: Create Branch
uses: peterjgrainger/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/draft-new-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest

# Only allow release stakeholders to initiate releases
if: (github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/heads/hotfix/')) && (github.actor == 'ItsSudip' || github.actor == 'krishna2020' || github.actor == 'saikumarrs' || github.actor == 'sandeepdsvs' || github.actor == 'koladilip' || github.actor == 'shrouti1507' || github.actor == 'anantjain45823' || github.actor == 'chandumlg' || github.actor == 'mihir-4116' || github.actor == 'yashasvibajpai' || github.actor == 'sanpj2292' || github.actor == 'ujjwal-ab') && (github.triggering_actor == 'ItsSudip' || github.triggering_actor == 'krishna2020' || github.triggering_actor == 'koladilip' || 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 == 'yashasvibajpai' || github.triggering_actor == 'sanpj2292' || github.triggering_actor == 'ujjwal-ab')
if: (github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/heads/hotfix/')) && (github.actor == 'ItsSudip' || github.actor == 'krishna2020' || github.actor == 'saikumarrs' || github.actor == 'sandeepdsvs' || github.actor == 'koladilip' || github.actor == 'shrouti1507' || github.actor == 'anantjain45823' || github.actor == 'chandumlg' || github.actor == 'mihir-4116' || github.actor == 'yashasvibajpai' || github.actor == 'sanpj2292' || github.actor == 'utsabc') && (github.triggering_actor == 'ItsSudip' || github.triggering_actor == 'krishna2020' || github.triggering_actor == 'koladilip' || 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 == 'yashasvibajpai' || github.triggering_actor == 'sanpj2292' || github.triggering_actor == 'utsabc')
steps:
- name: Checkout
uses: actions/[email protected]
Expand Down
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,28 @@

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.56.0](https://github.com/rudderlabs/rudder-transformer/compare/v1.55.0...v1.56.0) (2024-02-19)


### Features

* **hs:** chunking data based on batch limit ([#2907](https://github.com/rudderlabs/rudder-transformer/issues/2907)) ([a60694c](https://github.com/rudderlabs/rudder-transformer/commit/a60694cef1da31d27a5cf90264548cad793f556f))
* onboard bluecore integration ([#3061](https://github.com/rudderlabs/rudder-transformer/issues/3061)) ([aef5f8e](https://github.com/rudderlabs/rudder-transformer/commit/aef5f8e5f267262e0f9e10229f14f2bcc8ad29e2))
* tiktok_offline_events added support for all Standard events ([#3094](https://github.com/rudderlabs/rudder-transformer/issues/3094)) ([b5cdccb](https://github.com/rudderlabs/rudder-transformer/commit/b5cdccb75fe68150816140174087fddad677db10))


### Bug Fixes

* add support of placing properties at root in af ([#3082](https://github.com/rudderlabs/rudder-transformer/issues/3082)) ([0f01524](https://github.com/rudderlabs/rudder-transformer/commit/0f01524b6f4f2f82efc21f88f8c97cb6fdaf91ea))
* amplitude batch output metadata ([#3077](https://github.com/rudderlabs/rudder-transformer/issues/3077)) ([69c8348](https://github.com/rudderlabs/rudder-transformer/commit/69c83489c85486c9b2aed4a1292bd9f0aae9ca44))
* amplitude: Error handling for missing event type ([#3079](https://github.com/rudderlabs/rudder-transformer/issues/3079)) ([f7ec0a1](https://github.com/rudderlabs/rudder-transformer/commit/f7ec0a1244a7b97e6b40de5ed9881c63300866dc))
* custify user-regulation logic ([#3076](https://github.com/rudderlabs/rudder-transformer/issues/3076)) ([9683161](https://github.com/rudderlabs/rudder-transformer/commit/9683161612c7e3b9c2be95a2728f68ec7dcf69f4))
* error handling for auth0 source ([#3038](https://github.com/rudderlabs/rudder-transformer/issues/3038)) ([2a21274](https://github.com/rudderlabs/rudder-transformer/commit/2a21274333350c615991f7b56b81b766502d5bf4))
* **ga4:** failures not considered with 200 status in events tab ([#3089](https://github.com/rudderlabs/rudder-transformer/issues/3089)) ([6a364fb](https://github.com/rudderlabs/rudder-transformer/commit/6a364fba34c46b15c0fe4b06ecfa6f4b81b6f436))
* gaoc batching order ([#3064](https://github.com/rudderlabs/rudder-transformer/issues/3064)) ([a98cabd](https://github.com/rudderlabs/rudder-transformer/commit/a98cabdfe7781ada12baf742df4a3a439fc5fecd))
* resolve bugsnag issue caused due to undefined properties ([#3086](https://github.com/rudderlabs/rudder-transformer/issues/3086)) ([d522b35](https://github.com/rudderlabs/rudder-transformer/commit/d522b35c908a9f262ba3ba27dda0ea5d9ac5bc6b))
* tiktok ads v2 error handling ([#3084](https://github.com/rudderlabs/rudder-transformer/issues/3084)) ([b6edff4](https://github.com/rudderlabs/rudder-transformer/commit/b6edff46fa0e0e210e82206fea46a064e3fbe00f))

## [1.55.0](https://github.com/rudderlabs/rudder-transformer/compare/v1.54.4...v1.55.0) (2024-02-05)


Expand Down
15 changes: 12 additions & 3 deletions package-lock.json

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

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rudder-transformer",
"version": "1.55.0",
"version": "1.56.0",
"description": "",
"homepage": "https://github.com/rudderlabs/rudder-transformer#readme",
"bugs": {
Expand Down Expand Up @@ -113,7 +113,8 @@
"ua-parser-js": "^1.0.37",
"unset-value": "^2.0.1",
"uuid": "^9.0.0",
"valid-url": "^1.0.9"
"valid-url": "^1.0.9",
"zod": "^3.22.4"
},
"devDependencies": {
"@commitlint/config-conventional": "^17.6.3",
Expand Down
7 changes: 4 additions & 3 deletions src/adapters/networkhandler/genericNetworkHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@ const tags = require('../../v0/util/tags');
* will act as fall-fack for such scenarios.
*
*/
const responseHandler = (destinationResponse, dest) => {
const responseHandler = (responseParams) => {
const { destinationResponse, destType } = responseParams;
const { status } = destinationResponse;
const message = `[Generic Response Handler] Request for destination: ${dest} Processed Successfully`;
const message = `[Generic Response Handler] Request for destination: ${destType} Processed Successfully`;
// if the response from destination is not a success case build an explicit error
if (!isHttpStatusSuccess(status)) {
throw new NetworkError(
`[Generic Response Handler] Request failed for destination ${dest} with status: ${status}`,
`[Generic Response Handler] Request failed for destination ${destType} with status: ${status}`,
status,
{
[tags.TAG_NAMES.ERROR_TYPE]: getDynamicErrorType(status),
Expand Down
27 changes: 16 additions & 11 deletions src/controllers/delivery.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
/* eslint-disable prefer-destructuring */
/* eslint-disable sonarjs/no-duplicate-string */
import { Context } from 'koa';
import { isDefinedAndNotNullAndNotEmpty } from '@rudderstack/integrations-lib';
import { MiscService } from '../services/misc';
import {
DeliveriesResponse,
DeliveryResponse,
DeliveryV1Response,
DeliveryV0Response,
ProcessorTransformationOutput,
ProxyDeliveriesRequest,
ProxyDeliveryRequest,
ProxyV0Request,
ProxyV1Request,
} from '../types/index';
import { ServiceSelector } from '../helpers/serviceSelector';
import { DeliveryTestService } from '../services/delivertTest/deliveryTest';
Expand All @@ -22,9 +23,9 @@ const NON_DETERMINABLE = 'Non-determinable';
export class DeliveryController {
public static async deliverToDestination(ctx: Context) {
logger.debug('Native(Delivery):: Request to transformer::', JSON.stringify(ctx.request.body));
let deliveryResponse: DeliveryResponse;
let deliveryResponse: DeliveryV0Response;
const requestMetadata = MiscService.getRequestMetadata(ctx);
const deliveryRequest = ctx.request.body as ProxyDeliveryRequest;
const deliveryRequest = ctx.request.body as ProxyV0Request;
const { destination }: { destination: string } = ctx.params;
const integrationService = ServiceSelector.getNativeDestinationService();
try {
Expand All @@ -33,7 +34,7 @@ export class DeliveryController {
destination,
requestMetadata,
'v0',
)) as DeliveryResponse;
)) as DeliveryV0Response;
} catch (error: any) {
const { metadata } = deliveryRequest;
const metaTO = integrationService.getTags(
Expand All @@ -57,9 +58,9 @@ export class DeliveryController {

public static async deliverToDestinationV1(ctx: Context) {
logger.debug('Native(Delivery):: Request to transformer::', JSON.stringify(ctx.request.body));
let deliveryResponse: DeliveriesResponse;
let deliveryResponse: DeliveryV1Response;
const requestMetadata = MiscService.getRequestMetadata(ctx);
const deliveryRequest = ctx.request.body as ProxyDeliveriesRequest;
const deliveryRequest = ctx.request.body as ProxyV1Request;
const { destination }: { destination: string } = ctx.params;
const integrationService = ServiceSelector.getNativeDestinationService();
try {
Expand All @@ -68,7 +69,7 @@ export class DeliveryController {
destination,
requestMetadata,
'v1',
)) as DeliveriesResponse;
)) as DeliveryV1Response;
} catch (error: any) {
const { metadata } = deliveryRequest;
const metaTO = integrationService.getTags(
Expand All @@ -84,7 +85,11 @@ export class DeliveryController {
);
}
ctx.body = { output: deliveryResponse };
ControllerUtility.deliveryPostProcess(ctx, deliveryResponse.status);
if (isDefinedAndNotNullAndNotEmpty(deliveryResponse.authErrorCategory)) {
ControllerUtility.deliveryPostProcess(ctx, deliveryResponse.status);
} else {
ControllerUtility.deliveryPostProcess(ctx);
}

logger.debug('Native(Delivery):: Response from transformer::', JSON.stringify(ctx.body));
return ctx;
Expand Down
6 changes: 3 additions & 3 deletions src/interfaces/DestinationService.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {
DeliveryResponse,
DeliveryV0Response,
MetaTransferObject,
ProcessorTransformationRequest,
ProcessorTransformationResponse,
Expand All @@ -8,7 +8,7 @@ import {
UserDeletionRequest,
UserDeletionResponse,
ProxyRequest,
DeliveriesResponse,
DeliveryV1Response,
} from '../types/index';

export interface DestinationService {
Expand Down Expand Up @@ -49,7 +49,7 @@ export interface DestinationService {
destinationType: string,
requestMetadata: NonNullable<unknown>,
version: string,
): Promise<DeliveryResponse | DeliveriesResponse>;
): Promise<DeliveryV0Response | DeliveryV1Response>;

processUserDeletion(
requests: UserDeletionRequest[],
Expand Down
6 changes: 3 additions & 3 deletions src/services/comparator.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* eslint-disable class-methods-use-this */
import { DestinationService } from '../interfaces/DestinationService';
import {
DeliveriesResponse,
DeliveryResponse,
DeliveryV0Response,
DeliveryV1Response,
Destination,
ErrorDetailer,
MetaTransferObject,
Expand Down Expand Up @@ -370,7 +370,7 @@ export class ComparatorService implements DestinationService {
destinationType: string,
requestMetadata: NonNullable<unknown>,
version: string,
): Promise<DeliveryResponse | DeliveriesResponse> {
): Promise<DeliveryV0Response | DeliveryV1Response> {
const primaryResplist = await this.primaryService.deliver(
event,
destinationType,
Expand Down
6 changes: 3 additions & 3 deletions src/services/destination/cdkV1Integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import path from 'path';
import { TransformationError } from '@rudderstack/integrations-lib';
import { DestinationService } from '../../interfaces/DestinationService';
import {
DeliveryResponse,
DeliveryV0Response,
ErrorDetailer,
MetaTransferObject,
ProcessorTransformationRequest,
Expand All @@ -14,7 +14,7 @@ import {
UserDeletionRequest,
UserDeletionResponse,
ProxyRequest,
DeliveriesResponse,
DeliveryV1Response,
} from '../../types/index';
import { DestinationPostTransformationService } from './postTransformation';
import tags from '../../v0/util/tags';
Expand Down Expand Up @@ -121,7 +121,7 @@ export class CDKV1DestinationService implements DestinationService {
_event: ProxyRequest,
_destinationType: string,
_requestMetadata: NonNullable<unknown>,
): Promise<DeliveryResponse | DeliveriesResponse> {
): Promise<DeliveryV0Response | DeliveryV1Response> {
throw new TransformationError('CDV1 Does not Implement Delivery Routine');
}

Expand Down
6 changes: 3 additions & 3 deletions src/services/destination/cdkV2Integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { TransformationError } from '@rudderstack/integrations-lib';
import { processCdkV2Workflow } from '../../cdk/v2/handler';
import { DestinationService } from '../../interfaces/DestinationService';
import {
DeliveryResponse,
DeliveryV0Response,
ErrorDetailer,
MetaTransferObject,
ProcessorTransformationRequest,
Expand All @@ -16,7 +16,7 @@ import {
UserDeletionRequest,
UserDeletionResponse,
ProxyRequest,
DeliveriesResponse,
DeliveryV1Response,
} from '../../types/index';
import tags from '../../v0/util/tags';
import { DestinationPostTransformationService } from './postTransformation';
Expand Down Expand Up @@ -170,7 +170,7 @@ export class CDKV2DestinationService implements DestinationService {
_event: ProxyRequest,
_destinationType: string,
_requestMetadata: NonNullable<unknown>,
): Promise<DeliveryResponse | DeliveriesResponse> {
): Promise<DeliveryV0Response | DeliveryV1Response> {
throw new TransformationError('CDKV2 Does not Implement Delivery Routine');
}

Expand Down
38 changes: 18 additions & 20 deletions src/services/destination/nativeIntegration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import groupBy from 'lodash/groupBy';
import cloneDeep from 'lodash/cloneDeep';
import { DestinationService } from '../../interfaces/DestinationService';
import {
DeliveryResponse,
DeliveryV0Response,
ErrorDetailer,
MetaTransferObject,
ProcessorTransformationRequest,
Expand All @@ -16,9 +16,9 @@ import {
UserDeletionRequest,
UserDeletionResponse,
ProxyRequest,
ProxyDeliveriesRequest,
ProxyDeliveryRequest,
DeliveriesResponse,
ProxyV0Request,
ProxyV1Request,
DeliveryV1Response,
DeliveryJobState,
} from '../../types/index';
import { DestinationPostTransformationService } from './postTransformation';
Expand Down Expand Up @@ -181,7 +181,7 @@ export class NativeIntegrationDestinationService implements DestinationService {
destinationType: string,
_requestMetadata: NonNullable<unknown>,
version: string,
): Promise<DeliveryResponse | DeliveriesResponse> {
): Promise<DeliveryV0Response | DeliveryV1Response> {
try {
const { networkHandler, handlerVersion } = networkHandlerFactory.getNetworkHandler(
destinationType,
Expand All @@ -191,24 +191,22 @@ export class NativeIntegrationDestinationService implements DestinationService {
const processedProxyResponse = networkHandler.processAxiosResponse(rawProxyResponse);
let rudderJobMetadata =
version.toLowerCase() === 'v1'
? (deliveryRequest as ProxyDeliveriesRequest).metadata
: (deliveryRequest as ProxyDeliveryRequest).metadata;
? (deliveryRequest as ProxyV1Request).metadata
: (deliveryRequest as ProxyV0Request).metadata;

if (version.toLowerCase() === 'v1' && handlerVersion.toLowerCase() === 'v0') {
rudderJobMetadata = rudderJobMetadata[0];
}

let responseProxy = networkHandler.responseHandler(
{
...processedProxyResponse,
rudderJobMetadata,
},
destinationType,
);
const responseParams = {
destinationResponse: processedProxyResponse,
rudderJobMetadata,
destType: destinationType,
};
let responseProxy = networkHandler.responseHandler(responseParams);
// Adaption Logic for V0 to V1
if (handlerVersion.toLowerCase() === 'v0' && version.toLowerCase() === 'v1') {
const v0Response = responseProxy as DeliveryResponse;
const jobStates = (deliveryRequest as ProxyDeliveriesRequest).metadata.map(
const v0Response = responseProxy as DeliveryV0Response;
const jobStates = (deliveryRequest as ProxyV1Request).metadata.map(
(metadata) =>
({
error: JSON.stringify(v0Response.destinationResponse?.response),
Expand All @@ -221,7 +219,7 @@ export class NativeIntegrationDestinationService implements DestinationService {
status: v0Response.status,
message: v0Response.message,
authErrorCategory: v0Response.authErrorCategory,
} as DeliveriesResponse;
} as DeliveryV1Response;
}
return responseProxy;
} catch (err: any) {
Expand All @@ -236,10 +234,10 @@ export class NativeIntegrationDestinationService implements DestinationService {
);

if (version.toLowerCase() === 'v1') {
metaTO.metadatas = (deliveryRequest as ProxyDeliveriesRequest).metadata;
metaTO.metadatas = (deliveryRequest as ProxyV1Request).metadata;
return DestinationPostTransformationService.handlevV1DeliveriesFailureEvents(err, metaTO);
}
metaTO.metadata = (deliveryRequest as ProxyDeliveryRequest).metadata;
metaTO.metadata = (deliveryRequest as ProxyV0Request).metadata;
return DestinationPostTransformationService.handleDeliveryFailureEvents(err, metaTO);
}
}
Expand Down
Loading

0 comments on commit 6418d7b

Please sign in to comment.