@rebasepro/admin 0.16.0 → 0.16.1-canary.g2d1aec8

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 (167) hide show
  1. package/dist/{CollectionEditorDialog-D2Vf4C3-.js → CollectionEditorDialog-Cec5jU6R.js} +7 -3
  2. package/dist/{CollectionEditorDialog-D2Vf4C3-.js.map → CollectionEditorDialog-Cec5jU6R.js.map} +1 -1
  3. package/dist/{PropertyEditView-D3NBsK9_.js → PropertyEditView-BuSPZwnQ.js} +2 -2
  4. package/dist/{PropertyEditView-D3NBsK9_.js.map → PropertyEditView-BuSPZwnQ.js.map} +1 -1
  5. package/dist/{RouterCollectionsStudioView-hPB54l3Q.js → RouterCollectionsStudioView-BiNFpEii.js} +4 -4
  6. package/dist/{RouterCollectionsStudioView-hPB54l3Q.js.map → RouterCollectionsStudioView-BiNFpEii.js.map} +1 -1
  7. package/dist/SchemaChangeDialog-WKIbzS6P.js +327 -0
  8. package/dist/SchemaChangeDialog-WKIbzS6P.js.map +1 -0
  9. package/dist/collection_editor/ConfigControllerProvider.d.ts +4 -4
  10. package/dist/collection_editor/_cms_internals.d.ts +23 -23
  11. package/dist/collection_editor/api/index.d.ts +1 -1
  12. package/dist/collection_editor/extensibility_types.d.ts +1 -1
  13. package/dist/collection_editor/index.d.ts +21 -21
  14. package/dist/collection_editor/liveSchemaClient.d.ts +170 -0
  15. package/dist/collection_editor/serializable_utils.d.ts +1 -1
  16. package/dist/collection_editor/types/collection_editor_controller.d.ts +1 -1
  17. package/dist/collection_editor/types/config_controller.d.ts +11 -0
  18. package/dist/collection_editor/ui/collection_editor/AICollectionGeneratorPopover.d.ts +1 -1
  19. package/dist/collection_editor/ui/collection_editor/AIModifiedPathsContext.d.ts +1 -1
  20. package/dist/collection_editor/ui/collection_editor/CollectionEditorDialog.d.ts +4 -4
  21. package/dist/collection_editor/ui/collection_editor/CollectionEditorWelcomeView.d.ts +1 -1
  22. package/dist/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.d.ts +2 -2
  23. package/dist/collection_editor/ui/collection_editor/CollectionStudioView.d.ts +1 -1
  24. package/dist/collection_editor/ui/collection_editor/CollectionsStudioView.d.ts +2 -2
  25. package/dist/collection_editor/ui/collection_editor/GeneralSettingsForm.d.ts +1 -1
  26. package/dist/collection_editor/ui/collection_editor/PropertyEditView.d.ts +2 -2
  27. package/dist/collection_editor/ui/collection_editor/RouterCollectionStudioView.d.ts +1 -1
  28. package/dist/collection_editor/ui/collection_editor/RouterCollectionsStudioView.d.ts +1 -1
  29. package/dist/collection_editor/ui/collection_editor/SchemaChangeDialog.d.ts +66 -0
  30. package/dist/collection_editor/ui/collection_editor/SubcollectionsEditTab.d.ts +2 -2
  31. package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.d.ts +1 -1
  32. package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportMapping.d.ts +1 -1
  33. package/dist/collection_editor/ui/collection_editor/import/clean_import_data.d.ts +1 -1
  34. package/dist/collection_editor/ui/collection_editor/properties/conditions/index.d.ts +6 -6
  35. package/dist/collection_editor/useCollectionEditorController.d.ts +1 -1
  36. package/dist/collection_editor/useCollectionsConfigController.d.ts +1 -1
  37. package/dist/collection_editor/useJsonCollectionsConfigController.d.ts +2 -2
  38. package/dist/collection_editor/useLiveSchemaEditing.d.ts +71 -0
  39. package/dist/collection_editor/useLocalCollectionsConfigController.d.ts +1 -1
  40. package/dist/collection_editor_ui.d.ts +12 -12
  41. package/dist/collection_editor_ui.js +4 -4
  42. package/dist/components/CollectionTableBinding/CollectionTableBinding.d.ts +1 -1
  43. package/dist/components/CollectionTableBinding/PropertyTableCell.d.ts +1 -1
  44. package/dist/components/CollectionTableBinding/fields/TableStorageUpload.d.ts +1 -1
  45. package/dist/components/CollectionTableBinding/index.d.ts +5 -5
  46. package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.d.ts +1 -1
  47. package/dist/components/CollectionViewBinding/SlotValue.d.ts +2 -2
  48. package/dist/components/CollectionViewBinding/hooks/useKanbanDragAndDrop.d.ts +1 -1
  49. package/dist/components/EditFormActions.d.ts +1 -1
  50. package/dist/components/EditViewBinding.d.ts +3 -3
  51. package/dist/components/EntityInspector.d.ts +1 -1
  52. package/dist/components/EntityPreviewBinding.d.ts +1 -1
  53. package/dist/components/EntityViewBinding.d.ts +1 -1
  54. package/dist/components/HomePage/index.d.ts +4 -4
  55. package/dist/components/PropertyCollectionView.d.ts +1 -1
  56. package/dist/components/ReferenceWidget.d.ts +1 -1
  57. package/dist/components/admin/index.d.ts +1 -1
  58. package/dist/components/app/AppBar.d.ts +1 -1
  59. package/dist/components/app/index.d.ts +4 -4
  60. package/dist/components/common/index.d.ts +1 -1
  61. package/dist/components/field_configs.d.ts +1 -1
  62. package/dist/components/history/EntityHistoryEntry.d.ts +2 -2
  63. package/dist/components/history/index.d.ts +5 -5
  64. package/dist/components/index.d.ts +45 -45
  65. package/dist/data_export/export/index.d.ts +4 -4
  66. package/dist/data_export/index.d.ts +1 -1
  67. package/dist/data_import/components/DataNewPropertiesMapping.d.ts +1 -1
  68. package/dist/data_import/components/ImportSaveInProgress.d.ts +1 -1
  69. package/dist/data_import/components/index.d.ts +4 -4
  70. package/dist/data_import/hooks/index.d.ts +1 -1
  71. package/dist/data_import/hooks/useImportConfig.d.ts +1 -1
  72. package/dist/data_import/import/ImportCollectionAction.d.ts +1 -1
  73. package/dist/data_import/import/index.d.ts +1 -1
  74. package/dist/data_import/index.d.ts +5 -5
  75. package/dist/data_import/types/index.d.ts +1 -1
  76. package/dist/data_import/utils/file_to_json.d.ts +1 -1
  77. package/dist/data_import/utils/index.d.ts +5 -5
  78. package/dist/editor/components/SlashCommandMenu.d.ts +2 -2
  79. package/dist/editor/components/index.d.ts +5 -5
  80. package/dist/editor/editor.d.ts +2 -2
  81. package/dist/editor/index.d.ts +2 -2
  82. package/dist/editor/nodeViews/ImageComponent.d.ts +1 -1
  83. package/dist/editor/nodeViews/TaskItemComponent.d.ts +1 -1
  84. package/dist/editor/types.d.ts +1 -1
  85. package/dist/{export-oauWlxuu.js → export-BItpoIu0.js} +2 -2
  86. package/dist/{export-oauWlxuu.js.map → export-BItpoIu0.js.map} +1 -1
  87. package/dist/form/EntityForm.d.ts +1 -1
  88. package/dist/form/EntityFormActions.d.ts +1 -1
  89. package/dist/form/EntityFormBinding.d.ts +1 -1
  90. package/dist/form/PropertyFieldBinding.d.ts +1 -1
  91. package/dist/form/components/StorageItemPreview.d.ts +1 -1
  92. package/dist/form/components/index.d.ts +6 -6
  93. package/dist/form/field_bindings/ArrayCustomShapedFieldBinding.d.ts +1 -1
  94. package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.d.ts +1 -1
  95. package/dist/form/field_bindings/BinaryFieldBinding.d.ts +1 -1
  96. package/dist/form/field_bindings/BlockFieldBinding.d.ts +1 -1
  97. package/dist/form/field_bindings/DateTimeFieldBinding.d.ts +1 -1
  98. package/dist/form/field_bindings/GeopointFieldBinding.d.ts +1 -1
  99. package/dist/form/field_bindings/KeyValueFieldBinding.d.ts +1 -1
  100. package/dist/form/field_bindings/MapFieldBinding.d.ts +1 -1
  101. package/dist/form/field_bindings/MarkdownEditorFieldBinding.d.ts +2 -2
  102. package/dist/form/field_bindings/MultiSelectFieldBinding.d.ts +1 -1
  103. package/dist/form/field_bindings/MultipleRelationFieldBinding.d.ts +1 -1
  104. package/dist/form/field_bindings/ReadOnlyFieldBinding.d.ts +1 -1
  105. package/dist/form/field_bindings/ReferenceFieldBinding.d.ts +1 -1
  106. package/dist/form/field_bindings/RelationFieldBinding.d.ts +1 -1
  107. package/dist/form/field_bindings/RepeatFieldBinding.d.ts +1 -1
  108. package/dist/form/field_bindings/SelectFieldBinding.d.ts +1 -1
  109. package/dist/form/field_bindings/StorageUploadFieldBinding.d.ts +1 -1
  110. package/dist/form/field_bindings/SwitchFieldBinding.d.ts +1 -1
  111. package/dist/form/field_bindings/TextFieldBinding.d.ts +1 -1
  112. package/dist/form/field_bindings/UserSelectFieldBinding.d.ts +1 -1
  113. package/dist/form/field_bindings/VectorFieldBinding.d.ts +1 -1
  114. package/dist/form/index.d.ts +24 -24
  115. package/dist/{history-C2cqc0bw.js → history-C7WF14VR.js} +2 -2
  116. package/dist/{history-C2cqc0bw.js.map → history-C7WF14VR.js.map} +1 -1
  117. package/dist/hooks/index.d.ts +16 -16
  118. package/dist/hooks/navigation/contexts/index.d.ts +3 -3
  119. package/dist/hooks/useBuildSideDialogsController.d.ts +1 -1
  120. package/dist/hooks/useSelectionDialog.d.ts +1 -1
  121. package/dist/{import-Bxv5JPm-.js → import-CZgNAlcd.js} +2 -2
  122. package/dist/{import-Bxv5JPm-.js.map → import-CZgNAlcd.js.map} +1 -1
  123. package/dist/index.d.ts +17 -15
  124. package/dist/index.js +238 -21
  125. package/dist/index.js.map +1 -1
  126. package/dist/preview/PropertyPreview.d.ts +1 -1
  127. package/dist/preview/components/ArrayEnumPreview.d.ts +1 -1
  128. package/dist/preview/components/BooleanPreview.d.ts +1 -1
  129. package/dist/preview/components/ImagePreview.d.ts +1 -1
  130. package/dist/preview/components/ReferencePreview.d.ts +1 -1
  131. package/dist/preview/components/RelationPreview.d.ts +1 -1
  132. package/dist/preview/components/StorageThumbnail.d.ts +1 -1
  133. package/dist/preview/components/UrlComponentPreview.d.ts +2 -2
  134. package/dist/preview/components/UserPreview.d.ts +1 -1
  135. package/dist/preview/index.d.ts +24 -24
  136. package/dist/preview/property_previews/ArrayOfMapsPreview.d.ts +1 -1
  137. package/dist/preview/property_previews/ArrayOfReferencesPreview.d.ts +1 -1
  138. package/dist/preview/property_previews/ArrayOfRelationsPreview.d.ts +1 -1
  139. package/dist/preview/property_previews/ArrayOfStorageComponentsPreview.d.ts +1 -1
  140. package/dist/preview/property_previews/ArrayOfStringsPreview.d.ts +1 -1
  141. package/dist/preview/property_previews/ArrayOneOfPreview.d.ts +1 -1
  142. package/dist/preview/property_previews/ArrayPropertyEnumPreview.d.ts +1 -1
  143. package/dist/preview/property_previews/ArrayPropertyPreview.d.ts +1 -1
  144. package/dist/preview/property_previews/MapPropertyPreview.d.ts +1 -1
  145. package/dist/preview/property_previews/NumberPropertyPreview.d.ts +1 -1
  146. package/dist/preview/property_previews/SkeletonPropertyComponent.d.ts +1 -1
  147. package/dist/preview/property_previews/StringPropertyPreview.d.ts +1 -1
  148. package/dist/preview/util.d.ts +1 -1
  149. package/dist/routes/index.d.ts +2 -2
  150. package/dist/types/components/EntityFormActionsProps.d.ts +2 -2
  151. package/dist/types/components/EntityFormProps.d.ts +3 -3
  152. package/dist/types/components/index.d.ts +3 -3
  153. package/dist/types/fields.d.ts +1 -1
  154. package/dist/types/index.d.ts +2 -2
  155. package/dist/util/index.d.ts +5 -5
  156. package/dist/{util-C4qsI1QV.js → util-wrBH4QSB.js} +130 -7
  157. package/dist/util-wrBH4QSB.js.map +1 -0
  158. package/package.json +10 -10
  159. package/src/collection_editor/ConfigControllerProvider.tsx +5 -0
  160. package/src/collection_editor/liveSchemaClient.ts +272 -0
  161. package/src/collection_editor/types/config_controller.tsx +11 -0
  162. package/src/collection_editor/ui/collection_editor/CollectionEditorDialog.tsx +10 -0
  163. package/src/collection_editor/ui/collection_editor/SchemaChangeDialog.tsx +368 -0
  164. package/src/collection_editor/useLiveSchemaEditing.tsx +285 -0
  165. package/src/collection_editor/useLocalCollectionsConfigController.tsx +109 -10
  166. package/src/index.ts +6 -0
  167. package/dist/util-C4qsI1QV.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"export-oauWlxuu.js","names":[],"sources":["../src/data_export/export/export.ts","../src/data_export/export/fetch_export_data.ts","../src/data_export/export/BasicExportAction.tsx","../src/data_export/export/ExportCollectionAction.tsx","../src/data_export/export/index.ts"],"sourcesContent":["import { Entity, EntityReference, Properties, Property } from \"@rebasepro/types\";\nimport { type ArrayValuesCount, getArrayValuesCount, getValueInPath } from \"@rebasepro/utils\";\n\ninterface Header {\n key: string;\n label: string;\n}\n\nexport interface DownloadEntitiesExportParams<M extends Record<string, unknown>> {\n data: Entity<M>[];\n additionalData: Record<string, unknown>[] | undefined;\n properties: Properties;\n propertiesOrder: string[] | undefined;\n name: string;\n flattenArrays: boolean;\n additionalHeaders: string[] | undefined;\n exportType: \"csv\" | \"json\";\n dateExportType: \"timestamp\" | \"string\";\n}\n\nexport function downloadEntitiesExport<M extends Record<string, unknown>>({\n data,\n additionalData,\n properties,\n propertiesOrder,\n name,\n flattenArrays,\n additionalHeaders,\n exportType,\n dateExportType\n}: DownloadEntitiesExportParams<M>\n) {\n\n console.debug(\"Downloading export\", {\n dataLength: data.length,\n properties,\n exportType,\n dateExportType\n });\n\n if (exportType === \"csv\") {\n const arrayValuesCount = flattenArrays ? getArrayValuesCount(data.map(d => d.values)) : {};\n const headers = getExportHeaders(properties, propertiesOrder, additionalHeaders, arrayValuesCount);\n const exportableData = getEntityCSVExportableData(data, additionalData, properties, headers, dateExportType);\n const headersData = entryToCSVRow(headers.map(h => h.label));\n const csvData = exportableData.map(entry => entryToCSVRow(entry));\n downloadBlob([headersData, ...csvData], `${name}.csv`, \"text/csv\");\n } else {\n const exportableData = getEntityJsonExportableData(data, additionalData, properties, dateExportType);\n const json = JSON.stringify(exportableData, null, 2);\n downloadBlob([json], `${name}.json`, \"application/json\");\n }\n}\n\nexport function getEntityCSVExportableData(data: Entity<Record<string, unknown>>[],\n additionalData: Record<string, unknown>[] | undefined,\n properties: Properties,\n headers: Header[],\n dateExportType: \"timestamp\" | \"string\"\n) {\n\n const mergedData: Record<string, unknown>[] = data.map(e => ({\n id: e.id,\n ...processValuesForExport(e.values, properties, \"csv\", dateExportType)\n }));\n\n if (additionalData) {\n additionalData.forEach((additional, index) => {\n mergedData[index] = { ...mergedData[index],\n...additional };\n });\n }\n\n return mergedData && mergedData.map((entry) => {\n return headers.map((header) => getValueInPath(entry, header.key));\n });\n}\n\nexport function getEntityJsonExportableData(data: Entity<Record<string, unknown>>[],\n additionalData: Record<string, unknown>[] | undefined,\n properties: Properties,\n dateExportType: \"timestamp\" | \"string\"\n) {\n\n const mergedData: Record<string, unknown>[] = data.map(e => ({\n id: e.id,\n ...processValuesForExport(e.values, properties, \"json\", dateExportType)\n }));\n\n if (additionalData) {\n additionalData.forEach((additional, index) => {\n mergedData[index] = { ...mergedData[index],\n...additional };\n });\n }\n\n return mergedData;\n}\n\nfunction getExportHeaders<M extends Record<string, unknown>>(properties: Properties,\n propertiesOrder: string[] | undefined,\n additionalHeaders: string[] | undefined,\n arrayValuesCount?: ArrayValuesCount): Header[] {\n\n const headers: Header[] = [\n {\n label: \"id\",\n key: \"id\"\n },\n ...(propertiesOrder ?? Object.keys(properties))\n .flatMap((childKey) => {\n const property = properties[childKey];\n if (!property) {\n console.warn(\"Property not found\", childKey, properties);\n return [];\n }\n if (arrayValuesCount && arrayValuesCount[childKey] > 1) {\n return Array.from({ length: arrayValuesCount[childKey] },\n (_, i) => getHeaders(property as Property, `${childKey}[${i}]`, \"\"))\n .flat();\n } else {\n return getHeaders(property as Property, childKey, \"\");\n }\n })\n ];\n\n if (additionalHeaders) {\n headers.push(...additionalHeaders.map(h => ({\n label: h,\n key: h\n })));\n }\n\n return headers;\n}\n\n/**\n * Get headers for property. There could be more than one header per property\n * @param property\n * @param propertyKey\n * @param prefix\n */\nfunction getHeaders(property: Property, propertyKey: string, prefix = \"\"): Header[] {\n const currentKey = prefix ? `${prefix}.${propertyKey}` : propertyKey;\n if (property.type === \"map\" && property.properties) {\n return Object.entries(property.properties)\n .map(([childKey, p]) => getHeaders(p, childKey, currentKey))\n .flat();\n } else {\n return [{\n label: currentKey,\n key: currentKey\n }];\n }\n}\n\n/**\n * Read whatever a `date` column actually arrived as into a `Date`.\n *\n * The driver/WebSocket path revives `{ __type: \"date\" }` into a `Date`; the REST\n * path — which is the one the admin is on — leaves an ISO string, and an epoch\n * number is what a re-imported export carries. Returns `undefined` for anything\n * that is not a date, so the caller can pass the raw value through.\n */\nfunction toExportableDate(inputValue: unknown): Date | undefined {\n if (inputValue instanceof Date) return Number.isNaN(inputValue.getTime()) ? undefined : inputValue;\n if (typeof inputValue === \"number\" && Number.isFinite(inputValue)) return new Date(inputValue);\n if (typeof inputValue === \"string\" && inputValue.trim() !== \"\") {\n const parsed = new Date(inputValue);\n return Number.isNaN(parsed.getTime()) ? undefined : parsed;\n }\n return undefined;\n}\n\nfunction processValueForExport(inputValue: unknown,\n property: Property,\n exportType: \"csv\" | \"json\",\n dateExportType: \"timestamp\" | \"string\"\n): unknown {\n\n let value: unknown;\n if (property.type === \"map\" && property.properties) {\n value = processValuesForExport(inputValue as Record<string, unknown>, property.properties as Properties, exportType, dateExportType);\n } else if (property.type === \"array\") {\n if (property.of && Array.isArray(inputValue)) {\n if (Array.isArray(property.of)) {\n value = property.of.map((p, i) => processValueForExport(inputValue[i], p, exportType, dateExportType));\n } else if (property.of.type === \"map\") {\n value = exportType === \"csv\"\n ? inputValue.map((e) => JSON.stringify(e))\n : inputValue.map((e) => processValueForExport(e, property.of as Property, exportType, dateExportType));\n ;\n } else {\n value = inputValue.map((e) => processValueForExport(e, property.of as Property, exportType, dateExportType));\n }\n } else {\n value = inputValue;\n }\n } else if (property.type === \"reference\" && inputValue && typeof inputValue === \"object\" && \"isEntityReference\" in inputValue && typeof (inputValue as EntityReference).isEntityReference === \"function\" && (inputValue as EntityReference).isEntityReference()) {\n const ref = inputValue ? inputValue as EntityReference : undefined;\n value = ref ? ref.fullPath : null;\n } else if (property.type === \"date\") {\n // Not `instanceof Date`: the admin reads over REST, and the REST row\n // pipeline hands dates back as the database wrote them — a string. That\n // made this branch dead on every live export, so both radio options\n // produced identical files. Normalise here, where the declared type says\n // the column is a date, and leave anything unparseable untouched rather\n // than exporting an invalid date as `null`.\n const date = toExportableDate(inputValue);\n value = date\n ? (dateExportType === \"timestamp\" ? date.getTime() : date.toISOString())\n : inputValue;\n } else {\n value = inputValue;\n }\n\n return value;\n}\n\nfunction processValuesForExport<M extends Record<string, unknown>>\n (inputValues: Record<string, unknown>,\n properties: Properties,\n exportType: \"csv\" | \"json\",\n dateExportType: \"timestamp\" | \"string\"\n ): Record<string, unknown> {\n const updatedValues = Object.entries(properties)\n .map(([key, property]) => {\n const inputValue = inputValues && (inputValues)[key];\n const updatedValue = processValueForExport(inputValue, property as Property, exportType, dateExportType);\n if (updatedValue === undefined) return {};\n return ({ [key]: updatedValue });\n })\n .reduce((a, b) => ({ ...a,\n...b }), {}) as Record<string, unknown>;\n return { ...inputValues,\n...updatedValues };\n}\n\n/**\n * Characters that make a spreadsheet read a cell as a formula rather than text.\n *\n * Quoting is CSV *escaping* and is not enough: Excel, LibreOffice Calc and\n * Sheets strip the CSV quoting at parse time and then evaluate a cell whose\n * first character is one of these — `=HYPERLINK(…)` exfiltrates neighbouring\n * cells on click, `=cmd|'…'!A0` is worse.\n */\nconst FORMULA_TRIGGERS = [\"=\", \"+\", \"-\", \"@\", \"\\t\", \"\\r\"];\n\n/**\n * Neutralise a cell that a spreadsheet would otherwise evaluate, by prefixing a\n * single quote — the standard OWASP mitigation. The apostrophe is consumed by\n * the spreadsheet as \"treat the rest as text\", so the value reads back intact.\n */\nexport function escapeCsvFormula(value: string): string {\n const first = value.charAt(0);\n if (!FORMULA_TRIGGERS.includes(first)) return value;\n // A signed number is not a formula, and prefixing it would turn every\n // negative amount in the file into text. `-1+1` is still neutralised,\n // because it is not a number.\n if ((first === \"-\" || first === \"+\") && value.trim() !== \"\" && Number.isFinite(Number(value))) return value;\n return \"'\" + value;\n}\n\nfunction toCSVCell(v: unknown): string {\n if (v === null || v === undefined) return \"\";\n const s = Array.isArray(v) ? JSON.stringify(v) : String(v);\n return \"\\\"\" + escapeCsvFormula(s).replaceAll(\"\\\"\", \"\\\"\\\"\") + \"\\\"\";\n}\n\nexport function entryToCSVRow(entry: unknown[]) {\n return entry\n .map(toCSVCell)\n .join(\",\") + \"\\r\\n\";\n}\n\nexport function downloadBlob(content: BlobPart[], filename: string, contentType: string) {\n const blob = new Blob(content, { type: contentType });\n const url = URL.createObjectURL(blob);\n const pom = document.createElement(\"a\");\n pom.href = url;\n pom.setAttribute(\"download\", filename);\n pom.click();\n}\n\nexport function downloadDataAsCsv(data: object[], name: string) {\n if (data.length === 0) return;\n\n const headers = Object.keys(data[0]);\n const csvContent = [\n headers.join(\",\"),\n ...data.map(row => headers.map(header => toCSVCell((row as Record<string, unknown>)[header])).join(\",\"))\n ].join(\"\\r\\n\");\n\n downloadBlob([csvContent], `${name}.csv`, \"text/csv\");\n}\n","import { Entity, FindParams, FindResponse } from \"@rebasepro/types\";\n\n/**\n * Rows asked for per request.\n *\n * Kept at or below the server's `MAX_LIST_LIMIT`, which is now the largest page\n * a read will serve *and refuses* anything larger — it used to clamp silently,\n * and asking for 100 000 while receiving 1 000 looked exactly like a collection\n * with 1 000 rows in it. The walk still never trusts the page size it asked for:\n * it advances by the rows it was actually handed.\n */\nexport const EXPORT_PAGE_SIZE = 500;\n\n/**\n * Most rows one browser-side export will materialise.\n *\n * Everything here is built in memory and handed to a Blob, so there is a\n * ceiling whether or not it is named. Naming it means going over it **throws**\n * instead of writing a short file that reads like the whole collection.\n */\nexport const MAX_EXPORT_ROWS = 100_000;\n\nexport interface FetchAllForExportParams<M extends Record<string, unknown>> {\n /** The collection accessor to read through — `dataClient.collection(path)`. */\n accessor: { find(params?: FindParams<M>): Promise<FindResponse<M>> };\n /** Query to export. The window (`limit` / `offset` / `page`) is owned by the walk. */\n params?: Omit<FindParams<M>, \"limit\" | \"offset\" | \"page\">;\n pageSize?: number;\n maxRows?: number;\n /** Called after every page with the rows so far, and the total when the server reports one. */\n onProgress?: (loaded: number, total: number | undefined) => void;\n}\n\n/**\n * Read **every** row matching a query, one page at a time.\n *\n * `find({})` sends no `limit`, and an absent limit is resolved server-side to\n * `DEFAULT_LIST_LIMIT` — 50 rows. The export used to hand those 50 rows back as\n * `<collection>.csv` with nothing saying it was a sample, next to a dialog\n * warning that the collection had 100 000 documents.\n *\n * Termination is driven by the server's `meta.hasMore` where it is reported and\n * by an empty page otherwise — never by comparing a page's length against the\n * requested limit, since a final page that happens to be exactly full is\n * indistinguishable that way and a walk that stops there drops rows.\n *\n * @throws When more than `maxRows` rows match. A truncated export is worse than\n * no export: it is indistinguishable from a complete one.\n */\nexport async function fetchAllEntitiesForExport<M extends Record<string, unknown>>({\n accessor,\n params,\n pageSize = EXPORT_PAGE_SIZE,\n maxRows = MAX_EXPORT_ROWS,\n onProgress\n}: FetchAllForExportParams<M>): Promise<Entity<M>[]> {\n\n const rows: Entity<M>[] = [];\n let offset = 0;\n\n for (;;) {\n const res = await accessor.find({\n ...params,\n limit: pageSize,\n offset\n } as FindParams<M>);\n\n const page = res?.data ?? [];\n rows.push(...page);\n onProgress?.(rows.length, res?.meta?.total);\n\n if (rows.length > maxRows) {\n throw new Error(\n `This export would contain more than ${maxRows.toLocaleString()} rows, which is more than the ` +\n \"browser can build in one file. Filter the collection down, or export it from the server.\"\n );\n }\n\n // An empty page ends the walk whatever the metadata says, so a server\n // that keeps answering `hasMore` cannot spin forever.\n if (page.length === 0) break;\n if (res?.meta && !res.meta.hasMore) break;\n\n // By rows received, not by `pageSize`: a server whose ceiling is lower\n // than the page we asked for would otherwise skip everything it clamped.\n offset += page.length;\n }\n\n return rows;\n}\n","\nimport React, { useCallback } from \"react\";\n\nimport { useTranslation } from \"@rebasepro/app\";\nimport { Entity, Properties } from \"@rebasepro/types\";\nimport {\n BooleanSwitchWithLabel,\n Button,\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n DownloadIcon,\n IconButton,\n Label,\n RadioGroup,\n RadioGroupItem,\n Tooltip,\n Typography\n} from \"@rebasepro/ui\";\nimport { downloadEntitiesExport } from \"./export\";\n\nexport type BasicExportActionProps = {\n data: Entity<any>[];\n properties: Properties;\n propertiesOrder?: string[];\n}\n\nexport function BasicExportAction({\n data,\n properties,\n propertiesOrder\n}: BasicExportActionProps) {\n\n const { t } = useTranslation();\n const dateRef = React.useRef<Date>(new Date());\n const [flattenArrays, setFlattenArrays] = React.useState<boolean>(true);\n const [exportType, setExportType] = React.useState<\"csv\" | \"json\">(\"csv\");\n const [dateExportType, setDateExportType] = React.useState<\"timestamp\" | \"string\">(\"string\");\n\n const [open, setOpen] = React.useState(false);\n\n const handleClickOpen = useCallback(() => {\n setOpen(true);\n }, [setOpen]);\n\n const handleClose = useCallback(() => {\n setOpen(false);\n }, [setOpen]);\n\n const onOkClicked = useCallback(() => {\n downloadEntitiesExport({\n data,\n additionalData: [],\n properties,\n propertiesOrder,\n name: \"export.csv\",\n flattenArrays,\n additionalHeaders: [],\n exportType,\n dateExportType\n });\n handleClose();\n }, []);\n\n return <>\n\n <Tooltip title={\"Export\"}\n asChild={true}>\n <IconButton\n size={\"small\"}\n color={\"primary\"} onClick={handleClickOpen}>\n <DownloadIcon\n size={\"small\"}/>\n </IconButton>\n </Tooltip>\n\n <Dialog\n open={open}\n onOpenChange={setOpen}\n maxWidth={\"xl\"}>\n\n <DialogTitle variant={\"h6\"}>{t(\"export_data\")}</DialogTitle>\n\n <DialogContent className={\"flex flex-col gap-4 my-4\"}>\n\n <div>{t(\"download_table_csv\")}</div>\n\n <div className={\"flex flex-row gap-4\"}>\n <div className={\"p-4 flex flex-col\"}>\n <RadioGroup value={exportType} onValueChange={(v) => setExportType(v as \"csv\" | \"json\")}>\n <div className=\"flex items-center gap-2\">\n <RadioGroupItem value=\"csv\" id=\"radio-csv\"/>\n <Label htmlFor=\"radio-csv\">{t(\"csv\")}</Label>\n </div>\n <div className=\"flex items-center gap-2\">\n <RadioGroupItem value=\"json\" id=\"radio-json\"/>\n <Label htmlFor=\"radio-json\">{t(\"json\")}</Label>\n </div>\n </RadioGroup>\n </div>\n\n <div className={\"p-4 flex flex-col\"}>\n <RadioGroup value={dateExportType} onValueChange={(v) => setDateExportType(v as \"timestamp\" | \"string\")}>\n <div className=\"flex items-center gap-2\">\n <RadioGroupItem value=\"timestamp\" id=\"radio-timestamp\"/>\n <Label htmlFor=\"radio-timestamp\">{t(\"dates_as_timestamps\")} ({dateRef.current.getTime()})</Label>\n </div>\n <div className=\"flex items-center gap-2\">\n <RadioGroupItem value=\"string\" id=\"radio-string\"/>\n <Label htmlFor=\"radio-string\">{t(\"dates_as_strings\")} ({dateRef.current.toISOString()})</Label>\n </div>\n </RadioGroup>\n </div>\n </div>\n\n <BooleanSwitchWithLabel\n size={\"small\"}\n disabled={exportType !== \"csv\"}\n value={flattenArrays}\n onValueChange={setFlattenArrays}\n label={t(\"flatten_arrays\")}/>\n\n </DialogContent>\n\n <DialogActions>\n\n <Button onClick={handleClose}\n variant={\"text\"}>\n {t(\"cancel\")}\n </Button>\n\n <Button onClick={onOkClicked}>\n {t(\"download\")}\n </Button>\n\n </DialogActions>\n\n </Dialog>\n\n </>;\n}\n","\nimport React, { useCallback } from \"react\";\n\nimport {\n useAuthController,\n useCustomizationController,\n useData,\n useTranslation\n} from \"@rebasepro/app\";\nimport { useAdminContext } from \"../../hooks\";\nimport { Entity, User } from \"@rebasepro/types\";\nimport { CollectionActionsProps, ExportConfig, RebaseContext, AdminCollection } from \"@rebasepro/admin-types\";\nimport { getDefaultValuesFor } from \"@rebasepro/common\";\nimport {\n Alert,\n BooleanSwitchWithLabel,\n Button,\n CircularProgress,\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n DownloadIcon,\n IconButton,\n iconSize,\n Label,\n RadioGroup,\n RadioGroupItem,\n Tooltip\n} from \"@rebasepro/ui\";\nimport { downloadEntitiesExport } from \"./export\";\nimport { fetchAllEntitiesForExport, MAX_EXPORT_ROWS } from \"./fetch_export_data\";\n\nconst DOCS_LIMIT = 500;\n\n/**\n * Additional-field builders run per row and may do I/O, so a `Promise.all` over\n * the whole export is one request per row all at once. That was bounded only by\n * the 50-row cap the export used to have; now that the read is paginated, it is\n * bounded here instead.\n */\nconst ADDITIONAL_FIELDS_CONCURRENCY = 50;\n\nasync function mapInChunks<T, R>(items: T[], fn: (item: T) => Promise<R>, chunkSize = ADDITIONAL_FIELDS_CONCURRENCY): Promise<R[]> {\n const results: R[] = [];\n for (let i = 0; i < items.length; i += chunkSize) {\n results.push(...await Promise.all(items.slice(i, i + chunkSize).map(fn)));\n }\n return results;\n}\n\nexport function ExportCollectionAction<M extends Record<string, unknown>, USER extends User>({\n collection,\n path,\n collectionEntitiesCount,\n onAnalyticsEvent,\n exportAllowed,\n notAllowedView\n}: CollectionActionsProps<M, USER, AdminCollection<M>> & {\n exportAllowed?: (props: { collectionEntitiesCount: number, path: string, collection: AdminCollection }) => boolean;\n notAllowedView?: React.ReactNode;\n onAnalyticsEvent?: (event: string, params?: any) => void;\n}) {\n\n const { t } = useTranslation();\n\n const exportConfig = typeof collection.exportable === \"object\" ? collection.exportable : undefined;\n\n const dateRef = React.useRef<Date>(new Date());\n\n const [includeUndefinedValues, setIncludeUndefinedValues] = React.useState<boolean>(false);\n const [flattenArrays, setFlattenArrays] = React.useState<boolean>(true);\n const [exportType, setExportType] = React.useState<\"csv\" | \"json\">(\"csv\");\n const [dateExportType, setDateExportType] = React.useState<\"timestamp\" | \"string\">(\"string\");\n\n const context = useAdminContext<USER>();\n const dataClient = useData();\n\n // Said before the download starts, not discovered halfway through it: the\n // walk refuses rather than writing a short file, so the dialog has to name\n // the ceiling it is about to hit.\n const tooManyToExport = collectionEntitiesCount !== undefined && collectionEntitiesCount > MAX_EXPORT_ROWS;\n\n const canExport = !exportAllowed || exportAllowed({\n collectionEntitiesCount: collectionEntitiesCount ?? 0,\n path,\n collection\n });\n\n const [dataLoading, setDataLoading] = React.useState<boolean>(false);\n const [dataLoadingError, setDataLoadingError] = React.useState<Error | undefined>();\n const [progress, setProgress] = React.useState<{ loaded: number, total?: number }>({ loaded: 0 });\n\n const [open, setOpen] = React.useState(false);\n\n const handleClickOpen = useCallback(() => {\n setOpen(true);\n }, [setOpen]);\n\n const handleClose = useCallback(() => {\n setOpen(false);\n }, [setOpen]);\n\n const fetchAdditionalFields = useCallback(async (entities: Entity<M>[]) => {\n\n const additionalExportFields = exportConfig?.additionalFields;\n const additionalFields = collection.additionalFields;\n\n const resolvedExportColumnsValues: Record<string, any>[] = additionalExportFields\n ? await mapInChunks(entities, async (entity) => {\n return (await Promise.all(additionalExportFields.map(async (column) => {\n return {\n [column.key]: await column.builder({\n entity,\n context: context as RebaseContext\n })\n };\n }))).reduce((a, b) => ({ ...a,\n...b }), {});\n })\n : [];\n\n const resolvedColumnsValues: Record<string, any>[] = additionalFields\n ? await mapInChunks(entities, async (entity) => {\n return (await Promise.all(additionalFields\n .map(async (field) => {\n if (!field.value)\n return {};\n return {\n [field.key]: await field.value({\n entity,\n context: context as RebaseContext\n })\n };\n }))).reduce((a, b) => ({ ...a,\n...b }), {});\n })\n : [];\n return [...resolvedExportColumnsValues, ...resolvedColumnsValues];\n }, [exportConfig?.additionalFields]);\n\n const doDownload = useCallback(async (collection: AdminCollection<M>,\n exportConfig: ExportConfig<any> | undefined): Promise<boolean> => {\n\n onAnalyticsEvent?.(\"export_collection\", {\n collection: collection.slug\n });\n setDataLoading(true);\n setDataLoadingError(undefined);\n setProgress({ loaded: 0 });\n try {\n // Paginated, not `find({})`: an absent limit resolves to 50 rows\n // server-side, so the export used to be the first page of the\n // collection under a filename that read like all of it.\n const data = await fetchAllEntitiesForExport<M>({\n accessor: dataClient.collection(path) as { find: (params?: any) => Promise<any> },\n onProgress: (loaded, total) => setProgress({ loaded,\n total })\n });\n const additionalData = await fetchAdditionalFields(data);\n const additionalHeaders = [\n ...exportConfig?.additionalFields?.map(column => column.key) ?? [],\n ...collection.additionalFields?.map(field => field.key) ?? []\n ];\n\n const defaultValues = includeUndefinedValues ? getDefaultValuesFor(collection.properties) : undefined;\n const dataWithDefaults = defaultValues\n ? data.map(entity => ({\n ...entity,\n values: { ...defaultValues,\n...entity.values }\n }))\n : data;\n downloadEntitiesExport({\n data: dataWithDefaults,\n additionalData,\n properties: collection.properties,\n propertiesOrder: collection.propertiesOrder,\n name: collection.name,\n flattenArrays,\n additionalHeaders,\n exportType,\n dateExportType\n });\n onAnalyticsEvent?.(\"export_collection_success\", {\n collection: collection.slug\n });\n return true;\n } catch (e) {\n console.error(\"Error loading export data\", e);\n setDataLoadingError(e as Error);\n return false;\n } finally {\n setDataLoading(false);\n }\n\n }, [onAnalyticsEvent, dataClient, path, fetchAdditionalFields, includeUndefinedValues, flattenArrays, exportType, dateExportType]);\n\n const onOkClicked = useCallback(() => {\n // The dialog stays open until the walk finishes: it is the only place a\n // multi-page export reports progress, or reports that it failed.\n doDownload(collection, exportConfig).then((downloaded) => {\n if (downloaded) handleClose();\n });\n }, [doDownload, collection, exportConfig, handleClose]);\n\n return <>\n\n <Tooltip title={\"Export\"}\n asChild={true}>\n <IconButton\n size={\"small\"}\n color={\"primary\"}\n onClick={handleClickOpen}>\n <DownloadIcon size={iconSize.small}/>\n </IconButton>\n </Tooltip>\n\n <Dialog\n open={open}\n onOpenChange={setOpen}\n maxWidth={\"xl\"}>\n\n <DialogTitle variant={\"h6\"}>{t(\"export_data\")}</DialogTitle>\n\n <DialogContent className={\"flex flex-col gap-4 my-4\"}>\n\n <div>{t(\"download_table_csv\")}</div>\n\n {collectionEntitiesCount !== undefined && collectionEntitiesCount > DOCS_LIMIT && !tooManyToExport &&\n <Alert color={\"warning\"}>\n <div>\n {t(\"large_number_of_documents\", { count: collectionEntitiesCount.toString() })}\n </div>\n </Alert>}\n\n {tooManyToExport &&\n <Alert color={\"error\"}>\n <div>\n {t(\"too_many_documents_to_export\", {\n count: (collectionEntitiesCount ?? 0).toString(),\n limit: MAX_EXPORT_ROWS.toString()\n })}\n </div>\n </Alert>}\n\n <div className={\"flex flex-row gap-4\"}>\n <div className={\"p-4 flex flex-col\"}>\n <RadioGroup value={exportType} onValueChange={(v) => setExportType(v as \"csv\" | \"json\")}>\n <div className=\"flex items-center gap-2\">\n <RadioGroupItem value=\"csv\" id=\"radio-csv\"/>\n <Label htmlFor=\"radio-csv\">{t(\"csv\")}</Label>\n </div>\n <div className=\"flex items-center gap-2\">\n <RadioGroupItem value=\"json\" id=\"radio-json\"/>\n <Label htmlFor=\"radio-json\">{t(\"json\")}</Label>\n </div>\n </RadioGroup>\n </div>\n\n <div className={\"p-4 flex flex-col\"}>\n <RadioGroup value={dateExportType} onValueChange={(v) => setDateExportType(v as \"timestamp\" | \"string\")}>\n <div className=\"flex items-center gap-2\">\n <RadioGroupItem value=\"timestamp\" id=\"radio-timestamp\"/>\n <Label htmlFor=\"radio-timestamp\">{t(\"dates_as_timestamps\")} ({dateRef.current.getTime()})</Label>\n </div>\n <div className=\"flex items-center gap-2\">\n <RadioGroupItem value=\"string\" id=\"radio-string\"/>\n <Label htmlFor=\"radio-string\">{t(\"dates_as_strings\")} ({dateRef.current.toISOString()})</Label>\n </div>\n </RadioGroup>\n </div>\n </div>\n\n <BooleanSwitchWithLabel\n size={\"small\"}\n disabled={exportType !== \"csv\"}\n value={flattenArrays}\n onValueChange={setFlattenArrays}\n label={t(\"flatten_arrays\")}/>\n\n <BooleanSwitchWithLabel\n size={\"small\"}\n value={includeUndefinedValues}\n onValueChange={setIncludeUndefinedValues}\n label={t(\"include_undefined_values\")}/>\n\n {dataLoadingError && <Alert color={\"error\"}>\n <div>{dataLoadingError.message}</div>\n </Alert>}\n\n {!canExport && notAllowedView}\n\n </DialogContent>\n\n <DialogActions>\n\n {dataLoading && <CircularProgress size={\"smallest\"}/>}\n\n {dataLoading && <Label>\n {progress.total !== undefined\n ? `${progress.loaded} / ${progress.total}`\n : `${progress.loaded}`}\n </Label>}\n\n <Button onClick={handleClose}\n variant={\"text\"}>\n {t(\"cancel\")}\n </Button>\n\n <Button onClick={onOkClicked}\n disabled={dataLoading || !canExport || tooManyToExport}>\n {t(\"download\")}\n </Button>\n\n </DialogActions>\n\n </Dialog>\n\n </>;\n}\n","export * from \"./export\";\nexport * from \"./fetch_export_data\";\nexport * from \"./BasicExportAction\";\nexport * from \"./ExportCollectionAction\";\n"],"mappings":";;;;;;;;;AAoBA,SAAgB,uBAA0D,EACtE,MACA,gBACA,YACA,iBACA,MACA,eACA,mBACA,YACA,kBAEF;CAEE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,0BAA0B;KAAG,CAAA;KAEzC,oBAAoB,oBAAC,OAAD;MAAO,OAAO;gBAC/B,oBAAC,OAAD,EAAA,UAAM,iBAAiB,QAAa,CAAA;KACjC,CAAA;KAEN,CAAC,aAAa;IAEJ;;GAEf,qBAAC,eAAD,EAAA,UAAA;IAEK,eAAe,oBAAC,kBAAD,EAAkB,MAAM,WAAY,CAAA;IAEnD,eAAe,oBAAC,OAAD,EAAA,UACX,SAAS,UAAU,KAAA,IACd,GAAG,SAAS,OAAO,KAAK,SAAS,UACjC,GAAG,SAAS,SACf,CAAA;IAEP,oBAAC,QAAD;KAAQ,SAAS;KACb,SAAS;eACR,EAAE,QAAQ;IACP,CAAA;IAER,oBAAC,QAAD;KAAQ,SAAS;KACb,UAAU,eAAe,CAAC,aAAa;eACtC,EAAE,UAAU;IACT,CAAA;GAEG,EAAA,CAAA;EAEX;GAEV,EAAA,CAAA;AACN"}
