(options: { stateDir: string; now?: () => number })
| 318 | } |
| 319 | |
| 320 | export function summarizeCliSession(options: { stateDir: string; now?: () => number }): { |
| 321 | authenticated: boolean; |
| 322 | source: 'cli-session' | 'none'; |
| 323 | sessionId?: string; |
| 324 | cloudBaseUrl?: string; |
| 325 | workspaceId?: string; |
| 326 | accountId?: string; |
| 327 | name?: string; |
| 328 | createdAt?: string; |
| 329 | expiresAt?: string; |
| 330 | expired?: boolean; |
| 331 | } { |
| 332 | const session = readCliSession({ stateDir: options.stateDir }); |
| 333 | if (!session) return { authenticated: false, source: 'none' }; |
| 334 | return { |
| 335 | authenticated: true, |
| 336 | source: 'cli-session', |
| 337 | sessionId: session.id, |
| 338 | cloudBaseUrl: session.cloudBaseUrl, |
| 339 | workspaceId: session.workspaceId, |
| 340 | accountId: session.accountId, |
| 341 | name: session.name, |
| 342 | createdAt: session.createdAt, |
| 343 | expiresAt: session.expiresAt, |
| 344 | expired: isExpired(session.expiresAt, options.now), |
| 345 | }; |
| 346 | } |
| 347 | |
| 348 | async function resolveCliSessionAccess(options: { |
| 349 | stateDir: string; |
no test coverage detected