(startTime?: string)
| 7 | } |
| 8 | |
| 9 | const toCompactTimestamp = (startTime?: string): string => { |
| 10 | const parsed = startTime ? new Date(startTime) : new Date() |
| 11 | const date = Number.isNaN(parsed.getTime()) ? new Date() : parsed |
| 12 | const pad = (value: number, length: number) => value.toString().padStart(length, '0') |
| 13 | const year = date.getUTCFullYear() |
| 14 | const month = pad(date.getUTCMonth() + 1, 2) |
| 15 | const day = pad(date.getUTCDate(), 2) |
| 16 | const hours = pad(date.getUTCHours(), 2) |
| 17 | const minutes = pad(date.getUTCMinutes(), 2) |
| 18 | const seconds = pad(date.getUTCSeconds(), 2) |
| 19 | const micros = pad(date.getUTCMilliseconds() * 1000, 6) |
| 20 | return `${year}${month}${day}T${hours}${minutes}${seconds}${micros}` |
| 21 | } |
| 22 | |
| 23 | export const normalizeLangsmithRunPayload = (run: LangsmithRunPayload): NormalizedRunPayload => { |
| 24 | const runId = run.id ?? generateId() |
no test coverage detected