@rebasepro/admin 0.13.1-canary.gef9608c → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. package/dist/{CollectionEditorDialog-7b-kSLno.js → CollectionEditorDialog-CSheud_E.js} +19 -9
  2. package/dist/CollectionEditorDialog-CSheud_E.js.map +1 -0
  3. package/dist/{PropertyEditView-C-31uvpG.js → PropertyEditView-CWZlC1gq.js} +5 -5
  4. package/dist/PropertyEditView-CWZlC1gq.js.map +1 -0
  5. package/dist/{RouterCollectionsStudioView-BJylABq3.js → RouterCollectionsStudioView-CwTpdzWF.js} +9 -13
  6. package/dist/RouterCollectionsStudioView-CwTpdzWF.js.map +1 -0
  7. package/dist/collection_editor/serializable_types.d.ts +1 -0
  8. package/dist/collection_editor_ui.js +4 -4
  9. package/dist/components/ClearFilterSortButton.d.ts +7 -1
  10. package/dist/components/CollectionViewBinding/EntityCardBinding.d.ts +3 -1
  11. package/dist/components/CollectionViewBinding/SearchExplanation.d.ts +48 -0
  12. package/dist/components/CollectionViewBinding/SearchHighlight.d.ts +101 -0
  13. package/dist/components/CollectionViewBinding/SlotValue.d.ts +26 -0
  14. package/dist/components/CollectionViewBinding/SortButton.d.ts +7 -1
  15. package/dist/components/CollectionViewBinding/SplitListCloseButton.d.ts +17 -6
  16. package/dist/components/CollectionViewBinding/SplitListShowButton.d.ts +1 -1
  17. package/dist/components/CollectionViewBinding/usePreviewSlots.d.ts +26 -1
  18. package/dist/components/DetailViewBinding.d.ts +7 -0
  19. package/dist/components/DrawerNavigationGroup.d.ts +4 -2
  20. package/dist/components/DrawerNavigationItem.d.ts +13 -5
  21. package/dist/components/EditViewBinding.d.ts +22 -7
  22. package/dist/components/EntityIdentityBar.d.ts +24 -1
  23. package/dist/components/RelationSelector.d.ts +13 -0
  24. package/dist/data_export/export/export.d.ts +7 -0
  25. package/dist/data_export/export/fetch_export_data.d.ts +48 -0
  26. package/dist/data_export/export/index.d.ts +1 -0
  27. package/dist/data_import/utils/csv.d.ts +30 -0
  28. package/dist/data_import/utils/index.d.ts +2 -0
  29. package/dist/data_import/utils/save_entities.d.ts +38 -0
  30. package/dist/data_import/utils/transforms.d.ts +9 -0
  31. package/dist/editor.js +3 -0
  32. package/dist/editor.js.map +1 -1
  33. package/dist/{export-C-XG3aRh.js → export-L53WektO.js} +175 -39
  34. package/dist/export-L53WektO.js.map +1 -0
  35. package/dist/form/form_utils.d.ts +38 -1
  36. package/dist/{history-DfMuvPfr.js → history-D5SKygpJ.js} +2 -2
  37. package/dist/{history-DfMuvPfr.js.map → history-D5SKygpJ.js.map} +1 -1
  38. package/dist/{import-B0GyllB0.js → import-C_4edkoD.js} +5 -4
  39. package/dist/import-C_4edkoD.js.map +1 -0
  40. package/dist/index.d.ts +2 -2
  41. package/dist/index.js +96 -80
  42. package/dist/index.js.map +1 -1
  43. package/dist/preview/components/date_fns_locales.d.ts +9 -0
  44. package/dist/util/view_constants.d.ts +24 -0
  45. package/dist/util/view_mode.d.ts +18 -0
  46. package/dist/{util-DHNXodBo.js → util-C-D5yD2n.js} +2173 -673
  47. package/dist/util-C-D5yD2n.js.map +1 -0
  48. package/package.json +10 -9
  49. package/src/collection_editor/serializable_types.ts +1 -0
  50. package/src/collection_editor/ui/collection_editor/AICollectionGeneratorPopover.tsx +8 -3
  51. package/src/collection_editor/ui/collection_editor/CollectionDetailsForm.tsx +5 -2
  52. package/src/collection_editor/ui/collection_editor/CollectionJsonImportDialog.tsx +1 -0
  53. package/src/collection_editor/ui/collection_editor/CollectionRLSTab.tsx +9 -8
  54. package/src/collection_editor/ui/collection_editor/CollectionsStudioView.tsx +9 -11
  55. package/src/collection_editor/ui/collection_editor/GeneralSettingsForm.tsx +5 -2
  56. package/src/collection_editor/ui/collection_editor/properties/MapPropertyField.tsx +1 -1
  57. package/src/collection_editor/ui/collection_editor/properties/advanced/AdvancedPropertyValidation.tsx +5 -2
  58. package/src/collection_editor/ui/collection_editor/properties/conditions/ConditionsEditor.tsx +1 -0
  59. package/src/collection_editor/useJsonCollectionsConfigController.tsx +92 -84
  60. package/src/collection_editor/useLocalCollectionsConfigController.tsx +10 -3
  61. package/src/components/ClearFilterSortButton.tsx +16 -7
  62. package/src/components/CollectionTableBinding/CollectionTableBinding.tsx +2 -2
  63. package/src/components/CollectionTableBinding/PropertyTableCell.tsx +2 -2
  64. package/src/components/CollectionTableBinding/column_utils.tsx +15 -6
  65. package/src/components/CollectionTableBinding/internal/popup_field/PopupFormField.tsx +2 -2
  66. package/src/components/CollectionTableBinding/table_bindings.tsx +7 -1
  67. package/src/components/CollectionViewBinding/BoardCardBinding.tsx +18 -1
  68. package/src/components/CollectionViewBinding/CollectionBoardViewBinding.tsx +13 -7
  69. package/src/components/CollectionViewBinding/CollectionCardViewBinding.tsx +2 -1
  70. package/src/components/CollectionViewBinding/CollectionListViewBinding.tsx +816 -335
  71. package/src/components/CollectionViewBinding/CollectionViewActions.tsx +1 -1
  72. package/src/components/CollectionViewBinding/CollectionViewBinding.tsx +26 -6
  73. package/src/components/CollectionViewBinding/CollectionViewStartActions.tsx +9 -0
  74. package/src/components/CollectionViewBinding/EntityCardBinding.tsx +45 -10
  75. package/src/components/CollectionViewBinding/SearchExplanation.tsx +106 -0
  76. package/src/components/CollectionViewBinding/SearchHighlight.tsx +311 -0
  77. package/src/components/CollectionViewBinding/SlotValue.tsx +96 -0
  78. package/src/components/CollectionViewBinding/SortButton.tsx +16 -4
  79. package/src/components/CollectionViewBinding/SplitListCloseButton.tsx +23 -9
  80. package/src/components/CollectionViewBinding/SplitListShowButton.tsx +3 -3
  81. package/src/components/CollectionViewBinding/SplitListView.tsx +36 -9
  82. package/src/components/CollectionViewBinding/ViewModeToggle.tsx +10 -5
  83. package/src/components/CollectionViewBinding/useBoardDataController.tsx +11 -3
  84. package/src/components/CollectionViewBinding/usePreviewSlots.ts +76 -24
  85. package/src/components/CollectionViewBinding/utils.ts +7 -4
  86. package/src/components/DefaultDrawer.tsx +7 -0
  87. package/src/components/DetailViewBinding.tsx +33 -9
  88. package/src/components/DrawerNavigationGroup.tsx +12 -32
  89. package/src/components/DrawerNavigationItem.tsx +33 -12
  90. package/src/components/EditViewBinding.tsx +175 -28
  91. package/src/components/EntityIdentityBar.tsx +109 -17
  92. package/src/components/EntityInspector.tsx +24 -6
  93. package/src/components/EntityViewBinding.tsx +4 -2
  94. package/src/components/ReferenceTable/SelectionTableBinding.tsx +4 -2
  95. package/src/components/RelationSelector.tsx +61 -11
  96. package/src/components/SearchIconsView.tsx +14 -33
  97. package/src/components/SelectableTable/filters/StringNumberFilterField.tsx +1 -0
  98. package/src/components/SidePanelBinding.tsx +36 -25
  99. package/src/components/UserSelector.tsx +52 -9
  100. package/src/components/history/LastEditedByIndicator.tsx +7 -12
  101. package/src/data_export/export/ExportCollectionAction.tsx +101 -48
  102. package/src/data_export/export/export.ts +63 -16
  103. package/src/data_export/export/fetch_export_data.ts +90 -0
  104. package/src/data_export/export/index.ts +1 -0
  105. package/src/data_import/components/DataNewPropertiesMapping.tsx +20 -3
  106. package/src/data_import/components/ImportNewPropertyFieldPreview.tsx +1 -0
  107. package/src/data_import/components/ImportSaveInProgress.tsx +35 -36
  108. package/src/data_import/import/ImportCollectionAction.tsx +13 -2
  109. package/src/data_import/utils/csv.ts +153 -0
  110. package/src/data_import/utils/data.ts +16 -2
  111. package/src/data_import/utils/file_to_json.ts +77 -6
  112. package/src/data_import/utils/index.ts +2 -0
  113. package/src/data_import/utils/save_entities.ts +138 -0
  114. package/src/data_import/utils/transforms.ts +23 -0
  115. package/src/editor/components/image-bubble.tsx +2 -0
  116. package/src/editor/selectors/link-selector.tsx +1 -0
  117. package/src/form/EntityForm.tsx +12 -3
  118. package/src/form/EntityFormBinding.tsx +8 -12
  119. package/src/form/PropertyFieldBinding.tsx +2 -2
  120. package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +2 -2
  121. package/src/form/field_bindings/BinaryFieldBinding.tsx +1 -0
  122. package/src/form/field_bindings/BlockFieldBinding.tsx +3 -3
  123. package/src/form/field_bindings/DateTimeFieldBinding.tsx +4 -0
  124. package/src/form/field_bindings/KeyValueFieldBinding.tsx +3 -0
  125. package/src/form/field_bindings/MapFieldBinding.tsx +2 -2
  126. package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +15 -2
  127. package/src/form/field_bindings/RepeatFieldBinding.tsx +3 -3
  128. package/src/form/field_bindings/StorageUploadFieldBinding.tsx +2 -2
  129. package/src/form/field_bindings/TextFieldBinding.tsx +18 -0
  130. package/src/form/field_bindings/VectorFieldBinding.tsx +1 -0
  131. package/src/form/form_utils.ts +78 -0
  132. package/src/index.ts +9 -1
  133. package/src/preview/PropertyPreview.tsx +7 -3
  134. package/src/preview/components/DatePreview.tsx +15 -2
  135. package/src/preview/components/ReferencePreview.tsx +5 -8
  136. package/src/preview/components/RelationPreview.tsx +8 -7
  137. package/src/preview/components/date_fns_locales.ts +125 -0
  138. package/src/preview/property_previews/ArrayOfRelationsPreview.tsx +6 -3
  139. package/src/util/navigation_utils.ts +4 -2
  140. package/src/util/property_utils.tsx +6 -1
  141. package/src/util/view_constants.ts +27 -0
  142. package/src/util/view_mode.ts +36 -0
  143. package/dist/CollectionEditorDialog-7b-kSLno.js.map +0 -1
  144. package/dist/PropertyEditView-C-31uvpG.js.map +0 -1
  145. package/dist/RouterCollectionsStudioView-BJylABq3.js.map +0 -1
  146. package/dist/export-C-XG3aRh.js.map +0 -1
  147. package/dist/import-B0GyllB0.js.map +0 -1
  148. package/dist/util-DHNXodBo.js.map +0 -1
