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

Function isWorkspaceOnEnterprisePlan

apps/sim/lib/billing/core/subscription.ts:501–520  ·  view source on GitHub ↗
(workspaceId: string)

Source from the content-addressed store, hash-verified

499 * - the billed user has an individual enterprise subscription (personal workspace).
500 */
501export async function isWorkspaceOnEnterprisePlan(workspaceId: string): Promise<boolean> {
502 try {
503 if (!isBillingEnabled) return true
504 if (isAccessControlEnabled && !isHosted) return true
505
506 const { getWorkspaceWithOwner } = await import('@/lib/workspaces/permissions/utils')
507 const ws = await getWorkspaceWithOwner(workspaceId, { includeArchived: true })
508 if (!ws) return false
509
510 if (ws.organizationId) {
511 return isOrganizationOnEnterprisePlan(ws.organizationId)
512 }
513
514 const billedSub = await getHighestPrioritySubscription(ws.billedAccountUserId)
515 return !!billedSub && checkEnterprisePlan(billedSub)
516 } catch (error) {
517 logger.error('Error checking workspace enterprise plan status', { error, workspaceId })
518 return false
519 }
520}
521
522const MAX_PLAN_CREDITS = 25000
523

Callers 2

withByokEligibilityHintFunction · 0.90
route.tsFile · 0.90

Calls 5

checkEnterprisePlanFunction · 0.90
getWorkspaceWithOwnerFunction · 0.85
errorMethod · 0.80

Tested by

no test coverage detected