(
runId: string,
afterSequence?: number,
auth?: AuthContext | null,
)
| 27 | } |
| 28 | |
| 29 | async listSince( |
| 30 | runId: string, |
| 31 | afterSequence?: number, |
| 32 | auth?: AuthContext | null, |
| 33 | ): Promise<{ events: TraceEventPayload[]; cursor?: string }> { |
| 34 | if (!afterSequence || afterSequence <= 0) { |
| 35 | return this.list(runId, auth); |
| 36 | } |
| 37 | |
| 38 | const organizationId = this.requireOrganizationId(auth); |
| 39 | const records = await this.repository.listAfterSequence(runId, afterSequence, organizationId); |
| 40 | const events = records.map((record) => this.mapRecordToEvent(record)); |
| 41 | const cursor = events.length > 0 ? events[events.length - 1].id : undefined; |
| 42 | return { events, cursor }; |
| 43 | } |
| 44 | |
| 45 | private requireOrganizationId(auth?: AuthContext | null): string { |
| 46 | const organizationId = auth?.organizationId; |
no test coverage detected