MCPcopy Index your code
hub / github.com/simstudioai/sim / checkUsageStatus

Function checkUsageStatus

apps/sim/lib/billing/core/usage.ts:594–616  ·  view source on GitHub ↗
(userId: string)

Source from the content-addressed store, hash-verified

592 * Check usage status with warning thresholds
593 */
594export async function checkUsageStatus(userId: string): Promise<{
595 status: 'ok' | 'warning' | 'exceeded'
596 usageData: UsageData
597}> {
598 try {
599 const usageData = await getUserUsageData(userId)
600
601 let status: 'ok' | 'warning' | 'exceeded' = 'ok'
602 if (usageData.isExceeded) {
603 status = 'exceeded'
604 } else if (usageData.isWarning) {
605 status = 'warning'
606 }
607
608 return {
609 status,
610 usageData,
611 }
612 } catch (error) {
613 logger.error('Failed to check usage status', { userId, error })
614 throw error
615 }
616}
617
618/**
619 * Sync usage limits based on subscription changes

Callers 1

Calls 2

getUserUsageDataFunction · 0.85
errorMethod · 0.80

Tested by

no test coverage detected