@rebasepro/plugin-data-enhancement 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +70 -78
- package/dist/admin/src/collection_editor/ui/collection_editor/PropertyEditView.d.ts +1 -0
- package/dist/admin/src/collection_editor/ui/collection_editor/templates/blog_template.d.ts +1 -1
- package/dist/admin/src/collection_editor/ui/collection_editor/templates/pages_template.d.ts +1 -1
- package/dist/admin/src/collection_editor/ui/collection_editor/templates/products_template.d.ts +1 -1
- package/dist/admin/src/collection_editor/ui/collection_editor/templates/users_template.d.ts +1 -1
- package/dist/admin/src/components/CollectionPanel.d.ts +83 -0
- package/dist/admin/src/components/EntityDetailView.d.ts +0 -3
- package/dist/admin/src/components/EntityEditView.d.ts +2 -3
- package/dist/admin/src/components/RebaseRouteDefs.d.ts +1 -1
- package/dist/admin/src/components/SelectableTable/SelectableTable.d.ts +2 -2
- package/dist/admin/src/components/SelectableTable/SelectableTableContext.d.ts +1 -1
- package/dist/admin/src/components/SelectableTable/SelectionStore.d.ts +3 -3
- package/dist/admin/src/components/index.d.ts +1 -0
- package/dist/admin/src/hooks/navigation/useBuildNavigationStateController.d.ts +1 -1
- package/dist/admin/src/hooks/navigation/useResolvedViews.d.ts +2 -5
- package/dist/admin/src/index.d.ts +2 -4
- package/dist/admin/src/util/entity_view_constants.d.ts +6 -0
- package/dist/admin/src/util/resolutions.d.ts +1 -2
- package/dist/common/src/collections/default-collections.d.ts +5 -8
- package/dist/common/src/data/query_builder.d.ts +6 -2
- package/dist/common/src/util/permissions.d.ts +14 -6
- package/dist/core/src/components/LoginView/LoginView.d.ts +9 -1
- package/dist/core/src/components/common/types.d.ts +3 -3
- package/dist/core/src/hooks/data/useCollectionFetch.d.ts +12 -1
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/plugin-data-enhancement/src/components/DataEnhancementControllerProvider.d.ts +3 -3
- package/dist/plugin-data-enhancement/src/components/FormEnhanceAction.d.ts +0 -8
- package/dist/types/src/controllers/auth.d.ts +2 -2
- package/dist/types/src/controllers/client.d.ts +25 -40
- package/dist/types/src/controllers/data.d.ts +21 -3
- package/dist/types/src/controllers/data_driver.d.ts +5 -0
- package/dist/types/src/controllers/email.d.ts +2 -0
- package/dist/types/src/types/auth_adapter.d.ts +3 -56
- package/dist/types/src/types/backend.d.ts +38 -3
- package/dist/types/src/types/backend_hooks.d.ts +2 -17
- package/dist/types/src/types/collections.d.ts +30 -6
- package/dist/types/src/types/entity_views.d.ts +19 -28
- package/dist/types/src/types/properties.d.ts +9 -15
- package/dist/types/src/types/user_management_delegate.d.ts +16 -53
- package/dist/types/src/users/index.d.ts +0 -1
- package/dist/types/src/users/user.d.ts +0 -1
- package/dist/ui/src/components/Card.d.ts +2 -3
- package/dist/ui/src/components/FilterChip.d.ts +2 -10
- package/dist/ui/src/components/VirtualTable/VirtualTableProps.d.ts +8 -2
- package/package.json +7 -7
- package/src/components/DataEnhancementControllerProvider.tsx +2 -2
- package/src/components/FormEnhanceAction.tsx +0 -9
- package/dist/admin/src/components/admin/RoleChip.d.ts +0 -4
- package/dist/admin/src/components/admin/RolesFilterSelect.d.ts +0 -2
- package/dist/admin/src/components/admin/RolesView.d.ts +0 -4
- package/dist/admin/src/components/admin/UserRolesSelectField.d.ts +0 -2
- package/dist/plugin-data-enhancement/src/locales/de.d.ts +0 -21
- package/dist/plugin-data-enhancement/src/locales/en.d.ts +0 -21
- package/dist/plugin-data-enhancement/src/locales/es.d.ts +0 -21
- package/dist/plugin-data-enhancement/src/locales/fr.d.ts +0 -21
- package/dist/plugin-data-enhancement/src/locales/hi.d.ts +0 -21
- package/dist/plugin-data-enhancement/src/locales/it.d.ts +0 -21
- package/dist/plugin-data-enhancement/src/locales/pt.d.ts +0 -21
- package/dist/types/src/users/roles.d.ts +0 -14
- package/src/locales/de.ts +0 -21
- package/src/locales/en.ts +0 -21
- package/src/locales/es.ts +0 -21
- package/src/locales/fr.ts +0 -21
- package/src/locales/hi.ts +0 -21
- package/src/locales/it.ts +0 -21
- package/src/locales/pt.ts +0 -21
|
@@ -148,38 +148,6 @@ export interface AuthCreateUserData {
|
|
|
148
148
|
photoUrl?: string;
|
|
149
149
|
metadata?: Record<string, unknown>;
|
|
150
150
|
}
|
|
151
|
-
/**
|
|
152
|
-
* Role data exposed by the auth adapter.
|
|
153
|
-
* @group Auth
|
|
154
|
-
*/
|
|
155
|
-
export interface AuthRoleData {
|
|
156
|
-
id: string;
|
|
157
|
-
name: string;
|
|
158
|
-
isAdmin: boolean;
|
|
159
|
-
defaultPermissions?: {
|
|
160
|
-
read?: boolean;
|
|
161
|
-
create?: boolean;
|
|
162
|
-
edit?: boolean;
|
|
163
|
-
delete?: boolean;
|
|
164
|
-
} | null;
|
|
165
|
-
collectionPermissions?: Record<string, {
|
|
166
|
-
read?: boolean;
|
|
167
|
-
create?: boolean;
|
|
168
|
-
edit?: boolean;
|
|
169
|
-
delete?: boolean;
|
|
170
|
-
}> | null;
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Data for creating a role.
|
|
174
|
-
* @group Auth
|
|
175
|
-
*/
|
|
176
|
-
export interface AuthCreateRoleData {
|
|
177
|
-
id: string;
|
|
178
|
-
name: string;
|
|
179
|
-
isAdmin?: boolean;
|
|
180
|
-
defaultPermissions?: AuthRoleData["defaultPermissions"];
|
|
181
|
-
collectionPermissions?: AuthRoleData["collectionPermissions"];
|
|
182
|
-
}
|
|
183
151
|
/**
|
|
184
152
|
* User management operations for the admin panel.
|
|
185
153
|
*
|
|
@@ -193,23 +161,9 @@ export interface UserManagementAdapter {
|
|
|
193
161
|
createUser(data: AuthCreateUserData): Promise<AuthUserData>;
|
|
194
162
|
updateUser(id: string, data: Partial<AuthCreateUserData>): Promise<AuthUserData | null>;
|
|
195
163
|
deleteUser(id: string): Promise<void>;
|
|
196
|
-
getUserRoles(userId: string): Promise<
|
|
164
|
+
getUserRoles(userId: string): Promise<string[]>;
|
|
197
165
|
setUserRoles(userId: string, roleIds: string[]): Promise<void>;
|
|
198
166
|
}
|
|
199
|
-
/**
|
|
200
|
-
* Role management operations for the admin panel.
|
|
201
|
-
*
|
|
202
|
-
* Optional — if not provided by the adapter, role management is disabled.
|
|
203
|
-
*
|
|
204
|
-
* @group Auth
|
|
205
|
-
*/
|
|
206
|
-
export interface RoleManagementAdapter {
|
|
207
|
-
listRoles(): Promise<AuthRoleData[]>;
|
|
208
|
-
getRoleById(id: string): Promise<AuthRoleData | null>;
|
|
209
|
-
createRole(data: AuthCreateRoleData): Promise<AuthRoleData>;
|
|
210
|
-
updateRole(id: string, data: Partial<AuthRoleData>): Promise<AuthRoleData | null>;
|
|
211
|
-
deleteRole(id: string): Promise<void>;
|
|
212
|
-
}
|
|
213
167
|
/**
|
|
214
168
|
* Pluggable authentication adapter for Rebase.
|
|
215
169
|
*
|
|
@@ -217,7 +171,7 @@ export interface RoleManagementAdapter {
|
|
|
217
171
|
* database layer. Each auth adapter knows how to:
|
|
218
172
|
*
|
|
219
173
|
* 1. Verify incoming HTTP requests (`verifyRequest`)
|
|
220
|
-
* 2. Optionally manage users
|
|
174
|
+
* 2. Optionally manage users (for the admin panel)
|
|
221
175
|
* 3. Optionally mount auth-specific routes (login, register, etc.)
|
|
222
176
|
* 4. Advertise its capabilities so the frontend can adapt
|
|
223
177
|
*
|
|
@@ -269,11 +223,6 @@ export interface AuthAdapter {
|
|
|
269
223
|
* Optional — if not provided, user management UI is hidden.
|
|
270
224
|
*/
|
|
271
225
|
userManagement?: UserManagementAdapter;
|
|
272
|
-
/**
|
|
273
|
-
* Role CRUD for the admin panel.
|
|
274
|
-
* Optional — if not provided, role management is disabled.
|
|
275
|
-
*/
|
|
276
|
-
roleManagement?: RoleManagementAdapter;
|
|
277
226
|
/**
|
|
278
227
|
* Mount adapter-specific auth routes (login, register, refresh, etc.).
|
|
279
228
|
*
|
|
@@ -289,7 +238,7 @@ export interface AuthAdapter {
|
|
|
289
238
|
*/
|
|
290
239
|
createAuthRoutes?(): Hono<any, any, any> | undefined;
|
|
291
240
|
/**
|
|
292
|
-
* Mount admin routes for user
|
|
241
|
+
* Mount admin routes for user management.
|
|
293
242
|
*
|
|
294
243
|
* Same typing rationale as `createAuthRoutes` — the sub-app env is
|
|
295
244
|
* unconstrained to support arbitrary adapter implementations.
|
|
@@ -345,8 +294,6 @@ export interface CustomAuthAdapterOptions {
|
|
|
345
294
|
verifyToken?: (token: string) => Promise<AuthenticatedUser | null>;
|
|
346
295
|
/** Optional user management for the admin panel. */
|
|
347
296
|
userManagement?: UserManagementAdapter;
|
|
348
|
-
/** Optional role management for the admin panel. */
|
|
349
|
-
roleManagement?: RoleManagementAdapter;
|
|
350
297
|
/** Static service key for server-to-server auth. */
|
|
351
298
|
serviceKey?: string;
|
|
352
299
|
/** Override default capabilities. */
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Entity } from "./entities";
|
|
2
2
|
import type { EntityCollection, FilterValues, WhereFilterOp } from "./collections";
|
|
3
|
+
import type { AuthAdapter } from "./auth_adapter";
|
|
3
4
|
/**
|
|
4
5
|
* Abstract database connection interface.
|
|
5
6
|
* Represents a connection to any database system.
|
|
@@ -182,6 +183,24 @@ export interface RealtimeProvider {
|
|
|
182
183
|
* Notify all relevant subscribers of an entity update
|
|
183
184
|
*/
|
|
184
185
|
notifyEntityUpdate(path: string, entityId: string, entity: Entity | null, databaseId?: string): Promise<void>;
|
|
186
|
+
/**
|
|
187
|
+
* Called when the HTTP server is ready and listening.
|
|
188
|
+
* Useful for providers that need the server address for callbacks.
|
|
189
|
+
*/
|
|
190
|
+
onServerReady?(serverInfo: {
|
|
191
|
+
port: number;
|
|
192
|
+
hostname?: string;
|
|
193
|
+
}): void;
|
|
194
|
+
/**
|
|
195
|
+
* Gracefully shut down the realtime provider.
|
|
196
|
+
* Called during server shutdown to clean up resources.
|
|
197
|
+
*/
|
|
198
|
+
destroy?(): Promise<void>;
|
|
199
|
+
/**
|
|
200
|
+
* Stop the internal LISTEN client (e.g., PostgreSQL LISTEN/NOTIFY).
|
|
201
|
+
* Called during graceful shutdown before closing database connections.
|
|
202
|
+
*/
|
|
203
|
+
stopListening?(): Promise<void>;
|
|
185
204
|
}
|
|
186
205
|
/**
|
|
187
206
|
* Abstract collection registry interface.
|
|
@@ -464,6 +483,22 @@ export interface BackendBootstrapper {
|
|
|
464
483
|
* (e.g., `"postgres"`, `"mongodb"`, `"mysql"`).
|
|
465
484
|
*/
|
|
466
485
|
type: string;
|
|
486
|
+
/**
|
|
487
|
+
* Unique identifier for this bootstrapper instance.
|
|
488
|
+
* Used to register the driver in the driver registry.
|
|
489
|
+
* Defaults to `type` if not set.
|
|
490
|
+
*/
|
|
491
|
+
id?: string;
|
|
492
|
+
/**
|
|
493
|
+
* Whether this bootstrapper provides the default driver.
|
|
494
|
+
* When true, the coordinator uses this driver as the primary one.
|
|
495
|
+
*/
|
|
496
|
+
isDefault?: boolean;
|
|
497
|
+
/**
|
|
498
|
+
* Run database migrations for this driver.
|
|
499
|
+
* Called by the coordinator after all drivers are initialized.
|
|
500
|
+
*/
|
|
501
|
+
runMigrations?(config: unknown, driverResult: InitializedDriver): Promise<void>;
|
|
467
502
|
/**
|
|
468
503
|
* Create a DataDriver from the given config.
|
|
469
504
|
* This is the only **required** method.
|
|
@@ -498,7 +533,7 @@ export interface BackendBootstrapper {
|
|
|
498
533
|
/**
|
|
499
534
|
* Initialize WebSocket server for realtime operations.
|
|
500
535
|
*/
|
|
501
|
-
initializeWebsockets?(server: unknown, realtimeService: RealtimeProvider, driver: import("../controllers/data_driver").DataDriver, config?: unknown): Promise<void> | void;
|
|
536
|
+
initializeWebsockets?(server: unknown, realtimeService: RealtimeProvider, driver: import("../controllers/data_driver").DataDriver, config?: unknown, authAdapter?: AuthAdapter): Promise<void> | void;
|
|
502
537
|
}
|
|
503
538
|
/**
|
|
504
539
|
* Result of `BackendBootstrapper.initializeDriver()`.
|
|
@@ -527,8 +562,8 @@ export interface InitializedDriver {
|
|
|
527
562
|
export interface BootstrappedAuth {
|
|
528
563
|
/** User management service. */
|
|
529
564
|
userService: unknown;
|
|
530
|
-
/** Role management service. */
|
|
531
|
-
roleService
|
|
565
|
+
/** Role management service (optional, roles are now simple strings). */
|
|
566
|
+
roleService?: unknown;
|
|
532
567
|
/** Email service (optional). */
|
|
533
568
|
emailService?: unknown;
|
|
534
569
|
/** Combined Auth Repository for unified token and user management. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AdminUser
|
|
1
|
+
import type { AdminUser } from "../controllers/client";
|
|
2
2
|
/**
|
|
3
3
|
* Context passed to every backend hook.
|
|
4
4
|
* Provides information about the request that triggered the hook.
|
|
@@ -64,19 +64,6 @@ export interface UserHooks {
|
|
|
64
64
|
*/
|
|
65
65
|
afterDelete?(userId: string, context: BackendHookContext): void | Promise<void>;
|
|
66
66
|
}
|
|
67
|
-
/**
|
|
68
|
-
* Hooks for intercepting Admin Role data at the API boundary.
|
|
69
|
-
* @group Backend Hooks
|
|
70
|
-
*/
|
|
71
|
-
export interface RoleHooks {
|
|
72
|
-
/**
|
|
73
|
-
* Transform a role record after it's read from the database,
|
|
74
|
-
* before it's returned to the client.
|
|
75
|
-
*
|
|
76
|
-
* Return the modified role, or `null` to filter it out entirely.
|
|
77
|
-
*/
|
|
78
|
-
afterRead?(role: AdminRole, context: BackendHookContext): AdminRole | null | Promise<AdminRole | null>;
|
|
79
|
-
}
|
|
80
67
|
/**
|
|
81
68
|
* Hooks for intercepting collection entity data at the REST API boundary.
|
|
82
69
|
*
|
|
@@ -146,7 +133,7 @@ export interface DataHooks {
|
|
|
146
133
|
* These hooks run server-side after database operations complete and before
|
|
147
134
|
* API responses are sent.
|
|
148
135
|
*
|
|
149
|
-
* - `users`
|
|
136
|
+
* - `users` — intercept admin user management endpoints
|
|
150
137
|
* - `data` — intercept ALL collection entity data flowing through the REST API
|
|
151
138
|
*
|
|
152
139
|
* `data` hooks complement per-collection `EntityCallbacks`. Entity callbacks
|
|
@@ -180,8 +167,6 @@ export interface DataHooks {
|
|
|
180
167
|
export interface BackendHooks {
|
|
181
168
|
/** Hooks for intercepting user management data */
|
|
182
169
|
users?: UserHooks;
|
|
183
|
-
/** Hooks for intercepting role management data */
|
|
184
|
-
roles?: RoleHooks;
|
|
185
170
|
/** Hooks for intercepting ALL collection entity data via the REST API */
|
|
186
171
|
data?: DataHooks;
|
|
187
172
|
}
|
|
@@ -7,7 +7,7 @@ import type { EntityOverrides } from "./entity_overrides";
|
|
|
7
7
|
import type { User } from "../users";
|
|
8
8
|
import type { RebaseContext } from "../rebase_context";
|
|
9
9
|
import type { Relation } from "./relations";
|
|
10
|
-
import type { EntityCustomView,
|
|
10
|
+
import type { EntityCustomView, FormViewConfig } from "./entity_views";
|
|
11
11
|
import type { EntityAction } from "./entity_actions";
|
|
12
12
|
import type { ComponentRef } from "./component_ref";
|
|
13
13
|
/**
|
|
@@ -124,10 +124,14 @@ export interface BaseEntityCollection<M extends Record<string, unknown> = Record
|
|
|
124
124
|
*/
|
|
125
125
|
defaultEntityAction?: "view" | "edit";
|
|
126
126
|
/**
|
|
127
|
-
*
|
|
128
|
-
*
|
|
127
|
+
* Replace the default entity form with a custom component.
|
|
128
|
+
* The Builder receives the same props as entity view tabs
|
|
129
|
+
* (entity, formContext, collection, etc.) and has full control over the UI.
|
|
130
|
+
*
|
|
131
|
+
* Works in both edit mode and read-only mode (when `defaultEntityAction`
|
|
132
|
+
* is `"view"`). In read-only mode, `formContext.readOnly` will be `true`.
|
|
129
133
|
*/
|
|
130
|
-
|
|
134
|
+
formView?: FormViewConfig;
|
|
131
135
|
/**
|
|
132
136
|
* Prevent default actions from being displayed or executed on this collection.
|
|
133
137
|
*/
|
|
@@ -339,6 +343,23 @@ export interface BaseEntityCollection<M extends Record<string, unknown> = Record
|
|
|
339
343
|
* Builder for the collection actions rendered in the toolbar
|
|
340
344
|
*/
|
|
341
345
|
Actions?: ComponentRef<CollectionActionsProps>[];
|
|
346
|
+
/**
|
|
347
|
+
* The database table name for this collection.
|
|
348
|
+
* Automatically set for PostgreSQL collections.
|
|
349
|
+
* For non-SQL backends, this may be undefined.
|
|
350
|
+
*/
|
|
351
|
+
table?: string;
|
|
352
|
+
/**
|
|
353
|
+
* Relations defined for this collection.
|
|
354
|
+
* Populated at normalization time from inline relation properties
|
|
355
|
+
* or explicit relation definitions.
|
|
356
|
+
*/
|
|
357
|
+
relations?: Relation[];
|
|
358
|
+
/**
|
|
359
|
+
* Security rules for this collection (Row Level Security).
|
|
360
|
+
* When defined, the backend enforces access control policies.
|
|
361
|
+
*/
|
|
362
|
+
securityRules?: SecurityRule[];
|
|
342
363
|
}
|
|
343
364
|
/**
|
|
344
365
|
* A collection backed by PostgreSQL (or any SQL database).
|
|
@@ -432,7 +453,10 @@ export interface MongoDBCollection<M extends Record<string, unknown> = Record<st
|
|
|
432
453
|
* @group Models
|
|
433
454
|
*/
|
|
434
455
|
export type EntityCollection<M extends Record<string, unknown> = Record<string, unknown>, USER extends User = User> = PostgresCollection<M, USER> | FirebaseCollection<M, USER> | MongoDBCollection<M, USER>;
|
|
435
|
-
/**
|
|
456
|
+
/**
|
|
457
|
+
* An EntityCollection that supports SQL-style relations (e.g. Postgres).
|
|
458
|
+
* @deprecated Use `EntityCollection` directly — `table`, `relations`, and `securityRules` are now on `BaseEntityCollection`.
|
|
459
|
+
*/
|
|
436
460
|
export type CollectionWithRelations<M extends Record<string, unknown> = Record<string, unknown>> = EntityCollection<M> & {
|
|
437
461
|
table?: string;
|
|
438
462
|
relations?: Relation[];
|
|
@@ -566,7 +590,7 @@ export type WhereFilterOp = "<" | "<=" | "==" | "!=" | ">=" | ">" | "array-conta
|
|
|
566
590
|
*
|
|
567
591
|
* @group Models
|
|
568
592
|
*/
|
|
569
|
-
export type FilterValues<Key extends string> = Partial<Record<Key, [WhereFilterOp, unknown]>>;
|
|
593
|
+
export type FilterValues<Key extends string> = Partial<Record<Key, [WhereFilterOp, unknown] | [WhereFilterOp, unknown][]>>;
|
|
570
594
|
/**
|
|
571
595
|
* A pre-defined filter preset for quick access in the collection toolbar.
|
|
572
596
|
* Users can select a preset to instantly apply a set of filters and
|
|
@@ -56,41 +56,32 @@ export type EntityCustomView<M extends Record<string, unknown> = Record<string,
|
|
|
56
56
|
Builder?: ComponentRef<EntityCustomViewParams<M>>;
|
|
57
57
|
position?: "start" | "end";
|
|
58
58
|
};
|
|
59
|
-
export interface EntityCustomViewParams<M extends Record<string, unknown> = Record<string, unknown>> {
|
|
60
|
-
collection: EntityCollection<M>;
|
|
61
|
-
entity?: Entity<M>;
|
|
62
|
-
modifiedValues?: EntityValues<M>;
|
|
63
|
-
formContext: FormContext<M>;
|
|
64
|
-
parentCollectionSlugs?: string[];
|
|
65
|
-
parentEntityIds?: string[];
|
|
66
|
-
}
|
|
67
59
|
/**
|
|
68
|
-
* Configuration
|
|
69
|
-
*
|
|
60
|
+
* Configuration to replace the default entity form with a custom component.
|
|
61
|
+
* The Builder receives the same props as entity view tabs (entity, formContext, etc.)
|
|
62
|
+
* and has full control over the UI.
|
|
63
|
+
*
|
|
64
|
+
* The form tab still appears in the tab bar but renders your Builder
|
|
65
|
+
* instead of the auto-generated field form.
|
|
66
|
+
*
|
|
70
67
|
* @group Models
|
|
71
68
|
*/
|
|
72
|
-
export type
|
|
73
|
-
/**
|
|
74
|
-
* Custom component rendered above the property display in the detail view.
|
|
75
|
-
*/
|
|
76
|
-
Header?: ComponentRef<EntityDetailViewParams<M>>;
|
|
69
|
+
export type FormViewConfig<M extends Record<string, unknown> = Record<string, unknown>> = {
|
|
77
70
|
/**
|
|
78
|
-
* Custom component
|
|
71
|
+
* Custom component that replaces the default form.
|
|
79
72
|
*/
|
|
80
|
-
|
|
73
|
+
Builder: ComponentRef<EntityCustomViewParams<M>>;
|
|
81
74
|
/**
|
|
82
|
-
*
|
|
83
|
-
*
|
|
75
|
+
* If true, the save/delete action bar is rendered alongside the custom view.
|
|
76
|
+
* Defaults to true.
|
|
84
77
|
*/
|
|
85
|
-
|
|
78
|
+
includeActions?: boolean;
|
|
86
79
|
};
|
|
87
|
-
|
|
88
|
-
* Props passed to detail view customization components (Header, Footer, Builder).
|
|
89
|
-
* @group Models
|
|
90
|
-
*/
|
|
91
|
-
export interface EntityDetailViewParams<M extends Record<string, unknown> = Record<string, unknown>> {
|
|
80
|
+
export interface EntityCustomViewParams<M extends Record<string, unknown> = Record<string, unknown>> {
|
|
92
81
|
collection: EntityCollection<M>;
|
|
93
|
-
entity
|
|
94
|
-
|
|
95
|
-
|
|
82
|
+
entity?: Entity<M>;
|
|
83
|
+
modifiedValues?: EntityValues<M>;
|
|
84
|
+
formContext: FormContext<M>;
|
|
85
|
+
parentCollectionSlugs?: string[];
|
|
86
|
+
parentEntityIds?: string[];
|
|
96
87
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ComponentRef } from "./component_ref";
|
|
2
|
-
import type { EntityReference, EntityRelation, EntityValues, GeoPoint,
|
|
3
|
-
import type {
|
|
2
|
+
import type { Entity, EntityReference, EntityRelation, EntityValues, GeoPoint, Vector } from "./entities";
|
|
3
|
+
import type { JoinStep, OnAction, Relation } from "./relations";
|
|
4
4
|
import type { EntityCollection, FilterValues } from "./collections";
|
|
5
5
|
import type { ColorKey, ColorScheme } from "./chips";
|
|
6
6
|
import type { AuthController } from "../controllers/auth";
|
|
@@ -104,8 +104,8 @@ export interface BaseUIConfig<CustomProps = unknown> {
|
|
|
104
104
|
disabled?: boolean | PropertyDisabledConfig;
|
|
105
105
|
widthPercentage?: number;
|
|
106
106
|
customProps?: CustomProps;
|
|
107
|
-
Field?: ComponentRef
|
|
108
|
-
Preview?: ComponentRef
|
|
107
|
+
Field?: ComponentRef<any>;
|
|
108
|
+
Preview?: ComponentRef<any>;
|
|
109
109
|
}
|
|
110
110
|
export interface BaseProperty<CustomProps = unknown> {
|
|
111
111
|
ui?: BaseUIConfig<CustomProps>;
|
|
@@ -185,7 +185,7 @@ export interface StringProperty extends BaseProperty {
|
|
|
185
185
|
* Optional database column type. If not set, it defaults to `varchar` or `uuid` depending on `isId` configuration.
|
|
186
186
|
* Use `text` for strings with unbound length, `char` for fixed-length strings, or `varchar` for variable-length strings with a limit.
|
|
187
187
|
*/
|
|
188
|
-
columnType?: "varchar" | "text" | "char";
|
|
188
|
+
columnType?: "varchar" | "text" | "char" | "uuid";
|
|
189
189
|
/**
|
|
190
190
|
* Rules for validating this property
|
|
191
191
|
*/
|
|
@@ -541,9 +541,11 @@ export interface ArrayProperty extends BaseProperty {
|
|
|
541
541
|
ui?: ArrayUIConfig;
|
|
542
542
|
type: "array";
|
|
543
543
|
/**
|
|
544
|
-
* Optional database column type.
|
|
544
|
+
* Optional database column type. By default, maps to a native Postgres array
|
|
545
|
+
* (e.g. `text[]`, `integer[]`/`numeric[]`, `boolean[]`) if the element type
|
|
546
|
+
* is a primitive, otherwise defaults to `jsonb`.
|
|
545
547
|
*/
|
|
546
|
-
columnType?: "json" | "jsonb";
|
|
548
|
+
columnType?: "json" | "jsonb" | "text[]" | "integer[]" | "boolean[]" | "numeric[]";
|
|
547
549
|
/**
|
|
548
550
|
* The property of this array.
|
|
549
551
|
* You can specify any property (except another Array property)
|
|
@@ -639,14 +641,6 @@ export interface MapProperty extends BaseProperty {
|
|
|
639
641
|
* Properties that are displayed when rendered as a preview
|
|
640
642
|
*/
|
|
641
643
|
previewProperties?: string[];
|
|
642
|
-
/**
|
|
643
|
-
* Allow the user to add only some keys in this map.
|
|
644
|
-
* By default, all properties of the map have the corresponding field in
|
|
645
|
-
* the form view. Setting this flag to true allows to pick only some.
|
|
646
|
-
* Useful for map that can have a lot of sub-properties that may not be
|
|
647
|
-
* needed
|
|
648
|
-
*/
|
|
649
|
-
pickOnlySomeKeys?: boolean;
|
|
650
644
|
/**
|
|
651
645
|
* Render this map as a key-value table that allows to use
|
|
652
646
|
* arbitrary keys. You don't need to define the properties in this case.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { User } from "../users";
|
|
2
2
|
/**
|
|
3
3
|
* Result of creating a new user via admin flow.
|
|
4
4
|
* Contains the created user plus information about how credentials were delivered.
|
|
@@ -15,56 +15,46 @@ export interface UserCreationResult<USER extends User = User> {
|
|
|
15
15
|
temporaryPassword?: string;
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
|
-
* Delegate to manage
|
|
19
|
-
*
|
|
20
|
-
*
|
|
18
|
+
* Delegate to manage auth-specific user operations.
|
|
19
|
+
*
|
|
20
|
+
* This interface allows the CMS to be agnostic of the underlying
|
|
21
|
+
* authentication provider or backend. User/role CRUD is now handled
|
|
22
|
+
* by the collection system; this delegate only exposes auth-specific
|
|
23
|
+
* operations (password hashing, invitations, bootstrap).
|
|
21
24
|
*
|
|
22
25
|
* @group Models
|
|
23
26
|
*/
|
|
24
27
|
export interface UserManagementDelegate<USER extends User = User> {
|
|
25
28
|
/**
|
|
26
|
-
* Are
|
|
29
|
+
* Are auth-related operations currently loading?
|
|
27
30
|
*/
|
|
28
31
|
loading: boolean;
|
|
29
32
|
/**
|
|
30
|
-
*
|
|
33
|
+
* In-memory list of users (used for client-side filtering fallback).
|
|
31
34
|
*/
|
|
32
|
-
users
|
|
35
|
+
users?: USER[];
|
|
33
36
|
/**
|
|
34
|
-
*
|
|
37
|
+
* Error from fetching the users list, if any.
|
|
35
38
|
*/
|
|
36
39
|
usersError?: Error;
|
|
37
40
|
/**
|
|
38
|
-
*
|
|
39
|
-
* user information when assigning ownership of an entity.
|
|
40
|
-
* @param uid
|
|
41
|
+
* Look up a single user by UID from the in-memory cache.
|
|
41
42
|
*/
|
|
42
|
-
getUser
|
|
43
|
+
getUser?: (uid: string) => USER | null;
|
|
43
44
|
/**
|
|
44
|
-
*
|
|
45
|
-
* When provided, the CMS will use this for the users table
|
|
46
|
-
* instead of loading all users into memory.
|
|
45
|
+
* Server-side user search with pagination.
|
|
47
46
|
*/
|
|
48
|
-
searchUsers?: (
|
|
47
|
+
searchUsers?: (params: {
|
|
49
48
|
search?: string;
|
|
50
49
|
limit?: number;
|
|
51
50
|
offset?: number;
|
|
52
|
-
orderBy?: string;
|
|
53
|
-
orderDir?: "asc" | "desc";
|
|
54
|
-
roleId?: string;
|
|
55
51
|
}) => Promise<{
|
|
56
52
|
users: USER[];
|
|
57
53
|
total: number;
|
|
58
54
|
}>;
|
|
59
|
-
/**
|
|
60
|
-
* Save a user (create or update)
|
|
61
|
-
* @param user
|
|
62
|
-
*/
|
|
63
|
-
saveUser?: (user: USER) => Promise<USER>;
|
|
64
55
|
/**
|
|
65
56
|
* Create a new user with invitation/password generation support.
|
|
66
57
|
* Returns additional info about how the credentials were delivered.
|
|
67
|
-
* Falls back to saveUser if not provided.
|
|
68
58
|
*/
|
|
69
59
|
createUser?: (user: USER) => Promise<UserCreationResult<USER>>;
|
|
70
60
|
/**
|
|
@@ -73,42 +63,15 @@ export interface UserManagementDelegate<USER extends User = User> {
|
|
|
73
63
|
* or a flag indicating an email invitation was sent.
|
|
74
64
|
*/
|
|
75
65
|
resetPassword?: (user: USER) => Promise<UserCreationResult<USER>>;
|
|
76
|
-
/**
|
|
77
|
-
* Delete a user
|
|
78
|
-
* @param user
|
|
79
|
-
*/
|
|
80
|
-
deleteUser?: (user: USER) => Promise<void>;
|
|
81
|
-
/**
|
|
82
|
-
* List of roles defined in the CMS.
|
|
83
|
-
*/
|
|
84
|
-
roles?: Role[];
|
|
85
|
-
/**
|
|
86
|
-
* Optional error if roles failed to load.
|
|
87
|
-
*/
|
|
88
|
-
rolesError?: Error;
|
|
89
|
-
/**
|
|
90
|
-
* Save a role (create or update)
|
|
91
|
-
* @param role
|
|
92
|
-
*/
|
|
93
|
-
saveRole?: (role: Role) => Promise<void>;
|
|
94
|
-
/**
|
|
95
|
-
* Delete a role
|
|
96
|
-
* @param role
|
|
97
|
-
*/
|
|
98
|
-
deleteRole?: (role: Role) => Promise<void>;
|
|
99
66
|
/**
|
|
100
67
|
* Is the currently logged in user an admin?
|
|
101
68
|
*/
|
|
102
69
|
isAdmin?: boolean;
|
|
103
|
-
/**
|
|
104
|
-
* If true, the UI will allow the user to create the default roles (admin, editor, viewer).
|
|
105
|
-
*/
|
|
106
|
-
allowDefaultRolesCreation?: boolean;
|
|
107
70
|
/**
|
|
108
71
|
* Optionally define roles for a given user. This is useful when the roles
|
|
109
72
|
* are coming from a separate provider than the one issuing the tokens.
|
|
110
73
|
*/
|
|
111
|
-
defineRolesFor?: (user: USER) => Promise<
|
|
74
|
+
defineRolesFor?: (user: USER) => Promise<string[] | undefined> | string[] | undefined;
|
|
112
75
|
/**
|
|
113
76
|
* Whether any admin users exist. Used by the bootstrap banner to decide
|
|
114
77
|
* whether to prompt. Populated via a lightweight check (e.g. `limit=1`
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
|
|
2
|
+
declare const Card: React.ForwardRefExoticComponent<{
|
|
3
3
|
children: React.ReactNode;
|
|
4
4
|
style?: React.CSSProperties;
|
|
5
5
|
onClick?: (e?: React.MouseEvent) => void;
|
|
6
6
|
className?: string;
|
|
7
|
-
}
|
|
8
|
-
declare const Card: React.ForwardRefExoticComponent<CardProps & React.RefAttributes<HTMLDivElement>>;
|
|
7
|
+
} & React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
9
8
|
export { Card };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
export interface FilterChipProps {
|
|
2
|
+
export interface FilterChipProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "children"> {
|
|
3
3
|
/**
|
|
4
4
|
* The text label displayed on the chip.
|
|
5
5
|
*/
|
|
@@ -8,10 +8,6 @@ export interface FilterChipProps {
|
|
|
8
8
|
* Whether the chip is currently in an active/selected state.
|
|
9
9
|
*/
|
|
10
10
|
active?: boolean;
|
|
11
|
-
/**
|
|
12
|
-
* Callback when the chip is clicked.
|
|
13
|
-
*/
|
|
14
|
-
onClick?: () => void;
|
|
15
11
|
/**
|
|
16
12
|
* Optional icon rendered before the label.
|
|
17
13
|
*/
|
|
@@ -21,10 +17,6 @@ export interface FilterChipProps {
|
|
|
21
17
|
* @default "medium"
|
|
22
18
|
*/
|
|
23
19
|
size?: "small" | "medium";
|
|
24
|
-
/**
|
|
25
|
-
* Additional class names.
|
|
26
|
-
*/
|
|
27
|
-
className?: string;
|
|
28
20
|
/**
|
|
29
21
|
* Whether the chip is disabled.
|
|
30
22
|
*/
|
|
@@ -39,4 +31,4 @@ export interface FilterChipProps {
|
|
|
39
31
|
*
|
|
40
32
|
* @group Interactive components
|
|
41
33
|
*/
|
|
42
|
-
export declare
|
|
34
|
+
export declare const FilterChip: React.ForwardRefExoticComponent<FilterChipProps & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -224,6 +224,12 @@ export type OnVirtualTableColumnResizeParams = {
|
|
|
224
224
|
key: string;
|
|
225
225
|
column: VirtualTableColumn;
|
|
226
226
|
};
|
|
227
|
+
/**
|
|
228
|
+
* @see Table
|
|
229
|
+
* @group Components
|
|
230
|
+
*/
|
|
231
|
+
export type WhereFilterOp = "<" | "<=" | "==" | "!=" | ">=" | ">" | "array-contains" | "in" | "not-in" | "array-contains-any";
|
|
232
|
+
export type FilterValues<Key extends string> = Partial<Record<Key, [WhereFilterOp, unknown] | [WhereFilterOp, unknown][]>>;
|
|
227
233
|
/**
|
|
228
234
|
* @see Table
|
|
229
235
|
* @group Components
|
|
@@ -233,11 +239,11 @@ export type VirtualTableSort = "asc" | "desc" | undefined;
|
|
|
233
239
|
* @see Table
|
|
234
240
|
* @group Components
|
|
235
241
|
*/
|
|
236
|
-
export type VirtualTableFilterValues<Key extends string> =
|
|
242
|
+
export type VirtualTableFilterValues<Key extends string> = FilterValues<Key>;
|
|
237
243
|
/**
|
|
238
244
|
* Filter conditions in a `Query.where()` clause are specified using the
|
|
239
245
|
* strings `<`, `<=`, `==`, `>=`, `>`, `array-contains`, `in`, and `array-contains-any`.
|
|
240
246
|
* @see Table
|
|
241
247
|
* @group Models
|
|
242
248
|
*/
|
|
243
|
-
export type VirtualTableWhereFilterOp =
|
|
249
|
+
export type VirtualTableWhereFilterOp = WhereFilterOp;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rebasepro/plugin-data-enhancement",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.5.0",
|
|
5
5
|
"main": "./dist/index.umd.js",
|
|
6
6
|
"module": "./dist/index.es.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -16,12 +16,12 @@
|
|
|
16
16
|
"./package.json": "./package.json"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@rebasepro/admin": "0.
|
|
20
|
-
"@rebasepro/common": "0.
|
|
21
|
-
"@rebasepro/
|
|
22
|
-
"@rebasepro/
|
|
23
|
-
"@rebasepro/
|
|
24
|
-
"@rebasepro/
|
|
19
|
+
"@rebasepro/admin": "0.5.0",
|
|
20
|
+
"@rebasepro/common": "0.5.0",
|
|
21
|
+
"@rebasepro/core": "0.5.0",
|
|
22
|
+
"@rebasepro/types": "0.5.0",
|
|
23
|
+
"@rebasepro/utils": "0.5.0",
|
|
24
|
+
"@rebasepro/ui": "0.5.0"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"react": ">=19.0.0",
|
|
@@ -19,9 +19,9 @@ import { getSimplifiedProperties } from "../utils/properties";
|
|
|
19
19
|
import { useEditorAIController } from "../editor/useEditorAIController";
|
|
20
20
|
import { getValueInPath } from "@rebasepro/utils";
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
const DataEnhancementControllerContext = React.createContext<DataEnhancementController>(null! as DataEnhancementController);
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
type DataEnhancementControllerProviderProps = {
|
|
25
25
|
|
|
26
26
|
apiKey: string;
|
|
27
27
|
|