/** * Trims iDempiere model objects down to only the fields used by the frontend, * keeping cookie sizes small enough for nginx proxy buffers. */ const pick = (obj: any, keys: string[]) => { if (!obj || typeof obj !== 'object') return obj const result: any = {} for (const key of keys) { if (key in obj) result[key] = obj[key] } return result } export function trimUser(user: any) { return pick(user, [ 'id', 'Name', 'EMail', 'Value', 'Description', 'DateLastLogin', 'IsActive', 'IsFullBPAccess', 'IsInPayroll', 'IsSalesLead', 'IsLocked', 'IsNoPasswordReset', 'IsExpired', 'IsAddMailTextAutomatically', 'IsNoExpire', 'IsSupportUser', 'IsShipTo', 'IsBillTo', 'IsVendorLead', 'IsMobileWorker' ]) } export function trimRole(role: any) { return pick(role, ['id', 'Name', 'IsClientAdministrator', 'FrontendMenu']) } export function trimOrganization(org: any) { return pick(org, ['id', 'Name']) } export function trimClient(client: any) { return pick(client, ['id', 'Name']) } export function trimWarehouse(warehouse: any) { return pick(warehouse, ['id', 'Name']) }