@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
|
@@ -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>;
|
package/dist/index.es.js
CHANGED
|
@@ -595,10 +595,10 @@ function SyntaxHighlightedSnippet() {
|
|
|
595
595
|
}
|
|
596
596
|
return t49;
|
|
597
597
|
}
|
|
598
|
-
const SQLEditor = lazy(() => import("./SQLEditor-
|
|
598
|
+
const SQLEditor = lazy(() => import("./SQLEditor-CQXaI0iU.js").then((m) => ({
|
|
599
599
|
default: m.SQLEditor
|
|
600
600
|
})));
|
|
601
|
-
const JSEditor = lazy(() => import("./JSEditor-
|
|
601
|
+
const JSEditor = lazy(() => import("./JSEditor-DfwRLBZg.js").then((m) => ({
|
|
602
602
|
default: m.JSEditor
|
|
603
603
|
})));
|
|
604
604
|
const RLSEditor = lazy(() => import("./RLSEditor-CHEExeSB.js").then((m) => ({
|
package/dist/index.umd.js
CHANGED
|
@@ -1090,7 +1090,7 @@ WHERE id = ?;`);
|
|
|
1090
1090
|
const results = [];
|
|
1091
1091
|
for (const table of tables) {
|
|
1092
1092
|
const matched = collections.find((c) => {
|
|
1093
|
-
const tableName = c.table || utils.toSnakeCase(c.slug);
|
|
1093
|
+
const tableName = ("table" in c ? c.table : void 0) || utils.toSnakeCase(c.slug);
|
|
1094
1094
|
return tableName === table.name;
|
|
1095
1095
|
});
|
|
1096
1096
|
if (!matched) continue;
|
|
@@ -2783,25 +2783,12 @@ interface AdminUser {
|
|
|
2783
2783
|
updatedAt: string;
|
|
2784
2784
|
}
|
|
2785
2785
|
|
|
2786
|
-
interface RebaseRole {
|
|
2787
|
-
id: string;
|
|
2788
|
-
name: string;
|
|
2789
|
-
isAdmin: boolean;
|
|
2790
|
-
defaultPermissions: Record<string, unknown> | null;
|
|
2791
|
-
config: Record<string, unknown> | null;
|
|
2792
|
-
}
|
|
2793
|
-
|
|
2794
2786
|
interface RebaseAdmin {
|
|
2795
2787
|
listUsers(): Promise<{ users: AdminUser[] }>;
|
|
2796
2788
|
getUser(userId: string): Promise<{ user: AdminUser }>;
|
|
2797
2789
|
createUser(data: { email: string; displayName?: string; password?: string; roles?: string[] }): Promise<{ user: AdminUser }>;
|
|
2798
2790
|
updateUser(userId: string, data: { email?: string; displayName?: string; password?: string; roles?: string[] }): Promise<{ user: AdminUser }>;
|
|
2799
2791
|
deleteUser(userId: string): Promise<{ success: boolean }>;
|
|
2800
|
-
listRoles(): Promise<{ roles: RebaseRole[] }>;
|
|
2801
|
-
getRole(roleId: string): Promise<{ role: RebaseRole }>;
|
|
2802
|
-
createRole(data: { id: string; name: string; isAdmin?: boolean; defaultPermissions?: Record<string, unknown>; config?: Record<string, unknown> }): Promise<{ role: RebaseRole }>;
|
|
2803
|
-
updateRole(roleId: string, data: { name?: string; isAdmin?: boolean; defaultPermissions?: Record<string, unknown>; config?: Record<string, unknown> }): Promise<{ role: RebaseRole }>;
|
|
2804
|
-
deleteRole(roleId: string): Promise<{ success: boolean }>;
|
|
2805
2792
|
bootstrap(): Promise<{ success: boolean; message: string; user: { uid: string; roles: string[] } }>;
|
|
2806
2793
|
}
|
|
2807
2794
|
|
|
@@ -3458,7 +3445,7 @@ return result;
|
|
|
3458
3445
|
for (const slug of mentionedSlugs) {
|
|
3459
3446
|
const normalised = utils.toSnakeCase(slug);
|
|
3460
3447
|
const col = collections.find((c) => {
|
|
3461
|
-
const tableName = c.table || utils.toSnakeCase(c.slug);
|
|
3448
|
+
const tableName = ("table" in c ? c.table : void 0) || utils.toSnakeCase(c.slug);
|
|
3462
3449
|
return c.slug === slug || tableName === normalised || utils.toSnakeCase(c.slug) === normalised;
|
|
3463
3450
|
});
|
|
3464
3451
|
if (col) {
|