@ruya.sa/plugin-import-export 3.71.3
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.
- package/README.md +7 -0
- package/dist/components/CollectionField/index.d.ts +3 -0
- package/dist/components/CollectionField/index.d.ts.map +1 -0
- package/dist/components/CollectionField/index.js +29 -0
- package/dist/components/CollectionField/index.js.map +1 -0
- package/dist/components/ExportListMenuItem/index.d.ts +6 -0
- package/dist/components/ExportListMenuItem/index.d.ts.map +1 -0
- package/dist/components/ExportListMenuItem/index.js +44 -0
- package/dist/components/ExportListMenuItem/index.js.map +1 -0
- package/dist/components/ExportPreview/index.d.ts +4 -0
- package/dist/components/ExportPreview/index.d.ts.map +1 -0
- package/dist/components/ExportPreview/index.js +252 -0
- package/dist/components/ExportPreview/index.js.map +1 -0
- package/dist/components/ExportPreview/index.scss +36 -0
- package/dist/components/ExportSaveButton/index.d.ts +3 -0
- package/dist/components/ExportSaveButton/index.d.ts.map +1 -0
- package/dist/components/ExportSaveButton/index.js +110 -0
- package/dist/components/ExportSaveButton/index.js.map +1 -0
- package/dist/components/FieldsToExport/index.d.ts +3 -0
- package/dist/components/FieldsToExport/index.d.ts.map +1 -0
- package/dist/components/FieldsToExport/index.js +87 -0
- package/dist/components/FieldsToExport/index.js.map +1 -0
- package/dist/components/FieldsToExport/index.scss +0 -0
- package/dist/components/FieldsToExport/reduceFields.d.ts +13 -0
- package/dist/components/FieldsToExport/reduceFields.d.ts.map +1 -0
- package/dist/components/FieldsToExport/reduceFields.js +109 -0
- package/dist/components/FieldsToExport/reduceFields.js.map +1 -0
- package/dist/components/ImportCollectionField/index.d.ts +3 -0
- package/dist/components/ImportCollectionField/index.d.ts.map +1 -0
- package/dist/components/ImportCollectionField/index.js +17 -0
- package/dist/components/ImportCollectionField/index.js.map +1 -0
- package/dist/components/ImportExportProvider/index.d.ts +12 -0
- package/dist/components/ImportExportProvider/index.d.ts.map +1 -0
- package/dist/components/ImportExportProvider/index.js +20 -0
- package/dist/components/ImportExportProvider/index.js.map +1 -0
- package/dist/components/ImportListMenuItem/index.d.ts +6 -0
- package/dist/components/ImportListMenuItem/index.d.ts.map +1 -0
- package/dist/components/ImportListMenuItem/index.js +48 -0
- package/dist/components/ImportListMenuItem/index.js.map +1 -0
- package/dist/components/ImportPreview/index.d.ts +4 -0
- package/dist/components/ImportPreview/index.d.ts.map +1 -0
- package/dist/components/ImportPreview/index.js +624 -0
- package/dist/components/ImportPreview/index.js.map +1 -0
- package/dist/components/ImportPreview/index.scss +41 -0
- package/dist/components/ImportSaveButton/index.d.ts +2 -0
- package/dist/components/ImportSaveButton/index.d.ts.map +1 -0
- package/dist/components/ImportSaveButton/index.js +18 -0
- package/dist/components/ImportSaveButton/index.js.map +1 -0
- package/dist/components/Page/index.d.ts +4 -0
- package/dist/components/Page/index.d.ts.map +1 -0
- package/dist/components/Page/index.js +40 -0
- package/dist/components/Page/index.js.map +1 -0
- package/dist/components/Page/index.scss +5 -0
- package/dist/components/SelectionToUseField/index.d.ts +3 -0
- package/dist/components/SelectionToUseField/index.d.ts.map +1 -0
- package/dist/components/SelectionToUseField/index.js +128 -0
- package/dist/components/SelectionToUseField/index.js.map +1 -0
- package/dist/components/SortBy/index.d.ts +4 -0
- package/dist/components/SortBy/index.d.ts.map +1 -0
- package/dist/components/SortBy/index.js +133 -0
- package/dist/components/SortBy/index.js.map +1 -0
- package/dist/components/SortBy/index.scss +3 -0
- package/dist/components/SortOrder/index.d.ts +4 -0
- package/dist/components/SortOrder/index.d.ts.map +1 -0
- package/dist/components/SortOrder/index.js +121 -0
- package/dist/components/SortOrder/index.js.map +1 -0
- package/dist/components/SortOrder/index.scss +3 -0
- package/dist/constants.d.ts +21 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +21 -0
- package/dist/constants.js.map +1 -0
- package/dist/export/batchProcessor.d.ts +107 -0
- package/dist/export/batchProcessor.d.ts.map +1 -0
- package/dist/export/batchProcessor.js +187 -0
- package/dist/export/batchProcessor.js.map +1 -0
- package/dist/export/createExport.d.ts +37 -0
- package/dist/export/createExport.d.ts.map +1 -0
- package/dist/export/createExport.js +385 -0
- package/dist/export/createExport.js.map +1 -0
- package/dist/export/getCreateExportCollectionTask.d.ts +16 -0
- package/dist/export/getCreateExportCollectionTask.d.ts.map +1 -0
- package/dist/export/getCreateExportCollectionTask.js +35 -0
- package/dist/export/getCreateExportCollectionTask.js.map +1 -0
- package/dist/export/getExportCollection.d.ts +8 -0
- package/dist/export/getExportCollection.d.ts.map +1 -0
- package/dist/export/getExportCollection.js +100 -0
- package/dist/export/getExportCollection.js.map +1 -0
- package/dist/export/getFields.d.ts +10 -0
- package/dist/export/getFields.d.ts.map +1 -0
- package/dist/export/getFields.js +244 -0
- package/dist/export/getFields.js.map +1 -0
- package/dist/export/handleDownload.d.ts +3 -0
- package/dist/export/handleDownload.d.ts.map +1 -0
- package/dist/export/handleDownload.js +42 -0
- package/dist/export/handleDownload.js.map +1 -0
- package/dist/export/handlePreview.d.ts +3 -0
- package/dist/export/handlePreview.d.ts.map +1 -0
- package/dist/export/handlePreview.js +163 -0
- package/dist/export/handlePreview.js.map +1 -0
- package/dist/exports/rsc.d.ts +15 -0
- package/dist/exports/rsc.d.ts.map +1 -0
- package/dist/exports/rsc.js +16 -0
- package/dist/exports/rsc.js.map +1 -0
- package/dist/exports/types.d.ts +2 -0
- package/dist/exports/types.d.ts.map +1 -0
- package/dist/exports/types.js +3 -0
- package/dist/exports/types.js.map +1 -0
- package/dist/import/batchProcessor.d.ts +46 -0
- package/dist/import/batchProcessor.d.ts.map +1 -0
- package/dist/import/batchProcessor.js +529 -0
- package/dist/import/batchProcessor.js.map +1 -0
- package/dist/import/createImport.d.ts +45 -0
- package/dist/import/createImport.d.ts.map +1 -0
- package/dist/import/createImport.js +175 -0
- package/dist/import/createImport.js.map +1 -0
- package/dist/import/getCreateImportCollectionTask.d.ts +13 -0
- package/dist/import/getCreateImportCollectionTask.d.ts.map +1 -0
- package/dist/import/getCreateImportCollectionTask.js +81 -0
- package/dist/import/getCreateImportCollectionTask.js.map +1 -0
- package/dist/import/getFields.d.ts +7 -0
- package/dist/import/getFields.d.ts.map +1 -0
- package/dist/import/getFields.js +150 -0
- package/dist/import/getFields.js.map +1 -0
- package/dist/import/getImportCollection.d.ts +8 -0
- package/dist/import/getImportCollection.d.ts.map +1 -0
- package/dist/import/getImportCollection.js +258 -0
- package/dist/import/getImportCollection.js.map +1 -0
- package/dist/import/handlePreview.d.ts +3 -0
- package/dist/import/handlePreview.d.ts.map +1 -0
- package/dist/import/handlePreview.js +94 -0
- package/dist/import/handlePreview.js.map +1 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +120 -0
- package/dist/index.js.map +1 -0
- package/dist/translations/index.d.ts +6 -0
- package/dist/translations/index.d.ts.map +1 -0
- package/dist/translations/index.js +84 -0
- package/dist/translations/index.js.map +1 -0
- package/dist/translations/languages/ar.d.ts +4 -0
- package/dist/translations/languages/ar.d.ts.map +1 -0
- package/dist/translations/languages/ar.js +48 -0
- package/dist/translations/languages/ar.js.map +1 -0
- package/dist/translations/languages/az.d.ts +4 -0
- package/dist/translations/languages/az.d.ts.map +1 -0
- package/dist/translations/languages/az.js +48 -0
- package/dist/translations/languages/az.js.map +1 -0
- package/dist/translations/languages/bg.d.ts +4 -0
- package/dist/translations/languages/bg.d.ts.map +1 -0
- package/dist/translations/languages/bg.js +48 -0
- package/dist/translations/languages/bg.js.map +1 -0
- package/dist/translations/languages/bnBd.d.ts +4 -0
- package/dist/translations/languages/bnBd.d.ts.map +1 -0
- package/dist/translations/languages/bnBd.js +48 -0
- package/dist/translations/languages/bnBd.js.map +1 -0
- package/dist/translations/languages/bnIn.d.ts +4 -0
- package/dist/translations/languages/bnIn.d.ts.map +1 -0
- package/dist/translations/languages/bnIn.js +48 -0
- package/dist/translations/languages/bnIn.js.map +1 -0
- package/dist/translations/languages/ca.d.ts +4 -0
- package/dist/translations/languages/ca.d.ts.map +1 -0
- package/dist/translations/languages/ca.js +48 -0
- package/dist/translations/languages/ca.js.map +1 -0
- package/dist/translations/languages/cs.d.ts +4 -0
- package/dist/translations/languages/cs.d.ts.map +1 -0
- package/dist/translations/languages/cs.js +48 -0
- package/dist/translations/languages/cs.js.map +1 -0
- package/dist/translations/languages/da.d.ts +4 -0
- package/dist/translations/languages/da.d.ts.map +1 -0
- package/dist/translations/languages/da.js +48 -0
- package/dist/translations/languages/da.js.map +1 -0
- package/dist/translations/languages/de.d.ts +4 -0
- package/dist/translations/languages/de.d.ts.map +1 -0
- package/dist/translations/languages/de.js +48 -0
- package/dist/translations/languages/de.js.map +1 -0
- package/dist/translations/languages/en.d.ts +45 -0
- package/dist/translations/languages/en.d.ts.map +1 -0
- package/dist/translations/languages/en.js +48 -0
- package/dist/translations/languages/en.js.map +1 -0
- package/dist/translations/languages/es.d.ts +4 -0
- package/dist/translations/languages/es.d.ts.map +1 -0
- package/dist/translations/languages/es.js +48 -0
- package/dist/translations/languages/es.js.map +1 -0
- package/dist/translations/languages/et.d.ts +4 -0
- package/dist/translations/languages/et.d.ts.map +1 -0
- package/dist/translations/languages/et.js +48 -0
- package/dist/translations/languages/et.js.map +1 -0
- package/dist/translations/languages/fa.d.ts +4 -0
- package/dist/translations/languages/fa.d.ts.map +1 -0
- package/dist/translations/languages/fa.js +48 -0
- package/dist/translations/languages/fa.js.map +1 -0
- package/dist/translations/languages/fr.d.ts +4 -0
- package/dist/translations/languages/fr.d.ts.map +1 -0
- package/dist/translations/languages/fr.js +48 -0
- package/dist/translations/languages/fr.js.map +1 -0
- package/dist/translations/languages/he.d.ts +4 -0
- package/dist/translations/languages/he.d.ts.map +1 -0
- package/dist/translations/languages/he.js +48 -0
- package/dist/translations/languages/he.js.map +1 -0
- package/dist/translations/languages/hr.d.ts +4 -0
- package/dist/translations/languages/hr.d.ts.map +1 -0
- package/dist/translations/languages/hr.js +48 -0
- package/dist/translations/languages/hr.js.map +1 -0
- package/dist/translations/languages/hu.d.ts +4 -0
- package/dist/translations/languages/hu.d.ts.map +1 -0
- package/dist/translations/languages/hu.js +48 -0
- package/dist/translations/languages/hu.js.map +1 -0
- package/dist/translations/languages/hy.d.ts +4 -0
- package/dist/translations/languages/hy.d.ts.map +1 -0
- package/dist/translations/languages/hy.js +48 -0
- package/dist/translations/languages/hy.js.map +1 -0
- package/dist/translations/languages/id.d.ts +4 -0
- package/dist/translations/languages/id.d.ts.map +1 -0
- package/dist/translations/languages/id.js +48 -0
- package/dist/translations/languages/id.js.map +1 -0
- package/dist/translations/languages/is.d.ts +4 -0
- package/dist/translations/languages/is.d.ts.map +1 -0
- package/dist/translations/languages/is.js +48 -0
- package/dist/translations/languages/is.js.map +1 -0
- package/dist/translations/languages/it.d.ts +4 -0
- package/dist/translations/languages/it.d.ts.map +1 -0
- package/dist/translations/languages/it.js +48 -0
- package/dist/translations/languages/it.js.map +1 -0
- package/dist/translations/languages/ja.d.ts +4 -0
- package/dist/translations/languages/ja.d.ts.map +1 -0
- package/dist/translations/languages/ja.js +48 -0
- package/dist/translations/languages/ja.js.map +1 -0
- package/dist/translations/languages/ko.d.ts +4 -0
- package/dist/translations/languages/ko.d.ts.map +1 -0
- package/dist/translations/languages/ko.js +48 -0
- package/dist/translations/languages/ko.js.map +1 -0
- package/dist/translations/languages/lt.d.ts +4 -0
- package/dist/translations/languages/lt.d.ts.map +1 -0
- package/dist/translations/languages/lt.js +48 -0
- package/dist/translations/languages/lt.js.map +1 -0
- package/dist/translations/languages/lv.d.ts +4 -0
- package/dist/translations/languages/lv.d.ts.map +1 -0
- package/dist/translations/languages/lv.js +48 -0
- package/dist/translations/languages/lv.js.map +1 -0
- package/dist/translations/languages/my.d.ts +4 -0
- package/dist/translations/languages/my.d.ts.map +1 -0
- package/dist/translations/languages/my.js +48 -0
- package/dist/translations/languages/my.js.map +1 -0
- package/dist/translations/languages/nb.d.ts +4 -0
- package/dist/translations/languages/nb.d.ts.map +1 -0
- package/dist/translations/languages/nb.js +48 -0
- package/dist/translations/languages/nb.js.map +1 -0
- package/dist/translations/languages/nl.d.ts +4 -0
- package/dist/translations/languages/nl.d.ts.map +1 -0
- package/dist/translations/languages/nl.js +48 -0
- package/dist/translations/languages/nl.js.map +1 -0
- package/dist/translations/languages/pl.d.ts +4 -0
- package/dist/translations/languages/pl.d.ts.map +1 -0
- package/dist/translations/languages/pl.js +48 -0
- package/dist/translations/languages/pl.js.map +1 -0
- package/dist/translations/languages/pt.d.ts +4 -0
- package/dist/translations/languages/pt.d.ts.map +1 -0
- package/dist/translations/languages/pt.js +48 -0
- package/dist/translations/languages/pt.js.map +1 -0
- package/dist/translations/languages/ro.d.ts +4 -0
- package/dist/translations/languages/ro.d.ts.map +1 -0
- package/dist/translations/languages/ro.js +48 -0
- package/dist/translations/languages/ro.js.map +1 -0
- package/dist/translations/languages/rs.d.ts +4 -0
- package/dist/translations/languages/rs.d.ts.map +1 -0
- package/dist/translations/languages/rs.js +48 -0
- package/dist/translations/languages/rs.js.map +1 -0
- package/dist/translations/languages/rsLatin.d.ts +4 -0
- package/dist/translations/languages/rsLatin.d.ts.map +1 -0
- package/dist/translations/languages/rsLatin.js +48 -0
- package/dist/translations/languages/rsLatin.js.map +1 -0
- package/dist/translations/languages/ru.d.ts +4 -0
- package/dist/translations/languages/ru.d.ts.map +1 -0
- package/dist/translations/languages/ru.js +48 -0
- package/dist/translations/languages/ru.js.map +1 -0
- package/dist/translations/languages/sk.d.ts +4 -0
- package/dist/translations/languages/sk.d.ts.map +1 -0
- package/dist/translations/languages/sk.js +48 -0
- package/dist/translations/languages/sk.js.map +1 -0
- package/dist/translations/languages/sl.d.ts +4 -0
- package/dist/translations/languages/sl.d.ts.map +1 -0
- package/dist/translations/languages/sl.js +48 -0
- package/dist/translations/languages/sl.js.map +1 -0
- package/dist/translations/languages/sv.d.ts +4 -0
- package/dist/translations/languages/sv.d.ts.map +1 -0
- package/dist/translations/languages/sv.js +48 -0
- package/dist/translations/languages/sv.js.map +1 -0
- package/dist/translations/languages/ta.d.ts +4 -0
- package/dist/translations/languages/ta.d.ts.map +1 -0
- package/dist/translations/languages/ta.js +48 -0
- package/dist/translations/languages/ta.js.map +1 -0
- package/dist/translations/languages/th.d.ts +4 -0
- package/dist/translations/languages/th.d.ts.map +1 -0
- package/dist/translations/languages/th.js +48 -0
- package/dist/translations/languages/th.js.map +1 -0
- package/dist/translations/languages/tr.d.ts +4 -0
- package/dist/translations/languages/tr.d.ts.map +1 -0
- package/dist/translations/languages/tr.js +48 -0
- package/dist/translations/languages/tr.js.map +1 -0
- package/dist/translations/languages/translation-schema.json +114 -0
- package/dist/translations/languages/uk.d.ts +4 -0
- package/dist/translations/languages/uk.d.ts.map +1 -0
- package/dist/translations/languages/uk.js +48 -0
- package/dist/translations/languages/uk.js.map +1 -0
- package/dist/translations/languages/vi.d.ts +4 -0
- package/dist/translations/languages/vi.d.ts.map +1 -0
- package/dist/translations/languages/vi.js +48 -0
- package/dist/translations/languages/vi.js.map +1 -0
- package/dist/translations/languages/zh.d.ts +4 -0
- package/dist/translations/languages/zh.d.ts.map +1 -0
- package/dist/translations/languages/zh.js +48 -0
- package/dist/translations/languages/zh.js.map +1 -0
- package/dist/translations/languages/zhTw.d.ts +4 -0
- package/dist/translations/languages/zhTw.d.ts.map +1 -0
- package/dist/translations/languages/zhTw.js +48 -0
- package/dist/translations/languages/zhTw.js.map +1 -0
- package/dist/translations/types.d.ts +38 -0
- package/dist/translations/types.d.ts.map +1 -0
- package/dist/translations/types.js +3 -0
- package/dist/translations/types.js.map +1 -0
- package/dist/types.d.ts +221 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/dist/utilities/buildDisabledFieldRegex.d.ts +5 -0
- package/dist/utilities/buildDisabledFieldRegex.d.ts.map +1 -0
- package/dist/utilities/buildDisabledFieldRegex.js +12 -0
- package/dist/utilities/buildDisabledFieldRegex.js.map +1 -0
- package/dist/utilities/collectDisabledFieldPaths.d.ts +15 -0
- package/dist/utilities/collectDisabledFieldPaths.d.ts.map +1 -0
- package/dist/utilities/collectDisabledFieldPaths.js +61 -0
- package/dist/utilities/collectDisabledFieldPaths.js.map +1 -0
- package/dist/utilities/flattenObject.d.ts +11 -0
- package/dist/utilities/flattenObject.d.ts.map +1 -0
- package/dist/utilities/flattenObject.js +129 -0
- package/dist/utilities/flattenObject.js.map +1 -0
- package/dist/utilities/getExportFieldFunctions.d.ts +12 -0
- package/dist/utilities/getExportFieldFunctions.d.ts.map +1 -0
- package/dist/utilities/getExportFieldFunctions.js +102 -0
- package/dist/utilities/getExportFieldFunctions.js.map +1 -0
- package/dist/utilities/getFilename.d.ts +6 -0
- package/dist/utilities/getFilename.d.ts.map +1 -0
- package/dist/utilities/getFilename.js +13 -0
- package/dist/utilities/getFilename.js.map +1 -0
- package/dist/utilities/getFlattenedFieldKeys.d.ts +24 -0
- package/dist/utilities/getFlattenedFieldKeys.d.ts.map +1 -0
- package/dist/utilities/getFlattenedFieldKeys.js +95 -0
- package/dist/utilities/getFlattenedFieldKeys.js.map +1 -0
- package/dist/utilities/getImportFieldFunctions.d.ts +12 -0
- package/dist/utilities/getImportFieldFunctions.d.ts.map +1 -0
- package/dist/utilities/getImportFieldFunctions.js +130 -0
- package/dist/utilities/getImportFieldFunctions.js.map +1 -0
- package/dist/utilities/getPluginCollections.d.ts +39 -0
- package/dist/utilities/getPluginCollections.d.ts.map +1 -0
- package/dist/utilities/getPluginCollections.js +102 -0
- package/dist/utilities/getPluginCollections.js.map +1 -0
- package/dist/utilities/getSchemaColumns.d.ts +43 -0
- package/dist/utilities/getSchemaColumns.d.ts.map +1 -0
- package/dist/utilities/getSchemaColumns.js +163 -0
- package/dist/utilities/getSchemaColumns.js.map +1 -0
- package/dist/utilities/getSelect.d.ts +11 -0
- package/dist/utilities/getSelect.d.ts.map +1 -0
- package/dist/utilities/getSelect.js +27 -0
- package/dist/utilities/getSelect.js.map +1 -0
- package/dist/utilities/getvalueAtPath.d.ts +15 -0
- package/dist/utilities/getvalueAtPath.d.ts.map +1 -0
- package/dist/utilities/getvalueAtPath.js +49 -0
- package/dist/utilities/getvalueAtPath.js.map +1 -0
- package/dist/utilities/parseCSV.d.ts +11 -0
- package/dist/utilities/parseCSV.d.ts.map +1 -0
- package/dist/utilities/parseCSV.js +67 -0
- package/dist/utilities/parseCSV.js.map +1 -0
- package/dist/utilities/parseCSV.spec.js +169 -0
- package/dist/utilities/parseCSV.spec.js.map +1 -0
- package/dist/utilities/parseJSON.d.ts +11 -0
- package/dist/utilities/parseJSON.d.ts.map +1 -0
- package/dist/utilities/parseJSON.js +25 -0
- package/dist/utilities/parseJSON.js.map +1 -0
- package/dist/utilities/processRichTextField.d.ts +6 -0
- package/dist/utilities/processRichTextField.d.ts.map +1 -0
- package/dist/utilities/processRichTextField.js +45 -0
- package/dist/utilities/processRichTextField.js.map +1 -0
- package/dist/utilities/removeDisabledFields.d.ts +15 -0
- package/dist/utilities/removeDisabledFields.d.ts.map +1 -0
- package/dist/utilities/removeDisabledFields.js +66 -0
- package/dist/utilities/removeDisabledFields.js.map +1 -0
- package/dist/utilities/setNestedValue.d.ts +19 -0
- package/dist/utilities/setNestedValue.d.ts.map +1 -0
- package/dist/utilities/setNestedValue.js +55 -0
- package/dist/utilities/setNestedValue.js.map +1 -0
- package/dist/utilities/sortHelpers.d.ts +6 -0
- package/dist/utilities/sortHelpers.d.ts.map +1 -0
- package/dist/utilities/sortHelpers.js +14 -0
- package/dist/utilities/sortHelpers.js.map +1 -0
- package/dist/utilities/unflattenObject.d.ts +11 -0
- package/dist/utilities/unflattenObject.d.ts.map +1 -0
- package/dist/utilities/unflattenObject.js +431 -0
- package/dist/utilities/unflattenObject.js.map +1 -0
- package/dist/utilities/unflattenObject.spec.js +680 -0
- package/dist/utilities/unflattenObject.spec.js.map +1 -0
- package/dist/utilities/useBatchProcessor.d.ts +103 -0
- package/dist/utilities/useBatchProcessor.d.ts.map +1 -0
- package/dist/utilities/useBatchProcessor.js +88 -0
- package/dist/utilities/useBatchProcessor.js.map +1 -0
- package/dist/utilities/validateLimitValue.d.ts +3 -0
- package/dist/utilities/validateLimitValue.d.ts.map +1 -0
- package/dist/utilities/validateLimitValue.js +12 -0
- package/dist/utilities/validateLimitValue.js.map +1 -0
- package/license.md +22 -0
- package/package.json +90 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import type { CollectionConfig, CollectionSlug } from '@ruya.sa/payload';
|
|
2
|
+
/**
|
|
3
|
+
* Type for overriding import/export collection configurations
|
|
4
|
+
*/
|
|
5
|
+
export type CollectionOverride = ({ collection, }: {
|
|
6
|
+
collection: CollectionConfig;
|
|
7
|
+
}) => CollectionConfig | Promise<CollectionConfig>;
|
|
8
|
+
export type ExportConfig = {
|
|
9
|
+
/**
|
|
10
|
+
* Number of documents to process in each batch during export. This config is applied to both jobs and synchronous exports.
|
|
11
|
+
*
|
|
12
|
+
* @default 100
|
|
13
|
+
*/
|
|
14
|
+
batchSize?: number;
|
|
15
|
+
/**
|
|
16
|
+
* If true, disables the download button in the export preview UI
|
|
17
|
+
* @default false
|
|
18
|
+
*/
|
|
19
|
+
disableDownload?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* If true, disables the jobs queue for exports and runs them synchronously.
|
|
22
|
+
* @default false
|
|
23
|
+
*/
|
|
24
|
+
disableJobsQueue?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* If true, disables the save button in the export preview UI
|
|
27
|
+
* @default false
|
|
28
|
+
*/
|
|
29
|
+
disableSave?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Forces a specific export format (`csv` or `json`) and hides the format dropdown from the UI.
|
|
32
|
+
* When defined, this overrides the user's ability to choose a format manually.
|
|
33
|
+
* If not set, the user can choose between CSV and JSON in the export UI.
|
|
34
|
+
* @default undefined
|
|
35
|
+
*/
|
|
36
|
+
format?: 'csv' | 'json';
|
|
37
|
+
/**
|
|
38
|
+
* Override the export collection for this collection.
|
|
39
|
+
*
|
|
40
|
+
* @default true
|
|
41
|
+
*/
|
|
42
|
+
overrideCollection?: CollectionOverride;
|
|
43
|
+
};
|
|
44
|
+
export type ImportConfig = {
|
|
45
|
+
/**
|
|
46
|
+
* Number of documents to process in each batch during import. This config is applied to both jobs and synchronous imports.
|
|
47
|
+
*
|
|
48
|
+
* @default 100
|
|
49
|
+
*/
|
|
50
|
+
batchSize?: number;
|
|
51
|
+
/**
|
|
52
|
+
* Default version status for imported documents when _status field is not provided.
|
|
53
|
+
* Only applies to collections with versions enabled.
|
|
54
|
+
* @default 'published'
|
|
55
|
+
*/
|
|
56
|
+
defaultVersionStatus?: 'draft' | 'published';
|
|
57
|
+
/**
|
|
58
|
+
* If true, disables the jobs queue for imports and runs them synchronously.
|
|
59
|
+
* @default false
|
|
60
|
+
*/
|
|
61
|
+
disableJobsQueue?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Override the import collection for this collection.
|
|
64
|
+
*
|
|
65
|
+
* @default true
|
|
66
|
+
*/
|
|
67
|
+
overrideCollection?: CollectionOverride;
|
|
68
|
+
};
|
|
69
|
+
export type PluginCollectionConfig = {
|
|
70
|
+
/**
|
|
71
|
+
* Override the import collection for this collection or disable it entirely with `false`.
|
|
72
|
+
*
|
|
73
|
+
* @default true
|
|
74
|
+
*/
|
|
75
|
+
export?: boolean | ExportConfig;
|
|
76
|
+
/**
|
|
77
|
+
* Override the export collection for this collection or disable it entirely with `false`.
|
|
78
|
+
*
|
|
79
|
+
* @default true
|
|
80
|
+
*/
|
|
81
|
+
import?: boolean | ImportConfig;
|
|
82
|
+
/**
|
|
83
|
+
* Target collection's slug for import/export functionality
|
|
84
|
+
*/
|
|
85
|
+
slug: CollectionSlug;
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Configuration options for the Import/Export plugin
|
|
89
|
+
*/
|
|
90
|
+
export type ImportExportPluginConfig = {
|
|
91
|
+
/**
|
|
92
|
+
* Collections to include the Import/Export controls in.
|
|
93
|
+
* If not specified, all collections will have import/export enabled.
|
|
94
|
+
* @default undefined (all collections)
|
|
95
|
+
*/
|
|
96
|
+
collections: PluginCollectionConfig[];
|
|
97
|
+
/**
|
|
98
|
+
* Enable debug logging for troubleshooting import/export operations
|
|
99
|
+
* @default false
|
|
100
|
+
*/
|
|
101
|
+
debug?: boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Function to override the default export collection configuration.
|
|
104
|
+
* Takes the default export collection and allows you to modify and return it.
|
|
105
|
+
* Useful for adding access control, changing upload directory, etc.
|
|
106
|
+
*
|
|
107
|
+
* This can also be set at the collection level via `export` config.
|
|
108
|
+
*/
|
|
109
|
+
overrideExportCollection?: CollectionOverride;
|
|
110
|
+
/**
|
|
111
|
+
* Function to override the default import collection configuration.
|
|
112
|
+
* Takes the default import collection and allows you to modify and return it.
|
|
113
|
+
* Useful for adding access control, changing upload directory, etc.
|
|
114
|
+
*
|
|
115
|
+
* This can also be set at the collection level via `import` config.
|
|
116
|
+
*/
|
|
117
|
+
overrideImportCollection?: CollectionOverride;
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* Custom function used to modify the outgoing csv data by manipulating the data, siblingData or by returning the desired value
|
|
121
|
+
*/
|
|
122
|
+
export type ToCSVFunction = (args: {
|
|
123
|
+
/**
|
|
124
|
+
* The path of the column for the field, for arrays this includes the index (zero-based)
|
|
125
|
+
*/
|
|
126
|
+
columnName: string;
|
|
127
|
+
/**
|
|
128
|
+
* Alias for `row`, the object that accumulates CSV output.
|
|
129
|
+
* Use this to write additional fields into the exported row.
|
|
130
|
+
*/
|
|
131
|
+
data: Record<string, unknown>;
|
|
132
|
+
/**
|
|
133
|
+
* The top level document
|
|
134
|
+
*/
|
|
135
|
+
doc: Document;
|
|
136
|
+
/**
|
|
137
|
+
* The object data that can be manipulated to assign data to the CSV
|
|
138
|
+
*/
|
|
139
|
+
row: Record<string, unknown>;
|
|
140
|
+
/**
|
|
141
|
+
* The document data at the level where it belongs
|
|
142
|
+
*/
|
|
143
|
+
siblingDoc: Record<string, unknown>;
|
|
144
|
+
/**
|
|
145
|
+
* The data for the field.
|
|
146
|
+
*/
|
|
147
|
+
value: unknown;
|
|
148
|
+
}) => unknown;
|
|
149
|
+
/**
|
|
150
|
+
* Custom function used to transform incoming CSV data during import
|
|
151
|
+
*/
|
|
152
|
+
export type FromCSVFunction = (args: {
|
|
153
|
+
/**
|
|
154
|
+
* The path of the column for the field
|
|
155
|
+
*/
|
|
156
|
+
columnName: string;
|
|
157
|
+
/**
|
|
158
|
+
* The current row data being processed
|
|
159
|
+
*/
|
|
160
|
+
data: Record<string, unknown>;
|
|
161
|
+
/**
|
|
162
|
+
* The value being imported for this field
|
|
163
|
+
*/
|
|
164
|
+
value: unknown;
|
|
165
|
+
}) => unknown;
|
|
166
|
+
/**
|
|
167
|
+
* Base pagination data returned from preview endpoints
|
|
168
|
+
*/
|
|
169
|
+
export type PreviewPaginationData = {
|
|
170
|
+
/**
|
|
171
|
+
* Whether there is a next page available
|
|
172
|
+
*/
|
|
173
|
+
hasNextPage: boolean;
|
|
174
|
+
/**
|
|
175
|
+
* Whether there is a previous page available
|
|
176
|
+
*/
|
|
177
|
+
hasPrevPage: boolean;
|
|
178
|
+
/**
|
|
179
|
+
* Number of documents per page
|
|
180
|
+
*/
|
|
181
|
+
limit: number;
|
|
182
|
+
/**
|
|
183
|
+
* Current page number (1-indexed)
|
|
184
|
+
*/
|
|
185
|
+
page: number;
|
|
186
|
+
/**
|
|
187
|
+
* Total number of documents
|
|
188
|
+
*/
|
|
189
|
+
totalDocs: number;
|
|
190
|
+
/**
|
|
191
|
+
* Total number of pages
|
|
192
|
+
*/
|
|
193
|
+
totalPages: number;
|
|
194
|
+
};
|
|
195
|
+
/**
|
|
196
|
+
* Response from export preview endpoint
|
|
197
|
+
*/
|
|
198
|
+
export type ExportPreviewResponse = {
|
|
199
|
+
/**
|
|
200
|
+
* Column names for CSV format (undefined for JSON)
|
|
201
|
+
*/
|
|
202
|
+
columns?: string[];
|
|
203
|
+
/**
|
|
204
|
+
* Preview documents (transformed for display)
|
|
205
|
+
*/
|
|
206
|
+
docs: Record<string, unknown>[];
|
|
207
|
+
/**
|
|
208
|
+
* Actual count of docs that will be exported (respects export limit)
|
|
209
|
+
*/
|
|
210
|
+
exportTotalDocs: number;
|
|
211
|
+
} & PreviewPaginationData;
|
|
212
|
+
/**
|
|
213
|
+
* Response from import preview endpoint
|
|
214
|
+
*/
|
|
215
|
+
export type ImportPreviewResponse = {
|
|
216
|
+
/**
|
|
217
|
+
* Preview documents parsed from the import file
|
|
218
|
+
*/
|
|
219
|
+
docs: Record<string, unknown>[];
|
|
220
|
+
} & PreviewPaginationData;
|
|
221
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"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"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type { CollectionConfig, CollectionSlug } from '@ruya.sa/payload'\n\n/**\n * Type for overriding import/export collection configurations\n */\nexport type CollectionOverride = ({\n collection,\n}: {\n collection: CollectionConfig\n}) => CollectionConfig | Promise<CollectionConfig>\n\nexport type ExportConfig = {\n /**\n * Number of documents to process in each batch during export. This config is applied to both jobs and synchronous exports.\n *\n * @default 100\n */\n batchSize?: number\n /**\n * If true, disables the download button in the export preview UI\n * @default false\n */\n disableDownload?: boolean\n /**\n * If true, disables the jobs queue for exports and runs them synchronously.\n * @default false\n */\n disableJobsQueue?: boolean\n /**\n * If true, disables the save button in the export preview UI\n * @default false\n */\n disableSave?: boolean\n /**\n * Forces a specific export format (`csv` or `json`) and hides the format dropdown from the UI.\n * When defined, this overrides the user's ability to choose a format manually.\n * If not set, the user can choose between CSV and JSON in the export UI.\n * @default undefined\n */\n format?: 'csv' | 'json'\n /**\n * Override the export collection for this collection.\n *\n * @default true\n */\n overrideCollection?: CollectionOverride\n}\n\nexport type ImportConfig = {\n /**\n * Number of documents to process in each batch during import. This config is applied to both jobs and synchronous imports.\n *\n * @default 100\n */\n batchSize?: number\n /**\n * Default version status for imported documents when _status field is not provided.\n * Only applies to collections with versions enabled.\n * @default 'published'\n */\n defaultVersionStatus?: 'draft' | 'published'\n /**\n * If true, disables the jobs queue for imports and runs them synchronously.\n * @default false\n */\n disableJobsQueue?: boolean\n /**\n * Override the import collection for this collection.\n *\n * @default true\n */\n overrideCollection?: CollectionOverride\n}\n\nexport type PluginCollectionConfig = {\n /**\n * Override the import collection for this collection or disable it entirely with `false`.\n *\n * @default true\n */\n export?: boolean | ExportConfig\n /**\n * Override the export collection for this collection or disable it entirely with `false`.\n *\n * @default true\n */\n import?: boolean | ImportConfig\n /**\n * Target collection's slug for import/export functionality\n */\n slug: CollectionSlug\n}\n\n/**\n * Configuration options for the Import/Export plugin\n */\nexport type ImportExportPluginConfig = {\n /**\n * Collections to include the Import/Export controls in.\n * If not specified, all collections will have import/export enabled.\n * @default undefined (all collections)\n */\n collections: PluginCollectionConfig[]\n\n /**\n * Enable debug logging for troubleshooting import/export operations\n * @default false\n */\n debug?: boolean\n\n /**\n * Function to override the default export collection configuration.\n * Takes the default export collection and allows you to modify and return it.\n * Useful for adding access control, changing upload directory, etc.\n *\n * This can also be set at the collection level via `export` config.\n */\n overrideExportCollection?: CollectionOverride\n\n /**\n * Function to override the default import collection configuration.\n * Takes the default import collection and allows you to modify and return it.\n * Useful for adding access control, changing upload directory, etc.\n *\n * This can also be set at the collection level via `import` config.\n */\n overrideImportCollection?: CollectionOverride\n}\n\n/**\n * Custom function used to modify the outgoing csv data by manipulating the data, siblingData or by returning the desired value\n */\nexport type ToCSVFunction = (args: {\n /**\n * The path of the column for the field, for arrays this includes the index (zero-based)\n */\n columnName: string\n /**\n * Alias for `row`, the object that accumulates CSV output.\n * Use this to write additional fields into the exported row.\n */\n data: Record<string, unknown>\n /**\n * The top level document\n */\n doc: Document\n /**\n * The object data that can be manipulated to assign data to the CSV\n */\n row: Record<string, unknown>\n /**\n * The document data at the level where it belongs\n */\n siblingDoc: Record<string, unknown>\n /**\n * The data for the field.\n */\n value: unknown\n}) => unknown\n\n/**\n * Custom function used to transform incoming CSV data during import\n */\nexport type FromCSVFunction = (args: {\n /**\n * The path of the column for the field\n */\n columnName: string\n /**\n * The current row data being processed\n */\n data: Record<string, unknown>\n /**\n * The value being imported for this field\n */\n value: unknown\n}) => unknown\n\n/**\n * Base pagination data returned from preview endpoints\n */\nexport type PreviewPaginationData = {\n /**\n * Whether there is a next page available\n */\n hasNextPage: boolean\n /**\n * Whether there is a previous page available\n */\n hasPrevPage: boolean\n /**\n * Number of documents per page\n */\n limit: number\n /**\n * Current page number (1-indexed)\n */\n page: number\n /**\n * Total number of documents\n */\n totalDocs: number\n /**\n * Total number of pages\n */\n totalPages: number\n}\n\n/**\n * Response from export preview endpoint\n */\nexport type ExportPreviewResponse = {\n /**\n * Column names for CSV format (undefined for JSON)\n */\n columns?: string[]\n /**\n * Preview documents (transformed for display)\n */\n docs: Record<string, unknown>[]\n /**\n * Actual count of docs that will be exported (respects export limit)\n */\n exportTotalDocs: number\n} & PreviewPaginationData\n\n/**\n * Response from import preview endpoint\n */\nexport type ImportPreviewResponse = {\n /**\n * Preview documents parsed from the import file\n */\n docs: Record<string, unknown>[]\n} & PreviewPaginationData\n"],"names":[],"mappings":"AAkOA;;CAEC,GACD,WAKyB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildDisabledFieldRegex.d.ts","sourceRoot":"","sources":["../../src/utilities/buildDisabledFieldRegex.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,uBAAuB,SAAU,MAAM,KAAG,MAStD,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builds a RegExp that matches flattened field keys from a given dot-notated path.
|
|
3
|
+
*/ export const buildDisabledFieldRegex = (path)=>{
|
|
4
|
+
const parts = path.split('.');
|
|
5
|
+
const patternParts = parts.map((part)=>{
|
|
6
|
+
return `${part}(?:_\\d+)?(?:_[^_]+)?`;
|
|
7
|
+
});
|
|
8
|
+
const pattern = `^${patternParts.join('_')}(?:_.*)?$`;
|
|
9
|
+
return new RegExp(pattern);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=buildDisabledFieldRegex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utilities/buildDisabledFieldRegex.ts"],"sourcesContent":["/**\n * Builds a RegExp that matches flattened field keys from a given dot-notated path.\n */\nexport const buildDisabledFieldRegex = (path: string): RegExp => {\n const parts = path.split('.')\n\n const patternParts = parts.map((part) => {\n return `${part}(?:_\\\\d+)?(?:_[^_]+)?`\n })\n\n const pattern = `^${patternParts.join('_')}(?:_.*)?$`\n return new RegExp(pattern)\n}\n"],"names":["buildDisabledFieldRegex","path","parts","split","patternParts","map","part","pattern","join","RegExp"],"mappings":"AAAA;;CAEC,GACD,OAAO,MAAMA,0BAA0B,CAACC;IACtC,MAAMC,QAAQD,KAAKE,KAAK,CAAC;IAEzB,MAAMC,eAAeF,MAAMG,GAAG,CAAC,CAACC;QAC9B,OAAO,GAAGA,KAAK,qBAAqB,CAAC;IACvC;IAEA,MAAMC,UAAU,CAAC,CAAC,EAAEH,aAAaI,IAAI,CAAC,KAAK,SAAS,CAAC;IACrD,OAAO,IAAIC,OAAOF;AACpB,EAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Field } from '@ruya.sa/payload';
|
|
2
|
+
/**
|
|
3
|
+
* Recursively traverses a Payload field schema to collect all field paths
|
|
4
|
+
* that are explicitly disabled for the import/export plugin via:
|
|
5
|
+
* field.custom['plugin-import-export'].disabled
|
|
6
|
+
*
|
|
7
|
+
* Handles nested fields including named tabs, groups, arrays, blocks, etc.
|
|
8
|
+
* Tracks each field’s path by storing it in `ref.path` and manually propagating
|
|
9
|
+
* it through named tab layers via a temporary `__manualRef` marker.
|
|
10
|
+
*
|
|
11
|
+
* @param fields - The top-level array of Payload field definitions
|
|
12
|
+
* @returns An array of dot-notated field paths that are marked as disabled
|
|
13
|
+
*/
|
|
14
|
+
export declare const collectDisabledFieldPaths: (fields: Field[]) => string[];
|
|
15
|
+
//# sourceMappingURL=collectDisabledFieldPaths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collectDisabledFieldPaths.d.ts","sourceRoot":"","sources":["../../src/utilities/collectDisabledFieldPaths.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAK7C;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,yBAAyB,WAAY,KAAK,EAAE,KAAG,MAAM,EAgEjE,CAAA"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { traverseFields } from '@ruya.sa/payload';
|
|
2
|
+
import { fieldAffectsData } from '@ruya.sa/payload/shared';
|
|
3
|
+
/**
|
|
4
|
+
* Recursively traverses a Payload field schema to collect all field paths
|
|
5
|
+
* that are explicitly disabled for the import/export plugin via:
|
|
6
|
+
* field.custom['plugin-import-export'].disabled
|
|
7
|
+
*
|
|
8
|
+
* Handles nested fields including named tabs, groups, arrays, blocks, etc.
|
|
9
|
+
* Tracks each field’s path by storing it in `ref.path` and manually propagating
|
|
10
|
+
* it through named tab layers via a temporary `__manualRef` marker.
|
|
11
|
+
*
|
|
12
|
+
* @param fields - The top-level array of Payload field definitions
|
|
13
|
+
* @returns An array of dot-notated field paths that are marked as disabled
|
|
14
|
+
*/ export const collectDisabledFieldPaths = (fields)=>{
|
|
15
|
+
const disabledPaths = [];
|
|
16
|
+
traverseFields({
|
|
17
|
+
callback: ({ field, next, parentRef, ref })=>{
|
|
18
|
+
// Handle named tabs
|
|
19
|
+
if (field.type === 'tabs' && Array.isArray(field.tabs)) {
|
|
20
|
+
for (const tab of field.tabs){
|
|
21
|
+
if ('name' in tab && typeof tab.name === 'string') {
|
|
22
|
+
// Build the path prefix for this tab
|
|
23
|
+
const parentPath = parentRef && typeof parentRef.path === 'string' ? parentRef.path : '';
|
|
24
|
+
const tabPath = parentPath ? `${parentPath}.${tab.name}` : tab.name;
|
|
25
|
+
// Prepare a ref for this named tab's children to inherit the path
|
|
26
|
+
const refObj = ref;
|
|
27
|
+
const tabRef = refObj[tab.name] ?? {};
|
|
28
|
+
tabRef.path = tabPath;
|
|
29
|
+
tabRef.__manualRef = true; // flag this as a manually constructed parentRef
|
|
30
|
+
refObj[tab.name] = tabRef;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
// Skip further processing of the tab container itself
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
// Skip unnamed fields (e.g. rows/collapsibles)
|
|
37
|
+
if (!('name' in field) || typeof field.name !== 'string') {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
// Determine the path to the current field
|
|
41
|
+
let parentPath;
|
|
42
|
+
if (parentRef && typeof parentRef === 'object' && 'path' in parentRef && typeof parentRef.path === 'string') {
|
|
43
|
+
parentPath = parentRef.path;
|
|
44
|
+
} else if (ref?.__manualRef && typeof ref?.path === 'string') {
|
|
45
|
+
// Fallback: if current ref is a manual tabRef, use its path
|
|
46
|
+
parentPath = ref.path;
|
|
47
|
+
}
|
|
48
|
+
const fullPath = parentPath ? `${parentPath}.${field.name}` : field.name;
|
|
49
|
+
ref.path = fullPath;
|
|
50
|
+
// If field is a data-affecting field and disabled via plugin config, collect its path
|
|
51
|
+
if (fieldAffectsData(field) && field.custom?.['plugin-import-export']?.disabled) {
|
|
52
|
+
disabledPaths.push(fullPath);
|
|
53
|
+
return next?.();
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
fields
|
|
57
|
+
});
|
|
58
|
+
return disabledPaths;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
//# sourceMappingURL=collectDisabledFieldPaths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utilities/collectDisabledFieldPaths.ts"],"sourcesContent":["import type { Field } from '@ruya.sa/payload'\n\nimport { traverseFields } from '@ruya.sa/payload'\nimport { fieldAffectsData } from '@ruya.sa/payload/shared'\n\n/**\n * Recursively traverses a Payload field schema to collect all field paths\n * that are explicitly disabled for the import/export plugin via:\n * field.custom['plugin-import-export'].disabled\n *\n * Handles nested fields including named tabs, groups, arrays, blocks, etc.\n * Tracks each field’s path by storing it in `ref.path` and manually propagating\n * it through named tab layers via a temporary `__manualRef` marker.\n *\n * @param fields - The top-level array of Payload field definitions\n * @returns An array of dot-notated field paths that are marked as disabled\n */\nexport const collectDisabledFieldPaths = (fields: Field[]): string[] => {\n const disabledPaths: string[] = []\n\n traverseFields({\n callback: ({ field, next, parentRef, ref }) => {\n // Handle named tabs\n if (field.type === 'tabs' && Array.isArray(field.tabs)) {\n for (const tab of field.tabs) {\n if ('name' in tab && typeof tab.name === 'string') {\n // Build the path prefix for this tab\n const parentPath =\n parentRef && typeof (parentRef as { path?: unknown }).path === 'string'\n ? (parentRef as { path: string }).path\n : ''\n const tabPath = parentPath ? `${parentPath}.${tab.name}` : tab.name\n\n // Prepare a ref for this named tab's children to inherit the path\n const refObj = ref as Record<string, any>\n const tabRef = refObj[tab.name] ?? {}\n tabRef.path = tabPath\n tabRef.__manualRef = true // flag this as a manually constructed parentRef\n refObj[tab.name] = tabRef\n }\n }\n\n // Skip further processing of the tab container itself\n return\n }\n\n // Skip unnamed fields (e.g. rows/collapsibles)\n if (!('name' in field) || typeof field.name !== 'string') {\n return\n }\n\n // Determine the path to the current field\n let parentPath: string | undefined\n\n if (\n parentRef &&\n typeof parentRef === 'object' &&\n 'path' in parentRef &&\n typeof (parentRef as { path?: unknown }).path === 'string'\n ) {\n parentPath = (parentRef as { path: string }).path\n } else if ((ref as any)?.__manualRef && typeof (ref as any)?.path === 'string') {\n // Fallback: if current ref is a manual tabRef, use its path\n parentPath = (ref as any).path\n }\n\n const fullPath = parentPath ? `${parentPath}.${field.name}` : field.name\n\n // Store current path for any nested children to use\n ;(ref as any).path = fullPath\n\n // If field is a data-affecting field and disabled via plugin config, collect its path\n if (fieldAffectsData(field) && field.custom?.['plugin-import-export']?.disabled) {\n disabledPaths.push(fullPath)\n return next?.()\n }\n },\n fields,\n })\n\n return disabledPaths\n}\n"],"names":["traverseFields","fieldAffectsData","collectDisabledFieldPaths","fields","disabledPaths","callback","field","next","parentRef","ref","type","Array","isArray","tabs","tab","name","parentPath","path","tabPath","refObj","tabRef","__manualRef","fullPath","custom","disabled","push"],"mappings":"AAEA,SAASA,cAAc,QAAQ,mBAAkB;AACjD,SAASC,gBAAgB,QAAQ,0BAAyB;AAE1D;;;;;;;;;;;CAWC,GACD,OAAO,MAAMC,4BAA4B,CAACC;IACxC,MAAMC,gBAA0B,EAAE;IAElCJ,eAAe;QACbK,UAAU,CAAC,EAAEC,KAAK,EAAEC,IAAI,EAAEC,SAAS,EAAEC,GAAG,EAAE;YACxC,oBAAoB;YACpB,IAAIH,MAAMI,IAAI,KAAK,UAAUC,MAAMC,OAAO,CAACN,MAAMO,IAAI,GAAG;gBACtD,KAAK,MAAMC,OAAOR,MAAMO,IAAI,CAAE;oBAC5B,IAAI,UAAUC,OAAO,OAAOA,IAAIC,IAAI,KAAK,UAAU;wBACjD,qCAAqC;wBACrC,MAAMC,aACJR,aAAa,OAAO,AAACA,UAAiCS,IAAI,KAAK,WAC3D,AAACT,UAA+BS,IAAI,GACpC;wBACN,MAAMC,UAAUF,aAAa,GAAGA,WAAW,CAAC,EAAEF,IAAIC,IAAI,EAAE,GAAGD,IAAIC,IAAI;wBAEnE,kEAAkE;wBAClE,MAAMI,SAASV;wBACf,MAAMW,SAASD,MAAM,CAACL,IAAIC,IAAI,CAAC,IAAI,CAAC;wBACpCK,OAAOH,IAAI,GAAGC;wBACdE,OAAOC,WAAW,GAAG,MAAK,gDAAgD;wBAC1EF,MAAM,CAACL,IAAIC,IAAI,CAAC,GAAGK;oBACrB;gBACF;gBAEA,sDAAsD;gBACtD;YACF;YAEA,+CAA+C;YAC/C,IAAI,CAAE,CAAA,UAAUd,KAAI,KAAM,OAAOA,MAAMS,IAAI,KAAK,UAAU;gBACxD;YACF;YAEA,0CAA0C;YAC1C,IAAIC;YAEJ,IACER,aACA,OAAOA,cAAc,YACrB,UAAUA,aACV,OAAO,AAACA,UAAiCS,IAAI,KAAK,UAClD;gBACAD,aAAa,AAACR,UAA+BS,IAAI;YACnD,OAAO,IAAI,AAACR,KAAaY,eAAe,OAAQZ,KAAaQ,SAAS,UAAU;gBAC9E,4DAA4D;gBAC5DD,aAAa,AAACP,IAAYQ,IAAI;YAChC;YAEA,MAAMK,WAAWN,aAAa,GAAGA,WAAW,CAAC,EAAEV,MAAMS,IAAI,EAAE,GAAGT,MAAMS,IAAI;YAGtEN,IAAYQ,IAAI,GAAGK;YAErB,sFAAsF;YACtF,IAAIrB,iBAAiBK,UAAUA,MAAMiB,MAAM,EAAE,CAAC,uBAAuB,EAAEC,UAAU;gBAC/EpB,cAAcqB,IAAI,CAACH;gBACnB,OAAOf;YACT;QACF;QACAJ;IACF;IAEA,OAAOC;AACT,EAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Document } from '@ruya.sa/payload';
|
|
2
|
+
import type { ToCSVFunction } from '../types.js';
|
|
3
|
+
type Args = {
|
|
4
|
+
doc: Document;
|
|
5
|
+
fields?: string[];
|
|
6
|
+
prefix?: string;
|
|
7
|
+
toCSVFunctions: Record<string, ToCSVFunction>;
|
|
8
|
+
};
|
|
9
|
+
export declare const flattenObject: ({ doc, fields, prefix, toCSVFunctions, }: Args) => Record<string, unknown>;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=flattenObject.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flattenObject.d.ts","sourceRoot":"","sources":["../../src/utilities/flattenObject.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAEhD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAEhD,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,CA6J/B,CAAA"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
export const flattenObject = ({ doc, fields, prefix, toCSVFunctions })=>{
|
|
2
|
+
const row = {};
|
|
3
|
+
// Helper to get toCSV function by full path or base field name
|
|
4
|
+
// This allows functions registered for field names (e.g., 'richText') to work
|
|
5
|
+
// even when the field is nested in arrays/blocks (e.g., 'blocks_0_content_richText')
|
|
6
|
+
const getToCSVFunction = (fullPath, baseFieldName)=>{
|
|
7
|
+
return toCSVFunctions?.[fullPath] ?? toCSVFunctions?.[baseFieldName];
|
|
8
|
+
};
|
|
9
|
+
const flatten = (siblingDoc, prefix)=>{
|
|
10
|
+
Object.entries(siblingDoc).forEach(([key, value])=>{
|
|
11
|
+
const newKey = prefix ? `${prefix}_${key}` : key;
|
|
12
|
+
const toCSVFn = getToCSVFunction(newKey, key);
|
|
13
|
+
if (Array.isArray(value)) {
|
|
14
|
+
// If a custom toCSV function exists for this array field, run it first.
|
|
15
|
+
// If it produces output, skip per-item handling; otherwise, fall back.
|
|
16
|
+
if (toCSVFn) {
|
|
17
|
+
try {
|
|
18
|
+
const result = toCSVFn({
|
|
19
|
+
columnName: newKey,
|
|
20
|
+
data: row,
|
|
21
|
+
doc,
|
|
22
|
+
row,
|
|
23
|
+
siblingDoc,
|
|
24
|
+
value
|
|
25
|
+
});
|
|
26
|
+
if (typeof result !== 'undefined') {
|
|
27
|
+
// Custom function returned a single value for this array field.
|
|
28
|
+
row[newKey] = result;
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
// If the custom function wrote any keys for this field, consider it handled.
|
|
32
|
+
for(const k in row){
|
|
33
|
+
if (k === newKey || k.startsWith(`${newKey}_`)) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
// Otherwise, fall through to per-item handling.
|
|
38
|
+
} catch (error) {
|
|
39
|
+
throw new Error(`Error in toCSVFunction for array "${newKey}": ${JSON.stringify(value)}\n${error.message}`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
value.forEach((item, index)=>{
|
|
43
|
+
if (typeof item === 'object' && item !== null) {
|
|
44
|
+
const blockType = typeof item.blockType === 'string' ? item.blockType : undefined;
|
|
45
|
+
const itemPrefix = blockType ? `${newKey}_${index}_${blockType}` : `${newKey}_${index}`;
|
|
46
|
+
// Case: hasMany polymorphic relationships
|
|
47
|
+
if ('relationTo' in item && 'value' in item && typeof item.value === 'object' && item.value !== null) {
|
|
48
|
+
row[`${itemPrefix}_relationTo`] = item.relationTo;
|
|
49
|
+
row[`${itemPrefix}_id`] = item.value.id;
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
// Fallback: deep-flatten nested objects
|
|
53
|
+
flatten(item, itemPrefix);
|
|
54
|
+
} else {
|
|
55
|
+
// Primitive array item.
|
|
56
|
+
row[`${newKey}_${index}`] = item;
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
} else if (typeof value === 'object' && value !== null) {
|
|
60
|
+
// Object field: use custom toCSV if present, else recurse.
|
|
61
|
+
if (!toCSVFn) {
|
|
62
|
+
flatten(value, newKey);
|
|
63
|
+
} else {
|
|
64
|
+
try {
|
|
65
|
+
const result = toCSVFn({
|
|
66
|
+
columnName: newKey,
|
|
67
|
+
data: row,
|
|
68
|
+
doc,
|
|
69
|
+
row,
|
|
70
|
+
siblingDoc,
|
|
71
|
+
value
|
|
72
|
+
});
|
|
73
|
+
if (typeof result !== 'undefined') {
|
|
74
|
+
row[newKey] = result;
|
|
75
|
+
}
|
|
76
|
+
} catch (error) {
|
|
77
|
+
throw new Error(`Error in toCSVFunction for nested object "${newKey}": ${JSON.stringify(value)}\n${error.message}`);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
} else {
|
|
81
|
+
if (toCSVFn) {
|
|
82
|
+
try {
|
|
83
|
+
const result = toCSVFn({
|
|
84
|
+
columnName: newKey,
|
|
85
|
+
data: row,
|
|
86
|
+
doc,
|
|
87
|
+
row,
|
|
88
|
+
siblingDoc,
|
|
89
|
+
value
|
|
90
|
+
});
|
|
91
|
+
if (typeof result !== 'undefined') {
|
|
92
|
+
row[newKey] = result;
|
|
93
|
+
}
|
|
94
|
+
} catch (error) {
|
|
95
|
+
throw new Error(`Error in toCSVFunction for field "${newKey}": ${JSON.stringify(value)}\n${error.message}`);
|
|
96
|
+
}
|
|
97
|
+
} else {
|
|
98
|
+
row[newKey] = value;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
flatten(doc, prefix);
|
|
104
|
+
if (Array.isArray(fields) && fields.length > 0) {
|
|
105
|
+
const orderedResult = {};
|
|
106
|
+
const fieldToRegex = (field)=>{
|
|
107
|
+
const parts = field.split('.').map((part)=>`${part}(?:_\\d+)?`);
|
|
108
|
+
const pattern = `^${parts.join('_')}`;
|
|
109
|
+
return new RegExp(pattern);
|
|
110
|
+
};
|
|
111
|
+
fields.forEach((field)=>{
|
|
112
|
+
if (row[field.replace(/\./g, '_')]) {
|
|
113
|
+
const sanitizedField = field.replace(/\./g, '_');
|
|
114
|
+
orderedResult[sanitizedField] = row[sanitizedField];
|
|
115
|
+
} else {
|
|
116
|
+
const regex = fieldToRegex(field);
|
|
117
|
+
Object.keys(row).forEach((key)=>{
|
|
118
|
+
if (regex.test(key)) {
|
|
119
|
+
orderedResult[key] = row[key];
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
return orderedResult;
|
|
125
|
+
}
|
|
126
|
+
return row;
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
//# sourceMappingURL=flattenObject.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utilities/flattenObject.ts"],"sourcesContent":["import type { Document } from '@ruya.sa/payload'\n\nimport type { ToCSVFunction } from '../types.js'\n\ntype Args = {\n doc: Document\n fields?: string[]\n prefix?: string\n toCSVFunctions: Record<string, ToCSVFunction>\n}\n\nexport const flattenObject = ({\n doc,\n fields,\n prefix,\n toCSVFunctions,\n}: Args): Record<string, unknown> => {\n const row: Record<string, unknown> = {}\n\n // Helper to get toCSV function by full path or base field name\n // This allows functions registered for field names (e.g., 'richText') to work\n // even when the field is nested in arrays/blocks (e.g., 'blocks_0_content_richText')\n const getToCSVFunction = (fullPath: string, baseFieldName: string): ToCSVFunction | undefined => {\n return toCSVFunctions?.[fullPath] ?? toCSVFunctions?.[baseFieldName]\n }\n\n const flatten = (siblingDoc: Document, prefix?: string) => {\n Object.entries(siblingDoc).forEach(([key, value]) => {\n const newKey = prefix ? `${prefix}_${key}` : key\n const toCSVFn = getToCSVFunction(newKey, key)\n\n if (Array.isArray(value)) {\n // If a custom toCSV function exists for this array field, run it first.\n // If it produces output, skip per-item handling; otherwise, fall back.\n if (toCSVFn) {\n try {\n const result = toCSVFn({\n columnName: newKey,\n data: row,\n doc,\n row,\n siblingDoc,\n value, // whole array\n })\n\n if (typeof result !== 'undefined') {\n // Custom function returned a single value for this array field.\n row[newKey] = result\n return\n }\n\n // If the custom function wrote any keys for this field, consider it handled.\n for (const k in row) {\n if (k === newKey || k.startsWith(`${newKey}_`)) {\n return\n }\n }\n // Otherwise, fall through to per-item handling.\n } catch (error) {\n throw new Error(\n `Error in toCSVFunction for array \"${newKey}\": ${JSON.stringify(value)}\\n${\n (error as Error).message\n }`,\n )\n }\n }\n\n value.forEach((item, index) => {\n if (typeof item === 'object' && item !== null) {\n const blockType = typeof item.blockType === 'string' ? item.blockType : undefined\n const itemPrefix = blockType ? `${newKey}_${index}_${blockType}` : `${newKey}_${index}`\n\n // Case: hasMany polymorphic relationships\n if (\n 'relationTo' in item &&\n 'value' in item &&\n typeof item.value === 'object' &&\n item.value !== null\n ) {\n row[`${itemPrefix}_relationTo`] = item.relationTo\n row[`${itemPrefix}_id`] = item.value.id\n return\n }\n\n // Fallback: deep-flatten nested objects\n flatten(item, itemPrefix)\n } else {\n // Primitive array item.\n row[`${newKey}_${index}`] = item\n }\n })\n } else if (typeof value === 'object' && value !== null) {\n // Object field: use custom toCSV if present, else recurse.\n if (!toCSVFn) {\n flatten(value, newKey)\n } else {\n try {\n const result = toCSVFn({\n columnName: newKey,\n data: row,\n doc,\n row,\n siblingDoc,\n value,\n })\n if (typeof result !== 'undefined') {\n row[newKey] = result\n }\n } catch (error) {\n throw new Error(\n `Error in toCSVFunction for nested object \"${newKey}\": ${JSON.stringify(value)}\\n${\n (error as Error).message\n }`,\n )\n }\n }\n } else {\n if (toCSVFn) {\n try {\n const result = toCSVFn({\n columnName: newKey,\n data: row,\n doc,\n row,\n siblingDoc,\n value,\n })\n if (typeof result !== 'undefined') {\n row[newKey] = result\n }\n } catch (error) {\n throw new Error(\n `Error in toCSVFunction for field \"${newKey}\": ${JSON.stringify(value)}\\n${\n (error as Error).message\n }`,\n )\n }\n } else {\n row[newKey] = value\n }\n }\n })\n }\n\n flatten(doc, prefix)\n\n if (Array.isArray(fields) && fields.length > 0) {\n const orderedResult: Record<string, unknown> = {}\n\n const fieldToRegex = (field: string): RegExp => {\n const parts = field.split('.').map((part) => `${part}(?:_\\\\d+)?`)\n const pattern = `^${parts.join('_')}`\n return new RegExp(pattern)\n }\n\n fields.forEach((field) => {\n if (row[field.replace(/\\./g, '_')]) {\n const sanitizedField = field.replace(/\\./g, '_')\n orderedResult[sanitizedField] = row[sanitizedField]\n } else {\n const regex = fieldToRegex(field)\n Object.keys(row).forEach((key) => {\n if (regex.test(key)) {\n orderedResult[key] = row[key]\n }\n })\n }\n })\n\n return orderedResult\n }\n\n return row\n}\n"],"names":["flattenObject","doc","fields","prefix","toCSVFunctions","row","getToCSVFunction","fullPath","baseFieldName","flatten","siblingDoc","Object","entries","forEach","key","value","newKey","toCSVFn","Array","isArray","result","columnName","data","k","startsWith","error","Error","JSON","stringify","message","item","index","blockType","undefined","itemPrefix","relationTo","id","length","orderedResult","fieldToRegex","field","parts","split","map","part","pattern","join","RegExp","replace","sanitizedField","regex","keys","test"],"mappings":"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"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type FlattenedField } from '@ruya.sa/payload';
|
|
2
|
+
import type { ToCSVFunction } from '../types.js';
|
|
3
|
+
type Args = {
|
|
4
|
+
fields: FlattenedField[];
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Gets custom toCSV field functions for export.
|
|
8
|
+
* These functions transform field values when flattening documents for CSV export.
|
|
9
|
+
*/
|
|
10
|
+
export declare const getExportFieldFunctions: ({ fields }: Args) => Record<string, ToCSVFunction>;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=getExportFieldFunctions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getExportFieldFunctions.d.ts","sourceRoot":"","sources":["../../src/utilities/getExportFieldFunctions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAA+C,MAAM,kBAAkB,CAAA;AAEnG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAEhD,KAAK,IAAI,GAAG;IACV,MAAM,EAAE,cAAc,EAAE,CAAA;CACzB,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,uBAAuB,eAAgB,IAAI,KAAG,MAAM,CAAC,MAAM,EAAE,aAAa,CA6GtF,CAAA"}
|