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