@payloadcms/plugin-import-export 3.77.0-internal.8cf758f → 3.77.0-internal.fd50432

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 (89) hide show
  1. package/dist/components/CollectionField/index.d.ts +2 -2
  2. package/dist/components/CollectionField/index.d.ts.map +1 -1
  3. package/dist/components/CollectionField/index.js +5 -28
  4. package/dist/components/CollectionField/index.js.map +1 -1
  5. package/dist/components/CollectionSelectField/index.d.ts +13 -0
  6. package/dist/components/CollectionSelectField/index.d.ts.map +1 -0
  7. package/dist/components/CollectionSelectField/index.js +159 -0
  8. package/dist/components/CollectionSelectField/index.js.map +1 -0
  9. package/dist/components/ExportListMenuItem/index.d.ts.map +1 -1
  10. package/dist/components/ExportListMenuItem/index.js +5 -1
  11. package/dist/components/ExportListMenuItem/index.js.map +1 -1
  12. package/dist/components/ExportPreview/index.d.ts.map +1 -1
  13. package/dist/components/ExportPreview/index.js.map +1 -1
  14. package/dist/components/FieldsToExport/index.js +1 -1
  15. package/dist/components/FieldsToExport/index.js.map +1 -1
  16. package/dist/components/ImportPreview/index.d.ts.map +1 -1
  17. package/dist/components/ImportPreview/index.js +50 -30
  18. package/dist/components/ImportPreview/index.js.map +1 -1
  19. package/dist/export/createExport.d.ts +1 -2
  20. package/dist/export/createExport.d.ts.map +1 -1
  21. package/dist/export/createExport.js +4 -10
  22. package/dist/export/createExport.js.map +1 -1
  23. package/dist/export/getCreateExportCollectionTask.d.ts.map +1 -1
  24. package/dist/export/getCreateExportCollectionTask.js +12 -1
  25. package/dist/export/getCreateExportCollectionTask.js.map +1 -1
  26. package/dist/export/getExportCollection.d.ts +5 -1
  27. package/dist/export/getExportCollection.d.ts.map +1 -1
  28. package/dist/export/getExportCollection.js +20 -5
  29. package/dist/export/getExportCollection.js.map +1 -1
  30. package/dist/export/getFields.d.ts +7 -1
  31. package/dist/export/getFields.d.ts.map +1 -1
  32. package/dist/export/getFields.js +15 -3
  33. package/dist/export/getFields.js.map +1 -1
  34. package/dist/export/handlePreview.d.ts.map +1 -1
  35. package/dist/export/handlePreview.js +34 -17
  36. package/dist/export/handlePreview.js.map +1 -1
  37. package/dist/exports/rsc.d.ts +0 -1
  38. package/dist/exports/rsc.d.ts.map +1 -1
  39. package/dist/exports/rsc.js +0 -1
  40. package/dist/exports/rsc.js.map +1 -1
  41. package/dist/import/batchProcessor.d.ts.map +1 -1
  42. package/dist/import/batchProcessor.js +9 -3
  43. package/dist/import/batchProcessor.js.map +1 -1
  44. package/dist/import/getFields.d.ts +7 -3
  45. package/dist/import/getFields.d.ts.map +1 -1
  46. package/dist/import/getFields.js +12 -7
  47. package/dist/import/getFields.js.map +1 -1
  48. package/dist/import/getImportCollection.d.ts +6 -3
  49. package/dist/import/getImportCollection.d.ts.map +1 -1
  50. package/dist/import/getImportCollection.js +7 -4
  51. package/dist/import/getImportCollection.js.map +1 -1
  52. package/dist/index.d.ts +5 -0
  53. package/dist/index.d.ts.map +1 -1
  54. package/dist/index.js +2 -0
  55. package/dist/index.js.map +1 -1
  56. package/dist/utilities/filterToSelectedFields.spec.js +204 -0
  57. package/dist/utilities/filterToSelectedFields.spec.js.map +1 -0
  58. package/dist/utilities/flattenObject.d.ts +1 -7
  59. package/dist/utilities/flattenObject.d.ts.map +1 -1
  60. package/dist/utilities/flattenObject.js +14 -25
  61. package/dist/utilities/flattenObject.js.map +1 -1
  62. package/dist/utilities/getFilename.d.ts +1 -1
  63. package/dist/utilities/getFilename.js +3 -3
  64. package/dist/utilities/getFilename.js.map +1 -1
  65. package/dist/utilities/getPluginCollections.d.ts.map +1 -1
  66. package/dist/utilities/getPluginCollections.js +106 -34
  67. package/dist/utilities/getPluginCollections.js.map +1 -1
  68. package/dist/utilities/getSchemaColumns.d.ts +11 -7
  69. package/dist/utilities/getSchemaColumns.d.ts.map +1 -1
  70. package/dist/utilities/getSchemaColumns.js +35 -77
  71. package/dist/utilities/getSchemaColumns.js.map +1 -1
  72. package/dist/utilities/getSchemaColumns.spec.js +157 -0
  73. package/dist/utilities/getSchemaColumns.spec.js.map +1 -0
  74. package/dist/utilities/parseCSV.d.ts.map +1 -1
  75. package/dist/utilities/parseCSV.js +1 -0
  76. package/dist/utilities/parseCSV.js.map +1 -1
  77. package/dist/utilities/parseCSV.spec.js +26 -0
  78. package/dist/utilities/parseCSV.spec.js.map +1 -1
  79. package/package.json +7 -7
  80. package/dist/components/ImportCollectionField/index.d.ts +0 -3
  81. package/dist/components/ImportCollectionField/index.d.ts.map +0 -1
  82. package/dist/components/ImportCollectionField/index.js +0 -17
  83. package/dist/components/ImportCollectionField/index.js.map +0 -1
  84. package/dist/utilities/collectTimezoneCompanionFields.d.ts +0 -24
  85. package/dist/utilities/collectTimezoneCompanionFields.d.ts.map +0 -1
  86. package/dist/utilities/collectTimezoneCompanionFields.js +0 -89
  87. package/dist/utilities/collectTimezoneCompanionFields.js.map +0 -1
  88. package/dist/utilities/collectTimezoneCompanionFields.spec.js +0 -319
  89. package/dist/utilities/collectTimezoneCompanionFields.spec.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/import/getFields.ts"],"sourcesContent":["import type { Config, Field } from 'payload'\n\ntype GetFieldsOptions = {\n collectionSlugs?: string[]\n}\n\nexport const getFields = (config: Config, options?: GetFieldsOptions): Field[] => {\n const collectionOptions =\n options?.collectionSlugs || config.collections?.map(({ slug }) => slug) || []\n\n return [\n {\n name: 'collectionSlug',\n type: 'select',\n options: collectionOptions,\n required: true,\n\n admin: {\n components: {\n Field: '@payloadcms/plugin-import-export/rsc#ImportCollectionField',\n },\n },\n // @ts-expect-error - this is not correctly typed in plugins right now\n label: ({ t }) => t('plugin-import-export:field-collectionSlug-label'),\n validate: (value: any) => {\n if (!value) {\n return 'Collection is required'\n }\n return true\n },\n },\n {\n name: 'importMode',\n type: 'select',\n // @ts-expect-error - this is not correctly typed in plugins right now\n label: ({ t }) => t('plugin-import-export:field-importMode-label'),\n options: [\n {\n // @ts-expect-error - this is not correctly typed in plugins right now\n label: ({ t }) => t('plugin-import-export:field-importMode-create-label'),\n value: 'create',\n },\n {\n // @ts-expect-error - this is not correctly typed in plugins right now\n label: ({ t }) => t('plugin-import-export:field-importMode-update-label'),\n value: 'update',\n },\n {\n // @ts-expect-error - this is not correctly typed in plugins right now\n label: ({ t }) => t('plugin-import-export:field-importMode-upsert-label'),\n value: 'upsert',\n },\n ],\n },\n {\n name: 'matchField',\n type: 'text',\n admin: {\n condition: (_, siblingData) => siblingData?.importMode !== 'create',\n // @ts-expect-error - this is not correctly typed in plugins right now\n description: ({ t }) => t('plugin-import-export:field-matchField-description'),\n },\n defaultValue: 'id',\n // @ts-expect-error - this is not correctly typed in plugins right now\n label: ({ t }) => t('plugin-import-export:field-matchField-label'),\n },\n {\n name: 'status',\n type: 'select',\n admin: {\n readOnly: true,\n },\n defaultValue: 'pending',\n // @ts-expect-error - this is not correctly typed in plugins right now\n label: ({ t }) => t('plugin-import-export:field-status-label'),\n options: [\n {\n label: 'Pending',\n value: 'pending',\n },\n {\n label: 'Completed',\n value: 'completed',\n },\n {\n label: 'Partial',\n value: 'partial',\n },\n {\n label: 'Failed',\n value: 'failed',\n },\n ],\n },\n {\n name: 'summary',\n type: 'group',\n admin: {\n condition: (data) =>\n data?.status === 'completed' || data?.status === 'partial' || data?.status === 'failed',\n },\n fields: [\n {\n name: 'imported',\n type: 'number',\n admin: {\n readOnly: true,\n },\n label: 'Imported',\n },\n {\n name: 'updated',\n type: 'number',\n admin: {\n readOnly: true,\n },\n label: 'Updated',\n },\n {\n name: 'total',\n type: 'number',\n admin: {\n readOnly: true,\n },\n label: 'Total',\n },\n {\n name: 'issues',\n type: 'number',\n admin: {\n readOnly: true,\n },\n label: 'Issues',\n },\n {\n name: 'issueDetails',\n type: 'json',\n admin: {\n condition: (_, siblingData) => siblingData?.issues > 0,\n readOnly: true,\n },\n label: 'Issue Details',\n },\n ],\n // @ts-expect-error - this is not correctly typed in plugins right now\n label: ({ t }) => t('plugin-import-export:field-summary-label'),\n },\n {\n name: 'preview',\n type: 'ui',\n admin: {\n components: {\n Field: '@payloadcms/plugin-import-export/rsc#ImportPreview',\n },\n },\n },\n ]\n}\n"],"names":["getFields","config","options","collectionOptions","collectionSlugs","collections","map","slug","name","type","required","admin","components","Field","label","t","validate","value","condition","_","siblingData","importMode","description","defaultValue","readOnly","data","status","fields","issues"],"mappings":"AAMA,OAAO,MAAMA,YAAY,CAACC,QAAgBC;IACxC,MAAMC,oBACJD,SAASE,mBAAmBH,OAAOI,WAAW,EAAEC,IAAI,CAAC,EAAEC,IAAI,EAAE,GAAKA,SAAS,EAAE;IAE/E,OAAO;QACL;YACEC,MAAM;YACNC,MAAM;YACNP,SAASC;YACTO,UAAU;YAEVC,OAAO;gBACLC,YAAY;oBACVC,OAAO;gBACT;YACF;YACA,sEAAsE;YACtEC,OAAO,CAAC,EAAEC,CAAC,EAAE,GAAKA,EAAE;YACpBC,UAAU,CAACC;gBACT,IAAI,CAACA,OAAO;oBACV,OAAO;gBACT;gBACA,OAAO;YACT;QACF;QACA;YACET,MAAM;YACNC,MAAM;YACN,sEAAsE;YACtEK,OAAO,CAAC,EAAEC,CAAC,EAAE,GAAKA,EAAE;YACpBb,SAAS;gBACP;oBACE,sEAAsE;oBACtEY,OAAO,CAAC,EAAEC,CAAC,EAAE,GAAKA,EAAE;oBACpBE,OAAO;gBACT;gBACA;oBACE,sEAAsE;oBACtEH,OAAO,CAAC,EAAEC,CAAC,EAAE,GAAKA,EAAE;oBACpBE,OAAO;gBACT;gBACA;oBACE,sEAAsE;oBACtEH,OAAO,CAAC,EAAEC,CAAC,EAAE,GAAKA,EAAE;oBACpBE,OAAO;gBACT;aACD;QACH;QACA;YACET,MAAM;YACNC,MAAM;YACNE,OAAO;gBACLO,WAAW,CAACC,GAAGC,cAAgBA,aAAaC,eAAe;gBAC3D,sEAAsE;gBACtEC,aAAa,CAAC,EAAEP,CAAC,EAAE,GAAKA,EAAE;YAC5B;YACAQ,cAAc;YACd,sEAAsE;YACtET,OAAO,CAAC,EAAEC,CAAC,EAAE,GAAKA,EAAE;QACtB;QACA;YACEP,MAAM;YACNC,MAAM;YACNE,OAAO;gBACLa,UAAU;YACZ;YACAD,cAAc;YACd,sEAAsE;YACtET,OAAO,CAAC,EAAEC,CAAC,EAAE,GAAKA,EAAE;YACpBb,SAAS;gBACP;oBACEY,OAAO;oBACPG,OAAO;gBACT;gBACA;oBACEH,OAAO;oBACPG,OAAO;gBACT;gBACA;oBACEH,OAAO;oBACPG,OAAO;gBACT;gBACA;oBACEH,OAAO;oBACPG,OAAO;gBACT;aACD;QACH;QACA;YACET,MAAM;YACNC,MAAM;YACNE,OAAO;gBACLO,WAAW,CAACO,OACVA,MAAMC,WAAW,eAAeD,MAAMC,WAAW,aAAaD,MAAMC,WAAW;YACnF;YACAC,QAAQ;gBACN;oBACEnB,MAAM;oBACNC,MAAM;oBACNE,OAAO;wBACLa,UAAU;oBACZ;oBACAV,OAAO;gBACT;gBACA;oBACEN,MAAM;oBACNC,MAAM;oBACNE,OAAO;wBACLa,UAAU;oBACZ;oBACAV,OAAO;gBACT;gBACA;oBACEN,MAAM;oBACNC,MAAM;oBACNE,OAAO;wBACLa,UAAU;oBACZ;oBACAV,OAAO;gBACT;gBACA;oBACEN,MAAM;oBACNC,MAAM;oBACNE,OAAO;wBACLa,UAAU;oBACZ;oBACAV,OAAO;gBACT;gBACA;oBACEN,MAAM;oBACNC,MAAM;oBACNE,OAAO;wBACLO,WAAW,CAACC,GAAGC,cAAgBA,aAAaQ,SAAS;wBACrDJ,UAAU;oBACZ;oBACAV,OAAO;gBACT;aACD;YACD,sEAAsE;YACtEA,OAAO,CAAC,EAAEC,CAAC,EAAE,GAAKA,EAAE;QACtB;QACA;YACEP,MAAM;YACNC,MAAM;YACNE,OAAO;gBACLC,YAAY;oBACVC,OAAO;gBACT;YACF;QACF;KACD;AACH,EAAC"}
1
+ {"version":3,"sources":["../../src/import/getFields.ts"],"sourcesContent":["import type { Field, PayloadRequest } from 'payload'\n\ntype GetFieldsOptions = {\n /**\n * Collection slugs that this import collection supports.\n * Used for schema/types and as the options in the select field.\n */\n collectionSlugs: string[]\n}\n\nexport const getFields = (options: GetFieldsOptions): Field[] => {\n const { collectionSlugs } = options\n\n return [\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 // @ts-expect-error - this is not correctly typed in plugins right now\n label: ({ t }) => t('plugin-import-export:field-collectionSlug-label'),\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: 'importMode',\n type: 'select',\n // @ts-expect-error - this is not correctly typed in plugins right now\n label: ({ t }) => t('plugin-import-export:field-importMode-label'),\n options: [\n {\n // @ts-expect-error - this is not correctly typed in plugins right now\n label: ({ t }) => t('plugin-import-export:field-importMode-create-label'),\n value: 'create',\n },\n {\n // @ts-expect-error - this is not correctly typed in plugins right now\n label: ({ t }) => t('plugin-import-export:field-importMode-update-label'),\n value: 'update',\n },\n {\n // @ts-expect-error - this is not correctly typed in plugins right now\n label: ({ t }) => t('plugin-import-export:field-importMode-upsert-label'),\n value: 'upsert',\n },\n ],\n },\n {\n name: 'matchField',\n type: 'text',\n admin: {\n condition: (_, siblingData) => siblingData?.importMode !== 'create',\n // @ts-expect-error - this is not correctly typed in plugins right now\n description: ({ t }) => t('plugin-import-export:field-matchField-description'),\n },\n defaultValue: 'id',\n // @ts-expect-error - this is not correctly typed in plugins right now\n label: ({ t }) => t('plugin-import-export:field-matchField-label'),\n },\n {\n name: 'status',\n type: 'select',\n admin: {\n readOnly: true,\n },\n defaultValue: 'pending',\n // @ts-expect-error - this is not correctly typed in plugins right now\n label: ({ t }) => t('plugin-import-export:field-status-label'),\n options: [\n {\n label: 'Pending',\n value: 'pending',\n },\n {\n label: 'Completed',\n value: 'completed',\n },\n {\n label: 'Partial',\n value: 'partial',\n },\n {\n label: 'Failed',\n value: 'failed',\n },\n ],\n },\n {\n name: 'summary',\n type: 'group',\n admin: {\n condition: (data) =>\n data?.status === 'completed' || data?.status === 'partial' || data?.status === 'failed',\n },\n fields: [\n {\n name: 'imported',\n type: 'number',\n admin: {\n readOnly: true,\n },\n label: 'Imported',\n },\n {\n name: 'updated',\n type: 'number',\n admin: {\n readOnly: true,\n },\n label: 'Updated',\n },\n {\n name: 'total',\n type: 'number',\n admin: {\n readOnly: true,\n },\n label: 'Total',\n },\n {\n name: 'issues',\n type: 'number',\n admin: {\n readOnly: true,\n },\n label: 'Issues',\n },\n {\n name: 'issueDetails',\n type: 'json',\n admin: {\n condition: (_, siblingData) => siblingData?.issues > 0,\n readOnly: true,\n },\n label: 'Issue Details',\n },\n ],\n // @ts-expect-error - this is not correctly typed in plugins right now\n label: ({ t }) => t('plugin-import-export:field-summary-label'),\n },\n {\n name: 'preview',\n type: 'ui',\n admin: {\n components: {\n Field: '@payloadcms/plugin-import-export/rsc#ImportPreview',\n },\n },\n },\n ]\n}\n"],"names":["getFields","options","collectionSlugs","name","type","admin","components","Field","defaultValue","label","t","required","validate","value","req","collectionExists","payload","collections","condition","_","siblingData","importMode","description","readOnly","data","status","fields","issues"],"mappings":"AAUA,OAAO,MAAMA,YAAY,CAACC;IACxB,MAAM,EAAEC,eAAe,EAAE,GAAGD;IAE5B,OAAO;QACL;YACEE,MAAM;YACNC,MAAM;YACNC,OAAO;gBACLC,YAAY;oBACVC,OAAO;gBACT;YACF;YACAC,cAAcN,eAAe,CAAC,EAAE;YAChC,sEAAsE;YACtEO,OAAO,CAAC,EAAEC,CAAC,EAAE,GAAKA,EAAE;YACpBC,UAAU;YACVC,UAAU,CAACC,OAAkC,EAAEC,GAAG,EAA2B;gBAC3E,IAAI,CAACD,OAAO;oBACV,OAAO;gBACT;gBACA,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D,MAAMC,WAAW,aAAaD,MAAMC,WAAW;YACnF;YACAC,QAAQ;gBACN;oBACEvB,MAAM;oBACNC,MAAM;oBACNC,OAAO;wBACLkB,UAAU;oBACZ;oBACAd,OAAO;gBACT;gBACA;oBACEN,MAAM;oBACNC,MAAM;oBACNC,OAAO;wBACLkB,UAAU;oBACZ;oBACAd,OAAO;gBACT;gBACA;oBACEN,MAAM;oBACNC,MAAM;oBACNC,OAAO;wBACLkB,UAAU;oBACZ;oBACAd,OAAO;gBACT;gBACA;oBACEN,MAAM;oBACNC,MAAM;oBACNC,OAAO;wBACLkB,UAAU;oBACZ;oBACAd,OAAO;gBACT;gBACA;oBACEN,MAAM;oBACNC,MAAM;oBACNC,OAAO;wBACLa,WAAW,CAACC,GAAGC,cAAgBA,aAAaO,SAAS;wBACrDJ,UAAU;oBACZ;oBACAd,OAAO;gBACT;aACD;YACD,sEAAsE;YACtEA,OAAO,CAAC,EAAEC,CAAC,EAAE,GAAKA,EAAE;QACtB;QACA;YACEP,MAAM;YACNC,MAAM;YACNC,OAAO;gBACLC,YAAY;oBACVC,OAAO;gBACT;YACF;QACF;KACD;AACH,EAAC"}
@@ -1,7 +1,10 @@
1
- import type { CollectionConfig, Config } from 'payload';
1
+ import type { CollectionConfig } from 'payload';
2
2
  import type { ImportConfig, ImportExportPluginConfig } from '../types.js';
3
- export declare const getImportCollection: ({ config, importConfig, pluginConfig, }: {
4
- config: Config;
3
+ export declare const getImportCollection: ({ collectionSlugs, importConfig, pluginConfig, }: {
4
+ /**
5
+ * Collection slugs that this import collection supports.
6
+ */
7
+ collectionSlugs: string[];
5
8
  importConfig?: ImportConfig;
6
9
  pluginConfig: ImportExportPluginConfig;
7
10
  }) => CollectionConfig;
@@ -1 +1 @@
1
- {"version":3,"file":"getImportCollection.d.ts","sourceRoot":"","sources":["../../src/import/getImportCollection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,gBAAgB,EAChB,MAAM,EACP,MAAM,SAAS,CAAA;AAIhB,OAAO,KAAK,EAAE,YAAY,EAAE,wBAAwB,EAAS,MAAM,aAAa,CAAA;AAShF,eAAO,MAAM,mBAAmB,4CAI7B;IACD,MAAM,EAAE,MAAM,CAAA;IACd,YAAY,CAAC,EAAE,YAAY,CAAA;IAC3B,YAAY,EAAE,wBAAwB,CAAA;CACvC,KAAG,gBA2QH,CAAA"}
1
+ {"version":3,"file":"getImportCollection.d.ts","sourceRoot":"","sources":["../../src/import/getImportCollection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,gBAAgB,EACjB,MAAM,SAAS,CAAA;AAIhB,OAAO,KAAK,EAAE,YAAY,EAAE,wBAAwB,EAAS,MAAM,aAAa,CAAA;AAShF,eAAO,MAAM,mBAAmB,qDAI7B;IACD;;OAEG;IACH,eAAe,EAAE,MAAM,EAAE,CAAA;IACzB,YAAY,CAAC,EAAE,YAAY,CAAA;IAC3B,YAAY,EAAE,wBAAwB,CAAA;CACvC,KAAG,gBA6QH,CAAA"}
@@ -4,15 +4,13 @@ import { resolveLimit } from '../utilities/resolveLimit.js';
4
4
  import { createImport } from './createImport.js';
5
5
  import { getFields } from './getFields.js';
6
6
  import { handlePreview } from './handlePreview.js';
7
- export const getImportCollection = ({ config, importConfig, pluginConfig })=>{
7
+ export const getImportCollection = ({ collectionSlugs, importConfig, pluginConfig })=>{
8
8
  const beforeOperation = [];
9
9
  const afterChange = [];
10
10
  // Extract import-specific settings
11
11
  const disableJobsQueue = importConfig?.disableJobsQueue ?? false;
12
12
  const batchSize = importConfig?.batchSize ?? 100;
13
13
  const defaultVersionStatus = importConfig?.defaultVersionStatus ?? 'published';
14
- // Get collection slugs for the dropdown
15
- const collectionSlugs = pluginConfig.collections?.map((c)=>c.slug);
16
14
  const collection = {
17
15
  slug: 'imports',
18
16
  access: {
@@ -24,6 +22,11 @@ export const getImportCollection = ({ config, importConfig, pluginConfig })=>{
24
22
  SaveButton: '@payloadcms/plugin-import-export/rsc#ImportSaveButton'
25
23
  }
26
24
  },
25
+ custom: {
26
+ 'plugin-import-export': {
27
+ collectionSlugs
28
+ }
29
+ },
27
30
  disableCopyToLocale: true,
28
31
  group: false,
29
32
  useAsTitle: 'filename'
@@ -36,7 +39,7 @@ export const getImportCollection = ({ config, importConfig, pluginConfig })=>{
36
39
  path: '/preview-data'
37
40
  }
38
41
  ],
39
- fields: getFields(config, {
42
+ fields: getFields({
40
43
  collectionSlugs
41
44
  }),
42
45
  hooks: {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/import/getImportCollection.ts"],"sourcesContent":["import type {\n CollectionAfterChangeHook,\n CollectionBeforeOperationHook,\n CollectionConfig,\n Config,\n} from 'payload'\n\nimport { FileRetrievalError } from 'payload'\n\nimport type { ImportConfig, ImportExportPluginConfig, Limit } from '../types.js'\nimport type { ImportTaskInput } from './getCreateImportCollectionTask.js'\n\nimport { getFileFromDoc } from '../utilities/getFileFromDoc.js'\nimport { resolveLimit } from '../utilities/resolveLimit.js'\nimport { createImport } from './createImport.js'\nimport { getFields } from './getFields.js'\nimport { handlePreview } from './handlePreview.js'\n\nexport const getImportCollection = ({\n config,\n importConfig,\n pluginConfig,\n}: {\n config: Config\n importConfig?: ImportConfig\n pluginConfig: ImportExportPluginConfig\n}): CollectionConfig => {\n const beforeOperation: CollectionBeforeOperationHook[] = []\n const afterChange: CollectionAfterChangeHook[] = []\n\n // Extract import-specific settings\n const disableJobsQueue = importConfig?.disableJobsQueue ?? false\n const batchSize = importConfig?.batchSize ?? 100\n const defaultVersionStatus = importConfig?.defaultVersionStatus ?? 'published'\n\n // Get collection slugs for the dropdown\n const collectionSlugs = pluginConfig.collections?.map((c) => c.slug)\n\n const collection: CollectionConfig = {\n slug: 'imports',\n access: {\n update: () => false,\n },\n admin: {\n components: {\n edit: {\n SaveButton: '@payloadcms/plugin-import-export/rsc#ImportSaveButton',\n },\n },\n disableCopyToLocale: true,\n group: false,\n useAsTitle: 'filename',\n },\n disableDuplicate: true,\n endpoints: [\n {\n handler: handlePreview,\n method: 'post',\n path: '/preview-data',\n },\n ],\n fields: getFields(config, { collectionSlugs }),\n hooks: {\n afterChange,\n beforeOperation,\n },\n lockDocuments: false,\n upload: {\n filesRequiredOnCreate: true,\n hideFileInputOnCreate: false,\n hideRemoveFile: true,\n mimeTypes: ['text/csv', 'application/json'],\n },\n }\n\n if (disableJobsQueue) {\n // Process the import synchronously after the document (with file) has been created\n afterChange.push(async ({ collection: collectionConfig, doc, operation, req }) => {\n if (operation !== 'create' || doc.status !== 'pending') {\n return doc\n }\n\n const debug = pluginConfig.debug || false\n\n try {\n // Get file data from the uploaded document\n // First try req.file which is available during the same request (especially important for cloud storage)\n // Fall back to getFileFromDoc for cases where req.file isn't available\n let fileData: Buffer\n let fileMimetype: string\n\n if (req.file?.data) {\n fileData = req.file.data\n fileMimetype = req.file.mimetype || doc.mimeType\n\n if (!fileMimetype) {\n throw new FileRetrievalError(\n req.t,\n `Unable to determine mimetype for file: ${doc.filename}`,\n )\n }\n } else {\n const fileFromDoc = await getFileFromDoc({\n collectionConfig,\n doc: {\n filename: doc.filename,\n mimeType: doc.mimeType,\n url: doc.url,\n },\n req,\n })\n fileData = fileFromDoc.data\n fileMimetype = fileFromDoc.mimetype\n }\n\n const targetCollection = req.payload.collections[doc.collectionSlug]\n const importLimitConfig: Limit | undefined =\n targetCollection?.config.custom?.['plugin-import-export']?.importLimit\n const maxLimit = await resolveLimit({\n limit: importLimitConfig,\n req,\n })\n\n const result = await createImport({\n id: doc.id,\n name: doc.filename || 'import',\n batchSize,\n collectionSlug: doc.collectionSlug,\n debug,\n defaultVersionStatus,\n file: {\n name: doc.filename,\n data: fileData,\n mimetype: fileMimetype,\n },\n format: fileMimetype === 'text/csv' ? 'csv' : 'json',\n importMode: doc.importMode || 'create',\n matchField: doc.matchField,\n maxLimit,\n req,\n userCollection: req?.user?.collection || req?.user?.user?.collection,\n userID: req?.user?.id || req?.user?.user?.id,\n })\n\n // Determine status\n let status: 'completed' | 'failed' | 'partial'\n if (result.errors.length === 0) {\n status = 'completed'\n } else if (result.imported + result.updated === 0) {\n status = 'failed'\n } else {\n status = 'partial'\n }\n\n const summary = {\n imported: result.imported,\n issueDetails:\n result.errors.length > 0\n ? result.errors.map((e) => ({\n data: e.doc,\n error: e.error,\n row: e.index + 1,\n }))\n : undefined,\n issues: result.errors.length,\n total: result.total,\n updated: result.updated,\n }\n\n // Try to update the document with results (may fail due to transaction timing)\n try {\n await req.payload.update({\n id: doc.id,\n collection: collectionConfig.slug,\n data: {\n status,\n summary,\n },\n overrideAccess: true,\n req,\n })\n } catch (updateErr) {\n // Update may fail if document not yet committed, log but continue\n if (debug) {\n req.payload.logger.error({\n err: updateErr,\n msg: `Failed to update import document ${doc.id} with results`,\n })\n }\n }\n\n // Return updated doc for immediate response\n return {\n ...doc,\n status,\n summary,\n }\n } catch (err) {\n const summary = {\n imported: 0,\n issueDetails: [\n {\n data: {},\n error: err instanceof Error ? err.message : String(err),\n row: 0,\n },\n ],\n issues: 1,\n total: 0,\n updated: 0,\n }\n\n // Try to update document with error status\n try {\n await req.payload.update({\n id: doc.id,\n collection: collectionConfig.slug,\n data: {\n status: 'failed',\n summary,\n },\n overrideAccess: true,\n req,\n })\n } catch (updateErr) {\n // Update may fail if document not yet committed, log but continue\n if (debug) {\n req.payload.logger.error({\n err: updateErr,\n msg: `Failed to update import document ${doc.id} with error status`,\n })\n }\n }\n\n if (debug) {\n req.payload.logger.error({\n err,\n msg: 'Import processing failed',\n })\n }\n\n // Return error status for immediate response\n return {\n ...doc,\n status: 'failed',\n summary,\n }\n }\n })\n } else {\n // When jobs queue is enabled, queue the import as a job\n // The job handler will fetch the file from storage using getFileFromDoc\n afterChange.push(async ({ collection: collectionConfig, doc, operation, req }) => {\n if (operation !== 'create') {\n return\n }\n\n try {\n // Resolve maxLimit ahead of time since it may involve async config resolution\n const targetCollection = req.payload.collections[doc.collectionSlug]\n const importLimitConfig: Limit | undefined =\n targetCollection?.config.custom?.['plugin-import-export']?.importLimit\n const maxLimit = await resolveLimit({\n limit: importLimitConfig,\n req,\n })\n\n // Only pass minimal data to the job - the handler will fetch the file from storage\n const input: ImportTaskInput = {\n batchSize,\n debug: pluginConfig.debug,\n defaultVersionStatus,\n importCollection: collectionConfig.slug,\n importId: doc.id,\n maxLimit,\n userCollection: req.user?.collection || req?.user?.user?.collection,\n userID: req?.user?.id || req?.user?.user?.id,\n }\n\n await req.payload.jobs.queue({\n input,\n task: 'createCollectionImport',\n })\n } catch (err) {\n req.payload.logger.error({\n err,\n msg: `Failed to queue import job for document ${doc.id}`,\n })\n }\n })\n }\n\n return collection\n}\n"],"names":["FileRetrievalError","getFileFromDoc","resolveLimit","createImport","getFields","handlePreview","getImportCollection","config","importConfig","pluginConfig","beforeOperation","afterChange","disableJobsQueue","batchSize","defaultVersionStatus","collectionSlugs","collections","map","c","slug","collection","access","update","admin","components","edit","SaveButton","disableCopyToLocale","group","useAsTitle","disableDuplicate","endpoints","handler","method","path","fields","hooks","lockDocuments","upload","filesRequiredOnCreate","hideFileInputOnCreate","hideRemoveFile","mimeTypes","push","collectionConfig","doc","operation","req","status","debug","fileData","fileMimetype","file","data","mimetype","mimeType","t","filename","fileFromDoc","url","targetCollection","payload","collectionSlug","importLimitConfig","custom","importLimit","maxLimit","limit","result","id","name","format","importMode","matchField","userCollection","user","userID","errors","length","imported","updated","summary","issueDetails","e","error","row","index","undefined","issues","total","overrideAccess","updateErr","logger","err","msg","Error","message","String","input","importCollection","importId","jobs","queue","task"],"mappings":"AAOA,SAASA,kBAAkB,QAAQ,UAAS;AAK5C,SAASC,cAAc,QAAQ,iCAAgC;AAC/D,SAASC,YAAY,QAAQ,+BAA8B;AAC3D,SAASC,YAAY,QAAQ,oBAAmB;AAChD,SAASC,SAAS,QAAQ,iBAAgB;AAC1C,SAASC,aAAa,QAAQ,qBAAoB;AAElD,OAAO,MAAMC,sBAAsB,CAAC,EAClCC,MAAM,EACNC,YAAY,EACZC,YAAY,EAKb;IACC,MAAMC,kBAAmD,EAAE;IAC3D,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KAAK4B,MAAMA,MAAMvD;oBACzDwD,QAAQ7B,KAAK4B,MAAMN,MAAMtB,KAAK4B,MAAMA,MAAMN;gBAC5C;gBAEA,MAAMtB,IAAIc,OAAO,CAACwC,IAAI,CAACC,KAAK,CAAC;oBAC3BJ;oBACAK,MAAM;gBACR;YACF,EAAE,OAAOV,KAAK;gBACZ9C,IAAIc,OAAO,CAAC+B,MAAM,CAACR,KAAK,CAAC;oBACvBS;oBACAC,KAAK,CAAC,wCAAwC,EAAEjD,IAAIwB,EAAE,EAAE;gBAC1D;YACF;QACF;IACF;IAEA,OAAOjD;AACT,EAAC"}
1
+ {"version":3,"sources":["../../src/import/getImportCollection.ts"],"sourcesContent":["import type {\n CollectionAfterChangeHook,\n CollectionBeforeOperationHook,\n CollectionConfig,\n} from 'payload'\n\nimport { FileRetrievalError } from 'payload'\n\nimport type { ImportConfig, ImportExportPluginConfig, Limit } from '../types.js'\nimport type { ImportTaskInput } from './getCreateImportCollectionTask.js'\n\nimport { getFileFromDoc } from '../utilities/getFileFromDoc.js'\nimport { resolveLimit } from '../utilities/resolveLimit.js'\nimport { createImport } from './createImport.js'\nimport { getFields } from './getFields.js'\nimport { handlePreview } from './handlePreview.js'\n\nexport const getImportCollection = ({\n collectionSlugs,\n importConfig,\n pluginConfig,\n}: {\n /**\n * Collection slugs that this import collection supports.\n */\n collectionSlugs: string[]\n importConfig?: ImportConfig\n pluginConfig: ImportExportPluginConfig\n}): CollectionConfig => {\n const beforeOperation: CollectionBeforeOperationHook[] = []\n const afterChange: CollectionAfterChangeHook[] = []\n\n // Extract import-specific settings\n const disableJobsQueue = importConfig?.disableJobsQueue ?? false\n const batchSize = importConfig?.batchSize ?? 100\n const defaultVersionStatus = importConfig?.defaultVersionStatus ?? 'published'\n\n const collection: CollectionConfig = {\n slug: 'imports',\n access: {\n update: () => false,\n },\n admin: {\n components: {\n edit: {\n SaveButton: '@payloadcms/plugin-import-export/rsc#ImportSaveButton',\n },\n },\n custom: {\n 'plugin-import-export': {\n collectionSlugs,\n },\n },\n disableCopyToLocale: true,\n group: false,\n useAsTitle: 'filename',\n },\n disableDuplicate: true,\n endpoints: [\n {\n handler: handlePreview,\n method: 'post',\n path: '/preview-data',\n },\n ],\n fields: getFields({ collectionSlugs }),\n hooks: {\n afterChange,\n beforeOperation,\n },\n lockDocuments: false,\n upload: {\n filesRequiredOnCreate: true,\n hideFileInputOnCreate: false,\n hideRemoveFile: true,\n mimeTypes: ['text/csv', 'application/json'],\n },\n }\n\n if (disableJobsQueue) {\n // Process the import synchronously after the document (with file) has been created\n afterChange.push(async ({ collection: collectionConfig, doc, operation, req }) => {\n if (operation !== 'create' || doc.status !== 'pending') {\n return doc\n }\n\n const debug = pluginConfig.debug || false\n\n try {\n // Get file data from the uploaded document\n // First try req.file which is available during the same request (especially important for cloud storage)\n // Fall back to getFileFromDoc for cases where req.file isn't available\n let fileData: Buffer\n let fileMimetype: string\n\n if (req.file?.data) {\n fileData = req.file.data\n fileMimetype = req.file.mimetype || doc.mimeType\n\n if (!fileMimetype) {\n throw new FileRetrievalError(\n req.t,\n `Unable to determine mimetype for file: ${doc.filename}`,\n )\n }\n } else {\n const fileFromDoc = await getFileFromDoc({\n collectionConfig,\n doc: {\n filename: doc.filename,\n mimeType: doc.mimeType,\n url: doc.url,\n },\n req,\n })\n fileData = fileFromDoc.data\n fileMimetype = fileFromDoc.mimetype\n }\n\n const targetCollection = req.payload.collections[doc.collectionSlug]\n const importLimitConfig: Limit | undefined =\n targetCollection?.config.custom?.['plugin-import-export']?.importLimit\n const maxLimit = await resolveLimit({\n limit: importLimitConfig,\n req,\n })\n\n const result = await createImport({\n id: doc.id,\n name: doc.filename || 'import',\n batchSize,\n collectionSlug: doc.collectionSlug,\n debug,\n defaultVersionStatus,\n file: {\n name: doc.filename,\n data: fileData,\n mimetype: fileMimetype,\n },\n format: fileMimetype === 'text/csv' ? 'csv' : 'json',\n importMode: doc.importMode || 'create',\n matchField: doc.matchField,\n maxLimit,\n req,\n userCollection: req?.user?.collection || req?.user?.user?.collection,\n userID: req?.user?.id || req?.user?.user?.id,\n })\n\n // Determine status\n let status: 'completed' | 'failed' | 'partial'\n if (result.errors.length === 0) {\n status = 'completed'\n } else if (result.imported + result.updated === 0) {\n status = 'failed'\n } else {\n status = 'partial'\n }\n\n const summary = {\n imported: result.imported,\n issueDetails:\n result.errors.length > 0\n ? result.errors.map((e) => ({\n data: e.doc,\n error: e.error,\n row: e.index + 1,\n }))\n : undefined,\n issues: result.errors.length,\n total: result.total,\n updated: result.updated,\n }\n\n // Try to update the document with results (may fail due to transaction timing)\n try {\n await req.payload.update({\n id: doc.id,\n collection: collectionConfig.slug,\n data: {\n status,\n summary,\n },\n overrideAccess: true,\n req,\n })\n } catch (updateErr) {\n // Update may fail if document not yet committed, log but continue\n if (debug) {\n req.payload.logger.error({\n err: updateErr,\n msg: `Failed to update import document ${doc.id} with results`,\n })\n }\n }\n\n // Return updated doc for immediate response\n return {\n ...doc,\n status,\n summary,\n }\n } catch (err) {\n const summary = {\n imported: 0,\n issueDetails: [\n {\n data: {},\n error: err instanceof Error ? err.message : String(err),\n row: 0,\n },\n ],\n issues: 1,\n total: 0,\n updated: 0,\n }\n\n // Try to update document with error status\n try {\n await req.payload.update({\n id: doc.id,\n collection: collectionConfig.slug,\n data: {\n status: 'failed',\n summary,\n },\n overrideAccess: true,\n req,\n })\n } catch (updateErr) {\n // Update may fail if document not yet committed, log but continue\n if (debug) {\n req.payload.logger.error({\n err: updateErr,\n msg: `Failed to update import document ${doc.id} with error status`,\n })\n }\n }\n\n if (debug) {\n req.payload.logger.error({\n err,\n msg: 'Import processing failed',\n })\n }\n\n // Return error status for immediate response\n return {\n ...doc,\n status: 'failed',\n summary,\n }\n }\n })\n } else {\n // When jobs queue is enabled, queue the import as a job\n // The job handler will fetch the file from storage using getFileFromDoc\n afterChange.push(async ({ collection: collectionConfig, doc, operation, req }) => {\n if (operation !== 'create') {\n return\n }\n\n try {\n // Resolve maxLimit ahead of time since it may involve async config resolution\n const targetCollection = req.payload.collections[doc.collectionSlug]\n const importLimitConfig: Limit | undefined =\n targetCollection?.config.custom?.['plugin-import-export']?.importLimit\n const maxLimit = await resolveLimit({\n limit: importLimitConfig,\n req,\n })\n\n // Only pass minimal data to the job - the handler will fetch the file from storage\n const input: ImportTaskInput = {\n batchSize,\n debug: pluginConfig.debug,\n defaultVersionStatus,\n importCollection: collectionConfig.slug,\n importId: doc.id,\n maxLimit,\n userCollection: req.user?.collection || req?.user?.user?.collection,\n userID: req?.user?.id || req?.user?.user?.id,\n }\n\n await req.payload.jobs.queue({\n input,\n task: 'createCollectionImport',\n })\n } catch (err) {\n req.payload.logger.error({\n err,\n msg: `Failed to queue import job for document ${doc.id}`,\n })\n }\n })\n }\n\n return collection\n}\n"],"names":["FileRetrievalError","getFileFromDoc","resolveLimit","createImport","getFields","handlePreview","getImportCollection","collectionSlugs","importConfig","pluginConfig","beforeOperation","afterChange","disableJobsQueue","batchSize","defaultVersionStatus","collection","slug","access","update","admin","components","edit","SaveButton","custom","disableCopyToLocale","group","useAsTitle","disableDuplicate","endpoints","handler","method","path","fields","hooks","lockDocuments","upload","filesRequiredOnCreate","hideFileInputOnCreate","hideRemoveFile","mimeTypes","push","collectionConfig","doc","operation","req","status","debug","fileData","fileMimetype","file","data","mimetype","mimeType","t","filename","fileFromDoc","url","targetCollection","payload","collections","collectionSlug","importLimitConfig","config","importLimit","maxLimit","limit","result","id","name","format","importMode","matchField","userCollection","user","userID","errors","length","imported","updated","summary","issueDetails","map","e","error","row","index","undefined","issues","total","overrideAccess","updateErr","logger","err","msg","Error","message","String","input","importCollection","importId","jobs","queue","task"],"mappings":"AAMA,SAASA,kBAAkB,QAAQ,UAAS;AAK5C,SAASC,cAAc,QAAQ,iCAAgC;AAC/D,SAASC,YAAY,QAAQ,+BAA8B;AAC3D,SAASC,YAAY,QAAQ,oBAAmB;AAChD,SAASC,SAAS,QAAQ,iBAAgB;AAC1C,SAASC,aAAa,QAAQ,qBAAoB;AAEl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AAgB5B,IAAI6B,IAAI,EAAE1D,cAAc6B,KAAK6B,MAAMA,MAAM1D;oBACzD2D,QAAQ9B,KAAK6B,MAAMN,MAAMvB,KAAK6B,MAAMA,MAAMN;gBAC5C;gBAEA,MAAMvB,IAAIc,OAAO,CAAC0C,IAAI,CAACC,KAAK,CAAC;oBAC3BJ;oBACAK,MAAM;gBACR;YACF,EAAE,OAAOV,KAAK;gBACZhD,IAAIc,OAAO,CAACiC,MAAM,CAACR,KAAK,CAAC;oBACvBS;oBACAC,KAAK,CAAC,wCAAwC,EAAEnD,IAAIyB,EAAE,EAAE;gBAC1D;YACF;QACF;IACF;IAEA,OAAOpD;AACT,EAAC"}
package/dist/index.d.ts CHANGED
@@ -21,6 +21,11 @@ declare module 'payload' {
21
21
  }
22
22
  interface CollectionAdminCustom {
23
23
  'plugin-import-export'?: {
24
+ /**
25
+ * Array of collection slugs that this export/import collection can target.
26
+ * Used by CollectionField to populate the dropdown options.
27
+ */
28
+ collectionSlugs?: string[];
24
29
  /**
25
30
  * Array of field paths that are disabled for import/export.
26
31
  * These paths are collected from fields marked with `custom['plugin-import-export'].disabled = true`.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAKrC,OAAO,KAAK,EACV,eAAe,EACf,wBAAwB,EACxB,KAAK,EAEL,aAAa,EACd,MAAM,YAAY,CAAA;AAQnB,eAAO,MAAM,kBAAkB,iBACd,wBAAwB,cACxB,MAAM,KAAG,OAAO,CAAC,MAAM,CA2KrC,CAAA;AAEH,OAAO,QAAQ,SAAS,CAAC;IACvB,UAAiB,WAAW;QAC1B,sBAAsB,CAAC,EAAE;YACvB;;;;;;eAMG;YACH,QAAQ,CAAC,EAAE,OAAO,CAAA;YAClB,OAAO,CAAC,EAAE,eAAe,CAAA;YACzB;;eAEG;YACH,KAAK,CAAC,EAAE,aAAa,C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AAE,KAAK,CAAA;YACnB;;;;eAIG;YACH,WAAW,CAAC,EAAE,KAAK,CAAA;SACpB,CAAA;KACF;CACF"}
package/dist/index.js CHANGED
@@ -75,6 +75,7 @@ export const importExportPlugin = (pluginConfig)=>async (config)=>{
75
75
  if (!exportDisabled) {
76
76
  components.listMenuItems.push({
77
77
  clientProps: {
78
+ collectionSlug: collection.slug,
78
79
  exportCollectionSlug: exportSlugForCollection
79
80
  },
80
81
  path: '@payloadcms/plugin-import-export/rsc#ExportListMenuItem'
@@ -84,6 +85,7 @@ export const importExportPlugin = (pluginConfig)=>async (config)=>{
84
85
  if (!importDisabled) {
85
86
  components.listMenuItems.push({
86
87
  clientProps: {
88
+ collectionSlug: collection.slug,
87
89
  importCollectionSlug: importSlugForCollection
88
90
  },
89
91
  path: '@payloadcms/plugin-import-export/rsc#ImportListMenuItem'
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { Config } from 'payload'\n\nimport { deepMergeSimple } from 'payload'\n\nimport type { PluginDefaultTranslationsObject } from './translations/types.js'\nimport type {\n FromCSVFunction,\n ImportExportPluginConfig,\n Limit,\n PluginCollectionConfig,\n ToCSVFunction,\n} from './types.js'\n\nimport { getCreateCollectionExportTask } from './export/getCreateExportCollectionTask.js'\nimport { getCreateCollectionImportTask } from './import/getCreateImportCollectionTask.js'\nimport { translations } from './translations/index.js'\nimport { collectDisabledFieldPaths } from './utilities/collectDisabledFieldPaths.js'\nimport { getPluginCollections } from './utilities/getPluginCollections.js'\n\nexport const importExportPlugin =\n (pluginConfig: ImportExportPluginConfig) =>\n async (config: Config): Promise<Config> => {\n // Get all export/import collections and the mappings from target collections to custom collections\n const { customExportSlugMap, customImportSlugMap, exportCollections, importCollections } =\n await getPluginCollections({\n config,\n pluginConfig,\n })\n\n // Base collections are at index 0 (always present)\n const baseExportCollection = exportCollections[0]!\n const baseImportCollection = importCollections[0]!\n\n // Collect all export and import collection slugs for filtering\n const allExportSlugs = new Set(exportCollections.map((c) => c.slug))\n const allImportSlugs = new Set(importCollections.map((c) => c.slug))\n\n // Initialize collections array if needed\n if (!config.collections) {\n config.collections = []\n }\n\n // Push all export/import collections if their slugs don't already exist\n for (const collection of [...exportCollections, ...importCollections]) {\n const slugExists = config.collections.some((c) => c.slug === collection.slug)\n if (!slugExists) {\n config.collections.push(collection)\n }\n }\n\n // inject custom import export provider\n config.admin = config.admin || {}\n config.admin.components = config.admin.components || {}\n config.admin.components.providers = config.admin.components.providers || []\n config.admin.components.providers.push(\n '@payloadcms/plugin-import-export/rsc#ImportExportProvider',\n )\n\n // inject the createExport and createImport jobs into the config\n ;((config.jobs ??= {}).tasks ??= []).push(getCreateCollectionExportTask(config))\n config.jobs.tasks.push(getCreateCollectionImportTask(config))\n\n // Build a map of collection configs for quick lookup\n const collectionConfigMap = new Map<string, PluginCollectionConfig>()\n if (pluginConfig.collections) {\n for (const collectionConfig of pluginConfig.collections) {\n collectionConfigMap.set(collectionConfig.slug, collectionConfig)\n }\n }\n\n // Determine which collections to add import/export menu items to\n // Exclude all export and import collections\n const collectionsToUpdate = config.collections.filter(\n (c) => !allExportSlugs.has(c.slug) && !allImportSlugs.has(c.slug),\n )\n\n for (const collection of collectionsToUpdate) {\n // Get the plugin config for this collection (if specified)\n const collectionPluginConfig = collectionConfigMap.get(collection.slug)\n\n // If collections array is specified but this collection is not in it, skip\n if (\n pluginConfig.collections &&\n pluginConfig.collections.length > 0 &&\n !collectionPluginConfig\n ) {\n continue\n }\n\n // Determine which export/import collection to use for this collection\n const exportSlugForCollection =\n customExportSlugMap.get(collection.slug) || baseExportCollection.slug\n const importSlugForCollection =\n customImportSlugMap.get(collection.slug) || baseImportCollection.slug\n\n // Check if export/import are disabled for this collection\n const exportDisabled = collectionPluginConfig?.export === false\n const importDisabled = collectionPluginConfig?.import === false\n\n if (!collection.admin) {\n collection.admin = { components: { listMenuItems: [] } }\n }\n const components = collection.admin.components || {}\n if (!components.listMenuItems) {\n components.listMenuItems = []\n }\n\n // Add export menu item if not disabled\n if (!exportDisabled) {\n components.listMenuItems.push({\n clientProps: {\n exportCollectionSlug: exportSlugForCollection,\n },\n path: '@payloadcms/plugin-import-export/rsc#ExportListMenuItem',\n })\n }\n\n // Add import menu item if not disabled\n if (!importDisabled) {\n components.listMenuItems.push({\n clientProps: {\n importCollectionSlug: importSlugForCollection,\n },\n path: '@payloadcms/plugin-import-export/rsc#ImportListMenuItem',\n })\n }\n\n // Find fields explicitly marked as disabled for import/export\n const disabledFieldAccessors = collectDisabledFieldPaths(collection.fields)\n\n const exportConfig =\n typeof collectionPluginConfig?.export === 'object'\n ? collectionPluginConfig.export\n : undefined\n const exportFormat = exportConfig?.format\n\n const importConfig =\n typeof collectionPluginConfig?.import === 'object'\n ? collectionPluginConfig.import\n : undefined\n\n const exportLimit = exportConfig?.limit ?? pluginConfig.exportLimit\n\n const importLimit = importConfig?.limit ?? pluginConfig.importLimit\n\n // Store disabled field accessors and export format in the admin config for use in the UI\n // Note: limits are stored in collection.custom (server-only) because they can be functions\n collection.admin.custom = {\n ...(collection.admin.custom || {}),\n 'plugin-import-export': {\n ...(collection.admin.custom?.['plugin-import-export'] || {}),\n disabledFields: disabledFieldAccessors,\n ...(exportFormat !== undefined && { exportFormat }),\n },\n }\n\n // Store limits in collection.custom (server-only) since they can be functions\n if (exportLimit !== undefined || importLimit !== undefined) {\n collection.custom = {\n ...(collection.custom || {}),\n 'plugin-import-export': {\n ...(collection.custom?.['plugin-import-export'] || {}),\n ...(exportLimit !== undefined && { exportLimit }),\n ...(importLimit !== undefined && { importLimit }),\n },\n }\n }\n\n collection.admin.components = components\n }\n\n if (!config.i18n) {\n config.i18n = {}\n }\n\n /**\n * Merge plugin translations\n */\n const simplifiedTranslations = Object.entries(translations).reduce(\n (acc, [key, value]) => {\n acc[key] = value.translations\n return acc\n },\n {} as Record<string, PluginDefaultTranslationsObject>,\n )\n\n config.i18n = {\n ...config.i18n,\n translations: deepMergeSimple(simplifiedTranslations, config.i18n?.translations ?? {}),\n }\n\n return config\n }\n\ndeclare module 'payload' {\n export interface FieldCustom {\n 'plugin-import-export'?: {\n /**\n * When `true` the field is **completely excluded** from the import-export plugin:\n * - It will not appear in the \"Fields to export\" selector.\n * - It is hidden from the preview list when no specific fields are chosen.\n * - Its data is omitted from the final CSV / JSON export.\n * @default false\n */\n disabled?: boolean\n fromCSV?: FromCSVFunction\n /**\n * Custom function used to modify the outgoing csv data by manipulating the data, siblingData or by returning the desired value\n */\n toCSV?: ToCSVFunction\n }\n }\n\n export interface CollectionAdminCustom {\n 'plugin-import-export'?: {\n /**\n * Array of field paths that are disabled for import/export.\n * These paths are collected from fields marked with `custom['plugin-import-export'].disabled = true`.\n */\n disabledFields?: string[]\n /**\n * When set, forces exports from this collection to use this format.\n * This value is read from the plugin config's `export.format` option.\n */\n exportFormat?: 'csv' | 'json'\n }\n }\n\n export interface CollectionCustom {\n 'plugin-import-export'?: {\n /**\n * Maximum number of documents that can be exported from this collection.\n * Set to 0 for unlimited (default). Can be a number or function.\n * Stored in collection.custom (server-only) since functions cannot be serialized to client.\n */\n exportLimit?: Limit\n /**\n * Maximum number of documents that can be imported to this collection.\n * Set to 0 for unlimited (default). Can be a number or function.\n * Stored in collection.custom (server-only) since functions cannot be serialized to client.\n */\n importLimit?: Limit\n }\n }\n}\n"],"names":["deepMergeSimple","getCreateCollectionExportTask","getCreateCollectionImportTask","translations","collectDisabledFieldPaths","getPluginCollections","importExportPlugin","pluginConfig","config","customExportSlugMap","customImportSlugMap","exportCollections","importCollections","baseExportCollection","baseImportCollection","allExportSlugs","Set","map","c","slug","allImportSlugs","collections","collection","slugExists","some","push","admin","components","providers","jobs","tasks","collectionConfigMap","Map","collectionConfig","set","collectionsToUpdate","filter","has","collectionPluginConfig","get","length","exportSlugForCollection","importSlugForCollection","exportDisabled","export","importDisabled","import","listMenuItems","clientProps","exportCollectionSlug","path","importCollectionSlug","disabledFieldAccessors","fields","exportConfig","undefined","exportFormat","format","importConfig","exportLimit","limit","importLimit","custom","disabledFields","i18n","simplifiedTranslations","Object","entries","reduce","acc","key","value"],"mappings":"AAEA,SAASA,eAAe,QAAQ,UAAS;AAWzC,SAASC,6BAA6B,QAAQ,4CAA2C;AACzF,SAASC,6BAA6B,QAAQ,4CAA2C;AACzF,SAASC,YAAY,QAAQ,0BAAyB;AACtD,SAASC,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,oBAAoB,QAAQ,sCAAqC;AAE1E,OAAO,MAAMC,qBACX,CAACC,eACD,OAAOC;QACL,mGAAmG;QACnG,MAAM,EAAEC,mBAAmB,EAAEC,mBAAmB,EAAEC,iBAAiB,EAAEC,iBAAiB,EAAE,GACtF,MAAMP,qBAAqB;YACzBG;YACAD;QACF;QAEF,mDAAmD;QACnD,MAAMM,uBAAuBF,iBAAiB,CAAC,EAAE;QACjD,MAAMG,uBAAuBF,iBAAiB,CAAC,EAAE;QAEjD,+DAA+D;QAC/D,MAAMG,iBAAiB,IAAIC,IAAIL,kBAAkBM,GAAG,CAAC,CAACC,IAAMA,EAAEC,IAAI;QAClE,MAAMC,iBAAiB,IAAIJ,IAAIJ,kBAAkBK,GAAG,CAAC,CAACC,IAAMA,EAAEC,IAAI;QAElE,yCAAyC;QACzC,IAAI,CAACX,OAAOa,WAAW,EAAE;YACvBb,OAAOa,WAAW,GAAG,EAAE;QACzB;QAEA,wEAAwE;QACxE,KAAK,MAAMC,cAAc;eAAIX;eAAsBC;SAAkB,CAAE;YACrE,MAAMW,aAAaf,OAAOa,WAAW,CAACG,IAAI,CAAC,CAACN,IAAMA,EAAEC,IAAI,KAAKG,WAAWH,IAAI;YAC5E,IAAI,CAACI,YAAY;gBACff,OAAOa,WAAW,CAACI,IAAI,CAACH;YAC1B;QACF;QAEA,uCAAuC;QACvCd,OAAOkB,KAAK,GAAGlB,OAAOkB,KAAK,IAAI,CAAC;QAChClB,OAAOkB,KAAK,CAACC,UAAU,GAAGnB,OAAOkB,KAAK,CAACC,UAAU,IAAI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8E;YAC9E,IAAIG,gBAAgBJ,aAAaM,gBAAgBN,WAAW;gBAC1DjC,WAAWwC,MAAM,GAAG;oBAClB,GAAIxC,WAAWwC,MAAM,IAAI,CAAC,CAAC;oBAC3B,wBAAwB;wBACtB,GAAIxC,WAAWwC,MAAM,EAAE,CAAC,uBAAuB,IAAI,CAAC,CAAC;wBACrD,GAAIH,gBAAgBJ,aAAa;4BAAEI;wBAAY,CAAC;wBAChD,GAAIE,gBAAgBN,aAAa;4BAAEM;wBAAY,CAAC;oBAClD;gBACF;YACF;YAEAvC,WAAWI,KAAK,CAACC,UAAU,GAAGA;QAChC;QAEA,IAAI,CAACnB,OAAOwD,IAAI,EAAE;YAChBxD,OAAOwD,IAAI,GAAG,CAAC;QACjB;QAEA;;KAEC,GACD,MAAMC,yBAAyBC,OAAOC,OAAO,CAAChE,cAAciE,MAAM,CAChE,CAACC,KAAK,CAACC,KAAKC,MAAM;YAChBF,GAAG,CAACC,IAAI,GAAGC,MAAMpE,YAAY;YAC7B,OAAOkE;QACT,GACA,CAAC;QAGH7D,OAAOwD,IAAI,GAAG;YACZ,GAAGxD,OAAOwD,IAAI;YACd7D,cAAcH,gBAAgBiE,wBAAwBzD,OAAOwD,IAAI,EAAE7D,gBAAgB,CAAC;QACtF;QAEA,OAAOK;IACT,EAAC"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { Config } from 'payload'\n\nimport { deepMergeSimple } from 'payload'\n\nimport type { PluginDefaultTranslationsObject } from './translations/types.js'\nimport type {\n FromCSVFunction,\n ImportExportPluginConfig,\n Limit,\n PluginCollectionConfig,\n ToCSVFunction,\n} from './types.js'\n\nimport { getCreateCollectionExportTask } from './export/getCreateExportCollectionTask.js'\nimport { getCreateCollectionImportTask } from './import/getCreateImportCollectionTask.js'\nimport { translations } from './translations/index.js'\nimport { collectDisabledFieldPaths } from './utilities/collectDisabledFieldPaths.js'\nimport { getPluginCollections } from './utilities/getPluginCollections.js'\n\nexport const importExportPlugin =\n (pluginConfig: ImportExportPluginConfig) =>\n async (config: Config): Promise<Config> => {\n // Get all export/import collections and the mappings from target collections to custom collections\n const { customExportSlugMap, customImportSlugMap, exportCollections, importCollections } =\n await getPluginCollections({\n config,\n pluginConfig,\n })\n\n // Base collections are at index 0 (always present)\n const baseExportCollection = exportCollections[0]!\n const baseImportCollection = importCollections[0]!\n\n // Collect all export and import collection slugs for filtering\n const allExportSlugs = new Set(exportCollections.map((c) => c.slug))\n const allImportSlugs = new Set(importCollections.map((c) => c.slug))\n\n // Initialize collections array if needed\n if (!config.collections) {\n config.collections = []\n }\n\n // Push all export/import collections if their slugs don't already exist\n for (const collection of [...exportCollections, ...importCollections]) {\n const slugExists = config.collections.some((c) => c.slug === collection.slug)\n if (!slugExists) {\n config.collections.push(collection)\n }\n }\n\n // inject custom import export provider\n config.admin = config.admin || {}\n config.admin.components = config.admin.components || {}\n config.admin.components.providers = config.admin.components.providers || []\n config.admin.components.providers.push(\n '@payloadcms/plugin-import-export/rsc#ImportExportProvider',\n )\n\n // inject the createExport and createImport jobs into the config\n ;((config.jobs ??= {}).tasks ??= []).push(getCreateCollectionExportTask(config))\n config.jobs.tasks.push(getCreateCollectionImportTask(config))\n\n // Build a map of collection configs for quick lookup\n const collectionConfigMap = new Map<string, PluginCollectionConfig>()\n if (pluginConfig.collections) {\n for (const collectionConfig of pluginConfig.collections) {\n collectionConfigMap.set(collectionConfig.slug, collectionConfig)\n }\n }\n\n // Determine which collections to add import/export menu items to\n // Exclude all export and import collections\n const collectionsToUpdate = config.collections.filter(\n (c) => !allExportSlugs.has(c.slug) && !allImportSlugs.has(c.slug),\n )\n\n for (const collection of collectionsToUpdate) {\n // Get the plugin config for this collection (if specified)\n const collectionPluginConfig = collectionConfigMap.get(collection.slug)\n\n // If collections array is specified but this collection is not in it, skip\n if (\n pluginConfig.collections &&\n pluginConfig.collections.length > 0 &&\n !collectionPluginConfig\n ) {\n continue\n }\n\n // Determine which export/import collection to use for this collection\n const exportSlugForCollection =\n customExportSlugMap.get(collection.slug) || baseExportCollection.slug\n const importSlugForCollection =\n customImportSlugMap.get(collection.slug) || baseImportCollection.slug\n\n // Check if export/import are disabled for this collection\n const exportDisabled = collectionPluginConfig?.export === false\n const importDisabled = collectionPluginConfig?.import === false\n\n if (!collection.admin) {\n collection.admin = { components: { listMenuItems: [] } }\n }\n const components = collection.admin.components || {}\n if (!components.listMenuItems) {\n components.listMenuItems = []\n }\n\n // Add export menu item if not disabled\n if (!exportDisabled) {\n components.listMenuItems.push({\n clientProps: {\n collectionSlug: collection.slug,\n exportCollectionSlug: exportSlugForCollection,\n },\n path: '@payloadcms/plugin-import-export/rsc#ExportListMenuItem',\n })\n }\n\n // Add import menu item if not disabled\n if (!importDisabled) {\n components.listMenuItems.push({\n clientProps: {\n collectionSlug: collection.slug,\n importCollectionSlug: importSlugForCollection,\n },\n path: '@payloadcms/plugin-import-export/rsc#ImportListMenuItem',\n })\n }\n\n // Find fields explicitly marked as disabled for import/export\n const disabledFieldAccessors = collectDisabledFieldPaths(collection.fields)\n\n const exportConfig =\n typeof collectionPluginConfig?.export === 'object'\n ? collectionPluginConfig.export\n : undefined\n const exportFormat = exportConfig?.format\n\n const importConfig =\n typeof collectionPluginConfig?.import === 'object'\n ? collectionPluginConfig.import\n : undefined\n\n const exportLimit = exportConfig?.limit ?? pluginConfig.exportLimit\n\n const importLimit = importConfig?.limit ?? pluginConfig.importLimit\n\n // Store disabled field accessors and export format in the admin config for use in the UI\n // Note: limits are stored in collection.custom (server-only) because they can be functions\n collection.admin.custom = {\n ...(collection.admin.custom || {}),\n 'plugin-import-export': {\n ...(collection.admin.custom?.['plugin-import-export'] || {}),\n disabledFields: disabledFieldAccessors,\n ...(exportFormat !== undefined && { exportFormat }),\n },\n }\n\n // Store limits in collection.custom (server-only) since they can be functions\n if (exportLimit !== undefined || importLimit !== undefined) {\n collection.custom = {\n ...(collection.custom || {}),\n 'plugin-import-export': {\n ...(collection.custom?.['plugin-import-export'] || {}),\n ...(exportLimit !== undefined && { exportLimit }),\n ...(importLimit !== undefined && { importLimit }),\n },\n }\n }\n\n collection.admin.components = components\n }\n\n if (!config.i18n) {\n config.i18n = {}\n }\n\n /**\n * Merge plugin translations\n */\n const simplifiedTranslations = Object.entries(translations).reduce(\n (acc, [key, value]) => {\n acc[key] = value.translations\n return acc\n },\n {} as Record<string, PluginDefaultTranslationsObject>,\n )\n\n config.i18n = {\n ...config.i18n,\n translations: deepMergeSimple(simplifiedTranslations, config.i18n?.translations ?? {}),\n }\n\n return config\n }\n\ndeclare module 'payload' {\n export interface FieldCustom {\n 'plugin-import-export'?: {\n /**\n * When `true` the field is **completely excluded** from the import-export plugin:\n * - It will not appear in the \"Fields to export\" selector.\n * - It is hidden from the preview list when no specific fields are chosen.\n * - Its data is omitted from the final CSV / JSON export.\n * @default false\n */\n disabled?: boolean\n fromCSV?: FromCSVFunction\n /**\n * Custom function used to modify the outgoing csv data by manipulating the data, siblingData or by returning the desired value\n */\n toCSV?: ToCSVFunction\n }\n }\n\n export interface CollectionAdminCustom {\n 'plugin-import-export'?: {\n /**\n * Array of collection slugs that this export/import collection can target.\n * Used by CollectionField to populate the dropdown options.\n */\n collectionSlugs?: string[]\n /**\n * Array of field paths that are disabled for import/export.\n * These paths are collected from fields marked with `custom['plugin-import-export'].disabled = true`.\n */\n disabledFields?: string[]\n /**\n * When set, forces exports from this collection to use this format.\n * This value is read from the plugin config's `export.format` option.\n */\n exportFormat?: 'csv' | 'json'\n }\n }\n\n export interface CollectionCustom {\n 'plugin-import-export'?: {\n /**\n * Maximum number of documents that can be exported from this collection.\n * Set to 0 for unlimited (default). Can be a number or function.\n * Stored in collection.custom (server-only) since functions cannot be serialized to client.\n */\n exportLimit?: Limit\n /**\n * Maximum number of documents that can be imported to this collection.\n * Set to 0 for unlimited (default). Can be a number or function.\n * Stored in collection.custom (server-only) since functions cannot be serialized to client.\n */\n importLimit?: Limit\n }\n }\n}\n"],"names":["deepMergeSimple","getCreateCollectionExportTask","getCreateCollectionImportTask","translations","collectDisabledFieldPaths","getPluginCollections","importExportPlugin","pluginConfig","config","customExportSlugMap","customImportSlugMap","exportCollections","importCollections","baseExportCollection","baseImportCollection","allExportSlugs","Set","map","c","slug","allImportSlugs","collections","collection","slugExists","some","push","admin","components","providers","jobs","tasks","collectionConfigMap","Map","collectionConfig","set","collectionsToUpdate","filter","has","collectionPluginConfig","get","length","exportSlugForCollection","importSlugForCollection","exportDisabled","export","importDisabled","import","listMenuItems","clientProps","collectionSlug","exportCollectionSlug","path","importCollectionSlug","disabledFieldAccessors","fields","exportConfig","undefined","exportFormat","format","importConfig","exportLimit","limit","importLimit","custom","disabledFields","i18n","simplifiedTranslations","Object","entries","reduce","acc","key","value"],"mappings":"AAEA,SAASA,eAAe,QAAQ,UAAS;AAWzC,SAASC,6BAA6B,QAAQ,4CAA2C;AACzF,SAASC,6BAA6B,QAAQ,4CAA2C;AACzF,SAASC,YAAY,QAAQ,0BAAyB;AACtD,SAASC,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,oBAAoB,QAAQ,sCAAqC;AAE1E,OAAO,MAAMC,qBACX,CAACC,eACD,OAAOC;QACL,mGAAmG;QACnG,MAAM,EAAEC,mBAAmB,EAAEC,mBAAmB,EAAEC,iBAAiB,EAAEC,iBAAiB,EAAE,GACtF,MAAMP,qBAAqB;YACzBG;YACAD;QACF;QAEF,mDAAmD;QACnD,MAAMM,uBAAuBF,iBAAiB,CAAC,EAAE;QACjD,MAAMG,uBAAuBF,iBAAiB,CAAC,EAAE;QAEjD,+DAA+D;QAC/D,MAAMG,iBAAiB,IAAIC,IAAIL,kBAAkBM,GAAG,CAAC,CAACC,IAAMA,EAAEC,IAAI;QAClE,MAAMC,iBAAiB,IAAIJ,IAAIJ,kBAAkBK,GAAG,CAAC,CAACC,IAAMA,EAAEC,IAAI;QAElE,yCAAyC;QACzC,IAAI,CAACX,OAAOa,WAAW,EAAE;YACvBb,OAAOa,WAAW,GAAG,EAAE;QACzB;QAEA,wEAAwE;QAC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OAAOK;IACT,EAAC"}
@@ -0,0 +1,204 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { filterToSelectedFields } from './getSchemaColumns.js';
3
+ describe('filterToSelectedFields', ()=>{
4
+ describe('fields with their own column', ()=>{
5
+ it('should include only the exact column for a date with timezones field', ()=>{
6
+ const columns = [
7
+ 'id',
8
+ 'title',
9
+ 'dateWithTimezone',
10
+ 'dateWithTimezone_tz',
11
+ 'createdAt'
12
+ ];
13
+ const result = filterToSelectedFields(columns, [
14
+ 'title'
15
+ ]);
16
+ expect(result).toEqual([
17
+ 'title'
18
+ ]);
19
+ });
20
+ it('should not include timezone companion when only date field is selected', ()=>{
21
+ const columns = [
22
+ 'id',
23
+ 'dateWithTimezone',
24
+ 'dateWithTimezone_tz',
25
+ 'createdAt'
26
+ ];
27
+ const result = filterToSelectedFields(columns, [
28
+ 'dateWithTimezone'
29
+ ]);
30
+ expect(result).toEqual([
31
+ 'dateWithTimezone'
32
+ ]);
33
+ expect(result).not.toContain('dateWithTimezone_tz');
34
+ });
35
+ it('should include both date and timezone companion when both are explicitly selected', ()=>{
36
+ const columns = [
37
+ 'id',
38
+ 'dateWithTimezone',
39
+ 'dateWithTimezone_tz',
40
+ 'createdAt'
41
+ ];
42
+ const result = filterToSelectedFields(columns, [
43
+ 'dateWithTimezone',
44
+ 'dateWithTimezone_tz'
45
+ ]);
46
+ expect(result).toEqual([
47
+ 'dateWithTimezone',
48
+ 'dateWithTimezone_tz'
49
+ ]);
50
+ });
51
+ it('should preserve user-specified ordering', ()=>{
52
+ const columns = [
53
+ 'id',
54
+ 'title',
55
+ 'email',
56
+ 'createdAt'
57
+ ];
58
+ const result = filterToSelectedFields(columns, [
59
+ 'email',
60
+ 'title',
61
+ 'id'
62
+ ]);
63
+ expect(result).toEqual([
64
+ 'email',
65
+ 'title',
66
+ 'id'
67
+ ]);
68
+ });
69
+ });
70
+ describe('fields without their own column (groups, arrays, blocks)', ()=>{
71
+ it('should expand a group to include its nested fields', ()=>{
72
+ const columns = [
73
+ 'id',
74
+ 'group_name',
75
+ 'group_age',
76
+ 'createdAt'
77
+ ];
78
+ const result = filterToSelectedFields(columns, [
79
+ 'group'
80
+ ]);
81
+ expect(result).toEqual([
82
+ 'group_name',
83
+ 'group_age'
84
+ ]);
85
+ });
86
+ it('should expand an array to include its nested fields', ()=>{
87
+ const columns = [
88
+ 'id',
89
+ 'items_0_title',
90
+ 'items_0_value',
91
+ 'createdAt'
92
+ ];
93
+ const result = filterToSelectedFields(columns, [
94
+ 'items'
95
+ ]);
96
+ expect(result).toEqual([
97
+ 'items_0_title',
98
+ 'items_0_value'
99
+ ]);
100
+ });
101
+ it('should expand blocks to include their nested fields', ()=>{
102
+ const columns = [
103
+ 'id',
104
+ 'blocks_0_hero_blockType',
105
+ 'blocks_0_hero_title',
106
+ 'createdAt'
107
+ ];
108
+ const result = filterToSelectedFields(columns, [
109
+ 'blocks'
110
+ ]);
111
+ expect(result).toEqual([
112
+ 'blocks_0_hero_blockType',
113
+ 'blocks_0_hero_title'
114
+ ]);
115
+ });
116
+ it('should expand a hasMany select to include indexed columns', ()=>{
117
+ const columns = [
118
+ 'id',
119
+ 'colors_0',
120
+ 'createdAt'
121
+ ];
122
+ const result = filterToSelectedFields(columns, [
123
+ 'colors'
124
+ ]);
125
+ expect(result).toEqual([
126
+ 'colors_0'
127
+ ]);
128
+ });
129
+ it('should expand a polymorphic relationship to include relationTo and id columns', ()=>{
130
+ const columns = [
131
+ 'id',
132
+ 'relField_relationTo',
133
+ 'relField_id',
134
+ 'createdAt'
135
+ ];
136
+ const result = filterToSelectedFields(columns, [
137
+ 'relField'
138
+ ]);
139
+ expect(result).toEqual([
140
+ 'relField_relationTo',
141
+ 'relField_id'
142
+ ]);
143
+ });
144
+ });
145
+ describe('nested field selections with dot notation', ()=>{
146
+ it('should resolve a specific nested field within a group', ()=>{
147
+ const columns = [
148
+ 'id',
149
+ 'group_name',
150
+ 'group_age',
151
+ 'createdAt'
152
+ ];
153
+ const result = filterToSelectedFields(columns, [
154
+ 'group.name'
155
+ ]);
156
+ expect(result).toEqual([
157
+ 'group_name'
158
+ ]);
159
+ expect(result).not.toContain('group_age');
160
+ });
161
+ });
162
+ describe('mixed selections', ()=>{
163
+ it('should handle groups and date fields together without sibling leakage', ()=>{
164
+ const columns = [
165
+ 'id',
166
+ 'title',
167
+ 'group_name',
168
+ 'group_age',
169
+ 'dateWithTimezone',
170
+ 'dateWithTimezone_tz',
171
+ 'createdAt'
172
+ ];
173
+ const result = filterToSelectedFields(columns, [
174
+ 'id',
175
+ 'group',
176
+ 'dateWithTimezone'
177
+ ]);
178
+ expect(result).toEqual([
179
+ 'id',
180
+ 'group_name',
181
+ 'group_age',
182
+ 'dateWithTimezone'
183
+ ]);
184
+ expect(result).not.toContain('dateWithTimezone_tz');
185
+ });
186
+ it('should not produce duplicates when a group and its nested field are both selected', ()=>{
187
+ const columns = [
188
+ 'id',
189
+ 'group_name',
190
+ 'group_age'
191
+ ];
192
+ const result = filterToSelectedFields(columns, [
193
+ 'group',
194
+ 'group.name'
195
+ ]);
196
+ const uniqueResult = [
197
+ ...new Set(result)
198
+ ];
199
+ expect(result).toEqual(uniqueResult);
200
+ });
201
+ });
202
+ });
203
+
204
+ //# sourceMappingURL=filterToSelectedFields.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utilities/filterToSelectedFields.spec.ts"],"sourcesContent":["import { describe, expect, it } from 'vitest'\n\nimport { filterToSelectedFields } from './getSchemaColumns.js'\n\ndescribe('filterToSelectedFields', () => {\n describe('fields with their own column', () => {\n it('should include only the exact column for a date with timezones field', () => {\n const columns = ['id', 'title', 'dateWithTimezone', 'dateWithTimezone_tz', 'createdAt']\n\n const result = filterToSelectedFields(columns, ['title'])\n\n expect(result).toEqual(['title'])\n })\n\n it('should not include timezone companion when only date field is selected', () => {\n const columns = ['id', 'dateWithTimezone', 'dateWithTimezone_tz', 'createdAt']\n\n const result = filterToSelectedFields(columns, ['dateWithTimezone'])\n\n expect(result).toEqual(['dateWithTimezone'])\n expect(result).not.toContain('dateWithTimezone_tz')\n })\n\n it('should include both date and timezone companion when both are explicitly selected', () => {\n const columns = ['id', 'dateWithTimezone', 'dateWithTimezone_tz', 'createdAt']\n\n const result = filterToSelectedFields(columns, ['dateWithTimezone', 'dateWithTimezone_tz'])\n\n expect(result).toEqual(['dateWithTimezone', 'dateWithTimezone_tz'])\n })\n\n it('should preserve user-specified ordering', () => {\n const columns = ['id', 'title', 'email', 'createdAt']\n\n const result = filterToSelectedFields(columns, ['email', 'title', 'id'])\n\n expect(result).toEqual(['email', 'title', 'id'])\n })\n })\n\n describe('fields without their own column (groups, arrays, blocks)', () => {\n it('should expand a group to include its nested fields', () => {\n const columns = ['id', 'group_name', 'group_age', 'createdAt']\n\n const result = filterToSelectedFields(columns, ['group'])\n\n expect(result).toEqual(['group_name', 'group_age'])\n })\n\n it('should expand an array to include its nested fields', () => {\n const columns = ['id', 'items_0_title', 'items_0_value', 'createdAt']\n\n const result = filterToSelectedFields(columns, ['items'])\n\n expect(result).toEqual(['items_0_title', 'items_0_value'])\n })\n\n it('should expand blocks to include their nested fields', () => {\n const columns = ['id', 'blocks_0_hero_blockType', 'blocks_0_hero_title', 'createdAt']\n\n const result = filterToSelectedFields(columns, ['blocks'])\n\n expect(result).toEqual(['blocks_0_hero_blockType', 'blocks_0_hero_title'])\n })\n\n it('should expand a hasMany select to include indexed columns', () => {\n const columns = ['id', 'colors_0', 'createdAt']\n\n const result = filterToSelectedFields(columns, ['colors'])\n\n expect(result).toEqual(['colors_0'])\n })\n\n it('should expand a polymorphic relationship to include relationTo and id columns', () => {\n const columns = ['id', 'relField_relationTo', 'relField_id', 'createdAt']\n\n const result = filterToSelectedFields(columns, ['relField'])\n\n expect(result).toEqual(['relField_relationTo', 'relField_id'])\n })\n })\n\n describe('nested field selections with dot notation', () => {\n it('should resolve a specific nested field within a group', () => {\n const columns = ['id', 'group_name', 'group_age', 'createdAt']\n\n const result = filterToSelectedFields(columns, ['group.name'])\n\n expect(result).toEqual(['group_name'])\n expect(result).not.toContain('group_age')\n })\n })\n\n describe('mixed selections', () => {\n it('should handle groups and date fields together without sibling leakage', () => {\n const columns = [\n 'id',\n 'title',\n 'group_name',\n 'group_age',\n 'dateWithTimezone',\n 'dateWithTimezone_tz',\n 'createdAt',\n ]\n\n const result = filterToSelectedFields(columns, ['id', 'group', 'dateWithTimezone'])\n\n expect(result).toEqual(['id', 'group_name', 'group_age', 'dateWithTimezone'])\n expect(result).not.toContain('dateWithTimezone_tz')\n })\n\n it('should not produce duplicates when a group and its nested field are both selected', () => {\n const columns = ['id', 'group_name', 'group_age']\n\n const result = filterToSelectedFields(columns, ['group', 'group.name'])\n\n const uniqueResult = [...new Set(result)]\n\n expect(result).toEqual(uniqueResult)\n })\n })\n})\n"],"names":["describe","expect","it","filterToSelectedFields","columns","result","toEqual","not","toContain","uniqueResult","Set"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,SAAQ;AAE7C,SAASC,sBAAsB,QAAQ,wBAAuB;AAE9DH,SAAS,0BAA0B;IACjCA,SAAS,gCAAgC;QACvCE,GAAG,wEAAwE;YACzE,MAAME,UAAU;gBAAC;gBAAM;gBAAS;gBAAoB;gBAAuB;aAAY;YAEvF,MAAMC,SAASF,uBAAuBC,SAAS;gBAAC;aAAQ;YAExDH,OAAOI,QAAQC,OAAO,CAAC;gBAAC;aAAQ;QAClC;QAEAJ,GAAG,0EAA0E;YAC3E,MAAME,UAAU;gBAAC;gBAAM;gBAAoB;gBAAuB;aAAY;YAE9E,MAAMC,SAASF,uBAAuBC,SAAS;gBAAC;aAAmB;YAEnEH,OAAOI,QAAQC,OAAO,CAAC;gBAAC;aAAmB;YAC3CL,OAAOI,QAAQE,GAAG,CAACC,SAAS,CAAC;QAC/B;QAEAN,GAAG,qFAAqF;YACtF,MAAME,UAAU;gBAAC;gBAAM;gBAAoB;gBAAuB;aAAY;YAE9E,MAAMC,SAASF,uB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AAC;gBAAC;gBAAuB;aAAc;QAC/D;IACF;IAEAN,SAAS,6CAA6C;QACpDE,GAAG,yDAAyD;YAC1D,MAAME,UAAU;gBAAC;gBAAM;gBAAc;gBAAa;aAAY;YAE9D,MAAMC,SAASF,uBAAuBC,SAAS;gBAAC;aAAa;YAE7DH,OAAOI,QAAQC,OAAO,CAAC;gBAAC;aAAa;YACrCL,OAAOI,QAAQE,GAAG,CAACC,SAAS,CAAC;QAC/B;IACF;IAEAR,SAAS,oBAAoB;QAC3BE,GAAG,yEAAyE;YAC1E,MAAME,UAAU;gBACd;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;aACD;YAED,MAAMC,SAASF,uBAAuBC,SAAS;gBAAC;gBAAM;gBAAS;aAAmB;YAElFH,OAAOI,QAAQC,OAAO,CAAC;gBAAC;gBAAM;gBAAc;gBAAa;aAAmB;YAC5EL,OAAOI,QAAQE,GAAG,CAACC,SAAS,CAAC;QAC/B;QAEAN,GAAG,qFAAqF;YACtF,MAAME,UAAU;gBAAC;gBAAM;gBAAc;aAAY;YAEjD,MAAMC,SAASF,uBAAuBC,SAAS;gBAAC;gBAAS;aAAa;YAEtE,MAAMK,eAAe;mBAAI,IAAIC,IAAIL;aAAQ;YAEzCJ,OAAOI,QAAQC,OAAO,CAACG;QACzB;IACF;AACF"}
@@ -4,14 +4,8 @@ type Args = {
4
4
  doc: Document;
5
5
  fields?: string[];
6
6
  prefix?: string;
7
- /**
8
- * Set of auto-generated timezone companion field names (from collectTimezoneCompanionFields).
9
- * These fields are excluded unless explicitly selected.
10
- * If not provided, no timezone filtering is applied.
11
- */
12
- timezoneCompanionFields?: Set<string>;
13
7
  toCSVFunctions: Record<string, ToCSVFunction>;
14
8
  };
15
- export declare const flattenObject: ({ doc, fields, prefix, timezoneCompanionFields, toCSVFunctions, }: Args) => Record<string, unknown>;
9
+ export declare const flattenObject: ({ doc, fields, prefix, toCSVFunctions, }: Args) => Record<string, unknown>;
16
10
  export {};
17
11
  //# sourceMappingURL=flattenObject.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"flattenObject.d.ts","sourceRoot":"","sources":["../../src/utilities/flattenObject.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAEvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAIhD,KAAK,IAAI,GAAG;IACV,GAAG,EAAE,QAAQ,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IACjB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;;;OAIG;IACH,uBAAuB,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IACrC,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAA;CAC9C,CAAA;AAED,eAAO,MAAM,aAAa,sEAMvB,IAAI,KAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAgL/B,CAAA"}
1
+ {"version":3,"file":"flattenObject.d.ts","sourceRoot":"","sources":["../../src/utilities/flattenObject.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAEvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAIhD,KAAK,IAAI,GAAG;IACV,GAAG,EAAE,QAAQ,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IACjB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAA;CAC9C,CAAA;AAED,eAAO,MAAM,aAAa,6CAKvB,IAAI,KAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAoK/B,CAAA"}