@ram_28/kf-ai-sdk 1.0.1 → 1.0.2

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 CHANGED
@@ -15,6 +15,7 @@ npm install react @tanstack/react-query
15
15
 
16
16
  ## Features
17
17
 
18
+ - **Authentication** - Cookie-based auth with AuthProvider and useAuth hook
18
19
  - **useForm** - Dynamic schema-driven forms with backend validation
19
20
  - **useTable** - Data tables with sorting, pagination, and React Query integration
20
21
  - **useKanban** - Kanban board state management with drag-drop support
@@ -27,12 +28,22 @@ npm install react @tanstack/react-query
27
28
 
28
29
  ```tsx
29
30
  import {
31
+ // Authentication
32
+ AuthProvider,
33
+ useAuth,
34
+ configureAuth,
35
+
36
+ // Hooks
30
37
  useForm,
31
38
  useTable,
32
39
  useKanban,
33
40
  useFilter,
41
+
42
+ // API
34
43
  api,
35
44
  setApiBaseUrl,
45
+
46
+ // Utilities
36
47
  formatCurrency,
37
48
  formatDate
38
49
  } from '@ram_28/kf-ai-sdk';
@@ -41,6 +52,147 @@ import {
41
52
  setApiBaseUrl('https://api.example.com');
42
53
  ```
43
54
 
55
+ ## Authentication
56
+
57
+ The SDK provides a complete authentication solution with cookie-based session management.
58
+
59
+ ### Setup
60
+
61
+ Wrap your app with `AuthProvider` inside a `QueryClientProvider`:
62
+
63
+ ```tsx
64
+ import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
65
+ import { AuthProvider, setApiBaseUrl, configureAuth } from '@ram_28/kf-ai-sdk';
66
+
67
+ // Configure API
68
+ setApiBaseUrl('https://api.example.com');
69
+
70
+ // Optional: customize auth settings
71
+ configureAuth({
72
+ defaultProvider: 'google',
73
+ autoRedirect: true,
74
+ providers: {
75
+ google: {
76
+ loginPath: '/api/auth/google/login',
77
+ logoutPath: '/api/auth/logout',
78
+ },
79
+ },
80
+ });
81
+
82
+ const queryClient = new QueryClient();
83
+
84
+ function App() {
85
+ return (
86
+ <QueryClientProvider client={queryClient}>
87
+ <AuthProvider
88
+ loadingComponent={<div>Loading...</div>}
89
+ onAuthChange={(status, user) => console.log('Auth:', status, user)}
90
+ >
91
+ <MyApp />
92
+ </AuthProvider>
93
+ </QueryClientProvider>
94
+ );
95
+ }
96
+ ```
97
+
98
+ ### useAuth Hook
99
+
100
+ Access authentication state and operations in any component:
101
+
102
+ ```tsx
103
+ import { useAuth } from '@ram_28/kf-ai-sdk';
104
+
105
+ function UserMenu() {
106
+ const { user, isAuthenticated, isLoading, logout, hasRole } = useAuth();
107
+
108
+ if (isLoading) return <div>Loading...</div>;
109
+ if (!isAuthenticated) return null;
110
+
111
+ return (
112
+ <div>
113
+ <span>Welcome, {user._name}</span>
114
+ <span>Role: {user.Role}</span>
115
+
116
+ {hasRole('Admin') && <a href="/admin">Admin Dashboard</a>}
117
+
118
+ <button onClick={() => logout({ redirectUrl: '/' })}>
119
+ Logout
120
+ </button>
121
+ </div>
122
+ );
123
+ }
124
+ ```
125
+
126
+ ### useAuth Return Values
127
+
128
+ ```tsx
129
+ const {
130
+ // User state
131
+ user, // UserDetails | null
132
+ staticBaseUrl, // string | null
133
+ buildId, // string | null
134
+ status, // 'loading' | 'authenticated' | 'unauthenticated'
135
+ isAuthenticated, // boolean
136
+ isLoading, // boolean
137
+
138
+ // Operations
139
+ login, // (provider?, options?) => void
140
+ logout, // (options?) => Promise<void>
141
+ refreshSession, // () => Promise<SessionResponse | null>
142
+ hasRole, // (role: string) => boolean
143
+ hasAnyRole, // (roles: string[]) => boolean
144
+
145
+ // Error handling
146
+ error, // Error | null
147
+ clearError, // () => void
148
+ } = useAuth();
149
+ ```
150
+
151
+ ### Multiple Auth Providers
152
+
153
+ ```tsx
154
+ import { useAuth } from '@ram_28/kf-ai-sdk';
155
+
156
+ function LoginPage() {
157
+ const { login } = useAuth();
158
+
159
+ return (
160
+ <div>
161
+ <button onClick={() => login('google')}>
162
+ Continue with Google
163
+ </button>
164
+ <button onClick={() => login('microsoft')}>
165
+ Continue with Microsoft
166
+ </button>
167
+ </div>
168
+ );
169
+ }
170
+ ```
171
+
172
+ ### Protected Routes
173
+
174
+ ```tsx
175
+ import { useAuth } from '@ram_28/kf-ai-sdk';
176
+ import { Navigate } from 'react-router-dom';
177
+
178
+ function ProtectedRoute({ children, requiredRoles }) {
179
+ const { isAuthenticated, isLoading, hasAnyRole } = useAuth();
180
+
181
+ if (isLoading) return <div>Loading...</div>;
182
+ if (!isAuthenticated) return <Navigate to="/login" />;
183
+ if (requiredRoles && !hasAnyRole(requiredRoles)) {
184
+ return <Navigate to="/unauthorized" />;
185
+ }
186
+
187
+ return children;
188
+ }
189
+
190
+ // Usage
191
+ <ProtectedRoute requiredRoles={['Admin', 'Manager']}>
192
+ <AdminDashboard />
193
+ </ProtectedRoute>
194
+ ```
195
+
44
196
  ## Hooks
