@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
package/README.md
CHANGED
|
@@ -1,89 +1,81 @@
|
|
|
1
|
-
|
|
1
|
+
# @rebasepro/plugin-data-enhancement
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
project, using ChatGPT.
|
|
3
|
+
AI-powered data autofill and text autocomplete plugin for Rebase.
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
the latest GPT models. This plugin is able to understand the structure of your
|
|
8
|
-
data and generate content that fits your schema.
|
|
5
|
+
## Installation
|
|
9
6
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @rebasepro/plugin-data-enhancement
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
**Peer dependencies:** `react >= 19.0.0`, `react-dom >= 19.0.0`, `react-router >= 6.28.0`, `react-router-dom >= 6.28.0`
|
|
12
|
+
|
|
13
|
+
## What This Package Does
|
|
14
|
+
|
|
15
|
+
This plugin adds AI-powered capabilities to the Rebase admin panel:
|
|
16
|
+
|
|
17
|
+
- **Form autofill** — An "Enhance" action button injected into entity forms that uses AI to suggest and fill field values based on collection schema and existing data.
|
|
18
|
+
- **Editor autocomplete** — A streaming text autocomplete controller for rich text editors, powered by an AI backend.
|
|
19
|
+
|
|
20
|
+
It registers as a standard `RebasePlugin`, injecting UI slots and providers automatically.
|
|
13
21
|
|
|
14
|
-
|
|
22
|
+
## Key Exports
|
|
15
23
|
|
|
16
|
-
|
|
17
|
-
|
|
24
|
+
| Export | Type | Description |
|
|
25
|
+
|---|---|---|
|
|
26
|
+
| `useDataEnhancementPlugin` | Hook | Creates the plugin. Returns a `RebasePlugin` to pass to your app's `plugins` array |
|
|
27
|
+
| `DataEnhancementPluginProps` | Type | Configuration options for the plugin |
|
|
28
|
+
| `useEditorAIController` | Hook | Returns an `EditorAIController` with a streaming `autocomplete` method for rich text editors |
|
|
18
29
|
|
|
19
|
-
|
|
20
|
-
with,
|
|
21
|
-
in the website. And that's it!
|
|
30
|
+
### `DataEnhancementPluginProps`
|
|
22
31
|
|
|
23
|
-
|
|
32
|
+
| Prop | Type | Default | Description |
|
|
33
|
+
|---|---|---|---|
|
|
34
|
+
| `apiKey` | `string` | Built-in default key | API key for the data enhancement service |
|
|
35
|
+
| `getConfigForPath` | `(props: { path, collection, user }) => boolean` | — | Return `false` to disable enhancement for specific paths |
|
|
36
|
+
| `host` | `string` | — | Custom API host (development only) |
|
|
37
|
+
|
|
38
|
+
## Quick Start
|
|
39
|
+
|
|
40
|
+
```tsx
|
|
41
|
+
import { useDataEnhancementPlugin } from "@rebasepro/plugin-data-enhancement";
|
|
42
|
+
|
|
43
|
+
// In your app setup:
|
|
44
|
+
const dataEnhancementPlugin = useDataEnhancementPlugin({
|
|
45
|
+
getConfigForPath: ({ path, collection }) => {
|
|
46
|
+
// Disable for certain collections
|
|
47
|
+
return collection.name !== "system_logs";
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// Pass to your Rebase app:
|
|
52
|
+
<RebaseFirebaseApp
|
|
53
|
+
plugins={[dataEnhancementPlugin]}
|
|
54
|
+
// ...other props
|
|
55
|
+
/>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Editor AI Autocomplete
|
|
24
59
|
|
|
25
60
|
```tsx
|
|
26
|
-
import
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
appId: ""
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export default function App() {
|
|
44
|
-
|
|
45
|
-
const dataEnhancementPlugin = useDataEnhancementPlugin({
|
|
46
|
-
// Optional callback for defining which collections should be enhanced
|
|
47
|
-
getConfigForPath: ({ path }) => {
|
|
48
|
-
if (path === "books")
|
|
49
|
-
return true;
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
const plugins = [dataEnhancementPlugin];
|
|
55
|
-
|
|
56
|
-
const navigationController = useBuildNavigationStateController({
|
|
57
|
-
// ... rest of your config
|
|
58
|
-
plugins
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
return <Rebase
|
|
62
|
-
name={"My Online Shop"}
|
|
63
|
-
plugins={[dataEnhancementPlugin]}
|
|
64
|
-
authentication={myAuthenticator}
|
|
65
|
-
navigationController={navigationController}
|
|
66
|
-
firebaseConfig={firebaseConfig}
|
|
67
|
-
/>;
|
|
68
|
-
}
|
|
61
|
+
import { useEditorAIController } from "@rebasepro/plugin-data-enhancement";
|
|
62
|
+
|
|
63
|
+
const aiController = useEditorAIController({
|
|
64
|
+
getAuthToken: () => firebaseUser.getIdToken()
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
// Use in a rich text editor:
|
|
68
|
+
await aiController.autocomplete(
|
|
69
|
+
"The quick brown", // text before cursor
|
|
70
|
+
" over the fence", // text after cursor
|
|
71
|
+
(delta) => { // streaming callback
|
|
72
|
+
appendText(delta);
|
|
73
|
+
}
|
|
74
|
+
);
|
|
69
75
|
```
|
|
70
76
|
|
|
71
|
-
##
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
Some tips in order to get the best results:
|
|
78
|
-
|
|
79
|
-
- Make sure you select the **right data** type for your fields.
|
|
80
|
-
- The **field names** are used to generate the content and are usually enough to
|
|
81
|
-
generate good results. If you want to get even better results, you can
|
|
82
|
-
**add a description** to your fields. This will help the plugin understand the
|
|
83
|
-
context of your data and generate better results.
|
|
84
|
-
- The **collection name** is important as well.
|
|
85
|
-
- You can establish **relations between fields** and the plugin will pick it up.
|
|
86
|
-
e.g. if you have a field called `author` and another field called `book`, the
|
|
87
|
-
plugin will understand that the author is related to the book and will
|
|
88
|
-
generate content accordingly. You can use this for making **summaries, reviews,
|
|
89
|
-
translations, SEO content**, etc.
|
|
77
|
+
## Related Packages
|
|
78
|
+
|
|
79
|
+
- `@rebasepro/admin` — The admin panel this plugin extends
|
|
80
|
+
- `@rebasepro/core` — Core framework providing the plugin system
|
|
81
|
+
- `@rebasepro/types` — Shared types (`RebasePlugin`, `EntityCollection`, etc.)
|
|
@@ -3,6 +3,7 @@ import { FormexController } from "@rebasepro/formex";
|
|
|
3
3
|
import { Property, PropertyConfig } from "@rebasepro/types";
|
|
4
4
|
export type PropertyWithId = Property & {
|
|
5
5
|
id?: string;
|
|
6
|
+
conditions?: import('@rebasepro/types').PropertyConditions;
|
|
6
7
|
};
|
|
7
8
|
export type OnPropertyChangedParams = {
|
|
8
9
|
id?: string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { EntityCollection } from "@rebasepro/types";
|
|
1
|
+
import type { EntityCollection } from "@rebasepro/types";
|
|
2
2
|
export declare const blogCollectionTemplate: EntityCollection;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { EntityCollection } from "@rebasepro/types";
|
|
1
|
+
import type { EntityCollection } from "@rebasepro/types";
|
|
2
2
|
export declare const pagesCollectionTemplate: EntityCollection;
|
package/dist/admin/src/collection_editor/ui/collection_editor/templates/products_template.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { EntityCollection } from "@rebasepro/types";
|
|
1
|
+
import type { EntityCollection } from "@rebasepro/types";
|
|
2
2
|
export declare const productsCollectionTemplate: EntityCollection;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { EntityCollection } from "@rebasepro/types";
|
|
1
|
+
import type { EntityCollection } from "@rebasepro/types";
|
|
2
2
|
export declare const usersCollectionTemplate: EntityCollection;
|
|
@@ -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
|
|
@@ -1,6 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { Entity, EntityCollection, User } from "@rebasepro/types";
|
|
2
|
+
/**
|
|
3
|
+
* Minimal auth context for permission checking.
|
|
4
|
+
* Only requires the user object — avoids forcing callers to construct
|
|
5
|
+
* a full AuthController just to check permissions.
|
|
6
|
+
*/
|
|
7
|
+
export interface AuthContext<USER extends User = User> {
|
|
8
|
+
user: USER | null;
|
|
9
|
+
}
|
|
10
|
+
export declare function checkOperation<M extends Record<string, unknown>, USER extends User>(collection: EntityCollection<M>, authContext: AuthContext<USER>, entity: Entity<M> | null, targetOperation: "select" | "insert" | "update" | "delete"): boolean;
|
|
11
|
+
export declare function canReadCollection<M extends Record<string, unknown>, USER extends User>(collection: EntityCollection<M>, authContext: AuthContext<USER>): boolean;
|
|
12
|
+
export declare function canEditEntity<M extends Record<string, unknown>, USER extends User>(collection: EntityCollection<M>, authContext: AuthContext<USER>, path: string, entity: Entity<M> | null): boolean;
|
|
13
|
+
export declare function canCreateEntity<M extends Record<string, unknown>, USER extends User>(collection: EntityCollection<M>, authContext: AuthContext<USER>, path: string, entity: Entity<M> | null): boolean;
|
|
14
|
+
export declare function canDeleteEntity<M extends Record<string, unknown>, USER extends User>(collection: EntityCollection<M>, authContext: AuthContext<USER>, path: string, entity: Entity<M> | null): boolean;
|
|
@@ -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>;
|