-
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.
feat: marketo: migrate config fields and fix test cases
- Loading branch information
1 parent
c38f14f
commit ea35d22
Showing
51 changed files
with
4,940 additions
and
1,803 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 |
---|---|---|
|
@@ -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 == 'saikumarrs' || github.actor == 'sandeepdsvs' || github.actor == 'shrouti1507' || github.actor == 'anantjain45823' || github.actor == 'chandumlg' || github.actor == 'mihir-4116') && (github.triggering_actor == 'ItsSudip' || github.triggering_actor == 'krishna2020' || 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') | ||
if: github.ref == 'refs/heads/main' && (github.actor == 'ItsSudip' || github.actor == 'krishna2020' || 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 == 'shrouti1507' || github.triggering_actor == 'anantjain45823' || github.triggering_actor == 'chandumlg' || github.triggering_actor == 'mihir-4116' || github.triggering_actor == 'ujjwal-ab) | ||
steps: | ||
- name: Create Branch | ||
uses: peterjgrainger/[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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 == 'shrouti1507' || github.actor == 'anantjain45823' || github.actor == 'chandumlg' || github.actor == 'mihir-4116' || github.actor == 'yashasvibajpai' || github.actor == 'sanpj2292') && (github.triggering_actor == 'ItsSudip' || github.triggering_actor == 'krishna2020' || 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') | ||
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 == '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 == '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') | ||
steps: | ||
- name: Checkout | ||
uses: actions/[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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const ACTION_MAP = { | ||
add: 'add', | ||
remove: 'delete', | ||
}; | ||
const SHA256_TRAITS = ['IDFA_SHA256', 'AAID_SHA256', 'EMAIL_SHA256', 'PHONE_SHA256']; | ||
module.exports = { | ||
ACTION_MAP, | ||
SHA256_TRAITS, | ||
}; |
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,67 @@ | ||
|
||
bindings: | ||
- name: EventType | ||
path: ../../../../constants | ||
- path: ../../bindings/jsontemplate | ||
exportAll: true | ||
- path: ./config | ||
- name: removeUndefinedAndNullValues | ||
path: ../../../../v0/util | ||
- name: defaultRequestConfig | ||
path: ../../../../v0/util | ||
|
||
steps: | ||
- name: validateInput | ||
template: | | ||
let messageType = .message.type; | ||
$.assert(.message.type, "message Type is not present. Aborting message."); | ||
$.assert(.message.type.toLowerCase() ==='audiencelist', "Event type " + .message.type.toLowerCase() + " is not supported. Aborting message."); | ||
$.assert(.message.properties, "Message properties is not present. Aborting message."); | ||
$.assert(.message.properties.listData, "listData is not present inside properties. Aborting message."); | ||
$.assert($.containsAll(Object.keys(.message.properties.listData), ["add", "remove"]), "unsupported action type. Aborting message.") | ||
- name: prepareIdentifiersList | ||
description: | | ||
Populate list of identifiers to be updated | ||
template: | | ||
const destinationFields = .message.context.destinationFields.split(", ") | ||
const audienceId = .message.context.externalId[0].type.split("-")[1]; | ||
const isHashRequired = .destination.Config.isHashRequired; | ||
const advertiserIds = .metadata.secret.advertiserIds; | ||
const hashTraits = function(traits) { | ||
traits@trait.(destinationFields@destinationField.( | ||
trait[destinationField] ? { | ||
id: isHashRequired ? | ||
destinationField in $.SHA256_TRAITS ? | ||
$.SHA256(trait[destinationField]) : $.MD5(trait[destinationField]) | ||
: trait[destinationField], | ||
audience_ids:[audienceId] | ||
} : {} | ||
)[]) | ||
}; | ||
const listData = .message.properties.listData; | ||
const actions = Object.keys(listData) | ||
actions@action.({ | ||
"batch_data": hashTraits(listData[action]), | ||
"id_schema": destinationFields, | ||
"advertiser_ids": advertiserIds, | ||
"action": $.ACTION_MAP[action], | ||
})[] | ||
- name: buildResponseForProcessTransformation | ||
description: build response | ||
template: | | ||
const accessToken = .metadata.secret.accessToken | ||
const anonymousId = .message.anonymousId; | ||
$.outputs.prepareIdentifiersList@body.( | ||
let response = $.defaultRequestConfig(); | ||
response.body.JSON = body; | ||
response.userId = anonymousId; | ||
response.endpoint = "https://business-api.tiktok.com/open_api/v1.3/segment/mapping/"; | ||
response.headers = { | ||
"Access-Token": accessToken, | ||
"Content-Type": "application/json" | ||
}; | ||
response | ||
) |
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,32 @@ | ||
bindings: | ||
- name: handleRtTfSingleEventError | ||
path: ../../../../v0/util/index | ||
|
||
steps: | ||
- name: validateInput | ||
template: | | ||
$.assert(Array.isArray(^) && ^.length > 0, "Invalid event array") | ||
- name: transform | ||
externalWorkflow: | ||
path: ./procWorkflow.yaml | ||
loopOverInput: true | ||
|
||
- name: successfulEvents | ||
debug: true | ||
template: | | ||
$.outputs.transform#idx{"output" in .}.({ | ||
"batchedRequest": .output, | ||
"batched": true, | ||
"destination": ^[idx].destination, | ||
"metadata": ^[idx].metadata[], | ||
"statusCode": 200 | ||
})[] | ||
- name: failedEvents | ||
template: | | ||
$.outputs.transform#idx.error.( | ||
$.handleRtTfSingleEventError(^[idx], .originalError ?? ., {}) | ||
)[] | ||
- name: finalPayload | ||
template: | | ||
[...$.outputs.failedEvents, ...$.outputs.successfulEvents] |
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
Oops, something went wrong.