@rebasepro/auth 0.0.1-canary.0 → 0.0.1-canary.09e5ec5

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/api.d.ts CHANGED
@@ -23,6 +23,15 @@ export declare function login(email: string, password: string): Promise<AuthResp
23
23
  * Login with Google ID token
24
24
  */
25
25
  export declare function googleLogin(idToken: string): Promise<AuthResponse>;
26
+ /**
27
+ * Login with LinkedIn OAuth code
28
+ */
29
+ export declare function linkedinLogin(code: string, redirectUri: string): Promise<AuthResponse>;
30
+ /**
31
+ * Generic OAuth login — works with any provider registered on the backend.
32
+ * The `providerId` is used to build the endpoint: `/api/auth/{providerId}`.
33
+ */
34
+ export declare function oauthLogin(providerId: string, payload: Record<string, unknown>): Promise<AuthResponse>;
26
35
  /**
27
36
  * Refresh access token using refresh token
28
37
  */
@@ -108,8 +117,12 @@ export interface AuthConfigResponse {
108
117
  registrationEnabled: boolean;
109
118
  /** Whether Google OAuth is configured */
110
119
  googleEnabled: boolean;
120
+ /** Whether LinkedIn OAuth is configured */
121
+ linkedinEnabled: boolean;
111
122
  /** Whether email service is configured */
112
123
  emailServiceEnabled: boolean;
124
+ /** Complete list of enabled OAuth provider IDs (e.g. ["google", "github", "discord"]) */
125
+ enabledProviders?: string[];
113
126
  }
114
127
  /**
115
128
  * Fetch auth configuration / status from the backend
@@ -1,20 +1,22 @@
1
- import { CMSView } from "@rebasepro/core";
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): CMSView[];
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/core";
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,39 @@ 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
+ roleId?: string;
41
+ }) => Promise<{
42
+ users: USER[];
43
+ total: number;
44
+ }>;
19
45
  usersError?: Error;
20
46
  rolesError?: Error;
21
47
  bootstrapAdmin?: () => Promise<void>;
22
48
  }
23
49
  export interface BackendUserManagementConfig {
24
50
  /**
25
- * Base API URL for the backend
51
+ * The Rebase Client instance
52
+ */
53
+ client?: any;
54
+ /**
55
+ * Base API URL for the backend (optional, extracted from client if not provided)
26
56
  */
27
- apiUrl: string;
57
+ apiUrl?: string;
28
58
  /**
29
- * Function to get the current auth token
59
+ * Function to get the current auth token (optional, extracted from client if not provided)
30
60
  */
31
- getAuthToken: () => Promise<string>;
61
+ getAuthToken?: () => Promise<string>;
32
62
  /**
33
63
  * Current logged-in user
34
64
  */
@@ -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/backend
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 package for Rebase with PostgreSQL backend
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";