(event: TemporalRawHistoryEvent)
| 241 | * object (each event carries exactly one, keyed by its type). |
| 242 | */ |
| 243 | export function mapHistoryEvent(event: TemporalRawHistoryEvent) { |
| 244 | const attributesKey = Object.keys(event).find((key) => key.endsWith('EventAttributes')) |
| 245 | return { |
| 246 | eventId: event.eventId != null ? Number(event.eventId) : null, |
| 247 | eventTime: event.eventTime ?? null, |
| 248 | eventType: stripEnumPrefix(event.eventType, 'EVENT_TYPE_'), |
| 249 | attributes: attributesKey ? ((event[attributesKey] as Record<string, unknown>) ?? null) : null, |
| 250 | } |
| 251 | } |
| 252 | |
| 253 | /** |
| 254 | * Parses a Temporal HTTP API response body and throws a descriptive error for non-2xx |
nothing calls this directly
no test coverage detected