45
197
 
46
198
  ### useTable
@@ -310,8 +462,9 @@ cn('text-red-500', condition && 'text-blue-500');
310
462
 
311
463
  ## Documentation
312
464
 
313
- Detailed documentation for each hook:
465
+ Detailed documentation for each feature:
314
466
 
467
+ - [Authentication Documentation](./docs/useAuth.md)
315
468
  - [useForm Documentation](./docs/useForm.md)
316
469
  - [useTable Documentation](./docs/useTable.md)
317
470
  - [useKanban Documentation](./docs/useKanban.md)
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ import type { AuthContextValue, AuthProviderProps } from "./types";
3
+ export declare function AuthProvider({ children, config: configOverride, onAuthChange, onError, loadingComponent, unauthenticatedComponent, skipInitialCheck, }: AuthProviderProps): React.ReactElement;
4
+ export declare function useAuthContext(): AuthContextValue;
5
+ //# sourceMappingURL=AuthProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AuthProvider.d.ts","sourceRoot":"","sources":["../../sdk/auth/AuthProvider.tsx"],"names":[],"mappings":"AAKA,OAAO,KAQN,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EACV,gBAAgB,EAChB,iBAAiB,EAOlB,MAAM,SAAS,CAAC;AAsBjB,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,MAAM,EAAE,cAAc,EACtB,YAAY,EACZ,OAAO,EACP,gBAAgB,EAChB,wBAAwB,EACxB,gBAAwB,GACzB,EAAE,iBAAiB,GAAG,KAAK,CAAC,YAAY,CA2MxC;AAMD,wBAAgB,cAAc,IAAI,gBAAgB,CAMjD"}
@@ -0,0 +1,26 @@
1
+ import type { SessionResponse, AuthProviderName, LoginOptions, LogoutOptions } from "./types";
2
+ /**
3
+ * Custom error class for authentication errors
4
+ */
5
+ export declare class AuthenticationError extends Error {
6
+ readonly statusCode: number;
7
+ constructor(message: string, statusCode: number);
8
+ }
9
+ /**
10
+ * Fetch current session from the server
11
+ * Calls the session endpoint (default: /api/id)
12
+ *
13
+ * @throws AuthenticationError if session check fails or user is not authenticated
14
+ */
15
+ export declare function fetchSession(): Promise<SessionResponse>;
16
+ /**
17
+ * Initiate login flow by redirecting to the auth provider
18
+ * The server handles the OAuth flow and sets cookies
19
+ */
20
+ export declare function initiateLogin(provider?: AuthProviderName, options?: LoginOptions): void;
21
+ /**
22
+ * Logout the current user
23
+ * Optionally calls the logout endpoint before clearing client state
24
+ */
25
+ export declare function performLogout(options?: LogoutOptions): Promise<void>;
26
+ //# sourceMappingURL=authClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authClient.d.ts","sourceRoot":"","sources":["../../sdk/auth/authClient.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACd,MAAM,SAAS,CAAC;AAQjB;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,SAAgB,UAAU,EAAE,MAAM,CAAC;gBAEvB,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;CAKhD;AAED;;;;;GAKG;AACH,wBAAsB,YAAY,IAAI,OAAO,CAAC,eAAe,CAAC,CAuB7D;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,CAAC,EAAE,gBAAgB,EAC3B,OAAO,CAAC,EAAE,YAAY,GACrB,IAAI,CA0BN;AAED;;;GAGG;AACH,wBAAsB,aAAa,CAAC,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAyB1E"}
@@ -0,0 +1,38 @@
1
+ import type { AuthConfig, AuthProviderName, AuthEndpointConfig } from "./types";
2
+ /**
3
+ * Configure authentication settings globally
4
+ * @example
5
+ * ```ts
6
+ * configureAuth({
7
+ * defaultProvider: "google",
8
+ * autoRedirect: true,
9
+ * providers: {
10
+ * google: { loginPath: "/api/auth/google/login" },
11
+ * microsoft: { loginPath: "/api/auth/microsoft/login" },
12
+ * },
13
+ * });
14
+ * ```
15
+ */
16
+ export declare function configureAuth(config: Partial<AuthConfig>): void;
17
+ /**
18
+ * Add or update an auth provider configuration
19
+ */
20
+ export declare function setAuthProvider(provider: AuthProviderName, config: AuthEndpointConfig): void;
21
+ /**
22
+ * Get current auth configuration
23
+ */
24
+ export declare function getAuthConfig(): Readonly<AuthConfig>;
25
+ /**
26
+ * Get the base URL for auth endpoints
27
+ * Falls back to API base URL if not explicitly set
28
+ */
29
+ export declare function getAuthBaseUrl(): string;
30
+ /**
31
+ * Get endpoint configuration for a specific provider
32
+ */
33
+ export declare function getProviderConfig(provider: AuthProviderName): AuthEndpointConfig | undefined;
34
+ /**
35
+ * Reset auth configuration to defaults
36
+ */
37
+ export declare function resetAuthConfig(): void;
38
+ //# sourceMappingURL=authConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authConfig.d.ts","sourceRoot":"","sources":["../../sdk/auth/authConfig.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AA6BhF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,IAAI,CAa/D;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,gBAAgB,EAC1B,MAAM,EAAE,kBAAkB,GACzB,IAAI,CAEN;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,QAAQ,CAAC,UAAU,CAAC,CAEpD;AAED;;;GAGG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,gBAAgB,GACzB,kBAAkB,GAAG,SAAS,CAEhC;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,IAAI,CAEtC"}
@@ -0,0 +1,6 @@
1
+ export { AuthProvider } from "./AuthProvider";
2
+ export { useAuth } from "./useAuth";
3
+ export { configureAuth, setAuthProvider, getAuthConfig, getAuthBaseUrl, resetAuthConfig, } from "./authConfig";
4
+ export { fetchSession, initiateLogin, performLogout, AuthenticationError, } from "./authClient";
5
+ export type { UserDetails, SessionResponse, AuthStatus, AuthConfig, AuthProviderName, AuthEndpointConfig, AuthProviderProps, UseAuthReturn, LoginOptions, LogoutOptions, } from "./types";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../sdk/auth/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,EACL,aAAa,EACb,eAAe,EACf,aAAa,EACb,cAAc,EACd,eAAe,GAChB,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,YAAY,EACZ,aAAa,EACb,aAAa,EACb,mBAAmB,GACpB,MAAM,cAAc,CAAC;AAGtB,YAAY,EACV,WAAW,EACX,eAAe,EACf,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,aAAa,GACd,MAAM,SAAS,CAAC"}
@@ -0,0 +1,152 @@
1
+ /**
2
+ * User details returned from the session endpoint
3
+ */
4
+ export interface UserDetails {
5
+ _id: string;
6
+ _name: string;
7
+ Role: string;
8
+ [key: string]: unknown;
9
+ }
10
+ /**
11
+ * Session response from /api/id endpoint
12
+ */
13
+ export interface SessionResponse {
14
+ userDetails: UserDetails;
15
+ staticBaseUrl: string;
16
+ buildId: string;
17
+ }
18
+ /**
19
+ * Authentication status
20
+ */
21
+ export type AuthStatus = "loading" | "authenticated" | "unauthenticated";
22
+ /**
23
+ * Authentication provider type (extensible for multiple OAuth providers)
24
+ */
25
+ export type AuthProviderName = "google" | "microsoft" | "github" | "custom";
26
+ /**
27
+ * Auth endpoint configuration for a specific provider
28
+ */
29
+ export interface AuthEndpointConfig {
30
+ /** Login endpoint path (e.g., "/api/auth/google/login") */
31
+ loginPath: string;
32
+ /** Optional logout endpoint path */
33
+ logoutPath?: string;
34
+ /** Optional callback endpoint path */
35
+ callbackPath?: string;
36
+ }
37
+ /**
38
+ * Global authentication configuration
39
+ */
40
+ export interface AuthConfig {
41
+ /** Base URL for auth endpoints (defaults to apiBaseUrl) */
42
+ baseUrl?: string;
43
+ /** Session check endpoint (default: "/api/id") */
44
+ sessionEndpoint: string;
45
+ /** Auth provider configurations */
46
+ providers: Partial<Record<AuthProviderName, AuthEndpointConfig>>;
47
+ /** Default provider to use for login */
48
+ defaultProvider: AuthProviderName;
49
+ /** Auto-redirect to login when unauthenticated */
50
+ autoRedirect: boolean;
51
+ /** Custom redirect URL (if not using provider's login path) */
52
+ loginRedirectUrl?: string;
53
+ /** URL to redirect after successful login */
54
+ callbackUrl?: string;
55
+ /** Session check interval in milliseconds (0 to disable) */
56
+ sessionCheckInterval: number;
57
+ /** Retry configuration for session check */
58
+ retry: {
59
+ count: number;
60
+ delay: number;
61
+ };
62
+ /** React Query stale time for session data */
63
+ staleTime: number;
64
+ }
65
+ /**
66
+ * AuthProvider component props
67
+ */
68
+ export interface AuthProviderProps {
69
+ children: React.ReactNode;
70
+ /** Override global config for this provider instance */
71
+ config?: Partial<AuthConfig>;
72
+ /** Callback when authentication status changes */
73
+ onAuthChange?: (status: AuthStatus, user: UserDetails | null) => void;
74
+ /** Callback on authentication error */
75
+ onError?: (error: Error) => void;
76
+ /** Custom loading component */
77
+ loadingComponent?: React.ReactNode;
78
+ /** Custom unauthenticated component (shown when autoRedirect is false) */
79
+ unauthenticatedComponent?: React.ReactNode;
80
+ /** Disable automatic session check on mount */
81
+ skipInitialCheck?: boolean;
82
+ }
83
+ /**
84
+ * Options for login operation
85
+ */
86
+ export interface LoginOptions {
87
+ /** URL to redirect after successful login */
88
+ callbackUrl?: string;
89
+ /** Additional query parameters for login URL */
90
+ params?: Record<string, string>;
91
+ }
92
+ /**
93
+ * Options for logout operation
94
+ */
95
+ export interface LogoutOptions {
96
+ /** URL to redirect after logout */
97
+ redirectUrl?: string;
98
+ /** Whether to call logout endpoint (default: true) */
99
+ callLogoutEndpoint?: boolean;
100
+ }
101
+ /**
102
+ * Return type for useAuth hook
103
+ */
104
+ export interface UseAuthReturn {
105
+ /** Current authenticated user (null if not authenticated) */
106
+ user: UserDetails | null;
107
+ /** Static base URL from session */
108
+ staticBaseUrl: string | null;
109
+ /** Build ID from session */
110
+ buildId: string | null;
111
+ /** Current authentication status */
112
+ status: AuthStatus;
113
+ /** Convenience boolean for authenticated state */
114
+ isAuthenticated: boolean;
115
+ /** Convenience boolean for loading state */
116
+ isLoading: boolean;
117
+ /**
118
+ * Initiate login flow
119
+ * @param provider - Auth provider to use (defaults to configured default)
120
+ * @param options - Additional options for login
121
+ */
122
+ login: (provider?: AuthProviderName, options?: LoginOptions) => void;
123
+ /**
124
+ * Logout the current user
125
+ * @param options - Additional options for logout
126
+ */
127
+ logout: (options?: LogoutOptions) => Promise<void>;
128
+ /**
129
+ * Manually refresh the session
130
+ */
131
+ refreshSession: () => Promise<SessionResponse | null>;
132
+ /**
133
+ * Check if user has a specific role
134
+ */
135
+ hasRole: (role: string) => boolean;
136
+ /**
137
+ * Check if user has any of the specified roles
138
+ */
139
+ hasAnyRole: (roles: string[]) => boolean;
140
+ /** Last authentication error */
141
+ error: Error | null;
142
+ /** Clear the current error */
143
+ clearError: () => void;
144
+ }
145
+ /**
146
+ * Auth context value (internal)
147
+ */
148
+ export interface AuthContextValue extends UseAuthReturn {
149
+ /** Internal: force re-check session */
150
+ _forceCheck: () => void;
151
+ }
152
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../sdk/auth/types.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,27 @@
1
+ import type { UseAuthReturn } from "./types";
2
+ /**
3
+ * Hook to access authentication state and operations
4
+ *
5
+ * Must be used within an AuthProvider component.
6
+ *
7
+ * @example
8
+ * ```tsx
9
+ * function UserProfile() {
10
+ * const { user, isAuthenticated, logout } = useAuth();
11
+ *
12
+ * if (!isAuthenticated) {
13
+ * return <div>Please log in</div>;
14
+ * }
15
+ *
16
+ * return (
17
+ * <div>
18
+ * <h1>Welcome, {user._name}</h1>
19
+ * <p>Role: {user.Role}</p>
20
+ * <button onClick={() => logout()}>Logout</button>
21
+ * </div>
22
+ * );
23
+ * }
24
+ * ```
25
+ */
26
+ export declare function useAuth(): UseAuthReturn;
27
+ //# sourceMappingURL=useAuth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAuth.d.ts","sourceRoot":"","sources":["../../sdk/auth/useAuth.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAG7C;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,OAAO,IAAI,aAAa,CAkCvC"}