@rebasepro/admin-types 0.10.1-canary.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 (72) hide show
  1. package/LICENSE +21 -0
  2. package/dist/admin_collection.d.ts +464 -0
  3. package/dist/augment.d.ts +66 -0
  4. package/dist/collections.d.ts +226 -0
  5. package/dist/controllers/analytics_controller.d.ts +7 -0
  6. package/dist/controllers/auth.d.ts +110 -0
  7. package/dist/controllers/customization_controller.d.ts +61 -0
  8. package/dist/controllers/dialogs_controller.d.ts +36 -0
  9. package/dist/controllers/index.d.ts +10 -0
  10. package/dist/controllers/local_config_persistence.d.ts +20 -0
  11. package/dist/controllers/navigation.d.ts +225 -0
  12. package/dist/controllers/registry.d.ts +80 -0
  13. package/dist/controllers/side_dialogs_controller.d.ts +67 -0
  14. package/dist/controllers/side_panel_controller.d.ts +97 -0
  15. package/dist/controllers/snackbar.d.ts +24 -0
  16. package/dist/index.d.ts +18 -0
  17. package/dist/index.es.js +92 -0
  18. package/dist/index.es.js.map +1 -0
  19. package/dist/react_component_ref.d.ts +43 -0
  20. package/dist/rebase_context.d.ts +68 -0
  21. package/dist/types/breadcrumbs.d.ts +26 -0
  22. package/dist/types/builders.d.ts +15 -0
  23. package/dist/types/component_overrides.d.ts +196 -0
  24. package/dist/types/entity_actions.d.ts +105 -0
  25. package/dist/types/entity_link_builder.d.ts +7 -0
  26. package/dist/types/entity_views.d.ts +95 -0
  27. package/dist/types/export_import.d.ts +21 -0
  28. package/dist/types/formex.d.ts +40 -0
  29. package/dist/types/index.d.ts +15 -0
  30. package/dist/types/locales.d.ts +4 -0
  31. package/dist/types/modify_collections.d.ts +5 -0
  32. package/dist/types/plugins.d.ts +277 -0
  33. package/dist/types/property_config.d.ts +74 -0
  34. package/dist/types/property_options.d.ts +154 -0
  35. package/dist/types/slots.d.ts +263 -0
  36. package/dist/types/translations.d.ts +915 -0
  37. package/dist/types/user_management_delegate.d.ts +22 -0
  38. package/package.json +103 -0
  39. package/src/admin_collection.ts +582 -0
  40. package/src/augment.ts +60 -0
  41. package/src/collections.ts +256 -0
  42. package/src/controllers/analytics_controller.tsx +57 -0
  43. package/src/controllers/auth.ts +121 -0
  44. package/src/controllers/customization_controller.tsx +72 -0
  45. package/src/controllers/dialogs_controller.tsx +37 -0
  46. package/src/controllers/index.ts +10 -0
  47. package/src/controllers/local_config_persistence.tsx +22 -0
  48. package/src/controllers/navigation.ts +264 -0
  49. package/src/controllers/registry.ts +96 -0
  50. package/src/controllers/side_dialogs_controller.tsx +82 -0
  51. package/src/controllers/side_panel_controller.tsx +112 -0
  52. package/src/controllers/snackbar.ts +29 -0
  53. package/src/index.ts +20 -0
  54. package/src/react_component_ref.ts +52 -0
  55. package/src/rebase_context.ts +81 -0
  56. package/src/types/breadcrumbs.ts +27 -0
  57. package/src/types/builders.ts +18 -0
  58. package/src/types/component_overrides.ts +244 -0
  59. package/src/types/entity_actions.tsx +127 -0
  60. package/src/types/entity_link_builder.ts +8 -0
  61. package/src/types/entity_views.tsx +114 -0
  62. package/src/types/export_import.ts +26 -0
  63. package/src/types/formex.ts +45 -0
  64. package/src/types/index.ts +15 -0
  65. package/src/types/locales.ts +81 -0
  66. package/src/types/modify_collections.tsx +6 -0
  67. package/src/types/plugins.tsx +346 -0
  68. package/src/types/property_config.tsx +95 -0
  69. package/src/types/property_options.ts +169 -0
  70. package/src/types/slots.tsx +309 -0
  71. package/src/types/translations.ts +1026 -0
  72. package/src/types/user_management_delegate.ts +23 -0
