@rebasepro/auth 0.0.1-canary.1 → 0.0.1-canary.4d4fb3e
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/components/AdminViews.d.ts +5 -3
- package/dist/components/RebaseAuth.d.ts +6 -0
- package/dist/components/RebaseLoginView.d.ts +0 -1
- package/dist/hooks/useBackendUserManagement.d.ts +34 -5
- package/dist/hooks/useRebaseAuthController.d.ts +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.es.js +436 -220
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +437 -221
- package/dist/index.umd.js.map +1 -1
- package/dist/types.d.ts +3 -1
- package/package.json +8 -8
- package/src/components/AdminViews.tsx +31 -12
- package/src/components/RebaseAuth.tsx +23 -0
- package/src/components/RebaseLoginView.tsx +331 -209
- package/src/hooks/useBackendUserManagement.ts +147 -35
- package/src/hooks/useRebaseAuthController.ts +44 -6
- package/src/index.ts +7 -2
- package/src/types.ts +3 -1
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AppView, EntityCollection } from "@rebasepro/types";
|
|
2
2
|
import { UserManagement } from "../hooks/useBackendUserManagement";
|
|
3
3
|
interface AdminViewsProps {
|
|
4
4
|
userManagement: UserManagement;
|
|
5
5
|
apiUrl: string;
|
|
6
6
|
getAuthToken: () => Promise<string>;
|
|
7
|
+
collections?: EntityCollection[];
|
|
7
8
|
}
|
|
8
9
|
/**
|
|
9
10
|
* Create admin views for user and role management
|
|
10
11
|
*/
|
|
11
|
-
export declare function createUserManagementAdminViews({ userManagement, apiUrl, getAuthToken }: AdminViewsProps):
|
|
12
|
+
export declare function createUserManagementAdminViews({ userManagement, apiUrl, getAuthToken, collections }: AdminViewsProps): AppView[];
|
|
12
13
|
export declare function UsersView({ userManagement, apiUrl, getAuthToken }: {
|
|
13
14
|
userManagement: UserManagement;
|
|
14
15
|
apiUrl: string;
|
|
15
16
|
getAuthToken: () => Promise<string>;
|
|
16
17
|
}): import("react/jsx-runtime").JSX.Element;
|
|
17
|
-
export declare function RolesView({ userManagement }: {
|
|
18
|
+
export declare function RolesView({ userManagement, collections }: {
|
|
18
19
|
userManagement: UserManagement;
|
|
20
|
+
collections?: EntityCollection[];
|
|
19
21
|
}): import("react/jsx-runtime").JSX.Element;
|
|
20
22
|
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { RebaseAuthConfig } from "@rebasepro/types";
|
|
2
|
+
/**
|
|
3
|
+
* Declarative component to configure authentication in Rebase.
|
|
4
|
+
* Renders nothing — purely registers config into the RebaseRegistry.
|
|
5
|
+
*/
|
|
6
|
+
export declare function RebaseAuth({ loginView }: RebaseAuthConfig): null;
|
|
@@ -47,6 +47,5 @@ export interface RebaseLoginViewProps {
|
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
49
|
* Login view component for custom JWT authentication
|
|
50
|
-
* Based on MongoLoginView pattern from @rebasepro/mongodb
|
|
51
50
|
*/
|
|
52
51
|
export declare function RebaseLoginView({ logo, authController, noUserComponent, disableSignupScreen, disabled, notAllowedError, googleEnabled, googleClientId }: RebaseLoginViewProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Role, User } from "@rebasepro/
|
|
1
|
+
import { Role, User } from "@rebasepro/types";
|
|
2
2
|
/**
|
|
3
3
|
* UserManagement interface - compatible with @rebasepro/user_management
|
|
4
4
|
* Defined inline to avoid dependency on that package
|
|
@@ -7,6 +7,16 @@ export interface UserManagement<USER extends User = User> {
|
|
|
7
7
|
loading: boolean;
|
|
8
8
|
users: USER[];
|
|
9
9
|
saveUser: (user: USER) => Promise<USER>;
|
|
10
|
+
createUser?: (user: USER) => Promise<{
|
|
11
|
+
user: USER;
|
|
12
|
+
invitationSent: boolean;
|
|
13
|
+
temporaryPassword?: string;
|
|
14
|
+
}>;
|
|
15
|
+
resetPassword?: (user: USER) => Promise<{
|
|
16
|
+
user: USER;
|
|
17
|
+
invitationSent: boolean;
|
|
18
|
+
temporaryPassword?: string;
|
|
19
|
+
}>;
|
|
10
20
|
deleteUser: (user: USER) => Promise<void>;
|
|
11
21
|
roles: Role[];
|
|
12
22
|
saveRole: (role: Role) => Promise<void>;
|
|
@@ -16,19 +26,38 @@ export interface UserManagement<USER extends User = User> {
|
|
|
16
26
|
includeCollectionConfigPermissions?: boolean;
|
|
17
27
|
defineRolesFor: (user: User) => Promise<Role[] | undefined> | Role[] | undefined;
|
|
18
28
|
getUser: (uid: string) => User | null;
|
|
29
|
+
/**
|
|
30
|
+
* Search users with server-side pagination.
|
|
31
|
+
* When provided, the CMS will use this for the users table
|
|
32
|
+
* instead of loading all users into memory.
|
|
33
|
+
*/
|
|
34
|
+
searchUsers?: (options: {
|
|
35
|
+
search?: string;
|
|
36
|
+
limit?: number;
|
|
37
|
+
offset?: number;
|
|
38
|
+
orderBy?: string;
|
|
39
|
+
orderDir?: "asc" | "desc";
|
|
40
|
+
}) => Promise<{
|
|
41
|
+
users: USER[];
|
|
42
|
+
total: number;
|
|
43
|
+
}>;
|
|
19
44
|
usersError?: Error;
|
|
20
45
|
rolesError?: Error;
|
|
21
46
|
bootstrapAdmin?: () => Promise<void>;
|
|
22
47
|
}
|
|
23
48
|
export interface BackendUserManagementConfig {
|
|
24
49
|
/**
|
|
25
|
-
*
|
|
50
|
+
* The Rebase Client instance
|
|
51
|
+
*/
|
|
52
|
+
client?: any;
|
|
53
|
+
/**
|
|
54
|
+
* Base API URL for the backend (optional, extracted from client if not provided)
|
|
26
55
|
*/
|
|
27
|
-
apiUrl
|
|
56
|
+
apiUrl?: string;
|
|
28
57
|
/**
|
|
29
|
-
* Function to get the current auth token
|
|
58
|
+
* Function to get the current auth token (optional, extracted from client if not provided)
|
|
30
59
|
*/
|
|
31
|
-
getAuthToken
|
|
60
|
+
getAuthToken?: () => Promise<string>;
|
|
32
61
|
/**
|
|
33
62
|
* Current logged-in user
|
|
34
63
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RebaseAuthController, RebaseAuthControllerProps } from "../types";
|
|
2
2
|
/**
|
|
3
3
|
* Auth controller hook for JWT-based authentication
|
|
4
|
-
* with @rebasepro/
|
|
4
|
+
* with @rebasepro/server-core
|
|
5
5
|
*
|
|
6
6
|
* @param props Configuration options
|
|
7
7
|
* @returns RebaseAuthController instance
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @rebasepro/auth
|
|
3
3
|
*
|
|
4
|
-
* Custom JWT authentication
|
|
4
|
+
* Custom JWT authentication adapter for the Rebase backend.
|
|
5
|
+
* This package provides backend-specific auth hooks and API utilities.
|
|
6
|
+
*
|
|
7
|
+
* For the generic LoginView and RebaseAuth components, see @rebasepro/core.
|
|
5
8
|
*/
|
|
6
9
|
export type { RebaseAuthController, RebaseAuthControllerProps, AuthTokens, UserInfo, AuthResponse, RefreshResponse } from "./types";
|
|
7
10
|
export { useRebaseAuthController } from "./hooks/useRebaseAuthController";
|
|
@@ -9,6 +12,7 @@ export { useBackendUserManagement } from "./hooks/useBackendUserManagement";
|
|
|
9
12
|
export type { BackendUserManagementConfig, UserManagement } from "./hooks/useBackendUserManagement";
|
|
10
13
|
export { RebaseLoginView } from "./components/RebaseLoginView";
|
|
11
14
|
export type { RebaseLoginViewProps } from "./components/RebaseLoginView";
|
|
15
|
+
export { RebaseAuth } from "./components/RebaseAuth";
|
|
12
16
|
export { createUserManagementAdminViews, UsersView, RolesView } from "./components/AdminViews";
|
|
13
17
|
export { setApiUrl, getApiUrl, fetchAuthConfig, AuthApiError } from "./api";
|
|
14
18
|
export type { AuthConfigResponse } from "./api";
|