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.

40 lines (39 loc) 1.12 kB
import { createExport } from './createExport.js'; import { getFields } from './getFields.js'; export const getCreateCollectionExportTask = (config, pluginConfig)=>{ const inputSchema = getFields(config, pluginConfig).concat({ name: 'user', type: 'text' }, { name: 'userCollection', type: 'text' }, { name: 'exportsCollection', type: 'text' }); return { slug: 'createCollectionExport', handler: async ({ input, req })=>{ let user; if (input.userCollection && input.user) { user = await req.payload.findByID({ id: input.user, collection: input.userCollection }); } if (!user) { throw new Error('User not found'); } await createExport({ input, req, user }); return { output: {} }; }, inputSchema }; }; //# sourceMappingURL=getCreateExportCollectionTask.js.map