@payloadcms/plugin-import-export 3.78.0-internal-debug.f663370 → 3.78.0-internal.ab11ffa

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/components/ExportSaveButton/index.d.ts.map +1 -1
  2. package/dist/components/ExportSaveButton/index.js +11 -6
  3. package/dist/components/ExportSaveButton/index.js.map +1 -1
  4. package/dist/components/FormatField/index.d.ts +3 -0
  5. package/dist/components/FormatField/index.d.ts.map +1 -0
  6. package/dist/components/FormatField/index.js +95 -0
  7. package/dist/components/FormatField/index.js.map +1 -0
  8. package/dist/export/createExport.d.ts.map +1 -1
  9. package/dist/export/createExport.js +44 -16
  10. package/dist/export/createExport.js.map +1 -1
  11. package/dist/export/getCreateExportCollectionTask.d.ts.map +1 -1
  12. package/dist/export/getCreateExportCollectionTask.js +105 -24
  13. package/dist/export/getCreateExportCollectionTask.js.map +1 -1
  14. package/dist/export/getExportCollection.d.ts.map +1 -1
  15. package/dist/export/getExportCollection.js +75 -66
  16. package/dist/export/getExportCollection.js.map +1 -1
  17. package/dist/export/getFields.d.ts.map +1 -1
  18. package/dist/export/getFields.js +4 -7
  19. package/dist/export/getFields.js.map +1 -1
  20. package/dist/exports/rsc.d.ts +1 -0
  21. package/dist/exports/rsc.d.ts.map +1 -1
  22. package/dist/exports/rsc.js +1 -0
  23. package/dist/exports/rsc.js.map +1 -1
  24. package/dist/import/batchProcessor.d.ts.map +1 -1
  25. package/dist/import/batchProcessor.js +11 -5
  26. package/dist/import/batchProcessor.js.map +1 -1
  27. package/dist/import/createImport.d.ts.map +1 -1
  28. package/dist/import/createImport.js +2 -1
  29. package/dist/import/createImport.js.map +1 -1
  30. package/dist/import/getImportCollection.d.ts.map +1 -1
  31. package/dist/import/getImportCollection.js +229 -181
  32. package/dist/import/getImportCollection.js.map +1 -1
  33. package/dist/index.d.ts +34 -0
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.js +39 -16
  36. package/dist/index.js.map +1 -1
  37. package/dist/types.d.ts +13 -0
  38. package/dist/types.d.ts.map +1 -1
  39. package/dist/types.js.map +1 -1
  40. package/dist/utilities/getPluginCollections.d.ts +4 -1
  41. package/dist/utilities/getPluginCollections.d.ts.map +1 -1
  42. package/dist/utilities/getPluginCollections.js +4 -43
  43. package/dist/utilities/getPluginCollections.js.map +1 -1
  44. package/dist/utilities/unflattenObject.d.ts.map +1 -1
  45. package/dist/utilities/unflattenObject.js +5 -0
  46. package/dist/utilities/unflattenObject.js.map +1 -1
  47. package/package.json +8 -8
@@ -3,14 +3,12 @@ import { createExport } from './createExport.js';
3
3
  import { getFields } from './getFields.js';
4
4
  import { handleDownload } from './handleDownload.js';
5
5
  import { handlePreview } from './handlePreview.js';
