@rebasepro/cms 0.24.0 → 0.24.1-canary.gcb918fc
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 +3 -1
- package/dist/collection_editor/CollectionEditorDialogsContext.js +10 -0
- package/dist/collection_editor/CollectionEditorDialogsContext.js.map +1 -0
- package/dist/collection_editor/ConfigControllerProvider.js +274 -0
- package/dist/collection_editor/ConfigControllerProvider.js.map +1 -0
- package/dist/collection_editor/api/generateCollectionApi.js +64 -0
- package/dist/collection_editor/api/generateCollectionApi.js.map +1 -0
- package/dist/collection_editor/collection_wire.d.ts +13 -0
- package/dist/collection_editor/collection_wire.js +49 -0
- package/dist/collection_editor/collection_wire.js.map +1 -0
- package/dist/collection_editor/liveSchemaClient.js +130 -0
- package/dist/collection_editor/liveSchemaClient.js.map +1 -0
- package/dist/collection_editor/relation_kinds.js +74 -0
- package/dist/collection_editor/relation_kinds.js.map +1 -0
- package/dist/collection_editor/serializable_types.d.ts +4 -1
- package/dist/collection_editor/serializable_utils.js +504 -0
- package/dist/collection_editor/serializable_utils.js.map +1 -0
- package/dist/collection_editor/ui/EditorCollectionAction.js +37 -0
- package/dist/collection_editor/ui/EditorCollectionAction.js.map +1 -0
- package/dist/collection_editor/ui/MissingReferenceWidget.js +39 -0
- package/dist/collection_editor/ui/MissingReferenceWidget.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/AICollectionGeneratorPopover.js +160 -0
- package/dist/collection_editor/ui/collection_editor/AICollectionGeneratorPopover.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/AIModifiedPathsContext.js +61 -0
- package/dist/collection_editor/ui/collection_editor/AIModifiedPathsContext.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionEditorDialog.js +731 -0
- package/dist/collection_editor/ui/collection_editor/CollectionEditorDialog.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionEditorWelcomeView.js +220 -0
- package/dist/collection_editor/ui/collection_editor/CollectionEditorWelcomeView.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionJsonImportDialog.js +160 -0
- package/dist/collection_editor/ui/collection_editor/CollectionJsonImportDialog.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.js +394 -0
- package/dist/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionRLSTab.js +616 -0
- package/dist/collection_editor/ui/collection_editor/CollectionRLSTab.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionStudioView.js +68 -0
- package/dist/collection_editor/ui/collection_editor/CollectionStudioView.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionYupValidation.js +11 -0
- package/dist/collection_editor/ui/collection_editor/CollectionYupValidation.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionsStudioView.js +148 -0
- package/dist/collection_editor/ui/collection_editor/CollectionsStudioView.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/DisplaySettingsForm.js +244 -0
- package/dist/collection_editor/ui/collection_editor/DisplaySettingsForm.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/EnumForm.js +222 -0
- package/dist/collection_editor/ui/collection_editor/EnumForm.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/GeneralSettingsForm.js +204 -0
- package/dist/collection_editor/ui/collection_editor/GeneralSettingsForm.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/GetCodeDialog.js +108 -0
- package/dist/collection_editor/ui/collection_editor/GetCodeDialog.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/KanbanConfigSection.js +163 -0
- package/dist/collection_editor/ui/collection_editor/KanbanConfigSection.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/LayoutModeSwitch.js +59 -0
- package/dist/collection_editor/ui/collection_editor/LayoutModeSwitch.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/PropertyEditView.js +640 -0
- package/dist/collection_editor/ui/collection_editor/PropertyEditView.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/PropertyFieldPreview.js +141 -0
- package/dist/collection_editor/ui/collection_editor/PropertyFieldPreview.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/PropertyTree.js +210 -0
- package/dist/collection_editor/ui/collection_editor/PropertyTree.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/RouterCollectionStudioView.js +31 -0
- package/dist/collection_editor/ui/collection_editor/RouterCollectionStudioView.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/RouterCollectionsStudioView.js +25 -0
- package/dist/collection_editor/ui/collection_editor/RouterCollectionsStudioView.js.map +1 -0
- package/dist/{SchemaChangeDialog-CcFSXvkK.js → collection_editor/ui/collection_editor/SchemaChangeDialog.js} +42 -59
- package/dist/collection_editor/ui/collection_editor/SchemaChangeDialog.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/SwitchControl.js +24 -0
- package/dist/collection_editor/ui/collection_editor/SwitchControl.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/ViewModeSwitch.js +66 -0
- package/dist/collection_editor/ui/collection_editor/ViewModeSwitch.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.js +61 -0
- package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportMapping.js +188 -0
- package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportMapping.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/import/clean_import_data.d.ts +12 -0
- package/dist/collection_editor/ui/collection_editor/import/clean_import_data.js +74 -0
- package/dist/collection_editor/ui/collection_editor/import/clean_import_data.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/BlockPropertyField.js +100 -0
- package/dist/collection_editor/ui/collection_editor/properties/BlockPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/BooleanPropertyField.js +34 -0
- package/dist/collection_editor/ui/collection_editor/properties/BooleanPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/CommonPropertyFields.js +75 -0
- package/dist/collection_editor/ui/collection_editor/properties/CommonPropertyFields.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/DateTimePropertyField.js +338 -0
- package/dist/collection_editor/ui/collection_editor/properties/DateTimePropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/EnumPropertyField.js +83 -0
- package/dist/collection_editor/ui/collection_editor/properties/EnumPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/KeyValuePropertyField.js +15 -0
- package/dist/collection_editor/ui/collection_editor/properties/KeyValuePropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/MapPropertyField.js +121 -0
- package/dist/collection_editor/ui/collection_editor/properties/MapPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/MarkdownPropertyField.js +127 -0
- package/dist/collection_editor/ui/collection_editor/properties/MarkdownPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/NumberPropertyField.js +151 -0
- package/dist/collection_editor/ui/collection_editor/properties/NumberPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/ReferencePropertyField.js +77 -0
- package/dist/collection_editor/ui/collection_editor/properties/ReferencePropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/RelationPropertyField.js +254 -0
- package/dist/collection_editor/ui/collection_editor/properties/RelationPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/RepeatPropertyField.js +71 -0
- package/dist/collection_editor/ui/collection_editor/properties/RepeatPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/StoragePropertyField.js +356 -0
- package/dist/collection_editor/ui/collection_editor/properties/StoragePropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/StringPropertyField.js +173 -0
- package/dist/collection_editor/ui/collection_editor/properties/StringPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/UrlPropertyField.js +79 -0
- package/dist/collection_editor/ui/collection_editor/properties/UrlPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/VectorPropertyField.js +34 -0
- package/dist/collection_editor/ui/collection_editor/properties/VectorPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/advanced/AdvancedPropertyValidation.js +47 -0
- package/dist/collection_editor/ui/collection_editor/properties/advanced/AdvancedPropertyValidation.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/ArrayPropertyValidation.js +47 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/ArrayPropertyValidation.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/GeneralPropertyValidation.js +62 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/GeneralPropertyValidation.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/NumberPropertyValidation.js +119 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/NumberPropertyValidation.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/StringPropertyValidation.d.ts +10 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/StringPropertyValidation.js +178 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/StringPropertyValidation.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/ValidationPanel.js +23 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/ValidationPanel.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/templates/blog_template.js +116 -0
- package/dist/collection_editor/ui/collection_editor/templates/blog_template.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/templates/pages_template.js +182 -0
- package/dist/collection_editor/ui/collection_editor/templates/pages_template.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/templates/products_template.js +87 -0
- package/dist/collection_editor/ui/collection_editor/templates/products_template.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/templates/users_template.js +46 -0
- package/dist/collection_editor/ui/collection_editor/templates/users_template.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/util.js +20 -0
- package/dist/collection_editor/ui/collection_editor/util.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/utils/strings.js +2 -0
- package/dist/collection_editor/ui/collection_editor/utils/supported_fields.js +37 -0
- package/dist/collection_editor/ui/collection_editor/utils/supported_fields.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/utils/update_property_for_widget.js +192 -0
- package/dist/collection_editor/ui/collection_editor/utils/update_property_for_widget.js.map +1 -0
- package/dist/collection_editor/useCollectionEditorController.js +12 -0
- package/dist/collection_editor/useCollectionEditorController.js.map +1 -0
- package/dist/collection_editor/useCollectionsConfigController.js +12 -0
- package/dist/collection_editor/useCollectionsConfigController.js.map +1 -0
- package/dist/collection_editor/useJsonCollectionsConfigController.js +191 -0
- package/dist/collection_editor/useJsonCollectionsConfigController.js.map +1 -0
- package/dist/collection_editor/useLiveSchemaEditing.js +214 -0
- package/dist/collection_editor/useLiveSchemaEditing.js.map +1 -0
- package/dist/collection_editor/useLocalCollectionsConfigController.js +228 -0
- package/dist/collection_editor/useLocalCollectionsConfigController.js.map +1 -0
- package/dist/collection_editor/useSafeSnackbarController.js +13 -0
- package/dist/collection_editor/useSafeSnackbarController.js.map +1 -0
- package/dist/collection_editor/validateCollectionJson.js +289 -0
- package/dist/collection_editor/validateCollectionJson.js.map +1 -0
- package/dist/collection_editor_ui.js +7 -33
- package/dist/components/AdditionalFieldValue.js +60 -0
- package/dist/components/AdditionalFieldValue.js.map +1 -0
- package/dist/components/AdminModeSyncer.js +41 -0
- package/dist/components/AdminModeSyncer.js.map +1 -0
- package/dist/components/ArrayContainer.d.ts +8 -2
- package/dist/components/ArrayContainer.js +363 -0
- package/dist/components/ArrayContainer.js.map +1 -0
- package/dist/components/ClearFilterSortButton.js +33 -0
- package/dist/components/ClearFilterSortButton.js.map +1 -0
- package/dist/components/CollectionEditorDialogs.js +49 -0
- package/dist/components/CollectionEditorDialogs.js.map +1 -0
- package/dist/components/CollectionPanel.d.ts +26 -5
- package/dist/components/CollectionPanel.js +142 -0
- package/dist/components/CollectionPanel.js.map +1 -0
- package/dist/components/CollectionTableBinding/CollectionRowActions.js +165 -0
- package/dist/components/CollectionTableBinding/CollectionRowActions.js.map +1 -0
- package/dist/components/CollectionTableBinding/CollectionTableBinding.js +329 -0
- package/dist/components/CollectionTableBinding/CollectionTableBinding.js.map +1 -0
- package/dist/components/CollectionTableBinding/PropertyTableCell.js +311 -0
- package/dist/components/CollectionTableBinding/PropertyTableCell.js.map +1 -0
- package/dist/components/CollectionTableBinding/column_utils.js +85 -0
- package/dist/components/CollectionTableBinding/column_utils.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/CompactEntityCellField.js +45 -0
- package/dist/components/CollectionTableBinding/fields/CompactEntityCellField.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/TableMultipleRelationField.js +66 -0
- package/dist/components/CollectionTableBinding/fields/TableMultipleRelationField.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/TableReferenceField.js +86 -0
- package/dist/components/CollectionTableBinding/fields/TableReferenceField.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/TableRelationField.js +93 -0
- package/dist/components/CollectionTableBinding/fields/TableRelationField.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/TableRelationSelectorField.js +33 -0
- package/dist/components/CollectionTableBinding/fields/TableRelationSelectorField.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/TableStorageUpload.js +171 -0
- package/dist/components/CollectionTableBinding/fields/TableStorageUpload.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/VirtualTableSelect.js +91 -0
- package/dist/components/CollectionTableBinding/fields/VirtualTableSelect.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/VirtualTableUserSelect.js +36 -0
- package/dist/components/CollectionTableBinding/fields/VirtualTableUserSelect.js.map +1 -0
- package/dist/components/CollectionTableBinding/index.js +6 -0
- package/dist/components/CollectionTableBinding/internal/CollectionTableToolbar.js +50 -0
- package/dist/components/CollectionTableBinding/internal/CollectionTableToolbar.js.map +1 -0
- package/dist/components/CollectionTableBinding/internal/EntityTableCell.d.ts +2 -0
- package/dist/components/CollectionTableBinding/internal/EntityTableCell.js +223 -0
- package/dist/components/CollectionTableBinding/internal/EntityTableCell.js.map +1 -0
- package/dist/components/CollectionTableBinding/internal/EntityTableCellActions.js +58 -0
- package/dist/components/CollectionTableBinding/internal/EntityTableCellActions.js.map +1 -0
- package/dist/components/CollectionTableBinding/internal/TableCellOpener.js +53 -0
- package/dist/components/CollectionTableBinding/internal/TableCellOpener.js.map +1 -0
- package/dist/components/CollectionTableBinding/internal/common.js +40 -0
- package/dist/components/CollectionTableBinding/internal/common.js.map +1 -0
- package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.js +270 -0
- package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.js.map +1 -0
- package/dist/components/CollectionTableBinding/internal/popup_field/useDraggable.js +68 -0
- package/dist/components/CollectionTableBinding/internal/popup_field/useDraggable.js.map +1 -0
- package/dist/components/CollectionTableBinding/internal/popup_field/useWindowSize.js +24 -0
- package/dist/components/CollectionTableBinding/internal/popup_field/useWindowSize.js.map +1 -0
- package/dist/components/CollectionTableBinding/table_bindings.js +306 -0
- package/dist/components/CollectionTableBinding/table_bindings.js.map +1 -0
- package/dist/components/CollectionViewBinding/BoardCardBinding.js +160 -0
- package/dist/components/CollectionViewBinding/BoardCardBinding.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.js +471 -0
- package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionCardViewBinding.js +108 -0
- package/dist/components/CollectionViewBinding/CollectionCardViewBinding.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionListViewBinding.js +988 -0
- package/dist/components/CollectionViewBinding/CollectionListViewBinding.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionViewActions.js +146 -0
- package/dist/components/CollectionViewBinding/CollectionViewActions.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionViewBinding.js +1209 -0
- package/dist/components/CollectionViewBinding/CollectionViewBinding.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionViewStartActions.js +133 -0
- package/dist/components/CollectionViewBinding/CollectionViewStartActions.js.map +1 -0
- package/dist/components/CollectionViewBinding/EntityCardBinding.js +133 -0
- package/dist/components/CollectionViewBinding/EntityCardBinding.js.map +1 -0
- package/dist/components/CollectionViewBinding/FilterPresetsButton.js +203 -0
- package/dist/components/CollectionViewBinding/FilterPresetsButton.js.map +1 -0
- package/dist/components/CollectionViewBinding/FiltersDialog.js +148 -0
- package/dist/components/CollectionViewBinding/FiltersDialog.js.map +1 -0
- package/dist/components/CollectionViewBinding/SearchExplanation.js +86 -0
- package/dist/components/CollectionViewBinding/SearchExplanation.js.map +1 -0
- package/dist/components/CollectionViewBinding/SearchHighlight.js +262 -0
- package/dist/components/CollectionViewBinding/SearchHighlight.js.map +1 -0
- package/dist/components/CollectionViewBinding/SlotValue.js +117 -0
- package/dist/components/CollectionViewBinding/SlotValue.js.map +1 -0
- package/dist/components/CollectionViewBinding/SortButton.js +214 -0
- package/dist/components/CollectionViewBinding/SortButton.js.map +1 -0
- package/dist/components/CollectionViewBinding/SplitListCloseButton.js +41 -0
- package/dist/components/CollectionViewBinding/SplitListCloseButton.js.map +1 -0
- package/dist/components/CollectionViewBinding/SplitListShowButton.js +29 -0
- package/dist/components/CollectionViewBinding/SplitListShowButton.js.map +1 -0
- package/dist/components/CollectionViewBinding/SplitListView.js +311 -0
- package/dist/components/CollectionViewBinding/SplitListView.js.map +1 -0
- package/dist/components/CollectionViewBinding/SplitViewContext.js +21 -0
- package/dist/components/CollectionViewBinding/SplitViewContext.js.map +1 -0
- package/dist/components/CollectionViewBinding/ViewModeToggle.js +150 -0
- package/dist/components/CollectionViewBinding/ViewModeToggle.js.map +1 -0
- package/dist/components/CollectionViewBinding/hooks/useCollectionInlineEditor.js +49 -0
- package/dist/components/CollectionViewBinding/hooks/useCollectionInlineEditor.js.map +1 -0
- package/dist/components/CollectionViewBinding/hooks/useKanbanDragAndDrop.js +122 -0
- package/dist/components/CollectionViewBinding/hooks/useKanbanDragAndDrop.js.map +1 -0
- package/dist/components/CollectionViewBinding/useBoardDataController.js +530 -0
- package/dist/components/CollectionViewBinding/useBoardDataController.js.map +1 -0
- package/dist/components/CollectionViewBinding/usePreviewSlots.d.ts +4 -1
- package/dist/components/CollectionViewBinding/usePreviewSlots.js +384 -0
- package/dist/components/CollectionViewBinding/usePreviewSlots.js.map +1 -0
- package/dist/components/CollectionViewBinding/useSelectionController.js +104 -0
- package/dist/components/CollectionViewBinding/useSelectionController.js.map +1 -0
- package/dist/components/CollectionViewBinding/utils.js +21 -0
- package/dist/components/CollectionViewBinding/utils.js.map +1 -0
- package/dist/components/CollectionsProvider.d.ts +44 -0
- package/dist/components/CollectionsProvider.js +137 -0
- package/dist/components/CollectionsProvider.js.map +1 -0
- package/dist/components/CollectionsScopeContext.d.ts +18 -0
- package/dist/components/CollectionsScopeContext.js +25 -0
- package/dist/components/CollectionsScopeContext.js.map +1 -0
- package/dist/components/DefaultAppBar.js +179 -0
- package/dist/components/DefaultAppBar.js.map +1 -0
- package/dist/components/DefaultDrawer.js +364 -0
- package/dist/components/DefaultDrawer.js.map +1 -0
- package/dist/components/DeleteEntityDialog.js +256 -0
- package/dist/components/DeleteEntityDialog.js.map +1 -0
- package/dist/components/DetailViewBinding.js +504 -0
- package/dist/components/DetailViewBinding.js.map +1 -0
- package/dist/components/DrawerNavigationGroup.js +74 -0
- package/dist/components/DrawerNavigationGroup.js.map +1 -0
- package/dist/components/DrawerNavigationItem.d.ts +8 -0
- package/dist/components/DrawerNavigationItem.js +45 -0
- package/dist/components/DrawerNavigationItem.js.map +1 -0
- package/dist/components/EditFormActions.js +210 -0
- package/dist/components/EditFormActions.js.map +1 -0
- package/dist/components/EditViewBinding.js +802 -0
- package/dist/components/EditViewBinding.js.map +1 -0
- package/dist/components/EntityDisplayHeader.js +139 -0
- package/dist/components/EntityDisplayHeader.js.map +1 -0
- package/dist/components/EntityFormPanel.d.ts +58 -0
- package/dist/components/EntityFormPanel.js +126 -0
- package/dist/components/EntityFormPanel.js.map +1 -0
- package/dist/components/EntityIdentityBar.js +364 -0
- package/dist/components/EntityIdentityBar.js.map +1 -0
- package/dist/components/EntityInspector.js +96 -0
- package/dist/components/EntityInspector.js.map +1 -0
- package/dist/components/EntityPreviewBinding.js +282 -0
- package/dist/components/EntityPreviewBinding.js.map +1 -0
- package/dist/components/EntityPreviewNesting.js +53 -0
- package/dist/components/EntityPreviewNesting.js.map +1 -0
- package/dist/components/EntityViewBinding.js +246 -0
- package/dist/components/EntityViewBinding.js.map +1 -0
- package/dist/components/FieldCaption.js +17 -0
- package/dist/components/FieldCaption.js.map +1 -0
- package/dist/components/HomePage/ContentHomePage.js +326 -0
- package/dist/components/HomePage/ContentHomePage.js.map +1 -0
- package/dist/components/HomePage/FavouritesView.js +44 -0
- package/dist/components/HomePage/FavouritesView.js.map +1 -0
- package/dist/components/HomePage/HomePageDnD.js +436 -0
- package/dist/components/HomePage/HomePageDnD.js.map +1 -0
- package/dist/components/HomePage/NavigationCard.js +59 -0
- package/dist/components/HomePage/NavigationCard.js.map +1 -0
- package/dist/components/HomePage/NavigationCardBinding.js +70 -0
- package/dist/components/HomePage/NavigationCardBinding.js.map +1 -0
- package/dist/components/HomePage/NavigationGroup.js +98 -0
- package/dist/components/HomePage/NavigationGroup.js.map +1 -0
- package/dist/components/HomePage/RenameGroupDialog.js +89 -0
- package/dist/components/HomePage/RenameGroupDialog.js.map +1 -0
- package/dist/components/InlineEntityPreview.js +116 -0
- package/dist/components/InlineEntityPreview.js.map +1 -0
- package/dist/{JsonPreviewBinding-v0w3H0fp.js → components/JsonPreviewBinding.js} +2 -2
- package/dist/components/JsonPreviewBinding.js.map +1 -0
- package/dist/components/NavigationLoadingErrorView.js +27 -0
- package/dist/components/NavigationLoadingErrorView.js.map +1 -0
- package/dist/components/PickerTrigger.js +27 -0
- package/dist/components/PickerTrigger.js.map +1 -0
- package/dist/components/PropertyCollectionView.js +215 -0
- package/dist/components/PropertyCollectionView.js.map +1 -0
- package/dist/components/PropertyConfigBadge.js +19 -0
- package/dist/components/PropertyConfigBadge.js.map +1 -0
- package/dist/components/PropertyKeyHint.js +58 -0
- package/dist/components/PropertyKeyHint.js.map +1 -0
- package/dist/components/RebaseAuthGate.js +35 -0
- package/dist/components/RebaseAuthGate.js.map +1 -0
- package/dist/components/RebaseCMS.js +44 -0
- package/dist/components/RebaseCMS.js.map +1 -0
- package/dist/components/RebaseLayout.js +59 -0
- package/dist/components/RebaseLayout.js.map +1 -0
- package/dist/components/RebaseNavigation.js +215 -0
- package/dist/components/RebaseNavigation.js.map +1 -0
- package/dist/components/RebaseRouteDefs.js +96 -0
- package/dist/components/RebaseRouteDefs.js.map +1 -0
- package/dist/components/RebaseShell.js +50 -0
- package/dist/components/RebaseShell.js.map +1 -0
- package/dist/components/ReferenceTable/SelectionTableBinding.js +224 -0
- package/dist/components/ReferenceTable/SelectionTableBinding.js.map +1 -0
- package/dist/components/ReferenceWidget.js +100 -0
- package/dist/components/ReferenceWidget.js.map +1 -0
- package/dist/components/RelationSelector.js +625 -0
- package/dist/components/RelationSelector.js.map +1 -0
- package/dist/components/SearchIconsView.js +52 -0
- package/dist/components/SearchIconsView.js.map +1 -0
- package/dist/components/SelectableTable/SelectableTable.d.ts +1 -1
- package/dist/components/SelectableTable/SelectableTable.js +158 -0
- package/dist/components/SelectableTable/SelectableTable.js.map +1 -0
- package/dist/components/SelectableTable/SelectableTableContext.js +8 -0
- package/dist/components/SelectableTable/SelectableTableContext.js.map +1 -0
- package/dist/components/SelectableTable/SelectionStore.js +29 -0
- package/dist/components/SelectableTable/SelectionStore.js.map +1 -0
- package/dist/components/SelectableTable/filters/BooleanFilterField.js +28 -0
- package/dist/components/SelectableTable/filters/BooleanFilterField.js.map +1 -0
- package/dist/components/SelectableTable/filters/DateTimeFilterField.d.ts +2 -1
- package/dist/components/SelectableTable/filters/DateTimeFilterField.js +93 -0
- package/dist/components/SelectableTable/filters/DateTimeFilterField.js.map +1 -0
- package/dist/components/SelectableTable/filters/FilterFieldBinding.js +132 -0
- package/dist/components/SelectableTable/filters/FilterFieldBinding.js.map +1 -0
- package/dist/components/SelectableTable/filters/ReferenceFilterField.js +157 -0
- package/dist/components/SelectableTable/filters/ReferenceFilterField.js.map +1 -0
- package/dist/components/SelectableTable/filters/RelationFilterField.js +169 -0
- package/dist/components/SelectableTable/filters/RelationFilterField.js.map +1 -0
- package/dist/components/SelectableTable/filters/StringNumberFilterField.js +181 -0
- package/dist/components/SelectableTable/filters/StringNumberFilterField.js.map +1 -0
- package/dist/components/SelectableTable/filters/null_filter.js +36 -0
- package/dist/components/SelectableTable/filters/null_filter.js.map +1 -0
- package/dist/components/SideDialogs.js +149 -0
- package/dist/components/SideDialogs.js.map +1 -0
- package/dist/components/SidePanelBinding.js +287 -0
- package/dist/components/SidePanelBinding.js.map +1 -0
- package/dist/components/SidePanelProvider.js +69 -0
- package/dist/components/SidePanelProvider.js.map +1 -0
- package/dist/components/UserSelector.d.ts +2 -0
- package/dist/components/UserSelector.js +418 -0
- package/dist/components/UserSelector.js.map +1 -0
- package/dist/components/admin/CreationResultDialog.js +118 -0
- package/dist/components/admin/CreationResultDialog.js.map +1 -0
- package/dist/components/app/AppBar.js +14 -0
- package/dist/components/app/AppBar.js.map +1 -0
- package/dist/components/app/Drawer.js +26 -0
- package/dist/components/app/Drawer.js.map +1 -0
- package/dist/components/app/Scaffold.js +229 -0
- package/dist/components/app/Scaffold.js.map +1 -0
- package/dist/components/app/useApp.js +24 -0
- package/dist/components/app/useApp.js.map +1 -0
- package/dist/components/common/ActionMenuLabel.js +30 -0
- package/dist/components/common/ActionMenuLabel.js.map +1 -0
- package/dist/components/common/default_entity_actions.js +590 -0
- package/dist/components/common/default_entity_actions.js.map +1 -0
- package/dist/components/drawer_expansion.d.ts +25 -0
- package/dist/components/drawer_expansion.js +44 -0
- package/dist/components/drawer_expansion.js.map +1 -0
- package/dist/components/field_configs.d.ts +2 -2
- package/dist/components/field_configs.js +431 -0
- package/dist/components/field_configs.js.map +1 -0
- package/dist/components/field_ids.d.ts +11 -0
- package/dist/components/field_ids.js +58 -0
- package/dist/components/field_ids.js.map +1 -0
- package/dist/components/history/EntityHistoryEntry.js +151 -0
- package/dist/components/history/EntityHistoryEntry.js.map +1 -0
- package/dist/components/history/EntityHistoryView.js +157 -0
- package/dist/components/history/EntityHistoryView.js.map +1 -0
- package/dist/components/history/UserChip.js +21 -0
- package/dist/components/history/UserChip.js.map +1 -0
- package/dist/components/history/index.js +4 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/lazy_record_views.d.ts +10 -0
- package/dist/components/lazy_record_views.js +57 -0
- package/dist/components/lazy_record_views.js.map +1 -0
- package/dist/contexts/BreacrumbsContext.js +28 -0
- package/dist/contexts/BreacrumbsContext.js.map +1 -0
- package/dist/contexts/EditorAIControllerContext.d.ts +18 -0
- package/dist/contexts/EditorAIControllerContext.js +29 -0
- package/dist/contexts/EditorAIControllerContext.js.map +1 -0
- package/dist/contexts/SideDialogsControllerContext.js +7 -0
- package/dist/contexts/SideDialogsControllerContext.js.map +1 -0
- package/dist/data_export/export/BasicExportAction.js +151 -0
- package/dist/data_export/export/BasicExportAction.js.map +1 -0
- package/dist/data_export/export/ExportCollectionAction.js +297 -0
- package/dist/data_export/export/ExportCollectionAction.js.map +1 -0
- package/dist/data_export/export/additional_fields.js +40 -0
- package/dist/data_export/export/additional_fields.js.map +1 -0
- package/dist/data_export/export/export.d.ts +35 -0
- package/dist/data_export/export/export.js +400 -0
- package/dist/data_export/export/export.js.map +1 -0
- package/dist/data_export/export/fetch_export_data.d.ts +17 -7
- package/dist/data_export/export/fetch_export_data.js +67 -0
- package/dist/data_export/export/fetch_export_data.js.map +1 -0
- package/dist/data_export/export/index.d.ts +4 -2
- package/dist/data_export/export/index.js +5 -0
- package/dist/data_import/components/DataNewPropertiesMapping.js +207 -0
- package/dist/data_import/components/DataNewPropertiesMapping.js.map +1 -0
- package/dist/data_import/components/ImportConversionProblems.js +89 -0
- package/dist/data_import/components/ImportConversionProblems.js.map +1 -0
- package/dist/data_import/components/ImportFileUpload.js +43 -0
- package/dist/data_import/components/ImportFileUpload.js.map +1 -0
- package/dist/data_import/components/ImportNewPropertyFieldPreview.js +42 -0
- package/dist/data_import/components/ImportNewPropertyFieldPreview.js.map +1 -0
- package/dist/data_import/components/ImportSaveInProgress.js +105 -0
- package/dist/data_import/components/ImportSaveInProgress.js.map +1 -0
- package/dist/data_import/hooks/useImportConfig.js +34 -0
- package/dist/data_import/hooks/useImportConfig.js.map +1 -0
- package/dist/{import-DjQoRrIU.js → data_import/import/ImportCollectionAction.js} +53 -43
- package/dist/data_import/import/ImportCollectionAction.js.map +1 -0
- package/dist/data_import/import/index.js +2 -0
- package/dist/data_import/utils/csv.js +146 -0
- package/dist/data_import/utils/csv.js.map +1 -0
- package/dist/data_import/utils/data.js +366 -0
- package/dist/data_import/utils/data.js.map +1 -0
- package/dist/data_import/utils/file_headers.js +32 -0
- package/dist/data_import/utils/file_headers.js.map +1 -0
- package/dist/data_import/utils/file_to_json.js +149 -0
- package/dist/data_import/utils/file_to_json.js.map +1 -0
- package/dist/data_import/utils/get_import_inference_type.js +14 -0
- package/dist/data_import/utils/get_import_inference_type.js.map +1 -0
- package/dist/data_import/utils/id_column.js +27 -0
- package/dist/data_import/utils/id_column.js.map +1 -0
- package/dist/data_import/utils/import_columns.js +92 -0
- package/dist/data_import/utils/import_columns.js.map +1 -0
- package/dist/data_import/utils/save_entities.d.ts +33 -4
- package/dist/data_import/utils/save_entities.js +244 -0
- package/dist/data_import/utils/save_entities.js.map +1 -0
- package/dist/data_import/utils/transforms.js +83 -0
- package/dist/data_import/utils/transforms.js.map +1 -0
- package/dist/editor/components/SlashCommandMenu.js +497 -0
- package/dist/editor/components/SlashCommandMenu.js.map +1 -0
- package/dist/editor/components/editor-bubble-item.js +24 -0
- package/dist/editor/components/editor-bubble-item.js.map +1 -0
- package/dist/editor/components/editor-bubble.js +97 -0
- package/dist/editor/components/editor-bubble.js.map +1 -0
- package/dist/editor/components/image-bubble.js +148 -0
- package/dist/editor/components/image-bubble.js.map +1 -0
- package/dist/editor/components/table-bubble.js +406 -0
- package/dist/editor/components/table-bubble.js.map +1 -0
- package/dist/editor/editor.js +423 -0
- package/dist/editor/editor.js.map +1 -0
- package/dist/editor/extensions/HighlightDecorationExtension.js +74 -0
- package/dist/editor/extensions/HighlightDecorationExtension.js.map +1 -0
- package/dist/editor/extensions/Image.d.ts +7 -1
- package/dist/editor/extensions/Image.js +160 -0
- package/dist/editor/extensions/Image.js.map +1 -0
- package/dist/editor/extensions/TextLoadingDecorationExtension.js +82 -0
- package/dist/editor/extensions/TextLoadingDecorationExtension.js.map +1 -0
- package/dist/editor/extensions/clipboard.js +63 -0
- package/dist/editor/extensions/clipboard.js.map +1 -0
- package/dist/editor/extensions/drag-and-drop.js +354 -0
- package/dist/editor/extensions/drag-and-drop.js.map +1 -0
- package/dist/editor/hooks/useProseMirror.js +101 -0
- package/dist/editor/hooks/useProseMirror.js.map +1 -0
- package/dist/editor/hooks/useProseMirrorContext.js +11 -0
- package/dist/editor/hooks/useProseMirrorContext.js.map +1 -0
- package/dist/editor/markdown.js +154 -0
- package/dist/editor/markdown.js.map +1 -0
- package/dist/editor/nodeViews/ImageComponent.js +35 -0
- package/dist/editor/nodeViews/ImageComponent.js.map +1 -0
- package/dist/editor/nodeViews/ReactNodeView.js +57 -0
- package/dist/editor/nodeViews/ReactNodeView.js.map +1 -0
- package/dist/editor/nodeViews/TaskItemComponent.js +29 -0
- package/dist/editor/nodeViews/TaskItemComponent.js.map +1 -0
- package/dist/editor/nodeViews/index.js +21 -0
- package/dist/editor/nodeViews/index.js.map +1 -0
- package/dist/editor/plugins/index.js +54 -0
- package/dist/editor/plugins/index.js.map +1 -0
- package/dist/editor/plugins/inputrules.js +54 -0
- package/dist/editor/plugins/inputrules.js.map +1 -0
- package/dist/editor/plugins/placeholderPlugin.js +38 -0
- package/dist/editor/plugins/placeholderPlugin.js.map +1 -0
- package/dist/editor/plugins/slashCommandPlugin.js +40 -0
- package/dist/editor/plugins/slashCommandPlugin.js.map +1 -0
- package/dist/editor/sanitize-html.js +190 -0
- package/dist/editor/sanitize-html.js.map +1 -0
- package/dist/{markdown-CCqp8ibf.js → editor/schema.js} +2 -159
- package/dist/editor/schema.js.map +1 -0
- package/dist/editor/selectors/link-selector.js +118 -0
- package/dist/editor/selectors/link-selector.js.map +1 -0
- package/dist/editor/selectors/node-selector.js +118 -0
- package/dist/editor/selectors/node-selector.js.map +1 -0
- package/dist/editor/selectors/text-buttons.js +71 -0
- package/dist/editor/selectors/text-buttons.js.map +1 -0
- package/dist/editor/utils/prosemirror-utils.js +92 -0
- package/dist/editor/utils/prosemirror-utils.js.map +1 -0
- package/dist/editor/utils/remove_classes.js +16 -0
- package/dist/editor/utils/remove_classes.js.map +1 -0
- package/dist/editor.js +1 -3147
- package/dist/form/EntityForm.js +734 -0
- package/dist/form/EntityForm.js.map +1 -0
- package/dist/form/EntityFormActions.js +101 -0
- package/dist/form/EntityFormActions.js.map +1 -0
- package/dist/form/EntityFormBinding.js +256 -0
- package/dist/form/EntityFormBinding.js.map +1 -0
- package/dist/form/PropertyFieldBinding.js +298 -0
- package/dist/form/PropertyFieldBinding.js.map +1 -0
- package/dist/form/components/ErrorFocus.js +33 -0
- package/dist/form/components/ErrorFocus.js.map +1 -0
- package/dist/form/components/FieldBlock.js +118 -0
- package/dist/form/components/FieldBlock.js.map +1 -0
- package/dist/form/components/FieldHelperText.js +56 -0
- package/dist/form/components/FieldHelperText.js.map +1 -0
- package/dist/form/components/FormRail.js +118 -0
- package/dist/form/components/FormRail.js.map +1 -0
- package/dist/form/components/FormSections.js +63 -0
- package/dist/form/components/FormSections.js.map +1 -0
- package/dist/form/components/LabelWithIcon.js +29 -0
- package/dist/form/components/LabelWithIcon.js.map +1 -0
- package/dist/form/components/LocalChangesMenu.js +127 -0
- package/dist/form/components/LocalChangesMenu.js.map +1 -0
- package/dist/form/components/StorageItemPreview.js +46 -0
- package/dist/form/components/StorageItemPreview.js.map +1 -0
- package/dist/form/components/StorageUploadProgress.js +84 -0
- package/dist/form/components/StorageUploadProgress.js.map +1 -0
- package/dist/form/components/useRailVisible.js +43 -0
- package/dist/form/components/useRailVisible.js.map +1 -0
- package/dist/form/field_bindings/ArrayCustomShapedFieldBinding.js +84 -0
- package/dist/form/field_bindings/ArrayCustomShapedFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.js +125 -0
- package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/BinaryFieldBinding.js +135 -0
- package/dist/form/field_bindings/BinaryFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/BlockFieldBinding.js +164 -0
- package/dist/form/field_bindings/BlockFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/DateTimeFieldBinding.js +47 -0
- package/dist/form/field_bindings/DateTimeFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/GeopointFieldBinding.js +148 -0
- package/dist/form/field_bindings/GeopointFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/KeyValueFieldBinding.js +450 -0
- package/dist/form/field_bindings/KeyValueFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/MapFieldBinding.js +77 -0
- package/dist/form/field_bindings/MapFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/MarkdownEditorFieldBinding.js +215 -0
- package/dist/form/field_bindings/MarkdownEditorFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/MultiSelectFieldBinding.js +88 -0
- package/dist/form/field_bindings/MultiSelectFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/MultipleRelationFieldBinding.js +118 -0
- package/dist/form/field_bindings/MultipleRelationFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/ReadOnlyFieldBinding.js +52 -0
- package/dist/form/field_bindings/ReadOnlyFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/ReferenceFieldBinding.js +99 -0
- package/dist/form/field_bindings/ReferenceFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/RelationFieldBinding.js +135 -0
- package/dist/form/field_bindings/RelationFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/RepeatFieldBinding.js +103 -0
- package/dist/form/field_bindings/RepeatFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/SelectFieldBinding.js +80 -0
- package/dist/form/field_bindings/SelectFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/StorageUploadFieldBinding.js +266 -0
- package/dist/form/field_bindings/StorageUploadFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/SwitchFieldBinding.js +41 -0
- package/dist/form/field_bindings/SwitchFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/TextFieldBinding.js +114 -0
- package/dist/form/field_bindings/TextFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/UserSelectFieldBinding.js +48 -0
- package/dist/form/field_bindings/UserSelectFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/VectorFieldBinding.js +147 -0
- package/dist/form/field_bindings/VectorFieldBinding.js.map +1 -0
- package/dist/form/form_keyboard_scope.d.ts +26 -0
- package/dist/form/form_keyboard_scope.js +39 -0
- package/dist/form/form_keyboard_scope.js.map +1 -0
- package/dist/form/form_uploads.d.ts +24 -0
- package/dist/form/form_uploads.js +31 -0
- package/dist/form/form_uploads.js.map +1 -0
- package/dist/form/form_utils.d.ts +24 -0
- package/dist/form/form_utils.js +280 -0
- package/dist/form/form_utils.js.map +1 -0
- package/dist/form/resolve_cell_property.d.ts +32 -0
- package/dist/form/resolve_cell_property.js +80 -0
- package/dist/form/resolve_cell_property.js.map +1 -0
- package/dist/form/resolve_form_properties.d.ts +2 -1
- package/dist/form/resolve_form_properties.js +78 -0
- package/dist/form/resolve_form_properties.js.map +1 -0
- package/dist/form/useClearRestoreValue.js +27 -0
- package/dist/form/useClearRestoreValue.js.map +1 -0
- package/dist/form/useUndoableDiscard.js +36 -0
- package/dist/form/useUndoableDiscard.js.map +1 -0
- package/dist/form/validation.d.ts +20 -0
- package/dist/form/validation.js +416 -0
- package/dist/form/validation.js.map +1 -0
- package/dist/hooks/navigation/contexts/CollectionRegistryContext.js +22 -0
- package/dist/hooks/navigation/contexts/CollectionRegistryContext.js.map +1 -0
- package/dist/hooks/navigation/contexts/NavigationStateContext.js +15 -0
- package/dist/hooks/navigation/contexts/NavigationStateContext.js.map +1 -0
- package/dist/hooks/navigation/contexts/UrlContext.js +22 -0
- package/dist/hooks/navigation/contexts/UrlContext.js.map +1 -0
- package/dist/hooks/navigation/useAsyncResolver.js +68 -0
- package/dist/hooks/navigation/useAsyncResolver.js.map +1 -0
- package/dist/hooks/navigation/useBuildCollectionRegistryController.js +141 -0
- package/dist/hooks/navigation/useBuildCollectionRegistryController.js.map +1 -0
- package/dist/hooks/navigation/useBuildNavigationStateController.js +77 -0
- package/dist/hooks/navigation/useBuildNavigationStateController.js.map +1 -0
- package/dist/hooks/navigation/useBuildUrlController.js +57 -0
- package/dist/hooks/navigation/useBuildUrlController.js.map +1 -0
- package/dist/hooks/navigation/useNavigationResolution.js +177 -0
- package/dist/hooks/navigation/useNavigationResolution.js.map +1 -0
- package/dist/hooks/navigation/useResolvedCollections.js +56 -0
- package/dist/hooks/navigation/useResolvedCollections.js.map +1 -0
- package/dist/hooks/navigation/useResolvedViews.js +94 -0
- package/dist/hooks/navigation/useResolvedViews.js.map +1 -0
- package/dist/hooks/navigation/useTopLevelNavigation.js +162 -0
- package/dist/hooks/navigation/useTopLevelNavigation.js.map +1 -0
- package/dist/hooks/navigation/utils.js +125 -0
- package/dist/hooks/navigation/utils.js.map +1 -0
- package/dist/hooks/useAdminContext.js +45 -0
- package/dist/hooks/useAdminContext.js.map +1 -0
- package/dist/hooks/useBreadcrumbsController.js +17 -0
- package/dist/hooks/useBreadcrumbsController.js.map +1 -0
- package/dist/hooks/useBuildSideDialogsController.js +96 -0
- package/dist/hooks/useBuildSideDialogsController.js.map +1 -0
- package/dist/hooks/useBuildSidePanel.js +221 -0
- package/dist/hooks/useBuildSidePanel.js.map +1 -0
- package/dist/hooks/useChildViewSource.js +41 -0
- package/dist/hooks/useChildViewSource.js.map +1 -0
- package/dist/hooks/useEntityDisplay.js +136 -0
- package/dist/hooks/useEntityDisplay.js.map +1 -0
- package/dist/hooks/useEntityDisplayTitle.js +34 -0
- package/dist/hooks/useEntityDisplayTitle.js.map +1 -0
- package/dist/hooks/useHistory.js +137 -0
- package/dist/hooks/useHistory.js.map +1 -0
- package/dist/hooks/useRecordActions.js +108 -0
- package/dist/hooks/useRecordActions.js.map +1 -0
- package/dist/hooks/useReferencePaths.js +32 -0
- package/dist/hooks/useReferencePaths.js.map +1 -0
- package/dist/hooks/useResolvedNavigationFrom.js +83 -0
- package/dist/hooks/useResolvedNavigationFrom.js.map +1 -0
- package/dist/hooks/useResolvedUsers.js +109 -0
- package/dist/hooks/useResolvedUsers.js.map +1 -0
- package/dist/hooks/useSelectionDialog.js +53 -0
- package/dist/hooks/useSelectionDialog.js.map +1 -0
- package/dist/hooks/useSideDialogsController.js +8 -0
- package/dist/hooks/useSideDialogsController.js.map +1 -0
- package/dist/hooks/useSidePanel.js +15 -0
- package/dist/hooks/useSidePanel.js.map +1 -0
- package/dist/hooks/useStorageReferenceResolver.d.ts +4 -2
- package/dist/hooks/useStorageReferenceResolver.js +49 -0
- package/dist/hooks/useStorageReferenceResolver.js.map +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +151 -3867
- package/dist/preview/PropertyPreview.js +260 -0
- package/dist/preview/PropertyPreview.js.map +1 -0
- package/dist/preview/compact_text.js +52 -0
- package/dist/preview/compact_text.js.map +1 -0
- package/dist/preview/components/ArrayEnumPreview.js +24 -0
- package/dist/preview/components/ArrayEnumPreview.js.map +1 -0
- package/dist/preview/components/BooleanPreview.js +25 -0
- package/dist/preview/components/BooleanPreview.js.map +1 -0
- package/dist/preview/components/DatePreview.d.ts +3 -2
- package/dist/preview/components/DatePreview.js +87 -0
- package/dist/preview/components/DatePreview.js.map +1 -0
- package/dist/preview/components/EmptyValue.js +13 -0
- package/dist/preview/components/EmptyValue.js.map +1 -0
- package/dist/preview/components/EnumValuesChip.js +26 -0
- package/dist/preview/components/EnumValuesChip.js.map +1 -0
- package/dist/preview/components/ImagePreview.d.ts +7 -1
- package/dist/preview/components/ImagePreview.js +112 -0
- package/dist/preview/components/ImagePreview.js.map +1 -0
- package/dist/preview/components/InlineEntityListPreview.js +31 -0
- package/dist/preview/components/InlineEntityListPreview.js.map +1 -0
- package/dist/preview/components/ReferencePreview.js +162 -0
- package/dist/preview/components/ReferencePreview.js.map +1 -0
- package/dist/preview/components/RelationPreview.js +196 -0
- package/dist/preview/components/RelationPreview.js.map +1 -0
- package/dist/preview/components/StorageMarkdown.d.ts +2 -1
- package/dist/preview/components/StorageMarkdown.js +49 -0
- package/dist/preview/components/StorageMarkdown.js.map +1 -0
- package/dist/preview/components/StorageThumbnail.js +183 -0
- package/dist/preview/components/StorageThumbnail.js.map +1 -0
- package/dist/preview/components/UrlComponentPreview.d.ts +3 -1
- package/dist/preview/components/UrlComponentPreview.js +88 -0
- package/dist/preview/components/UrlComponentPreview.js.map +1 -0
- package/dist/preview/components/UserPreview.js +30 -0
- package/dist/preview/components/UserPreview.js.map +1 -0
- package/dist/preview/components/date_fns_locales.js +124 -0
- package/dist/preview/components/date_fns_locales.js.map +1 -0
- package/dist/preview/components/storageRenditions.d.ts +10 -0
- package/dist/preview/components/storageRenditions.js +93 -0
- package/dist/preview/components/storageRenditions.js.map +1 -0
- package/dist/preview/property_previews/ArrayOfMapsPreview.js +44 -0
- package/dist/preview/property_previews/ArrayOfMapsPreview.js.map +1 -0
- package/dist/preview/property_previews/ArrayOfReferencesPreview.js +48 -0
- package/dist/preview/property_previews/ArrayOfReferencesPreview.js.map +1 -0
- package/dist/preview/property_previews/ArrayOfRelationsPreview.js +50 -0
- package/dist/preview/property_previews/ArrayOfRelationsPreview.js.map +1 -0
- package/dist/preview/property_previews/ArrayOfStorageComponentsPreview.js +30 -0
- package/dist/preview/property_previews/ArrayOfStorageComponentsPreview.js.map +1 -0
- package/dist/preview/property_previews/ArrayOfStringsPreview.js +42 -0
- package/dist/preview/property_previews/ArrayOfStringsPreview.js.map +1 -0
- package/dist/preview/property_previews/ArrayOneOfPreview.js +47 -0
- package/dist/preview/property_previews/ArrayOneOfPreview.js.map +1 -0
- package/dist/preview/property_previews/ArrayPropertyEnumPreview.js +25 -0
- package/dist/preview/property_previews/ArrayPropertyEnumPreview.js.map +1 -0
- package/dist/preview/property_previews/ArrayPropertyPreview.js +48 -0
- package/dist/preview/property_previews/ArrayPropertyPreview.js.map +1 -0
- package/dist/preview/property_previews/MapPropertyPreview.js +137 -0
- package/dist/preview/property_previews/MapPropertyPreview.js.map +1 -0
- package/dist/preview/property_previews/NumberPropertyPreview.js +34 -0
- package/dist/preview/property_previews/NumberPropertyPreview.js.map +1 -0
- package/dist/preview/property_previews/SkeletonPropertyComponent.js +151 -0
- package/dist/preview/property_previews/SkeletonPropertyComponent.js.map +1 -0
- package/dist/preview/property_previews/StringPropertyPreview.js +49 -0
- package/dist/preview/property_previews/StringPropertyPreview.js.map +1 -0
- package/dist/preview/util.d.ts +4 -3
- package/dist/{util-D7ebttKT.js → preview/util.js} +8 -5
- package/dist/preview/util.js.map +1 -0
- package/dist/routes/CustomViewRoute.js +26 -0
- package/dist/routes/CustomViewRoute.js.map +1 -0
- package/dist/routes/RebaseRoute.js +311 -0
- package/dist/routes/RebaseRoute.js.map +1 -0
- package/dist/selection/SelectionMenu.js +90 -0
- package/dist/selection/SelectionMenu.js.map +1 -0
- package/dist/selection/resolve_selection.js +79 -0
- package/dist/selection/resolve_selection.js.map +1 -0
- package/dist/util/caller_scopes.js +25 -0
- package/dist/util/caller_scopes.js.map +1 -0
- package/dist/util/collection_open_mode.d.ts +20 -0
- package/dist/util/collection_open_mode.js +32 -0
- package/dist/util/collection_open_mode.js.map +1 -0
- package/dist/util/dataControllerAdapter.js +65 -0
- package/dist/util/dataControllerAdapter.js.map +1 -0
- package/dist/util/entity_actions.d.ts +5 -0
- package/dist/util/entity_actions.js +77 -0
- package/dist/util/entity_actions.js.map +1 -0
- package/dist/util/entity_pages.d.ts +37 -3
- package/dist/util/entity_pages.js +71 -0
- package/dist/util/entity_pages.js.map +1 -0
- package/dist/util/find_entities_by_ids.d.ts +23 -0
- package/dist/util/find_entities_by_ids.js +55 -0
- package/dist/util/find_entities_by_ids.js.map +1 -0
- package/dist/util/fit_inline_actions.js +40 -0
- package/dist/util/fit_inline_actions.js.map +1 -0
- package/dist/util/format_collection_date.d.ts +29 -0
- package/dist/util/format_collection_date.js +60 -0
- package/dist/util/format_collection_date.js.map +1 -0
- package/dist/util/map_with_concurrency.js +46 -0
- package/dist/util/map_with_concurrency.js.map +1 -0
- package/dist/util/navigation_utils.js +45 -0
- package/dist/util/navigation_utils.js.map +1 -0
- package/dist/util/number_format.js +33 -0
- package/dist/util/number_format.js.map +1 -0
- package/dist/util/previews.js +71 -0
- package/dist/util/previews.js.map +1 -0
- package/dist/util/propertyConfigMapper.js +83 -0
- package/dist/util/propertyConfigMapper.js.map +1 -0
- package/dist/util/property_utils.js +141 -0
- package/dist/util/property_utils.js.map +1 -0
- package/dist/util/resolutions.js +55 -0
- package/dist/util/resolutions.js.map +1 -0
- package/dist/util/view_constants.js +35 -0
- package/dist/util/view_constants.js.map +1 -0
- package/dist/util/view_mode.js +112 -0
- package/dist/util/view_mode.js.map +1 -0
- package/package.json +13 -9
- package/dist/CollectionEditorDialog-p5-I-Apu.js +0 -3669
- package/dist/CollectionEditorDialog-p5-I-Apu.js.map +0 -1
- package/dist/JsonPreviewBinding-v0w3H0fp.js.map +0 -1
- package/dist/PropertyEditView-DDB_X-00.js +0 -3837
- package/dist/PropertyEditView-DDB_X-00.js.map +0 -1
- package/dist/RouterCollectionsStudioView-SGBV4CMg.js +0 -212
- package/dist/RouterCollectionsStudioView-SGBV4CMg.js.map +0 -1
- package/dist/SchemaChangeDialog-CcFSXvkK.js.map +0 -1
- package/dist/collection_editor/ui/CollectionViewHeaderAction.d.ts +0 -13
- package/dist/collection_editor/ui/PropertyAddColumnComponent.d.ts +0 -8
- package/dist/collection_editor_ui.js.map +0 -1
- package/dist/editor.js.map +0 -1
- package/dist/export-DCHuPD1a.js +0 -520
- package/dist/export-DCHuPD1a.js.map +0 -1
- package/dist/history-CBd6SBRs.js +0 -314
- package/dist/history-CBd6SBRs.js.map +0 -1
- package/dist/import-DjQoRrIU.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/markdown-CCqp8ibf.js.map +0 -1
- package/dist/rolldown-runtime-D7D4PA-g.js +0 -13
- package/dist/util-BRvKFMLa.js +0 -27773
- package/dist/util-BRvKFMLa.js.map +0 -1
- package/dist/util-D7ebttKT.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"additional_fields.js","names":[],"sources":["../../../src/data_export/export/additional_fields.ts"],"sourcesContent":["import { Entity } from \"@rebasepro/types\";\nimport { AdditionalFieldDelegate, ExportMappingFunction, RebaseContext } from \"@rebasepro/cms-types\";\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\n/**\n * The values of the export's extra columns, one record per entity: the\n * collection's `exportable.additionalFields` and its `additionalFields` that\n * declare a `value`, both in the same record.\n */\nexport async function resolveAdditionalExportValues<M extends Record<string, unknown>>({\n entities,\n exportFields,\n additionalFields,\n context\n}: {\n entities: Entity<M>[];\n exportFields: ExportMappingFunction[] | undefined;\n additionalFields: AdditionalFieldDelegate<M>[] | undefined;\n context: RebaseContext;\n}): Promise<Record<string, unknown>[]> {\n\n const resolvedExportColumnsValues: Record<string, unknown>[] = exportFields\n ? await mapInChunks(entities, async (entity) => {\n // `fromEntries`, not a pairwise spread, which copied the row once\n // per column.\n return Object.fromEntries(await Promise.all(exportFields.map(async (column) => [\n column.key,\n await column.builder({\n entity,\n context\n })\n ])));\n })\n : [];\n\n const resolvedColumnsValues: Record<string, unknown>[] = additionalFields\n ? await mapInChunks(entities, async (entity) => {\n return Object.fromEntries(await Promise.all(additionalFields\n .filter((field) => field.value)\n .map(async (field) => [\n field.key,\n await field.value!({\n entity,\n context\n })\n ])));\n })\n : [];\n // One record per entity, index for index — the export merges\n // `additionalData[i]` into row `i`.\n return entities.map((_, i) => ({\n ...resolvedExportColumnsValues[i],\n ...resolvedColumnsValues[i]\n }));\n}\n"],"mappings":";;;;;;;AASA,IAAM,gCAAgC;AAEtC,eAAe,YAAkB,OAAY,IAA6B,YAAY,+BAA6C;CAC/H,MAAM,UAAe,CAAC;CACtB,KAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK,WACnC,QAAQ,KAAK,GAAG,MAAM,QAAQ,IAAI,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;CAE5E,OAAO;AACX;;;;;;AAOA,eAAsB,8BAAiE,EACnF,UACA,cACA,kBACA,WAMmC;CAEnC,MAAM,8BAAyD,eACzD,MAAM,YAAY,UAAU,OAAO,WAAW;EAG5C,OAAO,OAAO,YAAY,MAAM,QAAQ,IAAI,aAAa,IAAI,OAAO,WAAW,CAC3E,OAAO,KACP,MAAM,OAAO,QAAQ;GACjB;GACA;EACJ,CAAC,CACL,CAAC,CAAC,CAAC;CACP,CAAC,IACC,CAAC;CAEP,MAAM,wBAAmD,mBACnD,MAAM,YAAY,UAAU,OAAO,WAAW;EAC5C,OAAO,OAAO,YAAY,MAAM,QAAQ,IAAI,iBACvC,QAAQ,UAAU,MAAM,KAAK,CAAC,CAC9B,IAAI,OAAO,UAAU,CAClB,MAAM,KACN,MAAM,MAAM,MAAO;GACf;GACA;EACJ,CAAC,CACL,CAAC,CAAC,CAAC;CACX,CAAC,IACC,CAAC;CAGP,OAAO,SAAS,KAAK,GAAG,OAAO;EAC3B,GAAG,4BAA4B;EAC/B,GAAG,sBAAsB;CAC7B,EAAE;AACN"}
|
|
@@ -17,6 +17,41 @@ export interface DownloadEntitiesExportParams<M extends Record<string, unknown>>
|
|
|
17
17
|
export declare function downloadEntitiesExport<M extends Record<string, unknown>>({ data, additionalData, properties, propertiesOrder, name, flattenArrays, additionalHeaders, exportType, dateExportType }: DownloadEntitiesExportParams<M>): void;
|
|
18
18
|
export declare function getEntityCSVExportableData(data: Entity<Record<string, unknown>>[], additionalData: Record<string, unknown>[] | undefined, properties: Properties, headers: Header[], dateExportType: "timestamp" | "string"): unknown[][];
|
|
19
19
|
export declare function getEntityJsonExportableData(data: Entity<Record<string, unknown>>[], additionalData: Record<string, unknown>[] | undefined, properties: Properties, dateExportType: "timestamp" | "string"): Record<string, unknown>[];
|
|
20
|
+
export interface CsvExportWriterParams {
|
|
21
|
+
properties: Properties;
|
|
22
|
+
propertiesOrder: string[] | undefined;
|
|
23
|
+
additionalHeaders: string[] | undefined;
|
|
24
|
+
flattenArrays: boolean;
|
|
25
|
+
dateExportType: "timestamp" | "string";
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Writes a CSV export one page of entities at a time.
|
|
29
|
+
*
|
|
30
|
+
* An export used to hold every entity it read, then a copy of every row, then
|
|
31
|
+
* an array of cells per row, then the row strings — about 211 MB at its peak
|
|
32
|
+
* for 100,000 rows × 20 columns, for a 32 MB file. Each page is now turned
|
|
33
|
+
* into its CSV text as it arrives and its entities are let go; what is held
|
|
34
|
+
* is the text itself.
|
|
35
|
+
*
|
|
36
|
+
* The file is the one the in-memory export wrote, byte for byte. What makes
|
|
37
|
+
* that work across pages is `flattenArrays`: the columns an array spreads into
|
|
38
|
+
* (`tags[0]` … `tags[n-1]`) depend on the longest array in *any* row, which
|
|
39
|
+
* an early page cannot know. So a page is written with the columns known when
|
|
40
|
+
* it arrives, and a row also keeps the cells of any array items those columns
|
|
41
|
+
* leave out. At the end, a page written with fewer columns than the file has
|
|
42
|
+
* is re-cut: its cells copied, and an array's swapped for, or extended with,
|
|
43
|
+
* the kept item cells (or empty ones). Usually the longest array is met in the
|
|
44
|
+
* first page and nothing is re-cut. A property key with `.` or `[` in it
|
|
45
|
+
* resolves through other properties when spread, so an export with one keeps
|
|
46
|
+
* its rows' records and writes them at the end, as before.
|
|
47
|
+
*/
|
|
48
|
+
export interface CsvExportWriter {
|
|
49
|
+
/** One page of entities, with their additional-column values index for index. */
|
|
50
|
+
addPage(data: Entity<Record<string, unknown>>[], additionalData?: Record<string, unknown>[]): void;
|
|
51
|
+
/** The whole file, header row first. Once: the pages are handed over. */
|
|
52
|
+
finish(): BlobPart[];
|
|
53
|
+
}
|
|
54
|
+
export declare function createCsvExportWriter({ properties, propertiesOrder, additionalHeaders, flattenArrays, dateExportType }: CsvExportWriterParams): CsvExportWriter;
|
|
20
55
|
/**
|
|
21
56
|
* Neutralise a cell that a spreadsheet would otherwise evaluate, by prefixing a
|
|
22
57
|
* single quote — the standard OWASP mitigation. The apostrophe is consumed by
|
|
@@ -0,0 +1,400 @@
|
|
|
1
|
+
import { EntityRelation } from "@rebasepro/types";
|
|
2
|
+
import { getArrayValuesCount, getValueInPath } from "@rebasepro/utils";
|
|
3
|
+
//#region src/data_export/export/export.ts
|
|
4
|
+
function downloadEntitiesExport({ data, additionalData, properties, propertiesOrder, name, flattenArrays, additionalHeaders, exportType, dateExportType }) {
|
|
5
|
+
console.debug("Downloading export", {
|
|
6
|
+
dataLength: data.length,
|
|
7
|
+
properties,
|
|
8
|
+
exportType,
|
|
9
|
+
dateExportType
|
|
10
|
+
});
|
|
11
|
+
if (exportType === "csv") {
|
|
12
|
+
const writer = createCsvExportWriter({
|
|
13
|
+
properties,
|
|
14
|
+
propertiesOrder,
|
|
15
|
+
additionalHeaders,
|
|
16
|
+
flattenArrays,
|
|
17
|
+
dateExportType
|
|
18
|
+
});
|
|
19
|
+
writer.addPage(data, additionalData);
|
|
20
|
+
downloadBlob(writer.finish(), `${name}.csv`, "text/csv");
|
|
21
|
+
} else {
|
|
22
|
+
const exportableData = getEntityJsonExportableData(data, additionalData, properties, dateExportType);
|
|
23
|
+
downloadBlob([JSON.stringify(exportableData, null, 2)], `${name}.json`, "application/json");
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function getEntityCSVExportableData(data, additionalData, properties, headers, dateExportType) {
|
|
27
|
+
return mergeExportRows(data, additionalData, properties, "csv", dateExportType).map((entry) => headers.map((header) => getValueInPath(entry, header.key)));
|
|
28
|
+
}
|
|
29
|
+
function getEntityJsonExportableData(data, additionalData, properties, dateExportType) {
|
|
30
|
+
return mergeExportRows(data, additionalData, properties, "json", dateExportType);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Each entity as the record its export row is read from: `id`, the processed
|
|
34
|
+
* values, then `additionalData[i]` over them. An `additionalData` longer than
|
|
35
|
+
* `data` adds rows of its own.
|
|
36
|
+
*/
|
|
37
|
+
function mergeExportRows(data, additionalData, properties, exportType, dateExportType) {
|
|
38
|
+
const mergedData = data.map((e) => ({
|
|
39
|
+
id: e.id,
|
|
40
|
+
...processValuesForExport(e.values, properties, exportType, dateExportType)
|
|
41
|
+
}));
|
|
42
|
+
if (additionalData) additionalData.forEach((additional, index) => {
|
|
43
|
+
mergedData[index] = {
|
|
44
|
+
...mergedData[index],
|
|
45
|
+
...additional
|
|
46
|
+
};
|
|
47
|
+
});
|
|
48
|
+
return mergedData;
|
|
49
|
+
}
|
|
50
|
+
function getExportHeaderGroups(properties, propertiesOrder, additionalHeaders) {
|
|
51
|
+
const groups = [{ headers: [{
|
|
52
|
+
label: "id",
|
|
53
|
+
key: "id"
|
|
54
|
+
}] }];
|
|
55
|
+
for (const childKey of propertiesOrder ?? Object.keys(properties)) {
|
|
56
|
+
if (childKey === "id") continue;
|
|
57
|
+
const property = properties[childKey];
|
|
58
|
+
if (!property) {
|
|
59
|
+
console.warn("Property not found", childKey, properties);
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
groups.push({
|
|
63
|
+
key: childKey,
|
|
64
|
+
property,
|
|
65
|
+
headers: getHeaders(property, childKey, "")
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
if (additionalHeaders) groups.push(...additionalHeaders.map((h) => ({ headers: [{
|
|
69
|
+
label: h,
|
|
70
|
+
key: h
|
|
71
|
+
}] })));
|
|
72
|
+
return groups;
|
|
73
|
+
}
|
|
74
|
+
/** How many columns per item the group's array spreads into, or 0 when it does not. */
|
|
75
|
+
function expandedItemCount(group, arrayValuesCount) {
|
|
76
|
+
if (group.key === void 0) return 0;
|
|
77
|
+
const count = arrayValuesCount[group.key];
|
|
78
|
+
return count > 1 ? count : 0;
|
|
79
|
+
}
|
|
80
|
+
/** The group's columns for array item `index`. */
|
|
81
|
+
function itemHeaders(group, index) {
|
|
82
|
+
return getHeaders(group.property, `${group.key}[${index}]`, "");
|
|
83
|
+
}
|
|
84
|
+
function headersOf(groups, arrayValuesCount) {
|
|
85
|
+
return groups.flatMap((group) => {
|
|
86
|
+
const count = expandedItemCount(group, arrayValuesCount);
|
|
87
|
+
return count > 0 ? Array.from({ length: count }, (_, i) => itemHeaders(group, i)).flat() : group.headers;
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
function rowCells(entry, headers) {
|
|
91
|
+
return headers.map((header) => toCSVCell(getValueInPath(entry, header.key)));
|
|
92
|
+
}
|
|
93
|
+
function createCsvExportWriter({ properties, propertiesOrder, additionalHeaders, flattenArrays, dateExportType }) {
|
|
94
|
+
const groups = getExportHeaderGroups(properties, propertiesOrder, additionalHeaders);
|
|
95
|
+
const itemHeaderCache = groups.map(() => []);
|
|
96
|
+
const headersOfItem = (groupIndex, index) => itemHeaderCache[groupIndex][index] ??= itemHeaders(groups[groupIndex], index);
|
|
97
|
+
const itemWidths = groups.map((group, groupIndex) => group.key === void 0 ? 0 : headersOfItem(groupIndex, 0).length);
|
|
98
|
+
const arrayValuesCount = {};
|
|
99
|
+
const keepEntries = flattenArrays && groups.some((group) => group.key !== void 0 && /[.[\]]/.test(group.key));
|
|
100
|
+
const pages = [];
|
|
101
|
+
return {
|
|
102
|
+
addPage(data, additionalData) {
|
|
103
|
+
if (flattenArrays) for (const [key, count] of Object.entries(getArrayValuesCount(data.map((d) => d.values)))) arrayValuesCount[key] = Math.max(arrayValuesCount[key] || 0, count);
|
|
104
|
+
const spread = groups.map((group) => expandedItemCount(group, arrayValuesCount));
|
|
105
|
+
const entries = mergeExportRows(data, additionalData, properties, "csv", dateExportType);
|
|
106
|
+
if (keepEntries) {
|
|
107
|
+
pages.push({
|
|
108
|
+
text: "",
|
|
109
|
+
rows: entries.length,
|
|
110
|
+
spread,
|
|
111
|
+
entries
|
|
112
|
+
});
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
const headers = headersOf(groups, arrayValuesCount);
|
|
116
|
+
const lines = [];
|
|
117
|
+
let items;
|
|
118
|
+
entries.forEach((entry, row) => {
|
|
119
|
+
lines.push(rowCells(entry, headers).join(",") + "\r\n");
|
|
120
|
+
if (!flattenArrays) return;
|
|
121
|
+
const bracketed = bracketedKeyIndices(entry);
|
|
122
|
+
groups.forEach((group, groupIndex) => {
|
|
123
|
+
if (group.key === void 0 || itemWidths[groupIndex] === 0) return;
|
|
124
|
+
const written = spread[groupIndex];
|
|
125
|
+
const indices = itemIndicesWithValues(entry, group.key, bracketed).filter((index) => index >= written);
|
|
126
|
+
if (indices.length === 0) return;
|
|
127
|
+
const value = entry[group.key];
|
|
128
|
+
let cells;
|
|
129
|
+
if (written === 0 && Array.isArray(value) && indices.length === value.length) cells = value.map((_, index) => rowCells(entry, headersOfItem(groupIndex, index)).join(",")).join(",");
|
|
130
|
+
else {
|
|
131
|
+
cells = [];
|
|
132
|
+
for (const index of indices) cells[index] = rowCells(entry, headersOfItem(groupIndex, index)).join(",");
|
|
133
|
+
}
|
|
134
|
+
(items ??= [])[row * groups.length + groupIndex] = cells;
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
pages.push({
|
|
138
|
+
text: lines.join(""),
|
|
139
|
+
rows: entries.length,
|
|
140
|
+
spread,
|
|
141
|
+
items
|
|
142
|
+
});
|
|
143
|
+
},
|
|
144
|
+
finish() {
|
|
145
|
+
const counts = flattenArrays ? arrayValuesCount : {};
|
|
146
|
+
const headers = headersOf(groups, counts);
|
|
147
|
+
const parts = [entryToCSVRow(headers.map((h) => h.label))];
|
|
148
|
+
const spread = groups.map((group) => expandedItemCount(group, counts));
|
|
149
|
+
for (let page = pages.shift(); page; page = pages.shift()) if (page.entries) parts.push(page.entries.map((entry) => rowCells(entry, headers).join(",") + "\r\n").join(""));
|
|
150
|
+
else if (page.spread.every((count, groupIndex) => count === spread[groupIndex])) parts.push(page.text);
|
|
151
|
+
else parts.push(recutPage(page, groups, spread, itemWidths));
|
|
152
|
+
return parts;
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* The record's own keys spelled `key[i]…`, by `key`: `getValueInPath` reads
|
|
158
|
+
* one of those for the cell `key[i]` before anything else. Almost never there.
|
|
159
|
+
*/
|
|
160
|
+
function bracketedKeyIndices(entry) {
|
|
161
|
+
let found;
|
|
162
|
+
for (const own of Object.keys(entry)) {
|
|
163
|
+
if (!own.includes("[")) continue;
|
|
164
|
+
const match = /^(.*?)\[(\d+)\]/.exec(own);
|
|
165
|
+
if (!match) continue;
|
|
166
|
+
found ??= /* @__PURE__ */ new Map();
|
|
167
|
+
const indices = found.get(match[1]) ?? [];
|
|
168
|
+
indices.push(Number(match[2]));
|
|
169
|
+
found.set(match[1], indices);
|
|
170
|
+
}
|
|
171
|
+
return found;
|
|
172
|
+
}
|
|
173
|
+
var NO_INDICES = [];
|
|
174
|
+
/**
|
|
175
|
+
* The array items of `entry[key]` whose spread cells may not all be empty —
|
|
176
|
+
* every other item's are, as `getValueInPath` reads `key[i]` and
|
|
177
|
+
* `key[i].child`: an array's own items, an object's own integer-named keys
|
|
178
|
+
* (read as `key[i]` too), and a key of the record spelled `key[i]…` itself.
|
|
179
|
+
* Over-including is harmless; the cells are computed, not assumed.
|
|
180
|
+
*/
|
|
181
|
+
function itemIndicesWithValues(entry, key, bracketed) {
|
|
182
|
+
const value = entry[key];
|
|
183
|
+
const extra = bracketed?.get(key);
|
|
184
|
+
if (!extra) {
|
|
185
|
+
if (Array.isArray(value)) return value.map((_, i) => i);
|
|
186
|
+
if (value === null || typeof value !== "object") return NO_INDICES;
|
|
187
|
+
}
|
|
188
|
+
const indices = /* @__PURE__ */ new Set();
|
|
189
|
+
if (Array.isArray(value)) for (let i = 0; i < value.length; i++) indices.add(i);
|
|
190
|
+
else if (value !== null && typeof value === "object") for (const own of Object.getOwnPropertyNames(value)) {
|
|
191
|
+
const match = /^(\d+)(?:$|[.[])/.exec(own);
|
|
192
|
+
if (match) indices.add(Number(match[1]));
|
|
193
|
+
}
|
|
194
|
+
extra?.forEach((index) => indices.add(index));
|
|
195
|
+
return [...indices];
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* A page written with fewer columns than the file has, cut back into cells
|
|
199
|
+
* and written again: each array the file spreads further than the page did
|
|
200
|
+
* gets its kept item cells, or empty ones.
|
|
201
|
+
*/
|
|
202
|
+
function recutPage(page, groups, spread, itemWidths) {
|
|
203
|
+
const text = page.text;
|
|
204
|
+
const out = [];
|
|
205
|
+
let pos = 0;
|
|
206
|
+
for (let row = 0; row < page.rows; row++) {
|
|
207
|
+
const cells = [];
|
|
208
|
+
let first = true;
|
|
209
|
+
groups.forEach((group, groupIndex) => {
|
|
210
|
+
const written = page.spread[groupIndex];
|
|
211
|
+
const itemWidth = itemWidths[groupIndex];
|
|
212
|
+
const width = written > 0 ? written * itemWidth : group.headers.length;
|
|
213
|
+
const groupCells = [];
|
|
214
|
+
for (let c = 0; c < width; c++) {
|
|
215
|
+
if (!first) pos++;
|
|
216
|
+
first = false;
|
|
217
|
+
const end = csvCellEnd(text, pos);
|
|
218
|
+
groupCells.push(text.slice(pos, end));
|
|
219
|
+
pos = end;
|
|
220
|
+
}
|
|
221
|
+
const count = spread[groupIndex];
|
|
222
|
+
if (count === written) {
|
|
223
|
+
cells.push(...groupCells);
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
if (written > 0) cells.push(...groupCells);
|
|
227
|
+
const items = page.items?.[row * groups.length + groupIndex];
|
|
228
|
+
const dense = typeof items === "string" ? splitCsvCells(items) : void 0;
|
|
229
|
+
for (let i = written; i < count; i++) {
|
|
230
|
+
const itemCells = dense ? dense.slice(i * itemWidth, (i + 1) * itemWidth) : typeof items === "object" && items[i] !== void 0 ? splitCsvCells(items[i]) : [];
|
|
231
|
+
for (let c = 0; c < itemWidth; c++) cells.push(itemCells[c] ?? "");
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
pos += 2;
|
|
235
|
+
out.push(cells.join(",") + "\r\n");
|
|
236
|
+
}
|
|
237
|
+
return out.join("");
|
|
238
|
+
}
|
|
239
|
+
/** The cells of a run of them joined with commas, as `toCSVCell` wrote them. */
|
|
240
|
+
function splitCsvCells(text) {
|
|
241
|
+
const cells = [];
|
|
242
|
+
let pos = 0;
|
|
243
|
+
for (;;) {
|
|
244
|
+
const end = csvCellEnd(text, pos);
|
|
245
|
+
cells.push(text.slice(pos, end));
|
|
246
|
+
if (end >= text.length) return cells;
|
|
247
|
+
pos = end + 1;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Where the cell starting at `start` ends. Every cell `toCSVCell` writes is
|
|
252
|
+
* either empty or quoted with its own quotes doubled, so the next lone quote
|
|
253
|
+
* closes it.
|
|
254
|
+
*/
|
|
255
|
+
function csvCellEnd(text, start) {
|
|
256
|
+
if (text.charCodeAt(start) !== 34) return start;
|
|
257
|
+
let i = start + 1;
|
|
258
|
+
for (;;) {
|
|
259
|
+
const quote = text.indexOf("\"", i);
|
|
260
|
+
if (quote < 0) return text.length;
|
|
261
|
+
if (text.charCodeAt(quote + 1) === 34) i = quote + 2;
|
|
262
|
+
else return quote + 1;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Get headers for property. There could be more than one header per property
|
|
267
|
+
* @param property
|
|
268
|
+
* @param propertyKey
|
|
269
|
+
* @param prefix
|
|
270
|
+
*/
|
|
271
|
+
function getHeaders(property, propertyKey, prefix = "") {
|
|
272
|
+
const currentKey = prefix ? `${prefix}.${propertyKey}` : propertyKey;
|
|
273
|
+
if (property.type === "map" && property.properties) return Object.entries(property.properties).map(([childKey, p]) => getHeaders(p, childKey, currentKey)).flat();
|
|
274
|
+
else return [{
|
|
275
|
+
label: currentKey,
|
|
276
|
+
key: currentKey
|
|
277
|
+
}];
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Read whatever a `date` column actually arrived as into a `Date`.
|
|
281
|
+
*
|
|
282
|
+
* The driver/WebSocket path revives `{ __type: "date" }` into a `Date`; the REST
|
|
283
|
+
* path — which is the one the admin is on — leaves an ISO string, and an epoch
|
|
284
|
+
* number is what a re-imported export carries. Returns `undefined` for anything
|
|
285
|
+
* that is not a date, so the caller can pass the raw value through.
|
|
286
|
+
*/
|
|
287
|
+
function toExportableDate(inputValue) {
|
|
288
|
+
if (inputValue instanceof Date) return Number.isNaN(inputValue.getTime()) ? void 0 : inputValue;
|
|
289
|
+
if (typeof inputValue === "number" && Number.isFinite(inputValue)) return new Date(inputValue);
|
|
290
|
+
if (typeof inputValue === "string" && inputValue.trim() !== "") {
|
|
291
|
+
const parsed = new Date(inputValue);
|
|
292
|
+
return Number.isNaN(parsed.getTime()) ? void 0 : parsed;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* The id a relation value points at, for a relation property's value — an
|
|
297
|
+
* `EntityRelation`, or the same thing still in its `{ __type: "relation" }`
|
|
298
|
+
* wire form. `undefined` for anything else, so a bare foreign key passes
|
|
299
|
+
* through as the id it already is.
|
|
300
|
+
*/
|
|
301
|
+
function relationIdForExport(value) {
|
|
302
|
+
if (value instanceof EntityRelation) return value.id;
|
|
303
|
+
if (typeof value === "object" && value !== null && "__type" in value && value.__type === "relation" && "id" in value && (typeof value.id === "string" || typeof value.id === "number")) return value.id;
|
|
304
|
+
}
|
|
305
|
+
function processValueForExport(inputValue, property, exportType, dateExportType) {
|
|
306
|
+
let value;
|
|
307
|
+
if (property.type === "relation") {
|
|
308
|
+
const toId = (item) => relationIdForExport(item) ?? item;
|
|
309
|
+
value = Array.isArray(inputValue) ? inputValue.map(toId) : toId(inputValue);
|
|
310
|
+
} else if (property.type === "map" && property.properties) value = processValuesForExport(inputValue, property.properties, exportType, dateExportType);
|
|
311
|
+
else if (property.type === "array") if (property.of && Array.isArray(inputValue)) if (Array.isArray(property.of)) value = property.of.map((p, i) => processValueForExport(inputValue[i], p, exportType, dateExportType));
|
|
312
|
+
else if (property.of.type === "map") value = exportType === "csv" ? inputValue.map((e) => JSON.stringify(e)) : inputValue.map((e) => processValueForExport(e, property.of, exportType, dateExportType));
|
|
313
|
+
else value = inputValue.map((e) => processValueForExport(e, property.of, exportType, dateExportType));
|
|
314
|
+
else value = inputValue;
|
|
315
|
+
else if (property.type === "reference" && inputValue && typeof inputValue === "object" && "isEntityReference" in inputValue && typeof inputValue.isEntityReference === "function" && inputValue.isEntityReference()) {
|
|
316
|
+
const ref = inputValue ? inputValue : void 0;
|
|
317
|
+
value = ref ? ref.fullPath : null;
|
|
318
|
+
} else if (property.type === "date") {
|
|
319
|
+
const date = toExportableDate(inputValue);
|
|
320
|
+
value = date ? dateExportType === "timestamp" ? date.getTime() : date.toISOString() : inputValue;
|
|
321
|
+
} else value = inputValue;
|
|
322
|
+
return value;
|
|
323
|
+
}
|
|
324
|
+
function processValuesForExport(inputValues, properties, exportType, dateExportType) {
|
|
325
|
+
const result = { ...inputValues };
|
|
326
|
+
for (const [key, property] of Object.entries(properties)) {
|
|
327
|
+
const updatedValue = processValueForExport(inputValues && inputValues[key], property, exportType, dateExportType);
|
|
328
|
+
if (updatedValue === void 0) continue;
|
|
329
|
+
if (key === "__proto__") Object.defineProperty(result, key, {
|
|
330
|
+
value: updatedValue,
|
|
331
|
+
enumerable: true,
|
|
332
|
+
writable: true,
|
|
333
|
+
configurable: true
|
|
334
|
+
});
|
|
335
|
+
else result[key] = updatedValue;
|
|
336
|
+
}
|
|
337
|
+
return result;
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Characters that make a spreadsheet read a cell as a formula rather than text.
|
|
341
|
+
*
|
|
342
|
+
* Quoting is CSV *escaping* and is not enough: Excel, LibreOffice Calc and
|
|
343
|
+
* Sheets strip the CSV quoting at parse time and then evaluate a cell whose
|
|
344
|
+
* first character is one of these — `=HYPERLINK(…)` exfiltrates neighbouring
|
|
345
|
+
* cells on click, `=cmd|'…'!A0` is worse.
|
|
346
|
+
*/
|
|
347
|
+
var FORMULA_TRIGGERS = [
|
|
348
|
+
"=",
|
|
349
|
+
"+",
|
|
350
|
+
"-",
|
|
351
|
+
"@",
|
|
352
|
+
" ",
|
|
353
|
+
"\r"
|
|
354
|
+
];
|
|
355
|
+
/**
|
|
356
|
+
* Neutralise a cell that a spreadsheet would otherwise evaluate, by prefixing a
|
|
357
|
+
* single quote — the standard OWASP mitigation. The apostrophe is consumed by
|
|
358
|
+
* the spreadsheet as "treat the rest as text", so the value reads back intact.
|
|
359
|
+
*/
|
|
360
|
+
function escapeCsvFormula(value) {
|
|
361
|
+
const first = value.charAt(0);
|
|
362
|
+
if (!FORMULA_TRIGGERS.includes(first)) return value;
|
|
363
|
+
if ((first === "-" || first === "+") && value.trim() !== "" && Number.isFinite(Number(value))) return value;
|
|
364
|
+
return "'" + value;
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* The inverse of {@link escapeCsvFormula}, for a file read back in: a cell that
|
|
368
|
+
* is an apostrophe followed by a formula trigger loses the apostrophe, as it
|
|
369
|
+
* does when a spreadsheet reads it. Any other apostrophe is text.
|
|
370
|
+
*/
|
|
371
|
+
function unescapeCsvFormula(value) {
|
|
372
|
+
return value.charAt(0) === "'" && FORMULA_TRIGGERS.includes(value.charAt(1)) ? value.slice(1) : value;
|
|
373
|
+
}
|
|
374
|
+
function toCSVCell(v) {
|
|
375
|
+
if (v === null || v === void 0) return "";
|
|
376
|
+
return "\"" + escapeCsvFormula(Array.isArray(v) || typeof v === "object" && !(v instanceof Date) ? JSON.stringify(v) : String(v)).replaceAll("\"", "\"\"") + "\"";
|
|
377
|
+
}
|
|
378
|
+
function entryToCSVRow(entry) {
|
|
379
|
+
return entry.map(toCSVCell).join(",") + "\r\n";
|
|
380
|
+
}
|
|
381
|
+
function downloadBlob(content, filename, contentType) {
|
|
382
|
+
const blob = new Blob(content, { type: contentType });
|
|
383
|
+
const url = URL.createObjectURL(blob);
|
|
384
|
+
const pom = document.createElement("a");
|
|
385
|
+
pom.href = url;
|
|
386
|
+
pom.setAttribute("download", filename);
|
|
387
|
+
pom.click();
|
|
388
|
+
setTimeout(() => URL.revokeObjectURL(url), BLOB_URL_LIFETIME_MS);
|
|
389
|
+
}
|
|
390
|
+
/** How long an export's object URL outlives the click that downloads it. */
|
|
391
|
+
var BLOB_URL_LIFETIME_MS = 1e4;
|
|
392
|
+
function downloadDataAsCsv(data, name) {
|
|
393
|
+
if (data.length === 0) return;
|
|
394
|
+
const headers = Object.keys(data[0]);
|
|
395
|
+
downloadBlob([[headers.join(","), ...data.map((row) => headers.map((header) => toCSVCell(row[header])).join(","))].join("\r\n")], `${name}.csv`, "text/csv");
|
|
396
|
+
}
|
|
397
|
+
//#endregion
|
|
398
|
+
export { createCsvExportWriter, downloadBlob, downloadDataAsCsv, downloadEntitiesExport, entryToCSVRow, escapeCsvFormula, getEntityCSVExportableData, getEntityJsonExportableData, unescapeCsvFormula };
|
|
399
|
+
|
|
400
|
+
//# sourceMappingURL=export.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export.js","names":[],"sources":["../../../src/data_export/export/export.ts"],"sourcesContent":["import { Entity, EntityReference, EntityRelation, 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 writer = createCsvExportWriter({\n properties,\n propertiesOrder,\n additionalHeaders,\n flattenArrays,\n dateExportType\n });\n writer.addPage(data, additionalData);\n downloadBlob(writer.finish(), `${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 return mergeExportRows(data, additionalData, properties, \"csv\", dateExportType)\n .map((entry) => headers.map((header) => getValueInPath(entry, header.key)));\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 return mergeExportRows(data, additionalData, properties, \"json\", dateExportType);\n}\n\n/**\n * Each entity as the record its export row is read from: `id`, the processed\n * values, then `additionalData[i]` over them. An `additionalData` longer than\n * `data` adds rows of its own.\n */\nfunction mergeExportRows(data: Entity<Record<string, unknown>>[],\n additionalData: Record<string, unknown>[] | undefined,\n properties: Properties,\n exportType: \"csv\" | \"json\",\n dateExportType: \"timestamp\" | \"string\"\n): Record<string, unknown>[] {\n\n const mergedData: Record<string, unknown>[] = data.map(e => ({\n id: e.id,\n ...processValuesForExport(e.values, properties, exportType, 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\n/**\n * The columns of an export, in groups: the `id`, then one group per property\n * in `propertiesOrder`, then one per additional header. A property's group is\n * the one that becomes a column per array item (`tags[0]`, `tags[1]`, …) when\n * arrays are flattened and some row holds more than one.\n */\ninterface ExportHeaderGroup {\n /** The property's key, for a property's group. */\n key?: string;\n property?: Property;\n /** The group's columns while its array is not expanded. */\n headers: Header[];\n}\n\nfunction getExportHeaderGroups(properties: Properties,\n propertiesOrder: string[] | undefined,\n additionalHeaders: string[] | undefined): ExportHeaderGroup[] {\n\n const groups: ExportHeaderGroup[] = [{ headers: [{ label: \"id\", key: \"id\" }] }];\n for (const childKey of propertiesOrder ?? Object.keys(properties)) {\n // The first column already is the id. A collection that declares its\n // key as a property named `id` wrote it twice, and the import refuses\n // a file with a duplicate header.\n if (childKey === \"id\") continue;\n const property = properties[childKey];\n if (!property) {\n console.warn(\"Property not found\", childKey, properties);\n continue;\n }\n groups.push({ key: childKey, property: property as Property, headers: getHeaders(property as Property, childKey, \"\") });\n }\n if (additionalHeaders) {\n groups.push(...additionalHeaders.map(h => ({ headers: [{ label: h, key: h }] })));\n }\n return groups;\n}\n\n/** How many columns per item the group's array spreads into, or 0 when it does not. */\nfunction expandedItemCount(group: ExportHeaderGroup, arrayValuesCount: ArrayValuesCount): number {\n if (group.key === undefined) return 0;\n const count = arrayValuesCount[group.key];\n return count > 1 ? count : 0;\n}\n\n/** The group's columns for array item `index`. */\nfunction itemHeaders(group: ExportHeaderGroup, index: number): Header[] {\n return getHeaders(group.property as Property, `${group.key}[${index}]`, \"\");\n}\n\nfunction headersOf(groups: ExportHeaderGroup[], arrayValuesCount: ArrayValuesCount): Header[] {\n return groups.flatMap((group) => {\n const count = expandedItemCount(group, arrayValuesCount);\n return count > 0\n ? Array.from({ length: count }, (_, i) => itemHeaders(group, i)).flat()\n : group.headers;\n });\n}\n\nfunction rowCells(entry: Record<string, unknown>, headers: Header[]): string[] {\n return headers.map((header) => toCSVCell(getValueInPath(entry, header.key)));\n}\n\nexport interface CsvExportWriterParams {\n properties: Properties;\n propertiesOrder: string[] | undefined;\n additionalHeaders: string[] | undefined;\n flattenArrays: boolean;\n dateExportType: \"timestamp\" | \"string\";\n}\n\n/**\n * Writes a CSV export one page of entities at a time.\n *\n * An export used to hold every entity it read, then a copy of every row, then\n * an array of cells per row, then the row strings — about 211 MB at its peak\n * for 100,000 rows × 20 columns, for a 32 MB file. Each page is now turned\n * into its CSV text as it arrives and its entities are let go; what is held\n * is the text itself.\n *\n * The file is the one the in-memory export wrote, byte for byte. What makes\n * that work across pages is `flattenArrays`: the columns an array spreads into\n * (`tags[0]` … `tags[n-1]`) depend on the longest array in *any* row, which\n * an early page cannot know. So a page is written with the columns known when\n * it arrives, and a row also keeps the cells of any array items those columns\n * leave out. At the end, a page written with fewer columns than the file has\n * is re-cut: its cells copied, and an array's swapped for, or extended with,\n * the kept item cells (or empty ones). Usually the longest array is met in the\n * first page and nothing is re-cut. A property key with `.` or `[` in it\n * resolves through other properties when spread, so an export with one keeps\n * its rows' records and writes them at the end, as before.\n */\nexport interface CsvExportWriter {\n /** One page of entities, with their additional-column values index for index. */\n addPage(data: Entity<Record<string, unknown>>[], additionalData?: Record<string, unknown>[]): void;\n /** The whole file, header row first. Once: the pages are handed over. */\n finish(): BlobPart[];\n}\n\n/**\n * A row's cells for the items of one array that its page's columns leave out,\n * kept in case the file has columns for them. The cells of items `0…n-1` in\n * one string, for an array its page did not spread; otherwise one string per\n * item, a hole where an item is not kept or its cells are all empty.\n */\ntype RowItemCells = string | (string | undefined)[];\n\ninterface CsvExportPage {\n /** The rows, `\\r\\n` after each. */\n text: string;\n rows: number;\n /** Per group, the items its array was spread into on this page; 0 when not spread. */\n spread: number[];\n /** By `row * groups + group`, for the rows that hold items `spread` leaves out. */\n items?: (RowItemCells | undefined)[];\n /** The rows' records, when the export cannot be re-cut (see the writer). */\n entries?: Record<string, unknown>[];\n}\n\nexport function createCsvExportWriter({\n properties,\n propertiesOrder,\n additionalHeaders,\n flattenArrays,\n dateExportType\n}: CsvExportWriterParams): CsvExportWriter {\n\n const groups = getExportHeaderGroups(properties, propertiesOrder, additionalHeaders);\n // The columns of item `i` of each group, built once per item, not per row.\n const itemHeaderCache: Header[][][] = groups.map(() => []);\n const headersOfItem = (groupIndex: number, index: number): Header[] =>\n itemHeaderCache[groupIndex][index] ??= itemHeaders(groups[groupIndex], index);\n // Cells per item; a group with none (a map with no properties) spreads\n // into no columns at all.\n const itemWidths = groups.map((group, groupIndex) => group.key === undefined ? 0 : headersOfItem(groupIndex, 0).length);\n const arrayValuesCount: ArrayValuesCount = {};\n // A key the spread column's path would read through some other property.\n const keepEntries = flattenArrays && groups.some((group) => group.key !== undefined && /[.[\\]]/.test(group.key));\n const pages: CsvExportPage[] = [];\n\n return {\n addPage(data, additionalData) {\n if (flattenArrays) {\n // Merged by maximum, which is what one pass over every row\n // computes.\n for (const [key, count] of Object.entries(getArrayValuesCount(data.map(d => d.values)))) {\n arrayValuesCount[key] = Math.max(arrayValuesCount[key] || 0, count);\n }\n }\n const spread = groups.map((group) => expandedItemCount(group, arrayValuesCount));\n const entries = mergeExportRows(data, additionalData, properties, \"csv\", dateExportType);\n if (keepEntries) {\n pages.push({ text: \"\", rows: entries.length, spread, entries });\n return;\n }\n const headers = headersOf(groups, arrayValuesCount);\n const lines: string[] = [];\n let items: CsvExportPage[\"items\"];\n entries.forEach((entry, row) => {\n lines.push(rowCells(entry, headers).join(\",\") + \"\\r\\n\");\n if (!flattenArrays) return;\n const bracketed = bracketedKeyIndices(entry);\n groups.forEach((group, groupIndex) => {\n if (group.key === undefined || itemWidths[groupIndex] === 0) return;\n const written = spread[groupIndex];\n const indices = itemIndicesWithValues(entry, group.key, bracketed)\n .filter((index) => index >= written);\n if (indices.length === 0) return;\n const value = entry[group.key];\n let cells: RowItemCells;\n if (written === 0 && Array.isArray(value) && indices.length === value.length) {\n cells = value.map((_, index) => rowCells(entry, headersOfItem(groupIndex, index)).join(\",\")).join(\",\");\n } else {\n cells = [];\n for (const index of indices) {\n cells[index] = rowCells(entry, headersOfItem(groupIndex, index)).join(\",\");\n }\n }\n (items ??= [])[row * groups.length + groupIndex] = cells;\n });\n });\n pages.push({ text: lines.join(\"\"), rows: entries.length, spread, items });\n },\n\n finish() {\n const counts = flattenArrays ? arrayValuesCount : {};\n const headers = headersOf(groups, counts);\n const parts: BlobPart[] = [entryToCSVRow(headers.map(h => h.label))];\n const spread = groups.map((group) => expandedItemCount(group, counts));\n\n // Handed over a page at a time, so a re-cut page and the text it\n // was cut from are not both held for the whole file.\n for (let page = pages.shift(); page; page = pages.shift()) {\n if (page.entries) {\n parts.push(page.entries.map((entry) => rowCells(entry, headers).join(\",\") + \"\\r\\n\").join(\"\"));\n } else if (page.spread.every((count, groupIndex) => count === spread[groupIndex])) {\n parts.push(page.text);\n } else {\n parts.push(recutPage(page, groups, spread, itemWidths));\n }\n }\n return parts;\n }\n };\n}\n\n/**\n * The record's own keys spelled `key[i]…`, by `key`: `getValueInPath` reads\n * one of those for the cell `key[i]` before anything else. Almost never there.\n */\nfunction bracketedKeyIndices(entry: Record<string, unknown>): Map<string, number[]> | undefined {\n let found: Map<string, number[]> | undefined;\n for (const own of Object.keys(entry)) {\n if (!own.includes(\"[\")) continue;\n const match = /^(.*?)\\[(\\d+)\\]/.exec(own);\n if (!match) continue;\n found ??= new Map();\n const indices = found.get(match[1]) ?? [];\n indices.push(Number(match[2]));\n found.set(match[1], indices);\n }\n return found;\n}\n\nconst NO_INDICES: number[] = [];\n\n/**\n * The array items of `entry[key]` whose spread cells may not all be empty —\n * every other item's are, as `getValueInPath` reads `key[i]` and\n * `key[i].child`: an array's own items, an object's own integer-named keys\n * (read as `key[i]` too), and a key of the record spelled `key[i]…` itself.\n * Over-including is harmless; the cells are computed, not assumed.\n */\nfunction itemIndicesWithValues(entry: Record<string, unknown>,\n key: string,\n bracketed: Map<string, number[]> | undefined): number[] {\n const value = entry[key];\n const extra = bracketed?.get(key);\n if (!extra) {\n // The common cases, without building a set per cell.\n if (Array.isArray(value)) return value.map((_, i) => i);\n if (value === null || typeof value !== \"object\") return NO_INDICES;\n }\n const indices = new Set<number>();\n if (Array.isArray(value)) {\n for (let i = 0; i < value.length; i++) indices.add(i);\n } else if (value !== null && typeof value === \"object\") {\n for (const own of Object.getOwnPropertyNames(value)) {\n const match = /^(\\d+)(?:$|[.[])/.exec(own);\n if (match) indices.add(Number(match[1]));\n }\n }\n extra?.forEach((index) => indices.add(index));\n return [...indices];\n}\n\n/**\n * A page written with fewer columns than the file has, cut back into cells\n * and written again: each array the file spreads further than the page did\n * gets its kept item cells, or empty ones.\n */\nfunction recutPage(page: CsvExportPage, groups: ExportHeaderGroup[], spread: number[], itemWidths: number[]): string {\n const text = page.text;\n const out: string[] = [];\n let pos = 0;\n for (let row = 0; row < page.rows; row++) {\n const cells: string[] = [];\n let first = true;\n groups.forEach((group, groupIndex) => {\n const written = page.spread[groupIndex];\n const itemWidth = itemWidths[groupIndex];\n const width = written > 0 ? written * itemWidth : group.headers.length;\n const groupCells: string[] = [];\n for (let c = 0; c < width; c++) {\n if (!first) pos++; // the comma before every cell but the row's first\n first = false;\n const end = csvCellEnd(text, pos);\n groupCells.push(text.slice(pos, end));\n pos = end;\n }\n const count = spread[groupIndex];\n if (count === written) {\n cells.push(...groupCells);\n return;\n }\n // Spread further than the page was: the items it wrote stay.\n if (written > 0) cells.push(...groupCells);\n const items = page.items?.[row * groups.length + groupIndex];\n const dense = typeof items === \"string\" ? splitCsvCells(items) : undefined;\n for (let i = written; i < count; i++) {\n const itemCells = dense\n ? dense.slice(i * itemWidth, (i + 1) * itemWidth)\n : (typeof items === \"object\" && items[i] !== undefined ? splitCsvCells(items[i] as string) : []);\n for (let c = 0; c < itemWidth; c++) cells.push(itemCells[c] ?? \"\");\n }\n });\n pos += 2; // \"\\r\\n\"\n out.push(cells.join(\",\") + \"\\r\\n\");\n }\n return out.join(\"\");\n}\n\n/** The cells of a run of them joined with commas, as `toCSVCell` wrote them. */\nfunction splitCsvCells(text: string): string[] {\n const cells: string[] = [];\n let pos = 0;\n for (; ;) {\n const end = csvCellEnd(text, pos);\n cells.push(text.slice(pos, end));\n if (end >= text.length) return cells;\n pos = end + 1;\n }\n}\n\n/**\n * Where the cell starting at `start` ends. Every cell `toCSVCell` writes is\n * either empty or quoted with its own quotes doubled, so the next lone quote\n * closes it.\n */\nfunction csvCellEnd(text: string, start: number): number {\n if (text.charCodeAt(start) !== 34 /* \" */) return start;\n let i = start + 1;\n for (; ;) {\n const quote = text.indexOf(\"\\\"\", i);\n if (quote < 0) return text.length;\n if (text.charCodeAt(quote + 1) === 34) {\n i = quote + 2;\n } else {\n return quote + 1;\n }\n }\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\n/**\n * The id a relation value points at, for a relation property's value — an\n * `EntityRelation`, or the same thing still in its `{ __type: \"relation\" }`\n * wire form. `undefined` for anything else, so a bare foreign key passes\n * through as the id it already is.\n */\nfunction relationIdForExport(value: unknown): string | number | undefined {\n if (value instanceof EntityRelation) return value.id;\n if (typeof value === \"object\" && value !== null\n && \"__type\" in value && value.__type === \"relation\"\n && \"id\" in value && (typeof value.id === \"string\" || typeof value.id === \"number\")) {\n return value.id;\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 === \"relation\") {\n // A relation is exported as the id it points at — what the import\n // writes back — rather than the view-model object the admin holds,\n // which a CSV cell printed as `[object Object]`. To-many relations\n // are arrays of them.\n const toId = (item: unknown) => relationIdForExport(item) ?? item;\n value = Array.isArray(inputValue) ? inputValue.map(toId) : toId(inputValue);\n } else 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 // One accumulator. Merging `{ [key]: value }` objects pairwise copied the\n // whole row once per property — the square of the property count, per row.\n const result: Record<string, unknown> = { ...inputValues };\n for (const [key, property] of Object.entries(properties)) {\n const inputValue = inputValues && (inputValues)[key];\n const updatedValue = processValueForExport(inputValue, property as Property, exportType, dateExportType);\n if (updatedValue === undefined) continue;\n if (key === \"__proto__\") {\n // An own property, as the object spread made it, not the prototype.\n Object.defineProperty(result, key, { value: updatedValue, enumerable: true, writable: true, configurable: true });\n } else {\n result[key] = updatedValue;\n }\n }\n return result;\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\n/**\n * The inverse of {@link escapeCsvFormula}, for a file read back in: a cell that\n * is an apostrophe followed by a formula trigger loses the apostrophe, as it\n * does when a spreadsheet reads it. Any other apostrophe is text.\n */\nexport function unescapeCsvFormula(value: string): string {\n return value.charAt(0) === \"'\" && FORMULA_TRIGGERS.includes(value.charAt(1))\n ? value.slice(1)\n : value;\n}\n\nfunction toCSVCell(v: unknown): string {\n if (v === null || v === undefined) return \"\";\n // An array or object (a geopoint, a value no property declares) is written\n // as its JSON: `String()` of an object is `[object Object]`. Date\n // properties are normalised before they get here.\n const s = Array.isArray(v) || (typeof v === \"object\" && !(v instanceof Date))\n ? JSON.stringify(v)\n : 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 // Unrevoked, the URL kept the whole file in memory until the tab closed —\n // one more copy per export. The download holds its own reference once it\n // has started; the delay covers browsers that start it a moment after\n // `click()` returns.\n setTimeout(() => URL.revokeObjectURL(url), BLOB_URL_LIFETIME_MS);\n}\n\n/** How long an export's object URL outlives the click that downloads it. */\nconst BLOB_URL_LIFETIME_MS = 10_000;\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"],"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;EACtB,MAAM,SAAS,sBAAsB;GACjC;GACA;GACA;GACA;GACA;EACJ,CAAC;EACD,OAAO,QAAQ,MAAM,cAAc;EACnC,aAAa,OAAO,OAAO,GAAG,GAAG,KAAK,OAAO,UAAU;CAC3D,OAAO;EACH,MAAM,iBAAiB,4BAA4B,MAAM,gBAAgB,YAAY,cAAc;EAEnG,aAAa,CADA,KAAK,UAAU,gBAAgB,MAAM,CACpC,CAAI,GAAG,GAAG,KAAK,QAAQ,kBAAkB;CAC3D;AACJ;AAEA,SAAgB,2BAA2B,MACvC,gBACA,YACA,SACA,gBACF;CACE,OAAO,gBAAgB,MAAM,gBAAgB,YAAY,OAAO,cAAc,CAAC,CAC1E,KAAK,UAAU,QAAQ,KAAK,WAAW,eAAe,OAAO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
-
* Rows asked for per request
|
|
5
|
-
*
|
|
6
|
-
* Kept at or below the server's `MAX_LIST_LIMIT`, which is now the largest page
|
|
7
|
-
* a read will serve *and refuses* anything larger — it used to clamp silently,
|
|
4
|
+
* Rows asked for per request: the server's `MAX_LIST_LIMIT`, the largest page a
|
|
5
|
+
* read will serve — it *refuses* anything larger. (It used to clamp silently,
|
|
8
6
|
* and asking for 100 000 while receiving 1 000 looked exactly like a collection
|
|
9
|
-
* with 1 000 rows in it. The walk still never trusts the page size it asked
|
|
10
|
-
* it advances by the rows it was actually handed.
|
|
7
|
+
* with 1 000 rows in it.) The walk still never trusts the page size it asked
|
|
8
|
+
* for: it advances by the rows it was actually handed. It was 500, which made a
|
|
9
|
+
* 100 000-row export 200 sequential requests, each with its own count.
|
|
11
10
|
*/
|
|
12
|
-
export declare const EXPORT_PAGE_SIZE =
|
|
11
|
+
export declare const EXPORT_PAGE_SIZE = 1000;
|
|
13
12
|
/**
|
|
14
13
|
* Most rows one browser-side export will materialise.
|
|
15
14
|
*
|
|
@@ -40,3 +39,14 @@ export interface FetchAllForExportParams<M extends Record<string, unknown>> {
|
|
|
40
39
|
* @throws When more than `maxRows` rows match.
|
|
41
40
|
*/
|
|
42
41
|
export declare function fetchAllEntitiesForExport<M extends Record<string, unknown>>({ accessor, params, pageSize, maxRows, onProgress }: FetchAllForExportParams<M>): Promise<Entity<M>[]>;
|
|
42
|
+
/**
|
|
43
|
+
* {@link fetchAllEntitiesForExport}, handing each page to `onPage` as it is
|
|
44
|
+
* read instead of collecting every row: for an export that writes its file as
|
|
45
|
+
* it goes (CSV), so that what it holds is the file and one page, not every
|
|
46
|
+
* entity in it.
|
|
47
|
+
*
|
|
48
|
+
* @throws When more than `maxRows` rows match.
|
|
49
|
+
*/
|
|
50
|
+
export declare function forEachEntityPageForExport<M extends Record<string, unknown>>({ accessor, params, pageSize, maxRows, onProgress, onPage }: FetchAllForExportParams<M> & {
|
|
51
|
+
onPage: (page: Entity<M>[]) => void | Promise<void>;
|
|
52
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { forEachEntityPage, walkEntityPages } from "../../util/entity_pages.js";
|
|
2
|
+
import { MAX_LIST_LIMIT } from "@rebasepro/types";
|
|
3
|
+
//#region src/data_export/export/fetch_export_data.ts
|
|
4
|
+
/**
|
|
5
|
+
* Rows asked for per request: the server's `MAX_LIST_LIMIT`, the largest page a
|
|
6
|
+
* read will serve — it *refuses* anything larger. (It used to clamp silently,
|
|
7
|
+
* and asking for 100 000 while receiving 1 000 looked exactly like a collection
|
|
8
|
+
* with 1 000 rows in it.) The walk still never trusts the page size it asked
|
|
9
|
+
* for: it advances by the rows it was actually handed. It was 500, which made a
|
|
10
|
+
* 100 000-row export 200 sequential requests, each with its own count.
|
|
11
|
+
*/
|
|
12
|
+
var EXPORT_PAGE_SIZE = MAX_LIST_LIMIT;
|
|
13
|
+
/**
|
|
14
|
+
* Most rows one browser-side export will materialise.
|
|
15
|
+
*
|
|
16
|
+
* Everything here is built in memory and handed to a Blob, so there is a
|
|
17
|
+
* ceiling whether or not it is named. Naming it means going over it **throws**
|
|
18
|
+
* instead of writing a short file that reads like the whole collection.
|
|
19
|
+
*/
|
|
20
|
+
var MAX_EXPORT_ROWS = 1e5;
|
|
21
|
+
/**
|
|
22
|
+
* Read **every** row matching a query, for an export file.
|
|
23
|
+
*
|
|
24
|
+
* The export used to hand back the 50 rows an unwindowed `find({})` resolves to
|
|
25
|
+
* as `<collection>.csv`, with nothing saying it was a sample, next to a dialog
|
|
26
|
+
* warning that the collection had 100 000 documents. The walk is in
|
|
27
|
+
* {@link walkEntityPages}; what belongs to export is the ceiling — an export is
|
|
28
|
+
* built in memory and handed to a Blob — and what to say on hitting it.
|
|
29
|
+
*
|
|
30
|
+
* @throws When more than `maxRows` rows match.
|
|
31
|
+
*/
|
|
32
|
+
async function fetchAllEntitiesForExport({ accessor, params, pageSize = EXPORT_PAGE_SIZE, maxRows = MAX_EXPORT_ROWS, onProgress }) {
|
|
33
|
+
return walkEntityPages({
|
|
34
|
+
accessor,
|
|
35
|
+
params,
|
|
36
|
+
pageSize,
|
|
37
|
+
maxRows,
|
|
38
|
+
onProgress,
|
|
39
|
+
onCeiling: exportCeilingMessage
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* {@link fetchAllEntitiesForExport}, handing each page to `onPage` as it is
|
|
44
|
+
* read instead of collecting every row: for an export that writes its file as
|
|
45
|
+
* it goes (CSV), so that what it holds is the file and one page, not every
|
|
46
|
+
* entity in it.
|
|
47
|
+
*
|
|
48
|
+
* @throws When more than `maxRows` rows match.
|
|
49
|
+
*/
|
|
50
|
+
async function forEachEntityPageForExport({ accessor, params, pageSize = EXPORT_PAGE_SIZE, maxRows = MAX_EXPORT_ROWS, onProgress, onPage }) {
|
|
51
|
+
return forEachEntityPage({
|
|
52
|
+
accessor,
|
|
53
|
+
params,
|
|
54
|
+
pageSize,
|
|
55
|
+
maxRows,
|
|
56
|
+
onProgress,
|
|
57
|
+
onPage,
|
|
58
|
+
onCeiling: exportCeilingMessage
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function exportCeilingMessage(max) {
|
|
62
|
+
return `This export would contain more than ${max.toLocaleString()} rows, which is more than the browser can build in one file. Filter the collection down, or export it from the server.`;
|
|
63
|
+
}
|
|
64
|
+
//#endregion
|
|
65
|
+
export { EXPORT_PAGE_SIZE, MAX_EXPORT_ROWS, fetchAllEntitiesForExport, forEachEntityPageForExport };
|
|
66
|
+
|
|
67
|
+
//# sourceMappingURL=fetch_export_data.js.map
|