import{n as e}from"./source-DkXWTsmk.js";function t(e){if(!e||typeof e!=`object`||!(`code`in e))return;let{code:t}=e;return typeof t==`string`?t:void 0}const n=async n=>{let r=e=>e.reduce((e,t)=>{if(e.find(e=>e.name===t.name))return e;if(o&&t.valueList&&o.valueLists&&a!==`ignore`){let n=o.valueLists.find(e=>e.name===t.valueList)?.values.map(e=>e.value)??[];return e.push({name:t.name,type:`valueList`,values:a===`allowEmpty`?[...n,``]:n}),e}return e.push({name:t.name,type:t.result===`number`?`fmnumber`:`string`}),e},[]),{client:i,valueLists:a=`ignore`}=n,o=await i.layoutMetadata().catch(n=>{if(t(n)===`105`){console.log(e.bold.red(`ERROR:`),`Skipping typegen for layout:`,e.bold.underline(i.layout),`(not found)`);return}throw n});if(o)return{schema:r(o.fieldMetaData),portalSchema:Object.keys(o.portalMetaData).map(e=>({schemaName:e,schema:r(o.portalMetaData[e]??[])})),valueLists:(o.valueLists?.map(e=>({name:e.name,values:e.values.map(e=>e.value)}))??[]).reduce((e,t)=>(e.find(e=>e.name===t.name)||e.push(t),e),[])}};export{n as getLayoutMetadata};
//# sourceMappingURL=getLayoutMetadata-myBlHFlD.js.map