1
+ {"version":3,"file":"export-BItpoIu0.js","names":[],"sources":["../src/data_export/export/export.ts","../src/data_export/export/fetch_export_data.ts","../src/data_export/export/BasicExportAction.tsx","../src/data_export/export/ExportCollectionAction.tsx","../src/data_export/export/index.ts"],"sourcesContent":["import { Entity, EntityReference, Properties, Property } from \"@rebasepro/types\";\nimport { type ArrayValuesCount, getArrayValuesCount, getValueInPath } from \"@rebasepro/utils\";\n\ninterface Header {\n key: string;\n label: string;\n}\n\nexport interface DownloadEntitiesExportParams<M extends Record<string, unknown>> {\n data: Entity<M>[];\n additionalData: Record<string, unknown>[] | undefined;\n properties: Properties;\n propertiesOrder: string[] | undefined;\n name: string;\n flattenArrays: boolean;\n additionalHeaders: string[] | undefined;\n exportType: \"csv\" | \"json\";\n dateExportType: \"timestamp\" | \"string\";\n}\n\nexport function downloadEntitiesExport<M extends Record<string, unknown>>({\n data,\n additionalData,\n properties,\n propertiesOrder,\n name,\n flattenArrays,\n additionalHeaders,\n exportType,\n dateExportType\n}: DownloadEntitiesExportParams<M>\n) {\n\n console.debug(\"Downloading export\", {\n dataLength: data.length,\n properties,\n exportType,\n dateExportType\n });\n\n if (exportType === \"csv\") {\n const arrayValuesCount = flattenArrays ? getArrayValuesCount(data.map(d => d.values)) : {};\n const headers = getExportHeaders(properties, propertiesOrder, additionalHeaders, arrayValuesCount);\n const exportableData = getEntityCSVExportableData(data, additionalData, properties, headers, dateExportType);\n const headersData = entryToCSVRow(headers.map(h => h.label));\n const csvData = exportableData.map(entry => entryToCSVRow(entry));\n downloadBlob([headersData, ...csvData], `${name}.csv`, \"text/csv\");\n } else {\n const exportableData = getEntityJsonExportableData(data, additionalData, properties, dateExportType);\n const json = JSON.stringify(exportableData, null, 2);\n downloadBlob([json], `${name}.json`, \"application/json\");\n }\n}\n\nexport function getEntityCSVExportableData(data: Entity<Record<string, unknown>>[],\n additionalData: Record<string, unknown>[] | undefined,\n properties: Properties,\n headers: Header[],\n dateExportType: \"timestamp\" | \"string\"\n) {\n\n const mergedData: Record<string, unknown>[] = data.map(e => ({\n id: e.id,\n ...processValuesForExport(e.values, properties, \"csv\", dateExportType)\n }));\n\n if (additionalData) {\n additionalData.forEach((additional, index) => {\n mergedData[index] = { ...mergedData[index],\n...additional };\n });\n }\n\n return mergedData && mergedData.map((entry) => {\n return headers.map((header) => getValueInPath(entry, header.key));\n });\n}\n\nexport function getEntityJsonExportableData(data: Entity<Record<string, unknown>>[],\n additionalData: Record<string, unknown>[] | undefined,\n properties: Properties,\n dateExportType: \"timestamp\" | \"string\"\n) {\n\n const mergedData: Record<string, unknown>[] = data.map(e => ({\n id: e.id,\n ...processValuesForExport(e.values, properties, \"json\", dateExportType)\n }));\n\n if (additionalData) {\n additionalData.forEach((additional, index) => {\n mergedData[index] = { ...mergedData[index],\n...additional };\n });\n }\n\n return mergedData;\n}\n\nfunction getExportHeaders<M extends Record<string, unknown>>(properties: Properties,\n propertiesOrder: string[] | undefined,\n additionalHeaders: string[] | undefined,\n arrayValuesCount?: ArrayValuesCount): Header[] {\n\n const headers: Header[] = [\n {\n label: \"id\",\n key: \"id\"\n },\n ...(propertiesOrder ?? Object.keys(properties))\n .flatMap((childKey) => {\n const property = properties[childKey];\n if (!property) {\n console.warn(\"Property not found\", childKey, properties);\n return [];\n }\n if (arrayValuesCount && arrayValuesCount[childKey] > 1) {\n return Array.from({ length: arrayValuesCount[childKey] },\n (_, i) => getHeaders(property as Property, `${childKey}[${i}]`, \"\"))\n .flat();\n } else {\n return getHeaders(property as Property, childKey, \"\");\n }\n })\n ];\n\n if (additionalHeaders) {\n headers.push(...additionalHeaders.map(h => ({\n label: h,\n key: h\n })));\n }\n\n return headers;\n}\n\n/**\n * Get headers for property. There could be more than one header per property\n * @param property\n * @param propertyKey\n * @param prefix\n */\nfunction getHeaders(property: Property, propertyKey: string, prefix = \"\"): Header[] {\n const currentKey = prefix ? `${prefix}.${propertyKey}` : propertyKey;\n if (property.type === \"map\" && property.properties) {\n return Object.entries(property.properties)\n .map(([childKey, p]) => getHeaders(p, childKey, currentKey))\n .flat();\n } else {\n return [{\n label: currentKey,\n key: currentKey\n }];\n }\n}\n\n/**\n * Read whatever a `date` column actually arrived as into a `Date`.\n *\n * The driver/WebSocket path revives `{ __type: \"date\" }` into a `Date`; the REST\n * path — which is the one the admin is on — leaves an ISO string, and an epoch\n * number is what a re-imported export carries. Returns `undefined` for anything\n * that is not a date, so the caller can pass the raw value through.\n */\nfunction toExportableDate(inputValue: unknown): Date | undefined {\n if (inputValue instanceof Date) return Number.isNaN(inputValue.getTime()) ? undefined : inputValue;\n if (typeof inputValue === \"number\" && Number.isFinite(inputValue)) return new Date(inputValue);\n if (typeof inputValue === \"string\" && inputValue.trim() !== \"\") {\n const parsed = new Date(inputValue);\n return Number.isNaN(parsed.getTime()) ? undefined : parsed;\n }\n return undefined;\n}\n\nfunction processValueForExport(inputValue: unknown,\n property: Property,\n exportType: \"csv\" | \"json\",\n dateExportType: \"timestamp\" | \"string\"\n): unknown {\n\n let value: unknown;\n if (property.type === \"map\" && property.properties) {\n value = processValuesForExport(inputValue as Record<string, unknown>, property.properties as Properties, exportType, dateExportType);\n } else if (property.type === \"array\") {\n if (property.of && Array.isArray(inputValue)) {\n if (Array.isArray(property.of)) {\n value = property.of.map((p, i) => processValueForExport(inputValue[i], p, exportType, dateExportType));\n } else if (property.of.type === \"map\") {\n value = exportType === \"csv\"\n ? inputValue.map((e) => JSON.stringify(e))\n : inputValue.map((e) => processValueForExport(e, property.of as Property, exportType, dateExportType));\n ;\n } else {\n value = inputValue.map((e) => processValueForExport(e, property.of as Property, exportType, dateExportType));\n }\n } else {\n value = inputValue;\n }\n } else if (property.type === \"reference\" && inputValue && typeof inputValue === \"object\" && \"isEntityReference\" in inputValue && typeof (inputValue as EntityReference).isEntityReference === \"function\" && (inputValue as EntityReference).isEntityReference()) {\n const ref = inputValue ? inputValue as EntityReference : undefined;\n value = ref ? ref.fullPath : null;\n } else if (property.type === \"date\") {\n // Not `instanceof Date`: the admin reads over REST, and the REST row\n // pipeline hands dates back as the database wrote them — a string. That\n // made this branch dead on every live export, so both radio options\n // produced identical files. Normalise here, where the declared type says\n // the column is a date, and leave anything unparseable untouched rather\n // than exporting an invalid date as `null`.\n const date = toExportableDate(inputValue);\n value = date\n ? (dateExportType === \"timestamp\" ? date.getTime() : date.toISOString())\n : inputValue;\n } else {\n value = inputValue;\n }\n\n return value;\n}\n\nfunction processValuesForExport<M extends Record<string, unknown>>\n (inputValues: Record<string, unknown>,\n properties: Properties,\n exportType: \"csv\" | \"json\",\n dateExportType: \"timestamp\" | \"string\"\n ): Record<string, unknown> {\n const updatedValues = Object.entries(properties)\n .map(([key, property]) => {\n const inputValue = inputValues && (inputValues)[key];\n const updatedValue = processValueForExport(inputValue, property as Property, exportType, dateExportType);\n if (updatedValue === undefined) return {};\n return ({ [key]: updatedValue });\n })\n .reduce((a, b) => ({ ...a,\n...b }), {}) as Record<string, unknown>;\n return { ...inputValues,\n...updatedValues };\n}\n\n/**\n * Characters that make a spreadsheet read a cell as a formula rather than text.\n *\n * Quoting is CSV *escaping* and is not enough: Excel, LibreOffice Calc and\n * Sheets strip the CSV quoting at parse time and then evaluate a cell whose\n * first character is one of these — `=HYPERLINK(…)` exfiltrates neighbouring\n * cells on click, `=cmd|'…'!A0` is worse.\n */\nconst FORMULA_TRIGGERS = [\"=\", \"+\", \"-\", \"@\", \"\\t\", \"\\r\"];\n\n/**\n * Neutralise a cell that a spreadsheet would otherwise evaluate, by prefixing a\n * single quote — the standard OWASP mitigation. The apostrophe is consumed by\n * the spreadsheet as \"treat the rest as text\", so the value reads back intact.\n */\nexport function escapeCsvFormula(value: string): string {\n const first = value.charAt(0);\n if (!FORMULA_TRIGGERS.includes(first)) return value;\n // A signed number is not a formula, and prefixing it would turn every\n // negative amount in the file into text. `-1+1` is still neutralised,\n // because it is not a number.\n if ((first === \"-\" || first === \"+\") && value.trim() !== \"\" && Number.isFinite(Number(value))) return value;\n return \"'\" + value;\n}\n\nfunction toCSVCell(v: unknown): string {\n if (v === null || v === undefined) return \"\";\n const s = Array.isArray(v) ? JSON.stringify(v) : String(v);\n return \"\\\"\" + escapeCsvFormula(s).replaceAll(\"\\\"\", \"\\\"\\\"\") + \"\\\"\";\n}\n\nexport function entryToCSVRow(entry: unknown[]) {\n return entry\n .map(toCSVCell)\n .join(\",\") + \"\\r\\n\";\n}\n\nexport function downloadBlob(content: BlobPart[], filename: string, contentType: string) {\n const blob = new Blob(content, { type: contentType });\n const url = URL.createObjectURL(blob);\n const pom = document.createElement(\"a\");\n pom.href = url;\n pom.setAttribute(\"download\", filename);\n pom.click();\n}\n\nexport function downloadDataAsCsv(data: object[], name: string) {\n if (data.length === 0) return;\n\n const headers = Object.keys(data[0]);\n const csvContent = [\n headers.join(\",\"),\n ...data.map(row => headers.map(header => toCSVCell((row as Record<string, unknown>)[header])).join(\",\"))\n ].join(\"\\r\\n\");\n\n downloadBlob([csvContent], `${name}.csv`, \"text/csv\");\n}\n","import { Entity, FindParams, FindResponse } from \"@rebasepro/types\";\n\n/**\n * Rows asked for per request.\n *\n * Kept at or below the server's `MAX_LIST_LIMIT`, which is now the largest page\n * a read will serve *and refuses* anything larger — it used to clamp silently,\n * and asking for 100 000 while receiving 1 000 looked exactly like a collection\n * with 1 000 rows in it. The walk still never trusts the page size it asked for:\n * it advances by the rows it was actually handed.\n */\nexport const EXPORT_PAGE_SIZE = 500;\n\n/**\n * Most rows one browser-side export will materialise.\n *\n * Everything here is built in memory and handed to a Blob, so there is a\n * ceiling whether or not it is named. Naming it means going over it **throws**\n * instead of writing a short file that reads like the whole collection.\n */\nexport const MAX_EXPORT_ROWS = 100_000;\n\nexport interface FetchAllForExportParams<M extends Record<string, unknown>> {\n /** The collection accessor to read through — `dataClient.collection(path)`. */\n accessor: { find(params?: FindParams<M>): Promise<FindResponse<M>> };\n /** Query to export. The window (`limit` / `offset` / `page`) is owned by the walk. */\n params?: Omit<FindParams<M>, \"limit\" | \"offset\" | \"page\">;\n pageSize?: number;\n maxRows?: number;\n /** Called after every page with the rows so far, and the total when the server reports one. */\n onProgress?: (loaded: number, total: number | undefined) => void;\n}\n\n/**\n * Read **every** row matching a query, one page at a time.\n *\n * `find({})` sends no `limit`, and an absent limit is resolved server-side to\n * `DEFAULT_LIST_LIMIT` — 50 rows. The export used to hand those 50 rows back as\n * `<collection>.csv` with nothing saying it was a sample, next to a dialog\n * warning that the collection had 100 000 documents.\n *\n * Termination is driven by the server's `meta.hasMore` where it is reported and\n * by an empty page otherwise — never by comparing a page's length against the\n * requested limit, since a final page that happens to be exactly full is\n * indistinguishable that way and a walk that stops there drops rows.\n *\n * @throws When more than `maxRows` rows match. A truncated export is worse than\n * no export: it is indistinguishable from a complete one.\n */\nexport async function fetchAllEntitiesForExport<M extends Record<string, unknown>>({\n accessor,\n params,\n pageSize = EXPORT_PAGE_SIZE,\n maxRows = MAX_EXPORT_ROWS,\n onProgress\n}: FetchAllForExportParams<M>): Promise<Entity<M>[]> {\n\n const rows: Entity<M>[] = [];\n let offset = 0;\n\n for (;;) {\n const res = await accessor.find({\n ...params,\n limit: pageSize,\n offset\n } as FindParams<M>);\n\n const page = res?.data ?? [];\n rows.push(...page);\n onProgress?.(rows.length, res?.meta?.total);\n\n if (rows.length > maxRows) {\n throw new Error(\n `This export would contain more than ${maxRows.toLocaleString()} rows, which is more than the ` +\n \"browser can build in one file. Filter the collection down, or export it from the server.\"\n );\n }\n\n // An empty page ends the walk whatever the metadata says, so a server\n // that keeps answering `hasMore` cannot spin forever.\n if (page.length === 0) break;\n if (res?.meta && !res.meta.hasMore) break;\n\n // By rows received, not by `pageSize`: a server whose ceiling is lower\n // than the page we asked for would otherwise skip everything it clamped.\n offset += page.length;\n }\n\n return rows;\n}\n","\nimport React, { useCallback } from \"react\";\n\nimport { useTranslation } from \"@rebasepro/app\";\nimport { Entity, Properties } from \"@rebasepro/types\";\nimport {\n BooleanSwitchWithLabel,\n Button,\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n DownloadIcon,\n IconButton,\n Label,\n RadioGroup,\n RadioGroupItem,\n Tooltip,\n Typography\n} from \"@rebasepro/ui\";\nimport { downloadEntitiesExport } from \"./export\";\n\nexport type BasicExportActionProps = {\n data: Entity<any>[];\n properties: Properties;\n propertiesOrder?: string[];\n}\n\nexport function BasicExportAction({\n data,\n properties,\n propertiesOrder\n}: BasicExportActionProps) {\n\n const { t } = useTranslation();\n const dateRef = React.useRef<Date>(new Date());\n const [flattenArrays, setFlattenArrays] = React.useState<boolean>(true);\n const [exportType, setExportType] = React.useState<\"csv\" | \"json\">(\"csv\");\n const [dateExportType, setDateExportType] = React.useState<\"timestamp\" | \"string\">(\"string\");\n\n const [open, setOpen] = React.useState(false);\n\n const handleClickOpen = useCallback(() => {\n setOpen(true);\n }, [setOpen]);\n\n const handleClose = useCallback(() => {\n setOpen(false);\n }, [setOpen]);\n\n const onOkClicked = useCallback(() => {\n downloadEntitiesExport({\n data,\n additionalData: [],\n properties,\n propertiesOrder,\n name: \"export.csv\",\n flattenArrays,\n additionalHeaders: [],\n exportType,\n dateExportType\n });\n handleClose();\n }, []);\n\n return <>\n\n <Tooltip title={\"Export\"}\n asChild={true}>\n <IconButton\n size={\"small\"}\n color={\"primary\"} onClick={handleClickOpen}>\n <DownloadIcon\n size={\"small\"}/>\n </IconButton>\n </Tooltip>\n\n <Dialog\n open={open}\n onOpenChange={setOpen}\n maxWidth={\"xl\"}>\n\n <DialogTitle variant={\"h6\"}>{t(\"export_data\")}</DialogTitle>\n\n <DialogContent className={\"flex flex-col gap-4 my-4\"}>\n\n <div>{t(\"download_table_csv\")}</div>\n\n <div className={\"flex flex-row gap-4\"}>\n <div className={\"p-4 flex flex-col\"}>\n <RadioGroup value={exportType} onValueChange={(v) => setExportType(v as \"csv\" | \"json\")}>\n <div className=\"flex items-center gap-2\">\n <RadioGroupItem value=\"csv\" id=\"radio-csv\"/>\n <Label htmlFor=\"radio-csv\">{t(\"csv\")}</Label>\n </div>\n <div className=\"flex items-center gap-2\">\n <RadioGroupItem value=\"json\" id=\"radio-json\"/>\n <Label htmlFor=\"radio-json\">{t(\"json\")}</Label>\n </div>\n </RadioGroup>\n </div>\n\n <div className={\"p-4 flex flex-col\"}>\n <RadioGroup value={dateExportType} onValueChange={(v) => setDateExportType(v as \"timestamp\" | \"string\")}>\n <div className=\"flex items-center gap-2\">\n <RadioGroupItem value=\"timestamp\" id=\"radio-timestamp\"/>\n <Label htmlFor=\"radio-timestamp\">{t(\"dates_as_timestamps\")} ({dateRef.current.getTime()})</Label>\n </div>\n <div className=\"flex items-center gap-2\">\n <RadioGroupItem value=\"string\" id=\"radio-string\"/>\n <Label htmlFor=\"radio-string\">{t(\"dates_as_strings\")} ({dateRef.current.toISOString()})</Label>\n </div>\n </RadioGroup>\n </div>\n </div>\n\n <BooleanSwitchWithLabel\n size={\"small\"}\n disabled={exportType !== \"csv\"}\n value={flattenArrays}\n onValueChange={setFlattenArrays}\n label={t(\"flatten_arrays\")}/>\n\n </DialogContent>\n\n <DialogActions>\n\n <Button onClick={handleClose}\n variant={\"text\"}>\n {t(\"cancel\")}\n </Button>\n\n <Button onClick={onOkClicked}>\n {t(\"download\")}\n </Button>\n\n </DialogActions>\n\n </Dialog>\n\n </>;\n}\n","\nimport React, { useCallback } from \"react\";\n\nimport {\n useAuthController,\n useCustomizationController,\n useData,\n useTranslation\n} from \"@rebasepro/app\";\nimport { useAdminContext } from \"../../hooks\";\nimport { Entity, User } from \"@rebasepro/types\";\nimport { CollectionActionsProps, ExportConfig, RebaseContext, AdminCollection } from \"@rebasepro/admin-types\";\nimport { getDefaultValuesFor } from \"@rebasepro/common\";\nimport {\n Alert,\n BooleanSwitchWithLabel,\n Button,\n CircularProgress,\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n DownloadIcon,\n IconButton,\n iconSize,\n Label,\n RadioGroup,\n RadioGroupItem,\n Tooltip\n} from \"@rebasepro/ui\";\nimport { downloadEntitiesExport } from \"./export\";\nimport { fetchAllEntitiesForExport, MAX_EXPORT_ROWS } from \"./fetch_export_data\";\n\nconst DOCS_LIMIT = 500;\n\n/**\n * Additional-field builders run per row and may do I/O, so a `Promise.all` over\n * the whole export is one request per row all at once. That was bounded only by\n * the 50-row cap the export used to have; now that the read is paginated, it is\n * bounded here instead.\n */\nconst ADDITIONAL_FIELDS_CONCURRENCY = 50;\n\nasync function mapInChunks<T, R>(items: T[], fn: (item: T) => Promise<R>, chunkSize = ADDITIONAL_FIELDS_CONCURRENCY): Promise<R[]> {\n const results: R[] = [];\n for (let i = 0; i < items.length; i += chunkSize) {\n results.push(...await Promise.all(items.slice(i, i + chunkSize).map(fn)));\n }\n return results;\n}\n\nexport function ExportCollectionAction<M extends Record<string, unknown>, USER extends User>({\n collection,\n path,\n collectionEntitiesCount,\n onAnalyticsEvent,\n exportAllowed,\n notAllowedView\n}: CollectionActionsProps<M, USER, AdminCollection<M>> & {\n exportAllowed?: (props: { collectionEntitiesCount: number, path: string, collection: AdminCollection }) => boolean;\n notAllowedView?: React.ReactNode;\n onAnalyticsEvent?: (event: string, params?: any) => void;\n}) {\n\n const { t } = useTranslation();\n\n const exportConfig = typeof collection.exportable === \"object\" ? collection.exportable : undefined;\n\n const dateRef = React.useRef<Date>(new Date());\n\n const [includeUndefinedValues, setIncludeUndefinedValues] = React.useState<boolean>(false);\n const [flattenArrays, setFlattenArrays] = React.useState<boolean>(true);\n const [exportType, setExportType] = React.useState<\"csv\" | \"json\">(\"csv\");\n const [dateExportType, setDateExportType] = React.useState<\"timestamp\" | \"string\">(\"string\");\n\n const context = useAdminContext<USER>();\n const dataClient = useData();\n\n // Said before the download starts, not discovered halfway through it: the\n // walk refuses rather than writing a short file, so the dialog has to name\n // the ceiling it is about to hit.\n const tooManyToExport = collectionEntitiesCount !== undefined && collectionEntitiesCount > MAX_EXPORT_ROWS;\n\n const canExport = !exportAllowed || exportAllowed({\n collectionEntitiesCount: collectionEntitiesCount ?? 0,\n path,\n collection\n });\n\n const [dataLoading, setDataLoading] = React.useState<boolean>(false);\n const [dataLoadingError, setDataLoadingError] = React.useState<Error | undefined>();\n const [progress, setProgress] = React.useState<{ loaded: number, total?: number }>({ loaded: 0 });\n\n const [open, setOpen] = React.useState(false);\n\n const handleClickOpen = useCallback(() => {\n setOpen(true);\n }, [setOpen]);\n\n const handleClose = useCallback(() => {\n setOpen(false);\n }, [setOpen]);\n\n const fetchAdditionalFields = useCallback(async (entities: Entity<M>[]) => {\n\n const additionalExportFields = exportConfig?.additionalFields;\n const additionalFields = collection.additionalFields;\n\n const resolvedExportColumnsValues: Record<string, any>[] = additionalExportFields\n ? await mapInChunks(entities, async (entity) => {\n return (await Promise.all(additionalExportFields.map(async (column) => {\n return {\n [column.key]: await column.builder({\n entity,\n context: context as RebaseContext\n })\n };\n }))).reduce((a, b) => ({ ...a,\n...b }), {});\n })\n : [];\n\n const resolvedColumnsValues: Record<string, any>[] = additionalFields\n ? await mapInChunks(entities, async (entity) => {\n return (await Promise.all(additionalFields\n .map(async (field) => {\n if (!field.value)\n return {};\n return {\n [field.key]: await field.value({\n entity,\n context: context as RebaseContext\n })\n };\n }))).reduce((a, b) => ({ ...a,\n...b }), {});\n })\n : [];\n return [...resolvedExportColumnsValues, ...resolvedColumnsValues];\n }, [exportConfig?.additionalFields]);\n\n const doDownload = useCallback(async (collection: AdminCollection<M>,\n exportConfig: ExportConfig<any> | undefined): Promise<boolean> => {\n\n onAnalyticsEvent?.(\"export_collection\", {\n collection: collection.slug\n });\n setDataLoading(true);\n setDataLoadingError(undefined);\n setProgress({ loaded: 0 });\n try {\n // Paginated, not `find({})`: an absent limit resolves to 50 rows\n // server-side, so the export used to be the first page of the\n // collection under a filename that read like all of it.\n const data = await fetchAllEntitiesForExport<M>({\n accessor: dataClient.collection(path) as { find: (params?: any) => Promise<any> },\n onProgress: (loaded, total) => setProgress({ loaded,\n total })\n });\n const additionalData = await fetchAdditionalFields(data);\n const additionalHeaders = [\n ...exportConfig?.additionalFields?.map(column => column.key) ?? [],\n ...collection.additionalFields?.map(field => field.key) ?? []\n ];\n\n const defaultValues = includeUndefinedValues ? getDefaultValuesFor(collection.properties) : undefined;\n const dataWithDefaults = defaultValues\n ? data.map(entity => ({\n ...entity,\n values: { ...defaultValues,\n...entity.values }\n }))\n : data;\n downloadEntitiesExport({\n data: dataWithDefaults,\n additionalData,\n properties: collection.properties,\n propertiesOrder: collection.propertiesOrder,\n name: collection.name,\n flattenArrays,\n additionalHeaders,\n exportType,\n dateExportType\n });\n onAnalyticsEvent?.(\"export_collection_success\", {\n collection: collection.slug\n });\n return true;\n } catch (e) {\n console.error(\"Error loading export data\", e);\n setDataLoadingError(e as Error);\n return false;\n } finally {\n setDataLoading(false);\n }\n\n }, [onAnalyticsEvent, dataClient, path, fetchAdditionalFields, includeUndefinedValues, flattenArrays, exportType, dateExportType]);\n\n const onOkClicked = useCallback(() => {\n // The dialog stays open until the walk finishes: it is the only place a\n // multi-page export reports progress, or reports that it failed.\n doDownload(collection, exportConfig).then((downloaded) => {\n if (downloaded) handleClose();\n });\n }, [doDownload, collection, exportConfig, handleClose]);\n\n return <>\n\n <Tooltip title={\"Export\"}\n asChild={true}>\n <IconButton\n size={\"small\"}\n color={\"primary\"}\n onClick={handleClickOpen}>\n <DownloadIcon size={iconSize.small}/>\n </IconButton>\n </Tooltip>\n\n <Dialog\n open={open}\n onOpenChange={setOpen}\n maxWidth={\"xl\"}>\n\n <DialogTitle variant={\"h6\"}>{t(\"export_data\")}</DialogTitle>\n\n <DialogContent className={\"flex flex-col gap-4 my-4\"}>\n\n <div>{t(\"download_table_csv\")}</div>\n\n {collectionEntitiesCount !== undefined && collectionEntitiesCount > DOCS_LIMIT && !tooManyToExport &&\n <Alert color={\"warning\"}>\n <div>\n {t(\"large_number_of_documents\", { count: collectionEntitiesCount.toString() })}\n </div>\n </Alert>}\n\n {tooManyToExport &&\n <Alert color={\"error\"}>\n <div>\n {t(\"too_many_documents_to_export\", {\n count: (collectionEntitiesCount ?? 0).toString(),\n limit: MAX_EXPORT_ROWS.toString()\n })}\n </div>\n </Alert>}\n\n <div className={\"flex flex-row gap-4\"}>\n <div className={\"p-4 flex flex-col\"}>\n <RadioGroup value={exportType} onValueChange={(v) => setExportType(v as \"csv\" | \"json\")}>\n <div className=\"flex items-center gap-2\">\n <RadioGroupItem value=\"csv\" id=\"radio-csv\"/>\n <Label htmlFor=\"radio-csv\">{t(\"csv\")}</Label>\n </div>\n <div className=\"flex items-center gap-2\">\n <RadioGroupItem value=\"json\" id=\"radio-json\"/>\n <Label htmlFor=\"radio-json\">{t(\"json\")}</Label>\n </div>\n </RadioGroup>\n </div>\n\n <div className={\"p-4 flex flex-col\"}>\n <RadioGroup value={dateExportType} onValueChange={(v) => setDateExportType(v as \"timestamp\" | \"string\")}>\n <div className=\"flex items-center gap-2\">\n <RadioGroupItem value=\"timestamp\" id=\"radio-timestamp\"/>\n <Label htmlFor=\"radio-timestamp\">{t(\"dates_as_timestamps\")} ({dateRef.current.getTime()})</Label>\n </div>\n <div className=\"flex items-center gap-2\">\n <RadioGroupItem value=\"string\" id=\"radio-string\"/>\n <Label htmlFor=\"radio-string\">{t(\"dates_as_strings\")} ({dateRef.current.toISOString()})</Label>\n </div>\n </RadioGroup>\n </div>\n </div>\n\n <BooleanSwitchWithLabel\n size={\"small\"}\n disabled={exportType !== \"csv\"}\n value={flattenArrays}\n onValueChange={setFlattenArrays}\n label={t(\"flatten_arrays\")}/>\n\n <BooleanSwitchWithLabel\n size={\"small\"}\n value={includeUndefinedValues}\n onValueChange={setIncludeUndefinedValues}\n label={t(\"include_undefined_values\")}/>\n\n {dataLoadingError && <Alert color={\"error\"}>\n <div>{dataLoadingError.message}</div>\n </Alert>}\n\n {!canExport && notAllowedView}\n\n </DialogContent>\n\n <DialogActions>\n\n {dataLoading && <CircularProgress size={\"smallest\"}/>}\n\n {dataLoading && <Label>\n {progress.total !== undefined\n ? `${progress.loaded} / ${progress.total}`\n : `${progress.loaded}`}\n </Label>}\n\n <Button onClick={handleClose}\n variant={\"text\"}>\n {t(\"cancel\")}\n </Button>\n\n <Button onClick={onOkClicked}\n disabled={dataLoading || !canExport || tooManyToExport}>\n {t(\"download\")}\n </Button>\n\n </DialogActions>\n\n </Dialog>\n\n </>;\n}\n","export * from \"./export\";\nexport * from \"./fetch_export_data\";\nexport * from \"./BasicExportAction\";\nexport * from \"./ExportCollectionAction\";\n"],"mappings":";;;;;;;;;AAoBA,SAAgB,uBAA0D,EACtE,MACA,gBACA,YACA,iBACA,MACA,eACA,mBACA,YACA,kBAEF;CAEE,QAAQ,MAAM,sBAAsB;EAChC,YAAY,KAAK;EACjB;EACA;EACA;CACJ,CAAC;CAED,IAAI,eAAe,OAAO;EAEtB,MAAM,UAAU,iBAAiB,YAAY,iBAAiB,mBADrC,gBAAgB,oBAAoB,KAAK,KAAI,MAAK,EAAE,MAAM,CAAC,IAAI,CAAC,CACQ;EACjG,MAAM,iBAAiB,2BAA2B,MAAM,gBAAgB,YAAY,SAAS,cAAc;EAG3G,aAAa,CAFO,cAAc,QAAQ,KAAI,MAAK,EAAE,KAAK,CAE5C,GAAa,GADX,eAAe,KAA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IAEP,oBAAC,QAAD;KAAQ,SAAS;KACb,SAAS;eACR,EAAE,QAAQ;IACP,CAAA;IAER,oBAAC,QAAD;KAAQ,SAAS;KACb,UAAU,eAAe,CAAC,aAAa;eACtC,EAAE,UAAU;IACT,CAAA;GAEG,EAAA,CAAA;EAEX;GAEV,EAAA,CAAA;AACN"}
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import type { EntityFormProps } from "../types/components/EntityFormProps";
2
+ import type { EntityFormProps } from "../types/components/EntityFormProps.js";
3
3
  /**
4
4
  * Headless entity form component.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import type { EntityFormActionsProps } from "../types/components/EntityFormActionsProps";
2
+ import type { EntityFormActionsProps } from "../types/components/EntityFormActionsProps.js";
3
3
  /**
4
4
  * The form's own action bar.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import type { EntityFormProps } from "../types/components/EntityFormProps";
2
+ import type { EntityFormProps } from "../types/components/EntityFormProps.js";
3
3
  /**
4
4
  * Props for the admin-connected EntityFormBinding wrapper.
5
5
  * Extends EntityFormProps — you can pass all the same props as EntityForm,
@@ -1,4 +1,4 @@
1
- import type { PropertyFieldBindingProps } from "../types/fields";
1
+ import type { PropertyFieldBindingProps } from "../types/fields.js";
2
2
  import { ReactElement } from "react";
3
3
  /**
4
4
  * This component renders a form field creating the corresponding configuration
@@ -1,6 +1,6 @@
1
1
  import type { StringProperty } from "@rebasepro/types";
2
2
  import React from "react";
3
- import { PreviewSize } from "../../types/components/PropertyPreviewProps";
3
+ import { PreviewSize } from "../../types/components/PropertyPreviewProps.js";
4
4
  interface StorageItemPreviewProps {
5
5
  name: string;
6
6
  property: StringProperty;
@@ -1,6 +1,6 @@
1
- export * from "./FieldHelperText";
2
- export * from "./LabelWithIcon";
3
- export * from "./LabelWithIconAndTooltip";
4
- export * from "./FieldBlock";
5
- export * from "./FormRail";
6
- export * from "./FormSections";
1
+ export * from "./FieldHelperText.js";
2
+ export * from "./LabelWithIcon.js";
3
+ export * from "./LabelWithIconAndTooltip.js";
4
+ export * from "./FieldBlock.js";
5
+ export * from "./FormRail.js";
6
+ export * from "./FormSections.js";
@@ -1,4 +1,4 @@
1
- import type { FieldProps } from "../../types/fields";
1
+ import type { FieldProps } from "../../types/fields.js";
2
2
  import type { ArrayProperty } from "@rebasepro/types";
3
3
  import React from "react";
4
4
  /**
@@ -1,4 +1,4 @@
1
- import type { FieldProps } from "../../types/fields";
1
+ import type { FieldProps } from "../../types/fields.js";
2
2
  import type { ArrayProperty } from "@rebasepro/types";
3
3
  import React from "react";
4
4
  import { EntityReference } from "@rebasepro/types";
@@ -1,4 +1,4 @@
1
- import type { FieldProps } from "../../types/fields";
1
+ import type { FieldProps } from "../../types/fields.js";
2
2
  import type { BinaryProperty } from "@rebasepro/types";
3
3
  import React from "react";
4
4
  /** Base64, optionally padded. Empty is allowed — that is a cleared field. */
