(record: {
runId: string;
nodeRef: string;
timestamp: Date;
type: PersistedTraceEventType;
message: string | null;
error: unknown;
outputSummary: unknown | null;
level: string;
data: unknown | null;
sequence: number;
})
| 51 | } |
| 52 | |
| 53 | private mapRecordToEvent(record: { |
| 54 | runId: string; |
| 55 | nodeRef: string; |
| 56 | timestamp: Date; |
| 57 | type: PersistedTraceEventType; |
| 58 | message: string | null; |
| 59 | error: unknown; |
| 60 | outputSummary: unknown | null; |
| 61 | level: string; |
| 62 | data: unknown | null; |
| 63 | sequence: number; |
| 64 | }): TraceEventPayload { |
| 65 | const type = this.mapEventType(record.type); |
| 66 | const level = this.mapEventLevel(type, record.level); |
| 67 | |
| 68 | const { payload, metadata } = this.extractPayloadAndMetadata(record.data); |
| 69 | |
| 70 | const outputSummary = this.toRecord(record.outputSummary); |
| 71 | |
| 72 | const event: TraceEventPayload = { |
| 73 | id: record.sequence.toString(), |
| 74 | runId: record.runId, |
| 75 | nodeId: record.nodeRef, |
| 76 | type, |
| 77 | level, |
| 78 | timestamp: record.timestamp.toISOString(), |
| 79 | message: record.message ?? undefined, |
| 80 | error: this.toTraceError(record.error), |
| 81 | outputSummary, |
| 82 | }; |
| 83 | |
| 84 | if (payload) { |
| 85 | event.data = payload; |
| 86 | } |
| 87 | |
| 88 | if (metadata) { |
| 89 | event.metadata = metadata; |
| 90 | } |
| 91 | |
| 92 | return event; |
| 93 | } |
| 94 | |
| 95 | private mapEventType(type: PersistedTraceEventType): TraceEventType { |
| 96 | switch (type) { |
no test coverage detected