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

Function getStorageLimitForPlan

apps/sim/lib/billing/storage/limits.ts:64–81  ·  view source on GitHub ↗
(plan: string, metadata?: any)

Source from the content-addressed store, hash-verified

62 * Returns limit in bytes
63 */
64export function getStorageLimitForPlan(plan: string, metadata?: any): number {
65 const limits = getStorageLimits()
66
67 if (isEnterprise(plan)) {
68 if (metadata?.storageLimitGB) {
69 return gbToBytes(Number.parseInt(metadata.storageLimitGB))
70 }
71 return limits.enterpriseDefault
72 }
73
74 const effectivePlan = getPlanTypeForLimits(plan)
75 const limitByPlan: Record<'free' | 'pro' | 'team', number> = {
76 free: limits.free,
77 pro: limits.pro,
78 team: limits.team,
79 }
80 return limitByPlan[effectivePlan as 'free' | 'pro' | 'team'] ?? limits.free
81}
82
83/**
84 * Get storage limit for a user based on their subscription. Returns limit in

Callers

nothing calls this directly

Calls 4

isEnterpriseFunction · 0.90
getPlanTypeForLimitsFunction · 0.90
getStorageLimitsFunction · 0.85
gbToBytesFunction · 0.85

Tested by

no test coverage detected