Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(release): pull main into develop post release v1.52.0 #2908

Merged
merged 8 commits into from
Dec 13, 2023
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,29 @@

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.52.0](https://github.com/rudderlabs/rudder-transformer/compare/v1.51.1...v1.52.0) (2023-12-12)


### Features

* onboard msl changes for new record event ([#2644](https://github.com/rudderlabs/rudder-transformer/issues/2644)) ([36d3f25](https://github.com/rudderlabs/rudder-transformer/commit/36d3f258ed5ea4ba1899c8b2cae8203bf73d90ed)), closes [#2813](https://github.com/rudderlabs/rudder-transformer/issues/2813)
* onboard reddit cloud mode destination ([#2829](https://github.com/rudderlabs/rudder-transformer/issues/2829)) ([babb89a](https://github.com/rudderlabs/rudder-transformer/commit/babb89a5bf6d1b84d1319b967953c7c1b6de7c2c))
* tiktok_ads: add support for custom events ([#2891](https://github.com/rudderlabs/rudder-transformer/issues/2891)) ([091354c](https://github.com/rudderlabs/rudder-transformer/commit/091354c4427b33c9f8ac2678db3a4ab38b008e7d))


### Bug Fixes

* active_campaign error handler ([#2895](https://github.com/rudderlabs/rudder-transformer/issues/2895)) ([5a6d296](https://github.com/rudderlabs/rudder-transformer/commit/5a6d296b0ce83f3b6b4e215839fb65d4e0f2de41))
* add check to remove empty properties object from payload ([#2896](https://github.com/rudderlabs/rudder-transformer/issues/2896)) ([1a86a07](https://github.com/rudderlabs/rudder-transformer/commit/1a86a0723e3f5fb6fdf9cf1dc716a47c6da16745))
* adobe_analytics event field check ([#2890](https://github.com/rudderlabs/rudder-transformer/issues/2890)) ([bf39215](https://github.com/rudderlabs/rudder-transformer/commit/bf39215dd1bbed482665c837a2bfabfcb751c753))
* covert toString before toLowercase ([#2830](https://github.com/rudderlabs/rudder-transformer/issues/2830)) ([bed431e](https://github.com/rudderlabs/rudder-transformer/commit/bed431e1de94ab28df1ee592d083a1481b960b6d))
* **dm:** add workspaceId in common metadata to be returned to the callers ([#2868](https://github.com/rudderlabs/rudder-transformer/issues/2868)) ([b3437a3](https://github.com/rudderlabs/rudder-transformer/commit/b3437a34358d5fd5b1eb63f30a5a695f39aa84ff))
* **integrations:** onboard sprig destination ([#2857](https://github.com/rudderlabs/rudder-transformer/issues/2857)) ([ede22e3](https://github.com/rudderlabs/rudder-transformer/commit/ede22e3f8fb60a9e36e2a3f5a5e86260255c49ef))
* mailjet source transformation by adding email exists check ([#2889](https://github.com/rudderlabs/rudder-transformer/issues/2889)) ([4a7eaa0](https://github.com/rudderlabs/rudder-transformer/commit/4a7eaa09000bcb82eb7f217d500223939bd9b07b))
* missing null check in braze populateCustomAttributesWithOperation ([#2897](https://github.com/rudderlabs/rudder-transformer/issues/2897)) ([50e921d](https://github.com/rudderlabs/rudder-transformer/commit/50e921d1451bf7016e60b2e238b8f842d72b5b71))
* removed retry logic from v1 cm360, added adapter for v1 to v0 conversion ([#2860](https://github.com/rudderlabs/rudder-transformer/issues/2860)) ([776d2c4](https://github.com/rudderlabs/rudder-transformer/commit/776d2c4abe23cd279195064684b9ccc807d83afc))
* **dm:** use clones as false for tracking plan node cache ([#2899](https://github.com/rudderlabs/rudder-transformer/issues/2899)) ([8f47db8](https://github.com/rudderlabs/rudder-transformer/commit/8f47db8bcf581d1807cfa2aa823ef400a30a09e3))

### [1.51.1](https://github.com/rudderlabs/rudder-transformer/compare/v1.51.0...v1.51.1) (2023-12-06)


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.51.1",
"version": "1.52.0",
"description": "",
"homepage": "https://github.com/rudderlabs/rudder-transformer#readme",
"bugs": {
Expand Down
2 changes: 1 addition & 1 deletion src/cdk/v2/destinations/reddit/procWorkflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ steps:
template: |
let event = .message.event;
let eventInLowerCase = event.trim().toLowerCase();;
let eventNames = .destination.Config.eventsMapping.(){.from === event}.to[] ?? [];
let eventNames = .destination.Config.eventsMapping? .destination.Config.eventsMapping.(){.from === event}.to[] ?? []: [];
eventNames.length === 0 ? eventNames = $.ecomEventMaps.(){eventInLowerCase in .src}.dest[] ?? [];
const event_type = (eventNames.length === 0 || eventNames[0]==="") ? ({"tracking_type": "Custom", "custom_event_name": event}): ({tracking_type: eventNames[0]});

Expand Down
8 changes: 6 additions & 2 deletions src/services/destination/postTransformation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import { ErrorReportingService } from '../errorReporting';
import tags from '../../v0/util/tags';
import stats from '../../util/stats';
import { FixMe } from '../../util/types';

export class DestinationPostTransformationService {
public static handleProcessorTransformSucessEvents(
Expand Down Expand Up @@ -161,18 +162,21 @@
}

public static handlevV1DeliveriesFailureEvents(
error: NonNullable<unknown>,
error: FixMe,
metaTo: MetaTransferObject,
): DeliveriesResponse {
const errObj = generateErrorObject(error, metaTo.errorDetails, false);
const metadataArray = metaTo.metadatas;
if (!Array.isArray(metadataArray)) {
// Panic
throw new PlatformError('Proxy v1 endpoint error : metadataArray is not an array');

Check warning on line 172 in src/services/destination/postTransformation.ts

View check run for this annotation

Codecov / codecov/patch

src/services/destination/postTransformation.ts#L172

Added line #L172 was not covered by tests
}
const responses = metadataArray.map((metadata) => {
const resp = {
error: errObj.message || '[Delivery] Error occured while processing payload',
error:
JSON.stringify(error.destinationResponse?.response) ||
errObj.message ||
'[Delivery] Error occured while processing payload',

Check warning on line 179 in src/services/destination/postTransformation.ts

View check run for this annotation

Codecov / codecov/patch

src/services/destination/postTransformation.ts#L178-L179

Added lines #L178 - L179 were not covered by tests
statusCode: errObj.status,
metadata,
} as DeliveryJobState;
Expand Down
2 changes: 1 addition & 1 deletion src/util/trackingPlan.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const logger = require('../logger');
const { responseStatusHandler } = require('./utils');
const stats = require('./stats');

const tpCache = new NodeCache();
const tpCache = new NodeCache({ useClones: false });
const CONFIG_BACKEND_URL = process.env.CONFIG_BACKEND_URL || 'https://api.rudderlabs.com';
const TRACKING_PLAN_URL = `${CONFIG_BACKEND_URL}/workspaces`;

Expand Down
3 changes: 3 additions & 0 deletions src/v0/destinations/adobe_analytics/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@
*/

function escapeToHTML(inputString) {
if (typeof inputString !== 'string') {
return inputString;

Check warning on line 87 in src/v0/destinations/adobe_analytics/utils.js

View check run for this annotation

Codecov / codecov/patch

src/v0/destinations/adobe_analytics/utils.js#L87

Added line #L87 was not covered by tests
}
return inputString.replace(
/[&<>]/g,
(match) =>
Expand Down
2 changes: 1 addition & 1 deletion src/v0/destinations/marketo_static_list/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,21 +110,21 @@
try {
const token = await getAuthToken(formatConfig(destination));
if (!token) {
throw new UnauthorizedError('Could not retrieve authorisation token');

Check warning on line 113 in src/v0/destinations/marketo_static_list/transform.js

View check run for this annotation

Codecov / codecov/patch

src/v0/destinations/marketo_static_list/transform.js#L113

Added line #L113 was not covered by tests
}
} catch (error) {
const errorObj = generateErrorObject(error);
const errResponses = inputs.map((input) =>
getErrorRespEvents(input.metadata, errorObj.status, errorObj.message, errorObj.statTags),

Check warning on line 118 in src/v0/destinations/marketo_static_list/transform.js

View check run for this annotation

Codecov / codecov/patch

src/v0/destinations/marketo_static_list/transform.js#L116-L118

Added lines #L116 - L118 were not covered by tests
);

return errResponses;

Check warning on line 121 in src/v0/destinations/marketo_static_list/transform.js

View check run for this annotation

Codecov / codecov/patch

src/v0/destinations/marketo_static_list/transform.js#L121

Added line #L121 was not covered by tests
}

// use lodash.groupby to group the inputs based on message type
const transformedRecordEvent = [];
let transformedAudienceEvent = [];
const groupedInputs = lodash.groupBy(inputs, (input) => input.message.type);
const groupedInputs = lodash.groupBy(inputs, (input) => input.message.type?.toLowerCase());

const respList = [];
// process record events
Expand Down
2 changes: 1 addition & 1 deletion src/v0/util/errorTypes/filteredEventsError.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { BaseError } = require('./base');
const { BaseError } = require('@rudderstack/integrations-lib');
const { HTTP_STATUS_CODES } = require('../constant');

class FilteredEventsError extends BaseError {
Expand Down
2 changes: 1 addition & 1 deletion src/v0/util/errorTypes/transformerProxyError.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
const { BaseError } = require('@rudderstack/integrations-lib');
const tags = require('../tags');
const { BaseError } = require('./base');

const errorTypes = Object.values(tags.ERROR_TYPES);
const metaTypes = Object.values(tags.METADATA);
class TransformerProxyError extends BaseError {
constructor(message, statusCode, statTags, destResponse, authErrorCategory, response) {
const finalStatTags = {

Check warning on line 8 in src/v0/util/errorTypes/transformerProxyError.js

View check run for this annotation

Codecov / codecov/patch

src/v0/util/errorTypes/transformerProxyError.js#L7-L8

Added lines #L7 - L8 were not covered by tests
[tags.TAG_NAMES.ERROR_CATEGORY]: tags.ERROR_CATEGORIES.NETWORK,
[tags.TAG_NAMES.ERROR_TYPE]: tags.ERROR_TYPES.ABORTED,
};
Expand All @@ -13,15 +13,15 @@
// 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];

Check warning on line 16 in src/v0/util/errorTypes/transformerProxyError.js

View check run for this annotation

Codecov / codecov/patch

src/v0/util/errorTypes/transformerProxyError.js#L16

Added line #L16 was not covered by tests
}

if (metaTypes.includes(statTags[tags.TAG_NAMES.META])) {
finalStatTags[tags.TAG_NAMES.META] = statTags[tags.TAG_NAMES.META];

Check warning on line 20 in src/v0/util/errorTypes/transformerProxyError.js

View check run for this annotation

Codecov / codecov/patch

src/v0/util/errorTypes/transformerProxyError.js#L20

Added line #L20 was not covered by tests
}
}
super(message, statusCode, finalStatTags, destResponse, authErrorCategory);
this.response = response;

Check warning on line 24 in src/v0/util/errorTypes/transformerProxyError.js

View check run for this annotation

Codecov / codecov/patch

src/v0/util/errorTypes/transformerProxyError.js#L23-L24

Added lines #L23 - L24 were not covered by tests
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/v0/util/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ const isPrimitive = (arg) => {
const isNewStatusCodesAccepted = (reqMetadata = {}) => {
if (reqMetadata && typeof reqMetadata === 'object' && !Array.isArray(reqMetadata)) {
const { features } = reqMetadata;
return !!(features && features[FEATURE_FILTER_CODE]);
return !!features?.[FEATURE_FILTER_CODE];
}
return false;
};
Expand Down
10 changes: 10 additions & 0 deletions src/v0/util/index.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
const { TAG_NAMES } = require('@rudderstack/integrations-lib');
const utilities = require('.');
const { getFuncTestData } = require('../../../test/testHelper');
const { FilteredEventsError } = require('./errorTypes');
const { hasCircularReference, flattenJson } = require('./index');

// Names of the utility functions to test
Expand Down Expand Up @@ -116,3 +118,11 @@ describe('flattenJson', () => {
);
});
});

describe('tests for generateErrorObject', () => {
test('test-0', () => {
const myErr = new FilteredEventsError('error-1');
const outputErrObj = utilities.generateErrorObject(myErr);
expect(outputErrObj.statTags).toEqual({});
});
});
4 changes: 1 addition & 3 deletions test/__tests__/data/braze_router.json
Original file line number Diff line number Diff line change
Expand Up @@ -841,9 +841,7 @@
},
{
"error": "[Braze Deduplication]: Duplicate user detected, the user is dropped",
"statTags": {
"errorCategory": "transformation"
},
"statTags": {},
"statusCode": 298,
"batched": false,
"metadata": [
Expand Down
177 changes: 176 additions & 1 deletion test/integrations/destinations/braze/dataDelivery/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@
.replyOnce((config) => {
// @ts-ignore
const err = AxiosError.from('DNS not found', 'ENOTFOUND', config);
return Promise.reject(err);

Check warning on line 413 in test/integrations/destinations/braze/dataDelivery/data.ts

View check run for this annotation

Codecov / codecov/patch

test/integrations/destinations/braze/dataDelivery/data.ts#L413

Added line #L413 was not covered by tests
});
},
},
Expand Down Expand Up @@ -632,7 +632,7 @@
output: {
response: [
{
error: 'Request failed for braze with status: 401',
error: '{"code":400,"message":"Bad Req","status":"Fail Case"}',
statusCode: 401,
metadata: {
jobId: 2,
Expand Down Expand Up @@ -664,4 +664,179 @@
},
},
},
{
name: 'braze',
description:
'Test Transformer Proxy V1 input with v0 proxy handler Error returned Multiple metadata Track Event',
feature: 'dataDelivery',
module: 'destination',
version: 'v1',
input: {
request: {
body: {
type: 'REST',
endpoint: 'https://rest.iad-03.braze.com/users/track/testV1',
method: 'POST',
userId: 'gabi_userId_45',
headers: {
Accept: 'application/json',
Authorization: 'Bearer api_key',
'Content-Type': 'application/json',
},
body: {
FORM: {},
JSON: {
partner: 'RudderStack',
attributes: [
{
email: '[email protected]',
city: 'Disney',
country: 'USA',
firstname: 'Mickey',
external_id: '456345345',
},
{
email: '[email protected]',
city: 'Disney',
country: 'USA',
firstname: 'Mickey',
external_id: '456345345',
},
{
email: '[email protected]',
city: 'Disney',
country: 'USA',
firstname: 'Mickey',
external_id: '456345345',
},
],
},
JSON_ARRAY: {},
XML: {},
},
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: 0,
userId: '',
sourceId: '2Vsge2uWYdrLfG7pZb5Y82eo4lr',
destinationId: '2RHh08uOsXqE9KvCDg3hoaeuK2L',
workspaceId: '2Csl0lSTbuM3qyHdaOQB2GcDH8o',
secret: {
access_token: 'secret',
refresh_token: 'refresh',
developer_token: 'developer_Token',
},
},
{
jobId: 4,
attemptNum: 0,
userId: '',
sourceId: '2Vsge2uWYdrLfG7pZb5Y82eo4lr',
destinationId: '2RHh08uOsXqE9KvCDg3hoaeuK2L',
workspaceId: '2Csl0lSTbuM3qyHdaOQB2GcDH8o',
secret: {
access_token: 'secret',
refresh_token: 'refresh',
developer_token: 'developer_Token',
},
},
],
files: {},
params: {
destination: 'braze',
},
},
method: 'POST',
},
},
output: {
response: {
status: 200,
body: {
output: {
response: [
{
error:
'{"message":"Valid data must be provided in the \'attributes\', \'events\', or \'purchases\' fields.","errors":[{"type":"The value provided for the \'email\' field is not a valid email.","input_array":"attributes","index":0},{"type":"The value provided for the \'email\' field is not a valid email.","input_array":"attributes","index":1}]}',
statusCode: 401,
metadata: {
jobId: 2,
attemptNum: 0,
userId: '',
sourceId: '2Vsge2uWYdrLfG7pZb5Y82eo4lr',
destinationId: '2RHh08uOsXqE9KvCDg3hoaeuK2L',
workspaceId: '2Csl0lSTbuM3qyHdaOQB2GcDH8o',
secret: {
access_token: 'secret',
refresh_token: 'refresh',
developer_token: 'developer_Token',
},
},
},
{
error:
'{"message":"Valid data must be provided in the \'attributes\', \'events\', or \'purchases\' fields.","errors":[{"type":"The value provided for the \'email\' field is not a valid email.","input_array":"attributes","index":0},{"type":"The value provided for the \'email\' field is not a valid email.","input_array":"attributes","index":1}]}',
statusCode: 401,
metadata: {
jobId: 3,
attemptNum: 0,
userId: '',
sourceId: '2Vsge2uWYdrLfG7pZb5Y82eo4lr',
destinationId: '2RHh08uOsXqE9KvCDg3hoaeuK2L',
workspaceId: '2Csl0lSTbuM3qyHdaOQB2GcDH8o',
secret: {
access_token: 'secret',
refresh_token: 'refresh',
developer_token: 'developer_Token',
},
},
},
{
error:
'{"message":"Valid data must be provided in the \'attributes\', \'events\', or \'purchases\' fields.","errors":[{"type":"The value provided for the \'email\' field is not a valid email.","input_array":"attributes","index":0},{"type":"The value provided for the \'email\' field is not a valid email.","input_array":"attributes","index":1}]}',
statusCode: 401,
metadata: {
jobId: 4,
attemptNum: 0,
userId: '',
sourceId: '2Vsge2uWYdrLfG7pZb5Y82eo4lr',
destinationId: '2RHh08uOsXqE9KvCDg3hoaeuK2L',
workspaceId: '2Csl0lSTbuM3qyHdaOQB2GcDH8o',
secret: {
access_token: 'secret',
refresh_token: 'refresh',
developer_token: 'developer_Token',
},
},
},
],
statTags: {
destType: 'BRAZE',
destinationId: '2RHh08uOsXqE9KvCDg3hoaeuK2L',
errorCategory: 'network',
errorType: 'aborted',
feature: 'dataDelivery',
implementation: 'native',
module: 'destination',
workspaceId: '2Csl0lSTbuM3qyHdaOQB2GcDH8o',
},
},
},
},
},
},
];
Loading
Loading