-
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.
Merge branch 'develop' into feat.consentMode.GAOC
- Loading branch information
Showing
53 changed files
with
7,620 additions
and
6,995 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
MAX_REQUEST_SIZE_IN_BYTES: 13500, | ||
}; |
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,72 @@ | ||
bindings: | ||
- name: EventType | ||
path: ../../../../constants | ||
- path: ../../bindings/jsontemplate | ||
- name: defaultRequestConfig | ||
path: ../../../../v0/util | ||
- name: toUnixTimestampInMS | ||
path: ../../../../v0/util | ||
- name: base64Convertor | ||
path: ../../../../v0/util | ||
- path: ./utils | ||
|
||
steps: | ||
- name: messageType | ||
template: | | ||
.message.type.toLowerCase(); | ||
- name: validateInput | ||
template: | | ||
let messageType = $.outputs.messageType; | ||
$.assert(messageType, "message Type is not present. Aborting"); | ||
$.assert(messageType in {{$.EventType.([.IDENTIFY,.TRACK])}}, "message type " + messageType + " is not supported"); | ||
$.assertConfig(.destination.Config.endpoint, "Movable Ink Endpoint is not present. Aborting"); | ||
$.assertConfig(.destination.Config.accessKey, "Access key is not present . Aborting"); | ||
$.assertConfig(.destination.Config.accessSecret, "Access Secret is not present. Aborting"); | ||
$.assert(.message.timestamp ?? .message.originalTimestamp, "Timestamp is not present. Aborting"); | ||
const userId = .message.().( | ||
{{{{$.getGenericPaths("userIdOnly")}}}}; | ||
); | ||
const email = .message.().( | ||
{{{{$.getGenericPaths("email")}}}}; | ||
); | ||
$.assert(userId ?? email ?? .message.anonymousId, "Either one of userId or email or anonymousId is required. Aborting"); | ||
- name: preparePayload | ||
description: Prepare payload for identify and track. This payload schema needs to be configured in the Movable Ink dashboard. Movable Ink will discard any additional fields from the input payload. | ||
template: | | ||
const userId = .message.().( | ||
{{{{$.getGenericPaths("userIdOnly")}}}}; | ||
); | ||
const email = .message.().( | ||
{{{{$.getGenericPaths("email")}}}}; | ||
); | ||
const timestampInUnix = $.toUnixTimestampInMS(.message.().( | ||
{{{{$.getGenericPaths("timestamp")}}}}; | ||
)); | ||
$.context.payload = { | ||
...(.message), | ||
userId: userId ?? email, | ||
timestamp: timestampInUnix, | ||
anonymousId: .message.anonymousId | ||
} | ||
- name: buildResponse | ||
description: In batchMode we return payload directly | ||
condition: $.batchMode | ||
template: | | ||
$.context.payload | ||
else: | ||
name: buildResponseForProcessTransformation | ||
template: | | ||
const response = $.defaultRequestConfig(); | ||
response.body.JSON = $.context.payload; | ||
response.endpoint = .destination.Config.endpoint; | ||
response.method = "POST"; | ||
response.headers = { | ||
"Content-Type": "application/json", | ||
"Authorization": "Basic " + $.base64Convertor(.destination.Config.accessKey + ":" + .destination.Config.accessSecret) | ||
} | ||
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,74 @@ | ||
bindings: | ||
- name: handleRtTfSingleEventError | ||
path: ../../../../v0/util/index | ||
- path: ./utils | ||
exportAll: true | ||
- name: base64Convertor | ||
path: ../../../../v0/util | ||
- name: BatchUtils | ||
path: '@rudderstack/workflow-engine' | ||
- path: ./config | ||
|
||
steps: | ||
- name: validateInput | ||
template: | | ||
$.assert(Array.isArray(^) && ^.length > 0, "Invalid event array") | ||
- name: transform | ||
externalWorkflow: | ||
path: ./procWorkflow.yaml | ||
bindings: | ||
- name: batchMode | ||
value: true | ||
loopOverInput: true | ||
|
||
- name: successfulEvents | ||
template: | | ||
$.outputs.transform#idx.output.({ | ||
"batchedRequest": ., | ||
"batched": false, | ||
"destination": ^[idx].destination, | ||
"metadata": ^[idx].metadata, | ||
"statusCode": 200 | ||
})[] | ||
- name: failedEvents | ||
template: | | ||
$.outputs.transform#idx.error.( | ||
$.handleRtTfSingleEventError(^[idx], .originalError ?? ., {}) | ||
)[] | ||
- name: batchSuccessfulEvents | ||
description: Batches the successfulEvents | ||
template: | | ||
let batches = $.BatchUtils.chunkArrayBySizeAndLength( | ||
$.outputs.successfulEvents, {maxSizeInBytes: $.MAX_REQUEST_SIZE_IN_BYTES}).items; | ||
batches@batch.({ | ||
"batchedRequest": { | ||
"body": { | ||
"JSON": {"events": ~r batch.batchedRequest[]}, | ||
"JSON_ARRAY": {}, | ||
"XML": {}, | ||
"FORM": {} | ||
}, | ||
"version": "1", | ||
"type": "REST", | ||
"method": "POST", | ||
"endpoint": batch[0].destination.Config.().(.endpoint), | ||
"headers": batch[0].destination.Config.().({ | ||
"Content-Type": "application/json", | ||
"Authorization": "Basic " + $.base64Convertor(.accessKey + ":" + .accessSecret) | ||
}), | ||
"params": {}, | ||
"files": {} | ||
}, | ||
"metadata": ~r batch.metadata[], | ||
"batched": true, | ||
"statusCode": 200, | ||
"destination": batch[0].destination | ||
})[]; | ||
- name: finalPayload | ||
template: | | ||
[...$.outputs.batchSuccessfulEvents, ...$.outputs.failedEvents] |
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
Oops, something went wrong.