@rebasepro/admin 0.6.1 → 0.8.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 (187) hide show
  1. package/dist/{CollectionEditorDialog-HNXGxXdO.js → CollectionEditorDialog-BO_aQ-Z4.js} +236 -155
  2. package/dist/CollectionEditorDialog-BO_aQ-Z4.js.map +1 -0
  3. package/dist/{PropertyEditView-C2wp8kQ9.js → PropertyEditView-DKzOpMjR.js} +190 -50
  4. package/dist/PropertyEditView-DKzOpMjR.js.map +1 -0
  5. package/dist/{CollectionsStudioView-B1mN33GB.js → RouterCollectionsStudioView-BQTIExjA.js} +61 -39
  6. package/dist/RouterCollectionsStudioView-BQTIExjA.js.map +1 -0
  7. package/dist/collection_editor/_cms_internals.d.ts +1 -1
  8. package/dist/collection_editor/api/generateCollectionApi.d.ts +3 -2
  9. package/dist/collection_editor/extensibility_types.d.ts +135 -0
  10. package/dist/collection_editor/index.d.ts +6 -0
  11. package/dist/collection_editor/serializable_types.d.ts +370 -0
  12. package/dist/collection_editor/serializable_utils.d.ts +50 -0
  13. package/dist/collection_editor/ui/collection_editor/CollectionEditorDialog.d.ts +3 -3
  14. package/dist/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.d.ts +12 -1
  15. package/dist/collection_editor/ui/collection_editor/CollectionStudioView.d.ts +13 -1
  16. package/dist/collection_editor/ui/collection_editor/CollectionsStudioView.d.ts +24 -2
  17. package/dist/collection_editor/ui/collection_editor/DisplaySettingsForm.d.ts +2 -1
  18. package/dist/collection_editor/ui/collection_editor/GeneralSettingsForm.d.ts +4 -1
  19. package/dist/collection_editor/ui/collection_editor/PropertyEditView.d.ts +12 -1
  20. package/dist/collection_editor/ui/collection_editor/RouterCollectionStudioView.d.ts +15 -0
  21. package/dist/collection_editor/ui/collection_editor/RouterCollectionsStudioView.d.ts +14 -0
  22. package/dist/collection_editor/useJsonCollectionsConfigController.d.ts +37 -0
  23. package/dist/collection_editor/useSafeSnackbarController.d.ts +2 -0
  24. package/dist/collection_editor_ui.d.ts +4 -0
  25. package/dist/collection_editor_ui.js +33 -4
  26. package/dist/collection_editor_ui.js.map +1 -0
  27. package/dist/components/EntityCollectionTable/EntityCollectionTable.d.ts +1 -1
  28. package/dist/components/EntityCollectionTable/index.d.ts +1 -1
  29. package/dist/components/EntityCollectionView/EntityBoardCard.d.ts +3 -3
  30. package/dist/components/EntityCollectionView/hooks/useKanbanDragAndDrop.d.ts +3 -3
  31. package/dist/components/EntityEditView.d.ts +3 -2
  32. package/dist/components/RebaseCMS.d.ts +1 -1
  33. package/dist/components/SelectableTable/SelectionStore.d.ts +12 -21
  34. package/dist/components/field_configs.d.ts +1 -1
  35. package/dist/editor/editor.d.ts +0 -6
  36. package/dist/editor.js +1 -3
  37. package/dist/editor.js.map +1 -1
  38. package/dist/form/EntityForm.d.ts +10 -9
  39. package/dist/form/EntityFormBinding.d.ts +27 -0
  40. package/dist/form/components/StorageUploadProgress.d.ts +6 -1
  41. package/dist/form/form_utils.d.ts +8 -0
  42. package/dist/form/index.d.ts +5 -2
  43. package/dist/{history-BO6VT85a.js → history-B3cqBzEV.js} +2 -2
  44. package/dist/{history-BO6VT85a.js.map → history-B3cqBzEV.js.map} +1 -1
  45. package/dist/hooks/navigation/contexts/CollectionRegistryContext.d.ts +1 -1
  46. package/dist/hooks/navigation/useAsyncResolver.d.ts +26 -0
  47. package/dist/hooks/navigation/useBuildCollectionRegistryController.d.ts +2 -0
  48. package/dist/hooks/navigation/useTopLevelNavigation.d.ts +1 -1
  49. package/dist/hooks/navigation/utils.d.ts +1 -1
  50. package/dist/index.d.ts +3 -1
  51. package/dist/index.js +2 -2
  52. package/dist/preview/components/StorageThumbnail.d.ts +3 -1
  53. package/dist/routes/CustomViewRoute.d.ts +2 -1
  54. package/dist/{src-BYniefVu.js → src-cxV1ODRG.js} +1731 -1710
  55. package/dist/src-cxV1ODRG.js.map +1 -0
  56. package/dist/types/components/EntityFormActionsProps.d.ts +1 -1
  57. package/dist/types/components/EntityFormProps.d.ts +59 -0
  58. package/dist/types/components/PropertyPreviewProps.d.ts +2 -1
  59. package/dist/types/fields.d.ts +10 -7
  60. package/dist/util/dataControllerAdapter.d.ts +30 -0
  61. package/dist/util/navigation_utils.d.ts +1 -1
  62. package/dist/util/propertyConfigMapper.d.ts +17 -0
  63. package/package.json +8 -8
  64. package/src/collection_editor/_cms_internals.ts +1 -1
  65. package/src/collection_editor/api/generateCollectionApi.ts +3 -2
  66. package/src/collection_editor/extensibility_types.ts +168 -0
  67. package/src/collection_editor/index.ts +46 -0
  68. package/src/collection_editor/pgColumnToProperty.ts +2 -2
  69. package/src/collection_editor/serializable_types.ts +474 -0
  70. package/src/collection_editor/serializable_utils.ts +576 -0
  71. package/src/collection_editor/ui/collection_editor/AICollectionGeneratorPopover.tsx +6 -6
  72. package/src/collection_editor/ui/collection_editor/CollectionEditorDialog.tsx +170 -89
  73. package/src/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.tsx +95 -78
  74. package/src/collection_editor/ui/collection_editor/CollectionStudioView.tsx +23 -20
  75. package/src/collection_editor/ui/collection_editor/CollectionsStudioView.tsx +79 -27
  76. package/src/collection_editor/ui/collection_editor/DisplaySettingsForm.tsx +9 -7
  77. package/src/collection_editor/ui/collection_editor/GeneralSettingsForm.tsx +22 -5
  78. package/src/collection_editor/ui/collection_editor/GetCodeDialog.tsx +3 -3
  79. package/src/collection_editor/ui/collection_editor/PropertyEditView.tsx +154 -18
  80. package/src/collection_editor/ui/collection_editor/PropertyFieldPreview.tsx +6 -6
  81. package/src/collection_editor/ui/collection_editor/PropertyTree.tsx +1 -0
  82. package/src/collection_editor/ui/collection_editor/RouterCollectionStudioView.tsx +44 -0
  83. package/src/collection_editor/ui/collection_editor/RouterCollectionsStudioView.tsx +41 -0
  84. package/src/collection_editor/ui/collection_editor/properties/EnumPropertyField.tsx +4 -3
  85. package/src/collection_editor/ui/collection_editor/properties/StoragePropertyField.tsx +35 -1
  86. package/src/collection_editor/ui/collection_editor/templates/blog_template.ts +1 -1
  87. package/src/collection_editor/ui/collection_editor/utils/supported_fields.tsx +0 -1
  88. package/src/collection_editor/ui/collection_editor/utils/update_property_for_widget.ts +7 -29
  89. package/src/collection_editor/useJsonCollectionsConfigController.tsx +286 -0
  90. package/src/collection_editor/useSafeSnackbarController.ts +9 -0
  91. package/src/collection_editor_ui.ts +6 -0
  92. package/src/components/DefaultDrawer.tsx +14 -4
  93. package/src/components/DrawerNavigationGroup.tsx +2 -2
  94. package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +11 -9
  95. package/src/components/EntityCollectionTable/fields/TableMultipleRelationField.tsx +2 -1
  96. package/src/components/EntityCollectionTable/fields/TableRelationField.tsx +2 -1
  97. package/src/components/EntityCollectionTable/fields/TableStorageUpload.tsx +23 -20
  98. package/src/components/EntityCollectionTable/index.tsx +1 -1
  99. package/src/components/EntityCollectionTable/table_bindings.tsx +24 -44
  100. package/src/components/EntityCollectionView/EntityBoardCard.tsx +6 -6
  101. package/src/components/EntityCollectionView/EntityCollectionBoardView.tsx +13 -12
  102. package/src/components/EntityCollectionView/EntityCollectionCardView.tsx +40 -190
  103. package/src/components/EntityCollectionView/EntityCollectionListView.tsx +66 -184
  104. package/src/components/EntityCollectionView/EntityCollectionView.tsx +8 -25
  105. package/src/components/EntityCollectionView/hooks/useCollectionInlineEditor.ts +1 -1
  106. package/src/components/EntityCollectionView/hooks/useKanbanDragAndDrop.ts +6 -6
  107. package/src/components/EntityCollectionView/useBoardDataController.tsx +12 -40
  108. package/src/components/EntityCollectionView/useEntityPreviewSlots.ts +3 -3
  109. package/src/components/EntityDetailView.tsx +2 -2
  110. package/src/components/EntityEditView.tsx +7 -6
  111. package/src/components/EntityEditViewFormActions.tsx +35 -29
  112. package/src/components/HomePage/ContentHomePage.tsx +14 -5
  113. package/src/components/RebaseCMS.tsx +3 -3
  114. package/src/components/RebaseNavigation.tsx +74 -9
  115. package/src/components/RelationSelector.tsx +2 -2
  116. package/src/components/SelectableTable/SelectableTable.tsx +13 -5
  117. package/src/components/SelectableTable/SelectionStore.ts +18 -48
  118. package/src/components/SideDialogs.tsx +0 -7
  119. package/src/components/common/default_entity_actions.tsx +22 -11
  120. package/src/components/field_configs.tsx +0 -14
  121. package/src/contexts/BreacrumbsContext.tsx +15 -6
  122. package/src/editor/editor.tsx +4 -7
  123. package/src/editor/selectors/ai-selector.tsx +0 -1
  124. package/src/form/EntityForm.tsx +191 -428
  125. package/src/form/EntityFormActions.tsx +35 -49
  126. package/src/form/EntityFormBinding.tsx +323 -0
  127. package/src/form/components/FormLayout.tsx +1 -1
  128. package/src/form/components/StorageUploadProgress.tsx +9 -2
  129. package/src/form/field_bindings/MarkdownEditorFieldBinding.tsx +12 -1
  130. package/src/form/field_bindings/MultipleRelationFieldBinding.tsx +4 -4
  131. package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +7 -2
  132. package/src/form/field_bindings/RelationFieldBinding.tsx +5 -7
  133. package/src/form/field_bindings/StorageUploadFieldBinding.tsx +19 -15
  134. package/src/form/form_utils.ts +163 -0
  135. package/src/form/index.tsx +14 -6
  136. package/src/hooks/navigation/contexts/CollectionRegistryContext.tsx +2 -2
  137. package/src/hooks/navigation/contexts/NavigationStateContext.tsx +2 -2
  138. package/src/hooks/navigation/contexts/UrlContext.tsx +1 -2
  139. package/src/hooks/navigation/useAsyncResolver.ts +100 -0
  140. package/src/hooks/navigation/useBuildCollectionRegistryController.tsx +15 -8
  141. package/src/hooks/navigation/useBuildNavigationStateController.tsx +12 -8
  142. package/src/hooks/navigation/useNavigationResolution.ts +33 -0
  143. package/src/hooks/navigation/useResolvedCollections.ts +29 -71
  144. package/src/hooks/navigation/useResolvedViews.tsx +40 -70
  145. package/src/hooks/navigation/useTopLevelNavigation.ts +20 -16
  146. package/src/hooks/navigation/utils.ts +7 -4
  147. package/src/index.ts +6 -1
  148. package/src/preview/PropertyPreview.tsx +1 -16
  149. package/src/preview/components/StorageThumbnail.tsx +24 -7
  150. package/src/routes/CustomViewRoute.tsx +14 -6
  151. package/src/types/components/EntityFormActionsProps.tsx +1 -1
  152. package/src/types/components/EntityFormProps.tsx +68 -0
  153. package/src/types/components/PropertyPreviewProps.tsx +1 -1
  154. package/src/types/fields.tsx +9 -8
  155. package/src/util/dataControllerAdapter.ts +93 -0
  156. package/src/util/navigation_utils.ts +1 -1
  157. package/src/util/previews.ts +20 -0
  158. package/src/util/propertyConfigMapper.ts +134 -0
  159. package/src/util/property_utils.tsx +1 -2
  160. package/dist/CollectionEditorDialog-HNXGxXdO.js.map +0 -1
  161. package/dist/CollectionsStudioView-B1mN33GB.js.map +0 -1
  162. package/dist/PropertyEditView-C2wp8kQ9.js.map +0 -1
  163. package/dist/components/EntityCollectionTable/fields/VirtualTableDateField.d.ts +0 -12
  164. package/dist/components/EntityCollectionTable/fields/VirtualTableInput.d.ts +0 -10
  165. package/dist/components/EntityCollectionTable/fields/VirtualTableNumberInput.d.ts +0 -9
  166. package/dist/components/EntityCollectionTable/fields/VirtualTableSwitch.d.ts +0 -8
  167. package/dist/components/EntityCollectionView/Board.d.ts +0 -3
  168. package/dist/components/EntityCollectionView/BoardColumn.d.ts +0 -42
  169. package/dist/components/EntityCollectionView/BoardColumnTitle.d.ts +0 -9
  170. package/dist/components/EntityCollectionView/BoardSortableList.d.ts +0 -14
  171. package/dist/components/EntityCollectionView/board_types.d.ts +0 -105
  172. package/dist/form/field_bindings/ReferenceAsStringFieldBinding.d.ts +0 -11
  173. package/dist/hooks/navigation/useNavigationRegistry.d.ts +0 -12
  174. package/dist/hooks/navigation/useNavigationURLs.d.ts +0 -11
  175. package/dist/src-BYniefVu.js.map +0 -1
  176. package/src/components/EntityCollectionTable/fields/VirtualTableDateField.tsx +0 -39
  177. package/src/components/EntityCollectionTable/fields/VirtualTableInput.tsx +0 -90
  178. package/src/components/EntityCollectionTable/fields/VirtualTableNumberInput.tsx +0 -83
  179. package/src/components/EntityCollectionTable/fields/VirtualTableSwitch.tsx +0 -32
  180. package/src/components/EntityCollectionView/Board.tsx +0 -475
  181. package/src/components/EntityCollectionView/BoardColumn.tsx +0 -165
  182. package/src/components/EntityCollectionView/BoardColumnTitle.tsx +0 -46
  183. package/src/components/EntityCollectionView/BoardSortableList.tsx +0 -177
  184. package/src/components/EntityCollectionView/board_types.ts +0 -113
  185. package/src/form/field_bindings/ReferenceAsStringFieldBinding.tsx +0 -141
  186. package/src/hooks/navigation/useNavigationRegistry.ts +0 -164
  187. package/src/hooks/navigation/useNavigationURLs.ts +0 -56
