@rebasepro/plugin-data-enhancement 0.3.0 → 0.4.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/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/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/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 +2 -2
- package/dist/types/src/types/backend_hooks.d.ts +2 -17
- package/dist/types/src/types/collections.d.ts +9 -5
- package/dist/types/src/types/entity_views.d.ts +19 -28
- package/dist/types/src/types/properties.d.ts +9 -7
- 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/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/types/src/users/roles.d.ts +0 -14
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { EntityCollection, ViewMode } from "@rebasepro/types";
|
|
2
|
+
/**
|
|
3
|
+
* Props for the {@link CollectionPanel} component.
|
|
4
|
+
*
|
|
5
|
+
* This is a high-level, consumer-friendly wrapper around {@link EntityCollectionView}
|
|
6
|
+
* designed for embedding collection views inside custom pages (home pages,
|
|
7
|
+
* dashboards, entity detail views, etc.).
|
|
8
|
+
*
|
|
9
|
+
* At minimum, provide the `path` (collection slug). All other props are optional
|
|
10
|
+
* overrides that take precedence over the collection's default configuration.
|
|
11
|
+
*
|
|
12
|
+
* @group Components
|
|
13
|
+
*/
|
|
14
|
+
export type CollectionPanelProps = {
|
|
15
|
+
/**
|
|
16
|
+
* The collection slug / path to display (e.g. "tasks", "clients").
|
|
17
|
+
* The collection must be registered in the Rebase context.
|
|
18
|
+
*/
|
|
19
|
+
path: string;
|
|
20
|
+
/**
|
|
21
|
+
* Optional title displayed above the collection.
|
|
22
|
+
* Set to `false` to hide the title entirely.
|
|
23
|
+
* Defaults to the collection's `name`.
|
|
24
|
+
*/
|
|
25
|
+
title?: string | false;
|
|
26
|
+
/**
|
|
27
|
+
* Force a specific view mode, overriding the collection's default.
|
|
28
|
+
*/
|
|
29
|
+
viewMode?: ViewMode;
|
|
30
|
+
/**
|
|
31
|
+
* Override the sort field.
|
|
32
|
+
*/
|
|
33
|
+
sort?: [string, "asc" | "desc"];
|
|
34
|
+
/**
|
|
35
|
+
* Maximum number of entities to display.
|
|
36
|
+
*/
|
|
37
|
+
limit?: number;
|
|
38
|
+
/**
|
|
39
|
+
* Whether to sync filter/sort state with URL query params.
|
|
40
|
+
* Defaults to `false` (embedded panels shouldn't hijack the URL).
|
|
41
|
+
*/
|
|
42
|
+
updateUrl?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Override the entity open mode when clicking an entity.
|
|
45
|
+
*/
|
|
46
|
+
openEntityMode?: "side_panel" | "full_screen" | "split" | "dialog";
|
|
47
|
+
/**
|
|
48
|
+
* Additional CSS class name for the container.
|
|
49
|
+
*/
|
|
50
|
+
className?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Any additional collection-level overrides (e.g. `previewProperties`,
|
|
53
|
+
* `enabledViews`, `entityActions`, `defaultFilter`, etc.).
|
|
54
|
+
*/
|
|
55
|
+
collectionOverrides?: Partial<EntityCollection>;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* A high-level, reusable wrapper for embedding a Rebase collection view
|
|
59
|
+
* inside custom pages (dashboards, home pages, entity detail views, etc.).
|
|
60
|
+
*
|
|
61
|
+
* Usage:
|
|
62
|
+
* ```tsx
|
|
63
|
+
* import { CollectionPanel } from "@rebasepro/admin";
|
|
64
|
+
*
|
|
65
|
+
* function MyDashboard() {
|
|
66
|
+
* return (
|
|
67
|
+
* <div>
|
|
68
|
+
* <CollectionPanel path="tasks" title="Pending Tasks" />
|
|
69
|
+
* <CollectionPanel
|
|
70
|
+
* path="clients"
|
|
71
|
+
* viewMode="table"
|
|
72
|
+
* collectionOverrides={{
|
|
73
|
+
* defaultFilter: { status: ["!=", "completed"] }
|
|
74
|
+
* }}
|
|
75
|
+
* />
|
|
76
|
+
* </div>
|
|
77
|
+
* );
|
|
78
|
+
* }
|
|
79
|
+
* ```
|
|
80
|
+
*
|
|
81
|
+
* @group Components
|
|
82
|
+
*/
|
|
83
|
+
export declare function CollectionPanel({ path, title, viewMode, sort, limit, updateUrl, openEntityMode, className, collectionOverrides }: CollectionPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import type { EntityCollection } from "@rebasepro/types";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { EntityStatus } from "@rebasepro/types";
|
|
4
|
-
export declare const MAIN_TAB_VALUE = "__main_##Q$SC^#S6";
|
|
5
|
-
export declare const JSON_TAB_VALUE = "__json";
|
|
6
|
-
export declare const HISTORY_TAB_VALUE = "__rebase_history";
|
|
7
4
|
export type BarActionsParams = {
|
|
8
5
|
values: object;
|
|
9
6
|
status: EntityStatus;
|
|
@@ -2,9 +2,8 @@ import type { EntityCollection } from "@rebasepro/types";
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { Entity, EntityStatus } from "@rebasepro/types";
|
|
4
4
|
import type { EntityFormProps, OnUpdateParams } from "../types/components/EntityFormProps";
|
|
5
|
-
|
|
6
|
-
export
|
|
7
|
-
export declare const HISTORY_TAB_VALUE = "__rebase_history";
|
|
5
|
+
import { MAIN_TAB_VALUE, JSON_TAB_VALUE, HISTORY_TAB_VALUE } from "../util/entity_view_constants";
|
|
6
|
+
export { MAIN_TAB_VALUE, JSON_TAB_VALUE, HISTORY_TAB_VALUE };
|
|
8
7
|
export type BarActionsParams = {
|
|
9
8
|
values: object;
|
|
10
9
|
status: EntityStatus;
|
|
@@ -13,7 +13,7 @@ export interface RebaseRouteDefsProps {
|
|
|
13
13
|
* Route definitions for the CMS.
|
|
14
14
|
*
|
|
15
15
|
* Defines all standard routes: home, studio home, collection view,
|
|
16
|
-
* settings,
|
|
16
|
+
* settings, debug, custom views, and a catch-all 404.
|
|
17
17
|
*
|
|
18
18
|
* **Independently usable**: Use this when you want Rebase routes
|
|
19
19
|
* inside your own layout/navigation setup.
|
|
@@ -6,7 +6,7 @@ export type SelectableTableProps<M extends Record<string, unknown>> = {
|
|
|
6
6
|
/**
|
|
7
7
|
* Callback when a cell value changes.
|
|
8
8
|
*/
|
|
9
|
-
onValueChange?: OnCellValueChange<
|
|
9
|
+
onValueChange?: OnCellValueChange<unknown, M>;
|
|
10
10
|
columns: VirtualTableColumn[];
|
|
11
11
|
cellRenderer: React.ComponentType<CellRendererParams<Entity<M>>>;
|
|
12
12
|
/**
|
|
@@ -66,7 +66,7 @@ export type SelectableTableProps<M extends Record<string, unknown>> = {
|
|
|
66
66
|
* bust the cell memo comparator, triggering re-render of cells
|
|
67
67
|
* even when rowData hasn't changed.
|
|
68
68
|
*/
|
|
69
|
-
extraData?:
|
|
69
|
+
extraData?: unknown;
|
|
70
70
|
};
|
|
71
71
|
/**
|
|
72
72
|
* This component is in charge of rendering a collection table with a high
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { EntityCollectionTableController } from "@rebasepro/core";
|
|
3
3
|
export declare const SelectableTableContext: React.Context<EntityCollectionTableController<Record<string, unknown>>>;
|
|
4
|
-
export declare const useSelectableTableController: () => EntityCollectionTableController<
|
|
4
|
+
export declare const useSelectableTableController: <M extends Record<string, unknown> = Record<string, unknown>>() => EntityCollectionTableController<M>;
|
|
@@ -13,9 +13,9 @@ import { SelectedCellProps } from "@rebasepro/types";
|
|
|
13
13
|
* derivation actually changed will re-render.
|
|
14
14
|
*/
|
|
15
15
|
export declare function createSelectionStore(): {
|
|
16
|
-
getSnapshot: () => SelectedCellProps
|
|
16
|
+
getSnapshot: () => SelectedCellProps | undefined;
|
|
17
17
|
subscribe: (listener: () => void) => () => void;
|
|
18
|
-
select: (cell: SelectedCellProps
|
|
18
|
+
select: (cell: SelectedCellProps | undefined) => void;
|
|
19
19
|
};
|
|
20
20
|
export type SelectionStore = ReturnType<typeof createSelectionStore>;
|
|
21
21
|
/**
|
|
@@ -24,6 +24,6 @@ export type SelectionStore = ReturnType<typeof createSelectionStore>;
|
|
|
24
24
|
* `selected` boolean actually changes (not on every store update).
|
|
25
25
|
*/
|
|
26
26
|
export declare function useCellSelected(store: {
|
|
27
|
-
getSnapshot: () => SelectedCellProps
|
|
27
|
+
getSnapshot: () => SelectedCellProps | undefined;
|
|
28
28
|
subscribe: (listener: () => void) => () => void;
|
|
29
29
|
}, propertyKey: string, entityPath: string, entityId: string | number): boolean;
|
|
@@ -26,7 +26,7 @@ export type BuildNavigationStateProps<EC extends EntityCollection, USER extends
|
|
|
26
26
|
* NavigationStateController. This is a thin composition of three focused hooks:
|
|
27
27
|
*
|
|
28
28
|
* - useResolvedCollections: resolves collection props and registers with CollectionRegistry
|
|
29
|
-
* - useResolvedViews: resolves view/admin view props
|
|
29
|
+
* - useResolvedViews: resolves view/admin view props
|
|
30
30
|
* - useTopLevelNavigation: computes the NavigationResult from resolved data
|
|
31
31
|
*
|
|
32
32
|
* The NavigationStateController type is preserved as a public API.
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { AppView, AppViewsBuilder, EffectiveRoleController, RebasePlugin } from "@rebasepro/types";
|
|
2
|
-
import { AuthController, RebaseData, User } from "@rebasepro/types";
|
|
3
|
-
import { UserManagementDelegate } from "@rebasepro/types";
|
|
2
|
+
import type { AuthController, RebaseData, User } from "@rebasepro/types";
|
|
4
3
|
export type UseResolvedViewsProps<USER extends User> = {
|
|
5
4
|
authController: AuthController<USER>;
|
|
6
5
|
views?: AppView[] | AppViewsBuilder;
|
|
@@ -9,7 +8,6 @@ export type UseResolvedViewsProps<USER extends User> = {
|
|
|
9
8
|
plugins?: RebasePlugin[];
|
|
10
9
|
adminMode?: "content" | "studio" | "settings";
|
|
11
10
|
effectiveRoleController?: EffectiveRoleController;
|
|
12
|
-
userManagement?: UserManagementDelegate<USER>;
|
|
13
11
|
};
|
|
14
12
|
export type UseResolvedViewsResult = {
|
|
15
13
|
views: AppView[] | undefined;
|
|
@@ -20,8 +18,7 @@ export type UseResolvedViewsResult = {
|
|
|
20
18
|
};
|
|
21
19
|
/**
|
|
22
20
|
* Hook that resolves view and admin view props (which may be async builders or arrays)
|
|
23
|
-
* into concrete AppView[].
|
|
24
|
-
* is provided with roles.
|
|
21
|
+
* into concrete AppView[].
|
|
25
22
|
*
|
|
26
23
|
* Uses refs for potentially-unstable dependencies (driver, authController,
|
|
27
24
|
* plugins) to avoid re-triggering effects when their object identity changes.
|
|
@@ -3,13 +3,11 @@ export type { RebaseEditorProps, JSONContent, EditorAIController } from "./edito
|
|
|
3
3
|
export * from "./form";
|
|
4
4
|
export * from "./preview";
|
|
5
5
|
export * from "./routes";
|
|
6
|
-
export { EntityView, EntitySelectionTable, SelectableTable, SelectableTableContext, EntityCollectionView, EntityCollectionViewActions, EntityCollectionCardView, EntityCard, useSelectionController, PropertyConfigBadge, PropertyIdCopyTooltip, EntityCollectionTable, EntityCollectionRowActions, VirtualTableInput, ArrayContainer, type ArrayEntryParams, ReferenceWidget, SearchIconsView, FieldCaption, EntityPreview, getFieldConfig, getFieldId, getDefaultFieldConfig, getDefaultFieldId, DEFAULT_FIELD_CONFIGS, editEntityAction, copyEntityAction, deleteEntityAction, resetPasswordAction, SideEntityProvider, Scaffold, AppBar, Drawer, DefaultDrawer, DrawerFooterActions, AdminModeSyncer, RebaseCMS, RebaseShell, RebaseAuthGate, RebaseNavigation, RebaseLayout, RebaseRouteDefs, SideDialogs, useApp } from "./components";
|
|
7
|
-
export type { EntityViewProps, EntitySelectionProps, SelectableTableProps } from "./components";
|
|
6
|
+
export { EntityView, EntitySelectionTable, SelectableTable, SelectableTableContext, EntityCollectionView, EntityCollectionViewActions, EntityCollectionCardView, EntityCard, useSelectionController, PropertyConfigBadge, PropertyIdCopyTooltip, EntityCollectionTable, EntityCollectionRowActions, VirtualTableInput, ArrayContainer, type ArrayEntryParams, ReferenceWidget, SearchIconsView, FieldCaption, EntityPreview, getFieldConfig, getFieldId, getDefaultFieldConfig, getDefaultFieldId, DEFAULT_FIELD_CONFIGS, editEntityAction, copyEntityAction, deleteEntityAction, resetPasswordAction, SideEntityProvider, Scaffold, AppBar, Drawer, DefaultDrawer, DrawerFooterActions, AdminModeSyncer, RebaseCMS, RebaseShell, RebaseAuthGate, RebaseNavigation, RebaseLayout, RebaseRouteDefs, SideDialogs, useApp, CollectionPanel } from "./components";
|
|
7
|
+
export type { EntityViewProps, EntitySelectionProps, SelectableTableProps, CollectionPanelProps } from "./components";
|
|
8
8
|
export * from "./hooks";
|
|
9
9
|
export { addInitialSlash, removeInitialSlash, removeTrailingSlash, removeInitialAndTrailingSlashes, getLastSegment, getCollectionBySlugWithin, getCollectionPathsCombinations, resolveCollectionPathIds, mergeEntityActions, resolveEntityAction, resolveEntityView, isReferenceProperty, isRelationProperty, getIconForWidget, getIconForProperty, getPropertyInPath, getResolvedPropertyInPath, getBracketNotation, getPropertiesWithPropertiesOrder, getDefaultPropertiesOrder, getEntityPreviewKeys, getEntityTitlePropertyKey } from "./util";
|
|
10
10
|
export * from "./data_import";
|
|
11
11
|
export * from "./data_export";
|
|
12
12
|
export * from "./collection_editor";
|
|
13
|
-
export { RolesFilterSelect } from "./components/admin/RolesFilterSelect";
|
|
14
|
-
export { UserRolesSelectField } from "./components/admin/UserRolesSelectField";
|
|
15
13
|
export { CreationResultDialog } from "./components/admin/CreationResultDialog";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { EntityCustomView } from "@rebasepro/types";
|
|
2
|
-
import type { CustomizationController, EntityAction } from "@rebasepro/types";
|
|
1
|
+
import type { CustomizationController, EntityAction, EntityCustomView } from "@rebasepro/types";
|
|
3
2
|
export declare function resolveEntityView(entityView: string | EntityCustomView<any>, contextEntityViews?: EntityCustomView<any>[]): EntityCustomView<any> | undefined;
|
|
4
3
|
export declare function resolveEntityAction<M extends Record<string, unknown>>(entityAction: string | EntityAction<M>, contextEntityActions?: EntityAction<M>[]): EntityAction<M> | undefined;
|
|
5
4
|
export declare function resolvedSelectedEntityView<M extends Record<string, unknown>>(customViews: (string | EntityCustomView<M>)[] | undefined, customizationController: CustomizationController, selectedTab?: string, _canEdit?: boolean): {
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import { PostgresCollection } from "@rebasepro/types";
|
|
1
|
+
import type { PostgresCollection } from "@rebasepro/types";
|
|
2
2
|
/**
|
|
3
|
-
* Default users collection
|
|
3
|
+
* Default users collection.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* (Map keyed by slug, last-write-wins) so that developer-defined
|
|
9
|
-
* collections with the same slug override this default — no hardcoded
|
|
10
|
-
* string checks required.
|
|
5
|
+
* Prepended to the developer's collections array by the admin and server.
|
|
6
|
+
* Slug-based dedup (Map keyed by slug, last-write-wins) lets developers
|
|
7
|
+
* override by defining their own collection with `slug: "users"`.
|
|
11
8
|
*/
|
|
12
9
|
export declare const defaultUsersCollection: PostgresCollection;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import { FindResponse, CollectionAccessor, QueryBuilderInterface, FilterOperator } from "@rebasepro/types";
|
|
1
|
+
import { FindResponse, CollectionAccessor, QueryBuilderInterface, FilterOperator, LogicalCondition, WhereValue, FilterCondition } from "@rebasepro/types";
|
|
2
|
+
export declare function or(...conditions: (FilterCondition | LogicalCondition)[]): LogicalCondition;
|
|
3
|
+
export declare function and(...conditions: (FilterCondition | LogicalCondition)[]): LogicalCondition;
|
|
4
|
+
export declare function cond(column: string, operator: FilterOperator, value: unknown): FilterCondition;
|
|
2
5
|
export declare class QueryBuilder<M extends Record<string, unknown> = Record<string, unknown>> implements QueryBuilderInterface<M> {
|
|
3
6
|
private collection;
|
|
4
7
|
private params;
|
|
@@ -8,7 +11,8 @@ export declare class QueryBuilder<M extends Record<string, unknown> = Record<str
|
|
|
8
11
|
* @example
|
|
9
12
|
* client.collection('users').where('age', '>=', 18).find()
|
|
10
13
|
*/
|
|
11
|
-
where
|
|
14
|
+
where<K extends keyof M & string>(column: K, operator: FilterOperator, value: WhereValue<M[K]>): this;
|
|
15
|
+
where(logicalCondition: LogicalCondition): this;
|
|
12
16
|
/**
|
|
13
17
|
* Order the results by a specific column.
|
|
14
18
|
* @example
|
|
@@ -92,10 +92,18 @@ export interface LoginViewProps {
|
|
|
92
92
|
* If not set, derived from `authController.capabilities.registration`.
|
|
93
93
|
*/
|
|
94
94
|
registrationEnabled?: boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Pre-fill the email field (e.g. for demo or testing environments).
|
|
97
|
+
*/
|
|
98
|
+
defaultEmail?: string;
|
|
99
|
+
/**
|
|
100
|
+
* Pre-fill the password field (e.g. for demo or testing environments).
|
|
101
|
+
*/
|
|
102
|
+
defaultPassword?: string;
|
|
95
103
|
}
|
|
96
104
|
/**
|
|
97
105
|
* Generic login view component that works with any AuthControllerExtended.
|
|
98
106
|
* Feature-detects capabilities to show/hide login methods.
|
|
99
107
|
* @group Core
|
|
100
108
|
*/
|
|
101
|
-
export declare function LoginView({ logo, authController, noUserComponent, disableSignupScreen, disabled, notAllowedError, googleClientId, githubClientId, linkedinClientId, title, subtitle, needsSetup, registrationEnabled, additionalComponent }: LoginViewProps): import("react/jsx-runtime").JSX.Element;
|
|
109
|
+
export declare function LoginView({ logo, authController, noUserComponent, disableSignupScreen, disabled, notAllowedError, googleClientId, githubClientId, linkedinClientId, title, subtitle, needsSetup, registrationEnabled, additionalComponent, defaultEmail, defaultPassword }: LoginViewProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Property } from "@rebasepro/types";
|
|
1
|
+
import type { Property, Entity } from "@rebasepro/types";
|
|
2
2
|
import { CollectionSize, SelectedCellProps } from "@rebasepro/types";
|
|
3
3
|
export type EntityCollectionTableController<M extends Record<string, unknown>> = {
|
|
4
4
|
/**
|
|
@@ -26,7 +26,7 @@ export type EntityCollectionTableController<M extends Record<string, unknown>> =
|
|
|
26
26
|
* Callback used when the value of a cell has changed.
|
|
27
27
|
* @param params
|
|
28
28
|
*/
|
|
29
|
-
onValueChange?: (params: OnCellValueChangeParams<unknown, M
|
|
29
|
+
onValueChange?: (params: OnCellValueChangeParams<unknown, Entity<M>>) => void;
|
|
30
30
|
/**
|
|
31
31
|
* Size of the elements in the collection
|
|
32
32
|
*/
|
|
@@ -56,7 +56,7 @@ export type UniqueFieldValidator = (props: {
|
|
|
56
56
|
* Callback when a cell has changed in a table
|
|
57
57
|
* @group Collection components
|
|
58
58
|
*/
|
|
59
|
-
export type OnCellValueChange<T, M extends Record<string, unknown>> = (params: OnCellValueChangeParams<T, M
|
|
59
|
+
export type OnCellValueChange<T, M extends Record<string, unknown>> = (params: OnCellValueChangeParams<T, Entity<M>>) => Promise<void> | void;
|
|
60
60
|
/**
|
|
61
61
|
* @group Collection components
|
|
62
62
|
*/
|
|
@@ -16,6 +16,14 @@ export interface CollectionFetchProps<M extends Record<string, any>> {
|
|
|
16
16
|
* Number of entities to fetch
|
|
17
17
|
*/
|
|
18
18
|
itemCount?: number;
|
|
19
|
+
/**
|
|
20
|
+
* Number of items to skip
|
|
21
|
+
*/
|
|
22
|
+
offset?: number;
|
|
23
|
+
/**
|
|
24
|
+
* Page number (1-indexed), alternative to offset
|
|
25
|
+
*/
|
|
26
|
+
page?: number;
|
|
19
27
|
/**
|
|
20
28
|
* Filter the fetched data by the property
|
|
21
29
|
*/
|
|
@@ -37,6 +45,7 @@ export interface CollectionFetchResult<M extends Record<string, any>> {
|
|
|
37
45
|
dataLoading: boolean;
|
|
38
46
|
noMoreToLoad: boolean;
|
|
39
47
|
dataLoadingError?: Error;
|
|
48
|
+
totalCount?: number;
|
|
40
49
|
}
|
|
41
50
|
/**
|
|
42
51
|
* This hook is used to fetch collections using a given collection
|
|
@@ -45,7 +54,9 @@ export interface CollectionFetchResult<M extends Record<string, any>> {
|
|
|
45
54
|
* @param filterValues
|
|
46
55
|
* @param sortBy
|
|
47
56
|
* @param itemCount
|
|
57
|
+
* @param offset
|
|
58
|
+
* @param page
|
|
48
59
|
* @param searchString
|
|
49
60
|
* @group Hooks and utilities
|
|
50
61
|
*/
|
|
51
|
-
export declare function useCollectionFetch<M extends Record<string, any>, USER extends User>({ path, collection, filterValues, sortBy, itemCount, searchString }: CollectionFetchProps<M>): CollectionFetchResult<M>;
|
|
62
|
+
export declare function useCollectionFetch<M extends Record<string, any>, USER extends User>({ path, collection, filterValues, sortBy, itemCount, offset, page, searchString }: CollectionFetchProps<M>): CollectionFetchResult<M>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { User } from "../users";
|
|
2
2
|
/**
|
|
3
3
|
* Capabilities advertised by an auth provider.
|
|
4
4
|
* UI components use this to show/hide features dynamically
|
|
@@ -62,7 +62,7 @@ export type AuthController<USER extends User = User, ExtraData = unknown> = {
|
|
|
62
62
|
extra: ExtraData;
|
|
63
63
|
setExtra: (extra: ExtraData) => void;
|
|
64
64
|
setUser?(user: USER | null): void;
|
|
65
|
-
setUserRoles?(roles:
|
|
65
|
+
setUserRoles?(roles: string[]): void;
|
|
66
66
|
/**
|
|
67
67
|
* Capabilities advertised by the auth provider.
|
|
68
68
|
* UI components use this to feature-detect what the backend supports.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { User } from "../users";
|
|
2
|
-
import { RebaseData } from "./data";
|
|
3
|
-
import { EmailService } from "./email";
|
|
1
|
+
import type { User } from "../users";
|
|
2
|
+
import type { RebaseData } from "./data";
|
|
3
|
+
import type { EmailService } from "./email";
|
|
4
4
|
/**
|
|
5
5
|
* Event type for authentication state changes
|
|
6
6
|
*/
|
|
@@ -14,7 +14,7 @@ export interface RebaseSession {
|
|
|
14
14
|
expiresAt: number;
|
|
15
15
|
user: User;
|
|
16
16
|
}
|
|
17
|
-
import { StorageSource } from "./storage";
|
|
17
|
+
import type { StorageSource } from "./storage";
|
|
18
18
|
/**
|
|
19
19
|
* Unified Authentication Client Interface
|
|
20
20
|
* Pure functional SDK interface, decoupled from UI and React hooks
|
|
@@ -56,19 +56,9 @@ export interface AdminUser {
|
|
|
56
56
|
createdAt: string;
|
|
57
57
|
updatedAt: string;
|
|
58
58
|
}
|
|
59
|
-
/**
|
|
60
|
-
* Role record as returned by the Admin API.
|
|
61
|
-
* @group Admin
|
|
62
|
-
*/
|
|
63
|
-
export interface AdminRole {
|
|
64
|
-
id: string;
|
|
65
|
-
name: string;
|
|
66
|
-
isAdmin: boolean;
|
|
67
|
-
defaultPermissions: Record<string, unknown> | null;
|
|
68
|
-
}
|
|
69
59
|
/**
|
|
70
60
|
* Client-side Admin API interface.
|
|
71
|
-
* Provides user
|
|
61
|
+
* Provides user management operations.
|
|
72
62
|
* @group Admin
|
|
73
63
|
*/
|
|
74
64
|
export interface AdminAPI {
|
|
@@ -111,30 +101,6 @@ export interface AdminAPI {
|
|
|
111
101
|
deleteUser(userId: string): Promise<{
|
|
112
102
|
success: boolean;
|
|
113
103
|
}>;
|
|
114
|
-
listRoles(): Promise<{
|
|
115
|
-
roles: AdminRole[];
|
|
116
|
-
}>;
|
|
117
|
-
getRole(roleId: string): Promise<{
|
|
118
|
-
role: AdminRole;
|
|
119
|
-
}>;
|
|
120
|
-
createRole(data: {
|
|
121
|
-
id: string;
|
|
122
|
-
name: string;
|
|
123
|
-
isAdmin?: boolean;
|
|
124
|
-
defaultPermissions?: Record<string, unknown>;
|
|
125
|
-
}): Promise<{
|
|
126
|
-
role: AdminRole;
|
|
127
|
-
}>;
|
|
128
|
-
updateRole(roleId: string, data: {
|
|
129
|
-
name?: string;
|
|
130
|
-
isAdmin?: boolean;
|
|
131
|
-
defaultPermissions?: Record<string, unknown>;
|
|
132
|
-
}): Promise<{
|
|
133
|
-
role: AdminRole;
|
|
134
|
-
}>;
|
|
135
|
-
deleteRole(roleId: string): Promise<{
|
|
136
|
-
success: boolean;
|
|
137
|
-
}>;
|
|
138
104
|
bootstrap(): Promise<{
|
|
139
105
|
success: boolean;
|
|
140
106
|
message: string;
|
|
@@ -165,7 +131,7 @@ export interface RebaseClient<DB = unknown> {
|
|
|
165
131
|
* > The client-side SDK does not include an email service.
|
|
166
132
|
*/
|
|
167
133
|
email?: EmailService;
|
|
168
|
-
/** Admin API for user
|
|
134
|
+
/** Admin API for user management */
|
|
169
135
|
admin?: AdminAPI;
|
|
170
136
|
/**
|
|
171
137
|
* The base HTTP URL of the backend server.
|
|
@@ -180,4 +146,23 @@ export interface RebaseClient<DB = unknown> {
|
|
|
180
146
|
* detection (e.g. `typeof ws.executeSql === "function"`).
|
|
181
147
|
*/
|
|
182
148
|
ws?: unknown;
|
|
149
|
+
/**
|
|
150
|
+
* Execute raw SQL against the database.
|
|
151
|
+
*
|
|
152
|
+
* Only available server-side when the backend uses a SQL database
|
|
153
|
+
* (PostgreSQL, MySQL, etc.). `undefined` for document databases
|
|
154
|
+
* (MongoDB, Firestore) and on the client-side SDK.
|
|
155
|
+
*
|
|
156
|
+
* @example
|
|
157
|
+
* ```typescript
|
|
158
|
+
* // In a cron job or custom function:
|
|
159
|
+
* if (ctx.client.sql) {
|
|
160
|
+
* const rows = await ctx.client.sql("SELECT count(*) FROM orders");
|
|
161
|
+
* }
|
|
162
|
+
* ```
|
|
163
|
+
*/
|
|
164
|
+
sql?(query: string, options?: {
|
|
165
|
+
database?: string;
|
|
166
|
+
role?: string;
|
|
167
|
+
}): Promise<Record<string, unknown>[]>;
|
|
183
168
|
}
|
|
@@ -16,7 +16,17 @@ import { Entity, EntityValues } from "../types/entities";
|
|
|
16
16
|
*
|
|
17
17
|
* @group Data
|
|
18
18
|
*/
|
|
19
|
-
export type WhereFieldValue = string | number | boolean | null | [WhereFilterOpShort, any];
|
|
19
|
+
export type WhereFieldValue = string | number | boolean | null | [WhereFilterOpShort, any] | [WhereFilterOpShort, any][];
|
|
20
|
+
export type WhereValue<T> = T | T[] | null;
|
|
21
|
+
export interface LogicalCondition {
|
|
22
|
+
type: "and" | "or";
|
|
23
|
+
conditions: (FilterCondition | LogicalCondition)[];
|
|
24
|
+
}
|
|
25
|
+
export interface FilterCondition {
|
|
26
|
+
column: string;
|
|
27
|
+
operator: FilterOperator;
|
|
28
|
+
value: unknown;
|
|
29
|
+
}
|
|
20
30
|
/** Short operator strings accepted in the tuple syntax. */
|
|
21
31
|
export type WhereFilterOpShort = "==" | "!=" | ">" | ">=" | "<" | "<=" | "eq" | "neq" | "gt" | "gte" | "lt" | "lte" | "in" | "nin" | "not-in" | "array-contains" | "array-contains-any" | "cs" | "csa";
|
|
22
32
|
export interface FindParams {
|
|
@@ -51,6 +61,8 @@ export interface FindParams {
|
|
|
51
61
|
* ```
|
|
52
62
|
*/
|
|
53
63
|
where?: Record<string, WhereFieldValue>;
|
|
64
|
+
/** Logical grouping conditions (AND/OR) */
|
|
65
|
+
logical?: LogicalCondition;
|
|
54
66
|
/**
|
|
55
67
|
* Sort order. Format: "field:direction".
|
|
56
68
|
* @example "created_at:desc", "name:asc"
|
|
@@ -82,7 +94,8 @@ export type FilterOperator = WhereFilterOpShort;
|
|
|
82
94
|
* @group Data
|
|
83
95
|
*/
|
|
84
96
|
export interface QueryBuilderInterface<M extends Record<string, unknown> = Record<string, unknown>> {
|
|
85
|
-
where
|
|
97
|
+
where<K extends keyof M & string>(column: K, operator: FilterOperator, value: WhereValue<M[K]>): this;
|
|
98
|
+
where(logicalCondition: LogicalCondition): this;
|
|
86
99
|
orderBy(column: keyof M & string, ascending?: "asc" | "desc"): this;
|
|
87
100
|
limit(count: number): this;
|
|
88
101
|
offset(count: number): this;
|
|
@@ -125,6 +138,10 @@ export interface CollectionAccessor<M extends Record<string, unknown> = Record<s
|
|
|
125
138
|
* Delete a record by ID.
|
|
126
139
|
*/
|
|
127
140
|
delete(id: string | number): Promise<void>;
|
|
141
|
+
/**
|
|
142
|
+
* Delete all records in this collection.
|
|
143
|
+
*/
|
|
144
|
+
deleteAll?(): Promise<void>;
|
|
128
145
|
/**
|
|
129
146
|
* Subscribe to a collection for real-time updates.
|
|
130
147
|
* Optional method, may not be supported by all implementations (like stateless HTTP clients).
|
|
@@ -139,7 +156,8 @@ export interface CollectionAccessor<M extends Record<string, unknown> = Record<s
|
|
|
139
156
|
* Count the number of records matching the given filter.
|
|
140
157
|
*/
|
|
141
158
|
count?(params?: FindParams): Promise<number>;
|
|
142
|
-
where
|
|
159
|
+
where<K extends keyof M & string>(column: K, operator: FilterOperator, value: WhereValue<M[K]>): QueryBuilderInterface<M>;
|
|
160
|
+
where(logicalCondition: LogicalCondition): QueryBuilderInterface<M>;
|
|
143
161
|
orderBy(column: keyof M & string, ascending?: "asc" | "desc"): QueryBuilderInterface<M>;
|
|
144
162
|
limit(count: number): QueryBuilderInterface<M>;
|
|
145
163
|
offset(count: number): QueryBuilderInterface<M>;
|
|
@@ -129,6 +129,11 @@ export interface DataDriver {
|
|
|
129
129
|
* @return was the whole deletion flow successful
|
|
130
130
|
*/
|
|
131
131
|
deleteEntity<M extends Record<string, unknown> = Record<string, unknown>>(props: DeleteEntityProps<M>): Promise<void>;
|
|
132
|
+
/**
|
|
133
|
+
* Delete all entities from a collection.
|
|
134
|
+
* @param path Collection path
|
|
135
|
+
*/
|
|
136
|
+
deleteAll?(path: string): Promise<void>;
|
|
132
137
|
/**
|
|
133
138
|
* Check if the given property is unique in the given collection
|
|
134
139
|
* @param path Collection path
|
|
@@ -31,4 +31,6 @@ export interface EmailService {
|
|
|
31
31
|
send(options: EmailSendOptions): Promise<void>;
|
|
32
32
|
/** Returns `true` when the service has valid credentials / is ready to send. */
|
|
33
33
|
isConfigured(): boolean;
|
|
34
|
+
/** Verify connection/credentials with the email provider. */
|
|
35
|
+
verifyConnection?(): Promise<boolean>;
|
|
34
36
|
}
|
|
@@ -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. */
|
|
@@ -527,8 +527,8 @@ export interface InitializedDriver {
|
|
|
527
527
|
export interface BootstrappedAuth {
|
|
528
528
|
/** User management service. */
|
|
529
529
|
userService: unknown;
|
|
530
|
-
/** Role management service. */
|
|
531
|
-
roleService
|
|
530
|
+
/** Role management service (optional, roles are now simple strings). */
|
|
531
|
+
roleService?: unknown;
|
|
532
532
|
/** Email service (optional). */
|
|
533
533
|
emailService?: unknown;
|
|
534
534
|
/** 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
|
*/
|
|
@@ -566,7 +570,7 @@ export type WhereFilterOp = "<" | "<=" | "==" | "!=" | ">=" | ">" | "array-conta
|
|
|
566
570
|
*
|
|
567
571
|
* @group Models
|
|
568
572
|
*/
|
|
569
|
-
export type FilterValues<Key extends string> = Partial<Record<Key, [WhereFilterOp, unknown]>>;
|
|
573
|
+
export type FilterValues<Key extends string> = Partial<Record<Key, [WhereFilterOp, unknown] | [WhereFilterOp, unknown][]>>;
|
|
570
574
|
/**
|
|
571
575
|
* A pre-defined filter preset for quick access in the collection toolbar.
|
|
572
576
|
* 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)
|
|
@@ -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.4.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/
|
|
20
|
-
"@rebasepro/
|
|
21
|
-
"@rebasepro/
|
|
22
|
-
"@rebasepro/
|
|
23
|
-
"@rebasepro/
|
|
24
|
-
"@rebasepro/
|
|
19
|
+
"@rebasepro/core": "0.4.0",
|
|
20
|
+
"@rebasepro/admin": "0.4.0",
|
|
21
|
+
"@rebasepro/types": "0.4.0",
|
|
22
|
+
"@rebasepro/ui": "0.4.0",
|
|
23
|
+
"@rebasepro/common": "0.4.0",
|
|
24
|
+
"@rebasepro/utils": "0.4.0"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"react": ">=19.0.0",
|