6
+ const FALLBACK_BATCH_SIZE = 100;
6
7
  export const getExportCollection = ({ collectionSlugs, config, exportConfig, pluginConfig })=>{
7
8
  const beforeOperation = [];
8
9
  const afterChange = [];
9
- // Extract export-specific settings
10
10
  const disableDownload = exportConfig?.disableDownload ?? false;
11
11
  const disableSave = exportConfig?.disableSave ?? false;
12
- const disableJobsQueue = exportConfig?.disableJobsQueue ?? false;
13
- const batchSize = exportConfig?.batchSize ?? 100;
14
12
  const format = exportConfig?.format;
15
13
  const collection = {
16
14
  slug: 'exports',
@@ -64,71 +62,82 @@ export const getExportCollection = ({ collectionSlugs, config, exportConfig, plu
64
62
  hideRemoveFile: true
65
63
  }
66
64
  };
67
- if (disableJobsQueue) {
68
- beforeOperation.push(async ({ args, collection: collectionConfig, operation, req })=>{
69
- if (operation !== 'create') {
70
- return;
71
- }
72
- const { user } = req;
73
- const debug = pluginConfig.debug;
74
- // Get max limit from the target collection's config
75
- const exportData = args.data;
76
- const targetCollection = req.payload.collections[exportData.collectionSlug];
77
- const exportLimitConfig = targetCollection?.config.custom?.['plugin-import-export']?.exportLimit;
78
- const maxLimit = await resolveLimit({
79
- limit: exportLimitConfig,
80
- req
81
- });
82
- await createExport({
83
- ...exportData,
84
- batchSize,
85
- debug,
86
- exportCollection: collectionConfig.slug,
87
- maxLimit,
88
- req,
89
- userCollection: user?.collection || user?.user?.collection,
90
- userID: user?.id || user?.user?.id
91
- });
65
+ // Synchronous export hook - runs when target collection has disableJobsQueue enabled
66
+ beforeOperation.push(async ({ args, collection: collectionConfig, operation, req })=>{
67
+ if (operation !== 'create') {
68
+ return;
69
+ }
70
+ const exportData = args.data;
71
+ const targetCollection = req.payload.collections[exportData.collectionSlug];
72
+ const targetPluginConfig = targetCollection?.config.custom?.['plugin-import-export'];
73
+ // Check if this target collection should use sync mode
74
+ // Fall back to exportConfig (for custom collections with overrideCollection)
75
+ const disableJobsQueue = targetPluginConfig?.exportDisableJobsQueue ?? exportConfig?.disableJobsQueue ?? false;
76
+ if (!disableJobsQueue) {
77
+ return;
78
+ }
79
+ const { user } = req;
80
+ const debug = pluginConfig.debug;
81
+ const exportLimitConfig = targetPluginConfig?.exportLimit;
82
+ const maxLimit = await resolveLimit({
83
+ limit: exportLimitConfig,
84
+ req
92
85
  });
93
- } else {
94
- afterChange.push(async ({ collection: collectionConfig, doc, operation, req })=>{
95
- if (operation !== 'create') {
96
- return;
97
- }
98
- const { user } = req;
99
- // Get max limit from the target collection's config
100
- // For job-based exports, we resolve the limit now since function limits
101
- // cannot be serialized. This means dynamic limits are resolved at queue time.
102
- const targetCollection = req.payload.collections[doc.collectionSlug];
103
- const exportLimitConfig = targetCollection?.config.custom?.['plugin-import-export']?.exportLimit;
104
- const maxLimit = await resolveLimit({
105
- limit: exportLimitConfig,
106
- req
107
- });
108
- const input = {
109
- id: doc.id,
110
- name: doc.name,
111
- batchSize,
112
- collectionSlug: doc.collectionSlug,
113
- drafts: doc.drafts,
114
- exportCollection: collectionConfig.slug,
115
- fields: doc.fields,
116
- format: doc.format,
117
- limit: doc.limit,
118
- locale: doc.locale,
119
- maxLimit,
120
- page: doc.page,
121
- sort: doc.sort,
122
- userCollection: user?.collection || user?.user?.collection,
123
- userID: user?.id || user?.user?.id,
124
- where: doc.where
125
- };
126
- await req.payload.jobs.queue({
127
- input,
128
- task: 'createCollectionExport'
129
- });
86
+ const batchSize = targetPluginConfig?.exportBatchSize ?? exportConfig?.batchSize ?? pluginConfig.batchSize ?? FALLBACK_BATCH_SIZE;
87
+ await createExport({
88
+ ...exportData,
89
+ batchSize,
90
+ debug,
91
+ exportCollection: collectionConfig.slug,
92
+ maxLimit,
93
+ req,
94
+ userCollection: user?.collection || user?.user?.collection,
95
+ userID: user?.id || user?.user?.id
96
+ });
97
+ });
98
+ afterChange.push(async ({ collection: collectionConfig, doc, operation, req })=>{
99
+ if (operation !== 'create') {
100
+ return;
101
+ }
102
+ const targetCollection = req.payload.collections[doc.collectionSlug];
103
+ const targetPluginConfig = targetCollection?.config.custom?.['plugin-import-export'];
104
+ const disableJobsQueue = targetPluginConfig?.exportDisableJobsQueue ?? exportConfig?.disableJobsQueue ?? false;
105
+ if (disableJobsQueue) {
106
+ return;
107
+ }
108
+ const { user } = req;
109
+ // Get max limit from the target collection's config
110
+ // For job-based exports, we resolve the limit now since function limits
111
+ // cannot be serialized. This means dynamic limits are resolved at queue time.
112
+ const exportLimitConfig = targetPluginConfig?.exportLimit;
113
+ const maxLimit = await resolveLimit({
114
+ limit: exportLimitConfig,
115
+ req
116
+ });
117
+ const batchSize = targetPluginConfig?.exportBatchSize ?? exportConfig?.batchSize ?? pluginConfig.batchSize ?? FALLBACK_BATCH_SIZE;
118
+ const input = {
119
+ id: doc.id,
120
+ name: doc.name,
121
+ batchSize,
122
+ collectionSlug: doc.collectionSlug,
123
+ drafts: doc.drafts,
124
+ exportCollection: collectionConfig.slug,
125
+ fields: doc.fields,
126
+ format: doc.format,
127
+ limit: doc.limit,
128
+ locale: doc.locale,
129
+ maxLimit,
130
+ page: doc.page,
131
+ sort: doc.sort,
132
+ userCollection: user?.collection || user?.user?.collection,
133
+ userID: user?.id || user?.user?.id,
134
+ where: doc.where
135
+ };
136
+ await req.payload.jobs.queue({
137
+ input,
138
+ task: 'createCollectionExport'
130
139
  });
131
- }
140
+ });
132
141
  return collection;
133
142
  };
134
143
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/export/getExportCollection.ts"],"sourcesContent":["import type {\n CollectionAfterChangeHook,\n CollectionBeforeOperationHook,\n CollectionConfig,\n Config,\n} from 'payload'\n\nimport type { ExportConfig, ImportExportPluginConfig, Limit } from '../types.js'\nimport type { Export } from './createExport.js'\n\nimport { resolveLimit } from '../utilities/resolveLimit.js'\nimport { createExport } from './createExport.js'\nimport { getFields } from './getFields.js'\nimport { handleDownload } from './handleDownload.js'\nimport { handlePreview } from './handlePreview.js'\n\nexport const getExportCollection = ({\n collectionSlugs,\n config,\n exportConfig,\n pluginConfig,\n}: {\n /**\n * Collection slugs that this export collection supports.\n */\n collectionSlugs: string[]\n config: Config\n exportConfig?: ExportConfig\n pluginConfig: ImportExportPluginConfig\n}): CollectionConfig => {\n const beforeOperation: CollectionBeforeOperationHook[] = []\n const afterChange: CollectionAfterChangeHook[] = []\n\n // Extract export-specific settings\n const disableDownload = exportConfig?.disableDownload ?? false\n const disableSave = exportConfig?.disableSave ?? false\n const disableJobsQueue = exportConfig?.disableJobsQueue ?? false\n const batchSize = exportConfig?.batchSize ?? 100\n const format = exportConfig?.format\n\n const collection: CollectionConfig = {\n slug: 'exports',\n access: {\n update: () => false,\n },\n admin: {\n components: {\n edit: {\n SaveButton: '@payloadcms/plugin-import-export/rsc#ExportSaveButton',\n },\n },\n custom: {\n disableDownload,\n disableSave,\n format,\n 'plugin-import-export': {\n collectionSlugs,\n },\n },\n disableCopyToLocale: true,\n group: false,\n useAsTitle: 'name',\n },\n disableDuplicate: true,\n endpoints: [\n {\n handler: (req) => handleDownload(req, pluginConfig.debug),\n method: 'post',\n path: '/download',\n },\n {\n handler: handlePreview,\n method: 'post',\n path: '/export-preview',\n },\n ],\n fields: getFields({ collectionSlugs, config, format }),\n hooks: {\n afterChange,\n beforeOperation,\n },\n lockDocuments: false,\n upload: {\n filesRequiredOnCreate: false,\n hideFileInputOnCreate: true,\n hideRemoveFile: true,\n },\n }\n\n if (disableJobsQueue) {\n beforeOperation.push(async ({ args, collection: collectionConfig, operation, req }) => {\n if (operation !== 'create') {\n return\n }\n const { user } = req\n const debug = pluginConfig.debug\n\n // Get max limit from the target collection's config\n const exportData = args.data as Export\n const targetCollection = req.payload.collections[exportData.collectionSlug]\n const exportLimitConfig: Limit | undefined =\n targetCollection?.config.custom?.['plugin-import-export']?.exportLimit\n const maxLimit = await resolveLimit({\n limit: exportLimitConfig,\n req,\n })\n\n await createExport({\n ...exportData,\n batchSize,\n debug,\n exportCollection: collectionConfig.slug,\n maxLimit,\n req,\n userCollection: user?.collection || user?.user?.collection,\n userID: user?.id || user?.user?.id,\n })\n })\n } else {\n afterChange.push(async ({ collection: collectionConfig, doc, operation, req }) => {\n if (operation !== 'create') {\n return\n }\n\n const { user } = req\n\n // Get max limit from the target collection's config\n // For job-based exports, we resolve the limit now since function limits\n // cannot be serialized. This means dynamic limits are resolved at queue time.\n const targetCollection = req.payload.collections[doc.collectionSlug]\n const exportLimitConfig: Limit | undefined =\n targetCollection?.config.custom?.['plugin-import-export']?.exportLimit\n const maxLimit = await resolveLimit({\n limit: exportLimitConfig,\n req,\n })\n\n const input: Export = {\n id: doc.id,\n name: doc.name,\n batchSize,\n collectionSlug: doc.collectionSlug,\n drafts: doc.drafts,\n exportCollection: collectionConfig.slug,\n fields: doc.fields,\n format: doc.format,\n limit: doc.limit,\n locale: doc.locale,\n maxLimit,\n page: doc.page,\n sort: doc.sort,\n userCollection: user?.collection || user?.user?.collection,\n userID: user?.id || user?.user?.id,\n where: doc.where,\n }\n\n await req.payload.jobs.queue({\n input,\n task: 'createCollectionExport',\n })\n })\n }\n\n return collection\n}\n"],"names":["resolveLimit","createExport","getFields","handleDownload","handlePreview","getExportCollection","collectionSlugs","config","exportConfig","pluginConfig","beforeOperation","afterChange","disableDownload","disableSave","disableJobsQueue","batchSize","format","collection","slug","access","update","admin","components","edit","SaveButton","custom","disableCopyToLocale","group","useAsTitle","disableDuplicate","endpoints","handler","req","debug","method","path","fields","hooks","lockDocuments","upload","filesRequiredOnCreate","hideFileInputOnCreate","hideRemoveFile","push","args","collectionConfig","operation","user","exportData","data","targetCollection","payload","collections","collectionSlug","exportLimitConfig","exportLimit","maxLimit","limit","exportCollection","userCollection","userID","id","doc","input","name","drafts","locale","page","sort","where","jobs","queue","task"],"mappings":"AAUA,SAASA,YAAY,QAAQ,+BAA8B;AAC3D,SAASC,YAAY,QAAQ,oBAAmB;AAChD,SAASC,SAAS,QAAQ,iBAAgB;AAC1C,SAASC,cAAc,QAAQ,sBAAqB;AACpD,SAASC,aAAa,QAAQ,qBAAoB;AAElD,OAAO,MAAMC,sBAAsB,CAAC,EAClCC,eAAe,EACfC,MAAM,EACNC,YAAY,EACZC,YAAY,EASb;IACC,MAAMC,kBAAmD,EAAE;IAC3D,MAAMC,cAA2C,EAAE;IAEnD,mCAAmC;IACnC,MAAMC,kBAAkBJ,cAAcI,mBAAmB;IACzD,MAAMC,cAAcL,cAAcK,eAAe;IACjD,MAAMC,mBAAmBN,cAAcM,oBAAoB;IAC3D,MAAMC,YAAYP,cAAcO,aAAa;IAC7C,MAAMC,SAASR,cAAcQ;IAE7B,MAAMC,aAA+B;QACnCC,MAAM;QACNC,QAAQ;YACNC,QAAQ,IAAM;QAChB;QACAC,OAAO;YACLC,YAAY;gBACVC,MAAM;oBACJC,YAAY;gBACd;YACF;YACAC,QAAQ;gBACNb;gBACAC;gBACAG;gBACA,wBAAwB;oBACtBV;gBACF;YACF;YACAoB,qBAAqB;YACrBC,OAAO;YACPC,YAAY;QACd;QACAC,kBAAkB;QAClBC,WAAW;YACT;gBACEC,SAAS,CAACC,MAAQ7B,eAAe6B,KAAKvB,aAAawB,KAAK;gBACxDC,QAAQ;gBACRC,MAAM;YACR;YACA;gBACEJ,SAAS3B;gBACT8B,QAAQ;gBACRC,MAAM;YACR;SACD;QACDC,QAAQlC,UAAU;YAAE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CAAC,uBAAuB,EAAE8B;YAC7D,MAAMC,WAAW,MAAMxD,aAAa;gBAClCyD,OAAOH;gBACPtB;YACF;YAEA,MAAM+B,QAAgB;gBACpBF,IAAIC,IAAID,EAAE;gBACVG,MAAMF,IAAIE,IAAI;gBACdjD;gBACAsC,gBAAgBS,IAAIT,cAAc;gBAClCY,QAAQH,IAAIG,MAAM;gBAClBP,kBAAkBb,iBAAiB3B,IAAI;gBACvCkB,QAAQ0B,IAAI1B,MAAM;gBAClBpB,QAAQ8C,IAAI9C,MAAM;gBAClByC,OAAOK,IAAIL,KAAK;gBAChBS,QAAQJ,IAAII,MAAM;gBAClBV;gBACAW,MAAML,IAAIK,IAAI;gBACdC,MAAMN,IAAIM,IAAI;gBACdT,gBAAgBZ,MAAM9B,cAAc8B,MAAMA,MAAM9B;gBAChD2C,QAAQb,MAAMc,MAAMd,MAAMA,MAAMc;gBAChCQ,OAAOP,IAAIO,KAAK;YAClB;YAEA,MAAMrC,IAAImB,OAAO,CAACmB,IAAI,CAACC,KAAK,CAAC;gBAC3BR;gBACAS,MAAM;YACR;QACF;IACF;IAEA,OAAOvD;AACT,EAAC"}
1
+ {"version":3,"sources":["../../src/export/getExportCollection.ts"],"sourcesContent":["import type {\n CollectionAfterChangeHook,\n CollectionBeforeOperationHook,\n CollectionConfig,\n Config,\n} from 'payload'\n\nimport type { ExportConfig, ImportExportPluginConfig, Limit } from '../types.js'\nimport type { Export } from './createExport.js'\n\nimport { resolveLimit } from '../utilities/resolveLimit.js'\nimport { createExport } from './createExport.js'\nimport { getFields } from './getFields.js'\nimport { handleDownload } from './handleDownload.js'\nimport { handlePreview } from './handlePreview.js'\n\nconst FALLBACK_BATCH_SIZE = 100\n\nexport const getExportCollection = ({\n collectionSlugs,\n config,\n exportConfig,\n pluginConfig,\n}: {\n /**\n * Collection slugs that this export collection supports.\n */\n collectionSlugs: string[]\n config: Config\n exportConfig?: ExportConfig\n pluginConfig: ImportExportPluginConfig\n}): CollectionConfig => {\n const beforeOperation: CollectionBeforeOperationHook[] = []\n const afterChange: CollectionAfterChangeHook[] = []\n\n const disableDownload = exportConfig?.disableDownload ?? false\n const disableSave = exportConfig?.disableSave ?? false\n const format = exportConfig?.format\n\n const collection: CollectionConfig = {\n slug: 'exports',\n access: {\n update: () => false,\n },\n admin: {\n components: {\n edit: {\n SaveButton: '@payloadcms/plugin-import-export/rsc#ExportSaveButton',\n },\n },\n custom: {\n disableDownload,\n disableSave,\n format,\n 'plugin-import-export': {\n collectionSlugs,\n },\n },\n disableCopyToLocale: true,\n group: false,\n useAsTitle: 'name',\n },\n disableDuplicate: true,\n endpoints: [\n {\n handler: (req) => handleDownload(req, pluginConfig.debug),\n method: 'post',\n path: '/download',\n },\n {\n handler: handlePreview,\n method: 'post',\n path: '/export-preview',\n },\n ],\n fields: getFields({ collectionSlugs, config, format }),\n hooks: {\n afterChange,\n beforeOperation,\n },\n lockDocuments: false,\n upload: {\n filesRequiredOnCreate: false,\n hideFileInputOnCreate: true,\n hideRemoveFile: true,\n },\n }\n\n // Synchronous export hook - runs when target collection has disableJobsQueue enabled\n beforeOperation.push(async ({ args, collection: collectionConfig, operation, req }) => {\n if (operation !== 'create') {\n return\n }\n\n const exportData = args.data as Export\n const targetCollection = req.payload.collections[exportData.collectionSlug]\n const targetPluginConfig = targetCollection?.config.custom?.['plugin-import-export']\n\n // Check if this target collection should use sync mode\n // Fall back to exportConfig (for custom collections with overrideCollection)\n const disableJobsQueue =\n targetPluginConfig?.exportDisableJobsQueue ?? exportConfig?.disableJobsQueue ?? false\n if (!disableJobsQueue) {\n return\n }\n\n const { user } = req\n const debug = pluginConfig.debug\n\n const exportLimitConfig: Limit | undefined = targetPluginConfig?.exportLimit\n const maxLimit = await resolveLimit({\n limit: exportLimitConfig,\n req,\n })\n\n const batchSize =\n targetPluginConfig?.exportBatchSize ??\n exportConfig?.batchSize ??\n pluginConfig.batchSize ??\n FALLBACK_BATCH_SIZE\n\n await createExport({\n ...exportData,\n batchSize,\n debug,\n exportCollection: collectionConfig.slug,\n maxLimit,\n req,\n userCollection: user?.collection || user?.user?.collection,\n userID: user?.id || user?.user?.id,\n })\n })\n\n afterChange.push(async ({ collection: collectionConfig, doc, operation, req }) => {\n if (operation !== 'create') {\n return\n }\n\n const targetCollection = req.payload.collections[doc.collectionSlug]\n const targetPluginConfig = targetCollection?.config.custom?.['plugin-import-export']\n const disableJobsQueue =\n targetPluginConfig?.exportDisableJobsQueue ?? exportConfig?.disableJobsQueue ?? false\n if (disableJobsQueue) {\n return\n }\n\n const { user } = req\n\n // Get max limit from the target collection's config\n // For job-based exports, we resolve the limit now since function limits\n // cannot be serialized. This means dynamic limits are resolved at queue time.\n const exportLimitConfig: Limit | undefined = targetPluginConfig?.exportLimit\n const maxLimit = await resolveLimit({\n limit: exportLimitConfig,\n req,\n })\n\n const batchSize =\n targetPluginConfig?.exportBatchSize ??\n exportConfig?.batchSize ??\n pluginConfig.batchSize ??\n FALLBACK_BATCH_SIZE\n\n const input: Export = {\n id: doc.id,\n name: doc.name,\n batchSize,\n collectionSlug: doc.collectionSlug,\n drafts: doc.drafts,\n exportCollection: collectionConfig.slug,\n fields: doc.fields,\n format: doc.format,\n limit: doc.limit,\n locale: doc.locale,\n maxLimit,\n page: doc.page,\n sort: doc.sort,\n userCollection: user?.collection || user?.user?.collection,\n userID: user?.id || user?.user?.id,\n where: doc.where,\n }\n\n await req.payload.jobs.queue({\n input,\n task: 'createCollectionExport',\n })\n })\n\n return collection\n}\n"],"names":["resolveLimit","createExport","getFields","handleDownload","handlePreview","FALLBACK_BATCH_SIZE","getExportCollection","collectionSlugs","config","exportConfig","pluginConfig","beforeOperation","afterChange","disableDownload","disableSave","format","collection","slug","access","update","admin","components","edit","SaveButton","custom","disableCopyToLocale","group","useAsTitle","disableDuplicate","endpoints","handler","req","debug","method","path","fields","hooks","lockDocuments","upload","filesRequiredOnCreate","hideFileInputOnCreate","hideRemoveFile","push","args","collectionConfig","operation","exportData","data","targetCollection","payload","collections","collectionSlug","targetPluginConfig","disableJobsQueue","exportDisableJobsQueue","user","exportLimitConfig","exportLimit","maxLimit","limit","batchSize","exportBatchSize","exportCollection","userCollection","userID","id","doc","input","name","drafts","locale","page","sort","where","jobs","queue","task"],"mappings":"AAUA,SAASA,YAAY,QAAQ,+BAA8B;AAC3D,SAASC,YAAY,QAAQ,oBAAmB;AAChD,SAASC,SAAS,QAAQ,iBAAgB;AAC1C,SAASC,cAAc,QAAQ,sBAAqB;AACpD,SAASC,aAAa,QAAQ,qBAAoB;AAElD,MAAMC,sBAAsB;AAE5B,OAAO,MAAMC,sBAAsB,CAAC,EAClCC,eAAe,EACfC,MAAM,EACNC,YAAY,EACZC,YAAY,EASb;IACC,MAAMC,kBAAmD,EAAE;IAC3D,MAAMC,cAA2C,EAAE;IAEnD,MAAMC,kBAAkBJ,cAAcI,mBAAmB;IACzD,MAAMC,cAAcL,cAAcK,eAAe;IACjD,MAAMC,SAASN,cAAcM;IAE7B,MAAMC,aAA+B;QACnCC,MAAM;QACNC,QAAQ;YACNC,QAAQ,IAAM;QAChB;QACAC,OAAO;YACLC,YAAY;gBACVC,MAAM;oBACJC,YAAY;gBACd;YACF;YACAC,QAAQ;gBACNX;gBACAC;gBACAC;gBACA,wBAAwB;oBACtBR;gBACF;YACF;YACAkB,qBAAqB;YACrBC,OAAO;YACPC,YAAY;QACd;QACAC,kBAAkB;QAClBC,WAAW;YACT;gBACEC,SAAS,CAACC,MAAQ5B,eAAe4B,KAAKrB,aAAasB,KAAK;gBACxDC,QAAQ;gBACRC,MAAM;YACR;YACA;gBACEJ,SAAS1B;gBACT6B,QAAQ;gBACRC,MAAM;YACR;SACD;QACDC,QAAQjC,UAAU;YAAEK;YAAiBC;YAAQO;QAAO;QACpDqB,OAAO;YACLxB;YACAD;QACF;QACA0B,eAAe;QACfC,QAAQ;YACNC,uBAAuB;YACvBC,uBAAuB;YACvBC,gBAAgB;QAClB;IACF;IAEA,qFAAqF;IACrF9B,gBAAgB+B,IAAI,CAAC,OA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A,kBAAkB;YACpB;QACF;QAEA,MAAM,EAAEE,IAAI,EAAE,GAAGxB;QAEjB,oDAAoD;QACpD,wEAAwE;QACxE,8EAA8E;QAC9E,MAAMyB,oBAAuCJ,oBAAoBK;QACjE,MAAMC,WAAW,MAAM1D,aAAa;YAClC2D,OAAOH;YACPzB;QACF;QAEA,MAAM6B,YACJR,oBAAoBS,mBACpBpD,cAAcmD,aACdlD,aAAakD,SAAS,IACtBvD;QAEF,MAAM8D,QAAgB;YACpBF,IAAIC,IAAID,EAAE;YACVG,MAAMF,IAAIE,IAAI;YACdR;YACAT,gBAAgBe,IAAIf,cAAc;YAClCkB,QAAQH,IAAIG,MAAM;YAClBP,kBAAkBlB,iBAAiB3B,IAAI;YACvCkB,QAAQ+B,IAAI/B,MAAM;YAClBpB,QAAQmD,IAAInD,MAAM;YAClB4C,OAAOO,IAAIP,KAAK;YAChBW,QAAQJ,IAAII,MAAM;YAClBZ;YACAa,MAAML,IAAIK,IAAI;YACdC,MAAMN,IAAIM,IAAI;YACdT,gBAAgBR,MAAMvC,cAAcuC,MAAMA,MAAMvC;YAChDgD,QAAQT,MAAMU,MAAMV,MAAMA,MAAMU;YAChCQ,OAAOP,IAAIO,KAAK;QAClB;QAEA,MAAM1C,IAAIkB,OAAO,CAACyB,IAAI,CAACC,KAAK,CAAC;YAC3BR;YACAS,MAAM;QACR;IACF;IAEA,OAAO5D;AACT,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"getFields.d.ts","sourceRoot":"","sources":["../../src/export/getFields.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAA+B,MAAM,SAAS,CAAA;AAKzE,KAAK,gBAAgB,GAAG;IACtB;;;OAGG;IACH,eAAe,EAAE,MAAM,EAAE,CAAA;IACzB,MAAM,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,GAAG,MAAM,CAAA;CACxB,CAAA;AAED,eAAO,MAAM,SAAS,YAAa,gBAAgB,KAAG,KAAK,EA4Q1D,CAAA"}
1
+ {"version":3,"file":"getFields.d.ts","sourceRoot":"","sources":["../../src/export/getFields.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAA+B,MAAM,SAAS,CAAA;AAKzE,KAAK,gBAAgB,GAAG;IACtB;;;OAGG;IACH,eAAe,EAAE,MAAM,EAAE,CAAA;IACzB,MAAM,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,GAAG,MAAM,CAAA;CACxB,CAAA;AAED,eAAO,MAAM,SAAS,YAAa,gBAAgB,KAAG,KAAK,EAuQ1D,CAAA"}
@@ -43,18 +43,15 @@ export const getFields = (options)=>{
43
43
  name: 'format',
44
44
  type: 'select',
45
45
  admin: {
46
- readOnly: Boolean(format),
46
+ components: {
47
+ Field: '@payloadcms/plugin-import-export/rsc#FormatField'
48
+ },
47
49
  width: '33.3333%'
48
50
  },
49
51
  defaultValue: format ?? 'csv',
50
52
  // @ts-expect-error - this is not correctly typed in plugins right now
51
53
  label: ({ t })=>t('plugin-import-export:field-format-label'),
52
- options: format ? [
53
- {
54
- label: format.toUpperCase(),
55
- value: format
56
- }
57
- ] : [
54
+ options: [
58
55
  {
59
56
  label: 'CSV',
60
57
  value: 'csv'
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/export/getFields.ts"],"sourcesContent":["import type { TFunction } from '@payloadcms/translations'\nimport type { Config, Field, PayloadRequest, SelectField } from 'payload'\n\nimport { getFilename } from '../utilities/getFilename.js'\nimport { validateLimitValue } from '../utilities/validateLimitValue.js'\n\ntype GetFieldsOptions = {\n /**\n * Collection slugs that this export collection supports.\n * Used for schema/types and as the options in the select field.\n */\n collectionSlugs: string[]\n config: Config\n /**\n * Force a specific format, hiding the format dropdown\n */\n format?: 'csv' | 'json'\n}\n\nexport const getFields = (options: GetFieldsOptions): Field[] => {\n const { collectionSlugs, config, format } = options\n\n let localeField: SelectField | undefined\n\n if (config.localization) {\n localeField = {\n name: 'locale',\n type: 'select',\n admin: {\n width: '25%',\n },\n defaultValue: 'all',\n // @ts-expect-error - this is not correctly typed in plugins right now\n label: ({ t }) => t('plugin-import-export:field-locale-label'),\n options: [\n {\n label: ({ t }) => t('general:allLocales'),\n value: 'all',\n },\n ...config.localization.locales.map((locale) => ({\n label: typeof locale === 'string' ? locale : locale.label,\n value: typeof locale === 'string' ? locale : locale.code,\n })),\n ],\n }\n }\n\n return [\n {\n type: 'collapsible',\n fields: [\n {\n name: 'name',\n type: 'text',\n defaultValue: () => getFilename(),\n // @ts-expect-error - this is not correctly typed in plugins right now\n label: ({ t }) => t('plugin-import-export:field-name-label'),\n },\n {\n type: 'row',\n fields: [\n {\n name: 'format',\n type: 'select',\n admin: {\n readOnly: Boolean(format),\n width: '33.3333%',\n },\n defaultValue: format ?? 'csv',\n // @ts-expect-error - this is not correctly typed in plugins right now\n label: ({ t }) => t('plugin-import-export:field-format-label'),\n options: format\n ? [\n {\n label: format.toUpperCase(),\n value: format,\n },\n ]\n : [\n {\n label: 'CSV',\n value: 'csv',\n },\n {\n label: 'JSON',\n value: 'json',\n },\n ],\n required: true,\n },\n {\n name: 'limit',\n type: 'number',\n admin: {\n placeholder: 'No limit',\n step: 100,\n width: '33.3333%',\n },\n validate: (value: null | number | undefined, { req }: { req: { t: TFunction } }) => {\n return validateLimitValue(value, req.t) ?? true\n },\n // @ts-expect-error - this is not correctly typed in plugins right now\n label: ({ t }) => t('plugin-import-export:field-limit-label'),\n },\n {\n name: 'page',\n type: 'number',\n admin: {\n components: {\n Field: '@payloadcms/plugin-import-export/rsc#Page',\n },\n condition: ({ limit }) => {\n // Show the page field only if limit is set\n return typeof limit === 'number' && limit !== 0\n },\n width: '33.3333%',\n },\n defaultValue: 1,\n // @ts-expect-error - this is not correctly typed in plugins right now\n label: ({ t }) => t('plugin-import-export:field-page-label'),\n },\n ],\n },\n {\n type: 'row',\n fields: [\n {\n name: 'sort',\n type: 'text',\n admin: {\n components: {\n Field: '@payloadcms/plugin-import-export/rsc#SortBy',\n },\n },\n // @ts-expect-error - this is not correctly typed in plugins right now\n label: ({ t }) => t('plugin-import-export:field-sort-label'),\n },\n {\n name: 'sortOrder',\n type: 'select',\n admin: {\n components: {\n Field: '@payloadcms/plugin-import-export/rsc#SortOrder',\n },\n // Only show when `sort` has a value\n condition: ({ sort }) => typeof sort === 'string' && sort.trim().length > 0,\n },\n // @ts-expect-error - this is not correctly typed in plugins right now\n label: ({ t }) => t('plugin-import-export:field-sort-order-label'),\n options: [\n { label: 'Ascending', value: 'asc' },\n { label: 'Descending', value: 'desc' },\n ],\n },\n ...(localeField ? [localeField] : []),\n {\n name: 'drafts',\n type: 'select',\n admin: {\n condition: (data) => {\n const collectionConfig = (config.collections ?? []).find(\n (collection) => collection.slug === data.collectionSlug,\n )\n return Boolean(\n typeof collectionConfig?.versions === 'object' &&\n collectionConfig?.versions?.drafts,\n )\n },\n width: '25%',\n },\n defaultValue: 'yes',\n // @ts-expect-error - this is not correctly typed in plugins right now\n label: ({ t }) => t('plugin-import-export:field-drafts-label'),\n options: [\n {\n label: ({ t }) => t('general:yes'),\n value: 'yes',\n },\n {\n label: ({ t }) => t('general:no'),\n value: 'no',\n },\n ],\n },\n // {\n // name: 'depth',\n // type: 'number',\n // // @ts-expect-error - this is not correctly typed in plugins right now\n // label: ({ t }) => t('plugin-import-export:field-depth-label'),\n // admin: {\n // width: '33%',\n // },\n // defaultValue: 1,\n // required: true,\n // },\n ],\n },\n {\n name: 'selectionToUse',\n type: 'radio',\n admin: {\n components: {\n Field: '@payloadcms/plugin-import-export/rsc#SelectionToUseField',\n },\n },\n options: [\n {\n // @ts-expect-error - this is not correctly typed in plugins right now\n label: ({ t }) => t('plugin-import-export:selectionToUse-currentSelection'),\n value: 'currentSelection',\n },\n {\n // @ts-expect-error - this is not correctly typed in plugins right now\n label: ({ t }) => t('plugin-import-export:selectionToUse-currentFilters'),\n value: 'currentFilters',\n },\n {\n // @ts-expect-error - this is not correctly typed in plugins right now\n label: ({ t }) => t('plugin-import-export:selectionToUse-allDocuments'),\n value: 'all',\n },\n ],\n virtual: true,\n },\n {\n name: 'fields',\n type: 'text',\n admin: {\n components: {\n Field: '@payloadcms/plugin-import-export/rsc#FieldsToExport',\n },\n },\n hasMany: true,\n // @ts-expect-error - this is not correctly typed in plugins right now\n label: ({ t }) => t('plugin-import-export:field-fields-label'),\n },\n {\n name: 'collectionSlug',\n type: 'text',\n admin: {\n components: {\n Field: '@payloadcms/plugin-import-export/rsc#CollectionField',\n },\n },\n defaultValue: collectionSlugs[0],\n required: true,\n validate: (value: null | string | undefined, { req }: { req: PayloadRequest }) => {\n if (!value) {\n return 'Collection is required'\n }\n // Validate that the collection exists\n const collectionExists = req?.payload?.collections?.[value]\n if (!collectionExists) {\n return `Collection \"${value}\" does not exist`\n }\n return true\n },\n },\n {\n name: 'where',\n type: 'json',\n admin: {\n hidden: true,\n },\n defaultValue: {},\n hooks: {\n beforeValidate: [\n ({ value }) => {\n return value ?? {}\n },\n ],\n },\n },\n ],\n // @ts-expect-error - this is not correctly typed in plugins right now\n label: ({ t }) => t('plugin-import-export:exportOptions'),\n },\n {\n name: 'preview',\n type: 'ui',\n admin: {\n components: {\n Field: '@payloadcms/plugin-import-export/rsc#ExportPreview',\n },\n },\n },\n ]\n}\n"],"names":["getFilename","validateLimitValue","getFields","options","collectionSlugs","config","format","localeField","localization","name","type","admin","width","defaultValue","label","t","value","locales","map","locale","code","fields","readOnly","Boolean","toUpperCase","required","placeholder","step","validate","req","components","Field","condition","limit","sort","trim","length","data","collectionConfig","collections","find","collection","slug","collectionSlug","versions","drafts","virtual","hasMany","collectionExists","payload","hidden","hooks","beforeValidate"],"mappings":"AAGA,SAASA,WAAW,QAAQ,8BAA6B;AACzD,SAASC,kBAAkB,QAAQ,qCAAoC;AAevE,OAAO,MAAMC,YAAY,CAACC;IACxB,MAAM,EAAEC,eAAe,EAAEC,MAAM,EAAEC,MAAM,EAAE,GAA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B,KAAKoB,SAASV,aAAa,CAACvB,MAAM;wBAC3D,IAAI,CAACgC,kBAAkB;4BACrB,OAAO,CAAC,YAAY,EAAEhC,MAAM,gBAAgB,CAAC;wBAC/C;wBACA,OAAO;oBACT;gBACF;gBACA;oBACEP,MAAM;oBACNC,MAAM;oBACNC,OAAO;wBACLuC,QAAQ;oBACV;oBACArC,cAAc,CAAC;oBACfsC,OAAO;wBACLC,gBAAgB;4BACd,CAAC,EAAEpC,KAAK,EAAE;gCACR,OAAOA,SAAS,CAAC;4BACnB;yBACD;oBACH;gBACF;aACD;YACD,sEAAsE;YACtEF,OAAO,CAAC,EAAEC,CAAC,EAAE,GAAKA,EAAE;QACtB;QACA;YACEN,MAAM;YACNC,MAAM;YACNC,OAAO;gBACLmB,YAAY;oBACVC,OAAO;gBACT;YACF;QACF;KACD;AACH,EAAC"}
1
+ {"version":3,"sources":["../../src/export/getFields.ts"],"sourcesContent":["import type { TFunction } from '@payloadcms/translations'\nimport type { Config, Field, PayloadRequest, SelectField } from 'payload'\n\nimport { getFilename } from '../utilities/getFilename.js'\nimport { validateLimitValue } from '../utilities/validateLimitValue.js'\n\ntype GetFieldsOptions = {\n /**\n * Collection slugs that this export collection supports.\n * Used for schema/types and as the options in the select field.\n */\n collectionSlugs: string[]\n config: Config\n /**\n * Force a specific format, hiding the format dropdown\n */\n format?: 'csv' | 'json'\n}\n\nexport const getFields = (options: GetFieldsOptions): Field[] => {\n const { collectionSlugs, config, format } = options\n\n let localeField: SelectField | undefined\n\n if (config.localization) {\n localeField = {\n name: 'locale',\n type: 'select',\n admin: {\n width: '25%',\n },\n defaultValue: 'all',\n // @ts-expect-error - this is not correctly typed in plugins right now\n label: ({ t }) => t('plugin-import-export:field-locale-label'),\n options: [\n {\n label: ({ t }) => t('general:allLocales'),\n value: 'all',\n },\n ...config.localization.locales.map((locale) => ({\n label: typeof locale === 'string' ? locale : locale.label,\n value: typeof locale === 'string' ? locale : locale.code,\n })),\n ],\n }\n }\n\n return [\n {\n type: 'collapsible',\n fields: [\n {\n name: 'name',\n type: 'text',\n defaultValue: () => getFilename(),\n // @ts-expect-error - this is not correctly typed in plugins right now\n label: ({ t }) => t('plugin-import-export:field-name-label'),\n },\n {\n type: 'row',\n fields: [\n {\n name: 'format',\n type: 'select',\n admin: {\n components: {\n Field: '@payloadcms/plugin-import-export/rsc#FormatField',\n },\n width: '33.3333%',\n },\n defaultValue: format ?? 'csv',\n // @ts-expect-error - this is not correctly typed in plugins right now\n label: ({ t }) => t('plugin-import-export:field-format-label'),\n options: [\n {\n label: 'CSV',\n value: 'csv',\n },\n {\n label: 'JSON',\n value: 'json',\n },\n ],\n required: true,\n },\n {\n name: 'limit',\n type: 'number',\n admin: {\n placeholder: 'No limit',\n step: 100,\n width: '33.3333%',\n },\n validate: (value: null | number | undefined, { req }: { req: { t: TFunction } }) => {\n return validateLimitValue(value, req.t) ?? true\n },\n // @ts-expect-error - this is not correctly typed in plugins right now\n label: ({ t }) => t('plugin-import-export:field-limit-label'),\n },\n {\n name: 'page',\n type: 'number',\n admin: {\n components: {\n Field: '@payloadcms/plugin-import-export/rsc#Page',\n },\n condition: ({ limit }) => {\n // Show the page field only if limit is set\n return typeof limit === 'number' && limit !== 0\n },\n width: '33.3333%',\n },\n defaultValue: 1,\n // @ts-expect-error - this is not correctly typed in plugins right now\n label: ({ t }) => t('plugin-import-export:field-page-label'),\n },\n ],\n },\n {\n type: 'row',\n fields: [\n {\n name: 'sort',\n type: 'text',\n admin: {\n components: {\n Field: '@payloadcms/plugin-import-export/rsc#SortBy',\n },\n },\n // @ts-expect-error - this is not correctly typed in plugins right now\n label: ({ t }) => t('plugin-import-export:field-sort-label'),\n },\n {\n name: 'sortOrder',\n type: 'select',\n admin: {\n components: {\n Field: '@payloadcms/plugin-import-export/rsc#SortOrder',\n },\n // Only show when `sort` has a value\n condition: ({ sort }) => typeof sort === 'string' && sort.trim().length > 0,\n },\n // @ts-expect-error - this is not correctly typed in plugins right now\n label: ({ t }) => t('plugin-import-export:field-sort-order-label'),\n options: [\n { label: 'Ascending', value: 'asc' },\n { label: 'Descending', value: 'desc' },\n ],\n },\n ...(localeField ? [localeField] : []),\n {\n name: 'drafts',\n type: 'select',\n admin: {\n condition: (data) => {\n const collectionConfig = (config.collections ?? []).find(\n (collection) => collection.slug === data.collectionSlug,\n )\n return Boolean(\n typeof collectionConfig?.versions === 'object' &&\n collectionConfig?.versions?.drafts,\n )\n },\n width: '25%',\n },\n defaultValue: 'yes',\n // @ts-expect-error - this is not correctly typed in plugins right now\n label: ({ t }) => t('plugin-import-export:field-drafts-label'),\n options: [\n {\n label: ({ t }) => t('general:yes'),\n value: 'yes',\n },\n {\n label: ({ t }) => t('general:no'),\n value: 'no',\n },\n ],\n },\n // {\n // name: 'depth',\n // type: 'number',\n // // @ts-expect-error - this is not correctly typed in plugins right now\n // label: ({ t }) => t('plugin-import-export:field-depth-label'),\n // admin: {\n // width: '33%',\n // },\n // defaultValue: 1,\n // required: true,\n // },\n ],\n },\n {\n name: 'selectionToUse',\n type: 'radio',\n admin: {\n components: {\n Field: '@payloadcms/plugin-import-export/rsc#SelectionToUseField',\n },\n },\n options: [\n {\n // @ts-expect-error - this is not correctly typed in plugins right now\n label: ({ t }) => t('plugin-import-export:selectionToUse-currentSelection'),\n value: 'currentSelection',\n },\n {\n // @ts-expect-error - this is not correctly typed in plugins right now\n label: ({ t }) => t('plugin-import-export:selectionToUse-currentFilters'),\n value: 'currentFilters',\n },\n {\n // @ts-expect-error - this is not correctly typed in plugins right now\n label: ({ t }) => t('plugin-import-export:selectionToUse-allDocuments'),\n value: 'all',\n },\n ],\n virtual: true,\n },\n {\n name: 'fields',\n type: 'text',\n admin: {\n components: {\n Field: '@payloadcms/plugin-import-export/rsc#FieldsToExport',\n },\n },\n hasMany: true,\n // @ts-expect-error - this is not correctly typed in plugins right now\n label: ({ t }) => t('plugin-import-export:field-fields-label'),\n },\n {\n name: 'collectionSlug',\n type: 'text',\n admin: {\n components: {\n Field: '@payloadcms/plugin-import-export/rsc#CollectionField',\n },\n },\n defaultValue: collectionSlugs[0],\n required: true,\n validate: (value: null | string | undefined, { req }: { req: PayloadRequest }) => {\n if (!value) {\n return 'Collection is required'\n }\n // Validate that the collection exists\n const collectionExists = req?.payload?.collections?.[value]\n if (!collectionExists) {\n return `Collection \"${value}\" does not exist`\n }\n return true\n },\n },\n {\n name: 'where',\n type: 'json',\n admin: {\n hidden: true,\n },\n defaultValue: {},\n hooks: {\n beforeValidate: [\n ({ value }) => {\n return value ?? {}\n },\n ],\n },\n },\n ],\n // @ts-expect-error - this is not correctly typed in plugins right now\n label: ({ t }) => t('plugin-import-export:exportOptions'),\n },\n {\n name: 'preview',\n type: 'ui',\n admin: {\n components: {\n Field: '@payloadcms/plugin-import-export/rsc#ExportPreview',\n },\n },\n },\n ]\n}\n"],"names":["getFilename","validateLimitValue","getFields","options","collectionSlugs","config","format","localeField","localization","name","type","admin","width","defaultValue","label","t","value","locales","map","locale","code","fields","components","Field","required","placeholder","step","validate","req","condition","limit","sort","trim","length","data","collectionConfig","collections","find","collection","slug","collectionSlug","Boolean","versions","drafts","virtual","hasMany","collectionExists","payload","hidden","hooks","beforeValidate"],"mappings":"AAGA,SAASA,WAAW,QAAQ,8BAA6B;AACzD,SAASC,kBAAkB,QAAQ,qCAAoC;AAevE,OAAO,MAAMC,YAAY,CAACC;IACxB,MAAM,EAAEC,eAAe,EAAEC,MAAM,EAAEC,MAAM,EAAE,GAAGH;IAE5C,IAAII;IAEJ,IAAIF,OAAOG,YAAY,EAAE;QACvBD,cAAc;YACZE,MAAM;YACNC,MAAM;YACNC,OAAO;gBACLC,OAAO;YACT;YACAC,cAAc;YACd,sEAAsE;YACtEC,OAAO,CAAC,EAAEC,CAAC,EAAE,GAAKA,EAAE;YACpBZ,SAAS;gBACP;oBACEW,OAAO,CAAC,EAAEC,CAAC,EAAE,GAAKA,EAAE;oBACpBC,OAAO;gBACT;mBACGX,OAAOG,YAAY,CAACS,OAAO,CAACC,GAAG,CA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AKA,EAAE;QACtB;QACA;YACEN,MAAM;YACNC,MAAM;YACNC,OAAO;gBACLW,YAAY;oBACVC,OAAO;gBACT;YACF;QACF;KACD;AACH,EAAC"}
@@ -3,6 +3,7 @@ export { ExportListMenuItem } from '../components/ExportListMenuItem/index.js';
3
3
  export { ExportPreview } from '../components/ExportPreview/index.js';
4
4
  export { ExportSaveButton } from '../components/ExportSaveButton/index.js';
5
5
  export { FieldsToExport } from '../components/FieldsToExport/index.js';
6
+ export { FormatField } from '../components/FormatField/index.js';
6
7
  export { ImportExportProvider } from '../components/ImportExportProvider/index.js';
7
8
  export { ImportListMenuItem } from '../components/ImportListMenuItem/index.js';
8
9
  export { ImportPreview } from '../components/ImportPreview/index.js';
@@ -1 +1 @@
1
- {"version":3,"file":"rsc.d.ts","sourceRoot":"","sources":["../../src/exports/rsc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAA;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAA;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAA;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAA;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAA;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,6CAA6C,CAAA;AAClF,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAA;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAA;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAA;AAC1E,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAA;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAA;AAChF,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAA;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAA"}
1
+ {"version":3,"file":"rsc.d.ts","sourceRoot":"","sources":["../../src/exports/rsc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAA;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAA;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAA;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAA;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAA;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAA;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,6CAA6C,CAAA;AAClF,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAA;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAA;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAA;AAC1E,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAA;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAA;AAChF,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAA;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAA"}
@@ -3,6 +3,7 @@ export { ExportListMenuItem } from '../components/ExportListMenuItem/index.js';
3
3
  export { ExportPreview } from '../components/ExportPreview/index.js';
4
4
  export { ExportSaveButton } from '../components/ExportSaveButton/index.js';
5
5
  export { FieldsToExport } from '../components/FieldsToExport/index.js';
6
+ export { FormatField } from '../components/FormatField/index.js';
6
7
  export { ImportExportProvider } from '../components/ImportExportProvider/index.js';
7
8
  export { ImportListMenuItem } from '../components/ImportListMenuItem/index.js';
8
9
  export { ImportPreview } from '../components/ImportPreview/index.js';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/exports/rsc.ts"],"sourcesContent":["export { CollectionField } from '../components/CollectionField/index.js'\nexport { ExportListMenuItem } from '../components/ExportListMenuItem/index.js'\nexport { ExportPreview } from '../components/ExportPreview/index.js'\nexport { ExportSaveButton } from '../components/ExportSaveButton/index.js'\nexport { FieldsToExport } from '../components/FieldsToExport/index.js'\nexport { ImportExportProvider } from '../components/ImportExportProvider/index.js'\nexport { ImportListMenuItem } from '../components/ImportListMenuItem/index.js'\nexport { ImportPreview } from '../components/ImportPreview/index.js'\nexport { ImportSaveButton } from '../components/ImportSaveButton/index.js'\nexport { Page } from '../components/Page/index.js'\nexport { SelectionToUseField } from '../components/SelectionToUseField/index.js'\nexport { SortBy } from '../components/SortBy/index.js'\nexport { SortOrder } from '../components/SortOrder/index.js'\n"],"names":["CollectionField","ExportListMenuItem","ExportPreview","ExportSaveButton","FieldsToExport","ImportExportProvider","ImportListMenuItem","ImportPreview","ImportSaveButton","Page","SelectionToUseField","SortBy","SortOrder"],"mappings":"AAAA,SAASA,eAAe,QAAQ,yCAAwC;AACxE,SAASC,kBAAkB,QAAQ,4CAA2C;AAC9E,SAASC,aAAa,QAAQ,uCAAsC;AACpE,SAASC,gBAAgB,QAAQ,0CAAyC;AAC1E,SAASC,cAAc,QAAQ,wCAAuC;AACtE,SAASC,oBAAoB,QAAQ,8CAA6C;AAClF,SAASC,kBAAkB,QAAQ,4CAA2C;AAC9E,SAASC,aAAa,QAAQ,uCAAsC;AACpE,SAASC,gBAAgB,QAAQ,0CAAyC;AAC1E,SAASC,IAAI,QAAQ,8BAA6B;AAClD,SAASC,mBAAmB,QAAQ,6CAA4C;AAChF,SAASC,MAAM,QAAQ,gCAA+B;AACtD,SAASC,SAAS,QAAQ,mCAAkC"}
1
+ {"version":3,"sources":["../../src/exports/rsc.ts"],"sourcesContent":["export { CollectionField } from '../components/CollectionField/index.js'\nexport { ExportListMenuItem } from '../components/ExportListMenuItem/index.js'\nexport { ExportPreview } from '../components/ExportPreview/index.js'\nexport { ExportSaveButton } from '../components/ExportSaveButton/index.js'\nexport { FieldsToExport } from '../components/FieldsToExport/index.js'\nexport { FormatField } from '../components/FormatField/index.js'\nexport { ImportExportProvider } from '../components/ImportExportProvider/index.js'\nexport { ImportListMenuItem } from '../components/ImportListMenuItem/index.js'\nexport { ImportPreview } from '../components/ImportPreview/index.js'\nexport { ImportSaveButton } from '../components/ImportSaveButton/index.js'\nexport { Page } from '../components/Page/index.js'\nexport { SelectionToUseField } from '../components/SelectionToUseField/index.js'\nexport { SortBy } from '../components/SortBy/index.js'\nexport { SortOrder } from '../components/SortOrder/index.js'\n"],"names":["CollectionField","ExportListMenuItem","ExportPreview","ExportSaveButton","FieldsToExport","FormatField","ImportExportProvider","ImportListMenuItem","ImportPreview","ImportSaveButton","Page","SelectionToUseField","SortBy","SortOrder"],"mappings":"AAAA,SAASA,eAAe,QAAQ,yCAAwC;AACxE,SAASC,kBAAkB,QAAQ,4CAA2C;AAC9E,SAASC,aAAa,QAAQ,uCAAsC;AACpE,SAASC,gBAAgB,QAAQ,0CAAyC;AAC1E,SAASC,cAAc,QAAQ,wCAAuC;AACtE,SAASC,WAAW,QAAQ,qCAAoC;AAChE,SAASC,oBAAoB,QAAQ,8CAA6C;AAClF,SAASC,kBAAkB,QAAQ,4CAA2C;AAC9E,SAASC,aAAa,QAAQ,uCAAsC;AACpE,SAASC,gBAAgB,QAAQ,0CAAyC;AAC1E,SAASC,IAAI,QAAQ,8BAA6B;AAClD,SAASC,mBAAmB,QAAQ,6CAA4C;AAChF,SAASC,MAAM,QAAQ,gCAA+B;AACtD,SAASC,SAAS,QAAQ,mCAAkC"}
@@ -1 +1 @@
1
- {"version":3,"file":"batchProcessor.d.ts","sourceRoot":"","sources":["../../src/import/batchProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAExD,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAEjE,OAAO,EACL,KAAK,UAAU,EAIhB,MAAM,mCAAmC,CAAA;AAE1C;;GAEG;AACH,M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C,YAAY,CAAC;EA2D1F"}
@@ -1,3 +1,4 @@
1
+ import { isolateObjectProperty } from 'payload';
1
2
  import { categorizeError, createBatches, extractErrorMessage } from '../utilities/useBatchProcessor.js';
2
3
  /**
3
4
  * Separates multi-locale data from a document for sequential locale updates.
@@ -65,11 +66,18 @@ import { categorizeError, createBatches, extractErrorMessage } from '../utilitie
65
66
  *
66
67
  * Handles versioned collections, multi-locale data, and MongoDB ObjectID validation.
67
68
  * Continues processing remaining documents even if individual imports fail.
68
- */ async function processImportBatch({ batch, batchIndex, collectionSlug, importMode, matchField, options, req, user }) {
69
+ */ async function processImportBatch({ batch, batchIndex, collectionSlug, importMode, matchField, options, req: reqFromArgs, user }) {
69
70
  const result = {
70
71
  failed: [],
71
72
  successful: []
72
73
  };
74
+ // Create a request proxy that isolates the transactionID property, then clear it.
75
+ // This is critical because if a nested operation fails (e.g., Forbidden due to access control),
76
+ // Payload's error handling calls killTransaction(req), which would kill the parent's transaction
77
+ // if we shared the same transaction. By isolating and clearing transactionID, each nested
78
+ // operation either uses no transaction or starts its own, independent of the parent.
79
+ const req = isolateObjectProperty(reqFromArgs, 'transactionID');
80
+ req.transactionID = undefined;
73
81
  const collectionEntry = req.payload.collections[collectionSlug];
74
82
  const collectionConfig = collectionEntry?.config;
75
83
  const collectionHasVersions = Boolean(collectionConfig?.versions);
@@ -97,6 +105,7 @@ import { categorizeError, createBatches, extractErrorMessage } from '../utilitie
97
105
  const statusValue = createData._status || options.defaultVersionStatus;
98
106
  const isPublished = statusValue !== 'draft';
99
107
  draftOption = !isPublished;
108
+ createData._status = statusValue;
100
109
  if (req.payload.config.debug) {
101
110
  req.payload.logger.info({
102
111
  _status: createData._status,
@@ -105,8 +114,6 @@ import { categorizeError, createBatches, extractErrorMessage } from '../utilitie
105
114
  willSetDraft: draftOption
106
115
  });
107
116
  }
108
- // Remove _status from data - it's controlled via draft option
109
- delete createData._status;
110
117
  }
111
118
  if (req.payload.config.debug && 'title' in createData) {
112
119
  req.payload.logger.info({
@@ -356,8 +363,7 @@ import { categorizeError, createBatches, extractErrorMessage } from '../utilitie
356
363
  const statusValue = createData._status || options.defaultVersionStatus;
357
364
  const isPublished = statusValue !== 'draft';
358
365
  draftOption = !isPublished;
359
- // Remove _status from data - it's controlled via draft option
360
- delete createData._status;
366
+ createData._status = statusValue;
361
367
  }
362
368
  // Check if we have multi-locale data and extract it
363
369
  const { flatData, hasMultiLocale, localeUpdates } = extractMultiLocaleData(createData, configuredLocales);