@@ -0,0 +1,48 @@
1
+ import { Entity, FindParams, FindResponse } from "@rebasepro/types";
2
+ /**
3
+ * Rows asked for per request.
4
+ *
5
+ * Kept at or below the server's `MAX_LIST_LIMIT`, which is now the largest page
6
+ * a read will serve *and 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 for:
9
+ * it advances by the rows it was actually handed.
10
+ */
11
+ export declare const EXPORT_PAGE_SIZE = 500;
12
+ /**
13
+ * Most rows one browser-side export will materialise.
14
+ *
15
+ * Everything here is built in memory and handed to a Blob, so there is a
16
+ * ceiling whether or not it is named. Naming it means going over it **throws**
17
+ * instead of writing a short file that reads like the whole collection.
18
+ */
19
+ export declare const MAX_EXPORT_ROWS = 100000;
20
+ export interface FetchAllForExportParams<M extends Record<string, unknown>> {
21
+ /** The collection accessor to read through — `dataClient.collection(path)`. */
22
+ accessor: {
23
+ find(params?: FindParams<M>): Promise<FindResponse<M>>;
24
+ };
25
+ /** Query to export. The window (`limit` / `offset` / `page`) is owned by the walk. */
26
+ params?: Omit<FindParams<M>, "limit" | "offset" | "page">;
27
+ pageSize?: number;
28
+ maxRows?: number;
29
+ /** Called after every page with the rows so far, and the total when the server reports one. */
30
+ onProgress?: (loaded: number, total: number | undefined) => void;
31
+ }
32
+ /**
33
+ * Read **every** row matching a query, one page at a time.
34
+ *
35
+ * `find({})` sends no `limit`, and an absent limit is resolved server-side to
36
+ * `DEFAULT_LIST_LIMIT` — 50 rows. The export used to hand those 50 rows back as
37
+ * `<collection>.csv` with nothing saying it was a sample, next to a dialog
38
+ * warning that the collection had 100 000 documents.
39
+ *
40
+ * Termination is driven by the server's `meta.hasMore` where it is reported and
41
+ * by an empty page otherwise — never by comparing a page's length against the
42
+ * requested limit, since a final page that happens to be exactly full is
43
+ * indistinguishable that way and a walk that stops there drops rows.
44
+ *
45
+ * @throws When more than `maxRows` rows match. A truncated export is worse than
46
+ * no export: it is indistinguishable from a complete one.
47
+ */
48
+ export declare function fetchAllEntitiesForExport<M extends Record<string, unknown>>({ accessor, params, pageSize, maxRows, onProgress }: FetchAllForExportParams<M>): Promise<Entity<M>[]>;
@@ -1,3 +1,4 @@
1
1
  export * from "./export";
