(
overrides: Partial<ResolvedAuthSession> = {},
)
| 8 | } from './firstPartyInferenceSession.js' |
| 9 | |
| 10 | function makeSession( |
| 11 | overrides: Partial<ResolvedAuthSession> = {}, |
| 12 | ): ResolvedAuthSession { |
| 13 | return { |
| 14 | principalKind: 'noumena_account', |
| 15 | principalSource: 'managed_oauth', |
| 16 | sessionState: 'usable', |
| 17 | headersKind: 'bearer', |
| 18 | providerAuthKind: 'noumena_first_party', |
| 19 | providerPlan: { |
| 20 | mode: 'noumena_managed', |
| 21 | source: 'managed_principal', |
| 22 | staticKeyEnvVarName: null, |
| 23 | }, |
| 24 | isInteractive: true, |
| 25 | canRefresh: true, |
| 26 | canReauthenticateInteractively: true, |
| 27 | identity: { |
| 28 | email: 'user@example.com', |
| 29 | accountUuid: 'acct-123', |
| 30 | organizationUuid: 'org-123', |
| 31 | organizationName: 'Test Org', |
| 32 | }, |
| 33 | subscription: { |
| 34 | subscriptionName: 'Noumena Max', |
| 35 | subscriptionType: 'max', |
| 36 | rateLimitTier: 'tier-1', |
| 37 | }, |
| 38 | scopes: ['user:profile', 'user:inference'], |
| 39 | hasUsableToken: true, |
| 40 | hasUsableApiKey: false, |
| 41 | accessToken: 'oauth-token', |
| 42 | accessTokenExpiresAt: Date.now() + 10 * 60 * 1_000, |
| 43 | refreshTokenPresent: true, |
| 44 | apiKey: null, |
| 45 | rawAuthTokenSource: 'noumena.com', |
| 46 | rawApiKeySource: null, |
| 47 | recoveryAction: 'none', |
| 48 | recoveryMessage: null, |
| 49 | sourceDetails: { |
| 50 | usedLegacyCompat: false, |
| 51 | usedEnvVar: false, |
| 52 | usedFileDescriptor: false, |
| 53 | usedHelper: false, |
| 54 | }, |
| 55 | ...overrides, |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | function withMockCurrentSession<T>( |
| 60 | session: ResolvedAuthSession, |
no outgoing calls
no test coverage detected