(params: {
userId: string
userEmail?: string | null | undefined
deps?: SessionDeps
})
| 621 | } |
| 622 | |
| 623 | export async function endUserSession(params: { |
| 624 | userId: string |
| 625 | userEmail?: string | null | undefined |
| 626 | deps?: SessionDeps |
| 627 | }): Promise<void> { |
| 628 | const deps = params.deps ?? defaultDeps |
| 629 | if ( |
| 630 | !deps.isWaitingRoomEnabled() || |
| 631 | isWaitingRoomBypassedForEmail(params.userEmail) |
| 632 | ) { |
| 633 | return |
| 634 | } |
| 635 | await deps.endSession({ |
| 636 | userId: params.userId, |
| 637 | now: nowOf(deps), |
| 638 | sessionLengthMs: deps.sessionLengthMs, |
| 639 | }) |
| 640 | } |
| 641 | |
| 642 | export type SessionGateResult = |
| 643 | | { ok: true; reason: 'disabled' } |
no test coverage detected