2
+ export * from "./fetch_export_data";
2
3
  export * from "./BasicExportAction";
3
4
  export * from "./ExportCollectionAction";
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Split CSV text into rows of raw cells, RFC 4180 style.
3
+ *
4
+ * Quoted fields may contain the delimiter, newlines and doubled quotes; this is
5
+ * the exact inverse of what the export's `entryToCSVRow` writes, so a file this
6
+ * admin produced reads back into the cells it was built from.
7
+ */
8
+ export declare function parseCsvRows(text: string, delimiter?: string): string[][];
9
+ /**
10
+ * Pick the delimiter that splits the header row into the most cells. A
11
+ * single-column file matches nothing and stays on the comma.
12
+ */
13
+ export declare function detectCsvDelimiter(text: string): string;
14
+ export interface ParsedCsv {
15
+ headers: string[];
16
+ data: Record<string, string>[];
17
+ }
18
+ /**
19
+ * Parse CSV text into one object per row, keyed by the header row.
20
+ *
21
+ * The picker accepts `.csv` and the dialog promises "Upload a CSV, Excel or JSON
22
+ * file", but every non-JSON file used to be handed to ExcelJS'
23
+ * `workbook.xlsx.load`, which is a zip reader — so every CSV failed with
24
+ * "Can't find end of central directory : is this a zip file ?". The export
25
+ * writes CSV by default, so the round trip could not close.
26
+ *
27
+ * A blank header keeps its column rather than collapsing it, so the cells to its
28
+ * right stay under their own names.
29
+ */
30
+ export declare function parseCsvToObjects(text: string): ParsedCsv;
@@ -1,3 +1,5 @@
1
1
  export * from "./file_to_json";
