@rebasepro/studio 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 +73 -140
- package/dist/{JSEditor-Br4ke-J4.js → JSEditor-DfwRLBZg.js} +2 -15
- package/dist/JSEditor-DfwRLBZg.js.map +1 -0
- package/dist/RLSEditor-CHEExeSB.js.map +1 -1
- package/dist/{SQLEditor-BC0IOUQu.js → SQLEditor-CQXaI0iU.js} +2 -2
- package/dist/SQLEditor-CQXaI0iU.js.map +1 -0
- package/dist/SchemaVisualizer-BGpmzyXT.js.map +1 -1
- 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 +2 -2
- package/dist/index.umd.js +2 -15
- package/dist/index.umd.js.map +1 -1
- package/dist/studio/src/components/RLSEditor/RLSEditor.d.ts +0 -6
- package/dist/studio/src/components/SchemaVisualizer/schema-visualizer.utils.d.ts +0 -8
- package/dist/studio/src/utils/pgColumnToProperty.d.ts +1 -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 +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 +8 -8
- package/src/components/JSEditor/JSEditor.tsx +1 -1
- package/src/components/JSEditor/JSMonacoEditor.tsx +0 -13
- package/src/components/RLSEditor/RLSEditor.tsx +1 -1
- package/src/components/SchemaVisualizer/schema-visualizer.utils.ts +3 -3
- package/src/components/SchemaVisualizer/useSchemaGraph.ts +2 -2
- package/src/utils/pgColumnToProperty.test.ts +1 -0
- package/src/utils/pgColumnToProperty.ts +42 -22
- package/src/utils/sql_utils.ts +1 -1
- package/dist/JSEditor-Br4ke-J4.js.map +0 -1
- package/dist/SQLEditor-BC0IOUQu.js.map +0 -1
- package/dist/studio/src/components/SchemaVisualizer/index.d.ts +0 -5
- package/dist/studio/src/utils/entities.d.ts +0 -0
- package/dist/types/src/users/roles.d.ts +0 -14
- package/src/components/SchemaVisualizer/index.ts +0 -5
- package/src/utils/entities.ts +0 -2
package/README.md
CHANGED
|
@@ -1,159 +1,92 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @rebasepro/studio
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
collection editor that allows you to create, edit, and delete collections without writing code.
|
|
3
|
+
Developer tools layer for Rebase — provides 9 lazy-loaded tools (SQL Console, JS Console, RLS Editor, Storage, Cron Jobs, Schema Visualizer, Branches, API Explorer, Logs Explorer) plus a customizable home page.
|
|
5
4
|
|
|
6
5
|
## Installation
|
|
7
6
|
|
|
8
7
|
```bash
|
|
9
|
-
|
|
10
|
-
# or
|
|
11
|
-
yarn add @rebasepro/collection_editor
|
|
8
|
+
pnpm add @rebasepro/studio
|
|
12
9
|
```
|
|
13
10
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
##
|
|
23
|
-
|
|
24
|
-
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
// Define permissions for collection operations
|
|
65
|
-
configPermissions: ({ user }) => ({
|
|
66
|
-
createCollections: user.roles?.includes("admin") ?? false,
|
|
67
|
-
editCollections: user.roles?.includes("admin") ?? false,
|
|
68
|
-
deleteCollections: user.roles?.includes("admin") ?? false
|
|
69
|
-
}),
|
|
70
|
-
|
|
71
|
-
// Prevent these group names from being used
|
|
72
|
-
reservedGroups: ["admin", "system"],
|
|
73
|
-
|
|
74
|
-
// Optional custom view to add to the editor
|
|
75
|
-
extraView: {
|
|
76
|
-
View: MyCustomView,
|
|
77
|
-
icon: <CustomIcon />
|
|
78
|
-
},
|
|
79
|
-
|
|
80
|
-
// Function to infer collection structure from existing data
|
|
81
|
-
collectionInference: async ({ path }) => {
|
|
82
|
-
// Return inferred schema based on data at path
|
|
83
|
-
},
|
|
84
|
-
|
|
85
|
-
// Function to get sample data for a collection
|
|
86
|
-
getData: async (path, parentPaths) => {
|
|
87
|
-
// Return sample data for the specified path
|
|
88
|
-
},
|
|
89
|
-
|
|
90
|
-
// Track collection editor events
|
|
91
|
-
onAnalyticsEvent: (event, params) => {
|
|
92
|
-
console.log("Collection editor event:", event, params);
|
|
93
|
-
},
|
|
94
|
-
|
|
95
|
-
// Include introduction widget when no collections exist
|
|
96
|
-
includeIntroView: true
|
|
97
|
-
}}
|
|
98
|
-
/>
|
|
11
|
+
### Peer Dependencies
|
|
12
|
+
|
|
13
|
+
- `react` >= 19.0.0
|
|
14
|
+
- `react-dom` >= 19.0.0
|
|
15
|
+
- `react-router` ^7.0.0
|
|
16
|
+
- `react-router-dom` ^7.0.0
|
|
17
|
+
- `@rebasepro/admin` (optional)
|
|
18
|
+
|
|
19
|
+
## What This Package Does
|
|
20
|
+
|
|
21
|
+
`@rebasepro/studio` registers a set of developer tools into the Rebase CMS. The `<RebaseStudio>` component renders nothing visible — it declaratively registers tool views into the Rebase registry. Each tool (Monaco-based editors, xyflow graph, etc.) is lazy-loaded so it stays out of the initial bundle.
|
|
22
|
+
|
|
23
|
+
## Available Tools
|
|
24
|
+
|
|
25
|
+
| Slug | Name | Group | Description |
|
|
26
|
+
|---|---|---|---|
|
|
27
|
+
| `sql` | SQL Console | Database | Execute raw SQL queries |
|
|
28
|
+
| `js` | JS Console | Compute | Run JavaScript in a live sandbox |
|
|
29
|
+
| `rls` | RLS Policies | Database | Configure Row Level Security |
|
|
30
|
+
| `storage` | Storage | Storage | Browse and manage files |
|
|
31
|
+
| `cron` | Cron Jobs | Compute | Monitor scheduled tasks |
|
|
32
|
+
| `schema-visualizer` | Schema Visualizer | Database | Interactive database ERD |
|
|
33
|
+
| `branches` | Branches | Database | Create and manage database branches |
|
|
34
|
+
| `api` | API Explorer | API | Interactive API docs and testing |
|
|
35
|
+
| `logs` | Logs Explorer | Database | Real-time system and query logs |
|
|
36
|
+
|
|
37
|
+
All 9 tools are enabled by default. The `schema` tool (collection editor) is auto-injected by the CMS when `collectionEditor` is enabled — it is **not** registered here.
|
|
38
|
+
|
|
39
|
+
## Key Exports
|
|
40
|
+
|
|
41
|
+
| Export | Type | Description |
|
|
42
|
+
|---|---|---|
|
|
43
|
+
| `RebaseStudio` | Component | Main entry point — registers tools into the Rebase registry |
|
|
44
|
+
| `StudioHomePage` | Component | Default home page with tool cards and SDK quick-start snippet |
|
|
45
|
+
| `StudioBridgeProvider` | Component | Re-exported from `@rebasepro/core` |
|
|
46
|
+
| `StudioBridgeContext` | Context | Re-exported from `@rebasepro/core` |
|
|
47
|
+
| `useStudioCollectionRegistry` | Hook | Access the collection registry |
|
|
48
|
+
| `useStudioSideEntityController` | Hook | Control the side entity panel |
|
|
49
|
+
| `useStudioUrlController` | Hook | URL state management |
|
|
50
|
+
| `useStudioNavigationState` | Hook | Navigation state |
|
|
51
|
+
| `useStudioBreadcrumbs` | Hook | Breadcrumb management |
|
|
52
|
+
| `StudioBridge` | Type | Bridge interface type |
|
|
53
|
+
| `BreadcrumbEntry` | Type | Single breadcrumb item |
|
|
54
|
+
| `BreadcrumbsController` | Type | Breadcrumb controller interface |
|
|
55
|
+
|
|
56
|
+
Individual tools (e.g. `SQLEditor`, `SchemaVisualizer`) are **not** re-exported from the barrel to preserve code splitting. Use deep imports if needed:
|
|
57
|
+
|
|
58
|
+
```typescript
|
|
59
|
+
import { SQLEditor } from "@rebasepro/studio/components/SQLEditor/SQLEditor";
|
|
99
60
|
```
|
|
100
61
|
|
|
101
|
-
##
|
|
102
|
-
|
|
103
|
-
You can combine collections defined in code with those created in the UI:
|
|
62
|
+
## Quick Start
|
|
104
63
|
|
|
105
64
|
```tsx
|
|
106
|
-
import {
|
|
107
|
-
|
|
65
|
+
import { RebaseStudio } from "@rebasepro/studio";
|
|
108
66
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
const codeCollections = [productsCollection, ordersCollection];
|
|
112
|
-
|
|
113
|
-
// Merge with collections from the editor UI
|
|
114
|
-
return mergeCollections(codeCollections, collectionConfigController.collections ?? []);
|
|
115
|
-
}, [collectionConfigController.collections]);
|
|
67
|
+
// Inside your Rebase app — enable all 9 tools (default)
|
|
68
|
+
<RebaseStudio />
|
|
116
69
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
// Other options
|
|
120
|
-
});
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
## Firestore Configuration Controller
|
|
124
|
-
|
|
125
|
-
To persist collections in Firestore:
|
|
70
|
+
// Or pick specific tools
|
|
71
|
+
<RebaseStudio tools={["sql", "rls", "storage", "api"]} />
|
|
126
72
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
firebaseApp,
|
|
130
|
-
|
|
131
|
-
// Optional: specify where to save configs (default: "__REBASE/config/collections")
|
|
132
|
-
configPath: "custom/config/path",
|
|
133
|
-
|
|
134
|
-
// Optional: define permissions for collections
|
|
135
|
-
permissions: ({ user }) => ({
|
|
136
|
-
// Your permissions logic
|
|
137
|
-
}),
|
|
138
|
-
|
|
139
|
-
// Optional: custom property configurations
|
|
140
|
-
propertyConfigs: [
|
|
141
|
-
// Custom property types
|
|
142
|
-
]
|
|
143
|
-
});
|
|
73
|
+
// Custom home page
|
|
74
|
+
<RebaseStudio homePage={<MyCustomHomePage />} />
|
|
144
75
|
```
|
|
145
76
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
- Collections created through the editor are stored in Firestore and loaded dynamically
|
|
149
|
-
- The plugin automatically adds UI elements for creating and managing collections
|
|
150
|
-
- For a complete solution, consider using alongside other plugins like data import/export
|
|
77
|
+
### StudioHomePage Props
|
|
151
78
|
|
|
152
|
-
|
|
79
|
+
| Prop | Type | Description |
|
|
80
|
+
|---|---|---|
|
|
81
|
+
| `additionalActions` | `ReactNode` | Extra actions in the top-right area |
|
|
82
|
+
| `additionalChildrenStart` | `ReactNode` | Content before the tool grid |
|
|
83
|
+
| `additionalChildrenEnd` | `ReactNode` | Content after the tool grid |
|
|
84
|
+
| `sections` | `HomePageSection[]` | Extra sections appended to the page |
|
|
85
|
+
| `hiddenGroups` | `string[]` | Groups to hide from the home page |
|
|
153
86
|
|
|
154
|
-
|
|
87
|
+
## Related Packages
|
|
155
88
|
|
|
156
|
-
-
|
|
157
|
-
-
|
|
158
|
-
-
|
|
159
|
-
-
|
|
89
|
+
- `@rebasepro/core` — Bridge, registry, and navigation primitives
|
|
90
|
+
- `@rebasepro/ui` — Component library used by Studio tools
|
|
91
|
+
- `@rebasepro/admin` — The CMS layer (optional peer dep)
|
|
92
|
+
- `@rebasepro/types` — Shared type definitions
|
|
@@ -117,25 +117,12 @@ interface AdminUser {
|
|
|
117
117
|
updatedAt: string;
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
interface RebaseRole {
|
|
121
|
-
id: string;
|
|
122
|
-
name: string;
|
|
123
|
-
isAdmin: boolean;
|
|
124
|
-
defaultPermissions: Record<string, unknown> | null;
|
|
125
|
-
config: Record<string, unknown> | null;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
120
|
interface RebaseAdmin {
|
|
129
121
|
listUsers(): Promise<{ users: AdminUser[] }>;
|
|
130
122
|
getUser(userId: string): Promise<{ user: AdminUser }>;
|
|
131
123
|
createUser(data: { email: string; displayName?: string; password?: string; roles?: string[] }): Promise<{ user: AdminUser }>;
|
|
132
124
|
updateUser(userId: string, data: { email?: string; displayName?: string; password?: string; roles?: string[] }): Promise<{ user: AdminUser }>;
|
|
133
125
|
deleteUser(userId: string): Promise<{ success: boolean }>;
|
|
134
|
-
listRoles(): Promise<{ roles: RebaseRole[] }>;
|
|
135
|
-
getRole(roleId: string): Promise<{ role: RebaseRole }>;
|
|
136
|
-
createRole(data: { id: string; name: string; isAdmin?: boolean; defaultPermissions?: Record<string, unknown>; config?: Record<string, unknown> }): Promise<{ role: RebaseRole }>;
|
|
137
|
-
updateRole(roleId: string, data: { name?: string; isAdmin?: boolean; defaultPermissions?: Record<string, unknown>; config?: Record<string, unknown> }): Promise<{ role: RebaseRole }>;
|
|
138
|
-
deleteRole(roleId: string): Promise<{ success: boolean }>;
|
|
139
126
|
bootstrap(): Promise<{ success: boolean; message: string; user: { uid: string; roles: string[] } }>;
|
|
140
127
|
}
|
|
141
128
|
|
|
@@ -695,7 +682,7 @@ function detectCollectionsInResult(code, resultValue, collections) {
|
|
|
695
682
|
for (const slug of mentionedSlugs) {
|
|
696
683
|
const normalised = toSnakeCase(slug);
|
|
697
684
|
const col = collections.find((c2) => {
|
|
698
|
-
const tableName = c2.table || toSnakeCase(c2.slug);
|
|
685
|
+
const tableName = ("table" in c2 ? c2.table : void 0) || toSnakeCase(c2.slug);
|
|
699
686
|
return c2.slug === slug || tableName === normalised || toSnakeCase(c2.slug) === normalised;
|
|
700
687
|
});
|
|
701
688
|
if (col) {
|
|
@@ -1307,4 +1294,4 @@ function _temp(t0) {
|
|
|
1307
1294
|
export {
|
|
1308
1295
|
JSEditor
|
|
1309
1296
|
};
|
|
1310
|
-
//# sourceMappingURL=JSEditor-
|
|
1297
|
+
//# sourceMappingURL=JSEditor-DfwRLBZg.js.map
|