@rebasepro/types 0.10.0 → 0.10.1-canary.0a881d4
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/dist/call_context.d.ts +51 -0
- package/dist/controllers/auth_state.d.ts +23 -0
- package/dist/controllers/client.d.ts +3 -1
- package/dist/controllers/collection_registry.d.ts +5 -1
- package/dist/controllers/data_driver.d.ts +31 -2
- package/dist/controllers/index.d.ts +1 -10
- package/dist/index.d.ts +1 -1
- package/dist/index.es.js +374 -1
- package/dist/index.es.js.map +1 -1
- package/dist/types/admin_block.d.ts +34 -0
- package/dist/types/backend.d.ts +30 -1
- package/dist/types/channel_bus.d.ts +192 -0
- package/dist/types/collection_contract.d.ts +43 -0
- package/dist/types/collections.d.ts +17 -789
- package/dist/types/component_ref.d.ts +39 -6
- package/dist/types/entity_callbacks.d.ts +1 -1
- package/dist/types/index.d.ts +7 -15
- package/dist/types/project_manifest.d.ts +336 -0
- package/dist/types/properties.d.ts +12 -157
- package/dist/types/schema_version.d.ts +18 -0
- package/dist/types/security_rules.d.ts +320 -0
- package/dist/types/storage_authorize.d.ts +74 -0
- package/package.json +3 -6
- package/src/call_context.ts +56 -0
- package/src/controllers/auth_state.ts +24 -0
- package/src/controllers/client.ts +3 -2
- package/src/controllers/collection_registry.ts +5 -1
- package/src/controllers/data_driver.ts +58 -2
- package/src/controllers/index.ts +1 -10
- package/src/index.ts +1 -1
- package/src/types/admin_block.ts +75 -0
- package/src/types/backend.ts +33 -1
- package/src/types/channel_bus.ts +202 -0
- package/src/types/collection_contract.ts +278 -0
- package/src/types/collections.ts +25 -848
- package/src/types/component_ref.ts +40 -6
- package/src/types/entity_callbacks.ts +1 -1
- package/src/types/index.ts +7 -15
- package/src/types/policy.ts +25 -11
- package/src/types/project_manifest.ts +362 -0
- package/src/types/properties.ts +11 -169
- package/src/types/schema_version.ts +112 -0
- package/src/types/security_rules.ts +344 -0
- package/src/types/storage_authorize.ts +77 -0
- package/dist/controllers/analytics_controller.d.ts +0 -7
- package/dist/controllers/auth.d.ts +0 -110
- package/dist/controllers/customization_controller.d.ts +0 -61
- package/dist/controllers/dialogs_controller.d.ts +0 -36
- package/dist/controllers/local_config_persistence.d.ts +0 -20
- package/dist/controllers/navigation.d.ts +0 -225
- package/dist/controllers/registry.d.ts +0 -80
- package/dist/controllers/side_dialogs_controller.d.ts +0 -67
- package/dist/controllers/side_panel_controller.d.ts +0 -97
- package/dist/controllers/snackbar.d.ts +0 -24
- package/dist/rebase_context.d.ts +0 -110
- package/dist/types/breadcrumbs.d.ts +0 -26
- package/dist/types/builders.d.ts +0 -15
- package/dist/types/component_overrides.d.ts +0 -196
- package/dist/types/entity_actions.d.ts +0 -104
- package/dist/types/entity_link_builder.d.ts +0 -7
- package/dist/types/entity_views.d.ts +0 -95
- package/dist/types/export_import.d.ts +0 -21
- package/dist/types/formex.d.ts +0 -40
- package/dist/types/locales.d.ts +0 -4
- package/dist/types/modify_collections.d.ts +0 -5
- package/dist/types/plugins.d.ts +0 -277
- package/dist/types/property_config.d.ts +0 -74
- package/dist/types/slots.d.ts +0 -262
- package/dist/types/translations.d.ts +0 -915
- package/dist/types/user_management_delegate.d.ts +0 -22
- package/src/controllers/analytics_controller.tsx +0 -57
- package/src/controllers/auth.tsx +0 -121
- package/src/controllers/customization_controller.tsx +0 -72
- package/src/controllers/dialogs_controller.tsx +0 -37
- package/src/controllers/local_config_persistence.tsx +0 -22
- package/src/controllers/navigation.ts +0 -267
- package/src/controllers/registry.ts +0 -95
- package/src/controllers/side_dialogs_controller.tsx +0 -82
- package/src/controllers/side_panel_controller.tsx +0 -112
- package/src/controllers/snackbar.ts +0 -29
- package/src/rebase_context.tsx +0 -130
- package/src/types/breadcrumbs.ts +0 -27
- package/src/types/builders.ts +0 -17
- package/src/types/component_overrides.ts +0 -244
- package/src/types/entity_actions.tsx +0 -125
- package/src/types/entity_link_builder.ts +0 -8
- package/src/types/entity_views.tsx +0 -114
- package/src/types/export_import.ts +0 -26
- package/src/types/formex.ts +0 -45
- package/src/types/locales.ts +0 -81
- package/src/types/modify_collections.tsx +0 -6
- package/src/types/plugins.tsx +0 -346
- package/src/types/property_config.tsx +0 -95
- package/src/types/slots.tsx +0 -307
- package/src/types/translations.ts +0 -1026
- package/src/types/user_management_delegate.ts +0 -23
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import type { CollectionConfig } from "../types/collections";
|
|
3
|
-
/**
|
|
4
|
-
* Controller that handles URL path building and resolution.
|
|
5
|
-
* @group Models
|
|
6
|
-
*/
|
|
7
|
-
export type UrlController = {
|
|
8
|
-
/**
|
|
9
|
-
* Default path under the navigation routes of the CMS will be created.
|
|
10
|
-
* Defaults to '/'. You may want to change this `basepath` to 'admin' for example.
|
|
11
|
-
*/
|
|
12
|
-
basePath: string;
|
|
13
|
-
/**
|
|
14
|
-
* Default path under the collection routes of the CMS will be created.
|
|
15
|
-
* It defaults to '/c'
|
|
16
|
-
*/
|
|
17
|
-
baseCollectionPath: string;
|
|
18
|
-
/**
|
|
19
|
-
* Convert a URL path to a collection or entity path
|
|
20
|
-
* `/c/products` => `products`
|
|
21
|
-
* `/my_cms/c/products/B34SAP8Z` => `products/B34SAP8Z`
|
|
22
|
-
* `/my_cms/my_view` => `my_view`
|
|
23
|
-
* @param cmsPath
|
|
24
|
-
*/
|
|
25
|
-
urlPathToDataPath: (cmsPath: string) => string;
|
|
26
|
-
/**
|
|
27
|
-
* Base url path for the home screen
|
|
28
|
-
*/
|
|
29
|
-
homeUrl: string;
|
|
30
|
-
/**
|
|
31
|
-
* Check if a url path belongs to a collection
|
|
32
|
-
* @param path
|
|
33
|
-
*/
|
|
34
|
-
isUrlCollectionPath: (urlPath: string) => boolean;
|
|
35
|
-
/**
|
|
36
|
-
* Build a URL collection path from a data path
|
|
37
|
-
* `products` => `/c/products`
|
|
38
|
-
* `products/B34SAP8Z` => `/c/products/B34SAP8Z`
|
|
39
|
-
* @param path
|
|
40
|
-
*/
|
|
41
|
-
buildUrlCollectionPath: (path: string) => string;
|
|
42
|
-
/**
|
|
43
|
-
* Build a URL path for the CMS (e.g. for custom views)
|
|
44
|
-
* @param path
|
|
45
|
-
*/
|
|
46
|
-
buildAppUrlPath: (path: string) => string;
|
|
47
|
-
/**
|
|
48
|
-
* Turn a path with collection ids into a resolved path.
|
|
49
|
-
* The ids (typically used in urls) will be replaced with relative paths (typically used in database paths)
|
|
50
|
-
* @param path
|
|
51
|
-
*/
|
|
52
|
-
resolveDatabasePathsFrom: (path: string) => string;
|
|
53
|
-
/**
|
|
54
|
-
* A function to navigate to a specified route or URL.
|
|
55
|
-
*
|
|
56
|
-
* @param {string} to - The target route or URL to navigate to.
|
|
57
|
-
* @param {NavigateOptions} [options] - Optional configuration settings for navigation, such as replace behavior or state data.
|
|
58
|
-
*/
|
|
59
|
-
navigate: (to: string, options?: NavigateOptions) => void;
|
|
60
|
-
};
|
|
61
|
-
/**
|
|
62
|
-
* Controller that manages the state of the navigation menu,
|
|
63
|
-
* including resolved views and top-level grouping.
|
|
64
|
-
* @group Models
|
|
65
|
-
*/
|
|
66
|
-
export type NavigationStateController = {
|
|
67
|
-
/**
|
|
68
|
-
* Custom additional views created by the developer, added to the main
|
|
69
|
-
* navigation
|
|
70
|
-
*/
|
|
71
|
-
views?: AppView[];
|
|
72
|
-
/**
|
|
73
|
-
* Custom additional views created by the developer, added to the admin
|
|
74
|
-
* navigation
|
|
75
|
-
*/
|
|
76
|
-
adminViews?: AppView[];
|
|
77
|
-
/**
|
|
78
|
-
* Configuration for the views that should be displayed at the top
|
|
79
|
-
* level of the navigation (e.g. in the home page or the navigation
|
|
80
|
-
* drawer)
|
|
81
|
-
*/
|
|
82
|
-
topLevelNavigation?: NavigationResult;
|
|
83
|
-
/**
|
|
84
|
-
* Is the navigation loading (the configuration persistence has not
|
|
85
|
-
* loaded yet, or a specified navigation builder has not completed)
|
|
86
|
-
*/
|
|
87
|
-
loading: boolean;
|
|
88
|
-
/**
|
|
89
|
-
* Was there an error while loading the navigation data
|
|
90
|
-
*/
|
|
91
|
-
navigationLoadingError?: Error;
|
|
92
|
-
/**
|
|
93
|
-
* Call this method to recalculate the navigation
|
|
94
|
-
*/
|
|
95
|
-
refreshNavigation: () => void;
|
|
96
|
-
};
|
|
97
|
-
export interface NavigateOptions {
|
|
98
|
-
replace?: boolean;
|
|
99
|
-
state?: unknown;
|
|
100
|
-
preventScrollReset?: boolean;
|
|
101
|
-
relative?: "route" | "path";
|
|
102
|
-
flushSync?: boolean;
|
|
103
|
-
viewTransition?: boolean;
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Custom additional views created by the developer, added to the main
|
|
107
|
-
* navigation.
|
|
108
|
-
* @group Models
|
|
109
|
-
*/
|
|
110
|
-
export interface AppView {
|
|
111
|
-
/**
|
|
112
|
-
* CMS Path you can reach this view from.
|
|
113
|
-
*/
|
|
114
|
-
slug: string;
|
|
115
|
-
/**
|
|
116
|
-
* Name of this view
|
|
117
|
-
*/
|
|
118
|
-
name: string;
|
|
119
|
-
/**
|
|
120
|
-
* Optional description of this view. You can use Markdown
|
|
121
|
-
*/
|
|
122
|
-
description?: string;
|
|
123
|
-
/**
|
|
124
|
-
* Icon key to use in this view.
|
|
125
|
-
* You can use any of the icons in the Lucide specs:
|
|
126
|
-
* https://lucide.dev/icons/
|
|
127
|
-
* e.g. 'ShoppingCart' or 'User'
|
|
128
|
-
* Find all the icons in https://rebase.pro/docs/icons
|
|
129
|
-
*/
|
|
130
|
-
icon?: string | React.ReactNode;
|
|
131
|
-
/**
|
|
132
|
-
* Should this view be hidden from the main navigation panel.
|
|
133
|
-
* It will still be accessible if you reach the specified path
|
|
134
|
-
*/
|
|
135
|
-
hideFromNavigation?: boolean;
|
|
136
|
-
/**
|
|
137
|
-
* Navigation group for this view.
|
|
138
|
-
* Views sharing the same group name will be visually grouped
|
|
139
|
-
* together in the drawer and home page. If not set, the view
|
|
140
|
-
* falls into the default "Views" group.
|
|
141
|
-
*/
|
|
142
|
-
group?: string;
|
|
143
|
-
/**
|
|
144
|
-
* Component to be rendered. This can be any React component, and can use
|
|
145
|
-
* any of the provided hooks.
|
|
146
|
-
*
|
|
147
|
-
* Pass a `ComponentType` to enable lazy rendering — the component will
|
|
148
|
-
* only be instantiated when the route is visited. This is recommended
|
|
149
|
-
* for dynamic views generated from database data.
|
|
150
|
-
*/
|
|
151
|
-
view: React.ReactNode | React.ComponentType;
|
|
152
|
-
/**
|
|
153
|
-
* If true, a wildcard route (slug/*) is automatically registered
|
|
154
|
-
* alongside the base route, enabling nested navigation within this view.
|
|
155
|
-
*/
|
|
156
|
-
nestedRoutes?: boolean;
|
|
157
|
-
/**
|
|
158
|
-
* Restrict this view to users with at least one of the listed roles.
|
|
159
|
-
* When omitted or empty, the view is visible to all authenticated users.
|
|
160
|
-
* Applied during view resolution — the view is filtered out entirely
|
|
161
|
-
* (not just hidden from nav) if the user lacks a matching role.
|
|
162
|
-
*/
|
|
163
|
-
roles?: string[];
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* A composable section that can be rendered on the home page.
|
|
167
|
-
* Use this to add custom content alongside the auto-generated
|
|
168
|
-
* navigation groups.
|
|
169
|
-
* @group Models
|
|
170
|
-
*/
|
|
171
|
-
export interface HomePageSection {
|
|
172
|
-
/**
|
|
173
|
-
* Unique key for this section.
|
|
174
|
-
*/
|
|
175
|
-
key: string;
|
|
176
|
-
/**
|
|
177
|
-
* Title displayed as the section header.
|
|
178
|
-
*/
|
|
179
|
-
title: string;
|
|
180
|
-
/**
|
|
181
|
-
* Arbitrary React content rendered inside the section.
|
|
182
|
-
*/
|
|
183
|
-
children: React.ReactNode;
|
|
184
|
-
}
|
|
185
|
-
/**
|
|
186
|
-
* Used to group navigation entries in the main navigation.
|
|
187
|
-
*/
|
|
188
|
-
export interface NavigationGroupMapping {
|
|
189
|
-
/**
|
|
190
|
-
* Name of the group, used to display the group header in the UI
|
|
191
|
-
*/
|
|
192
|
-
name: string;
|
|
193
|
-
/**
|
|
194
|
-
* List of collection ids or view paths that belong to this group.
|
|
195
|
-
*/
|
|
196
|
-
entries: string[];
|
|
197
|
-
/**
|
|
198
|
-
* Configure which groups start collapsed.
|
|
199
|
-
* Set to `true` to collapse in both drawer and home page,
|
|
200
|
-
* or use an object to control each independently.
|
|
201
|
-
*
|
|
202
|
-
* @defaultValue false (expanded)
|
|
203
|
-
*/
|
|
204
|
-
collapsedByDefault?: boolean | {
|
|
205
|
-
drawer?: boolean;
|
|
206
|
-
home?: boolean;
|
|
207
|
-
};
|
|
208
|
-
}
|
|
209
|
-
export interface NavigationEntry {
|
|
210
|
-
id: string;
|
|
211
|
-
url: string;
|
|
212
|
-
name: string;
|
|
213
|
-
slug: string;
|
|
214
|
-
type: "collection" | "view" | "admin";
|
|
215
|
-
collection?: CollectionConfig;
|
|
216
|
-
view?: AppView;
|
|
217
|
-
description?: string;
|
|
218
|
-
group: string;
|
|
219
|
-
}
|
|
220
|
-
export type NavigationResult = {
|
|
221
|
-
allowDragAndDrop: boolean;
|
|
222
|
-
navigationEntries: NavigationEntry[];
|
|
223
|
-
groups: string[];
|
|
224
|
-
onNavigationEntriesUpdate: (entries: NavigationGroupMapping[]) => void;
|
|
225
|
-
};
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
2
|
-
import type { CollectionConfig } from "../types/collections";
|
|
3
|
-
import type { CollectionConfigsBuilder, AppViewsBuilder } from "../types/builders";
|
|
4
|
-
import type { EntityCustomView } from "../types/entity_views";
|
|
5
|
-
import type { EntityAction } from "../types/entity_actions";
|
|
6
|
-
import type { AppView, NavigationGroupMapping } from "./navigation";
|
|
7
|
-
/**
|
|
8
|
-
* Options to enable the built-in collection editor.
|
|
9
|
-
* When provided to `<RebaseAdmin>`, the editor is auto-wired as a native feature.
|
|
10
|
-
*/
|
|
11
|
-
export interface CollectionEditorOptions {
|
|
12
|
-
/**
|
|
13
|
-
* Function that returns an auth token for schema-editor API calls.
|
|
14
|
-
* Falls back to `authController.getAuthToken` when omitted.
|
|
15
|
-
*/
|
|
16
|
-
getAuthToken?: () => Promise<string | null>;
|
|
17
|
-
/** Mark the editor as read-only (disable mutations). */
|
|
18
|
-
readOnly?: boolean;
|
|
19
|
-
/** Suggested base paths shown when creating new collections. */
|
|
20
|
-
pathSuggestions?: string[];
|
|
21
|
-
}
|
|
22
|
-
export interface RebaseAdminConfig<EC extends CollectionConfig = CollectionConfig> {
|
|
23
|
-
collections?: EC[] | CollectionConfigsBuilder<EC>;
|
|
24
|
-
/**
|
|
25
|
-
* Custom top-level views added to the main navigation.
|
|
26
|
-
* Accepts a static array of views or an async builder function
|
|
27
|
-
* that receives the current user/auth context for role-based views.
|
|
28
|
-
*/
|
|
29
|
-
views?: AppView[] | AppViewsBuilder;
|
|
30
|
-
homePage?: ReactNode;
|
|
31
|
-
entityViews?: EntityCustomView[];
|
|
32
|
-
entityActions?: EntityAction[];
|
|
33
|
-
/**
|
|
34
|
-
* Centralized configuration for how collections and views are grouped
|
|
35
|
-
* in the navigation sidebar and home page.
|
|
36
|
-
* Each mapping defines a named group and the collection/view slugs
|
|
37
|
-
* that belong to it. The array order determines group display order.
|
|
38
|
-
* Entry order within each group determines card order.
|
|
39
|
-
*/
|
|
40
|
-
navigationGroupMappings?: NavigationGroupMapping[];
|
|
41
|
-
/**
|
|
42
|
-
* Enable the built-in visual collection/schema editor.
|
|
43
|
-
* Pass `true` for zero-config, or an options object for fine-grained control.
|
|
44
|
-
* When enabled, the editor slots, provider, and Studio schema view
|
|
45
|
-
* are all auto-wired — no plugin or manual view injection needed.
|
|
46
|
-
*/
|
|
47
|
-
collectionEditor?: boolean | CollectionEditorOptions;
|
|
48
|
-
/**
|
|
49
|
-
* URL path prefix the admin is mounted under, when it does not live at the
|
|
50
|
-
* site root. Set this when the admin is rendered inside a path-prefixed
|
|
51
|
-
* route (e.g. `<Route path="/admin/*">`) so URL⇄collection resolution
|
|
52
|
-
* accounts for the prefix — otherwise the current path won't be recognized
|
|
53
|
-
* as a collection path and views hang on a spinner with no data fetch.
|
|
54
|
-
*
|
|
55
|
-
* Do NOT set this when mounting via a react-router `basename` — react-router
|
|
56
|
-
* already strips the prefix from the location, so the default (`/`) is correct.
|
|
57
|
-
*
|
|
58
|
-
* @default "/"
|
|
59
|
-
*/
|
|
60
|
-
basePath?: string;
|
|
61
|
-
}
|
|
62
|
-
export interface RebaseStudioConfig {
|
|
63
|
-
tools?: ("sql" | "js" | "rls" | "schema" | "storage" | "cron" | "schema-visualizer" | "branches" | "backups" | "api" | "logs" | "api-keys")[];
|
|
64
|
-
homePage?: ReactNode;
|
|
65
|
-
devViews?: AppView[];
|
|
66
|
-
}
|
|
67
|
-
export interface RebaseAuthConfig {
|
|
68
|
-
loginView?: ReactNode;
|
|
69
|
-
}
|
|
70
|
-
export interface RebaseRegistryController {
|
|
71
|
-
cmsConfig: RebaseAdminConfig | null;
|
|
72
|
-
studioConfig: RebaseStudioConfig | null;
|
|
73
|
-
authConfig: RebaseAuthConfig | null;
|
|
74
|
-
registerCMS: (config: RebaseAdminConfig) => void;
|
|
75
|
-
unregisterCMS: () => void;
|
|
76
|
-
registerStudio: (config: RebaseStudioConfig) => void;
|
|
77
|
-
unregisterStudio: () => void;
|
|
78
|
-
registerAuth: (config: RebaseAuthConfig) => void;
|
|
79
|
-
unregisterAuth: () => void;
|
|
80
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
/**
|
|
3
|
-
* Controller to open the side dialog
|
|
4
|
-
* @group Hooks and utilities
|
|
5
|
-
*/
|
|
6
|
-
export interface SideDialogsController {
|
|
7
|
-
/**
|
|
8
|
-
* Close the last panel
|
|
9
|
-
*/
|
|
10
|
-
close: () => void;
|
|
11
|
-
/**
|
|
12
|
-
* List of side panels currently open
|
|
13
|
-
*/
|
|
14
|
-
sidePanels: SideDialogPanelProps[];
|
|
15
|
-
/**
|
|
16
|
-
* Override the current side panels
|
|
17
|
-
* @param panels
|
|
18
|
-
*/
|
|
19
|
-
setSidePanels: (panels: SideDialogPanelProps[]) => void;
|
|
20
|
-
/**
|
|
21
|
-
* Open one or multiple side panels
|
|
22
|
-
* @param props
|
|
23
|
-
*/
|
|
24
|
-
open: (panelProps: SideDialogPanelProps | SideDialogPanelProps[]) => void;
|
|
25
|
-
/**
|
|
26
|
-
* Replace the last open panel with the given one
|
|
27
|
-
* @param props
|
|
28
|
-
*/
|
|
29
|
-
replace: (panelProps: SideDialogPanelProps | SideDialogPanelProps[]) => void;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Props used to open a side dialog
|
|
33
|
-
* @group Hooks and utilities
|
|
34
|
-
*/
|
|
35
|
-
export interface SideDialogPanelProps {
|
|
36
|
-
/**
|
|
37
|
-
* A key that identifies this panel
|
|
38
|
-
*/
|
|
39
|
-
key: string;
|
|
40
|
-
/**
|
|
41
|
-
* The component type that will be rendered
|
|
42
|
-
*/
|
|
43
|
-
component: React.ReactNode;
|
|
44
|
-
/**
|
|
45
|
-
* Optional width of the panel
|
|
46
|
-
*/
|
|
47
|
-
width?: string;
|
|
48
|
-
/**
|
|
49
|
-
* When open, change the URL to this path.
|
|
50
|
-
* Note that if you want to restore state from a URL you need to add the
|
|
51
|
-
* logic yourself by listening to URL updates, and probably call `open`.
|
|
52
|
-
*/
|
|
53
|
-
urlPath?: string;
|
|
54
|
-
/**
|
|
55
|
-
* If the navigation stack is empty (you landed in the `urlPath` url), what
|
|
56
|
-
* url path to change to when the panel gets closed.
|
|
57
|
-
*/
|
|
58
|
-
parentUrlPath?: string;
|
|
59
|
-
/**
|
|
60
|
-
* Callback when the panel is closed
|
|
61
|
-
*/
|
|
62
|
-
onClose?: () => void;
|
|
63
|
-
/**
|
|
64
|
-
* Use this prop to store additional data in the panel
|
|
65
|
-
*/
|
|
66
|
-
additional?: unknown;
|
|
67
|
-
}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import type { Entity } from "../types/entities";
|
|
2
|
-
import type { CollectionConfig } from "../types/collections";
|
|
3
|
-
/**
|
|
4
|
-
* Props used to open a side dialog
|
|
5
|
-
* @group Hooks and utilities
|
|
6
|
-
*/
|
|
7
|
-
export interface SidePanelBindingProps<M extends Record<string, unknown> = Record<string, unknown>> {
|
|
8
|
-
/**
|
|
9
|
-
* Absolute path of the entity
|
|
10
|
-
*/
|
|
11
|
-
path: string;
|
|
12
|
-
/**
|
|
13
|
-
* ID of the entity, if not set, it means we are creating a new entity
|
|
14
|
-
*/
|
|
15
|
-
entityId?: string | number;
|
|
16
|
-
/**
|
|
17
|
-
* Set this flag to true if you want to make a copy of an existing entity
|
|
18
|
-
*/
|
|
19
|
-
copy?: boolean;
|
|
20
|
-
/**
|
|
21
|
-
* Open the entity with a selected sub-collection view. If the panel for this
|
|
22
|
-
* entity was already open, it is replaced.
|
|
23
|
-
*/
|
|
24
|
-
selectedTab?: string;
|
|
25
|
-
/**
|
|
26
|
-
* Use this prop to override the width of the form view.
|
|
27
|
-
* e.g. "600px"
|
|
28
|
-
*/
|
|
29
|
-
width?: number | string;
|
|
30
|
-
/**
|
|
31
|
-
* Collection representing the entities of this view.
|
|
32
|
-
* If you leave it blank it will be induced by your navigation
|
|
33
|
-
*/
|
|
34
|
-
collection?: CollectionConfig<M>;
|
|
35
|
-
/**
|
|
36
|
-
* Should update the URL when opening the dialog.
|
|
37
|
-
* Consider that if the collection that you provide is not defined in the base
|
|
38
|
-
* config of your `Rebase` component, you will not be able to recreate
|
|
39
|
-
* the state if copying the URL to a different window.
|
|
40
|
-
*/
|
|
41
|
-
updateUrl?: boolean;
|
|
42
|
-
/**
|
|
43
|
-
* Callback when the entity is updated
|
|
44
|
-
* @param params
|
|
45
|
-
*/
|
|
46
|
-
onUpdate?: (params: {
|
|
47
|
-
entity: Entity<M>;
|
|
48
|
-
}) => void;
|
|
49
|
-
/**
|
|
50
|
-
* Callback when the dialog is closed
|
|
51
|
-
*/
|
|
52
|
-
onClose?: () => void;
|
|
53
|
-
/**
|
|
54
|
-
* Should this panel close when saving
|
|
55
|
-
*/
|
|
56
|
-
closeOnSave?: boolean;
|
|
57
|
-
/**
|
|
58
|
-
* Override some form properties
|
|
59
|
-
*/
|
|
60
|
-
formProps?: Record<string, unknown>;
|
|
61
|
-
/**
|
|
62
|
-
* Allow the user to open the entity fullscreen
|
|
63
|
-
*/
|
|
64
|
-
allowFullScreen?: boolean;
|
|
65
|
-
/**
|
|
66
|
-
* Pre-populate the form with these values when creating a new entity.
|
|
67
|
-
* Only applied when `entityId` is not set (i.e. the form is in "new" mode).
|
|
68
|
-
* Useful for actions that fetch data from an external source (e.g. a URL)
|
|
69
|
-
* and want to pre-fill the document before the user saves.
|
|
70
|
-
*/
|
|
71
|
-
defaultValues?: Partial<M>;
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Controller to open the side dialog displaying entity forms
|
|
75
|
-
* @group Hooks and utilities
|
|
76
|
-
*/
|
|
77
|
-
export interface SidePanelController {
|
|
78
|
-
/**
|
|
79
|
-
* Close the last panel
|
|
80
|
-
*/
|
|
81
|
-
close: () => void;
|
|
82
|
-
/**
|
|
83
|
-
* Open a new entity sideDialog. By default, the collection and configuration
|
|
84
|
-
* of the view is fetched from the collections you have specified in the
|
|
85
|
-
* navigation.
|
|
86
|
-
* At least you need to pass the path of the entity you would like
|
|
87
|
-
* to edit. You can set a entityId if you would like to edit and existing one
|
|
88
|
-
* (or a new one with that id).
|
|
89
|
-
* @param props
|
|
90
|
-
*/
|
|
91
|
-
open: <M extends Record<string, unknown> = Record<string, unknown>>(props: SidePanelBindingProps<M>) => void;
|
|
92
|
-
/**
|
|
93
|
-
* Replace the last open entity panel with the given one.
|
|
94
|
-
* @param props
|
|
95
|
-
*/
|
|
96
|
-
replace: <M extends Record<string, unknown> = Record<string, unknown>>(props: SidePanelBindingProps<M>) => void;
|
|
97
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Possible snackbar types
|
|
3
|
-
* @group Hooks and utilities
|
|
4
|
-
*/
|
|
5
|
-
export type SnackbarMessageType = "success" | "info" | "warning" | "error";
|
|
6
|
-
/**
|
|
7
|
-
* Controller to display snackbars
|
|
8
|
-
* @group Hooks and utilities
|
|
9
|
-
*/
|
|
10
|
-
export interface SnackbarController {
|
|
11
|
-
/**
|
|
12
|
-
* Close the currently open snackbar
|
|
13
|
-
*/
|
|
14
|
-
close: () => void;
|
|
15
|
-
/**
|
|
16
|
-
* Display a new snackbar. You need to specify the type and message.
|
|
17
|
-
* You can optionally specify a title
|
|
18
|
-
*/
|
|
19
|
-
open: (props: {
|
|
20
|
-
type: SnackbarMessageType;
|
|
21
|
-
message: React.ReactNode;
|
|
22
|
-
autoHideDuration?: number;
|
|
23
|
-
}) => void;
|
|
24
|
-
}
|
package/dist/rebase_context.d.ts
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import type { AnalyticsController } from "./controllers/analytics_controller";
|
|
2
|
-
import type { AuthController } from "./controllers/auth";
|
|
3
|
-
import type { StorageSource } from "./controllers/storage";
|
|
4
|
-
import type { UserConfigurationPersistence } from "./controllers/local_config_persistence";
|
|
5
|
-
import type { DatabaseAdmin } from "./types/backend";
|
|
6
|
-
import type { RebaseClient } from "./controllers/client";
|
|
7
|
-
import type { RebaseSdkData } from "./controllers/data";
|
|
8
|
-
import type { User } from "./users";
|
|
9
|
-
/**
|
|
10
|
-
* Context that is provided to entity callbacks (hooks).
|
|
11
|
-
* It contains only the dependencies that are available in both the frontend and the backend.
|
|
12
|
-
* @group Hooks and utilities
|
|
13
|
-
*/
|
|
14
|
-
export type RebaseCallContext<USER extends User = User> = {
|
|
15
|
-
/**
|
|
16
|
-
* The Rebase client instance.
|
|
17
|
-
* Available in all entity callbacks (beforeSave, afterSave, afterRead,
|
|
18
|
-
* beforeDelete, afterDelete) and in CollectionActionsProps via context.
|
|
19
|
-
* Use it to call backend functions, access data, storage, etc.
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* // In a beforeSave callback:
|
|
23
|
-
* const result = await context.client.functions.invoke('my-function', { ... });
|
|
24
|
-
*
|
|
25
|
-
* @example
|
|
26
|
-
* // In a CollectionAction component:
|
|
27
|
-
* const { client } = props.context;
|
|
28
|
-
* const result = await client.functions.invoke('extract-job', { url });
|
|
29
|
-
*/
|
|
30
|
-
client: RebaseClient;
|
|
31
|
-
/**
|
|
32
|
-
* Unified data access — `context.data.products.create(...)`.
|
|
33
|
-
* Access any collection as a dynamic property.
|
|
34
|
-
*
|
|
35
|
-
* Returns flat rows (`{ id, ...columns }`), identical to the frontend SDK
|
|
36
|
-
* client — so `context.data` in a backend callback and `client.data` in the
|
|
37
|
-
* frontend behave the same way (`row.title`, never `row.values.title`).
|
|
38
|
-
*/
|
|
39
|
-
data: RebaseSdkData;
|
|
40
|
-
/**
|
|
41
|
-
* Used storage implementation
|
|
42
|
-
*/
|
|
43
|
-
storageSource: StorageSource;
|
|
44
|
-
/**
|
|
45
|
-
* Set by the backend when callbacks are executed on the server.
|
|
46
|
-
*/
|
|
47
|
-
user?: USER;
|
|
48
|
-
};
|
|
49
|
-
/**
|
|
50
|
-
* Context that includes the internal controllers and contexts used by the app.
|
|
51
|
-
* Some controllers and context included in this context can be accessed
|
|
52
|
-
* directly from their respective hooks.
|
|
53
|
-
* @group Hooks and utilities
|
|
54
|
-
* @see useRebaseContext
|
|
55
|
-
*/
|
|
56
|
-
export type RebaseContext<USER extends User = User, AuthControllerType extends AuthController<USER> = AuthController<USER>> = RebaseCallContext<USER> & {
|
|
57
|
-
authController: AuthControllerType;
|
|
58
|
-
/**
|
|
59
|
-
* Controller mapping strings to collections
|
|
60
|
-
*/
|
|
61
|
-
collectionRegistryController?: import("./controllers/collection_registry").CollectionRegistryController;
|
|
62
|
-
/**
|
|
63
|
-
* Controller for navigation state
|
|
64
|
-
*/
|
|
65
|
-
navigationStateController?: import("./controllers/navigation").NavigationStateController;
|
|
66
|
-
/**
|
|
67
|
-
* Controller for side dialogs (side sheets)
|
|
68
|
-
*/
|
|
69
|
-
sideDialogsController?: import("./controllers/side_dialogs_controller").SideDialogsController;
|
|
70
|
-
/**
|
|
71
|
-
* Controller to open the side panel displaying entity forms
|
|
72
|
-
*/
|
|
73
|
-
sidePanelController?: import("./controllers/side_panel_controller").SidePanelController;
|
|
74
|
-
/**
|
|
75
|
-
* Controller resolving URLs in the CMS
|
|
76
|
-
*/
|
|
77
|
-
urlController?: import("./controllers/navigation").UrlController;
|
|
78
|
-
/**
|
|
79
|
-
* Controller to handle simple confirmation and alert dialogs
|
|
80
|
-
*/
|
|
81
|
-
dialogsController?: import("./controllers/dialogs_controller").DialogsController;
|
|
82
|
-
/**
|
|
83
|
-
* Controller for CMS customization
|
|
84
|
-
*/
|
|
85
|
-
customizationController?: import("./controllers/customization_controller").CustomizationController;
|
|
86
|
-
/**
|
|
87
|
-
* Controller for effective role
|
|
88
|
-
*/
|
|
89
|
-
effectiveRoleController?: {
|
|
90
|
-
effectiveRole: string | null;
|
|
91
|
-
setEffectiveRole: (role: string | null) => void;
|
|
92
|
-
};
|
|
93
|
-
/**
|
|
94
|
-
* Use this controller to access data stored in the browser for the user
|
|
95
|
-
*/
|
|
96
|
-
userConfigPersistence?: UserConfigurationPersistence;
|
|
97
|
-
/**
|
|
98
|
-
* Callback to send analytics events
|
|
99
|
-
*/
|
|
100
|
-
analyticsController?: AnalyticsController;
|
|
101
|
-
/**
|
|
102
|
-
* Administrative database operations (SQL, schema discovery).
|
|
103
|
-
* Only available in developer/admin contexts.
|
|
104
|
-
*/
|
|
105
|
-
databaseAdmin?: DatabaseAdmin;
|
|
106
|
-
/**
|
|
107
|
-
* Controller for snackbars
|
|
108
|
-
*/
|
|
109
|
-
snackbarController?: import("./controllers/snackbar").SnackbarController;
|
|
110
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export interface BreadcrumbEntry {
|
|
2
|
-
title: string;
|
|
3
|
-
url: string;
|
|
4
|
-
/**
|
|
5
|
-
* Optional entity count for collection breadcrumbs.
|
|
6
|
-
* - undefined: not applicable (e.g., entity breadcrumb, custom view)
|
|
7
|
-
* - null: loading
|
|
8
|
-
* - number: loaded count
|
|
9
|
-
*/
|
|
10
|
-
count?: number | null;
|
|
11
|
-
/**
|
|
12
|
-
* Unique identifier for this breadcrumb (e.g., collection path).
|
|
13
|
-
* Used to update count without replacing entire breadcrumb array.
|
|
14
|
-
*/
|
|
15
|
-
id?: string;
|
|
16
|
-
}
|
|
17
|
-
export interface BreadcrumbsController {
|
|
18
|
-
breadcrumbs: BreadcrumbEntry[];
|
|
19
|
-
set: (props: {
|
|
20
|
-
breadcrumbs: BreadcrumbEntry[];
|
|
21
|
-
}) => void;
|
|
22
|
-
/**
|
|
23
|
-
* Update the count for a specific breadcrumb by ID.
|
|
24
|
-
*/
|
|
25
|
-
updateCount: (id: string, count: number | null | undefined) => void;
|
|
26
|
-
}
|
package/dist/types/builders.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { AuthController } from "../controllers/auth";
|
|
2
|
-
import type { RebaseData } from "../controllers/data";
|
|
3
|
-
import type { User } from "../users";
|
|
4
|
-
import type { CollectionConfig } from "./collections";
|
|
5
|
-
import type { AppView } from "../controllers/navigation";
|
|
6
|
-
export type CollectionConfigsBuilder<EC extends CollectionConfig = CollectionConfig> = (params: {
|
|
7
|
-
user: User | null;
|
|
8
|
-
authController: AuthController;
|
|
9
|
-
data: RebaseData;
|
|
10
|
-
}) => EC[] | Promise<EC[]>;
|
|
11
|
-
export type AppViewsBuilder = (params: {
|
|
12
|
-
user: User | null;
|
|
13
|
-
authController: AuthController;
|
|
14
|
-
data: RebaseData;
|
|
15
|
-
}) => AppView[] | Promise<AppView[]>;
|