Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
accoilmj committed Nov 14, 2024
1 parent 0d0570f commit 2b3a9b6
Showing 1 changed file with 25 additions and 23 deletions.
48 changes: 25 additions & 23 deletions src/cdk/v2/destinations/accoil_analytics/procWorkflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ steps:
$.assert(.message.type, "message Type is not present. Aborting message.");
$.assert(.message.type in {{$.EventType.([.TRACK, .PAGE, .SCREEN, .IDENTIFY, .GROUP])}},
"message type " + .message.type + " is not supported");
$.assert(.destination.Config.apiKey, "apiKey must be supplied in destination config");
- name: prepareContext
template: |
Expand All @@ -27,45 +28,46 @@ steps:
$.context.endpoint = $.endpointUrl(.destination.Config.apiKey);
- name: trackPayload
condition: $.context.messageType == "track"
condition: $.context.messageType == {{$.EventType.TRACK}}
template: |
$.context.payload.event = .message.event;
$.context.payload.userId = .message.userId;
$.context.payload.timestamp = .message.timestamp;
$.context.payload.userId = message.().({{{{$.getGenericPaths("userId")}}}})
$.context.payload.timestamp = .message.().({{{{$.getGenericPaths("timestamp")}}}});
- name: pagePayload
condition: $.context.messageType == "page"
condition: $.context.messageType == {{$.EventType.PAGE}}
template: |
$.context.payload.userId = .message.userId;
$.context.payload.userId = .message.().({{{{$.getGenericPaths("userId")}}}});
$.context.payload.name = .message.event;
$.context.payload.timestamp = .message.timestamp;
$.context.payload.timestamp = .message.().({{{{$.getGenericPaths("timestamp")}}}});
- name: screenPayload
condition: $.context.messageType == "screen"
condition: $.context.messageType == {{$.EventType.SCREEN}}
template: |
$.context.payload.userId = .message.userId;
$.context.payload.userId = .message.().({{{{$.getGenericPaths("userId")}}}});
$.context.payload.name = .message.event;
$.context.payload.timestamp = .message.timestamp;
$.context.payload.timestamp = .message.().({{{{$.getGenericPaths("timestamp")}}}});
- name: identifyPayload
condition: $.context.messageType == "identify"
condition: $.context.messageType == {{$.EventType.IDENTIFY}}
template: |
$.context.payload.userId = .message.userId;
$.context.payload.userId = .message.().({{{{$.getGenericPaths("userId")}}}});
$.context.payload.traits = .message.traits ?? .message.context.traits;
$.context.payload.timestamp = .message.().({{{{$.getGenericPaths("timestamp")}}}});
# $.context.payload.traits.email = .message.traits.email;
# $.context.payload.traits.name = .message.traits.name;
# $.context.payload.traits.role = .message.traits.role;
# $.context.payload.traits.createdAt = .message.traits.createdAt;
# $.context.payload.traits.accountStatus = .message.traits.accountStatus;

- name: groupPayload
condition: $.context.messageType == "group"
condition: $.context.messageType == {{$.EventType.GROUP}}
template: |
$.context.payload.anonymousId = .message.anonymousId;
$.context.payload.userId = .message.userId;
$.context.payload.userId = .message.().({{{{$.getGenericPaths("userId")}}}});
$.context.payload.groupId = .message.groupId;
$.context.payload.name = .message.event;
$.context.payload.timestamp = .message.timestamp;
$.context.payload.timestamp = .message.().({{{{$.getGenericPaths("timestamp")}}}});
$.context.payload.traits = .message.traits ?? .message.context.traits;
# $.context.payload.traits.name = .message.traits.name;
# $.context.payload.traits.createdAt = .message.traits.createdAt;
Expand All @@ -78,33 +80,33 @@ steps:
$.assert($.context.payload.timestamp, "timestamp is required for all calls")
- name: validateTrackPayload
condition: $.context.messageType == "track"
condition: $.context.messageType == {{$.EventType.TRACK}}
template: |
$.assert($.context.payload.event, "event is required for track call")
$.assert($.context.payload.userId, "userId is required for track call")
- name: validatePagePayload
condition: $.context.messageType == "page"
condition: $.context.messageType == {{$.EventType.PAGE}}
template: |
$.assert($.context.payload.userId, "userId is required for page call")
- name: validateScreenPayload
condition: $.context.messageType == "screen"
condition: $.context.messageType == {{$.EventType.SCREEN}}
template: |
$.assert($.context.payload.userId, "userId is required for screen call")
$.assert($.context.payload.timestamp, "timestamp is required for screen call")
- name: validateIdentifyPayload
condition: $.context.messageType == "identify"
condition: $.context.messageType == {{$.EventType.IDENTIFY}}
template: |
$.assert($.context.payload.userId, "userId is required for track call")
$.assert($.context.payload.timestamp, "timestamp is required for screen call")
$.assert($.context.payload.userId, "userId is required for identify call")
$.assert($.context.payload.timestamp, "timestamp is required for identify call")
- name: validateGroupyPayload
condition: $.context.messageType == "group"
condition: $.context.messageType == {{$.EventType.GROUP}}
template: |
$.assert($.context.payload.userId, "userId is required for track call")
$.assert($.context.payload.timestamp, "timestamp is required for screen call")
$.assert($.context.payload.userId, "userId is required for group call")
$.assert($.context.payload.timestamp, "timestamp is required for group call")
- name: cleanPayload
template: |
Expand Down

0 comments on commit 2b3a9b6

Please sign in to comment.