Skip to content

Commit

Permalink
chore(release): pull hotfix-release/v1.83.2 into main (#3852)
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsSudip authored Nov 5, 2024
2 parents 1032aa2 + 60468fb commit 713e584
Show file tree
Hide file tree
Showing 18 changed files with 576 additions and 94 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.83.2](https://github.com/rudderlabs/rudder-transformer/compare/v1.83.1...v1.83.2) (2024-11-05)


### Bug Fixes

* update gaec destination with config validation ([#3847](https://github.com/rudderlabs/rudder-transformer/issues/3847)) ([e5c5b0a](https://github.com/rudderlabs/rudder-transformer/commit/e5c5b0a28070ff5ca89a274c3998b96780139149))

### [1.83.1](https://github.com/rudderlabs/rudder-transformer/compare/v1.83.0...v1.83.1) (2024-11-01)

## [1.83.0](https://github.com/rudderlabs/rudder-transformer/compare/v1.82.2...v1.83.0) (2024-10-25)
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.83.1",
"version": "1.83.2",
"description": "",
"homepage": "https://github.com/rudderlabs/rudder-transformer#readme",
"bugs": {
Expand Down
6 changes: 1 addition & 5 deletions src/cdk/v2/destinations/pinterest_tag/procWorkflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,7 @@ steps:
"content_ids": (props.product_id ?? props.sku ?? props.id)[],
"contents": {
"quantity": Number(props.quantity) || 1,
"item_price": String(props.price),
"item_name": String(props.name),
"id": props.product_id ?? props.sku,
"item_category": props.category,
"item_brand": props.brand
"item_price": String(props.price)
}[]
};
- name: combineAllEcomFields
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/* eslint-disable no-param-reassign */

const get = require('get-value');
const { cloneDeep } = require('lodash');
const { cloneDeep, isNumber } = require('lodash');
const { InstrumentationError, ConfigurationError } = require('@rudderstack/integrations-lib');
const isString = require('lodash/isString');
const {
constructPayload,
defaultRequestConfig,
Expand Down Expand Up @@ -35,7 +36,16 @@ const updateMappingJson = (mapping) => {
const responseBuilder = async (metadata, message, { Config }, payload) => {
const response = defaultRequestConfig();
const { event } = message;
const filteredCustomerId = removeHyphens(Config.customerId);
const { subAccount } = Config;
let { customerId, loginCustomerId } = Config;
if (isNumber(customerId)) {
customerId = customerId.toString();
}
if (!isString(customerId)) {
throw new InstrumentationError('customerId should be a string or number');
}
const filteredCustomerId = removeHyphens(customerId);

response.endpoint = `${BASE_ENDPOINT}/${filteredCustomerId}:uploadConversionAdjustments`;
response.body.JSON = payload;
const accessToken = getAccessToken(metadata, 'access_token');
Expand All @@ -45,11 +55,19 @@ const responseBuilder = async (metadata, message, { Config }, payload) => {
'developer-token': getValueFromMessage(metadata, 'secret.developer_token'),
};
response.params = { event, customerId: filteredCustomerId };
if (Config.subAccount)
if (Config.loginCustomerId) {
const filteredLoginCustomerId = removeHyphens(Config.loginCustomerId);
response.headers['login-customer-id'] = filteredLoginCustomerId;
} else throw new ConfigurationError(`LoginCustomerId is required as subAccount is true.`);
if (subAccount) {
if (!loginCustomerId) {
throw new ConfigurationError(`loginCustomerId is required as subAccount is true.`);
}
if (isNumber(loginCustomerId)) {
loginCustomerId = loginCustomerId.toString();
}
if (loginCustomerId && !isString(loginCustomerId)) {
throw new InstrumentationError('loginCustomerId should be a string or number');
}
const filteredLoginCustomerId = removeHyphens(loginCustomerId);
response.headers['login-customer-id'] = filteredLoginCustomerId;
}

return response;
};
Expand Down
6 changes: 5 additions & 1 deletion src/v0/util/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const {
} = require('@rudderstack/integrations-lib');

const { JsonTemplateEngine, PathType } = require('@rudderstack/json-template-engine');
const isString = require('lodash/isString');
const logger = require('../../logger');
const stats = require('../../util/stats');
const { DestCanonicalNames, DestHandlerMap } = require('../../constants/destinationCanonicalNames');
Expand Down Expand Up @@ -1622,7 +1623,7 @@ function isHttpStatusRetryable(status) {
function generateUUID() {
return crypto.randomUUID({
disableEntropyCache: true,
}); /* using disableEntropyCache as true to not cache the generated uuids.
}); /* using disableEntropyCache as true to not cache the generated uuids.
For more Info https://nodejs.org/api/crypto.html#cryptorandomuuidoptions:~:text=options%20%3CObject%3E-,disableEntropyCache,-%3Cboolean%3E%20By
*/
}
Expand All @@ -1646,6 +1647,9 @@ function isAppleFamily(platform) {
}

function removeHyphens(str) {
if (!isString(str)) {
return str;
}
return str.replace(/-/g, '');
}

Expand Down
17 changes: 17 additions & 0 deletions src/v0/util/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const {
validateEventAndLowerCaseConversion,
groupRouterTransformEvents,
isAxiosError,
removeHyphens,
} = require('./index');
const exp = require('constants');

Expand Down Expand Up @@ -968,3 +969,19 @@ describe('isAxiosError', () => {
expect(isAxiosError(error)).toBe(false);
});
});

describe('removeHyphens', () => {
const data = [
{ input: 'hello-w--orld', expected: 'helloworld' },
{ input: '', expected: '' },
{ input: null, expected: null },
{ input: undefined, expected: undefined },
{ input: 12345, expected: 12345 },
{ input: '123-12-241', expected: '12312241' },
];
it('should remove hyphens from string else return the input as it is', () => {
data.forEach(({ input, expected }) => {
expect(removeHyphens(input)).toBe(expected);
});
});
});
8 changes: 0 additions & 8 deletions test/apitests/data_scenarios/cdk_v2/failure.json
Original file line number Diff line number Diff line change
Expand Up @@ -556,10 +556,6 @@
"content_ids": ["123"],
"contents": [
{
"id": "123",
"item_brand": "Gamepro",
"item_category": "Games",
"item_name": "Game",
"quantity": 11,
"item_price": "13.49"
}
Expand Down Expand Up @@ -683,10 +679,6 @@
"content_ids": ["123"],
"contents": [
{
"id": "123",
"item_brand": "Gamepro",
"item_category": "Games",
"item_name": "Game",
"quantity": 11,
"item_price": "13.49"
}
Expand Down
12 changes: 0 additions & 12 deletions test/apitests/data_scenarios/cdk_v2/success.json
Original file line number Diff line number Diff line change
Expand Up @@ -556,10 +556,6 @@
"content_ids": ["123"],
"contents": [
{
"id": "123",
"item_brand": "Gamepro",
"item_category": "Games",
"item_name": "Game",
"quantity": 11,
"item_price": "13.49"
}
Expand Down Expand Up @@ -638,10 +634,6 @@
"content_ids": ["123"],
"contents": [
{
"id": "123",
"item_brand": "Gamepro",
"item_category": "Games",
"item_name": "Game",
"quantity": 11,
"item_price": "13.49"
}
Expand Down Expand Up @@ -720,10 +712,6 @@
"content_ids": ["123"],
"contents": [
{
"id": "123",
"item_brand": "Gamepro",
"item_category": "Games",
"item_name": "Game",
"quantity": 11,
"item_price": "13.49"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -388,10 +388,6 @@
"content_ids": ["123"],
"contents": [
{
"id": "123",
"item_brand": "Gamepro",
"item_category": "Games",
"item_name": "Game",
"quantity": 11,
"item_price": "13.49"
}
Expand Down Expand Up @@ -470,10 +466,6 @@
"content_ids": ["123"],
"contents": [
{
"id": "123",
"item_brand": "Gamepro",
"item_category": "Games",
"item_name": "Game",
"quantity": 11,
"item_price": "13.49"
}
Expand Down Expand Up @@ -552,10 +544,6 @@
"content_ids": ["123"],
"contents": [
{
"id": "123",
"item_brand": "Gamepro",
"item_category": "Games",
"item_name": "Game",
"quantity": 11,
"item_price": "13.49"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -388,10 +388,6 @@
"content_ids": ["123"],
"contents": [
{
"id": "123",
"item_brand": "Gamepro",
"item_category": "Games",
"item_name": "Game",
"quantity": 11,
"item_price": "13.49"
}
Expand Down Expand Up @@ -470,10 +466,6 @@
"content_ids": ["123"],
"contents": [
{
"id": "123",
"item_brand": "Gamepro",
"item_category": "Games",
"item_name": "Game",
"quantity": 11,
"item_price": "13.49"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,6 @@
"content_ids": ["123"],
"contents": [
{
"id": "123",
"item_brand": "Gamepro",
"item_category": "Games",
"item_name": "Game",
"quantity": 11,
"item_price": "13.49"
}
Expand Down Expand Up @@ -289,10 +285,6 @@
"content_ids": ["123"],
"contents": [
{
"id": "123",
"item_brand": "Gamepro",
"item_category": "Games",
"item_name": "Game",
"quantity": 11,
"item_price": "13.49"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -754,10 +754,6 @@
"content_ids": ["123"],
"contents": [
{
"id": "123",
"item_brand": "Gamepro",
"item_category": "Games",
"item_name": "Game",
"quantity": 11,
"item_price": "13.49"
}
Expand Down Expand Up @@ -785,10 +781,6 @@
"content_ids": ["123"],
"contents": [
{
"id": "123",
"item_brand": "Gamepro",
"item_category": "Games",
"item_name": "Game",
"quantity": 11,
"item_price": "13.49"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,7 @@ export const data = [
},
},
statusCode: 400,
error: 'LoginCustomerId is required as subAccount is true.',
error: 'loginCustomerId is required as subAccount is true.',
statTags: {
errorCategory: 'dataValidation',
errorType: 'configuration',
Expand Down
Loading

0 comments on commit 713e584

Please sign in to comment.