// @bun
var n=Object.defineProperty;var l=(a)=>a;function m(a,t){this[a]=l.bind(null,t)}var p=(a,t)=>{for(var r in t)n(a,r,{get:t[r],enumerable:!0,configurable:!0,set:m.bind(t,r)})};var v=(a,t)=>()=>(a&&(t=a(a=0)),t);import{CodeBlock as o,InstallCommand as s}from"@contractspec/lib.design-system";import c from"@contractspec/lib.ui-link";import{ChevronRight as d}from"lucide-react";import{jsx as e,jsxs as i}from"react/jsx-runtime";function y(){return i("div",{className:"space-y-8",children:[i("div",{className:"space-y-4",children:[e("h1",{className:"font-bold text-4xl",children:"Multi-Tenancy Library"}),i("p",{className:"text-lg text-muted-foreground",children:["The ",e("code",{children:"@contractspec/lib.multi-tenancy"})," library provides the core building blocks for secure SaaS applications."]})]}),i("div",{className:"space-y-4",children:[e("h2",{className:"font-bold text-2xl",children:"Installation"}),e(s,{package:"@contractspec/lib.multi-tenancy"})]}),i("div",{className:"space-y-4",children:[e("h2",{className:"font-bold text-2xl",children:"Prisma RLS Middleware"}),i("p",{className:"text-muted-foreground",children:["Automatically injects ",e("code",{children:"tenantId"})," into all queries."]}),e(o,{language:"typescript",code:`import { createRlsMiddleware } from '@contractspec/lib.multi-tenancy/rls';
import { prisma } from './db';
import { getTenantId } from './context';

prisma.$use(createRlsMiddleware(() => getTenantId()));`})]}),i("div",{className:"space-y-4",children:[e("h2",{className:"font-bold text-2xl",children:"Provisioning Service"}),e("p",{className:"text-muted-foreground",children:"Automates the creation of new tenants, including database setup and default user creation."}),e(o,{language:"typescript",code:`import { TenantProvisioningService } from '@contractspec/lib.multi-tenancy/provisioning';

const service = new TenantProvisioningService({ db: prisma });
await service.provision({
  id: 'acme',
  name: 'Acme Corp',
  slug: 'acme',
  ownerEmail: 'admin@acme.com'
});`})]}),i("div",{className:"flex items-center gap-4 pt-4",children:[e(c,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),i(c,{href:"/docs/libraries/progressive-delivery",className:"btn-primary",children:["Next: Progressive Delivery ",e(d,{size:16})]})]})]})}export{y as LibrariesMultiTenancyPage};
