@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,22 +0,0 @@
|
|
|
1
|
-
import type { User } from "../users";
|
|
2
|
-
/**
|
|
3
|
-
* Result of creating a new user via admin flow.
|
|
4
|
-
* Contains the created user plus information about how credentials were delivered.
|
|
5
|
-
*/
|
|
6
|
-
export interface UserCreationResult<USER extends User = User> {
|
|
7
|
-
/** The created user */
|
|
8
|
-
user: USER;
|
|
9
|
-
/** Whether an invitation email was sent to the user */
|
|
10
|
-
invitationSent: boolean;
|
|
11
|
-
/**
|
|
12
|
-
* Temporary password, present when no invitation email could be delivered —
|
|
13
|
-
* either because no email service is configured, or because delivery failed
|
|
14
|
-
* (see `emailDeliveryFailed`). Returned one-time, to be shared manually.
|
|
15
|
-
*/
|
|
16
|
-
temporaryPassword?: string;
|
|
17
|
-
/**
|
|
18
|
-
* Whether an email service was configured but delivery failed, causing the
|
|
19
|
-
* fallback to `temporaryPassword`. Absent when no email service is configured.
|
|
20
|
-
*/
|
|
21
|
-
emailDeliveryFailed?: boolean;
|
|
22
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
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
|
-
;
|
package/src/controllers/auth.tsx
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import type { User } from "../users";
|
|
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
|
-
}
|
|
@@ -1,72 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { CollectionConfig } from "../types/collections";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @group Models
|
|
5
|
-
*/
|
|
6
|
-
export type PartialCollectionConfig<M extends Record<string, unknown> = Record<string, unknown>> = Partial<CollectionConfig<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
|
-
}
|
|
@@ -1,267 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import type { EntityReference } from "../types/entities";
|
|
3
|
-
import type { CollectionConfig } from "../types/collections";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Controller that handles URL path building and resolution.
|
|
8
|
-
* @group Models
|
|
9
|
-
*/
|
|
10
|
-
export type UrlController = {
|
|
11
|
-
/**
|
|
12
|
-
* Default path under the navigation routes of the CMS will be created.
|
|
13
|
-
* Defaults to '/'. You may want to change this `basepath` to 'admin' for example.
|
|
14
|
-
*/
|
|
15
|
-
basePath: string;
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Default path under the collection routes of the CMS will be created.
|
|
19
|
-
* It defaults to '/c'
|
|
20
|
-
*/
|
|
21
|
-
baseCollectionPath: string;
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Convert a URL path to a collection or entity path
|
|
25
|
-
* `/c/products` => `products`
|
|
26
|
-
* `/my_cms/c/products/B34SAP8Z` => `products/B34SAP8Z`
|
|
27
|
-
* `/my_cms/my_view` => `my_view`
|
|
28
|
-
* @param cmsPath
|
|
29
|
-
*/
|
|
30
|
-
urlPathToDataPath: (cmsPath: string) => string;
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Base url path for the home screen
|
|
34
|
-
*/
|
|
35
|
-
homeUrl: string;
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Check if a url path belongs to a collection
|
|
39
|
-
* @param path
|
|
40
|
-
*/
|
|
41
|
-
isUrlCollectionPath: (urlPath: string) => boolean;
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Build a URL collection path from a data path
|
|
45
|
-
* `products` => `/c/products`
|
|
46
|
-
* `products/B34SAP8Z` => `/c/products/B34SAP8Z`
|
|
47
|
-
* @param path
|
|
48
|
-
*/
|
|
49
|
-
buildUrlCollectionPath: (path: string) => string;
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Build a URL path for the CMS (e.g. for custom views)
|
|
53
|
-
* @param path
|
|
54
|
-
*/
|
|
55
|
-
buildAppUrlPath: (path: string) => string;
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Turn a path with collection ids into a resolved path.
|
|
59
|
-
* The ids (typically used in urls) will be replaced with relative paths (typically used in database paths)
|
|
60
|
-
* @param path
|
|
61
|
-
*/
|
|
62
|
-
resolveDatabasePathsFrom: (path: string) => string;
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* A function to navigate to a specified route or URL.
|
|
66
|
-
*
|
|
67
|
-
* @param {string} to - The target route or URL to navigate to.
|
|
68
|
-
* @param {NavigateOptions} [options] - Optional configuration settings for navigation, such as replace behavior or state data.
|
|
69
|
-
*/
|
|
70
|
-
navigate: (to: string, options?: NavigateOptions) => void;
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Controller that manages the state of the navigation menu,
|
|
75
|
-
* including resolved views and top-level grouping.
|
|
76
|
-
* @group Models
|
|
77
|
-
*/
|
|
78
|
-
export type NavigationStateController = {
|
|
79
|
-
/**
|
|
80
|
-
* Custom additional views created by the developer, added to the main
|
|
81
|
-
* navigation
|
|
82
|
-
*/
|
|
83
|
-
views?: AppView[];
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Custom additional views created by the developer, added to the admin
|
|
87
|
-
* navigation
|
|
88
|
-
*/
|
|
89
|
-
adminViews?: AppView[];
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Configuration for the views that should be displayed at the top
|
|
93
|
-
* level of the navigation (e.g. in the home page or the navigation
|
|
94
|
-
* drawer)
|
|
95
|
-
*/
|
|
96
|
-
topLevelNavigation?: NavigationResult;
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Is the navigation loading (the configuration persistence has not
|
|
100
|
-
* loaded yet, or a specified navigation builder has not completed)
|
|
101
|
-
*/
|
|
102
|
-
loading: boolean;
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Was there an error while loading the navigation data
|
|
106
|
-
*/
|
|
107
|
-
navigationLoadingError?: Error;
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Call this method to recalculate the navigation
|
|
111
|
-
*/
|
|
112
|
-
refreshNavigation: () => void;
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
export interface NavigateOptions {
|
|
116
|
-
replace?: boolean;
|
|
117
|
-
state?: unknown;
|
|
118
|
-
preventScrollReset?: boolean;
|
|
119
|
-
relative?: "route" | "path";
|
|
120
|
-
flushSync?: boolean;
|
|
121
|
-
viewTransition?: boolean;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Custom additional views created by the developer, added to the main
|
|
128
|
-
* navigation.
|
|
129
|
-
* @group Models
|
|
130
|
-
*/
|
|
131
|
-
export interface AppView {
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* CMS Path you can reach this view from.
|
|
135
|
-
*/
|
|
136
|
-
slug: string;
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* Name of this view
|
|
140
|
-
*/
|
|
141
|
-
name: string;
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* Optional description of this view. You can use Markdown
|
|
145
|
-
*/
|
|
146
|
-
description?: string;
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* Icon key to use in this view.
|
|
150
|
-
* You can use any of the icons in the Lucide specs:
|
|
151
|
-
* https://lucide.dev/icons/
|
|
152
|
-
* e.g. 'ShoppingCart' or 'User'
|
|
153
|
-
* Find all the icons in https://rebase.pro/docs/icons
|
|
154
|
-
*/
|
|
155
|
-
icon?: string | React.ReactNode;
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* Should this view be hidden from the main navigation panel.
|
|
159
|
-
* It will still be accessible if you reach the specified path
|
|
160
|
-
*/
|
|
161
|
-
hideFromNavigation?: boolean;
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* Navigation group for this view.
|
|
165
|
-
* Views sharing the same group name will be visually grouped
|
|
166
|
-
* together in the drawer and home page. If not set, the view
|
|
167
|
-
* falls into the default "Views" group.
|
|
168
|
-
*/
|
|
169
|
-
group?: string;
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* Component to be rendered. This can be any React component, and can use
|
|
173
|
-
* any of the provided hooks.
|
|
174
|
-
*
|
|
175
|
-
* Pass a `ComponentType` to enable lazy rendering — the component will
|
|
176
|
-
* only be instantiated when the route is visited. This is recommended
|
|
177
|
-
* for dynamic views generated from database data.
|
|
178
|
-
*/
|
|
179
|
-
view: React.ReactNode | React.ComponentType;
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* If true, a wildcard route (slug/*) is automatically registered
|
|
183
|
-
* alongside the base route, enabling nested navigation within this view.
|
|
184
|
-
*/
|
|
185
|
-
nestedRoutes?: boolean;
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* Restrict this view to users with at least one of the listed roles.
|
|
189
|
-
* When omitted or empty, the view is visible to all authenticated users.
|
|
190
|
-
* Applied during view resolution — the view is filtered out entirely
|
|
191
|
-
* (not just hidden from nav) if the user lacks a matching role.
|
|
192
|
-
*/
|
|
193
|
-
roles?: string[];
|
|
194
|
-
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
* A composable section that can be rendered on the home page.
|
|
199
|
-
* Use this to add custom content alongside the auto-generated
|
|
200
|
-
* navigation groups.
|
|
201
|
-
* @group Models
|
|
202
|
-
*/
|
|
203
|
-
export interface HomePageSection {
|
|
204
|
-
/**
|
|
205
|
-
* Unique key for this section.
|
|
206
|
-
*/
|
|
207
|
-
key: string;
|
|
208
|
-
|
|
209
|
-
/**
|
|
210
|
-
* Title displayed as the section header.
|
|
211
|
-
*/
|
|
212
|
-
title: string;
|
|
213
|
-
|
|
214
|
-
/**
|
|
215
|
-
* Arbitrary React content rendered inside the section.
|
|
216
|
-
*/
|
|
217
|
-
children: React.ReactNode;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
/**
|
|
221
|
-
* Used to group navigation entries in the main navigation.
|
|
222
|
-
*/
|
|
223
|
-
export interface NavigationGroupMapping {
|
|
224
|
-
/**
|
|
225
|
-
* Name of the group, used to display the group header in the UI
|
|
226
|
-
*/
|
|
227
|
-
name: string;
|
|
228
|
-
/**
|
|
229
|
-
* List of collection ids or view paths that belong to this group.
|
|
230
|
-
*/
|
|
231
|
-
entries: string[];
|
|
232
|
-
/**
|
|
233
|
-
* Configure which groups start collapsed.
|
|
234
|
-
* Set to `true` to collapse in both drawer and home page,
|
|
235
|
-
* or use an object to control each independently.
|
|
236
|
-
*
|
|
237
|
-
* @defaultValue false (expanded)
|
|
238
|
-
*/
|
|
239
|
-
collapsedByDefault?: boolean | {
|
|
240
|
-
drawer?: boolean;
|
|
241
|
-
home?: boolean;
|
|
242
|
-
};
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
export interface NavigationEntry {
|
|
246
|
-
id: string;
|
|
247
|
-
url: string;
|
|
248
|
-
name: string;
|
|
249
|
-
slug: string;
|
|
250
|
-
type: "collection" | "view" | "admin";
|
|
251
|
-
collection?: CollectionConfig;
|
|
252
|
-
view?: AppView;
|
|
253
|
-
description?: string;
|
|
254
|
-
group: string;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
export type NavigationResult = {
|
|
258
|
-
|
|
259
|
-
allowDragAndDrop: boolean;
|
|
260
|
-
|
|
261
|
-
navigationEntries: NavigationEntry[],
|
|
262
|
-
|
|
263
|
-
groups: string[],
|
|
264
|
-
|
|
265
|
-
onNavigationEntriesUpdate: (entries: NavigationGroupMapping[]) => void;
|
|
266
|
-
};
|
|
267
|
-
|
|
@@ -1,95 +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
|
-
/**
|
|
9
|
-
* Options to enable the built-in collection editor.
|
|
10
|
-
* When provided to `<RebaseAdmin>`, the editor is auto-wired as a native feature.
|
|
11
|
-
*/
|
|
12
|
-
export interface CollectionEditorOptions {
|
|
13
|
-
/**
|
|
14
|
-
* Function that returns an auth token for schema-editor API calls.
|
|
15
|
-
* Falls back to `authController.getAuthToken` when omitted.
|
|
16
|
-
*/
|
|
17
|
-
getAuthToken?: () => Promise<string | null>;
|
|
18
|
-
/** Mark the editor as read-only (disable mutations). */
|
|
19
|
-
readOnly?: boolean;
|
|
20
|
-
/** Suggested base paths shown when creating new collections. */
|
|
21
|
-
pathSuggestions?: string[];
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export interface RebaseAdminConfig<EC extends CollectionConfig = CollectionConfig> {
|
|
25
|
-
collections?: EC[] | CollectionConfigsBuilder<EC>;
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Custom top-level views added to the main navigation.
|
|
29
|
-
* Accepts a static array of views or an async builder function
|
|
30
|
-
* that receives the current user/auth context for role-based views.
|
|
31
|
-
*/
|
|
32
|
-
views?: AppView[] | AppViewsBuilder;
|
|
33
|
-
|
|
34
|
-
homePage?: ReactNode;
|
|
35
|
-
entityViews?: EntityCustomView[];
|
|
36
|
-
entityActions?: EntityAction[];
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Centralized configuration for how collections and views are grouped
|
|
40
|
-
* in the navigation sidebar and home page.
|
|
41
|
-
* Each mapping defines a named group and the collection/view slugs
|
|
42
|
-
* that belong to it. The array order determines group display order.
|
|
43
|
-
* Entry order within each group determines card order.
|
|
44
|
-
*/
|
|
45
|
-
navigationGroupMappings?: NavigationGroupMapping[];
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Enable the built-in visual collection/schema editor.
|
|
49
|
-
* Pass `true` for zero-config, or an options object for fine-grained control.
|
|
50
|
-
* When enabled, the editor slots, provider, and Studio schema view
|
|
51
|
-
* are all auto-wired — no plugin or manual view injection needed.
|
|
52
|
-
*/
|
|
53
|
-
collectionEditor?: boolean | CollectionEditorOptions;
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* URL path prefix the admin is mounted under, when it does not live at the
|
|
57
|
-
* site root. Set this when the admin is rendered inside a path-prefixed
|
|
58
|
-
* route (e.g. `<Route path="/admin/*">`) so URL⇄collection resolution
|
|
59
|
-
* accounts for the prefix — otherwise the current path won't be recognized
|
|
60
|
-
* as a collection path and views hang on a spinner with no data fetch.
|
|
61
|
-
*
|
|
62
|
-
* Do NOT set this when mounting via a react-router `basename` — react-router
|
|
63
|
-
* already strips the prefix from the location, so the default (`/`) is correct.
|
|
64
|
-
*
|
|
65
|
-
* @default "/"
|
|
66
|
-
*/
|
|
67
|
-
basePath?: string;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export interface RebaseStudioConfig {
|
|
71
|
-
tools?: ("sql" | "js" | "rls" | "schema" | "storage" | "cron" | "schema-visualizer" | "branches" | "backups" | "api" | "logs" | "api-keys")[];
|
|
72
|
-
homePage?: ReactNode;
|
|
73
|
-
devViews?: AppView[];
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export interface RebaseAuthConfig {
|
|
77
|
-
loginView?: ReactNode;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export interface RebaseRegistryController {
|
|
81
|
-
// Current state
|
|
82
|
-
cmsConfig: RebaseAdminConfig | null;
|
|
83
|
-
studioConfig: RebaseStudioConfig | null;
|
|
84
|
-
authConfig: RebaseAuthConfig | null;
|
|
85
|
-
|
|
86
|
-
// Registration functions
|
|
87
|
-
registerCMS: (config: RebaseAdminConfig) => void;
|
|
88
|
-
unregisterCMS: () => void;
|
|
89
|
-
|
|
90
|
-
registerStudio: (config: RebaseStudioConfig) => void;
|
|
91
|
-
unregisterStudio: () => void;
|
|
92
|
-
|
|
93
|
-
registerAuth: (config: RebaseAuthConfig) => void;
|
|
94
|
-
unregisterAuth: () => void;
|
|
95
|
-
}
|