import{d as h,a as u}from"./dataSchema-VwIQYPJL.js";import"./locale-wDcg0qDg.js";import{C as f}from"./collection-nnUjKAuT.js";import"./manifest--hA2W8VB.js";const g=`This component acts as the frontend client for the Mia Platform Export Service, utilizing the fetch HTTP client in the browser. It listens to specific events to track the current state of the page, including:

1. Filter and query changes that modify the data displayed by the CRUD Client.
2. Counting the currently filtered items.
3. Counting and recording item selections in components such as the Table or the Gallery.

The component supports two export modes as specified by the Export Service: CSV and Excel.
`,y=`Questo componente agisce come client frontend per il servizio il Mia-Platform Export Client, utilizzando il client HTTP fetch nel browser. Ascolta eventi specifici per tracciare lo stato attuale della pagina, tra cui:

1. Modifiche ai filtri e alle query che modificano i dati visualizzati dal client CRUD.
2. Conteggio degli elementi attualmente filtrati.
3. Conteggio e registrazione delle selezioni di elementi in componenti come la Tabella o la Galleria.

Il componente supporta due modalità di esportazione, come specificato dall'Export Service: CSV ed Excel.
`,b={docLink:"https://docs.mia-platform.eu/docs/microfrontend-composer/back-kit/components/crud_export_client",description:{en:"Client for Mia-Platform CRUD service export route",it:"Client per la rotta di export del servizio CRUD di Mia-Platform "},descriptionLong:{en:g,it:y},example:JSON.stringify({tag:"bk-export-client",properties:{basePath:"/export",exportInternalUrl:"http://crud-service/customers/export",dataSchema:{type:"object",properties:{_id:{type:"string"},__STATE__:{type:"string"},name:{type:"string"}}}}}),label:"CRUD Export Client",mocks:{fetch:a=>{const{basePath:i,dataSchema:r}=a,o=new f(r);if(i){const{pathname:s,origin:c}=new URL(i,window.document.baseURI);return[{handler:async(l,{body:p=""}={})=>{if(typeof p!="string")return new Response("Bad Request",{status:400});try{return new Response(new ReadableStream({start(e){const d=`
`,m=new TextEncoder;async function n(t){if(t.length===0){e.close();return}e.enqueue(m.encode(JSON.stringify(t.shift()).concat(d))),n(t)}n(o.export(l))}}),{status:200,statusText:"OK",headers:new Headers({"Content-Type":"application/x-ndjson","Transfer-Encoding":"chunked"})})}catch{return new Response("Internal Server Error",{status:500})}},method:"POST",url:{pathname:s,origin:c}}]}return[]}},definitions:{...h,dataSchema:u},properties:{dataSchema:{$ref:"#/definitions/dataSchema",__mia_configuration:{label:"Data Schema",priority:"high","shared-key":"back-kit/data-schema"}},exportInternalUrl:{type:"string",__mia_configuration:{attribute:"export-internal-url",label:"Internal CRUD Url",description:"Url to be called internally to get `jsonl` formatted data"}},primaryKey:{type:"string",default:"_id",__mia_configuration:{attribute:"primary-key",label:"Primary Key",description:"primary key to filter selected data when `selected only export` option is enabled"}},streamSaverIFrameSrc:{type:"string",__mia_configuration:{attribute:"stream-saver-iframe-src",label:"Streamsaver IFrame source",description:"When downloading this component may use the `streamsaver` service worker. This property sets the location where the relevant iframe can be found"}},basePath:{type:"string",__mia_configuration:{description:"The URL base path used to reach the export service",label:"CRUD Service base path",attribute:!0,priority:"high","schema-hint":"mia/endpoints"}}},type:"connector"};var v=b;export{v as default};
