@@ -19,6 +19,7 @@ public struct DestinationMetadata: Codable {
19
19
// MARK: - Event Types
20
20
21
21
public protocol RawEvent : Codable {
22
+ var enrichments : [ EnrichmentClosure ] ? { get set }
22
23
var type : String ? { get set }
23
24
var anonymousId : String ? { get set }
24
25
var messageId : String ? { get set }
@@ -32,6 +33,7 @@ public protocol RawEvent: Codable {
32
33
}
33
34
34
35
public struct TrackEvent : RawEvent {
36
+ @Noncodable public var enrichments : [ EnrichmentClosure ] ? = nil
35
37
public var type : String ? = " track "
36
38
public var anonymousId : String ? = nil
37
39
public var messageId : String ? = nil
@@ -57,6 +59,7 @@ public struct TrackEvent: RawEvent {
57
59
}
58
60
59
61
public struct IdentifyEvent : RawEvent {
62
+ @Noncodable public var enrichments : [ EnrichmentClosure ] ? = nil
60
63
public var type : String ? = " identify "
61
64
public var anonymousId : String ? = nil
62
65
public var messageId : String ? = nil
@@ -82,6 +85,7 @@ public struct IdentifyEvent: RawEvent {
82
85
}
83
86
84
87
public struct ScreenEvent : RawEvent {
88
+ @Noncodable public var enrichments : [ EnrichmentClosure ] ? = nil
85
89
public var type : String ? = " screen "
86
90
public var anonymousId : String ? = nil
87
91
public var messageId : String ? = nil
@@ -109,6 +113,7 @@ public struct ScreenEvent: RawEvent {
109
113
}
110
114
111
115
public struct GroupEvent : RawEvent {
116
+ @Noncodable public var enrichments : [ EnrichmentClosure ] ? = nil
112
117
public var type : String ? = " group "
113
118
public var anonymousId : String ? = nil
114
119
public var messageId : String ? = nil
@@ -134,6 +139,7 @@ public struct GroupEvent: RawEvent {
134
139
}
135
140
136
141
public struct AliasEvent : RawEvent {
142
+ @Noncodable public var enrichments : [ EnrichmentClosure ] ? = nil
137
143
public var type : String ? = " alias "
138
144
public var anonymousId : String ? = nil
139
145
public var messageId : String ? = nil
@@ -289,11 +295,12 @@ extension RawEvent {
289
295
}
290
296
}
291
297
292
- internal func applyRawEventData( store: Store ) -> Self {
298
+ internal func applyRawEventData( store: Store , enrichments : [ EnrichmentClosure ] ? ) -> Self {
293
299
var result : Self = self
294
300
295
301
guard let userInfo: UserInfo = store. currentState ( ) else { return self }
296
302
303
+ result. enrichments = enrichments
297
304
result. anonymousId = userInfo. anonymousId
298
305
result. userId = userInfo. userId
299
306
result. messageId = UUID ( ) . uuidString
0 commit comments