'use strict';
import { convertToCsv } from './csv-data-formatter.js';
import { apiBadRequestError } from '../../../fd-toolbox/server/web/errors.js';
import { responseMessages } from '../../../fd-toolbox/server/web/response-messages.js';
import { apiOkResponse } from '../../meta/server/web/responses.js';
import { parseJsonBodyFromRequest } from '../../../fd-toolbox/lib/utils.js';
import { metaQueryParams } from '../../../fd-toolbox/constants/meta-query-params.js';

var __defProp=Object['defineProperty'],__name=(_0x1898d8,_0x2b5dbe)=>__defProp(_0x1898d8,'name',{'value':_0x2b5dbe,'configurable':!![]});async function exportPostRoute(_0x571dce){const _0x41ee49=await parseJsonBodyFromRequest(_0x571dce),_0x2db2d1=new URL(_0x571dce['url'])['searchParams']['get'](metaQueryParams['resource']);if(_0x41ee49['value']&&_0x2db2d1){const _0x331fde=await convertToCsv(_0x41ee49['value'],_0x2db2d1);return apiOkResponse(_0x331fde);}else throw apiBadRequestError(responseMessages['routingError']);}__name(exportPostRoute,'exportPostRoute');

export { exportPostRoute };