@@ -0,0 +1,256 @@
1
+ /**
2
+ * Admin-panel view models for a collection.
3
+ *
4
+ * These twelve types came out of `collections.ts`, where they sat interleaved
5
+ * with the collection shape itself. None of them describes data: they are the
6
+ * table's controllers, the selection state, the kanban layout, the shape of a
7
+ * toolbar action's props. Every one names `React` or `RebaseContext`, and none is
8
+ * imported by a single backend package — checked across `server`,
9
+ * `server-postgres`, `server-mongo`, `client`, `common`, `utils`, `cli` and
10
+ * `codegen`.
11
+ *
12
+ * That is what made them safe to lift: they were never part of the BaaS surface,
13
+ * only stored next to it.
14
+ */
15
+ import React, { Dispatch, SetStateAction } from "react";
16
+ import type { Entity, EntityStatus, FilterValues, Property, User } from "@rebasepro/types";
17
+
18
+ import type { RebaseContext } from "./rebase_context";
19
+ import type { AdminCollection } from "@rebasepro/admin-types";
20
+
21
+ /**
22
+ * Configuration for Kanban board view mode.
23
+ * @group Collections
24
+ */
25
+ export interface KanbanConfig<M extends Record<string, unknown> = Record<string, unknown>> {
26
+ /**
27
+ * Property key to use for Kanban board columns.
28
+ * Must reference a string property with `enum` values defined.
29
+ * Entities will be grouped into columns based on this property's value.
30
+ * The column order is determined by the order of `enum` values in the property.
31
+ */
32
+ columnProperty: Extract<keyof M, string> | (string & {});
33
+ }
34
+
35
+ /**
36
+ * View mode for displaying a collection.
37
+ * - "list": Simple, clean list view — the classic CMS default
38
+ * - "table": Table with inline editing
39
+ * - "cards": Grid of visual cards with thumbnails
40
+ * - "kanban": Board view grouped by a property
41
+ * @group Collections
42
+ */
43
+ export type ViewMode = "list" | "table" | "cards" | "kanban";
44
+
45
+ /**
46
+ * Parameter passed to the `Actions` prop in the collection configuration.
47
+ * The component will receive this prop when it is rendered in the collection
48
+ * toolbar.
49
+ *
50
+ * @group Models
51
+ */
52
+ export interface CollectionActionsProps<M extends Record<string, unknown> = Record<string, unknown>, USER extends User = User, EC extends AdminCollection<M> = AdminCollection<M>> {
53
+ /**
54
+ * Full collection path of this entity. This is the full path, like
55
+ * `users/1234/addresses`
56
+ */
57
+ path: string;
58
+
59
+ /**
60
+ * Path of the last collection, like `addresses`
61
+ */
62
+ relativePath: string;
63
+
64
+ /**
65
+ * Array of the parent path segments like `['users']`
66
+ */
67
+ parentCollectionSlugs: string[];
68
+ parentEntityIds: string[];
69
+
70
+ /**
71
+ * The collection configuration
72
+ */
73
+ collection: EC;
74
+
75
+ /**
76
+ * Use this controller to get the selected entities and to update the
77
+ * selected entities state.
78
+ */
79
+ selectionController: SelectionController<M>;
80
+
81
+ /**
82
+ * Use this controller to get the table controller and to update the
83
+ * table controller state.
84
+ */
85
+ tableController: EntityTableController<M>;
86
+
87
+ /**
88
+ * Context of the app status
89
+ */
90
+ context: RebaseContext<USER>;
91
+
92
+ /**
93
+ * Count of the entities in this collection.
94
+ * undefined means the count is still loading.
95
+ */
96
+ collectionEntitiesCount?: number;
97
+
98
+ /**
99
+ * Programmatically open the new-document form for this collection,
100
+ * optionally pre-populating it with initial field values.
101
+ * The form opens in the same mode configured for the collection
102
+ * (side panel, full screen, or split).
103
+ *
104
+ * This is the primary hook for workflows that need to create a document
105
+ * from external data — e.g. fetching content from a URL, importing from
106
+ * a third-party API, or duplicating from another system.
107
+ *
108
+ * @example
109
+ * // Inside a custom CollectionAction component:
110
+ * openNewDocument({ title: "Fetched title", body: "..." });
111
+ */
112
+ openNewDocument: (defaultValues?: Record<string, unknown>) => void;
113
+
114
+ }
115
+
116
+ /**
117
+ * Use this controller to retrieve the selected entities or modify them in
118
+ * an {@link AdminCollection}
119
+ * @group Models
120
+ */
121
+ export interface SelectionController<M extends Record<string, unknown> = Record<string, unknown>> {
122
+ selectedEntities: Entity<M>[];
123
+ setSelectedEntities(entities: Entity<M>[]): void;
124
+ setSelectedEntities(action: (prev: Entity<M>[]) => Entity<M>[]): void;
125
+ isEntitySelected(entity: Entity<M>): boolean;
126
+ toggleEntitySelection(entity: Entity<M>, newSelectedState?: boolean): void;
127
+ }
128
+
129
+ // Canonical filter types — re-exported from the single source-of-truth.
130
+
131
+ /**
132
+ * Used to indicate valid filter combinations (e.g. created in Firestore)
133
+ * If the user selects a specific filter/sort combination, the CMS checks if it's
134
+ * valid, otherwise it reverts to the simpler valid case
135
+ * @group Models
136
+ */
137
+ export type FilterCombination<Key extends string> = Partial<Record<Key, "asc" | "desc">>;
138
+
139
+ /**
140
+ * Sizes in which a collection can be rendered
141
+ * @group Models
142
+ */
143
+ export type CollectionSize = "xs" | "s" | "m" | "l" | "xl";
144
+
145
+ export type AdditionalFieldDelegateProps<M extends Record<string, unknown> = Record<string, unknown>, USER extends User = User> = {
146
+ entity: Entity<M>,
147
+ context: RebaseContext<USER>
148
+ };
149
+
150
+ /**
151
+ * Use this interface for adding additional fields to entity collection views and forms.
152
+ * @group Models
153
+ */
154
+ export interface AdditionalFieldDelegate<M extends Record<string, unknown> = Record<string, unknown>,
155
+ USER extends User = User> {
156
+
157
+ /**
158
+ * ID of this column. You can use this id in the `properties` field of the
159
+ * collection in any order you want
160
+ */
161
+ key: string;
162
+
163
+ /**
164
+ * Header of this column
165
+ */
166
+ name: string;
167
+
168
+ /**
169
+ * Width of the generated column in pixels
170
+ */
171
+ width?: number;
172
+
173
+ /**
174
+ * Builder for the custom field
175
+ */
176
+ Builder?(props: { entity: Entity<M>, context: RebaseContext<USER> }): React.ReactNode;
177
+
178
+ /**
179
+ * If this column needs to update dynamically based on other properties,
180
+ * you can define an array of keys as strings with the
181
+ * `dependencies` prop.
182
+ * e.g. ["name", "surname"]
183
+ * This is a performance optimization, if you don't define dependencies
184
+ * it will be updated in every render.
185
+ */
186
+ dependencies?: NoInfer<Extract<keyof M, string>> | NoInfer<Extract<keyof M, string>>[] | (string & {}) | (string & {})[];
187
+
188
+ /**
189
+ * Use this prop to define the value of the column as a string or number.
190
+ * This is the value that will be used for exporting the collection.
191
+ * If `Builder` is defined, this prop will be ignored in the collection
192
+ * view.
193
+ * @param entity
194
+ */
195
+ value?(props: {
196
+ entity: Entity<M>,
197
+ context: RebaseContext
198
+ }): string | number | Promise<string | number> | undefined;
199
+ }
200
+
201
+ /**
202
+ * Used in the {@link AdminCollection#defaultSelectedView} to define the default
203
+ * @group Models
204
+ */
205
+ export type DefaultSelectedViewBuilder = (params: DefaultSelectedViewParams) => string | undefined;
206
+
207
+ /**
208
+ * Used in the {@link AdminCollection#defaultSelectedView} to define the default
209
+ * @group Models
210
+ */
211
+ export type DefaultSelectedViewParams = {
212
+ status?: EntityStatus;
213
+ entityId?: string | number;
214
+ };
215
+
216
+ /**
217
+ * You can use this controller to control the table view of a collection.
218
+ */
219
+ export type EntityTableController<M extends Record<string, unknown> = Record<string, unknown>> = {
220
+ data: Entity<M>[];
221
+ dataLoading: boolean;
222
+ noMoreToLoad: boolean;
223
+ dataLoadingError?: Error;
224
+ filterValues?: FilterValues<Extract<keyof M, string> | (string & {})>;
225
+ setFilterValues?: (filterValues: FilterValues<Extract<keyof M, string> | (string & {})>) => void;
226
+ sortBy?: [Extract<keyof M, string> | (string & {}), "asc" | "desc"];
227
+ setSortBy?: (sortBy?: [Extract<keyof M, string> | (string & {}), "asc" | "desc"]) => void;
228
+ searchString?: string;
229
+ setSearchString?: (searchString?: string) => void;
230
+ clearFilter?: () => void;
231
+ itemCount?: number;
232
+ setItemCount?: (itemCount: number) => void;
233
+ initialScroll?: number;
234
+ onScroll?: (props: {
235
+ scrollDirection: "forward" | "backward",
236
+ scrollOffset: number,
237
+ scrollUpdateWasRequested: boolean
238
+ }) => void;
239
+ paginationEnabled?: boolean;
240
+ pageSize?: number;
241
+ checkFilterCombination?: (filterValues: FilterValues<string>,
242
+ sortBy?: [string, "asc" | "desc"]) => boolean;
243
+ popupCell?: SelectedCellProps<M>;
244
+ setPopupCell?: (popupCell?: SelectedCellProps<M>) => void;
245
+
246
+ onAddColumn?: (column: string) => void;
247
+ }
248
+
249
+ export type SelectedCellProps<M extends Record<string, unknown> = Record<string, unknown>> = {
250
+ propertyKey: Extract<keyof M, string> | (string & {});
251
+ cellRect: DOMRect;
252
+ width: number;
253
+ height: number;
254
+ entityPath: string;
255
+ entityId: string | number;
256
+ };
@@ -0,0 +1,57 @@
1
+ export type AnalyticsController = {
2
+
3
+ /**
4
+ * Callback used to get analytics events from the CMS
5
+ */
6
+ onAnalyticsEvent?: (event: AnalyticsEvent, data?: object) => void;
7
+
8
+ }
9
+
10
+ export type AnalyticsEvent =
11
+ | "entity_click"
12
+ | "entity_click_from_reference"
13
+
14
+ | "reference_selection_clear"
15
+ | "reference_selection_toggle"
16
+ | "reference_selected_single"
17
+ | "reference_selection_new_entity"
18
+
19
+ | "edit_entity_clicked"
20
+ | "entity_edited"
21
+ | "new_entity_click"
22
+ | "new_entity_saved"
23
+ | "copy_entity_click"
24
+ | "entity_copied"
25
+
26
+ | "single_delete_dialog_open"
27
+ | "multiple_delete_dialog_open"
28
+ | "single_entity_deleted"
29
+ | "multiple_entities_deleted"
30
+
31
+ | "drawer_navigate_to_home"
32
+ | "drawer_navigate_to_collection"
33
+ | "drawer_navigate_to_view"
34
+
35
+ | "home_navigate_to_collection"
36
+ | "home_favorite_navigate_to_collection"
37
+ | "home_navigate_to_view"
38
+ | "home_navigate_to_admin_view"
39
+ | "home_favorite_navigate_to_view"
40
+ | "home_move_card"
41
+ | "home_move_group"
42
+ | "home_drop_new_group"
43
+
44
+ | "collection_inline_editing"
45
+
46
+ | "view_mode_changed"
47
+
48
+ | "kanban_card_moved"
49
+ | "kanban_column_reorder"
50
+ | "kanban_property_changed"
51
+ | "kanban_new_entity_in_column"
52
+ | "kanban_backfill_order"
53
+
54
+ | "card_view_entity_click"
55
+
56
+ | "unmapped_event"
57
+ ;
@@ -0,0 +1,121 @@
1
+ import type { User } from "@rebasepro/types";
2
+
3
+ /**
4
+ * Capabilities advertised by an auth provider.
5
+ * UI components use this to show/hide features dynamically
6
+ * (e.g. password reset, registration, session management).
7
+ * @group Hooks and utilities
8
+ */
9
+ export interface AuthCapabilities {
10
+ emailPasswordLogin?: boolean;
11
+ googleLogin?: boolean;
12
+ registration?: boolean;
13
+ /** Self-service password reset (emailing a reset link) is available. */
14
+ passwordReset?: boolean;
15
+ /**
16
+ * An admin can reset another user's password. Gates the "Reset Password"
17
+ * entity action in the admin UI. See `AuthAdapterCapabilities`.
18
+ */
19
+ adminPasswordReset?: boolean;
20
+ sessionManagement?: boolean;
21
+ profileUpdate?: boolean;
22
+ emailVerification?: boolean;
23
+ /** List of enabled OAuth provider IDs (e.g. ["google", "github", "discord"]) */
24
+ enabledProviders?: string[];
25
+ }
26
+
27
+ /**
28
+ * Controller for retrieving the logged user or performing auth related operations.
29
+ * Note that if you are implementing your AuthController, you probably will want
30
+ * to do it as the result of a hook.
31
+ * @group Hooks and utilities
32
+ */
33
+ export type AuthController<USER extends User = User, ExtraData = unknown> = {
34
+
35
+ /**
36
+ * The user currently logged in
37
+ * The values can be: the user object, null if they skipped login
38
+ */
39
+ user: USER | null;
40
+
41
+ /**
42
+ * Initial loading flag. It is used not to display the login screen
43
+ * when the app first loads, and it has not been checked whether the user
44
+ * is logged in or not.
45
+ */
46
+ initialLoading?: boolean;
47
+
48
+ /**
49
+ * Loading flag. It is used to display a loading screen when the user is
50
+ * logging in or out.
51
+ */
52
+ authLoading: boolean;
53
+
54
+ /**
55
+ * Sign out
56
+ */
57
+ signOut: () => Promise<void>;
58
+
59
+ /**
60
+ * Error initializing the authentication
61
+ */
62
+ authError?: unknown;
63
+
64
+ /**
65
+ * Error dispatched by the auth provider
66
+ */
67
+ authProviderError?: unknown;
68
+
69
+ /**
70
+ * You can use this method to retrieve the auth token for the current user.
71
+ */
72
+ getAuthToken: () => Promise<string>;
73
+
74
+ /**
75
+ * Has the user skipped the login process
76
+ */
77
+ loginSkipped: boolean;
78
+
79
+ extra: ExtraData;
80
+
81
+ setExtra: (extra: ExtraData) => void;
82
+
83
+
84
+ setUser?(user: USER | null): void;
85
+
86
+ setUserRoles?(roles: string[]): void;
87
+
88
+ /**
89
+ * Capabilities advertised by the auth provider.
90
+ * UI components use this to feature-detect what the backend supports.
91
+ */
92
+ capabilities?: AuthCapabilities;
93
+
94
+ };
95
+
96
+ /**
97
+ * Extended auth controller with common optional auth methods.
98
+ * Backend implementations (Rebase backend, Firebase, etc.)
99
+ * extend this with their own backend-specific extras.
100
+ * @group Hooks and utilities
101
+ */
102
+ export interface AuthControllerExtended<USER extends User = User, ExtraData = unknown> extends AuthController<USER, ExtraData> {
103
+ /** Login with email and password */
104
+ emailPasswordLogin?(email: string, password: string): Promise<void>;
105
+ /** Login with Google — accepts an ID token, access token, or authorization code payload */
106
+ googleLogin?: (payload: { idToken: string } | { accessToken: string } | { code: string; redirectUri: string }) => Promise<void>;
107
+ /** Generic OAuth login — works with any provider. Posts payload to /auth/{providerId}. */
108
+ oauthLogin?: (providerId: string, payload: Record<string, unknown>) => Promise<void>;
109
+ /** Register a new user */
110
+ register?(email: string, password: string, displayName?: string): Promise<void>;
111
+ /** Skip login (for anonymous access if enabled) */
112
+ skipLogin?(): void;
113
+ /** Request password reset email */
114
+ forgotPassword?(email: string): Promise<void>;
115
+ /** Reset password using a token */
116
+ resetPassword?(token: string, password: string): Promise<void>;
117
+ /** Change password for the authenticated user */
118
+ changePassword?(oldPassword: string, newPassword: string): Promise<void>;
119
+ /** Update user profile */
120
+ updateProfile?(displayName?: string, photoURL?: string): Promise<USER>;
121
+ }
@@ -0,0 +1,72 @@
1
+
2
+ import type { EntityLinkBuilder } from "../types/entity_link_builder";
3
+ import type { Locale } from "../types/locales";
4
+ import type { EntityAction } from "../types/entity_actions";
5
+ import type { EntityCustomView } from "../types/entity_views";
6
+ import type { RebasePlugin } from "../types/plugins";
7
+ import type { PropertyConfig } from "../types/property_config";
8
+ import type { SlotContribution } from "../types/slots";
9
+ import type { ComponentOverrideMap } from "../types/component_overrides";
10
+
11
+ export type CustomizationController = {
12
+
13
+ /**
14
+ * Builder for generating utility links for entities
15
+ */
16
+ entityLinkBuilder?: EntityLinkBuilder;
17
+
18
+ /**
19
+ * Use plugins to modify the behaviour of the CMS.
20
+ */
21
+ plugins?: RebasePlugin[];
22
+
23
+ /**
24
+ * Pre-merged slots from plugins + direct slot contributions.
25
+ */
26
+ resolvedSlots: SlotContribution[];
27
+
28
+ /**
29
+ * List of additional custom views for entities.
30
+ * You can use the key to reference the custom view in
31
+ * the `entityViews` prop of a collection.
32
+ *
33
+ * You can also define a entity view from the UI.
34
+ */
35
+ entityViews?: EntityCustomView[];
36
+
37
+ /**
38
+ * List of actions that can be performed on entities.
39
+ * These actions are displayed in the entity view and in the collection view.
40
+ * You can later reuse these actions in the `entityActions` prop of a collection,
41
+ * by specifying the `key` of the action.
42
+ */
43
+ entityActions?: EntityAction[];
44
+
45
+ /**
46
+ * Format of the dates in the CMS.
47
+ * Defaults to 'MMMM dd, yyyy, HH:mm:ss'
48
+ */
49
+ dateTimeFormat?: string;
50
+
51
+ /**
52
+ * Locale of the CMS, currently only affecting dates
53
+ */
54
+ locale?: Locale;
55
+
56
+ /**
57
+ * Record of custom form fields to be used in the CMS.
58
+ * You can use the key to reference the custom field in
59
+ * the `propertyConfig` prop of a property in a collection.
60
+ */
61
+ propertyConfigs: Record<string, PropertyConfig>;
62
+
63
+ /**
64
+ * Global component overrides. Keys are component names from
65
+ * {@link OverridableComponentName}. Values replace the default
66
+ * implementation everywhere in the app.
67
+ *
68
+ * Collection-scoped overrides (set on individual collections)
69
+ * take precedence over global overrides.
70
+ */
71
+ components?: ComponentOverrideMap;
72
+ }
@@ -0,0 +1,37 @@
1
+ import React from "react";
2
+
3
+ /**
4
+ * Controller to open the side dialog
5
+ * @group Hooks and utilities
6
+ */
7
+ export interface DialogsController {
8
+
9
+ /**
10
+ * Close the last dialog
11
+ */
12
+ close: () => void;
13
+
14
+ /**
15
+ * Open a dialog
16
+ * @param props
17
+ */
18
+ open: <T extends object = object>(props: DialogControllerEntryProps<T>) => { closeDialog: () => void };
19
+ }
20
+
21
+ /**
22
+ * Props used to open a side dialog
23
+ * @group Hooks and utilities
24
+ */
25
+ export interface DialogControllerEntryProps<T extends object = object> {
26
+
27
+ key: string;
28
+ /**
29
+ * The component type that will be rendered
30
+ */
31
+ Component: React.ComponentType<{ open: boolean, closeDialog: () => void } & T>;
32
+ /**
33
+ * Props to pass to the dialog component
34
+ */
35
+ props?: T;
36
+
37
+ }
@@ -0,0 +1,10 @@
1
+ export * from "./analytics_controller";
2
+ export * from "./auth";
3
+ export * from "./customization_controller";
4
+ export * from "./dialogs_controller";
5
+ export * from "./local_config_persistence";
6
+ export * from "./navigation";
7
+ export * from "./registry";
8
+ export * from "./side_dialogs_controller";
9
+ export * from "./side_panel_controller";
10
+ export * from "./snackbar";
@@ -0,0 +1,22 @@
1
+ import type { AdminCollection } from "@rebasepro/admin-types";
2
+
3
+ /**
4
+ * @group Models
5
+ */
6
+ export type PartialCollectionConfig<M extends Record<string, unknown> = Record<string, unknown>> = Partial<AdminCollection<M>>;
7
+
8
+ /**
9
+ * This interface is in charge of defining the controller that persists
10
+ * modifications to a collection or collection, and retrieves them back from
11
+ * a data source, such as local storage or Firestore.
12
+ */
13
+ export interface UserConfigurationPersistence {
14
+ onCollectionModified: <M extends Record<string, unknown> = Record<string, unknown>>(path: string, partialCollection: PartialCollectionConfig<M>) => void;
15
+ getCollectionConfig: <M extends Record<string, unknown> = Record<string, unknown>>(path: string) => PartialCollectionConfig<M>;
16
+ recentlyVisitedPaths: string[];
17
+ setRecentlyVisitedPaths: (paths: string[]) => void;
18
+ favouritePaths: string[];
19
+ setFavouritePaths: (paths: string[]) => void;
20
+ collapsedGroups: string[];
21
+ setCollapsedGroups: (paths: string[]) => void;
22
+ }