authmi 1.0.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.
@@ -0,0 +1,68 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode } from 'react';
3
+ import { b as AuthMiConfig, T as TokenStorage, a as AuthMiClient, U as User, V as ValidationResult } from './client-D6JiIhlU.mjs';
4
+ export { A as ApiKey, c as AuthMiError, d as AuthToken, C as CreateApiKeyRequest, e as CreateApiKeyResponse, f as CreateScopeRequest, g as CreateUserRequest, I as IntrospectRequest, h as IntrospectResponse, L as LocalStorageTokenStorage, i as LoginCredentials, M as MemoryTokenStorage, O as OAuthCallbackResult, j as OAuthInitiateResponse, k as OAuthProvider, l as OnboardRequest, m as OnboardResponse, R as RegisterWebhookRequest, S as Scope, n as ScopeError, o as Service, p as UserListResponse, W as Webhook } from './client-D6JiIhlU.mjs';
5
+
6
+ interface AuthMiContextValue {
7
+ client: AuthMiClient;
8
+ isAuthenticated: boolean;
9
+ user: User | null;
10
+ isLoading: boolean;
11
+ login: (email: string, password: string) => Promise<void>;
12
+ logout: () => Promise<void>;
13
+ validate: () => Promise<ValidationResult>;
14
+ }
15
+ interface AuthMiProviderProps {
16
+ config: AuthMiConfig;
17
+ tokenStorage?: TokenStorage;
18
+ children: ReactNode;
19
+ /**
20
+ * Validate token on mount and periodically
21
+ */
22
+ validateOnMount?: boolean;
23
+ /**
24
+ * Validation interval in milliseconds (default: 5 minutes)
25
+ */
26
+ validationInterval?: number;
27
+ }
28
+ declare function AuthMiProvider({ config, tokenStorage, children, validateOnMount, validationInterval, }: AuthMiProviderProps): react_jsx_runtime.JSX.Element;
29
+ /**
30
+ * Access the Auth Mi context
31
+ */
32
+ declare function useAuthMi(): AuthMiContextValue;
33
+ /**
34
+ * Get the Auth Mi client instance
35
+ */
36
+ declare function useAuthMiClient(): AuthMiClient;
37
+ /**
38
+ * Check if user is authenticated
39
+ */
40
+ declare function useIsAuthenticated(): boolean;
41
+ /**
42
+ * Get current user
43
+ */
44
+ declare function useUser(): User | null;
45
+ /**
46
+ * Login/logout methods
47
+ */
48
+ declare function useAuthActions(): {
49
+ login: (email: string, password: string) => Promise<void>;
50
+ logout: () => Promise<void>;
51
+ isLoading: boolean;
52
+ };
53
+ interface ProtectedProps {
54
+ children: ReactNode;
55
+ fallback?: ReactNode;
56
+ }
57
+ /**
58
+ * Component that only renders children when authenticated
59
+ */
60
+ declare function Protected({ children, fallback }: ProtectedProps): react_jsx_runtime.JSX.Element | null;
61
+ interface LoginFormProps {
62
+ onSuccess?: () => void;
63
+ onError?: (error: Error) => void;
64
+ className?: string;
65
+ }
66
+ declare function LoginForm({ onSuccess, onError, className }: LoginFormProps): react_jsx_runtime.JSX.Element;
67
+
68
+ export { AuthMiClient, AuthMiConfig, AuthMiProvider, LoginForm, Protected, TokenStorage, User, ValidationResult, useAuthActions, useAuthMi, useAuthMiClient, useIsAuthenticated, useUser };
@@ -0,0 +1,68 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode } from 'react';
3
+ import { b as AuthMiConfig, T as TokenStorage, a as AuthMiClient, U as User, V as ValidationResult } from './client-D6JiIhlU.js';
4
+ export { A as ApiKey, c as AuthMiError, d as AuthToken, C as CreateApiKeyRequest, e as CreateApiKeyResponse, f as CreateScopeRequest, g as CreateUserRequest, I as IntrospectRequest, h as IntrospectResponse, L as LocalStorageTokenStorage, i as LoginCredentials, M as MemoryTokenStorage, O as OAuthCallbackResult, j as OAuthInitiateResponse, k as OAuthProvider, l as OnboardRequest, m as OnboardResponse, R as RegisterWebhookRequest, S as Scope, n as ScopeError, o as Service, p as UserListResponse, W as Webhook } from './client-D6JiIhlU.js';
5
+
6
+ interface AuthMiContextValue {
7
+ client: AuthMiClient;
8
+ isAuthenticated: boolean;
9
+ user: User | null;
10
+ isLoading: boolean;
11
+ login: (email: string, password: string) => Promise<void>;
12
+ logout: () => Promise<void>;
13
+ validate: () => Promise<ValidationResult>;
14
+ }
15
+ interface AuthMiProviderProps {
16
+ config: AuthMiConfig;
17
+ tokenStorage?: TokenStorage;
18
+ children: ReactNode;
19
+ /**
20
+ * Validate token on mount and periodically
21
+ */
22
+ validateOnMount?: boolean;
23
+ /**
24
+ * Validation interval in milliseconds (default: 5 minutes)
25
+ */
26
+ validationInterval?: number;
27
+ }
28
+ declare function AuthMiProvider({ config, tokenStorage, children, validateOnMount, validationInterval, }: AuthMiProviderProps): react_jsx_runtime.JSX.Element;
29
+ /**
30
+ * Access the Auth Mi context
31
+ */
32
+ declare function useAuthMi(): AuthMiContextValue;
33
+ /**
34
+ * Get the Auth Mi client instance
35
+ */
36
+ declare function useAuthMiClient(): AuthMiClient;
37
+ /**
38
+ * Check if user is authenticated
39
+ */
40
+ declare function useIsAuthenticated(): boolean;
41
+ /**
42
+ * Get current user
43
+ */
44
+ declare function useUser(): User | null;
45
+ /**
46
+ * Login/logout methods
47
+ */
48
+ declare function useAuthActions(): {
49
+ login: (email: string, password: string) => Promise<void>;
50
+ logout: () => Promise<void>;
51
+ isLoading: boolean;
52
+ };
53
+ interface ProtectedProps {
54
+ children: ReactNode;
55
+ fallback?: ReactNode;
56
+ }
57
+ /**
58
+ * Component that only renders children when authenticated
59
+ */
60
+ declare function Protected({ children, fallback }: ProtectedProps): react_jsx_runtime.JSX.Element | null;
61
+ interface LoginFormProps {
62
+ onSuccess?: () => void;
63
+ onError?: (error: Error) => void;
64
+ className?: string;
65
+ }
66
+ declare function LoginForm({ onSuccess, onError, className }: LoginFormProps): react_jsx_runtime.JSX.Element;
67
+
68
+ export { AuthMiClient, AuthMiConfig, AuthMiProvider, LoginForm, Protected, TokenStorage, User, ValidationResult, useAuthActions, useAuthMi, useAuthMiClient, useIsAuthenticated, useUser };