2
+ export * from "./csv";
3
+ export * from "./save_entities";
2
4
  export * from "./data";
3
5
  export * from "./get_import_inference_type";
@@ -0,0 +1,38 @@
1
+ import { Entity, RebaseData } from "@rebasepro/types";
2
+ /** Rows written per request, and per transaction where the data source has one. */
3
+ export declare const IMPORT_BATCH_SIZE = 25;
4
+ /**
5
+ * An import failure that says where it stopped.
6
+ *
7
+ * "Error saving data / null value in column "sku" violates not-null constraint"
8
+ * on a ten-thousand-row import named no row, and the Retry button restarted at
9
+ * zero — where the rows already written now conflicted, so it could never
10
+ * succeed. Both halves of that are what this carries.
11
+ */
12
+ export interface ImportSaveError extends Error {
13
+ /** Rows written and confirmed before the failure. Where a retry resumes. */
14
+ committed: number;
15
+ /** Index of the first row that was not written, 0-based. */
16
+ failedFrom: number;
17
+ /** Index after the last row of the batch that was not written. */
18
+ failedTo: number;
19
+ }
20
+ /**
21
+ * Write imported entities in batches, reporting what was committed.
22
+ *
23
+ * Resumable on purpose: a failure at row 4 000 leaves rows 1–3 999 in the table
24
+ * whatever this does, so the only useful thing to report is where to carry on
25
+ * from. `offset` is that point — the Retry button passes back the `committed`
26
+ * count of the error it is retrying, instead of starting from zero and
27
+ * conflicting on every row that already exists.
28
+ *
29
+ * @throws {ImportSaveError} naming the rows that were not written.
30
+ */
31
+ export declare function saveImportedEntities(dataClient: RebaseData, path: string, data: Partial<Entity<any>>[], { offset, batchSize, onBatchCommitted, bulkUnsupported }?: {
32
+ offset?: number;
33
+ batchSize?: number;
34
+ onBatchCommitted?: (rowsWritten: number) => void;
35
+ bulkUnsupported?: {
36
+ current: boolean;
37
+ };
38
+ }): Promise<void>;
@@ -1,6 +1,15 @@
1
1
  /**
2
2
  * Take an object with keys of type `address.street`, `address.city` and
3
3
  * convert it to an object with nested objects like `{ address: { street: ..., city: ... } }`
4
+ *
5
+ * Keys here are the **header row of an uploaded file**, so they are attacker
6
+ * data. `res["__proto__"] = …` is the prototype setter rather than an own
7
+ * property, so a column named `__proto__.polluted` walked out of the accumulator
8
+ * and wrote onto `Object.prototype` for the life of the tab — and
9
+ * `constructor.prototype.x` threw a `TypeError` that surfaced as an unreadable
10
+ * file. Such a column is refused, not sanitised, the way `setIn` settled it
11
+ * (`docs/bug-classes.md` class 22).
12
+ *
4
13
  * @param flatObj
5
14
  */
