@payloadcms/plugin-import-export 4.0.0-internal.183b315 → 4.0.0-internal.203916b

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 (65) hide show
  1. package/dist/components/ExportPreview/index.css +55 -0
  2. package/dist/components/ExportPreview/index.d.ts +1 -1
  3. package/dist/components/ExportPreview/index.d.ts.map +1 -1
  4. package/dist/components/ExportPreview/index.js +1 -1
  5. package/dist/components/ExportPreview/index.js.map +1 -1
  6. package/dist/components/FormatField/index.d.ts.map +1 -1
  7. package/dist/components/FormatField/index.js +6 -3
  8. package/dist/components/FormatField/index.js.map +1 -1
  9. package/dist/components/ImportPreview/index.css +48 -0
  10. package/dist/components/ImportPreview/index.d.ts +1 -1
  11. package/dist/components/ImportPreview/index.d.ts.map +1 -1
  12. package/dist/components/ImportPreview/index.js +17 -3
  13. package/dist/components/ImportPreview/index.js.map +1 -1
  14. package/dist/components/Page/index.d.ts +1 -1
  15. package/dist/components/Page/index.d.ts.map +1 -1
  16. package/dist/components/Page/index.js +1 -1
  17. package/dist/components/Page/index.js.map +1 -1
  18. package/dist/components/SortBy/index.css +9 -0
  19. package/dist/components/SortBy/index.d.ts +1 -1
  20. package/dist/components/SortBy/index.d.ts.map +1 -1
  21. package/dist/components/SortBy/index.js +1 -2
  22. package/dist/components/SortBy/index.js.map +1 -1
  23. package/dist/components/SortOrder/index.css +9 -0
  24. package/dist/components/SortOrder/index.d.ts +1 -1
  25. package/dist/components/SortOrder/index.d.ts.map +1 -1
  26. package/dist/components/SortOrder/index.js +1 -2
  27. package/dist/components/SortOrder/index.js.map +1 -1
  28. package/dist/export/batchProcessor.d.ts +2 -2
  29. package/dist/export/batchProcessor.d.ts.map +1 -1
  30. package/dist/export/batchProcessor.js.map +1 -1
  31. package/dist/export/createExport.d.ts +2 -2
  32. package/dist/export/createExport.d.ts.map +1 -1
  33. package/dist/export/createExport.js +1 -1
  34. package/dist/export/createExport.js.map +1 -1
  35. package/dist/export/getExportCollection.js +4 -4
  36. package/dist/export/getExportCollection.js.map +1 -1
  37. package/dist/export/handleDownload.js +2 -2
  38. package/dist/export/handleDownload.js.map +1 -1
  39. package/dist/import/batchProcessor.d.ts +2 -2
  40. package/dist/import/batchProcessor.d.ts.map +1 -1
  41. package/dist/import/batchProcessor.js.map +1 -1
  42. package/dist/import/createImport.d.ts.map +1 -1
  43. package/dist/import/createImport.js.map +1 -1
  44. package/dist/import/getImportCollection.js +4 -4
  45. package/dist/import/getImportCollection.js.map +1 -1
  46. package/dist/index.d.ts +1 -2
  47. package/dist/index.d.ts.map +1 -1
  48. package/dist/index.js +6 -3
  49. package/dist/index.js.map +1 -1
  50. package/dist/utilities/applyFieldHooks.d.ts.map +1 -1
  51. package/dist/utilities/applyFieldHooks.js +1 -1
  52. package/dist/utilities/applyFieldHooks.js.map +1 -1
  53. package/dist/utilities/flattenedFields.d.ts.map +1 -1
  54. package/dist/utilities/flattenedFields.js +3 -0
  55. package/dist/utilities/flattenedFields.js.map +1 -1
  56. package/license.md +1 -1
  57. package/package.json +7 -7
  58. package/dist/@types/assets.d.js +0 -2
  59. package/dist/@types/assets.d.js.map +0 -1
  60. package/dist/components/ExportPreview/index.scss +0 -48
  61. package/dist/components/FieldsToExport/index.scss +0 -0
  62. package/dist/components/ImportPreview/index.scss +0 -41
  63. package/dist/components/SortBy/index.scss +0 -3
  64. package/dist/components/SortOrder/index.scss +0 -3
  65. /package/dist/components/Page/{index.scss → index.css} +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utilities/applyFieldHooks.ts"],"sourcesContent":["import type { FlattenedField, PayloadRequest } from 'payload'\n\nimport type {\n ExportFieldHookEntry,\n FieldBeforeExportHook,\n FieldBeforeImportHook,\n ImportFieldHookEntry,\n} from '../types.js'\n\nimport { isPlainObject } from './isPlainObject.js'\n\nexport type FieldHook = FieldBeforeExportHook | FieldBeforeImportHook\n\nexport type FieldHookEntry = ExportFieldHookEntry | ImportFieldHookEntry\n\nconst joinPath = (parent: string | undefined, segment: string): string =>\n parent ? `${parent}_${segment}` : segment\n\nexport type Args = {\n data: Record<string, unknown>\n fieldHooks: Record<string, FieldHookEntry>\n fields: FlattenedField[]\n format: 'csv' | 'json' | ({} & string)\n operation: 'export' | 'import'\n req: PayloadRequest\n type: 'beforeExport' | 'beforeImport'\n}\n\nconst operationLabel = { export: 'Export', import: 'Import' } as const\n\ntype TraverseArgs = {\n path: string | undefined\n schemaPath: string | undefined\n siblingData: Record<string, unknown>\n} & Args\n\nconst traverseFields = ({\n type,\n data,\n fieldHooks,\n fields,\n format,\n operation,\n path,\n req,\n schemaPath,\n siblingData,\n}: TraverseArgs): Record<string, unknown> => {\n const result: Record<string, unknown> = { ...siblingData }\n\n for (const field of fields) {\n if (!('name' in field) || !field.name) {\n continue\n }\n\n const fieldPath = joinPath(path, field.name)\n const fieldSchemaPath = joinPath(schemaPath, field.name)\n const entry = fieldHooks[fieldSchemaPath]\n const hook = entry?.type === type ? (entry.fn as FieldHook) : undefined\n\n if (typeof hook === 'function' && field.name in result) {\n try {\n const transformed = hook({\n columnName: fieldPath,\n data,\n format,\n siblingData: result,\n siblingDoc: siblingData,\n value: result[field.name],\n })\n\n if (typeof transformed !== 'undefined') {\n result[field.name] = transformed\n }\n } catch (error) {\n req.payload.logger.error({\n err: error,\n msg: `[plugin-import-export] Field-level before${operationLabel[operation]} hook for \"${fieldPath}\" threw — falling back to original value`,\n })\n }\n }\n\n if (!(field.name in result)) {\n continue\n }\n\n const value = result[field.name]\n\n if ((field.type === 'group' || field.type === 'tab') && isPlainObject(value)) {\n result[field.name] = traverseFields({\n type,\n data,\n fieldHooks,\n fields: field.flattenedFields,\n format,\n operation,\n path: fieldPath,\n req,\n schemaPath: fieldSchemaPath,\n siblingData: value,\n })\n } else if (field.type === 'array' && Array.isArray(value)) {\n result[field.name] = value.map((item, index) => {\n if (!isPlainObject(item)) {\n return item\n }\n return traverseFields({\n type,\n data,\n fieldHooks,\n fields: field.flattenedFields,\n format,\n operation,\n path: `${fieldPath}_${index}`,\n req,\n schemaPath: fieldSchemaPath,\n siblingData: item,\n })\n })\n } else if (field.type === 'blocks' && Array.isArray(value)) {\n result[field.name] = value.map((item, index) => {\n if (!isPlainObject(item)) {\n return item\n }\n const blockType = typeof item.blockType === 'string' ? item.blockType : undefined\n const block = blockType ? field.blocks.find((b) => b.slug === blockType) : undefined\n return traverseFields({\n type,\n data,\n fieldHooks,\n fields: block?.flattenedFields ?? [],\n format,\n operation,\n path: blockType ? `${fieldPath}_${index}_${blockType}` : `${fieldPath}_${index}`,\n req,\n schemaPath: blockType ? `${fieldSchemaPath}_${blockType}` : fieldSchemaPath,\n siblingData: item,\n })\n })\n }\n }\n\n return result\n}\n\n/**\n * Walks a nested document and applies each field's `beforeExport` or\n * `beforeImport` hook.\n *\n * Field-level hook errors are logged and the field falls back to its\n * original value so a single bad doc does not abort the batch.\n */\nexport const applyFieldHooks = (args: Args): Record<string, unknown> => {\n const { data, fieldHooks } = args\n if (!data || typeof data !== 'object' || Object.keys(fieldHooks).length === 0) {\n return data\n }\n\n return traverseFields({\n ...args,\n path: undefined,\n schemaPath: undefined,\n siblingData: data,\n })\n}\n"],"names":["isPlainObject","joinPath","parent","segment","operationLabel","export","import","traverseFields","type","data","fieldHooks","fields","format","operation","path","req","schemaPath","siblingData","result","field","name","fieldPath","fieldSchemaPath","entry","hook","fn","undefined","transformed","columnName","siblingDoc","value","error","payload","logger","err","msg","flattenedFields","Array","isArray","map","item","index","blockType","block","blocks","find","b","slug","applyFieldHooks","args","Object","keys","length"],"mappings":"AASA,SAASA,aAAa,QAAQ,qBAAoB;AAMlD,MAAMC,WAAW,CAACC,QAA4BC,UAC5CD,SAAS,GAAGA,OAAO,CAAC,EAAEC,SAAS,GAAGA;AAYpC,MAAMC,iBAAiB;IAAEC,QAAQ;IAAUC,QAAQ;AAAS;AAQ5D,MAAMC,iBAAiB,CAAC,EACtBC,IAAI,EACJC,IAAI,EACJC,UAAU,EACVC,MA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;IACF;IAEA,OAAOtB;AACT;AAEA;;;;;;CAMC,GACD,OAAO,MAAM8B,kBAAkB,CAACC;IAC9B,MAAM,EAAExC,IAAI,EAAEC,UAAU,EAAE,GAAGuC;IAC7B,IAAI,CAACxC,QAAQ,OAAOA,SAAS,YAAYyC,OAAOC,IAAI,CAACzC,YAAY0C,MAAM,KAAK,GAAG;QAC7E,OAAO3C;IACT;IAEA,OAAOF,eAAe;QACpB,GAAG0C,IAAI;QACPnC,MAAMY;QACNV,YAAYU;QACZT,aAAaR;IACf;AACF,EAAC"}
