-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feat.sources-v2-spec-controller
- Loading branch information
Showing
41 changed files
with
2,239 additions
and
404 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 |
---|---|---|
|
@@ -98,7 +98,7 @@ jobs: | |
fetch-depth: 1 | ||
|
||
- name: Setup Docker Buildx | ||
uses: docker/setup-buildx-action@v3.6.1 | ||
uses: docker/setup-buildx-action@v3.7.1 | ||
|
||
- name: Login to DockerHub | ||
uses: docker/[email protected] | ||
|
@@ -107,7 +107,7 @@ jobs: | |
password: ${{ secrets.DOCKERHUB_PROD_TOKEN }} | ||
|
||
- name: Build Docker Image | ||
uses: docker/build-push-action@v6.7.0 | ||
uses: docker/build-push-action@v6.9.0 | ||
with: | ||
context: . | ||
file: ${{ inputs.dockerfile }} | ||
|
@@ -124,7 +124,7 @@ jobs: | |
docker run ${{ inputs.build_tag }} npm run test:ts:ci | ||
- name: Build and Push Multi-platform Images | ||
uses: docker/build-push-action@v6.7.0 | ||
uses: docker/build-push-action@v6.9.0 | ||
with: | ||
context: . | ||
file: ${{ inputs.dockerfile }} | ||
|
@@ -151,7 +151,7 @@ jobs: | |
fetch-depth: 1 | ||
|
||
- name: Setup Docker Buildx | ||
uses: docker/setup-buildx-action@v3.6.1 | ||
uses: docker/setup-buildx-action@v3.7.1 | ||
|
||
- name: Login to DockerHub | ||
uses: docker/[email protected] | ||
|
@@ -160,7 +160,7 @@ jobs: | |
password: ${{ secrets.DOCKERHUB_PROD_TOKEN }} | ||
|
||
- name: Build Docker Image | ||
uses: docker/build-push-action@v6.7.0 | ||
uses: docker/build-push-action@v6.9.0 | ||
with: | ||
context: . | ||
file: ${{ inputs.dockerfile }} | ||
|
@@ -177,7 +177,7 @@ jobs: | |
docker run ${{ inputs.build_tag }} npm run test:ts:ci | ||
- name: Build and Push Multi-platform Images | ||
uses: docker/build-push-action@v6.7.0 | ||
uses: docker/build-push-action@v6.9.0 | ||
with: | ||
context: . | ||
file: ${{ inputs.dockerfile }} | ||
|
@@ -199,7 +199,7 @@ jobs: | |
|
||
steps: | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3.6.1 | ||
uses: docker/setup-buildx-action@v3.7.1 | ||
|
||
- name: Login to DockerHub | ||
uses: docker/[email protected] | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const { defaultRequestConfig } = require('../../../../v0/util'); | ||
|
||
const buildResponseList = (payload, endpointList) => { | ||
const responseList = []; | ||
endpointList.forEach((endpoint) => { | ||
const response = defaultRequestConfig(); | ||
response.body.JSON = payload; | ||
response.endpoint = endpoint; | ||
response.headers = { 'content-type': 'application/json' }; | ||
responseList.push(response); | ||
}); | ||
return responseList; | ||
}; | ||
|
||
module.exports = { buildResponseList }; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { networkHandler } from '../ga4/networkHandler'; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('../snowflake/transform'); |
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,94 @@ | ||
const get = require('get-value'); | ||
const { InstrumentationError } = require('@rudderstack/integrations-lib'); | ||
const { | ||
defaultRequestConfig, | ||
simpleProcessRouterDest, | ||
getHashFromArray, | ||
isDefinedAndNotNull, | ||
isNotEmpty, | ||
} = require('../../util'); | ||
|
||
const getTuneEndpoint = (subdomain) => `https://${subdomain}.go2cloud.org/aff_l`; | ||
|
||
const mapPropertiesWithNestedSupport = (msg, properties, mappings) => { | ||
const mappedObj = {}; // Create a new object for parameters | ||
Object.entries(mappings).forEach(([key, value]) => { | ||
const keyStr = `${key}`; | ||
const args = { object: properties, key: keyStr }; | ||
if (args.key.split('.').length > 1) { | ||
// Handle nested keys | ||
args.object = msg; // This line modifies the object property of args | ||
} | ||
const data = get(args.object, args.key); | ||
if (isDefinedAndNotNull(data) && isNotEmpty(data)) { | ||
mappedObj[value] = data; // Map to the corresponding destination key | ||
} | ||
}); | ||
return mappedObj; // Return the new params object | ||
}; | ||
|
||
const responseBuilder = (message, { Config }) => { | ||
const { tuneEvents, subdomain } = Config; // Extract tuneEvents from config | ||
const { properties, event: messageEvent } = message; // Destructure properties and event from message | ||
|
||
// Find the relevant tune event based on the message's event name | ||
const tuneEvent = tuneEvents.find((event) => event.eventName === messageEvent); | ||
|
||
if (tuneEvent) { | ||
const standardHashMap = getHashFromArray(tuneEvent.standardMapping, 'from', 'to', false); | ||
const advSubIdHashMap = getHashFromArray(tuneEvent.advSubIdMapping, 'from', 'to', false); | ||
const advUniqueIdHashMap = getHashFromArray(tuneEvent.advUniqueIdMapping, 'from', 'to', false); | ||
|
||
const params = { | ||
...mapPropertiesWithNestedSupport(message, properties, standardHashMap), | ||
...mapPropertiesWithNestedSupport(message, properties, advSubIdHashMap), | ||
...mapPropertiesWithNestedSupport(message, properties, advUniqueIdHashMap), | ||
}; | ||
|
||
const endpoint = getTuneEndpoint(subdomain); | ||
|
||
// Prepare the response | ||
const response = defaultRequestConfig(); | ||
response.params = params; // Set only the mapped params | ||
response.endpoint = endpoint; | ||
|
||
return response; | ||
} | ||
|
||
throw new InstrumentationError('No matching tune event found for the provided event.', 400); | ||
}; | ||
|
||
const processEvent = (message, destination) => { | ||
// Validate message type | ||
if (!isDefinedAndNotNull(message.type) || typeof message.type !== 'string') { | ||
throw new InstrumentationError( | ||
'Message Type is not present or is not a string. Aborting message.', | ||
400, | ||
); | ||
} | ||
const messageType = message.type.toLowerCase(); | ||
|
||
// Initialize response variable | ||
let response; | ||
|
||
// Process 'track' messages using the responseBuilder | ||
if (messageType === 'track') { | ||
response = responseBuilder(message, destination); | ||
} else { | ||
throw new InstrumentationError('Message type not supported. Only "track" is allowed.', 400); | ||
} | ||
|
||
return response; | ||
}; | ||
|
||
const process = (event) => processEvent(event.message, event.destination); | ||
|
||
const processRouterDest = async (inputs, reqMetadata) => { | ||
const respList = await simpleProcessRouterDest(inputs, process, reqMetadata); | ||
return respList; | ||
}; | ||
|
||
module.exports = { | ||
process, | ||
processRouterDest, | ||
}; |
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
Oops, something went wrong.