@@ -0,0 +1,474 @@
1
+ /**
2
+ * JSON-serializable versions of Rebase collection and property types.
3
+ *
4
+ * These types strip all non-serializable fields (functions, React nodes,
5
+ * class instances) from the original types in `@rebasepro/types`, making
6
+ * them safe for `JSON.stringify()` / database storage.
7
+ *
8
+ * Use `toSerializableCollection` / `fromSerializableCollection` from
9
+ * `./serializable_utils` to convert between the original and serializable forms.
10
+ *
11
+ * @module
12
+ */
13
+
14
+ import type {
15
+ ArrayPropertyValidationSchema,
16
+ CollectionSize,
17
+ EnumValues,
18
+ FileType,
19
+ FilterPreset,
20
+ FilterValues,
21
+ ImageResize,
22
+ JoinStep,
23
+ KanbanConfig,
24
+ NavigationGroupMapping,
25
+ NumberPropertyValidationSchema,
26
+ OnAction,
27
+ PropertyConditions,
28
+ PropertyValidationSchema,
29
+ SecurityRule,
30
+ ViewMode,
31
+ } from "@rebasepro/types";
32
+
33
+ // ═══════════════════════════════════════════════════════════════════════
34
+ // SERIALIZABLE PROPERTY TYPES
35
+ // ═══════════════════════════════════════════════════════════════════════
36
+
37
+ /**
38
+ * JSON-serializable version of `BaseUIConfig`.
39
+ * Drops `Field` and `Preview` (ComponentRef — functions/components).
40
+ */
41
+ export interface SerializableBaseUIConfig {
42
+ columnWidth?: number;
43
+ hideFromCollection?: boolean;
44
+ readOnly?: boolean;
45
+ disabled?: boolean | SerializablePropertyDisabledConfig;
46
+ widthPercentage?: number;
47
+ customProps?: unknown;
48
+ // Field and Preview are dropped (ComponentRef is not serializable)
49
+ }
50
+
51
+ /** JSON-serializable version of `PropertyDisabledConfig`. Already serializable. */
52
+ export interface SerializablePropertyDisabledConfig {
53
+ clearOnDisabled?: boolean;
54
+ disabledMessage?: string;
55
+ hidden?: boolean;
56
+ }
57
+
58
+ /**
59
+ * JSON-serializable version of `StringPropertyValidationSchema`.
60
+ * `matches` is forced to `string` (no RegExp).
61
+ */
62
+ export interface SerializableStringValidation extends PropertyValidationSchema {
63
+ length?: number;
64
+ min?: number;
65
+ max?: number;
66
+ /** Regex pattern as a string. RegExp objects are converted to their `.source`. */
67
+ matches?: string;
68
+ matchesMessage?: string;
69
+ trim?: boolean;
70
+ lowercase?: boolean;
71
+ uppercase?: boolean;
72
+ }
73
+
74
+ /**
75
+ * JSON-serializable version of `DatePropertyValidationSchema`.
76
+ * `min` and `max` are ISO 8601 strings instead of `Date` objects.
77
+ */
78
+ export interface SerializableDateValidation extends PropertyValidationSchema {
79
+ /** Minimum date as ISO 8601 string. */
80
+ min?: string;
81
+ /** Maximum date as ISO 8601 string. */
82
+ max?: string;
83
+ }
84
+
85
+ /**
86
+ * JSON-serializable version of `StorageConfig`.
87
+ * Drops all function fields: `processFile`, `postProcess`, `previewUrl`.
88
+ * `storagePath` and `fileName` are string-only (no function variant).
89
+ */
90
+ export interface SerializableStorageConfig {
91
+ acceptedFiles?: FileType[];
92
+ imageResize?: ImageResize;
93
+ metadata?: Record<string, unknown>;
94
+ /** String template only. Function variant is not serializable. */
95
+ fileName?: string;
96
+ /** String template only. Function variant is not serializable. */
97
+ storagePath: string;
98
+ includeBucketUrl?: boolean;
99
+ storeUrl?: boolean;
100
+ maxSize?: number;
101
+ /** Key of the named storage backend to use (see `StorageConfig.storageSource`). */
102
+ storageSource?: string;
103
+ // processFile, postProcess, previewUrl are dropped (functions)
104
+ }
105
+
106
+ // ── Serializable UI configs for specific property types ───────────────
107
+
108
+ /** JSON-serializable version of `StringUIConfig`. */
109
+ export interface SerializableStringUIConfig extends SerializableBaseUIConfig {
110
+ multiline?: boolean;
111
+ markdown?: boolean;
112
+ previewAsTag?: boolean;
113
+ clearable?: boolean;
114
+ url?: boolean | "image" | "video" | "audio" | "file";
115
+ }
116
+
117
+ /** JSON-serializable version of `NumberUIConfig`. */
118
+ export interface SerializableNumberUIConfig extends SerializableBaseUIConfig {
119
+ clearable?: boolean;
120
+ }
121
+
122
+ /** JSON-serializable version of `DateUIConfig`. */
123
+ export interface SerializableDateUIConfig extends SerializableBaseUIConfig {
124
+ clearable?: boolean;
125
+ }
126
+
127
+ /** JSON-serializable version of `VectorUIConfig`. */
128
+ export interface SerializableVectorUIConfig extends SerializableBaseUIConfig {
129
+ clearable?: boolean;
130
+ }
131
+
132
+ /** JSON-serializable version of `ReferenceUIConfig`. */
133
+ export interface SerializableReferenceUIConfig extends SerializableBaseUIConfig {
134
+ previewProperties?: string[];
135
+ }
136
+
137
+ /** JSON-serializable version of `RelationUIConfig`. */
138
+ export interface SerializableRelationUIConfig extends SerializableBaseUIConfig {
139
+ previewProperties?: string[];
140
+ widget?: "select" | "dialog";
141
+ }
142
+
143
+ /** JSON-serializable version of `ArrayUIConfig`. */
144
+ export interface SerializableArrayUIConfig extends SerializableBaseUIConfig {
145
+ expanded?: boolean;
146
+ minimalistView?: boolean;
147
+ }
148
+
149
+ /** JSON-serializable version of `MapUIConfig`. */
150
+ export interface SerializableMapUIConfig extends SerializableBaseUIConfig {
151
+ expanded?: boolean;
152
+ minimalistView?: boolean;
153
+ spreadChildren?: boolean;
154
+ }
155
+
156
+ // ── Serializable base property ────────────────────────────────────────
157
+
158
+ /**
159
+ * JSON-serializable version of `BaseProperty`.
160
+ * Drops: `dynamicProps` (function), `callbacks` (functions).
161
+ * Keeps: `conditions` (JSON Logic — already serializable by design).
162
+ */
163
+ export interface SerializableBaseProperty {
164
+ ui?: SerializableBaseUIConfig;
165
+ name: string;
166
+ description?: string;
167
+ propertyConfig?: string;
168
+ columnName?: string;
169
+ validation?: PropertyValidationSchema;
170
+ defaultValue?: unknown;
171
+ /**
172
+ * JSON Logic conditions — fully serializable by design.
173
+ * These are the declarative alternative to `dynamicProps` functions.
174
+ */
175
+ conditions?: PropertyConditions;
176
+ /**
177
+ * Arbitrary key-value metadata for external consumers.
178
+ * Not interpreted by Rebase — passed through serialization unchanged.
179
+ */
180
+ metadata?: Record<string, unknown>;
181
+ // dynamicProps and callbacks are dropped (functions)
182
+ }
183
+
184
+ // ── Individual serializable property types ────────────────────────────
185
+
186
+ /** JSON-serializable `StringProperty`. */
187
+ export interface SerializableStringProperty extends SerializableBaseProperty {
188
+ ui?: SerializableStringUIConfig;
189
+ type: "string";
190
+ columnType?: "varchar" | "text" | "char" | "uuid";
191
+ validation?: SerializableStringValidation;
192
+ isId?: boolean | "manual" | "uuid" | "cuid" | string;
193
+ enum?: EnumValues;
194
+ storage?: SerializableStorageConfig;
195
+ userSelect?: boolean;
196
+ email?: boolean;
197
+ reference?: SerializableReferenceProperty;
198
+ }
199
+
200
+ /** JSON-serializable `NumberProperty`. */
201
+ export interface SerializableNumberProperty extends SerializableBaseProperty {
202
+ ui?: SerializableNumberUIConfig;
203
+ type: "number";
204
+ columnType?: "integer" | "real" | "double precision" | "numeric" | "bigint" | "serial" | "bigserial";
205
+ validation?: NumberPropertyValidationSchema;
206
+ isId?: boolean | "manual" | "increment" | string;
207
+ enum?: EnumValues;
208
+ }
209
+
210
+ /** JSON-serializable `BooleanProperty`. */
211
+ export interface SerializableBooleanProperty extends SerializableBaseProperty {
212
+ ui?: SerializableBaseUIConfig;
213
+ type: "boolean";
214
+ validation?: PropertyValidationSchema;
215
+ }
216
+
217
+ /** JSON-serializable `DateProperty`. */
218
+ export interface SerializableDateProperty extends SerializableBaseProperty {
219
+ ui?: SerializableDateUIConfig;
220
+ type: "date";
221
+ columnType?: "timestamp" | "date" | "time";
222
+ validation?: SerializableDateValidation;
223
+ mode?: "date" | "date_time";
224
+ timezone?: string;
225
+ autoValue?: "on_create" | "on_update";
226
+ }
227
+
228
+ /** JSON-serializable `GeopointProperty`. */
229
+ export interface SerializableGeopointProperty extends SerializableBaseProperty {
230
+ ui?: SerializableBaseUIConfig;
231
+ type: "geopoint";
232
+ validation?: PropertyValidationSchema;
233
+ }
234
+
235
+ /** JSON-serializable `VectorProperty`. */
236
+ export interface SerializableVectorProperty extends SerializableBaseProperty {
237
+ ui?: SerializableVectorUIConfig;
238
+ type: "vector";
239
+ dimensions: number;
240
+ validation?: PropertyValidationSchema;
241
+ }
242
+
243
+ /** JSON-serializable `BinaryProperty`. */
244
+ export interface SerializableBinaryProperty extends SerializableBaseProperty {
245
+ type: "binary";
246
+ validation?: PropertyValidationSchema;
247
+ }
248
+
249
+ /**
250
+ * JSON-serializable `ReferenceProperty`.
251
+ * Already largely serializable; just inherits the serializable base.
252
+ */
253
+ export interface SerializableReferenceProperty extends SerializableBaseProperty {
254
+ ui?: SerializableReferenceUIConfig;
255
+ type: "reference";
256
+ isId?: boolean;
257
+ path?: string;
258
+ fixedFilter?: FilterValues<string>;
259
+ includeId?: boolean;
260
+ includeEntityLink?: boolean;
261
+ }
262
+
263
+ /**
264
+ * JSON-serializable `RelationProperty`.
265
+ * `target` is string-only (collection slug). The function variant
266
+ * `() => EntityCollection` is not serializable.
267
+ */
268
+ export interface SerializableRelationProperty extends SerializableBaseProperty {
269
+ ui?: SerializableRelationUIConfig;
270
+ type: "relation";
271
+ isId?: boolean;
272
+ /** Target collection slug. Function variant is not serializable. */
273
+ target?: string;
274
+ cardinality?: "one" | "many";
275
+ direction?: "owning" | "inverse";
276
+ inverseRelationName?: string;
277
+ localKey?: string;
278
+ foreignKeyOnTarget?: string;
279
+ through?: {
280
+ table: string;
281
+ sourceColumn: string;
282
+ targetColumn: string;
283
+ };
284
+ joinPath?: JoinStep[];
285
+ onUpdate?: OnAction;
286
+ onDelete?: OnAction;
287
+ relationName?: string;
288
+ fixedFilter?: FilterValues<string>;
289
+ includeId?: boolean;
290
+ includeEntityLink?: boolean;
291
+ widget?: "select" | "dialog";
292
+ // overrides are dropped (can contain non-serializable EntityCollection fields)
293
+ // relation (resolved Relation object) is dropped (runtime-only, contains function target)
294
+ }
295
+
296
+ /** JSON-serializable `ArrayProperty`. */
297
+ export interface SerializableArrayProperty extends SerializableBaseProperty {
298
+ ui?: SerializableArrayUIConfig;
299
+ type: "array";
300
+ columnType?: "json" | "jsonb" | "text[]" | "integer[]" | "boolean[]" | "numeric[]";
301
+ of?: SerializableProperty | SerializableProperty[];
302
+ oneOf?: {
303
+ properties: SerializableProperties;
304
+ propertiesOrder?: string[];
305
+ typeField?: string;
306
+ valueField?: string;
307
+ };
308
+ validation?: ArrayPropertyValidationSchema;
309
+ sortable?: boolean;
310
+ canAddElements?: boolean;
311
+ }
312
+
313
+ /** JSON-serializable `MapProperty`. */
314
+ export interface SerializableMapProperty extends SerializableBaseProperty {
315
+ ui?: SerializableMapUIConfig;
316
+ type: "map";
317
+ columnType?: "json" | "jsonb";
318
+ properties?: SerializableProperties;
319
+ propertiesOrder?: string[];
320
+ validation?: PropertyValidationSchema;
321
+ previewProperties?: string[];
322
+ keyValue?: boolean;
323
+ }
324
+
325
+ // ── Aggregates ────────────────────────────────────────────────────────
326
+
327
+ /**
328
+ * Union of all JSON-serializable property types.
329
+ * Mirrors `Property` from `@rebasepro/types` but with all non-serializable
330
+ * fields stripped.
331
+ */
332
+ export type SerializableProperty =
333
+ | SerializableStringProperty
334
+ | SerializableNumberProperty
335
+ | SerializableBooleanProperty
336
+ | SerializableDateProperty
337
+ | SerializableGeopointProperty
338
+ | SerializableReferenceProperty
339
+ | SerializableRelationProperty
340
+ | SerializableArrayProperty
341
+ | SerializableMapProperty
342
+ | SerializableVectorProperty
343
+ | SerializableBinaryProperty;
344
+
345
+ /** Record of serializable properties, keyed by property key. */
346
+ export type SerializableProperties = {
347
+ [key: string]: SerializableProperty;
348
+ };
349
+
350
+ // ═══════════════════════════════════════════════════════════════════════
351
+ // SERIALIZABLE COLLECTION TYPE
352
+ // ═══════════════════════════════════════════════════════════════════════
353
+
354
+ /**
355
+ * JSON-serializable version of `EntityCollection` / `BaseEntityCollection`.
356
+ *
357
+ * Strips all non-serializable fields:
358
+ * - Functions: `callbacks`, `childCollections`, `additionalFields`, `defaultSelectedView` (fn)
359
+ * - React nodes: `icon` (ReactNode variant), `entityViews`, `formView`
360
+ * - Runtime objects: `selectionController`, `overrides`
361
+ * - Component refs: `Actions`, `components`, `entityActions`
362
+ * - `exportable` when it's an `ExportConfig` (contains functions)
363
+ * - `auth` when it's an `AuthCollectionConfig` (contains functions)
364
+ *
365
+ * Keeps all data-describing fields that the collection editor works with.
366
+ */
367
+ export interface SerializableCollection {
368
+ slug: string;
369
+ name: string;
370
+ singularName?: string;
371
+ description?: string;
372
+
373
+ /**
374
+ * Icon name as a string (e.g. Lucide icon key).
375
+ * React.ReactNode variant is not serializable and is stripped.
376
+ */
377
+ icon?: string;
378
+
379
+ group?: string;
380
+ engine?: string;
381
+ dataSource?: string;
382
+ databaseId?: string;
383
+
384
+ properties: SerializableProperties;
385
+ propertiesOrder?: string[];
386
+ previewProperties?: string[];
387
+ listProperties?: string[];
388
+ titleProperty?: string;
389
+
390
+ // ── Display config ────────────────────────────────────────────────
391
+ openEntityMode?: "side_panel" | "full_screen" | "split" | "dialog";
392
+ defaultEntityAction?: "view" | "edit";
393
+ defaultViewMode?: ViewMode;
394
+ enabledViews?: ViewMode[];
395
+ kanban?: KanbanConfig<Record<string, unknown>>;
396
+ defaultSize?: CollectionSize;
397
+ sideDialogWidth?: number | string;
398
+
399
+ // ── Behavior flags ────────────────────────────────────────────────
400
+ pagination?: boolean | number;
401
+ selectionEnabled?: boolean;
402
+ inlineEditing?: boolean;
403
+ hideFromNavigation?: boolean;
404
+ hideIdFromForm?: boolean;
405
+ hideIdFromCollection?: boolean;
406
+ formAutoSave?: boolean;
407
+ alwaysApplyDefaultValues?: boolean;
408
+ includeJsonView?: boolean;
409
+ history?: boolean;
410
+ localChangesBackup?: "manual_apply" | "auto_apply" | false;
411
+ exportable?: boolean;
412
+ auth?: boolean;
413
+
414
+ /**
415
+ * Default selected view as a string key.
416
+ * The function variant (`DefaultSelectedViewBuilder`) is not serializable.
417
+ */
418
+ defaultSelectedView?: string;
419
+
420
+ // ── Filters and sorting ───────────────────────────────────────────
421
+ fixedFilter?: FilterValues<string>;
422
+ defaultFilter?: FilterValues<string>;
423
+ filterPresets?: FilterPreset<string>[];
424
+ sort?: [string, "asc" | "desc"];
425
+ orderProperty?: string;
426
+
427
+ // ── Disable built-in actions ──────────────────────────────────────
428
+ disableDefaultActions?: ("edit" | "copy" | "delete")[];
429
+
430
+ // ── SQL / Postgres-specific ───────────────────────────────────────
431
+ table?: string;
432
+ schema?: string;
433
+ securityRules?: SecurityRule[];
434
+
435
+ // ── Owner ─────────────────────────────────────────────────────────
436
+ ownerId?: string;
437
+
438
+ /**
439
+ * Arbitrary key-value metadata for external consumers.
440
+ * Not interpreted by Rebase — passed through serialization unchanged.
441
+ */
442
+ metadata?: Record<string, unknown>;
443
+ }
444
+
445
+ // ═══════════════════════════════════════════════════════════════════════
446
+ // JSON COLLECTION STORE ADAPTER
447
+ // ═══════════════════════════════════════════════════════════════════════
448
+
449
+ /**
450
+ * Adapter interface for persisting serializable collections to a JSON backend.
451
+ * Implement this to store collection configs in a database, API, localStorage, etc.
452
+ */
453
+ export interface JsonCollectionStore {
454
+ /** Load all persisted collections. */
455
+ load(): Promise<SerializableCollection[]>;
456
+
457
+ /** Save (create or update) a single collection by its slug. */
458
+ save(slug: string, data: SerializableCollection): Promise<void>;
459
+
460
+ /** Delete a collection by its slug. */
461
+ delete(slug: string): Promise<void>;
462
+
463
+ /**
464
+ * Optional: save navigation group mappings.
465
+ * If not implemented, navigation entries are not persisted.
466
+ */
467
+ saveNavigationEntries?(entries: NavigationGroupMapping[]): Promise<void>;
468
+
469
+ /**
470
+ * Optional: load navigation group mappings.
471
+ * If not implemented, an empty array is used.
472
+ */
473
+ loadNavigationEntries?(): Promise<NavigationGroupMapping[]>;
474
+ }