1
+ {"version":3,"sources":["../../src/utilities/applyFieldHooks.ts"],"sourcesContent":["import type { FlattenedBlock, FlattenedField, PayloadRequest } from 'payload'\n\nimport type {\n ExportFieldHookEntry,\n FieldBeforeExportHook,\n FieldBeforeImportHook,\n ImportFieldHookEntry,\n} from '../types.js'\n\nimport { isPlainObject } from './isPlainObject.js'\n\nexport type FieldHook = FieldBeforeExportHook | FieldBeforeImportHook\n\nexport type FieldHookEntry = ExportFieldHookEntry | ImportFieldHookEntry\n\nconst joinPath = (parent: string | undefined, segment: string): string =>\n parent ? `${parent}_${segment}` : segment\n\nexport type Args = {\n data: Record<string, unknown>\n fieldHooks: Record<string, FieldHookEntry>\n fields: FlattenedField[]\n format: 'csv' | 'json' | ({} & string)\n operation: 'export' | 'import'\n req: PayloadRequest\n type: 'beforeExport' | 'beforeImport'\n}\n\nconst operationLabel = { export: 'Export', import: 'Import' } as const\n\ntype TraverseArgs = {\n path: string | undefined\n schemaPath: string | undefined\n siblingData: Record<string, unknown>\n} & Args\n\nconst traverseFields = ({\n type,\n data,\n fieldHooks,\n fields,\n format,\n operation,\n path,\n req,\n schemaPath,\n siblingData,\n}: TraverseArgs): Record<string, unknown> => {\n const result: Record<string, unknown> = { ...siblingData }\n\n for (const field of fields) {\n if (!('name' in field) || !field.name) {\n continue\n }\n\n const fieldPath = joinPath(path, field.name)\n const fieldSchemaPath = joinPath(schemaPath, field.name)\n const entry = fieldHooks[fieldSchemaPath]\n const hook = entry?.type === type ? (entry.fn as FieldHook) : undefined\n\n if (typeof hook === 'function' && field.name in result) {\n try {\n const transformed = hook({\n columnName: fieldPath,\n data,\n format,\n siblingData: result,\n siblingDoc: siblingData,\n value: result[field.name],\n })\n\n if (typeof transformed !== 'undefined') {\n result[field.name] = transformed\n }\n } catch (error) {\n req.payload.logger.error({\n err: error,\n msg: `[plugin-import-export] Field-level before${operationLabel[operation]} hook for \"${fieldPath}\" threw — falling back to original value`,\n })\n }\n }\n\n if (!(field.name in result)) {\n continue\n }\n\n const value = result[field.name]\n\n if ((field.type === 'group' || field.type === 'tab') && isPlainObject(value)) {\n result[field.name] = traverseFields({\n type,\n data,\n fieldHooks,\n fields: field.flattenedFields,\n format,\n operation,\n path: fieldPath,\n req,\n schemaPath: fieldSchemaPath,\n siblingData: value,\n })\n } else if (field.type === 'array' && Array.isArray(value)) {\n result[field.name] = value.map((item, index) => {\n if (!isPlainObject(item)) {\n return item\n }\n return traverseFields({\n type,\n data,\n fieldHooks,\n fields: field.flattenedFields,\n format,\n operation,\n path: `${fieldPath}_${index}`,\n req,\n schemaPath: fieldSchemaPath,\n siblingData: item,\n })\n })\n } else if (field.type === 'blocks' && Array.isArray(value)) {\n result[field.name] = value.map((item, index) => {\n if (!isPlainObject(item)) {\n return item\n }\n const blockType = typeof item.blockType === 'string' ? item.blockType : undefined\n const block = blockType\n ? (req.payload.blocks[blockType] ??\n field.blocks.find(\n (b): b is FlattenedBlock => typeof b !== 'string' && b.slug === blockType,\n ))\n : undefined\n return traverseFields({\n type,\n data,\n fieldHooks,\n fields: block?.flattenedFields ?? [],\n format,\n operation,\n path: blockType ? `${fieldPath}_${index}_${blockType}` : `${fieldPath}_${index}`,\n req,\n schemaPath: blockType ? `${fieldSchemaPath}_${blockType}` : fieldSchemaPath,\n siblingData: item,\n })\n })\n }\n }\n\n return result\n}\n\n/**\n * Walks a nested document and applies each field's `beforeExport` or\n * `beforeImport` hook.\n *\n * Field-level hook errors are logged and the field falls back to its\n * original value so a single bad doc does not abort the batch.\n */\nexport const applyFieldHooks = (args: Args): Record<string, unknown> => {\n const { data, fieldHooks } = args\n if (!data || typeof data !== 'object' || Object.keys(fieldHooks).length === 0) {\n return data\n }\n\n return traverseFields({\n ...args,\n path: undefined,\n schemaPath: undefined,\n siblingData: data,\n })\n}\n"],"names":["isPlainObject","joinPath","parent","segment","operationLabel","export","import","traverseFields","type","data","fieldHooks","fields","format","operation","path","req","schemaPath","siblingData","result","field","name","fieldPath","fieldSchemaPath","entry","hook","fn","undefined","transformed","columnName","siblingDoc","value","error","payload","logger","err","msg","flattenedFields","Array","isArray","map","item","index","blockType","block","blocks","find","b","slug","applyFieldHooks","args","Object","keys","length"],"mappings":"AASA,SAASA,aAAa,QAAQ,qBAAoB;AAMlD,MAAMC,WAAW,CAACC,QAA4BC,UAC5CD,SAAS,GAAGA,OAAO,CAAC,EAAEC,SAAS,GAAGA;AAYpC,MAAMC,iBAAiB;IAAEC,QAAQ;IAAUC,QAAQ;AAAS;AAQ5D,MAAMC,iBAAiB,CAAC,EACtBC,IAAI,EACJC,IAAI,EACJC,UAAU,EACVC,MAAM,EACNC,MAAM,EACNC,SAAS,EACTC,IAAI,EACJC,GAAG,EACHC,UAAU,EACVC,WAAW,EACE;IACb,MAAMC,SAAkC;QAAE,GAAGD,WAAW;IAAC;IAEzD,KAAK,MAAME,SAASR,OAAQ;QAC1B,IAAI,CAAE,CAAA,UAAUQ,KAAI,KAAM,CAACA,MAAMC,IAAI,EAAE;YACrC;QACF;QAEA,MAAMC,YAAYpB,SAASa,MAAMK,MAAMC,IAAI;QAC3C,MAAME,kBAAkBrB,SAASe,YAAYG,MAAMC,IAAI;QACvD,MAAMG,QAAQb,UAAU,CAACY,gBAAgB;QACzC,MAAME,OAAOD,OAAOf,SAASA,OAAQe,MAAME,EAAE,GAAiBC;QAE9D,IAAI,OAAOF,SAAS,cAAcL,MAAMC,IAAI,IAAIF,QAAQ;YACtD,IAAI;gBACF,MA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ACF,OAAO,IAAIrB,MAAMX,IAAI,KAAK,YAAY6B,MAAMC,OAAO,CAACR,QAAQ;YAC1DZ,MAAM,CAACC,MAAMC,IAAI,CAAC,GAAGU,MAAMS,GAAG,CAAC,CAACC,MAAMC;gBACpC,IAAI,CAACzC,cAAcwC,OAAO;oBACxB,OAAOA;gBACT;gBACA,MAAME,YAAY,OAAOF,KAAKE,SAAS,KAAK,WAAWF,KAAKE,SAAS,GAAGhB;gBACxE,MAAMiB,QAAQD,YACT3B,IAAIiB,OAAO,CAACY,MAAM,CAACF,UAAU,IAC9BvB,MAAMyB,MAAM,CAACC,IAAI,CACf,CAACC,IAA2B,OAAOA,MAAM,YAAYA,EAAEC,IAAI,KAAKL,aAElEhB;gBACJ,OAAOnB,eAAe;oBACpBC;oBACAC;oBACAC;oBACAC,QAAQgC,OAAOP,mBAAmB,EAAE;oBACpCxB;oBACAC;oBACAC,MAAM4B,YAAY,GAAGrB,UAAU,CAAC,EAAEoB,MAAM,CAAC,EAAEC,WAAW,GAAG,GAAGrB,UAAU,CAAC,EAAEoB,OAAO;oBAChF1B;oBACAC,YAAY0B,YAAY,GAAGpB,gBAAgB,CAAC,EAAEoB,WAAW,GAAGpB;oBAC5DL,aAAauB;gBACf;YACF;QACF;IACF;IAEA,OAAOtB;AACT;AAEA;;;;;;CAMC,GACD,OAAO,MAAM8B,kBAAkB,CAACC;IAC9B,MAAM,EAAExC,IAAI,EAAEC,UAAU,EAAE,GAAGuC;IAC7B,IAAI,CAACxC,QAAQ,OAAOA,SAAS,YAAYyC,OAAOC,IAAI,CAACzC,YAAY0C,MAAM,KAAK,GAAG;QAC7E,OAAO3C;IACT;IAEA,OAAOF,eAAe;QACpB,GAAG0C,IAAI;QACPnC,MAAMY;QACNV,YAAYU;QACZT,aAAaR;IACf;AACF,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"flattenedFields.d.ts","sourceRoot":"","sources":["../../src/utilities/flattenedFields.ts"],"names":[],"mappings":"AAAA,OAAO,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 +19,9 @@
19
19
  if (field.type === 'blocks') {
20
20
  const base = parentPath ? `${parentPath}_${field.name}` : field.name;
21
21
  for (const block of field.blocks ?? []){
22
+ if (typeof block === 'string') {
23
+ continue;
24
+ }
22
25
  registerFieldHooks(getBlockFlattenedFields(block), `${base}_${block.slug}`, result, registerHandler);
23
26
  }
24
27
  continue;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utilities/flattenedFields.ts"],"sourcesContent":["import type { FlattenedField } from 'payload'\n\n/**\n * Returns the `flattenedFields` of a group/tab/array field, or undefined for\n * field types that don't carry nested fields. Concentrates the cast for the\n * Payload core typing oversight (`FlattenedField` doesn't expose\n * `flattenedFields` on every variant).\n */\nexport const getNestedFlattenedFields = (field: FlattenedField): FlattenedField[] | undefined =>\n (field as { flattenedFields?: FlattenedField[] }).flattenedFields\n\n/**\n * Returns the `flattenedFields` of a `BlocksField` block (always an array).\n */\nexport const getBlockFlattenedFields = (block: {\n flattenedFields?: FlattenedField[]\n}): FlattenedField[] => block.flattenedFields ?? []\n\n/**\n * Traverses a flattened field schema and calls `registerHandler` for each\n * named field. Handles blocks (keyed by block slug), groups, tabs, and arrays.\n * Shared by `getExportFieldFunctions` and `getImportFieldFunctions`.\n */\nexport const registerFieldHooks = <TEntry>(\n fields: FlattenedField[],\n parentPath: string,\n result: Record<string, TEntry>,\n registerHandler: (field: FlattenedField, fullKey: string, result: Record<string, TEntry>) => void,\n): void => {\n for (const field of fields) {\n if (!('name' in field) || !field.name) {\n continue\n }\n\n if (field.type === 'blocks') {\n const base = parentPath ? `${parentPath}_${field.name}` : field.name\n for (const block of field.blocks ?? []) {\n registerFieldHooks(\n getBlockFlattenedFields(block),\n `${base}_${block.slug}`,\n result,\n registerHandler,\n )\n }\n continue\n }\n\n const fullKey = parentPath ? `${parentPath}_${field.name}` : field.name\n registerHandler(field, fullKey, result)\n\n if (field.type === 'group' || field.type === 'tab' || field.type === 'array') {\n registerFieldHooks(getNestedFlattenedFields(field) ?? [], fullKey, result, registerHandler)\n }\n }\n}\n"],"names":["getNestedFlattenedFields","field","flattenedFields","getBlockFlattenedFields","block","registerFieldHooks","fields","parentPath","result","registerHandler","name","type","base","blocks","slug","fullKey"],"mappings":"AAEA;;;;;CAKC,GACD,OAAO,MAAMA,2BAA2B,CAACC,QACvC,AAACA,MAAiDC,eAAe,CAAA;AAEnE;;CAEC,GACD,OAAO,MAAMC,0BAA0B,CAACC,QAEhBA,MAAMF,eAAe,IAAI,EAAE,CAAA;AAEnD;;;;CAIC,GACD,OAAO,MAAMG,qBAAqB,CAChCC,QACAC,YACAC,QACAC;IAEA,KAAK,MAAMR,SAASK,OAAQ;QAC1B,IAAI,CAAE,CAAA,UAAUL,KAAI,KAAM,CAACA,MAAMS,IAAI,EAAE;YACrC;QACF;QAEA,IAAIT,MAAMU,IAAI,KAAK,UAAU;YAC3B,MAAMC,OAAOL,aAAa,GAAGA,WAAW,CAAC,EAAEN,MAAMS,IAAI,EAAE,GAAGT,MAAMS,IAAI;YACpE,KAAK,MAAMN,SAASH,MAAMY,MAAM,IAAI,EAAE,CAAE;gBACtCR,mBACEF,wBAAwBC,QACxB,GAAGQ,KAAK,CAAC,EAAER,MAAMU,IAAI,EAAE,EACvBN,QACAC;YAEJ;YACA;QACF;QAEA,MAAMM,UAAUR,aAAa,GAAGA,WAAW,CAAC,EAAEN,MAAMS,IAAI,EAAE,GAAGT,MAAMS,IAAI;QACvED,gBAAgBR,OAAOc,SAASP;QAEhC,IAAIP,MAAMU,IAAI,KAAK,WAAWV,MAAMU,IAAI,KAAK,SAASV,MAAMU,IAAI,KAAK,SAAS;YAC5EN,mBAAmBL,yBAAyBC,UAAU,EAAE,EAAEc,SAASP,QAAQC;QAC7E;IACF;AACF,EAAC"}
1
+ {"version":3,"sources":["../../src/utilities/flattenedFields.ts"],"sourcesContent":["import type { FlattenedField } from 'payload'\n\n/**\n * Returns the `flattenedFields` of a group/tab/array field, or undefined for\n * field types that don't carry nested fields. Concentrates the cast for the\n * Payload core typing oversight (`FlattenedField` doesn't expose\n * `flattenedFields` on every variant).\n */\nexport const getNestedFlattenedFields = (field: FlattenedField): FlattenedField[] | undefined =>\n (field as { flattenedFields?: FlattenedField[] }).flattenedFields\n\n/**\n * Returns the `flattenedFields` of a `BlocksField` block (always an array).\n */\nexport const getBlockFlattenedFields = (block: {\n flattenedFields?: FlattenedField[]\n}): FlattenedField[] => block.flattenedFields ?? []\n\n/**\n * Traverses a flattened field schema and calls `registerHandler` for each\n * named field. Handles blocks (keyed by block slug), groups, tabs, and arrays.\n * Shared by `getExportFieldFunctions` and `getImportFieldFunctions`.\n */\nexport const registerFieldHooks = <TEntry>(\n fields: FlattenedField[],\n parentPath: string,\n result: Record<string, TEntry>,\n registerHandler: (field: FlattenedField, fullKey: string, result: Record<string, TEntry>) => void,\n): void => {\n for (const field of fields) {\n if (!('name' in field) || !field.name) {\n continue\n }\n\n if (field.type === 'blocks') {\n const base = parentPath ? `${parentPath}_${field.name}` : field.name\n for (const block of field.blocks ?? []) {\n if (typeof block === 'string') {\n continue\n }\n registerFieldHooks(\n getBlockFlattenedFields(block),\n `${base}_${block.slug}`,\n result,\n registerHandler,\n )\n }\n continue\n }\n\n const fullKey = parentPath ? `${parentPath}_${field.name}` : field.name\n registerHandler(field, fullKey, result)\n\n if (field.type === 'group' || field.type === 'tab' || field.type === 'array') {\n registerFieldHooks(getNestedFlattenedFields(field) ?? [], fullKey, result, registerHandler)\n }\n }\n}\n"],"names":["getNestedFlattenedFields","field","flattenedFields","getBlockFlattenedFields","block","registerFieldHooks","fields","parentPath","result","registerHandler","name","type","base","blocks","slug","fullKey"],"mappings":"AAEA;;;;;CAKC,GACD,OAAO,MAAMA,2BAA2B,CAACC,QACvC,AAACA,MAAiDC,eAAe,CAAA;AAEnE;;CAEC,GACD,OAAO,MAAMC,0BAA0B,CAACC,QAEhBA,MAAMF,eAAe,IAAI,EAAE,CAAA;AAEnD;;;;CAIC,GACD,OAAO,MAAMG,qBAAqB,CAChCC,QACAC,YACAC,QACAC;IAEA,KAAK,MAAMR,SAASK,OAAQ;QAC1B,IAAI,CAAE,CAAA,UAAUL,KAAI,KAAM,CAACA,MAAMS,IAAI,EAAE;YACrC;QACF;QAEA,IAAIT,MAAMU,IAAI,KAAK,UAAU;YAC3B,MAAMC,OAAOL,aAAa,GAAGA,WAAW,CAAC,EAAEN,MAAMS,IAAI,EAAE,GAAGT,MAAMS,IAAI;YACpE,KAAK,MAAMN,SAASH,MAAMY,MAAM,IAAI,EAAE,CAAE;gBACtC,IAAI,OAAOT,UAAU,UAAU;oBAC7B;gBACF;gBACAC,mBACEF,wBAAwBC,QACxB,GAAGQ,KAAK,CAAC,EAAER,MAAMU,IAAI,EAAE,EACvBN,QACAC;YAEJ;YACA;QACF;QAEA,MAAMM,UAAUR,aAAa,GAAGA,WAAW,CAAC,EAAEN,MAAMS,IAAI,EAAE,GAAGT,MAAMS,IAAI;QACvED,gBAAgBR,OAAOc,SAASP;QAEhC,IAAIP,MAAMU,IAAI,KAAK,WAAWV,MAAMU,IAAI,KAAK,SAASV,MAAMU,IAAI,KAAK,SAAS;YAC5EN,mBAAmBL,yBAAyBC,UAAU,EAAE,EAAEc,SAASP,QAAQC;QAC7E;IACF;AACF,EAAC"}
package/license.md CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2018-2024 Payload CMS, Inc. <info@payloadcms.com>
3
+ Copyright (c) 2018-2026 Payload CMS, LLC <info@payloadcms.com>
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/plugin-import-export",
3
- "version": "4.0.0-internal.183b315",
3
+ "version": "4.0.0-internal.203916b",
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": "8.0.1",
67
- "@payloadcms/translations": "4.0.0-internal.183b315",
68
- "@payloadcms/ui": "4.0.0-internal.183b315"
67
+ "@payloadcms/translations": "4.0.0-internal.203916b",
68
+ "@payloadcms/ui": "4.0.0-internal.203916b"
69
69
  },
70
70
  "devDependencies": {
71
- "@payloadcms/ui": "4.0.0-internal.183b315",
72
71
  "@payloadcms/eslint-config": "3.28.0",
73
- "payload": "4.0.0-internal.183b315"
72
+ "payload": "4.0.0-internal.203916b",
73
+ "@payloadcms/ui": "4.0.0-internal.203916b"
74
74
  },
75
75
  "peerDependencies": {
76
- "@payloadcms/ui": "4.0.0-internal.183b315",
77
- "payload": "4.0.0-internal.183b315"
76
+ "payload": "4.0.0-internal.203916b",
77
+ "@payloadcms/ui": "4.0.0-internal.203916b"
78
78
  },
79
79
  "homepage:": "https://payloadcms.com",
80
80
  "scripts": {
@@ -1,2 +0,0 @@
1
-
2
- //# sourceMappingURL=assets.d.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/@types/assets.d.ts"],"names":[],"mappings":""}
@@ -1,48 +0,0 @@
1
- @layer payload-default {
2
- .export-preview {
3
- &__header {
4
- display: flex;
5
- justify-content: space-between;
6
- align-items: flex-end;
7
- margin-bottom: 10px;
8
- }
9
-
10
- &__export-info {
11
- display: flex;
12
- flex-direction: column;
13
- align-items: flex-end;
14
- gap: 2px;
15
- }
16
-
17
- &__export-count {
18
- font-size: var(--font-size-small);
19
- color: var(--theme-elevation-500);
20
- }
21
-
22
- &__limit-capped {
23
- font-size: var(--font-size-small);
24
- color: var(--theme-warning-500);
25
- }
26
-
27
- &__pagination {
28
- display: flex;
29
- align-items: center;
30
- justify-content: space-between;
31
- gap: var(--base);
32
- margin-top: var(--base);
33
- padding-top: var(--base);
34
- border-top: 1px solid var(--theme-elevation-100);
35
-
36
- // When only PerPage is present (no Pagination), keep it on the right
37
- .per-page:only-child {
38
- margin-left: auto;
39
- }
40
- }
41
-
42
- &__page-info {
43
- font-size: var(--font-size-small);
44
- color: var(--theme-elevation-500);
45
- white-space: nowrap;
46
- }
47
- }
48
- }
File without changes
@@ -1,41 +0,0 @@
1
- @layer payload-default {
2
- .import-preview {
3
- &__header {
4
- display: flex;
5
- justify-content: space-between;
6
- align-items: flex-end;
7
- margin-bottom: 10px;
8
- }
9
-
10
- &__info {
11
- font-size: var(--font-size-small);
12
- color: var(--theme-elevation-500);
13
- }
14
-
15
- &__import-count {
16
- font-size: var(--font-size-small);
17
- color: var(--theme-elevation-500);
18
- }
19
-
20
- &__pagination {
21
- display: flex;
22
- align-items: center;
23
- justify-content: space-between;
24
- gap: var(--base);
25
- margin-top: var(--base);
26
- padding-top: var(--base);
27
- border-top: 1px solid var(--theme-elevation-100);
28
-
29
- // When only PerPage is present (no Pagination), keep it on the right
30
- .per-page:only-child {
31
- margin-left: auto;
32
- }
33
- }
34
-
35
- &__page-info {
36
- font-size: var(--font-size-small);
37
- color: var(--theme-elevation-500);
38
- white-space: nowrap;
39
- }
40
- }
41
- }
@@ -1,3 +0,0 @@
1
- .sort-by-fields {
2
- --field-width: 25%;
3
- }
@@ -1,3 +0,0 @@
1
- .sort-order-field {
2
- --field-width: 25%;
3
- }
File without changes