(
session: ManagedRateLimitMessageSession,
accountInfo:
| {
hasExtraUsageEnabled?: boolean
billingType?: string | null
}
| null
| undefined,
)
| 55 | } |
| 56 | |
| 57 | export function buildRateLimitMessageSessionState( |
| 58 | session: ManagedRateLimitMessageSession, |
| 59 | accountInfo: |
| 60 | | { |
| 61 | hasExtraUsageEnabled?: boolean |
| 62 | billingType?: string | null |
| 63 | } |
| 64 | | null |
| 65 | | undefined, |
| 66 | ): RateLimitMessageSessionState { |
| 67 | if (session?.principalSource !== 'managed_oauth') { |
| 68 | return { |
| 69 | subscriptionType: null, |
| 70 | hasExtraUsageEnabled: false, |
| 71 | billingType: null, |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | return { |
| 76 | subscriptionType: session.subscription.subscriptionType, |
| 77 | hasExtraUsageEnabled: accountInfo?.hasExtraUsageEnabled === true, |
| 78 | billingType: accountInfo?.billingType ?? null, |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | export function isOverageProvisioningAllowedForRateLimitState( |
| 83 | state: Pick<RateLimitMessageSessionState, 'subscriptionType' | 'billingType'>, |
no outgoing calls
no test coverage detected