-
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: onboard new custom destination: wunderkind
- Loading branch information
1 parent
a96d40b
commit 09e3d0f
Showing
3 changed files
with
70 additions
and
2 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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
bindings: | ||
- name: EventType | ||
path: ../../../../constants | ||
- path: ../../bindings/jsontemplate | ||
exportAll: true | ||
- path: ../../../../v0/destinations/webhook/utils | ||
- name: getHashFromArray | ||
path: ../../../../v0/util | ||
- name: getIntegrationsObj | ||
path: ../../../../v0/util | ||
- name: removeUndefinedAndNullValues | ||
path: ../../../../v0/util | ||
|
||
steps: | ||
- name: checkIfProcessed | ||
condition: .message.statusCode | ||
template: | | ||
$.batchMode ? .message.body.JSON : .message | ||
onComplete: return | ||
|
||
- name: messageType | ||
template: | | ||
$.context.messageType = .message.type.toLowerCase(); | ||
- name: validateInput | ||
template: | | ||
let messageType = $.context.messageType; | ||
$.assert(messageType, "message Type is not present. Aborting"); | ||
$.assert(messageType in {{$.EventType.([.TRACK])}}, "message type " + messageType + " is not supported"); | ||
$.assertConfig(.destination.Config.accountID, "Account ID is not present. Aborting"); | ||
$.assertConfig(.destination.Config.instanceID, "Instance ID is not present. Aborting"); | ||
- name: buildResponseForProcessTransformation | ||
template: | | ||
{ | ||
payload: JSON.stringify(.message.properties), | ||
} |
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,31 @@ | ||
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 | ||
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: 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