{"version":3,"file":"roles-5qKvC7gA.mjs","names":[],"sources":["../src/contract/roles.ts"],"sourcesContent":["import { role } from '@prisma-next/postgres/contract-builder';\nimport { enumType, member } from '@prisma-next/sql-contract-ts/contract-builder';\n\n/**\n * Supabase's three standard Postgres roles as a Prisma Next enum — the\n * single source of truth for the role vocabulary. Runtime-only: the shipped\n * contract declares the roles via PSL `role` blocks inside an explicit\n * `namespace unbound { }` block, not through this handle. The runtime\n * (`supabase-runtime.ts`, `supabase.ts`) derives its role type from\n * `SupabaseRole.values` and reads member values through `SupabaseRole.members`\n * instead of raw string literals.\n */\nexport const SupabaseRole = enumType(\n  'SupabaseRole',\n  { codecId: 'pg/text@1', nativeType: 'text' },\n  member('Anon', 'anon'),\n  member('Authenticated', 'authenticated'),\n  member('ServiceRole', 'service_role'),\n);\n\nexport type SupabaseRole = (typeof SupabaseRole)['values'][number];\n\n/** The JWT claim key Supabase stores the Postgres role under. */\nexport const SUPABASE_JWT_ROLE_CLAIM = 'role';\n\nexport function isSupabaseRole(value: string): value is SupabaseRole {\n  return SupabaseRole.values.some((role) => role === value);\n}\n\n/**\n * Supabase's runtime request roles as `role()` reference handles, for use in\n * a policy's `roles:` list (e.g. `policySelect(Profile, { roles: [anon], … })`).\n * These reference the same role identities `SupabaseRole` declares — Supabase\n * provisions them on every project; referencing one lowers to its bare name,\n * matching PSL's bare-identifier pass-through.\n */\nexport const anon = role('anon');\nexport const authenticated = role('authenticated');\n"],"mappings":";;;;;;;;;;;;AAYA,MAAa,eAAe,SAC1B,gBACA;CAAE,SAAS;CAAa,YAAY;AAAO,GAC3C,OAAO,QAAQ,MAAM,GACrB,OAAO,iBAAiB,eAAe,GACvC,OAAO,eAAe,cAAc,CACtC;;AAKA,MAAa,0BAA0B;AAEvC,SAAgB,eAAe,OAAsC;CACnE,OAAO,aAAa,OAAO,MAAM,SAAS,SAAS,KAAK;AAC1D;;;;;;;;AASA,MAAa,OAAO,KAAK,MAAM;AAC/B,MAAa,gBAAgB,KAAK,eAAe"}