@@ -1,4 +1,4 @@
1
- import type { FieldProps } from "../../types/fields";
1
+ import type { FieldProps } from "../../types/fields.js";
2
2
  import type { ArrayProperty } from "@rebasepro/types";
3
3
  import React from "react";
4
4
  /**
@@ -1,4 +1,4 @@
1
- import type { FieldProps } from "../../types/fields";
1
+ import type { FieldProps } from "../../types/fields.js";
2
2
  import type { DateProperty } from "@rebasepro/types";
3
3
  import React from "react";
4
4
  type DateTimeFieldProps = FieldProps<DateProperty>;
@@ -1,4 +1,4 @@
1
- import type { FieldProps } from "../../types/fields";
1
+ import type { FieldProps } from "../../types/fields.js";
2
2
  import type { GeopointProperty } from "@rebasepro/types";
3
3
  import React from "react";
4
4
  interface Coordinates {
@@ -1,4 +1,4 @@
1
- import type { FieldProps } from "../../types/fields";
1
+ import type { FieldProps } from "../../types/fields.js";
2
2
  import type { MapProperty } from "@rebasepro/types";
3
3
  import React from "react";
4
4
  /**
@@ -1,4 +1,4 @@
1
- import type { FieldProps } from "../../types/fields";
1
+ import type { FieldProps } from "../../types/fields.js";
2
2
  import type { MapProperty } from "@rebasepro/types";
3
3
  import React from "react";
4
4
  /**
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
- import type { FieldProps } from "../../types/fields";
2
+ import type { FieldProps } from "../../types/fields.js";
3
3
  import type { StringProperty } from "@rebasepro/types";
4
- import type { RichTextEditorProps } from "../../editor";
4
+ import type { RichTextEditorProps } from "../../editor/index.js";
5
5
  interface MarkdownEditorFieldProps {
6
6
  highlight?: {
7
7
  from: number;
@@ -1,4 +1,4 @@
1
- import type { FieldProps } from "../../types/fields";
1
+ import type { FieldProps } from "../../types/fields.js";
2
2
  import type { ArrayProperty } from "@rebasepro/types";
3
3
  import React from "react";
4
4
  /**
@@ -1,4 +1,4 @@
1
- import type { FieldProps } from "../../types/fields";
1
+ import type { FieldProps } from "../../types/fields.js";
2
2
  import type { RelationProperty } from "@rebasepro/types";
3
3
  import React from "react";
4
4
  /**
@@ -1,4 +1,4 @@
1
- import type { FieldProps } from "../../types/fields";
1
+ import type { FieldProps } from "../../types/fields.js";
2
2
  import type { Property } from "@rebasepro/types";
3
3
  import React from "react";
4
4
  /**
@@ -1,4 +1,4 @@
1
- import type { FieldProps } from "../../types/fields";
1
+ import type { FieldProps } from "../../types/fields.js";
2
2
  import type { ReferenceProperty } from "@rebasepro/types";
3
3
  import React from "react";
4
4
  /**
@@ -1,4 +1,4 @@
1
- import type { FieldProps } from "../../types/fields";
1
+ import type { FieldProps } from "../../types/fields.js";
2
2
  import type { RelationProperty } from "@rebasepro/types";
3
3
  import React from "react";
4
4
  export declare function RelationFieldBinding(props: FieldProps<RelationProperty>): React.JSX.Element;
@@ -1,4 +1,4 @@
1
- import type { FieldProps } from "../../types/fields";
1
+ import type { FieldProps } from "../../types/fields.js";
2
2
  import type { ArrayProperty } from "@rebasepro/types";
3
3
  import React from "react";
4
4
  /**
@@ -1,4 +1,4 @@
1
- import type { FieldProps } from "../../types/fields";
1
+ import type { FieldProps } from "../../types/fields.js";
2
2
  import type { NumberProperty, StringProperty } from "@rebasepro/types";
3
3
  import React from "react";
4
4
  /**
@@ -1,4 +1,4 @@
1
- import type { FieldProps } from "../../types/fields";
1
+ import type { FieldProps } from "../../types/fields.js";
2
2
  import type { ArrayProperty, StringProperty } from "@rebasepro/types";
3
3
  import React from "react";
4
4
  import { StorageConfig } from "@rebasepro/types";
@@ -1,4 +1,4 @@
1
- import type { FieldProps } from "../../types/fields";
1
+ import type { FieldProps } from "../../types/fields.js";
2
2
  import type { BooleanProperty } from "@rebasepro/types";
3
3
  import React from "react";
4
4
  /**
@@ -1,4 +1,4 @@
1
- import type { FieldProps } from "../../types/fields";
1
+ import type { FieldProps } from "../../types/fields.js";
2
2
  import type { NumberProperty, StringProperty } from "@rebasepro/types";
3
3
  import React from "react";
4
4
  /**
@@ -1,4 +1,4 @@
1
- import type { FieldProps } from "../../types/fields";
1
+ import type { FieldProps } from "../../types/fields.js";
2
2
  import type { StringProperty } from "@rebasepro/types";
3
3
  import React from "react";
4
4
  type UserSelectProps = FieldProps<StringProperty>;
@@ -1,4 +1,4 @@
1
- import type { FieldProps } from "../../types/fields";
1
+ import type { FieldProps } from "../../types/fields.js";
2
2
  import type { VectorProperty } from "@rebasepro/types";
3
3
  import React from "react";
4
4
  /**
@@ -1,24 +1,24 @@
1
- export { EntityForm } from "./EntityForm";
2
- export type { EntityFormProps, OnUpdateParams } from "../types/components/EntityFormProps";
3
- export { EntityFormBinding } from "./EntityFormBinding";
4
- export type { EntityFormBindingProps } from "./EntityFormBinding";
5
- export { SelectFieldBinding } from "./field_bindings/SelectFieldBinding";
6
- export { MultiSelectFieldBinding } from "./field_bindings/MultiSelectFieldBinding";
7
- export { ArrayOfReferencesFieldBinding } from "./field_bindings/ArrayOfReferencesFieldBinding";
8
- export { StorageUploadFieldBinding } from "./field_bindings/StorageUploadFieldBinding";
9
- export { TextFieldBinding } from "./field_bindings/TextFieldBinding";
10
- export { SwitchFieldBinding } from "./field_bindings/SwitchFieldBinding";
11
- export { DateTimeFieldBinding } from "./field_bindings/DateTimeFieldBinding";
12
- export { ReferenceFieldBinding } from "./field_bindings/ReferenceFieldBinding";
13
- export { MapFieldBinding } from "./field_bindings/MapFieldBinding";
14
- export { KeyValueFieldBinding } from "./field_bindings/KeyValueFieldBinding";
15
- export { RepeatFieldBinding } from "./field_bindings/RepeatFieldBinding";
16
- export { BlockFieldBinding } from "./field_bindings/BlockFieldBinding";
17
- export { ReadOnlyFieldBinding } from "./field_bindings/ReadOnlyFieldBinding";
18
- export { MarkdownEditorFieldBinding } from "./field_bindings/MarkdownEditorFieldBinding";
19
- export { ArrayCustomShapedFieldBinding } from "./field_bindings/ArrayCustomShapedFieldBinding";
20
- export { VectorFieldBinding } from "./field_bindings/VectorFieldBinding";
21
- export * from "./components";
22
- export { PropertyFieldBinding } from "./PropertyFieldBinding";
23
- export * from "./useClearRestoreValue";
24
- export { extractTouchedValues, removeEmptyContainers, getChanges, getInitialEntityValues, zodToFormErrors } from "./form_utils";
1
+ export { EntityForm } from "./EntityForm.js";
2
+ export type { EntityFormProps, OnUpdateParams } from "../types/components/EntityFormProps.js";
3
+ export { EntityFormBinding } from "./EntityFormBinding.js";
4
+ export type { EntityFormBindingProps } from "./EntityFormBinding.js";
5
+ export { SelectFieldBinding } from "./field_bindings/SelectFieldBinding.js";
6
+ export { MultiSelectFieldBinding } from "./field_bindings/MultiSelectFieldBinding.js";
7
+ export { ArrayOfReferencesFieldBinding } from "./field_bindings/ArrayOfReferencesFieldBinding.js";
8
+ export { StorageUploadFieldBinding } from "./field_bindings/StorageUploadFieldBinding.js";
9
+ export { TextFieldBinding } from "./field_bindings/TextFieldBinding.js";
10
+ export { SwitchFieldBinding } from "./field_bindings/SwitchFieldBinding.js";
11
+ export { DateTimeFieldBinding } from "./field_bindings/DateTimeFieldBinding.js";
12
+ export { ReferenceFieldBinding } from "./field_bindings/ReferenceFieldBinding.js";
13
+ export { MapFieldBinding } from "./field_bindings/MapFieldBinding.js";
14
+ export { KeyValueFieldBinding } from "./field_bindings/KeyValueFieldBinding.js";
15
+ export { RepeatFieldBinding } from "./field_bindings/RepeatFieldBinding.js";
16
+ export { BlockFieldBinding } from "./field_bindings/BlockFieldBinding.js";
17
+ export { ReadOnlyFieldBinding } from "./field_bindings/ReadOnlyFieldBinding.js";
18
+ export { MarkdownEditorFieldBinding } from "./field_bindings/MarkdownEditorFieldBinding.js";
19
+ export { ArrayCustomShapedFieldBinding } from "./field_bindings/ArrayCustomShapedFieldBinding.js";
20
+ export { VectorFieldBinding } from "./field_bindings/VectorFieldBinding.js";
21
+ export * from "./components/index.js";
22
+ export { PropertyFieldBinding } from "./PropertyFieldBinding.js";
23
+ export * from "./useClearRestoreValue.js";
24
+ export { extractTouchedValues, removeEmptyContainers, getChanges, getInitialEntityValues, zodToFormErrors } from "./form_utils.js";
@@ -1,4 +1,4 @@
1
- import { Cn as PropertyPreview, Sr as getPropertyInPath$1, Y as useHistory } from "./util-C4qsI1QV.js";
1
+ import { Dr as getPropertyInPath$1, On as PropertyPreview, et as useHistory } from "./util-wrBH4QSB.js";
2
2
  import * as React$1 from "react";
3
3
  import { useEffect, useRef, useState } from "react";
4
4
  import { ArrowLeftIcon, Chip, ErrorBoundary, HistoryIcon, IconButton, Label, Tooltip, Typography, cls, defaultBorderMixin, iconSize } from "@rebasepro/ui";
@@ -310,4 +310,4 @@ function EntityHistoryView({ entity, collection, formContext, refreshToken }) {
310
310
  //#endregion
311
311
  export { EntityHistoryView };
312
312
 
313
- //# sourceMappingURL=history-C2cqc0bw.js.map
313
+ //# sourceMappingURL=history-C7WF14VR.js.map