@rebasepro/types 0.0.1-canary.2 → 0.0.1-canary.4d4fb3e
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 +1 -1
- package/dist/controllers/analytics_controller.d.ts +2 -2
- package/dist/controllers/auth.d.ts +50 -6
- package/dist/controllers/client.d.ts +58 -0
- package/dist/controllers/collection_registry.d.ts +44 -0
- package/dist/controllers/customization_controller.d.ts +5 -1
- package/dist/controllers/data.d.ts +141 -0
- package/dist/controllers/{datasource.d.ts → data_driver.d.ts} +25 -36
- package/dist/controllers/database_admin.d.ts +11 -0
- package/dist/controllers/effective_role.d.ts +4 -0
- package/dist/controllers/index.d.ts +11 -5
- package/dist/controllers/navigation.d.ts +9 -58
- package/dist/controllers/registry.d.ts +51 -0
- package/dist/controllers/side_entity_controller.d.ts +1 -2
- package/dist/index.d.ts +0 -1
- package/dist/index.es.js +113 -12
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +112 -11
- package/dist/index.umd.js.map +1 -1
- package/dist/rebase_context.d.ts +35 -25
- package/dist/types/backend.d.ts +296 -17
- package/dist/types/builders.d.ts +14 -0
- package/dist/types/collections.d.ts +166 -241
- package/dist/types/data_source.d.ts +64 -0
- package/dist/types/entities.d.ts +29 -24
- package/dist/types/entity_actions.d.ts +7 -7
- package/dist/types/entity_callbacks.d.ts +4 -4
- package/dist/types/entity_overrides.d.ts +6 -2
- package/dist/types/entity_views.d.ts +61 -0
- package/dist/types/index.d.ts +8 -5
- package/dist/types/plugins.d.ts +170 -221
- package/dist/types/properties.d.ts +17 -29
- package/dist/types/property_config.d.ts +13 -11
- package/dist/types/slots.d.ts +228 -0
- package/dist/types/translations.d.ts +826 -0
- package/dist/types/user_management_delegate.d.ts +42 -0
- package/dist/types/websockets.d.ts +45 -0
- package/dist/users/user.d.ts +4 -0
- package/package.json +7 -39
- package/src/controllers/analytics_controller.tsx +2 -2
- package/src/controllers/auth.tsx +53 -6
- package/src/controllers/client.ts +74 -0
- package/src/controllers/collection_registry.ts +53 -0
- package/src/controllers/customization_controller.tsx +6 -1
- package/src/controllers/data.ts +153 -0
- package/src/controllers/{datasource.ts → data_driver.ts} +41 -37
- package/src/controllers/database_admin.ts +22 -0
- package/src/controllers/effective_role.ts +4 -0
- package/src/controllers/index.ts +14 -5
- package/src/controllers/navigation.ts +9 -73
- package/src/controllers/registry.ts +62 -0
- package/src/controllers/side_entity_controller.tsx +1 -2
- package/src/index.ts +0 -1
- package/src/rebase_context.tsx +37 -33
- package/src/types/backend.ts +351 -19
- package/src/types/builders.ts +16 -0
- package/src/types/collections.ts +196 -259
- package/src/types/data_source.ts +156 -0
- package/src/types/entities.ts +35 -28
- package/src/types/entity_actions.tsx +6 -6
- package/src/types/entity_callbacks.ts +4 -4
- package/src/types/entity_overrides.tsx +6 -2
- package/src/types/entity_views.tsx +77 -0
- package/src/types/index.ts +9 -5
- package/src/types/plugins.tsx +198 -256
- package/src/types/properties.ts +22 -31
- package/src/types/property_config.tsx +11 -11
- package/src/types/slots.tsx +271 -0
- package/src/types/translations.ts +923 -0
- package/src/types/user_management_delegate.ts +43 -0
- package/src/types/websockets.ts +48 -0
- package/src/users/user.ts +5 -0
- package/dist/components/EntityFormActionsProps.d.ts +0 -17
- package/dist/components/EntityFormProps.d.ts +0 -46
- package/dist/components/PropertyPreviewProps.d.ts +0 -50
- package/dist/components/formex.d.ts +0 -40
- package/dist/components/index.d.ts +0 -3
- package/dist/types/fields.d.ts +0 -221
- package/dist/types/rebase.d.ts +0 -180
- package/src/components/EntityFormActionsProps.tsx +0 -18
- package/src/components/EntityFormProps.tsx +0 -52
- package/src/components/PropertyPreviewProps.tsx +0 -61
- package/src/components/formex.tsx +0 -46
- package/src/components/index.ts +0 -3
- package/src/types/fields.tsx +0 -298
- package/src/types/rebase.tsx +0 -211
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { CollectionRegistryController } from "./
|
|
2
|
-
import { Entity, EntityCollection, EntityStatus, EntityValues, FilterValues
|
|
1
|
+
import { CollectionRegistryController } from "./collection_registry";
|
|
2
|
+
import { Entity, EntityCollection, EntityStatus, EntityValues, FilterValues } from "../types";
|
|
3
3
|
import { RebaseContext } from "../rebase_context";
|
|
4
|
+
import { TableMetadata } from "../types/websockets";
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
|
-
* @
|
|
7
|
+
* @internal
|
|
7
8
|
*/
|
|
8
9
|
export interface FetchEntityProps<M extends Record<string, any> = any> {
|
|
9
10
|
path: string;
|
|
@@ -13,7 +14,7 @@ export interface FetchEntityProps<M extends Record<string, any> = any> {
|
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
|
-
* @
|
|
17
|
+
* @internal
|
|
17
18
|
*/
|
|
18
19
|
export type ListenEntityProps<M extends Record<string, any> = any> =
|
|
19
20
|
FetchEntityProps<M>
|
|
@@ -23,7 +24,7 @@ export type ListenEntityProps<M extends Record<string, any> = any> =
|
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
/**
|
|
26
|
-
* @
|
|
27
|
+
* @internal
|
|
27
28
|
*/
|
|
28
29
|
export interface FetchCollectionProps<M extends Record<string, any> = any> {
|
|
29
30
|
path: string;
|
|
@@ -37,7 +38,7 @@ export interface FetchCollectionProps<M extends Record<string, any> = any> {
|
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
/**
|
|
40
|
-
* @
|
|
41
|
+
* @internal
|
|
41
42
|
*/
|
|
42
43
|
export type ListenCollectionProps<M extends Record<string, any> = any> =
|
|
43
44
|
FetchCollectionProps<M> &
|
|
@@ -47,7 +48,7 @@ export type ListenCollectionProps<M extends Record<string, any> = any> =
|
|
|
47
48
|
};
|
|
48
49
|
|
|
49
50
|
/**
|
|
50
|
-
* @
|
|
51
|
+
* @internal
|
|
51
52
|
*/
|
|
52
53
|
export interface SaveEntityProps<M extends Record<string, any> = any> {
|
|
53
54
|
path: string;
|
|
@@ -59,7 +60,7 @@ export interface SaveEntityProps<M extends Record<string, any> = any> {
|
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
/**
|
|
62
|
-
* @
|
|
63
|
+
* @internal
|
|
63
64
|
*/
|
|
64
65
|
export interface DeleteEntityProps<M extends Record<string, any> = any> {
|
|
65
66
|
entity: Entity<M>;
|
|
@@ -75,18 +76,19 @@ export type FilterCombinationValidProps = {
|
|
|
75
76
|
};
|
|
76
77
|
|
|
77
78
|
/**
|
|
78
|
-
*
|
|
79
|
-
*
|
|
79
|
+
* Internal driver interface for communicating with the data layer.
|
|
80
|
+
* This is NOT the public API — use `RebaseData` / `context.data` instead.
|
|
81
|
+
* @internal
|
|
80
82
|
*/
|
|
81
|
-
export interface
|
|
83
|
+
export interface DataDriver {
|
|
82
84
|
|
|
83
85
|
/**
|
|
84
|
-
* Key that identifies this
|
|
86
|
+
* Key that identifies this driver
|
|
85
87
|
*/
|
|
86
88
|
key?: string;
|
|
87
89
|
|
|
88
90
|
/**
|
|
89
|
-
* If the
|
|
91
|
+
* If the driver has been initialised
|
|
90
92
|
*/
|
|
91
93
|
initialised?: boolean;
|
|
92
94
|
|
|
@@ -94,7 +96,6 @@ export interface DataSource {
|
|
|
94
96
|
* Fetch data from a collection
|
|
95
97
|
* @param props
|
|
96
98
|
* @return Promise of entities
|
|
97
|
-
* @see useCollectionFetch if you need this functionality implemented as a hook
|
|
98
99
|
*/
|
|
99
100
|
fetchCollection<M extends Record<string, any> = any>(props: FetchCollectionProps<M>): Promise<Entity<M>[]>;
|
|
100
101
|
|
|
@@ -103,7 +104,6 @@ export interface DataSource {
|
|
|
103
104
|
* `fetchCollection` will be used instead, with no real time updates.
|
|
104
105
|
* @param props
|
|
105
106
|
* @return Function to cancel subscription
|
|
106
|
-
* @see useCollectionFetch if you need this functionality implemented as a hook
|
|
107
107
|
*/
|
|
108
108
|
listenCollection?<M extends Record<string, any> = any>(props: ListenCollectionProps<M>): () => void;
|
|
109
109
|
|
|
@@ -164,7 +164,7 @@ export interface DataSource {
|
|
|
164
164
|
}): boolean;
|
|
165
165
|
|
|
166
166
|
/**
|
|
167
|
-
* Get the object to generate the current time in the
|
|
167
|
+
* Get the object to generate the current time in the driver
|
|
168
168
|
*/
|
|
169
169
|
currentTime?: () => unknown;
|
|
170
170
|
|
|
@@ -181,38 +181,42 @@ export interface DataSource {
|
|
|
181
181
|
}) => Promise<boolean>;
|
|
182
182
|
|
|
183
183
|
/**
|
|
184
|
-
*
|
|
184
|
+
* Flag to indicate if the driver has requested the initialization of the text search index
|
|
185
185
|
*/
|
|
186
|
-
|
|
186
|
+
needsInitTextSearch?: boolean;
|
|
187
|
+
|
|
188
|
+
// ── Admin capabilities ─────────────────────────────────────────────
|
|
189
|
+
//
|
|
190
|
+
// Admin operations are now modelled as capability-specific interfaces
|
|
191
|
+
// (SQLAdmin, DocumentAdmin, SchemaAdmin) in `@rebasepro/types/backend`.
|
|
192
|
+
//
|
|
193
|
+
// Drivers that support admin features should expose them here.
|
|
194
|
+
// Consumers should use the `isSQLAdmin()`, `isSchemaAdmin()` etc.
|
|
195
|
+
// type guards to safely narrow the type before calling methods.
|
|
187
196
|
|
|
188
197
|
/**
|
|
189
|
-
*
|
|
198
|
+
* Return the admin capabilities of this driver.
|
|
199
|
+
* @see SQLAdmin
|
|
200
|
+
* @see DocumentAdmin
|
|
201
|
+
* @see SchemaAdmin
|
|
190
202
|
*/
|
|
203
|
+
admin?: import("../types/backend").DatabaseAdmin;
|
|
204
|
+
|
|
205
|
+
// ── Direct admin methods ────────────────────────────────────────────
|
|
206
|
+
// These convenience methods are kept on the driver interface for
|
|
207
|
+
// simple use cases. For capability-based access, use `driver.admin`
|
|
208
|
+
// with `isSQLAdmin()` / `isSchemaAdmin()` type guards.
|
|
209
|
+
|
|
210
|
+
executeSql?(sql: string, options?: { database?: string; role?: string }): Promise<Record<string, unknown>[]>;
|
|
211
|
+
|
|
191
212
|
fetchAvailableDatabases?(): Promise<string[]>;
|
|
192
213
|
|
|
193
|
-
/**
|
|
194
|
-
* Fetch the available roles (if supported by the datasource)
|
|
195
|
-
*/
|
|
196
214
|
fetchAvailableRoles?(): Promise<string[]>;
|
|
197
215
|
|
|
198
|
-
/**
|
|
199
|
-
* Fetch the current database name (if supported by the datasource)
|
|
200
|
-
*/
|
|
201
216
|
fetchCurrentDatabase?(): Promise<string | undefined>;
|
|
202
217
|
|
|
203
|
-
/**
|
|
204
|
-
* Fetch database tables not yet mapped to a collection (if supported)
|
|
205
|
-
*/
|
|
206
218
|
fetchUnmappedTables?(mappedPaths?: string[]): Promise<string[]>;
|
|
207
219
|
|
|
208
|
-
|
|
209
|
-
* Fetch column metadata for a given table (if supported)
|
|
210
|
-
*/
|
|
211
|
-
fetchTableColumns?(tableName: string): Promise<TableColumnInfo[]>;
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
* Flag to indicate if the datasource delegate has requested the initialization of the text search index
|
|
215
|
-
*/
|
|
216
|
-
needsInitTextSearch?: boolean;
|
|
220
|
+
fetchTableMetadata?(tableName: string): Promise<TableMetadata>;
|
|
217
221
|
|
|
218
222
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module database_admin
|
|
3
|
+
*
|
|
4
|
+
* Re-exports the capability-specific admin interfaces from `@rebasepro/types/backend`.
|
|
5
|
+
* This file is kept for backwards compatibility — new code should import from
|
|
6
|
+
* `@rebasepro/types` directly.
|
|
7
|
+
*
|
|
8
|
+
* @group Admin
|
|
9
|
+
*/
|
|
10
|
+
export type {
|
|
11
|
+
SQLAdmin,
|
|
12
|
+
DocumentAdmin,
|
|
13
|
+
SchemaAdmin,
|
|
14
|
+
DatabaseAdmin,
|
|
15
|
+
HealthCheckResult,
|
|
16
|
+
} from "../types/backend";
|
|
17
|
+
|
|
18
|
+
export {
|
|
19
|
+
isSQLAdmin,
|
|
20
|
+
isDocumentAdmin,
|
|
21
|
+
isSchemaAdmin,
|
|
22
|
+
} from "../types/backend";
|
package/src/controllers/index.ts
CHANGED
|
@@ -1,11 +1,20 @@
|
|
|
1
|
+
export * from "./collection_registry";
|
|
1
2
|
export * from "./analytics_controller";
|
|
2
3
|
export * from "./auth";
|
|
3
|
-
|
|
4
|
-
export * from "./
|
|
5
|
-
export * from "./
|
|
4
|
+
|
|
5
|
+
export * from "./data";
|
|
6
|
+
export * from "./database_admin";
|
|
7
|
+
export * from "./data_driver";
|
|
8
|
+
|
|
6
9
|
export * from "./local_config_persistence";
|
|
7
10
|
export * from "./navigation";
|
|
8
|
-
export * from "./
|
|
11
|
+
export * from "./effective_role";
|
|
12
|
+
|
|
13
|
+
export * from "./storage";
|
|
14
|
+
export * from "./client";
|
|
15
|
+
export * from "./customization_controller";
|
|
9
16
|
export * from "./side_entity_controller";
|
|
17
|
+
export * from "./side_dialogs_controller";
|
|
18
|
+
export * from "./dialogs_controller";
|
|
10
19
|
export * from "./snackbar";
|
|
11
|
-
export * from "./
|
|
20
|
+
export * from "./registry";
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { EntityReference } from "../types/entities";import { EntityCollection } from "../types/collections";
|
|
3
|
+
import { RebasePlugin } from "../types/plugins";
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Controller that handles URL path building and resolution.
|
|
6
7
|
* @group Models
|
|
7
8
|
*/
|
|
8
|
-
export type
|
|
9
|
+
export type UrlController = {
|
|
9
10
|
/**
|
|
10
11
|
* Default path under the navigation routes of the CMS will be created.
|
|
11
12
|
* Defaults to '/'. You may want to change this `basepath` to 'admin' for example.
|
|
@@ -50,7 +51,7 @@ export type CMSUrlController = {
|
|
|
50
51
|
* Build a URL path for the CMS (e.g. for custom views)
|
|
51
52
|
* @param path
|
|
52
53
|
*/
|
|
53
|
-
|
|
54
|
+
buildAppUrlPath: (path: string) => string;
|
|
54
55
|
|
|
55
56
|
/**
|
|
56
57
|
* Turn a path with collection ids into a resolved path.
|
|
@@ -78,13 +79,13 @@ export type NavigationStateController = {
|
|
|
78
79
|
* Custom additional views created by the developer, added to the main
|
|
79
80
|
* navigation
|
|
80
81
|
*/
|
|
81
|
-
views?:
|
|
82
|
+
views?: AppView[];
|
|
82
83
|
|
|
83
84
|
/**
|
|
84
85
|
* Custom additional views created by the developer, added to the admin
|
|
85
86
|
* navigation
|
|
86
87
|
*/
|
|
87
|
-
adminViews?:
|
|
88
|
+
adminViews?: AppView[];
|
|
88
89
|
|
|
89
90
|
/**
|
|
90
91
|
* Configuration for the views that should be displayed at the top
|
|
@@ -112,74 +113,9 @@ export type NavigationStateController = {
|
|
|
112
113
|
/**
|
|
113
114
|
* Plugin system allowing to extend the CMS functionality.
|
|
114
115
|
*/
|
|
115
|
-
plugins?: RebasePlugin
|
|
116
|
+
plugins?: RebasePlugin[];
|
|
116
117
|
};
|
|
117
118
|
|
|
118
|
-
/**
|
|
119
|
-
* Controller that provides access to the registered entity collections.
|
|
120
|
-
* @group Models
|
|
121
|
-
*/
|
|
122
|
-
export type CollectionRegistryController<EC extends EntityCollection = EntityCollection<any>> = {
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* List of the mapped collections in the CMS.
|
|
126
|
-
* Each entry relates to a collection in the root database.
|
|
127
|
-
* Each of the navigation entries in this field
|
|
128
|
-
* generates an entry in the main menu.
|
|
129
|
-
*/
|
|
130
|
-
collections?: EntityCollection[];
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Is the registry ready to be used
|
|
134
|
-
*/
|
|
135
|
-
initialised: boolean;
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* Get the collection configuration for a given path.
|
|
139
|
-
* The collection is resolved from the given path or alias.
|
|
140
|
-
*/
|
|
141
|
-
getCollection: (slugOrPath: string, includeUserOverride?: boolean) => EC | undefined;
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* Get the raw, un-normalized collection configuration.
|
|
145
|
-
* This bypasses the `CollectionRegistry` normalization (such as injecting `relation` instances).
|
|
146
|
-
* This is strictly for the Visual Editor to manipulate AST code without persisting runtime state.
|
|
147
|
-
*/
|
|
148
|
-
getRawCollection: (slugOrPath: string) => EC | undefined;
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* Retrieve all the related parent references for a given path
|
|
154
|
-
* @param path
|
|
155
|
-
*/
|
|
156
|
-
getParentReferencesFromPath: (path: string) => EntityReference[];
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* Retrieve all the related parent collection ids for a given path
|
|
160
|
-
* @param path
|
|
161
|
-
*/
|
|
162
|
-
getParentCollectionIds: (path: string) => string[];
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* Resolve paths from a list of ids
|
|
166
|
-
* @param ids
|
|
167
|
-
*/
|
|
168
|
-
convertIdsToPaths: (ids: string[]) => string[];
|
|
169
|
-
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* Legacy monolithic controller that includes the resolved navigation and utility methods and attributes.
|
|
174
|
-
* It is a combination of CMSUrlController, NavigationStateController, and CollectionRegistryController.
|
|
175
|
-
* @group Models
|
|
176
|
-
* @deprecated Use the specific controllers instead.
|
|
177
|
-
*/
|
|
178
|
-
export type NavigationController<EC extends EntityCollection = EntityCollection<any>> =
|
|
179
|
-
CMSUrlController &
|
|
180
|
-
NavigationStateController &
|
|
181
|
-
CollectionRegistryController<EC>;
|
|
182
|
-
|
|
183
119
|
export interface NavigateOptions {
|
|
184
120
|
replace?: boolean;
|
|
185
121
|
state?: unknown;
|
|
@@ -202,7 +138,7 @@ export type NavigationBlocker = {
|
|
|
202
138
|
* navigation.
|
|
203
139
|
* @group Models
|
|
204
140
|
*/
|
|
205
|
-
export interface
|
|
141
|
+
export interface AppView {
|
|
206
142
|
|
|
207
143
|
/**
|
|
208
144
|
* CMS Path you can reach this view from.
|
|
@@ -299,7 +235,7 @@ export interface NavigationEntry {
|
|
|
299
235
|
slug: string;
|
|
300
236
|
type: "collection" | "view" | "admin";
|
|
301
237
|
collection?: EntityCollection;
|
|
302
|
-
view?:
|
|
238
|
+
view?: AppView;
|
|
303
239
|
description?: string;
|
|
304
240
|
group: string;
|
|
305
241
|
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { EntityCollection, EntityCollectionsBuilder, EntityCustomView, EntityAction } from "../types";
|
|
3
|
+
import { AppView } from "./navigation";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Options to enable the built-in collection editor.
|
|
7
|
+
* When provided to `<RebaseCMS>`, the editor is auto-wired as a native feature.
|
|
8
|
+
*/
|
|
9
|
+
export interface CollectionEditorOptions {
|
|
10
|
+
/**
|
|
11
|
+
* Function that returns an auth token for schema-editor API calls.
|
|
12
|
+
* Falls back to `authController.getAuthToken` when omitted.
|
|
13
|
+
*/
|
|
14
|
+
getAuthToken?: () => Promise<string | null>;
|
|
15
|
+
/** Mark the editor as read-only (disable mutations). */
|
|
16
|
+
readOnly?: boolean;
|
|
17
|
+
/** Suggested base paths shown when creating new collections. */
|
|
18
|
+
pathSuggestions?: string[];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface RebaseCMSConfig<EC extends EntityCollection = any> {
|
|
22
|
+
collections?: EC[] | EntityCollectionsBuilder<EC>;
|
|
23
|
+
homePage?: ReactNode;
|
|
24
|
+
entityViews?: EntityCustomView<any>[];
|
|
25
|
+
entityActions?: EntityAction[];
|
|
26
|
+
plugins?: any[];
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Enable the built-in visual collection/schema editor.
|
|
30
|
+
* Pass `true` for zero-config, or an options object for fine-grained control.
|
|
31
|
+
* When enabled, the editor slots, provider, and Studio schema view
|
|
32
|
+
* are all auto-wired — no plugin or manual view injection needed.
|
|
33
|
+
*/
|
|
34
|
+
collectionEditor?: boolean | CollectionEditorOptions;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface RebaseStudioConfig {
|
|
38
|
+
tools?: ("sql" | "js" | "rls" | "schema" | "storage")[];
|
|
39
|
+
homePage?: ReactNode;
|
|
40
|
+
devViews?: AppView[];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface RebaseAuthConfig {
|
|
44
|
+
loginView?: ReactNode;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface RebaseRegistryController {
|
|
48
|
+
// Current state
|
|
49
|
+
cmsConfig: RebaseCMSConfig | null;
|
|
50
|
+
studioConfig: RebaseStudioConfig | null;
|
|
51
|
+
authConfig: RebaseAuthConfig | null;
|
|
52
|
+
|
|
53
|
+
// Registration functions
|
|
54
|
+
registerCMS: (config: RebaseCMSConfig) => void;
|
|
55
|
+
unregisterCMS: () => void;
|
|
56
|
+
|
|
57
|
+
registerStudio: (config: RebaseStudioConfig) => void;
|
|
58
|
+
unregisterStudio: () => void;
|
|
59
|
+
|
|
60
|
+
registerAuth: (config: RebaseAuthConfig) => void;
|
|
61
|
+
unregisterAuth: () => void;
|
|
62
|
+
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Entity, EntityCollection } from "../types";
|
|
2
|
-
import { EntityFormProps } from "../components";
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* Props used to open a side dialog
|
|
@@ -67,7 +66,7 @@ export interface EntitySidePanelProps<M extends Record<string, any> = any> {
|
|
|
67
66
|
/**
|
|
68
67
|
* Override some form properties
|
|
69
68
|
*/
|
|
70
|
-
formProps?:
|
|
69
|
+
formProps?: any;
|
|
71
70
|
|
|
72
71
|
/**
|
|
73
72
|
* Allow the user to open the entity fullscreen
|
package/src/index.ts
CHANGED
package/src/rebase_context.tsx
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AnalyticsController,
|
|
3
3
|
AuthController,
|
|
4
|
-
CustomizationController,
|
|
5
|
-
DataSource,
|
|
6
|
-
DialogsController,
|
|
7
|
-
NavigationController,
|
|
8
|
-
SideDialogsController,
|
|
9
|
-
SideEntityController,
|
|
10
|
-
SnackbarController,
|
|
11
4
|
StorageSource,
|
|
12
|
-
UserConfigurationPersistence
|
|
5
|
+
UserConfigurationPersistence,
|
|
6
|
+
DatabaseAdmin
|
|
13
7
|
} from "./controllers";
|
|
8
|
+
|
|
9
|
+
import { RebaseData } from "./controllers/data";
|
|
14
10
|
import { User } from "./users";
|
|
15
|
-
import { UserManagementDelegate
|
|
11
|
+
import { UserManagementDelegate } from "./types/user_management_delegate";
|
|
12
|
+
|
|
16
13
|
|
|
17
14
|
/**
|
|
18
15
|
* Context that is provided to entity callbacks (hooks).
|
|
@@ -22,9 +19,10 @@ import { UserManagementDelegate, EffectiveRoleController } from "./types";
|
|
|
22
19
|
export type RebaseCallContext<USER extends User = User> = {
|
|
23
20
|
|
|
24
21
|
/**
|
|
25
|
-
*
|
|
22
|
+
* Unified data access — `context.data.products.create(...)`.
|
|
23
|
+
* Access any collection as a dynamic property.
|
|
26
24
|
*/
|
|
27
|
-
|
|
25
|
+
data: RebaseData;
|
|
28
26
|
|
|
29
27
|
/**
|
|
30
28
|
* Used storage implementation
|
|
@@ -46,47 +44,47 @@ export type RebaseCallContext<USER extends User = User> = {
|
|
|
46
44
|
*/
|
|
47
45
|
export type RebaseContext<USER extends User = User, AuthControllerType extends AuthController<USER> = AuthController<USER>> = RebaseCallContext<USER> & {
|
|
48
46
|
|
|
47
|
+
authController: AuthControllerType;
|
|
48
|
+
|
|
49
49
|
/**
|
|
50
|
-
*
|
|
51
|
-
* attributes.
|
|
52
|
-
* @see useNavigation
|
|
50
|
+
* Controller mapping strings to collections
|
|
53
51
|
*/
|
|
54
|
-
|
|
52
|
+
collectionRegistryController?: import("./controllers/collection_registry").CollectionRegistryController;
|
|
55
53
|
|
|
56
54
|
/**
|
|
57
|
-
* Controller
|
|
58
|
-
* @see useSideEntityController
|
|
55
|
+
* Controller for navigation state
|
|
59
56
|
*/
|
|
60
|
-
|
|
57
|
+
navigationStateController?: import("./controllers/navigation").NavigationStateController;
|
|
61
58
|
|
|
62
59
|
/**
|
|
63
|
-
* Controller
|
|
64
|
-
* This is the controller used internally by side entity dialogs
|
|
65
|
-
* or reference dialogs.
|
|
60
|
+
* Controller for side dialogs (side sheets)
|
|
66
61
|
*/
|
|
67
|
-
sideDialogsController?: SideDialogsController;
|
|
62
|
+
sideDialogsController?: import("./controllers/side_dialogs_controller").SideDialogsController;
|
|
68
63
|
|
|
69
64
|
/**
|
|
70
|
-
* Controller
|
|
65
|
+
* Controller to open the side dialog displaying entity forms
|
|
71
66
|
*/
|
|
72
|
-
|
|
67
|
+
sideEntityController?: import("./controllers/side_entity_controller").SideEntityController;
|
|
73
68
|
|
|
74
69
|
/**
|
|
75
|
-
*
|
|
70
|
+
* Controller resolving URLs in the CMS
|
|
76
71
|
*/
|
|
77
|
-
|
|
78
|
-
|
|
72
|
+
urlController?: import("./controllers/navigation").UrlController;
|
|
79
73
|
|
|
74
|
+
/**
|
|
75
|
+
* Controller to handle simple confirmation and alert dialogs
|
|
76
|
+
*/
|
|
77
|
+
dialogsController?: import("./controllers/dialogs_controller").DialogsController;
|
|
80
78
|
|
|
81
79
|
/**
|
|
82
|
-
*
|
|
80
|
+
* Controller for CMS customization
|
|
83
81
|
*/
|
|
84
|
-
customizationController?: CustomizationController;
|
|
82
|
+
customizationController?: import("./controllers/customization_controller").CustomizationController;
|
|
85
83
|
|
|
86
84
|
/**
|
|
87
|
-
*
|
|
85
|
+
* Controller for effective role
|
|
88
86
|
*/
|
|
89
|
-
|
|
87
|
+
effectiveRoleController?: { effectiveRole: string | null, setEffectiveRole: (role: string | null) => void };
|
|
90
88
|
|
|
91
89
|
/**
|
|
92
90
|
* Use this controller to access data stored in the browser for the user
|
|
@@ -115,8 +113,14 @@ export type RebaseContext<USER extends User = User, AuthControllerType extends A
|
|
|
115
113
|
userManagement?: UserManagementDelegate<USER>;
|
|
116
114
|
|
|
117
115
|
/**
|
|
118
|
-
*
|
|
116
|
+
* Administrative database operations (SQL, schema discovery).
|
|
117
|
+
* Only available in developer/admin contexts.
|
|
118
|
+
*/
|
|
119
|
+
databaseAdmin?: DatabaseAdmin;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Controller for snackbars
|
|
119
123
|
*/
|
|
120
|
-
|
|
124
|
+
snackbarController?: import("./controllers/snackbar").SnackbarController;
|
|
121
125
|
|
|
122
126
|
};
|