6
15
  export declare function unflattenObject(flatObj: {
package/dist/editor.js CHANGED
@@ -948,6 +948,7 @@ var ImageBubble = forwardRef(({ options, className }, ref) => {
948
948
  },
949
949
  children: [/* @__PURE__ */ jsx(TextField, {
950
950
  size: "small",
951
+ "aria-label": t("alt_text"),
951
952
  placeholder: t("alt_text"),
952
953
  value: alt,
953
954
  onChange: (e) => {
@@ -956,6 +957,7 @@ var ImageBubble = forwardRef(({ options, className }, ref) => {
956
957
  }
957
958
  }), /* @__PURE__ */ jsx(TextField, {
958
959
  size: "small",
960
+ "aria-label": t("title"),
959
961
  placeholder: t("title"),
960
962
  value: title,
961
963
  onChange: (e) => {
@@ -1614,6 +1616,7 @@ var LinkSelector = ({ open, onOpenChange }) => {
1614
1616
  children: [/* @__PURE__ */ jsx(TextField, {
1615
1617
  inputRef,
1616
1618
  autoFocus: open,
1619
+ "aria-label": t("editor_paste_or_type_link"),
1617
1620
  placeholder: t("editor_paste_or_type_link"),
1618
1621
  defaultValue: href,
1619
1622
  size: "small",