import {AuthError} from './customer-auth';
import {db} from './server';
import {identityError} from './identity';
export {activeCustomerSession as identitySession} from './customer-auth';
export async function identityRpc(name:string,payload:unknown,token:string){const r=await db('rpc/'+name,{method:'POST',body:JSON.stringify(payload)},token);const data=await r.json() as Record<string,unknown>;if(!r.ok)throw new AuthError(identityError(String(data.message||'')),r.status===403?403:r.status>=500?503:409);return data;}
