-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(release): pull release/v1.64.0 into main (#3321)
- Loading branch information
Showing
57 changed files
with
7,988 additions
and
8,689 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
18.19.1 | ||
18.20.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
src/cdk/v2/destinations/yandex_metrica_offline_events/config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const YANDEX_METRICA_OFFLINE_EVENTS = 'yandex_metrica_offline_events'; | ||
|
||
module.exports = { | ||
YANDEX_METRICA_OFFLINE_EVENTS, | ||
}; |
36 changes: 36 additions & 0 deletions
36
src/cdk/v2/destinations/yandex_metrica_offline_events/procWorkflow.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
bindings: | ||
- name: EventType | ||
path: ../../../../constants | ||
- path: ../../bindings/jsontemplate | ||
exportAll: true | ||
- path: ./config | ||
- name: removeUndefinedAndNullValues | ||
path: ../../../../v0/util | ||
- name: defaultRequestConfig | ||
path: ../../../../v0/util | ||
- path: ./utils | ||
|
||
steps: | ||
- name: validateInput | ||
template: | | ||
let messageType = .message.type; | ||
$.assert(messageType, "message Type is not present. Aborting message."); | ||
$.assert(.message.type.toLowerCase() ==='identify', "Event type " + .message.type.toLowerCase() + " is not supported. Aborting message."); | ||
$.assert(.message.traits || .message.properties, "Message traits/properties not present. Aborting message."); | ||
- name: prepareData | ||
template: | | ||
let data = .message.traits | ||
let identifierType = .message.context.externalId[0].identifierType; | ||
let identifierValue = .message.context.externalId[0].id; | ||
identifierValue = String(identifierValue); | ||
data = $.setIdentifier(data, identifierType, identifierValue) | ||
data = $.validateData(data) | ||
data | ||
- name: buildResponseForProcessTransformation | ||
description: build response | ||
template: | | ||
const response = $.defaultRequestConfig(); | ||
response.body.JSON = $.outputs.prepareData | ||
response |
51 changes: 51 additions & 0 deletions
51
src/cdk/v2/destinations/yandex_metrica_offline_events/utils.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* eslint-disable no-param-reassign */ | ||
const { InstrumentationError, isDefinedNotNullNotEmpty } = require('@rudderstack/integrations-lib'); | ||
const moment = require('moment'); | ||
|
||
const setIdentifier = (data, identifierType, identifierValue) => { | ||
const updatedData = data; | ||
if (identifierType === 'ClientId') { | ||
updatedData.ClientId = identifierValue; | ||
} else if (identifierType === 'YCLID') { | ||
updatedData.Yclid = identifierValue; | ||
} else if (identifierType === 'UserId') { | ||
updatedData.UserId = identifierValue; | ||
} else { | ||
throw new InstrumentationError( | ||
'Invalid identifier type passed in external Id. Valid types are ClientId, YCLID, UserId. Aborting!', | ||
); | ||
} | ||
return updatedData; | ||
}; | ||
|
||
function isUnixTimestamp(datetime) { | ||
if (moment.unix(datetime).isValid()) { | ||
return datetime; | ||
} | ||
const unixTimestamp = moment(datetime).unix(); | ||
if (moment.unix(unixTimestamp).isValid()) { | ||
return unixTimestamp; | ||
} | ||
throw new InstrumentationError('Invalid timestamp. Aborting!'); | ||
} | ||
|
||
const validateData = (data) => { | ||
const { Price, DateTime } = data; | ||
if (!isDefinedNotNullNotEmpty(data)) { | ||
throw new InstrumentationError('No traits found in the payload. Aborting!'); | ||
} | ||
if (Price && typeof Price !== 'number') { | ||
throw new InstrumentationError('Price can only be a numerical value. Aborting!'); | ||
} | ||
if (!isDefinedNotNullNotEmpty(DateTime)) { | ||
throw new InstrumentationError('DateTime cannot be empty. Aborting!'); | ||
} | ||
data.DateTime = String(isUnixTimestamp(DateTime)); | ||
return data; | ||
}; | ||
|
||
module.exports = { | ||
setIdentifier, | ||
validateData, | ||
isUnixTimestamp, | ||
}; |
Oops, something went wrong.