@rebasepro/types 0.2.1 → 0.2.4
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/controllers/auth.d.ts +2 -24
- package/dist/controllers/client.d.ts +0 -3
- package/dist/controllers/collection_registry.d.ts +1 -1
- package/dist/controllers/data.d.ts +21 -0
- package/dist/controllers/data_driver.d.ts +18 -0
- package/dist/controllers/registry.d.ts +5 -4
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/rebase_context.d.ts +1 -1
- package/dist/types/auth_adapter.d.ts +2 -4
- package/dist/types/collections.d.ts +0 -4
- package/dist/types/component_ref.d.ts +1 -1
- package/dist/types/cron.d.ts +1 -1
- package/dist/types/entity_views.d.ts +1 -0
- package/dist/types/export_import.d.ts +1 -1
- package/dist/types/formex.d.ts +2 -2
- package/dist/types/properties.d.ts +2 -2
- package/dist/types/translations.d.ts +28 -12
- package/dist/types/user_management_delegate.d.ts +6 -4
- package/dist/users/roles.d.ts +0 -8
- package/package.json +1 -1
- package/src/controllers/auth.tsx +2 -30
- package/src/controllers/client.ts +2 -3
- package/src/controllers/collection_registry.ts +1 -1
- package/src/controllers/data.ts +25 -0
- package/src/controllers/data_driver.ts +19 -0
- package/src/controllers/registry.ts +5 -4
- package/src/rebase_context.tsx +1 -1
- package/src/types/auth_adapter.ts +2 -4
- package/src/types/collections.ts +1 -4
- package/src/types/component_ref.ts +1 -1
- package/src/types/cron.ts +1 -1
- package/src/types/entity_views.tsx +1 -0
- package/src/types/export_import.ts +1 -1
- package/src/types/formex.ts +2 -2
- package/src/types/properties.ts +2 -2
- package/src/types/translations.ts +28 -12
- package/src/types/user_management_delegate.ts +8 -4
- package/src/users/roles.ts +0 -10
- package/src/controllers/analytics_controller.d.ts +0 -7
- package/src/controllers/auth.d.ts +0 -125
- package/src/controllers/client.d.ts +0 -183
- package/src/controllers/collection_registry.d.ts +0 -46
- package/src/controllers/customization_controller.d.ts +0 -60
- package/src/controllers/data.d.ts +0 -168
- package/src/controllers/data_driver.d.ts +0 -195
- package/src/controllers/database_admin.d.ts +0 -11
- package/src/controllers/dialogs_controller.d.ts +0 -36
- package/src/controllers/effective_role.d.ts +0 -4
- package/src/controllers/email.d.ts +0 -34
- package/src/controllers/index.d.ts +0 -18
- package/src/controllers/local_config_persistence.d.ts +0 -20
- package/src/controllers/navigation.d.ts +0 -225
- package/src/controllers/registry.d.ts +0 -62
- package/src/controllers/side_dialogs_controller.d.ts +0 -67
- package/src/controllers/side_entity_controller.d.ts +0 -97
- package/src/controllers/snackbar.d.ts +0 -24
- package/src/controllers/storage.d.ts +0 -171
- package/src/index.d.ts +0 -4
- package/src/rebase_context.d.ts +0 -122
- package/src/types/auth_adapter.d.ts +0 -354
- package/src/types/backend.d.ts +0 -536
- package/src/types/backend_hooks.d.ts +0 -187
- package/src/types/builders.d.ts +0 -15
- package/src/types/chips.d.ts +0 -5
- package/src/types/collections.d.ts +0 -920
- package/src/types/component_ref.d.ts +0 -47
- package/src/types/cron.d.ts +0 -102
- package/src/types/data_source.d.ts +0 -64
- package/src/types/database_adapter.d.ts +0 -90
- package/src/types/entities.d.ts +0 -145
- package/src/types/entity_actions.d.ts +0 -98
- package/src/types/entity_callbacks.d.ts +0 -173
- package/src/types/entity_link_builder.d.ts +0 -7
- package/src/types/entity_overrides.d.ts +0 -10
- package/src/types/entity_views.d.ts +0 -60
- package/src/types/export_import.d.ts +0 -21
- package/src/types/formex.d.ts +0 -40
- package/src/types/index.d.ts +0 -28
- package/src/types/locales.d.ts +0 -4
- package/src/types/modify_collections.d.ts +0 -5
- package/src/types/plugins.d.ts +0 -282
- package/src/types/properties.d.ts +0 -1160
- package/src/types/property_config.d.ts +0 -70
- package/src/types/relations.d.ts +0 -336
- package/src/types/slots.d.ts +0 -262
- package/src/types/translations.d.ts +0 -882
- package/src/types/user_management_delegate.d.ts +0 -121
- package/src/types/websockets.d.ts +0 -78
- package/src/users/index.d.ts +0 -2
- package/src/users/roles.d.ts +0 -22
- package/src/users/user.d.ts +0 -46
package/dist/users/roles.d.ts
CHANGED
|
@@ -11,12 +11,4 @@ export type Role = {
|
|
|
11
11
|
* If this flag is true, the user can perform any action
|
|
12
12
|
*/
|
|
13
13
|
isAdmin?: boolean;
|
|
14
|
-
/**
|
|
15
|
-
* Permissions related to editing the collections
|
|
16
|
-
*/
|
|
17
|
-
config?: {
|
|
18
|
-
createCollections?: boolean;
|
|
19
|
-
editCollections?: boolean | "own";
|
|
20
|
-
deleteCollections?: boolean | "own";
|
|
21
|
-
};
|
|
22
14
|
};
|
package/package.json
CHANGED
package/src/controllers/auth.tsx
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { StorageSource } from "./storage";
|
|
2
1
|
import { Role, User } from "../users";
|
|
3
|
-
import { RebaseData } from "./data";
|
|
4
2
|
|
|
5
3
|
/**
|
|
6
4
|
* Capabilities advertised by an auth provider.
|
|
@@ -100,6 +98,8 @@ export interface AuthControllerExtended<USER extends User = User, ExtraData = un
|
|
|
100
98
|
emailPasswordLogin?(email: string, password: string): Promise<void>;
|
|
101
99
|
/** Login with Google — accepts an ID token, access token, or authorization code payload */
|
|
102
100
|
googleLogin?: (payload: { idToken: string } | { accessToken: string } | { code: string; redirectUri: string }) => Promise<void>;
|
|
101
|
+
/** Generic OAuth login — works with any provider. Posts payload to /auth/{providerId}. */
|
|
102
|
+
oauthLogin?: (providerId: string, payload: Record<string, unknown>) => Promise<void>;
|
|
103
103
|
/** Register a new user */
|
|
104
104
|
register?(email: string, password: string, displayName?: string): Promise<void>;
|
|
105
105
|
/** Skip login (for anonymous access if enabled) */
|
|
@@ -113,31 +113,3 @@ export interface AuthControllerExtended<USER extends User = User, ExtraData = un
|
|
|
113
113
|
/** Update user profile */
|
|
114
114
|
updateProfile?(displayName?: string, photoURL?: string): Promise<USER>;
|
|
115
115
|
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Implement this function to allow access to specific users.
|
|
119
|
-
* @group Hooks and utilities
|
|
120
|
-
*/
|
|
121
|
-
export type Authenticator<USER extends User = User> = (props: {
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* Logged-in user or null
|
|
125
|
-
*/
|
|
126
|
-
user: USER | null;
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* AuthController
|
|
130
|
-
*/
|
|
131
|
-
authController: AuthController<USER>;
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Unified data access API
|
|
135
|
-
*/
|
|
136
|
-
data: RebaseData;
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* Used storage implementation
|
|
140
|
-
*/
|
|
141
|
-
storageSource: StorageSource;
|
|
142
|
-
|
|
143
|
-
}) => boolean | Promise<boolean>;
|
|
@@ -75,7 +75,6 @@ export interface AdminRole {
|
|
|
75
75
|
name: string;
|
|
76
76
|
isAdmin: boolean;
|
|
77
77
|
defaultPermissions: Record<string, unknown> | null;
|
|
78
|
-
config: Record<string, unknown> | null;
|
|
79
78
|
}
|
|
80
79
|
|
|
81
80
|
/**
|
|
@@ -98,8 +97,8 @@ export interface AdminAPI {
|
|
|
98
97
|
deleteUser(userId: string): Promise<{ success: boolean }>;
|
|
99
98
|
listRoles(): Promise<{ roles: AdminRole[] }>;
|
|
100
99
|
getRole(roleId: string): Promise<{ role: AdminRole }>;
|
|
101
|
-
createRole(data: { id: string; name: string; isAdmin?: boolean; defaultPermissions?: Record<string, unknown
|
|
102
|
-
updateRole(roleId: string, data: { name?: string; isAdmin?: boolean; defaultPermissions?: Record<string, unknown
|
|
100
|
+
createRole(data: { id: string; name: string; isAdmin?: boolean; defaultPermissions?: Record<string, unknown> }): Promise<{ role: AdminRole }>;
|
|
101
|
+
updateRole(roleId: string, data: { name?: string; isAdmin?: boolean; defaultPermissions?: Record<string, unknown> }): Promise<{ role: AdminRole }>;
|
|
103
102
|
deleteRole(roleId: string): Promise<{ success: boolean }>;
|
|
104
103
|
bootstrap(): Promise<{ success: boolean; message: string; user: { uid: string; roles: string[] } }>;
|
|
105
104
|
}
|
package/src/controllers/data.ts
CHANGED
|
@@ -90,6 +90,23 @@ export interface FindResponse<M extends Record<string, unknown> = Record<string,
|
|
|
90
90
|
};
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
+
export type FilterOperator = WhereFilterOpShort;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Fluent Query Builder Interface supported on both client and server accessors.
|
|
97
|
+
* @group Data
|
|
98
|
+
*/
|
|
99
|
+
export interface QueryBuilderInterface<M extends Record<string, unknown> = Record<string, unknown>> {
|
|
100
|
+
where(column: keyof M & string, operator: FilterOperator, value: unknown): this;
|
|
101
|
+
orderBy(column: keyof M & string, ascending?: "asc" | "desc"): this;
|
|
102
|
+
limit(count: number): this;
|
|
103
|
+
offset(count: number): this;
|
|
104
|
+
search(searchString: string): this;
|
|
105
|
+
include(...relations: string[]): this;
|
|
106
|
+
find(): Promise<FindResponse<M>>;
|
|
107
|
+
listen(onUpdate: (data: FindResponse<M>) => void, onError?: (error: Error) => void): () => void;
|
|
108
|
+
}
|
|
109
|
+
|
|
93
110
|
/**
|
|
94
111
|
* A single collection's CRUD accessor.
|
|
95
112
|
*
|
|
@@ -145,6 +162,14 @@ export interface CollectionAccessor<M extends Record<string, unknown> = Record<s
|
|
|
145
162
|
* Count the number of records matching the given filter.
|
|
146
163
|
*/
|
|
147
164
|
count?(params?: FindParams): Promise<number>;
|
|
165
|
+
|
|
166
|
+
// Fluent Query Builder
|
|
167
|
+
where(column: keyof M & string, operator: FilterOperator, value: unknown): QueryBuilderInterface<M>;
|
|
168
|
+
orderBy(column: keyof M & string, ascending?: "asc" | "desc"): QueryBuilderInterface<M>;
|
|
169
|
+
limit(count: number): QueryBuilderInterface<M>;
|
|
170
|
+
offset(count: number): QueryBuilderInterface<M>;
|
|
171
|
+
search(searchString: string): QueryBuilderInterface<M>;
|
|
172
|
+
include(...relations: string[]): QueryBuilderInterface<M>;
|
|
148
173
|
}
|
|
149
174
|
|
|
150
175
|
/**
|
|
@@ -24,6 +24,22 @@ export type ListenEntityProps<M extends Record<string, unknown> = Record<string,
|
|
|
24
24
|
onError?: (error: Error) => void,
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
/**
|
|
28
|
+
* Configuration for vector similarity search queries.
|
|
29
|
+
* Vector search applies an ORDER BY distance expression and optionally
|
|
30
|
+
* filters results by a distance threshold.
|
|
31
|
+
*/
|
|
32
|
+
export interface VectorSearchParams {
|
|
33
|
+
/** Property name containing the vector column */
|
|
34
|
+
property: string;
|
|
35
|
+
/** Query vector to compare against */
|
|
36
|
+
vector: number[];
|
|
37
|
+
/** Distance function (default: "cosine") */
|
|
38
|
+
distance?: "cosine" | "l2" | "inner_product";
|
|
39
|
+
/** Only return results within this distance threshold */
|
|
40
|
+
threshold?: number;
|
|
41
|
+
}
|
|
42
|
+
|
|
27
43
|
/**
|
|
28
44
|
* @internal
|
|
29
45
|
*/
|
|
@@ -37,6 +53,8 @@ export interface FetchCollectionProps<M extends Record<string, unknown> = Record
|
|
|
37
53
|
orderBy?: string;
|
|
38
54
|
searchString?: string;
|
|
39
55
|
order?: "desc" | "asc";
|
|
56
|
+
/** Vector similarity search configuration */
|
|
57
|
+
vectorSearch?: VectorSearchParams;
|
|
40
58
|
}
|
|
41
59
|
|
|
42
60
|
/**
|
|
@@ -240,6 +258,7 @@ export interface RestFetchService {
|
|
|
240
258
|
startAfter?: Record<string, unknown>;
|
|
241
259
|
searchString?: string;
|
|
242
260
|
databaseId?: string;
|
|
261
|
+
vectorSearch?: VectorSearchParams;
|
|
243
262
|
},
|
|
244
263
|
include?: string[]
|
|
245
264
|
): Promise<Record<string, unknown>[]>;
|
|
@@ -4,6 +4,7 @@ import type { EntityCollectionsBuilder } from "../types/builders";
|
|
|
4
4
|
import type { EntityCustomView } from "../types/entity_views";
|
|
5
5
|
import type { EntityAction } from "../types/entity_actions";
|
|
6
6
|
import type { AppView, NavigationGroupMapping } from "./navigation";
|
|
7
|
+
import type { RebasePlugin } from "../types/plugins";
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Options to enable the built-in collection editor.
|
|
@@ -21,12 +22,12 @@ export interface CollectionEditorOptions {
|
|
|
21
22
|
pathSuggestions?: string[];
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
export interface RebaseCMSConfig<EC extends EntityCollection =
|
|
25
|
+
export interface RebaseCMSConfig<EC extends EntityCollection = EntityCollection> {
|
|
25
26
|
collections?: EC[] | EntityCollectionsBuilder<EC>;
|
|
26
27
|
homePage?: ReactNode;
|
|
27
|
-
entityViews?: EntityCustomView
|
|
28
|
+
entityViews?: EntityCustomView[];
|
|
28
29
|
entityActions?: EntityAction[];
|
|
29
|
-
plugins?:
|
|
30
|
+
plugins?: RebasePlugin[];
|
|
30
31
|
|
|
31
32
|
/**
|
|
32
33
|
* Centralized configuration for how collections and views are grouped
|
|
@@ -47,7 +48,7 @@ export interface RebaseCMSConfig<EC extends EntityCollection = any> {
|
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
export interface RebaseStudioConfig {
|
|
50
|
-
tools?: ("sql" | "js" | "rls" | "schema" | "storage" | "cron" | "schema-visualizer" | "branches" | "api")[];
|
|
51
|
+
tools?: ("sql" | "js" | "rls" | "schema" | "storage" | "cron" | "schema-visualizer" | "branches" | "api" | "logs")[];
|
|
51
52
|
homePage?: ReactNode;
|
|
52
53
|
devViews?: AppView[];
|
|
53
54
|
}
|
package/src/rebase_context.tsx
CHANGED
|
@@ -32,7 +32,7 @@ export type RebaseCallContext<USER extends User = User> = {
|
|
|
32
32
|
* const { client } = props.context;
|
|
33
33
|
* const result = await client.functions.invoke('extract-job', { url });
|
|
34
34
|
*/
|
|
35
|
-
client: RebaseClient
|
|
35
|
+
client: RebaseClient;
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
38
|
* Unified data access — `context.data.products.create(...)`.
|
|
@@ -149,7 +149,7 @@ export interface AuthUserData {
|
|
|
149
149
|
displayName?: string | null;
|
|
150
150
|
photoUrl?: string | null;
|
|
151
151
|
emailVerified?: boolean;
|
|
152
|
-
metadata?: Record<string,
|
|
152
|
+
metadata?: Record<string, unknown>;
|
|
153
153
|
createdAt?: Date;
|
|
154
154
|
updatedAt?: Date;
|
|
155
155
|
}
|
|
@@ -163,7 +163,7 @@ export interface AuthCreateUserData {
|
|
|
163
163
|
password?: string;
|
|
164
164
|
displayName?: string;
|
|
165
165
|
photoUrl?: string;
|
|
166
|
-
metadata?: Record<string,
|
|
166
|
+
metadata?: Record<string, unknown>;
|
|
167
167
|
}
|
|
168
168
|
|
|
169
169
|
/**
|
|
@@ -186,7 +186,6 @@ export interface AuthRoleData {
|
|
|
186
186
|
edit?: boolean;
|
|
187
187
|
delete?: boolean;
|
|
188
188
|
}> | null;
|
|
189
|
-
config?: Record<string, unknown> | null;
|
|
190
189
|
}
|
|
191
190
|
|
|
192
191
|
/**
|
|
@@ -199,7 +198,6 @@ export interface AuthCreateRoleData {
|
|
|
199
198
|
isAdmin?: boolean;
|
|
200
199
|
defaultPermissions?: AuthRoleData["defaultPermissions"];
|
|
201
200
|
collectionPermissions?: AuthRoleData["collectionPermissions"];
|
|
202
|
-
config?: AuthRoleData["config"];
|
|
203
201
|
}
|
|
204
202
|
|
|
205
203
|
/**
|
package/src/types/collections.ts
CHANGED
|
@@ -716,10 +716,7 @@ export interface FilterPreset<Key extends string = string> {
|
|
|
716
716
|
sort?: [Key, "asc" | "desc"];
|
|
717
717
|
}
|
|
718
718
|
|
|
719
|
-
|
|
720
|
-
* @deprecated Use {@link FilterPreset} instead.
|
|
721
|
-
*/
|
|
722
|
-
export type QuickFilter<Key extends string = string> = FilterPreset<Key>;
|
|
719
|
+
|
|
723
720
|
|
|
724
721
|
/**
|
|
725
722
|
* Used to indicate valid filter combinations (e.g. created in Firestore)
|
|
@@ -37,7 +37,7 @@ export interface LazyComponentRef<P = unknown> {
|
|
|
37
37
|
*
|
|
38
38
|
* @group Types
|
|
39
39
|
*/
|
|
40
|
-
export type ComponentRef<P =
|
|
40
|
+
export type ComponentRef<P = any> =
|
|
41
41
|
| React.ComponentType<P>
|
|
42
42
|
| LazyComponentRef<P>
|
|
43
43
|
| (() => Promise<{ default: React.ComponentType<P> }>)
|
package/src/types/cron.ts
CHANGED
|
@@ -61,7 +61,7 @@ export interface CronJobContext {
|
|
|
61
61
|
log: (...args: unknown[]) => void;
|
|
62
62
|
|
|
63
63
|
/** The RebaseClient instance to interact with the database. */
|
|
64
|
-
client: RebaseClient
|
|
64
|
+
client: RebaseClient;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
// =============================================================================
|
|
@@ -66,6 +66,7 @@ export interface FormContext<M extends Record<string, unknown> = Record<string,
|
|
|
66
66
|
export type EntityCustomView<M extends Record<string, unknown> = Record<string, unknown>> = {
|
|
67
67
|
key: string;
|
|
68
68
|
name: string;
|
|
69
|
+
icon?: string | React.ReactNode;
|
|
69
70
|
tabComponent?: React.ReactNode;
|
|
70
71
|
includeActions?: boolean | "bottom";
|
|
71
72
|
Builder?: ComponentRef<EntityCustomViewParams<M>>;
|
package/src/types/formex.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { FormEvent } from "react";
|
|
2
2
|
|
|
3
|
-
export type FormexController<T =
|
|
3
|
+
export type FormexController<T = unknown> = {
|
|
4
4
|
values: T;
|
|
5
5
|
initialValues: T;
|
|
6
6
|
setValues: (values: T) => void;
|
|
@@ -37,7 +37,7 @@ export type FormexController<T = any> = {
|
|
|
37
37
|
canRedo: boolean;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
export type FormexResetProps<T =
|
|
40
|
+
export type FormexResetProps<T = unknown> = {
|
|
41
41
|
values?: T;
|
|
42
42
|
submitCount?: number;
|
|
43
43
|
errors?: Record<string, string>;
|
package/src/types/properties.ts
CHANGED
|
@@ -152,8 +152,8 @@ export interface BaseUIConfig<CustomProps = unknown> {
|
|
|
152
152
|
disabled?: boolean | PropertyDisabledConfig;
|
|
153
153
|
widthPercentage?: number;
|
|
154
154
|
customProps?: CustomProps;
|
|
155
|
-
Field?: ComponentRef
|
|
156
|
-
Preview?: ComponentRef
|
|
155
|
+
Field?: ComponentRef;
|
|
156
|
+
Preview?: ComponentRef;
|
|
157
157
|
}
|
|
158
158
|
|
|
159
159
|
export interface BaseProperty<CustomProps = unknown> {
|
|
@@ -121,6 +121,12 @@ export interface RebaseTranslations {
|
|
|
121
121
|
navigation_drawer: string;
|
|
122
122
|
collapse: string;
|
|
123
123
|
expand: string;
|
|
124
|
+
/** Tooltip for the language switcher in the drawer footer */
|
|
125
|
+
change_language?: string;
|
|
126
|
+
/** Tooltip for the theme toggle in the drawer footer */
|
|
127
|
+
toggle_theme?: string;
|
|
128
|
+
/** Aria label for the user menu trigger in the drawer footer */
|
|
129
|
+
user_menu?: string;
|
|
124
130
|
|
|
125
131
|
// ─── Error states ─────────────────────────────────────────────
|
|
126
132
|
error: string;
|
|
@@ -486,18 +492,28 @@ export interface RebaseTranslations {
|
|
|
486
492
|
|
|
487
493
|
select_reference: string;
|
|
488
494
|
select_references: string;
|
|
489
|
-
account_settings
|
|
490
|
-
profile
|
|
491
|
-
sessions
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
495
|
+
account_settings?: string;
|
|
496
|
+
profile?: string;
|
|
497
|
+
sessions?: string;
|
|
498
|
+
security?: string;
|
|
499
|
+
change_password?: string;
|
|
500
|
+
current_password?: string;
|
|
501
|
+
new_password?: string;
|
|
502
|
+
confirm_password?: string;
|
|
503
|
+
password_changed?: string;
|
|
504
|
+
passwords_dont_match?: string;
|
|
505
|
+
password_too_short?: string;
|
|
506
|
+
password_change_not_available?: string;
|
|
507
|
+
changing_password?: string;
|
|
508
|
+
display_name?: string;
|
|
509
|
+
photo_url?: string;
|
|
510
|
+
save_profile?: string;
|
|
511
|
+
saving?: string;
|
|
512
|
+
no_active_sessions?: string;
|
|
513
|
+
revoking?: string;
|
|
514
|
+
revoke_all_sessions?: string;
|
|
515
|
+
unknown_device?: string;
|
|
516
|
+
current?: string;
|
|
501
517
|
role_id: string;
|
|
502
518
|
role_name: string;
|
|
503
519
|
add_reference: string;
|
|
@@ -120,10 +120,7 @@ export interface UserManagementDelegate<USER extends User = User> {
|
|
|
120
120
|
*/
|
|
121
121
|
allowDefaultRolesCreation?: boolean;
|
|
122
122
|
|
|
123
|
-
|
|
124
|
-
* Should collection config permissions be included?
|
|
125
|
-
*/
|
|
126
|
-
includeCollectionConfigPermissions?: boolean;
|
|
123
|
+
|
|
127
124
|
|
|
128
125
|
|
|
129
126
|
/**
|
|
@@ -132,6 +129,13 @@ export interface UserManagementDelegate<USER extends User = User> {
|
|
|
132
129
|
*/
|
|
133
130
|
defineRolesFor?: (user: USER) => Promise<Role[] | undefined> | Role[] | undefined;
|
|
134
131
|
|
|
132
|
+
/**
|
|
133
|
+
* Whether any admin users exist. Used by the bootstrap banner to decide
|
|
134
|
+
* whether to prompt. Populated via a lightweight check (e.g. `limit=1`
|
|
135
|
+
* query) instead of loading all users.
|
|
136
|
+
*/
|
|
137
|
+
hasAdminUsers?: boolean;
|
|
138
|
+
|
|
135
139
|
/**
|
|
136
140
|
* Optional function to bootstrap an admin user.
|
|
137
141
|
* Often used when the database is empty.
|
package/src/users/roles.ts
CHANGED
|
@@ -18,15 +18,5 @@ export type Role = {
|
|
|
18
18
|
isAdmin?: boolean;
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
/**
|
|
22
|
-
* Permissions related to editing the collections
|
|
23
|
-
*/
|
|
24
|
-
config?: {
|
|
25
|
-
|
|
26
|
-
createCollections?: boolean;
|
|
27
|
-
|
|
28
|
-
editCollections?: boolean | "own";
|
|
29
21
|
|
|
30
|
-
deleteCollections?: boolean | "own";
|
|
31
|
-
}
|
|
32
22
|
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export type AnalyticsController = {
|
|
2
|
-
/**
|
|
3
|
-
* Callback used to get analytics events from the CMS
|
|
4
|
-
*/
|
|
5
|
-
onAnalyticsEvent?: (event: AnalyticsEvent, data?: object) => void;
|
|
6
|
-
};
|
|
7
|
-
export type AnalyticsEvent = "entity_click" | "entity_click_from_reference" | "reference_selection_clear" | "reference_selection_toggle" | "reference_selected_single" | "reference_selection_new_entity" | "edit_entity_clicked" | "entity_edited" | "new_entity_click" | "new_entity_saved" | "copy_entity_click" | "entity_copied" | "single_delete_dialog_open" | "multiple_delete_dialog_open" | "single_entity_deleted" | "multiple_entities_deleted" | "drawer_navigate_to_home" | "drawer_navigate_to_collection" | "drawer_navigate_to_view" | "home_navigate_to_collection" | "home_favorite_navigate_to_collection" | "home_navigate_to_view" | "home_navigate_to_admin_view" | "home_favorite_navigate_to_view" | "home_move_card" | "home_move_group" | "home_drop_new_group" | "collection_inline_editing" | "view_mode_changed" | "kanban_card_moved" | "kanban_column_reorder" | "kanban_property_changed" | "kanban_new_entity_in_column" | "kanban_backfill_order" | "card_view_entity_click" | "unmapped_event";
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import { StorageSource } from "./storage";
|
|
2
|
-
import { Role, User } from "../users";
|
|
3
|
-
import { RebaseData } from "./data";
|
|
4
|
-
/**
|
|
5
|
-
* Capabilities advertised by an auth provider.
|
|
6
|
-
* UI components use this to show/hide features dynamically
|
|
7
|
-
* (e.g. password reset, registration, session management).
|
|
8
|
-
* @group Hooks and utilities
|
|
9
|
-
*/
|
|
10
|
-
export interface AuthCapabilities {
|
|
11
|
-
emailPasswordLogin?: boolean;
|
|
12
|
-
googleLogin?: boolean;
|
|
13
|
-
registration?: boolean;
|
|
14
|
-
passwordReset?: boolean;
|
|
15
|
-
sessionManagement?: boolean;
|
|
16
|
-
profileUpdate?: boolean;
|
|
17
|
-
emailVerification?: boolean;
|
|
18
|
-
/** List of enabled OAuth provider IDs (e.g. ["google", "github", "discord"]) */
|
|
19
|
-
enabledProviders?: string[];
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Controller for retrieving the logged user or performing auth related operations.
|
|
23
|
-
* Note that if you are implementing your AuthController, you probably will want
|
|
24
|
-
* to do it as the result of a hook.
|
|
25
|
-
* @group Hooks and utilities
|
|
26
|
-
*/
|
|
27
|
-
export type AuthController<USER extends User = User, ExtraData = unknown> = {
|
|
28
|
-
/**
|
|
29
|
-
* The user currently logged in
|
|
30
|
-
* The values can be: the user object, null if they skipped login
|
|
31
|
-
*/
|
|
32
|
-
user: USER | null;
|
|
33
|
-
/**
|
|
34
|
-
* Initial loading flag. It is used not to display the login screen
|
|
35
|
-
* when the app first loads, and it has not been checked whether the user
|
|
36
|
-
* is logged in or not.
|
|
37
|
-
*/
|
|
38
|
-
initialLoading?: boolean;
|
|
39
|
-
/**
|
|
40
|
-
* Loading flag. It is used to display a loading screen when the user is
|
|
41
|
-
* logging in or out.
|
|
42
|
-
*/
|
|
43
|
-
authLoading: boolean;
|
|
44
|
-
/**
|
|
45
|
-
* Sign out
|
|
46
|
-
*/
|
|
47
|
-
signOut: () => Promise<void>;
|
|
48
|
-
/**
|
|
49
|
-
* Error initializing the authentication
|
|
50
|
-
*/
|
|
51
|
-
authError?: unknown;
|
|
52
|
-
/**
|
|
53
|
-
* Error dispatched by the auth provider
|
|
54
|
-
*/
|
|
55
|
-
authProviderError?: unknown;
|
|
56
|
-
/**
|
|
57
|
-
* You can use this method to retrieve the auth token for the current user.
|
|
58
|
-
*/
|
|
59
|
-
getAuthToken: () => Promise<string>;
|
|
60
|
-
/**
|
|
61
|
-
* Has the user skipped the login process
|
|
62
|
-
*/
|
|
63
|
-
loginSkipped: boolean;
|
|
64
|
-
extra: ExtraData;
|
|
65
|
-
setExtra: (extra: ExtraData) => void;
|
|
66
|
-
setUser?(user: USER | null): void;
|
|
67
|
-
setUserRoles?(roles: Role[]): void;
|
|
68
|
-
/**
|
|
69
|
-
* Capabilities advertised by the auth provider.
|
|
70
|
-
* UI components use this to feature-detect what the backend supports.
|
|
71
|
-
*/
|
|
72
|
-
capabilities?: AuthCapabilities;
|
|
73
|
-
};
|
|
74
|
-
/**
|
|
75
|
-
* Extended auth controller with common optional auth methods.
|
|
76
|
-
* Backend implementations (Rebase backend, Firebase, Supabase, etc.)
|
|
77
|
-
* extend this with their own backend-specific extras.
|
|
78
|
-
* @group Hooks and utilities
|
|
79
|
-
*/
|
|
80
|
-
export interface AuthControllerExtended<USER extends User = User, ExtraData = unknown> extends AuthController<USER, ExtraData> {
|
|
81
|
-
/** Login with email and password */
|
|
82
|
-
emailPasswordLogin?(email: string, password: string): Promise<void>;
|
|
83
|
-
/** Login with a Google token or authorization code */
|
|
84
|
-
googleLogin?: {
|
|
85
|
-
(token: string, tokenType?: "idToken" | "accessToken"): Promise<void>;
|
|
86
|
-
(payload: {
|
|
87
|
-
code: string;
|
|
88
|
-
redirectUri: string;
|
|
89
|
-
}): Promise<void>;
|
|
90
|
-
};
|
|
91
|
-
/** Register a new user */
|
|
92
|
-
register?(email: string, password: string, displayName?: string): Promise<void>;
|
|
93
|
-
/** Skip login (for anonymous access if enabled) */
|
|
94
|
-
skipLogin?(): void;
|
|
95
|
-
/** Request password reset email */
|
|
96
|
-
forgotPassword?(email: string): Promise<void>;
|
|
97
|
-
/** Reset password using a token */
|
|
98
|
-
resetPassword?(token: string, password: string): Promise<void>;
|
|
99
|
-
/** Change password for the authenticated user */
|
|
100
|
-
changePassword?(oldPassword: string, newPassword: string): Promise<void>;
|
|
101
|
-
/** Update user profile */
|
|
102
|
-
updateProfile?(displayName?: string, photoURL?: string): Promise<USER>;
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Implement this function to allow access to specific users.
|
|
106
|
-
* @group Hooks and utilities
|
|
107
|
-
*/
|
|
108
|
-
export type Authenticator<USER extends User = User> = (props: {
|
|
109
|
-
/**
|
|
110
|
-
* Logged-in user or null
|
|
111
|
-
*/
|
|
112
|
-
user: USER | null;
|
|
113
|
-
/**
|
|
114
|
-
* AuthController
|
|
115
|
-
*/
|
|
116
|
-
authController: AuthController<USER>;
|
|
117
|
-
/**
|
|
118
|
-
* Unified data access API
|
|
119
|
-
*/
|
|
120
|
-
data: RebaseData;
|
|
121
|
-
/**
|
|
122
|
-
* Used storage implementation
|
|
123
|
-
*/
|
|
124
|
-
storageSource: StorageSource;
|
|
125
|
-
}) => boolean | Promise<boolean>;
|