MCPcopy
hub / github.com/simstudioai/sim / requireOrganizationOwnerId

Function requireOrganizationOwnerId

apps/sim/lib/workspaces/policy.ts:399–406  ·  view source on GitHub ↗

* Like `getOrganizationOwnerId` but throws when no owner row exists. * Use when the caller needs a guaranteed billed-account userId — every * Better Auth organization is expected to have exactly one owner, so a * missing owner is a data-integrity issue that should surface loudly.

(organizationId: string)

Source from the content-addressed store, hash-verified

397 * missing owner is a data-integrity issue that should surface loudly.
398 */
399async function requireOrganizationOwnerId(organizationId: string): Promise<string> {
400 const ownerId = await getOrganizationOwnerId(organizationId)
401 if (!ownerId) {
402 logger.error('Organization is missing its owner membership row', { organizationId })
403 throw new Error(`Organization ${organizationId} has no owner membership`)
404 }
405 return ownerId
406}

Callers 1

Calls 2

getOrganizationOwnerIdFunction · 0.85
errorMethod · 0.80

Tested by

no test coverage detected