UNPKG

payloadcms-import-export-plugin

Version:

A comprehensive Payload CMS plugin that enables seamless import and export of collection data with support for CSV and JSON formats, featuring advanced field mapping, duplicate handling, and batch processing capabilities.

23 lines (22 loc) 629 B
import { APIError } from 'payload'; import { createExport } from './createExport.js'; export const download = async (req, debug = false)=>{ let body; if (typeof req?.json === 'function') { body = await req.json(); } if (!body || !body.data) { throw new APIError('Request data is required.'); } req.payload.logger.info(`Download request received ${body.data.collectionSlug}`); body.data.user = req.user; return createExport({ download: true, input: { ...body.data, debug }, req }); }; //# sourceMappingURL=download.js.map