@payloadcms/plugin-import-export 3.66.0-canary.5 → 3.66.0-canary.7

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.
@@ -17,8 +17,6 @@ export type Export = {
17
17
  page?: number;
18
18
  slug: string;
19
19
  sort: Sort;
20
- user: string;
21
- userCollection: string;
22
20
  where?: Where;
23
21
  };
24
22
  export type CreateExportArgs = {
@@ -28,7 +26,7 @@ export type CreateExportArgs = {
28
26
  download?: boolean;
29
27
  input: Export;
30
28
  req: PayloadRequest;
31
- user?: TypedUser;
29
+ user?: null | TypedUser;
32
30
  };
33
31
  export declare const createExport: (args: CreateExportArgs) => Promise<Response | undefined>;
34
32
  //# sourceMappingURL=createExport.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createExport.d.ts","sourceRoot":"","sources":["../../src/export/createExport.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAarE,MAAM,MAAM,MAAM,GAAG;IACnB,cAAc,EAAE,MAAM,CAAA;IACtB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,MAAM,CAAC,EAAE,IAAI,GAAG,KAAK,CAAA;IACrB,iBAAiB,EAAE,MAAM,CAAA;IACzB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IACjB,MAAM,EAAE,KAAK,GAAG,MAAM,CAAA;IACtB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,IAAI,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ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AAC,EAAE,IAAI,GAAG,SAAS,CAAA;CACxB,CAAA;AAED,eAAO,MAAM,YAAY,SAAgB,gBAAgB,kCA6YxD,CAAA"}
@@ -8,7 +8,10 @@ import { getCustomFieldFunctions } from './getCustomFieldFunctions.js';
8
8
  import { getFilename } from './getFilename.js';
9
9
  import { getSelect } from './getSelect.js';
10
10
  export const createExport = async (args)=>{
11
- const { download, input: { id, name: nameArg, collectionSlug, debug = false, drafts, exportsCollection, fields, format, locale: localeInput, sort, user, page, limit: incomingLimit, where }, req: { locale: localeArg, payload }, req } = args;
11
+ const { download, input: { id, name: nameArg, collectionSlug, debug = false, drafts, exportsCollection, fields, format, locale: localeInput, sort, page, limit: incomingLimit, where }, req: { locale: localeArg, payload }, req, user } = args;
12
+ if (!user) {
13
+ throw new APIError('User authentication is required to create exports');
14
+ }
12
15
  if (debug) {
13
16
  req.payload.logger.debug({
14
17
  message: 'Starting export process with args:',
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/export/createExport.ts"],"sourcesContent":["/* eslint-disable perfectionist/sort-objects */\nimport type { PayloadRequest, Sort, TypedUser, Where } from 'payload'\n\nimport { stringify } from 'csv-stringify/sync'\nimport { APIError } from 'payload'\nimport { Readable } from 'stream'\n\nimport { buildDisabledFieldRegex } from '../utilities/buildDisabledFieldRegex.js'\nimport { validateLimitValue } from '../utilities/validateLimitValue.js'\nimport { flattenObject } from './flattenObject.js'\nimport { getCustomFieldFunctions } from './getCustomFieldFunctions.js'\nimport { getFilename } from './getFilename.js'\nimport { getSelect } from './getSelect.js'\n\nexport type Export = {\n collectionSlug: string\n /**\n * If true, enables debug logging\n */\n debug?: boolean\n drafts?: 'no' | 'yes'\n exportsCollection: string\n fields?: string[]\n format: 'csv' | 'json'\n globals?: string[]\n id: number | string\n limit?: number\n locale?: string\n name: string\n page?: number\n slug: string\n sort: Sort\n user: string\n userCollection: string\n where?: Where\n}\n\nexport type CreateExportArgs = {\n /**\n * If true, stream the file instead of saving it\n */\n download?: boolean\n input: Export\n req: PayloadRequest\n user?: TypedUser\n}\n\nexport const createExport = async (args: CreateExportArgs) => {\n const {\n download,\n input: {\n id,\n name: nameArg,\n collectionSlug,\n debug = false,\n drafts,\n exportsCollection,\n fields,\n format,\n locale: localeInput,\n sort,\n user,\n page,\n limit: incomingLimit,\n where,\n },\n req: { locale: localeArg, payload },\n req,\n } = args\n\n if (debug) {\n req.payload.logger.debug({\n message: 'Starting export process with args:',\n collectionSlug,\n drafts,\n fields,\n format,\n })\n }\n\n const locale = localeInput ?? localeArg\n const collectionConfig = payload.config.collections.find(({ slug }) => slug === collectionSlug)\n if (!collectionConfig) {\n throw new APIError(`Collection with slug ${collectionSlug} not found`)\n }\n\n const name = `${nameArg ?? `${getFilename()}-${collectionSlug}`}.${format}`\n const isCSV = format === 'csv'\n const select = Array.isArray(fields) && fields.length > 0 ? getSelect(fields) : undefined\n\n if (debug) {\n req.payload.logger.debug({ message: 'Export configuration:', name, isCSV, locale })\n }\n\n const batchSize = 100 // fixed per request\n\n const hardLimit =\n typeof incomingLimit === 'number' && incomingLimit > 0 ? incomingLimit : undefined\n\n const { totalDocs } = await payload.count({\n collection: collectionSlug,\n user,\n locale,\n overrideAccess: false,\n })\n\n const totalPages = Math.max(1, Math.ceil(totalDocs / batchSize))\n const requestedPage = page || 1\n const adjustedPage = requestedPage > totalPages ? 1 : requestedPage\n\n const findArgs = {\n collection: collectionSlug,\n depth: 1,\n draft: drafts === 'yes',\n limit: batchSize,\n locale,\n overrideAccess: false,\n page: 0, // The page will be incremented manually in the loop\n select,\n sort,\n user,\n where,\n }\n\n if (debug) {\n req.payload.logger.debug({ message: 'Find arguments:', findArgs })\n }\n\n const toCSVFunctions = getCustomFieldFunctions({\n fields: collectionConfig.flattenedFields,\n })\n\n const disabledFields =\n collectionConfig.admin?.custom?.['plugin-import-export']?.disabledFields ?? []\n\n const disabledRegexes: RegExp[] = disabledFields.map(buildDisabledFieldRegex)\n\n const filterDisabledCSV = (row: Record<string, unknown>): Record<string, unknown> => {\n const filtered: Record<string, unknown> = {}\n\n for (const [key, value] of Object.entries(row)) {\n const isDisabled = disabledRegexes.some((regex) => regex.test(key))\n if (!isDisabled) {\n filtered[key] = value\n }\n }\n\n return filtered\n }\n\n const filterDisabledJSON = (doc: any, parentPath = ''): any => {\n if (Array.isArray(doc)) {\n return doc.map((item) => filterDisabledJSON(item, parentPath))\n }\n\n if (typeof doc !== 'object' || doc === null) {\n return doc\n }\n\n const filtered: Record<string, any> = {}\n for (const [key, value] of Object.entries(doc)) {\n const currentPath = parentPath ? `${parentPath}.${key}` : key\n\n // Only remove if this exact path is disabled\n const isDisabled = disabledFields.includes(currentPath)\n\n if (!isDisabled) {\n filtered[key] = filterDisabledJSON(value, currentPath)\n }\n }\n\n return filtered\n }\n\n if (download) {\n if (debug) {\n req.payload.logger.debug('Pre-scanning all columns before streaming')\n }\n\n const limitErrorMsg = validateLimitValue(\n incomingLimit,\n req.t,\n batchSize, // step i.e. 100\n )\n if (limitErrorMsg) {\n throw new APIError(limitErrorMsg)\n }\n\n const allColumns: string[] = []\n\n if (isCSV) {\n const allColumnsSet = new Set<string>()\n\n // Use the incoming page value here, defaulting to 1 if undefined\n let scanPage = adjustedPage\n let hasMore = true\n let fetched = 0\n const maxDocs = typeof hardLimit === 'number' ? hardLimit : Number.POSITIVE_INFINITY\n\n while (hasMore) {\n const remaining = Math.max(0, maxDocs - fetched)\n if (remaining === 0) {\n break\n }\n\n const result = await payload.find({\n ...findArgs,\n page: scanPage,\n limit: Math.min(batchSize, remaining),\n })\n\n result.docs.forEach((doc) => {\n const flat = filterDisabledCSV(flattenObject({ doc, fields, toCSVFunctions }))\n Object.keys(flat).forEach((key) => {\n if (!allColumnsSet.has(key)) {\n allColumnsSet.add(key)\n allColumns.push(key)\n }\n })\n })\n\n fetched += result.docs.length\n scanPage += 1 // Increment page for next batch\n hasMore = result.hasNextPage && fetched < maxDocs\n }\n\n if (debug) {\n req.payload.logger.debug(`Discovered ${allColumns.length} columns`)\n }\n }\n\n const encoder = new TextEncoder()\n let isFirstBatch = true\n let streamPage = adjustedPage\n let fetched = 0\n const maxDocs = typeof hardLimit === 'number' ? hardLimit : Number.POSITIVE_INFINITY\n\n const stream = new Readable({\n async read() {\n const remaining = Math.max(0, maxDocs - fetched)\n\n if (remaining === 0) {\n if (!isCSV) {\n this.push(encoder.encode(']'))\n }\n this.push(null)\n return\n }\n\n const result = await payload.find({\n ...findArgs,\n page: streamPage,\n limit: Math.min(batchSize, remaining),\n })\n\n if (debug) {\n req.payload.logger.debug(`Streaming batch ${streamPage} with ${result.docs.length} docs`)\n }\n\n if (result.docs.length === 0) {\n // Close JSON array properly if JSON\n if (!isCSV) {\n this.push(encoder.encode(']'))\n }\n this.push(null)\n return\n }\n\n if (isCSV) {\n // --- CSV Streaming ---\n const batchRows = result.docs.map((doc) =>\n filterDisabledCSV(flattenObject({ doc, fields, toCSVFunctions })),\n )\n\n const paddedRows = batchRows.map((row) => {\n const fullRow: Record<string, unknown> = {}\n for (const col of allColumns) {\n fullRow[col] = row[col] ?? ''\n }\n return fullRow\n })\n\n const csvString = stringify(paddedRows, {\n header: isFirstBatch,\n columns: allColumns,\n })\n\n this.push(encoder.encode(csvString))\n } else {\n // --- JSON Streaming ---\n const batchRows = result.docs.map((doc) => filterDisabledJSON(doc))\n\n // Convert each filtered/flattened row into JSON string\n const batchJSON = batchRows.map((row) => JSON.stringify(row)).join(',')\n\n if (isFirstBatch) {\n this.push(encoder.encode('[' + batchJSON))\n } else {\n this.push(encoder.encode(',' + batchJSON))\n }\n }\n\n fetched += result.docs.length\n isFirstBatch = false\n streamPage += 1 // Increment stream page for the next batch\n\n if (!result.hasNextPage || fetched >= maxDocs) {\n if (debug) {\n req.payload.logger.debug('Stream complete - no more pages')\n }\n if (!isCSV) {\n this.push(encoder.encode(']'))\n }\n this.push(null) // End the stream\n }\n },\n })\n\n return new Response(stream as any, {\n headers: {\n 'Content-Disposition': `attachment; filename=\"${name}\"`,\n 'Content-Type': isCSV ? 'text/csv' : 'application/json',\n },\n })\n }\n\n // Non-download path (buffered export)\n if (debug) {\n req.payload.logger.debug('Starting file generation')\n }\n\n const outputData: string[] = []\n const rows: Record<string, unknown>[] = []\n const columnsSet = new Set<string>()\n const columns: string[] = []\n\n // Start from the incoming page value, defaulting to 1 if undefined\n let currentPage = adjustedPage\n let fetched = 0\n let hasNextPage = true\n const maxDocs = typeof hardLimit === 'number' ? hardLimit : Number.POSITIVE_INFINITY\n\n while (hasNextPage) {\n const remaining = Math.max(0, maxDocs - fetched)\n\n if (remaining === 0) {\n break\n }\n\n const result = await payload.find({\n ...findArgs,\n page: currentPage,\n limit: Math.min(batchSize, remaining),\n })\n\n if (debug) {\n req.payload.logger.debug(\n `Processing batch ${currentPage} with ${result.docs.length} documents`,\n )\n }\n\n if (isCSV) {\n const batchRows = result.docs.map((doc) =>\n filterDisabledCSV(flattenObject({ doc, fields, toCSVFunctions })),\n )\n\n // Track discovered column keys\n batchRows.forEach((row) => {\n Object.keys(row).forEach((key) => {\n if (!columnsSet.has(key)) {\n columnsSet.add(key)\n columns.push(key)\n }\n })\n })\n\n rows.push(...batchRows)\n } else {\n const batchRows = result.docs.map((doc) => filterDisabledJSON(doc))\n outputData.push(batchRows.map((doc) => JSON.stringify(doc)).join(',\\n'))\n }\n\n fetched += result.docs.length\n hasNextPage = result.hasNextPage && fetched < maxDocs\n currentPage += 1 // Increment page for next batch\n }\n\n // Prepare final output\n if (isCSV) {\n const paddedRows = rows.map((row) => {\n const fullRow: Record<string, unknown> = {}\n for (const col of columns) {\n fullRow[col] = row[col] ?? ''\n }\n return fullRow\n })\n\n outputData.push(\n stringify(paddedRows, {\n header: true,\n columns,\n }),\n )\n }\n\n const buffer = Buffer.from(format === 'json' ? `[${outputData.join(',')}]` : outputData.join(''))\n if (debug) {\n req.payload.logger.debug(`${format} file generation complete`)\n }\n\n if (!id) {\n if (debug) {\n req.payload.logger.debug('Creating new export file')\n }\n req.file = {\n name,\n data: buffer,\n mimetype: isCSV ? 'text/csv' : 'application/json',\n size: buffer.length,\n }\n } else {\n if (debug) {\n req.payload.logger.debug(`Updating existing export with id: ${id}`)\n }\n await req.payload.update({\n id,\n collection: exportsCollection,\n data: {},\n file: {\n name,\n data: buffer,\n mimetype: isCSV ? 'text/csv' : 'application/json',\n size: buffer.length,\n },\n user,\n })\n }\n if (debug) {\n req.payload.logger.debug('Export process completed successfully')\n }\n}\n"],"names":["stringify","APIError","Readable","buildDisabledFieldRegex","validateLimitValue","flattenObject","getCustomFieldFunctions","getFilename","getSelect","createExport","args","download","input","id","name","nameArg","collectionSlug","debug","drafts","exportsCollection","fields","format","locale","localeInput","sort","user","page","limit","incomingLimit","where","req","localeArg","payload","logger","message","collectionConfig","config","collections","find","slug","isCSV","select","Array","isArray","length","undefined","batchSize","hardLimit","totalDocs","count","collection","overrideAccess","totalPages","Math","max","ceil","requestedPage","adjustedPage","findArgs","depth","draft","toCSVFunctions","flattenedFields","disabledFields","admin","custom","disabledRegexes","map","filterDisabledCSV","row","filtered","key","value","Object","entries","isDisabled","some","regex","test","filterDisabledJSON","doc","parentPath","item","currentPath","includes","limitErrorMsg","t","allColumns","allColumnsSet","Set","scanPage","hasMore","fetched","maxDocs","Number","POSITIVE_INFINITY","remaining","result","min","docs","forEach","flat","keys","has","add","push","hasNextPage","encoder","TextEncoder","isFirstBatch","streamPage","stream","read","encode","batchRows","paddedRows","fullRow","col","csvString","header","columns","batchJSON","JSON","join","Response","headers","outputData","rows","columnsSet","currentPage","buffer","Buffer","from","file","data","mimetype","size","update"],"mappings":"AAAA,6CAA6C,GAG7C,SAASA,SAAS,QAAQ,qBAAoB;AAC9C,SAASC,QAAQ,QAAQ,UAAS;AAClC,SAASC,QAAQ,QAAQ,SAAQ;AAEjC,SAASC,uBAAuB,QAAQ,0CAAyC;AACjF,SAASC,kBAAkB,QAAQ,qCAAoC;AACvE,SAASC,aAAa,QAAQ,qBAAoB;AAClD,SAASC,uBAAuB,QAAQ,+BAA8B;AACtE,SAASC,WA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QACrB;IACF,OAAO;QACL,IAAI3B,OAAO;YACTa,IAAIE,OAAO,CAACC,MAAM,CAAChB,KAAK,CAAC,CAAC,kCAAkC,EAAEJ,IAAI;QACpE;QACA,MAAMiB,IAAIE,OAAO,CAACyG,MAAM,CAAC;YACvB5H;YACAqC,YAAY/B;YACZmH,MAAM,CAAC;YACPD,MAAM;gBACJvH;gBACAwH,MAAMJ;gBACNK,UAAU/F,QAAQ,aAAa;gBAC/BgG,MAAMN,OAAOtF,MAAM;YACrB;YACAnB;QACF;IACF;IACA,IAAIR,OAAO;QACTa,IAAIE,OAAO,CAACC,MAAM,CAAChB,KAAK,CAAC;IAC3B;AACF,EAAC"}
1
+ {"version":3,"sources":["../../src/export/createExport.ts"],"sourcesContent":["/* eslint-disable perfectionist/sort-objects */\nimport type { PayloadRequest, Sort, TypedUser, Where } from 'payload'\n\nimport { stringify } from 'csv-stringify/sync'\nimport { APIError } from 'payload'\nimport { Readable } from 'stream'\n\nimport { buildDisabledFieldRegex } from '../utilities/buildDisabledFieldRegex.js'\nimport { validateLimitValue } from '../utilities/validateLimitValue.js'\nimport { flattenObject } from './flattenObject.js'\nimport { getCustomFieldFunctions } from './getCustomFieldFunctions.js'\nimport { getFilename } from './getFilename.js'\nimport { getSelect } from './getSelect.js'\n\nexport type Export = {\n collectionSlug: string\n /**\n * If true, enables debug logging\n */\n debug?: boolean\n drafts?: 'no' | 'yes'\n exportsCollection: string\n fields?: string[]\n format: 'csv' | 'json'\n globals?: string[]\n id: number | string\n limit?: number\n locale?: string\n name: string\n page?: number\n slug: string\n sort: Sort\n where?: Where\n}\n\nexport type CreateExportArgs = {\n /**\n * If true, stream the file instead of saving it\n */\n download?: boolean\n input: Export\n req: PayloadRequest\n user?: null | TypedUser\n}\n\nexport const createExport = async (args: CreateExportArgs) => {\n const {\n download,\n input: {\n id,\n name: nameArg,\n collectionSlug,\n debug = false,\n drafts,\n exportsCollection,\n fields,\n format,\n locale: localeInput,\n sort,\n page,\n limit: incomingLimit,\n where,\n },\n req: { locale: localeArg, payload },\n req,\n user,\n } = args\n\n if (!user) {\n throw new APIError('User authentication is required to create exports')\n }\n\n if (debug) {\n req.payload.logger.debug({\n message: 'Starting export process with args:',\n collectionSlug,\n drafts,\n fields,\n format,\n })\n }\n\n const locale = localeInput ?? localeArg\n const collectionConfig = payload.config.collections.find(({ slug }) => slug === collectionSlug)\n if (!collectionConfig) {\n throw new APIError(`Collection with slug ${collectionSlug} not found`)\n }\n\n const name = `${nameArg ?? `${getFilename()}-${collectionSlug}`}.${format}`\n const isCSV = format === 'csv'\n const select = Array.isArray(fields) && fields.length > 0 ? getSelect(fields) : undefined\n\n if (debug) {\n req.payload.logger.debug({ message: 'Export configuration:', name, isCSV, locale })\n }\n\n const batchSize = 100 // fixed per request\n\n const hardLimit =\n typeof incomingLimit === 'number' && incomingLimit > 0 ? incomingLimit : undefined\n\n const { totalDocs } = await payload.count({\n collection: collectionSlug,\n user,\n locale,\n overrideAccess: false,\n })\n\n const totalPages = Math.max(1, Math.ceil(totalDocs / batchSize))\n const requestedPage = page || 1\n const adjustedPage = requestedPage > totalPages ? 1 : requestedPage\n\n const findArgs = {\n collection: collectionSlug,\n depth: 1,\n draft: drafts === 'yes',\n limit: batchSize,\n locale,\n overrideAccess: false,\n page: 0, // The page will be incremented manually in the loop\n select,\n sort,\n user,\n where,\n }\n\n if (debug) {\n req.payload.logger.debug({ message: 'Find arguments:', findArgs })\n }\n\n const toCSVFunctions = getCustomFieldFunctions({\n fields: collectionConfig.flattenedFields,\n })\n\n const disabledFields =\n collectionConfig.admin?.custom?.['plugin-import-export']?.disabledFields ?? []\n\n const disabledRegexes: RegExp[] = disabledFields.map(buildDisabledFieldRegex)\n\n const filterDisabledCSV = (row: Record<string, unknown>): Record<string, unknown> => {\n const filtered: Record<string, unknown> = {}\n\n for (const [key, value] of Object.entries(row)) {\n const isDisabled = disabledRegexes.some((regex) => regex.test(key))\n if (!isDisabled) {\n filtered[key] = value\n }\n }\n\n return filtered\n }\n\n const filterDisabledJSON = (doc: any, parentPath = ''): any => {\n if (Array.isArray(doc)) {\n return doc.map((item) => filterDisabledJSON(item, parentPath))\n }\n\n if (typeof doc !== 'object' || doc === null) {\n return doc\n }\n\n const filtered: Record<string, any> = {}\n for (const [key, value] of Object.entries(doc)) {\n const currentPath = parentPath ? `${parentPath}.${key}` : key\n\n // Only remove if this exact path is disabled\n const isDisabled = disabledFields.includes(currentPath)\n\n if (!isDisabled) {\n filtered[key] = filterDisabledJSON(value, currentPath)\n }\n }\n\n return filtered\n }\n\n if (download) {\n if (debug) {\n req.payload.logger.debug('Pre-scanning all columns before streaming')\n }\n\n const limitErrorMsg = validateLimitValue(\n incomingLimit,\n req.t,\n batchSize, // step i.e. 100\n )\n if (limitErrorMsg) {\n throw new APIError(limitErrorMsg)\n }\n\n const allColumns: string[] = []\n\n if (isCSV) {\n const allColumnsSet = new Set<string>()\n\n // Use the incoming page value here, defaulting to 1 if undefined\n let scanPage = adjustedPage\n let hasMore = true\n let fetched = 0\n const maxDocs = typeof hardLimit === 'number' ? hardLimit : Number.POSITIVE_INFINITY\n\n while (hasMore) {\n const remaining = Math.max(0, maxDocs - fetched)\n if (remaining === 0) {\n break\n }\n\n const result = await payload.find({\n ...findArgs,\n page: scanPage,\n limit: Math.min(batchSize, remaining),\n })\n\n result.docs.forEach((doc) => {\n const flat = filterDisabledCSV(flattenObject({ doc, fields, toCSVFunctions }))\n Object.keys(flat).forEach((key) => {\n if (!allColumnsSet.has(key)) {\n allColumnsSet.add(key)\n allColumns.push(key)\n }\n })\n })\n\n fetched += result.docs.length\n scanPage += 1 // Increment page for next batch\n hasMore = result.hasNextPage && fetched < maxDocs\n }\n\n if (debug) {\n req.payload.logger.debug(`Discovered ${allColumns.length} columns`)\n }\n }\n\n const encoder = new TextEncoder()\n let isFirstBatch = true\n let streamPage = adjustedPage\n let fetched = 0\n const maxDocs = typeof hardLimit === 'number' ? hardLimit : Number.POSITIVE_INFINITY\n\n const stream = new Readable({\n async read() {\n const remaining = Math.max(0, maxDocs - fetched)\n\n if (remaining === 0) {\n if (!isCSV) {\n this.push(encoder.encode(']'))\n }\n this.push(null)\n return\n }\n\n const result = await payload.find({\n ...findArgs,\n page: streamPage,\n limit: Math.min(batchSize, remaining),\n })\n\n if (debug) {\n req.payload.logger.debug(`Streaming batch ${streamPage} with ${result.docs.length} docs`)\n }\n\n if (result.docs.length === 0) {\n // Close JSON array properly if JSON\n if (!isCSV) {\n this.push(encoder.encode(']'))\n }\n this.push(null)\n return\n }\n\n if (isCSV) {\n // --- CSV Streaming ---\n const batchRows = result.docs.map((doc) =>\n filterDisabledCSV(flattenObject({ doc, fields, toCSVFunctions })),\n )\n\n const paddedRows = batchRows.map((row) => {\n const fullRow: Record<string, unknown> = {}\n for (const col of allColumns) {\n fullRow[col] = row[col] ?? ''\n }\n return fullRow\n })\n\n const csvString = stringify(paddedRows, {\n header: isFirstBatch,\n columns: allColumns,\n })\n\n this.push(encoder.encode(csvString))\n } else {\n // --- JSON Streaming ---\n const batchRows = result.docs.map((doc) => filterDisabledJSON(doc))\n\n // Convert each filtered/flattened row into JSON string\n const batchJSON = batchRows.map((row) => JSON.stringify(row)).join(',')\n\n if (isFirstBatch) {\n this.push(encoder.encode('[' + batchJSON))\n } else {\n this.push(encoder.encode(',' + batchJSON))\n }\n }\n\n fetched += result.docs.length\n isFirstBatch = false\n streamPage += 1 // Increment stream page for the next batch\n\n if (!result.hasNextPage || fetched >= maxDocs) {\n if (debug) {\n req.payload.logger.debug('Stream complete - no more pages')\n }\n if (!isCSV) {\n this.push(encoder.encode(']'))\n }\n this.push(null) // End the stream\n }\n },\n })\n\n return new Response(stream as any, {\n headers: {\n 'Content-Disposition': `attachment; filename=\"${name}\"`,\n 'Content-Type': isCSV ? 'text/csv' : 'application/json',\n },\n })\n }\n\n // Non-download path (buffered export)\n if (debug) {\n req.payload.logger.debug('Starting file generation')\n }\n\n const outputData: string[] = []\n const rows: Record<string, unknown>[] = []\n const columnsSet = new Set<string>()\n const columns: string[] = []\n\n // Start from the incoming page value, defaulting to 1 if undefined\n let currentPage = adjustedPage\n let fetched = 0\n let hasNextPage = true\n const maxDocs = typeof hardLimit === 'number' ? hardLimit : Number.POSITIVE_INFINITY\n\n while (hasNextPage) {\n const remaining = Math.max(0, maxDocs - fetched)\n\n if (remaining === 0) {\n break\n }\n\n const result = await payload.find({\n ...findArgs,\n page: currentPage,\n limit: Math.min(batchSize, remaining),\n })\n\n if (debug) {\n req.payload.logger.debug(\n `Processing batch ${currentPage} with ${result.docs.length} documents`,\n )\n }\n\n if (isCSV) {\n const batchRows = result.docs.map((doc) =>\n filterDisabledCSV(flattenObject({ doc, fields, toCSVFunctions })),\n )\n\n // Track discovered column keys\n batchRows.forEach((row) => {\n Object.keys(row).forEach((key) => {\n if (!columnsSet.has(key)) {\n columnsSet.add(key)\n columns.push(key)\n }\n })\n })\n\n rows.push(...batchRows)\n } else {\n const batchRows = result.docs.map((doc) => filterDisabledJSON(doc))\n outputData.push(batchRows.map((doc) => JSON.stringify(doc)).join(',\\n'))\n }\n\n fetched += result.docs.length\n hasNextPage = result.hasNextPage && fetched < maxDocs\n currentPage += 1 // Increment page for next batch\n }\n\n // Prepare final output\n if (isCSV) {\n const paddedRows = rows.map((row) => {\n const fullRow: Record<string, unknown> = {}\n for (const col of columns) {\n fullRow[col] = row[col] ?? ''\n }\n return fullRow\n })\n\n outputData.push(\n stringify(paddedRows, {\n header: true,\n columns,\n }),\n )\n }\n\n const buffer = Buffer.from(format === 'json' ? `[${outputData.join(',')}]` : outputData.join(''))\n if (debug) {\n req.payload.logger.debug(`${format} file generation complete`)\n }\n\n if (!id) {\n if (debug) {\n req.payload.logger.debug('Creating new export file')\n }\n req.file = {\n name,\n data: buffer,\n mimetype: isCSV ? 'text/csv' : 'application/json',\n size: buffer.length,\n }\n } else {\n if (debug) {\n req.payload.logger.debug(`Updating existing export with id: ${id}`)\n }\n await req.payload.update({\n id,\n collection: exportsCollection,\n data: {},\n file: {\n name,\n data: buffer,\n mimetype: isCSV ? 'text/csv' : 'application/json',\n size: buffer.length,\n },\n user,\n })\n }\n if (debug) {\n req.payload.logger.debug('Export process completed successfully')\n }\n}\n"],"names":["stringify","APIError","Readable","buildDisabledFieldRegex","validateLimitValue","flattenObject","getCustomFieldFunctions","getFilename","getSelect","createExport","args","download","input","id","name","nameArg","collectionSlug","debug","drafts","exportsCollection","fields","format","locale","localeInput","sort","page","limit","incomingLimit","where","req","localeArg","payload","user","logger","message","collectionConfig","config","collections","find","slug","isCSV","select","Array","isArray","length","undefined","batchSize","hardLimit","totalDocs","count","collection","overrideAccess","totalPages","Math","max","ceil","requestedPage","adjustedPage","findArgs","depth","draft","toCSVFunctions","flattenedFields","disabledFields","admin","custom","disabledRegexes","map","filterDisabledCSV","row","filtered","key","value","Object","entries","isDisabled","some","regex","test","filterDisabledJSON","doc","parentPath","item","currentPath","includes","limitErrorMsg","t","allColumns","allColumnsSet","Set","scanPage","hasMore","fetched","maxDocs","Number","POSITIVE_INFINITY","remaining","result","min","docs","forEach","flat","keys","has","add","push","hasNextPage","encoder","TextEncoder","isFirstBatch","streamPage","stream","read","encode","batchRows","paddedRows","fullRow","col","csvString","header","columns","batchJSON","JSON","join","Response","headers","outputData","rows","columnsSet","currentPage","buffer","Buffer","from","file","data","mimetype","size","update"],"mappings":"AAAA,6CAA6C,GAG7C,SAASA,SAAS,QAAQ,qBAAoB;AAC9C,SAASC,QAAQ,QAAQ,UAAS;AAClC,SAASC,QAAQ,QAAQ,SAAQ;AAEjC,SAASC,uBAAuB,QAAQ,0CAAyC;AACjF,SAASC,kBAAkB,QAAQ,qCAAoC;AACvE,SAASC,aAAa,QAAQ,qBAAoB;AAClD,SAASC,uBAAuB,QAAQ,+BAA8B;AACtE,SAASC,WAAW,QAAQ,mBAAkB;AAC9C,SAASC,SAAS,QAAQ,iBAAgB;AAiC1C,OAAO,MAAMC,eAAe,OAAOC;IACjC,MAAM,EACJC,QAAQ,EACRC,OAAO,EACLC,EAAE,E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AAK,CAAC,CAAC,kCAAkC,EAAEJ,IAAI;QACpE;QACA,MAAMgB,IAAIE,OAAO,CAAC0G,MAAM,CAAC;YACvB5H;YACAqC,YAAY/B;YACZmH,MAAM,CAAC;YACPD,MAAM;gBACJvH;gBACAwH,MAAMJ;gBACNK,UAAU/F,QAAQ,aAAa;gBAC/BgG,MAAMN,OAAOtF,MAAM;YACrB;YACAZ;QACF;IACF;IACA,IAAIf,OAAO;QACTY,IAAIE,OAAO,CAACE,MAAM,CAAChB,KAAK,CAAC;IAC3B;AACF,EAAC"}
@@ -11,14 +11,14 @@ export const download = async (req, debug = false)=>{
11
11
  }
12
12
  const { collectionSlug } = body.data || {};
13
13
  req.payload.logger.info(`Download request received ${collectionSlug}`);
14
- body.data.user = req.user;
15
14
  const res = await createExport({
16
15
  download: true,
17
16
  input: {
18
17
  ...body.data,
19
18
  debug
20
19
  },
21
- req
20
+ req,
21
+ user: req.user
22
22
  });
23
23
  return res;
24
24
  } catch (err) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/export/download.ts"],"sourcesContent":["import type { PayloadRequest } from 'payload'\n\nimport { APIError } from 'payload'\n\nimport { createExport } from './createExport.js'\n\nexport const download = async (req: PayloadRequest, debug = false) => {\n try {\n let body\n if (typeof req?.json === 'function') {\n body = await req.json()\n }\n\n if (!body || !body.data) {\n throw new APIError('Request data is required.')\n }\n\n const { collectionSlug } = body.data || {}\n\n req.payload.logger.info(`Download request received ${collectionSlug}`)\n body.data.user = req.user\n\n const res = await createExport({\n download: true,\n input: { ...body.data, debug },\n req,\n })\n\n return res as Response\n } catch (err) {\n // Return JSON for front-end toast\n return new Response(\n JSON.stringify({ errors: [{ message: (err as Error).message || 'Something went wrong' }] }),\n { headers: { 'Content-Type': 'application/json' }, status: 400 },\n )\n }\n}\n"],"names":["APIError","createExport","download","req","debug","body","json","data","collectionSlug","payload","logger","info","user","res","input","err","Response","JSON","stringify","errors","message","headers","status"],"mappings":"AAEA,SAASA,QAAQ,QAAQ,UAAS;AAElC,SAASC,YAAY,QAAQ,oBAAmB;AAEhD,OAAO,MAAMC,WAAW,OAAOC,KAAqBC,QAAQ,KAAK;IAC/D,IAAI;QACF,IAAIC;QACJ,IAAI,OAAOF,KAAKG,SAAS,YAAY;YACnCD,OAAO,MAAMF,IAAIG,IAAI;QACvB;QAEA,IAAI,CAACD,QAAQ,CAACA,KAAKE,IAAI,EAAE;YACvB,MAAM,IAAIP,SAAS;QACrB;QAEA,MAAM,EAAEQ,cAAc,EAAE,GAAGH,KAAKE,IAAI,IAAI,CAAC;QAEzCJ,IAAIM,OAAO,CAACC,MAAM,CAACC,IAAI,CAAC,CAAC,0BAA0B,EAAEH,gBAAgB;QACrEH,KAAKE,IAAI,CAACK,IAAI,GAAGT,IAAIS,IAAI;QAEzB,MAAMC,MAAM,MAAMZ,aAAa;YAC7BC,UAAU;YACVY,OAAO;gBAAE,GAAGT,KAAKE,IAAI;gBAAEH;YAAM;YAC7BD;QACF;QAEA,OAAOU;IACT,EAAE,OAAOE,KAAK;QACZ,kCAAkC;QAClC,OAAO,IAAIC,SACTC,KAAKC,SAAS,CAAC;YAAEC,QAAQ;gBAAC;oBAAEC,SAAS,AAACL,IAAcK,OAAO,IAAI;gBAAuB;aAAE;QAAC,IACzF;YAAEC,SAAS;gBAAE,gBAAgB;YAAmB;YAAGC,QAAQ;QAAI;IAEnE;AACF,EAAC"}
1
+ {"version":3,"sources":["../../src/export/download.ts"],"sourcesContent":["import type { PayloadRequest } from 'payload'\n\nimport { APIError } from 'payload'\n\nimport { createExport } from './createExport.js'\n\nexport const download = async (req: PayloadRequest, debug = false) => {\n try {\n let body\n if (typeof req?.json === 'function') {\n body = await req.json()\n }\n\n if (!body || !body.data) {\n throw new APIError('Request data is required.')\n }\n\n const { collectionSlug } = body.data || {}\n\n req.payload.logger.info(`Download request received ${collectionSlug}`)\n\n const res = await createExport({\n download: true,\n input: { ...body.data, debug },\n req,\n user: req.user,\n })\n\n return res as Response\n } catch (err) {\n // Return JSON for front-end toast\n return new Response(\n JSON.stringify({ errors: [{ message: (err as Error).message || 'Something went wrong' }] }),\n { headers: { 'Content-Type': 'application/json' }, status: 400 },\n )\n }\n}\n"],"names":["APIError","createExport","download","req","debug","body","json","data","collectionSlug","payload","logger","info","res","input","user","err","Response","JSON","stringify","errors","message","headers","status"],"mappings":"AAEA,SAASA,QAAQ,QAAQ,UAAS;AAElC,SAASC,YAAY,QAAQ,oBAAmB;AAEhD,OAAO,MAAMC,WAAW,OAAOC,KAAqBC,QAAQ,KAAK;IAC/D,IAAI;QACF,IAAIC;QACJ,IAAI,OAAOF,KAAKG,SAAS,YAAY;YACnCD,OAAO,MAAMF,IAAIG,IAAI;QACvB;QAEA,IAAI,CAACD,QAAQ,CAACA,KAAKE,IAAI,EAAE;YACvB,MAAM,IAAIP,SAAS;QACrB;QAEA,MAAM,EAAEQ,cAAc,EAAE,GAAGH,KAAKE,IAAI,IAAI,CAAC;QAEzCJ,IAAIM,OAAO,CAACC,MAAM,CAACC,IAAI,CAAC,CAAC,0BAA0B,EAAEH,gBAAgB;QAErE,MAAMI,MAAM,MAAMX,aAAa;YAC7BC,UAAU;YACVW,OAAO;gBAAE,GAAGR,KAAKE,IAAI;gBAAEH;YAAM;YAC7BD;YACAW,MAAMX,IAAIW,IAAI;QAChB;QAEA,OAAOF;IACT,EAAE,OAAOG,KAAK;QACZ,kCAAkC;QAClC,OAAO,IAAIC,SACTC,KAAKC,SAAS,CAAC;YAAEC,QAAQ;gBAAC;oBAAEC,SAAS,AAACL,IAAcK,OAAO,IAAI;gBAAuB;aAAE;QAAC,IACzF;YAAEC,SAAS;gBAAE,gBAAgB;YAAmB;YAAGC,QAAQ;QAAI;IAEnE;AACF,EAAC"}
@@ -1,8 +1,17 @@
1
1
  import type { Config, TaskConfig } from 'payload';
2
2
  import type { ImportExportPluginConfig } from '../types.js';
3
3
  import type { Export } from './createExport.js';
4
+ /**
5
+ * Export input type for job queue serialization.
6
+ * When exports are queued as jobs, the user must be serialized as an ID string or number
7
+ * along with the collection name so it can be rehydrated when the job runs.
8
+ */
9
+ export type ExportJobInput = {
10
+ user: number | string;
11
+ userCollection: string;
12
+ } & Export;
4
13
  export declare const getCreateCollectionExportTask: (config: Config, pluginConfig?: ImportExportPluginConfig) => TaskConfig<{
5
- input: Export;
14
+ input: ExportJobInput;
6
15
  output: object;
7
16
  }>;
8
17
  //# sourceMappingURL=getCreateExportCollectionTask.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getCreateExportCollectionTask.d.ts","sourceRoot":"","sources":["../../src/export/getCreateExportCollectionTask.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAa,MAAM,SAAS,CAAA;AAE5D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAA;AAC3D,OAAO,KAAK,EAAoB,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAKjE,eAAO,MAAM,6BAA6B,WAChC,MAAM,iBACC,wBAAwB,KACtC,UAAU,CAAC;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;CACf,CAwCA,CAAA"}
1
+ {"version":3,"file":"getCreateExportCollectionTask.d.ts","sourceRoot":"","sources":["../../src/export/getCreateExportCollectionTask.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAkB,UAAU,EAAa,MAAM,SAAS,CAAA;AAE5E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAA;AAC3D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAK/C;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;IACrB,cAAc,EAAE,MAAM,CAAA;CACvB,GAAG,MAAM,CAAA;AAEV,eAAO,MAAM,6BAA6B,WAChC,MAAM,iBACC,wBAAwB,KACtC,UAAU,CAAC;IACZ,KAAK,EAAE,cAAc,CAAA;IACrB,MAAM,EAAE,MAAM,CAAA;CACf,CA6CA,CAAA"}
@@ -20,12 +20,15 @@ export const getCreateCollectionExportTask = (config, pluginConfig)=>{
20
20
  id: input.user,
21
21
  collection: input.userCollection
22
22
  });
23
+ req.user = user;
23
24
  }
24
25
  if (!user) {
25
26
  throw new Error('User not found');
26
27
  }
28
+ // Strip out user and userCollection from input - they're only needed for rehydration
29
+ const { user: _userId, userCollection: _userCollection, ...exportInput } = input;
27
30
  await createExport({
28
- input,
31
+ input: exportInput,
29
32
  req,
30
33
  user
31
34
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/export/getCreateExportCollectionTask.ts"],"sourcesContent":["import type { Config, TaskConfig, TypedUser } from 'payload'\n\nimport type { ImportExportPluginConfig } from '../types.js'\nimport type { CreateExportArgs, Export } from './createExport.js'\n\nimport { createExport } from './createExport.js'\nimport { getFields } from './getFields.js'\n\nexport const getCreateCollectionExportTask = (\n config: Config,\n pluginConfig?: ImportExportPluginConfig,\n): TaskConfig<{\n input: Export\n output: object\n}> => {\n const inputSchema = getFields(config, pluginConfig).concat(\n {\n name: 'user',\n type: 'text',\n },\n {\n name: 'userCollection',\n type: 'text',\n },\n {\n name: 'exportsCollection',\n type: 'text',\n },\n )\n\n return {\n slug: 'createCollectionExport',\n handler: async ({ input, req }: CreateExportArgs) => {\n let user: TypedUser | undefined\n\n if (input.userCollection && input.user) {\n user = (await req.payload.findByID({\n id: input.user,\n collection: input.userCollection,\n })) as TypedUser\n }\n\n if (!user) {\n throw new Error('User not found')\n }\n\n await createExport({ input, req, user })\n\n return {\n output: {},\n }\n },\n inputSchema,\n }\n}\n"],"names":["createExport","getFields","getCreateCollectionExportTask","config","pluginConfig","inputSchema","concat","name","type","slug","handler","input","req","user","userCollection","payload","findByID","id","collection","Error","output"],"mappings":"AAKA,SAASA,YAAY,QAAQ,oBAAmB;AAChD,SAASC,SAAS,QAAQ,iBAAgB;AAE1C,OAAO,MAAMC,gCAAgC,CAC3CC,QACAC;IAKA,MAAMC,cAAcJ,UAAUE,QAAQC,cAAcE,MAAM,CACxD;QACEC,MAAM;QACNC,MAAM;IACR,GACA;QACED,MAAM;QACNC,MAAM;IACR,GACA;QACED,MAAM;QACNC,MAAM;IACR;IAGF,OAAO;QACLC,MAAM;QACNC,SAAS,OAAO,EAAEC,KAAK,EAAEC,GAAG,EAAoB;YAC9C,IAAIC;YAEJ,IAAIF,MAAMG,cAAc,IAAIH,MAAME,IAAI,EAAE;gBACtCA,OAAQ,MAAMD,IAAIG,OAAO,CAACC,QAAQ,CAAC;oBACjCC,IAAIN,MAAME,IAAI;oBACdK,YAAYP,MAAMG,cAAc;gBAClC;YACF;YAEA,IAAI,CAACD,MAAM;gBACT,MAAM,IAAIM,MAAM;YAClB;YAEA,MAAMnB,aAAa;gBAAEW;gBAAOC;gBAAKC;YAAK;YAEtC,OAAO;gBACLO,QAAQ,CAAC;YACX;QACF;QACAf;IACF;AACF,EAAC"}
1
+ {"version":3,"sources":["../../src/export/getCreateExportCollectionTask.ts"],"sourcesContent":["import type { Config, PayloadRequest, TaskConfig, TypedUser } from 'payload'\n\nimport type { ImportExportPluginConfig } from '../types.js'\nimport type { Export } from './createExport.js'\n\nimport { createExport } from './createExport.js'\nimport { getFields } from './getFields.js'\n\n/**\n * Export input type for job queue serialization.\n * When exports are queued as jobs, the user must be serialized as an ID string or number\n * along with the collection name so it can be rehydrated when the job runs.\n */\nexport type ExportJobInput = {\n user: number | string\n userCollection: string\n} & Export\n\nexport const getCreateCollectionExportTask = (\n config: Config,\n pluginConfig?: ImportExportPluginConfig,\n): TaskConfig<{\n input: ExportJobInput\n output: object\n}> => {\n const inputSchema = getFields(config, pluginConfig).concat(\n {\n name: 'user',\n type: 'text',\n },\n {\n name: 'userCollection',\n type: 'text',\n },\n {\n name: 'exportsCollection',\n type: 'text',\n },\n )\n\n return {\n slug: 'createCollectionExport',\n handler: async ({ input, req }: { input: ExportJobInput; req: PayloadRequest }) => {\n let user: TypedUser | undefined\n\n if (input.userCollection && input.user) {\n user = (await req.payload.findByID({\n id: input.user,\n collection: input.userCollection,\n })) as TypedUser\n\n req.user = user\n }\n\n if (!user) {\n throw new Error('User not found')\n }\n\n // Strip out user and userCollection from input - they're only needed for rehydration\n const { user: _userId, userCollection: _userCollection, ...exportInput } = input\n\n await createExport({ input: exportInput, req, user })\n\n return {\n output: {},\n }\n },\n inputSchema,\n }\n}\n"],"names":["createExport","getFields","getCreateCollectionExportTask","config","pluginConfig","inputSchema","concat","name","type","slug","handler","input","req","user","userCollection","payload","findByID","id","collection","Error","_userId","_userCollection","exportInput","output"],"mappings":"AAKA,SAASA,YAAY,QAAQ,oBAAmB;AAChD,SAASC,SAAS,QAAQ,iBAAgB;AAY1C,OAAO,MAAMC,gCAAgC,CAC3CC,QACAC;IAKA,MAAMC,cAAcJ,UAAUE,QAAQC,cAAcE,MAAM,CACxD;QACEC,MAAM;QACNC,MAAM;IACR,GACA;QACED,MAAM;QACNC,MAAM;IACR,GACA;QACED,MAAM;QACNC,MAAM;IACR;IAGF,OAAO;QACLC,MAAM;QACNC,SAAS,OAAO,EAAEC,KAAK,EAAEC,GAAG,EAAkD;YAC5E,IAAIC;YAEJ,IAAIF,MAAMG,cAAc,IAAIH,MAAME,IAAI,EAAE;gBACtCA,OAAQ,MAAMD,IAAIG,OAAO,CAACC,QAAQ,CAAC;oBACjCC,IAAIN,MAAME,IAAI;oBACdK,YAAYP,MAAMG,cAAc;gBAClC;gBAEAF,IAAIC,IAAI,GAAGA;YACb;YAEA,IAAI,CAACA,MAAM;gBACT,MAAM,IAAIM,MAAM;YAClB;YAEA,qFAAqF;YACrF,MAAM,EAAEN,MAAMO,OAAO,EAAEN,gBAAgBO,eAAe,EAAE,GAAGC,aAAa,GAAGX;YAE3E,MAAMX,aAAa;gBAAEW,OAAOW;gBAAaV;gBAAKC;YAAK;YAEnD,OAAO;gBACLU,QAAQ,CAAC;YACX;QACF;QACAlB;IACF;AACF,EAAC"}
@@ -57,10 +57,10 @@ export const getExportCollection = ({ config, pluginConfig })=>{
57
57
  await createExport({
58
58
  input: {
59
59
  ...args.data,
60
- debug,
61
- user
60
+ debug
62
61
  },
63
- req
62
+ req,
63
+ user
64
64
  });
65
65
  });
66
66
  } else {
@@ -72,7 +72,7 @@ export const getExportCollection = ({ config, pluginConfig })=>{
72
72
  ...doc,
73
73
  exportsCollection: collection.slug,
74
74
  user: req?.user?.id || req?.user?.user?.id,
75
- userCollection: 'users'
75
+ userCollection: req.payload.config.admin.user
76
76
  };
77
77
  await req.payload.jobs.queue({
78
78
  input,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/getExportCollection.ts"],"sourcesContent":["import type {\n CollectionAfterChangeHook,\n CollectionBeforeOperationHook,\n CollectionConfig,\n Config,\n} from 'payload'\n\nimport type { CollectionOverride, ImportExportPluginConfig } from './types.js'\n\nimport { createExport } from './export/createExport.js'\nimport { download } from './export/download.js'\nimport { getFields } from './export/getFields.js'\n\nexport const getExportCollection = ({\n config,\n pluginConfig,\n}: {\n config: Config\n pluginConfig: ImportExportPluginConfig\n}): CollectionConfig => {\n const { overrideExportCollection } = pluginConfig\n\n const beforeOperation: CollectionBeforeOperationHook[] = []\n const afterChange: CollectionAfterChangeHook[] = []\n\n let collection: CollectionOverride = {\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: pluginConfig.disableDownload ?? false,\n disableSave: pluginConfig.disableSave ?? false,\n },\n group: false,\n useAsTitle: 'name',\n },\n disableDuplicate: true,\n endpoints: [\n {\n handler: (req) => {\n return download(req, pluginConfig.debug)\n },\n method: 'post',\n path: '/download',\n },\n ],\n fields: getFields(config, pluginConfig),\n hooks: {\n afterChange,\n beforeOperation,\n },\n upload: {\n filesRequiredOnCreate: false,\n hideFileInputOnCreate: true,\n hideRemoveFile: true,\n },\n }\n\n if (typeof overrideExportCollection === 'function') {\n collection = overrideExportCollection(collection)\n }\n\n if (pluginConfig.disableJobsQueue) {\n beforeOperation.push(async ({ args, operation, req }) => {\n if (operation !== 'create') {\n return\n }\n const { user } = req\n const debug = pluginConfig.debug\n await createExport({ input: { ...args.data, debug, user }, req })\n })\n } else {\n afterChange.push(async ({ doc, operation, req }) => {\n if (operation !== 'create') {\n return\n }\n\n const input = {\n ...doc,\n exportsCollection: collection.slug,\n user: req?.user?.id || req?.user?.user?.id,\n userCollection: 'users',\n }\n await req.payload.jobs.queue({\n input,\n task: 'createCollectionExport',\n })\n })\n }\n\n return collection\n}\n"],"names":["createExport","download","getFields","getExportCollection","config","pluginConfig","overrideExportCollection","beforeOperation","afterChange","collection","slug","access","update","admin","components","edit","SaveButton","custom","disableDownload","disableSave","group","useAsTitle","disableDuplicate","endpoints","handler","req","debug","method","path","fields","hooks","upload","filesRequiredOnCreate","hideFileInputOnCreate","hideRemoveFile","disableJobsQueue","push","args","operation","user","input","data","doc","exportsCollection","id","userCollection","payload","jobs","queue","task"],"mappings":"AASA,SAASA,YAAY,QAAQ,2BAA0B;AACvD,SAASC,QAAQ,QAAQ,uBAAsB;AAC/C,SAASC,SAAS,QAAQ,wBAAuB;AAEjD,OAAO,MAAMC,sBAAsB,CAAC,EAClCC,MAAM,EACNC,YAAY,EAIb;IACC,MAAM,EAAEC,wBAAwB,EAAE,GAAGD;IAErC,MAAME,kBAAmD,EAAE;IAC3D,MAAMC,cAA2C,EAAE;IAEnD,IAAIC,aAAiC;QACnCC,MAAM;QACNC,QAAQ;YACNC,QAAQ,IAAM;QAChB;QACAC,OAAO;YACLC,YAAY;gBACVC,MAAM;oBACJC,YAAY;gBACd;YACF;YACAC,QAAQ;gBACNC,iBAAiBb,aAAaa,eAAe,IAAI;gBACjDC,aAAad,aAAac,WAAW,IAAI;YAC3C;YACAC,OAAO;YACPC,YAAY;QACd;QACAC,kBAAkB;QAClBC,WAAW;YACT;gBACEC,SAAS,CAACC;oBACR,OAAOxB,SAASwB,KAAKpB,aAAaqB,KAAK;gBACzC;gBACAC,QAAQ;gBACRC,MAAM;YACR;SACD;QACDC,QAAQ3B,UAAUE,QAAQC;QAC1ByB,OAAO;YACLtB;YACAD;QACF;QACAwB,QAAQ;YACNC,uBAAuB;YACvBC,uBAAuB;YACvBC,gBAAgB;QAClB;IACF;IAEA,IAAI,OAAO5B,6BAA6B,YAAY;QAClDG,aAAaH,yBAAyBG;IACxC;IAEA,IAAIJ,aAAa8B,gBAAgB,EAAE;QACjC5B,gBAAgB6B,IAAI,CAAC,OAAO,EAAEC,IAAI,EAAEC,SAAS,EAAEb,GAAG,EAAE;YAClD,IAAIa,cAAc,UAAU;gBAC1B;YACF;YACA,MAAM,EAAEC,IAAI,EAAE,GAAGd;YACjB,MAAMC,QAAQrB,aAAaqB,KAAK;YAChC,MAAM1B,aAAa;gBAAEwC,OAAO;oBAAE,GAAGH,KAAKI,IAAI;oBAAEf;oBAAOa;gBAAK;gBAAGd;YAAI;QACjE;IACF,OAAO;QACLjB,YAAY4B,IAAI,CAAC,OAAO,EAAEM,GAAG,EAAEJ,SAAS,EAAEb,GAAG,EAAE;YAC7C,IAAIa,cAAc,UAAU;gBAC1B;YACF;YAEA,MAAME,QAAQ;gBACZ,GAAGE,GAAG;gBACNC,mBAAmBlC,WAAWC,IAAI;gBAClC6B,MAAMd,KAAKc,MAAMK,MAAMnB,KAAKc,MAAMA,MAAMK;gBACxCC,gBAAgB;YAClB;YACA,MAAMpB,IAAIqB,OAAO,CAACC,IAAI,CAACC,KAAK,CAAC;gBAC3BR;gBACAS,MAAM;YACR;QACF;IACF;IAEA,OAAOxC;AACT,EAAC"}
1
+ {"version":3,"sources":["../src/getExportCollection.ts"],"sourcesContent":["import type {\n CollectionAfterChangeHook,\n CollectionBeforeOperationHook,\n CollectionConfig,\n Config,\n} from 'payload'\n\nimport type { CollectionOverride, ImportExportPluginConfig } from './types.js'\n\nimport { createExport } from './export/createExport.js'\nimport { download } from './export/download.js'\nimport { getFields } from './export/getFields.js'\n\nexport const getExportCollection = ({\n config,\n pluginConfig,\n}: {\n config: Config\n pluginConfig: ImportExportPluginConfig\n}): CollectionConfig => {\n const { overrideExportCollection } = pluginConfig\n\n const beforeOperation: CollectionBeforeOperationHook[] = []\n const afterChange: CollectionAfterChangeHook[] = []\n\n let collection: CollectionOverride = {\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: pluginConfig.disableDownload ?? false,\n disableSave: pluginConfig.disableSave ?? false,\n },\n group: false,\n useAsTitle: 'name',\n },\n disableDuplicate: true,\n endpoints: [\n {\n handler: (req) => {\n return download(req, pluginConfig.debug)\n },\n method: 'post',\n path: '/download',\n },\n ],\n fields: getFields(config, pluginConfig),\n hooks: {\n afterChange,\n beforeOperation,\n },\n upload: {\n filesRequiredOnCreate: false,\n hideFileInputOnCreate: true,\n hideRemoveFile: true,\n },\n }\n\n if (typeof overrideExportCollection === 'function') {\n collection = overrideExportCollection(collection)\n }\n\n if (pluginConfig.disableJobsQueue) {\n beforeOperation.push(async ({ args, operation, req }) => {\n if (operation !== 'create') {\n return\n }\n const { user } = req\n const debug = pluginConfig.debug\n await createExport({ input: { ...args.data, debug }, req, user })\n })\n } else {\n afterChange.push(async ({ doc, operation, req }) => {\n if (operation !== 'create') {\n return\n }\n\n const input = {\n ...doc,\n exportsCollection: collection.slug,\n user: req?.user?.id || req?.user?.user?.id,\n userCollection: req.payload.config.admin.user,\n }\n await req.payload.jobs.queue({\n input,\n task: 'createCollectionExport',\n })\n })\n }\n\n return collection\n}\n"],"names":["createExport","download","getFields","getExportCollection","config","pluginConfig","overrideExportCollection","beforeOperation","afterChange","collection","slug","access","update","admin","components","edit","SaveButton","custom","disableDownload","disableSave","group","useAsTitle","disableDuplicate","endpoints","handler","req","debug","method","path","fields","hooks","upload","filesRequiredOnCreate","hideFileInputOnCreate","hideRemoveFile","disableJobsQueue","push","args","operation","user","input","data","doc","exportsCollection","id","userCollection","payload","jobs","queue","task"],"mappings":"AASA,SAASA,YAAY,QAAQ,2BAA0B;AACvD,SAASC,QAAQ,QAAQ,uBAAsB;AAC/C,SAASC,SAAS,QAAQ,wBAAuB;AAEjD,OAAO,MAAMC,sBAAsB,CAAC,EAClCC,MAAM,EACNC,YAAY,EAIb;IACC,MAAM,EAAEC,wBAAwB,EAAE,GAAGD;IAErC,MAAME,kBAAmD,EAAE;IAC3D,MAAMC,cAA2C,EAAE;IAEnD,IAAIC,aAAiC;QACnCC,MAAM;QACNC,QAAQ;YACNC,QAAQ,IAAM;QAChB;QACAC,OAAO;YACLC,YAAY;gBACVC,MAAM;oBACJC,YAAY;gBACd;YACF;YACAC,QAAQ;gBACNC,iBAAiBb,aAAaa,eAAe,IAAI;gBACjDC,aAAad,aAAac,WAAW,IAAI;YAC3C;YACAC,OAAO;YACPC,YAAY;QACd;QACAC,kBAAkB;QAClBC,WAAW;YACT;gBACEC,SAAS,CAACC;oBACR,OAAOxB,SAASwB,KAAKpB,aAAaqB,KAAK;gBACzC;gBACAC,QAAQ;gBACRC,MAAM;YACR;SACD;QACDC,QAAQ3B,UAAUE,QAAQC;QAC1ByB,OAAO;YACLtB;YACAD;QACF;QACAwB,QAAQ;YACNC,uBAAuB;YACvBC,uBAAuB;YACvBC,gBAAgB;QAClB;IACF;IAEA,IAAI,OAAO5B,6BAA6B,YAAY;QAClDG,aAAaH,yBAAyBG;IACxC;IAEA,IAAIJ,aAAa8B,gBAAgB,EAAE;QACjC5B,gBAAgB6B,IAAI,CAAC,OAAO,EAAEC,IAAI,EAAEC,SAAS,EAAEb,GAAG,EAAE;YAClD,IAAIa,cAAc,UAAU;gBAC1B;YACF;YACA,MAAM,EAAEC,IAAI,EAAE,GAAGd;YACjB,MAAMC,QAAQrB,aAAaqB,KAAK;YAChC,MAAM1B,aAAa;gBAAEwC,OAAO;oBAAE,GAAGH,KAAKI,IAAI;oBAAEf;gBAAM;gBAAGD;gBAAKc;YAAK;QACjE;IACF,OAAO;QACL/B,YAAY4B,IAAI,CAAC,OAAO,EAAEM,GAAG,EAAEJ,SAAS,EAAEb,GAAG,EAAE;YAC7C,IAAIa,cAAc,UAAU;gBAC1B;YACF;YAEA,MAAME,QAAQ;gBACZ,GAAGE,GAAG;gBACNC,mBAAmBlC,WAAWC,IAAI;gBAClC6B,MAAMd,KAAKc,MAAMK,MAAMnB,KAAKc,MAAMA,MAAMK;gBACxCC,gBAAgBpB,IAAIqB,OAAO,CAAC1C,MAAM,CAACS,KAAK,CAAC0B,IAAI;YAC/C;YACA,MAAMd,IAAIqB,OAAO,CAACC,IAAI,CAACC,KAAK,CAAC;gBAC3BR;gBACAS,MAAM;YACR;QACF;IACF;IAEA,OAAOxC;AACT,EAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/plugin-import-export",
3
- "version": "3.66.0-canary.5",
3
+ "version": "3.66.0-canary.7",
4
4
  "description": "Import-Export plugin for Payload",
5
5
  "keywords": [
6
6
  "payload",
@@ -64,17 +64,17 @@
64
64
  "csv-parse": "^5.6.0",
65
65
  "csv-stringify": "^6.5.2",
66
66
  "qs-esm": "7.0.2",
67
- "@payloadcms/translations": "3.66.0-canary.5",
68
- "@payloadcms/ui": "3.66.0-canary.5"
67
+ "@payloadcms/translations": "3.66.0-canary.7",
68
+ "@payloadcms/ui": "3.66.0-canary.7"
69
69
  },
70
70
  "devDependencies": {
71
71
  "@payloadcms/eslint-config": "3.28.0",
72
- "payload": "3.66.0-canary.5",
73
- "@payloadcms/ui": "3.66.0-canary.5"
72
+ "payload": "3.66.0-canary.7",
73
+ "@payloadcms/ui": "3.66.0-canary.7"
74
74
  },
75
75
  "peerDependencies": {
76
- "payload": "3.66.0-canary.5",
77
- "@payloadcms/ui": "3.66.0-canary.5"
76
+ "@payloadcms/ui": "3.66.0-canary.7",
77
+ "payload": "3.66.0-canary.7"
78
78
  },
79
79
  "homepage:": "https://payloadcms.com",
80
80
  "scripts": {