@plyaz/types 1.46.3 → 1.46.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/auth/auth-events.d.ts +10 -0
- package/dist/auth/client.d.ts +57 -0
- package/dist/auth/index.cjs.map +1 -1
- package/dist/auth/index.d.ts +4 -0
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/signin-flow.d.ts +36 -0
- package/dist/auth/signup-flow.d.ts +47 -0
- package/dist/auth/store.d.ts +44 -0
- package/dist/auth/types.d.ts +333 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +5 -3
|
@@ -105,3 +105,13 @@ export interface RoleEventPayload extends AuthEventPayload {
|
|
|
105
105
|
role: string;
|
|
106
106
|
assignedBy?: string;
|
|
107
107
|
}
|
|
108
|
+
export interface AuthAuditEvent {
|
|
109
|
+
userId?: string;
|
|
110
|
+
action: string;
|
|
111
|
+
resource: string;
|
|
112
|
+
resourceId?: string;
|
|
113
|
+
ipAddress?: string;
|
|
114
|
+
userAgent?: string;
|
|
115
|
+
metadata?: Record<string, string>;
|
|
116
|
+
timestamp: Date;
|
|
117
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { AuthAdapterUser, AuthSession, Tokens } from "./adapter-interface";
|
|
2
|
+
import type { AUTHPROVIDER } from "./enums";
|
|
3
|
+
import type { AuthCredentials, AuthUser, ConnectedAccount, Session } from "./types";
|
|
4
|
+
interface Permission {
|
|
5
|
+
resource: string;
|
|
6
|
+
action: string;
|
|
7
|
+
conditions: Record<string, string>;
|
|
8
|
+
}
|
|
9
|
+
export interface AuthPermissions extends AuthUser {
|
|
10
|
+
permissions?: Permission[];
|
|
11
|
+
isActive: boolean;
|
|
12
|
+
isVerified: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface UseAuthReturn {
|
|
15
|
+
user: AuthPermissions | null;
|
|
16
|
+
isAuthenticated: boolean;
|
|
17
|
+
isLoading: boolean;
|
|
18
|
+
error: string | null;
|
|
19
|
+
signIn: (provider?: AUTHPROVIDER, credentials?: AuthCredentials) => Promise<{
|
|
20
|
+
user: AuthAdapterUser;
|
|
21
|
+
session: AuthSession;
|
|
22
|
+
tokens: Tokens;
|
|
23
|
+
}>;
|
|
24
|
+
signUp: (provider: AUTHPROVIDER, data?: unknown) => Promise<void>;
|
|
25
|
+
signOut: () => Promise<void>;
|
|
26
|
+
linkAccount: (userId: string, provider: AUTHPROVIDER, data: ConnectedAccount) => Promise<void | ConnectedAccount>;
|
|
27
|
+
unlinkAccount: (accountId: string) => Promise<void>;
|
|
28
|
+
}
|
|
29
|
+
export interface UseConnectedAccountsReturn {
|
|
30
|
+
accounts: ConnectedAccount[];
|
|
31
|
+
isLoading: boolean;
|
|
32
|
+
linkAccount: (provider: string, credentials: AuthCredentials) => Promise<void>;
|
|
33
|
+
unlinkAccount: (accountId: string) => Promise<void>;
|
|
34
|
+
setPrimaryAccount: (accountId: string) => Promise<void>;
|
|
35
|
+
refreshAccounts: () => Promise<void>;
|
|
36
|
+
}
|
|
37
|
+
export interface UsePermissionsReturn {
|
|
38
|
+
permissions: Permission[];
|
|
39
|
+
hasPermission: (permission: Permission) => boolean;
|
|
40
|
+
hasAnyPermission: (permissions: Permission[]) => boolean;
|
|
41
|
+
hasAllPermissions: (permissions: Permission[]) => boolean;
|
|
42
|
+
}
|
|
43
|
+
export interface UseRBACReturn {
|
|
44
|
+
hasRole: (role: string) => boolean;
|
|
45
|
+
hasAnyRole: (roles: string[]) => boolean;
|
|
46
|
+
hasAllRoles: (roles: string[]) => boolean;
|
|
47
|
+
userRoles: string[];
|
|
48
|
+
isAdmin: boolean;
|
|
49
|
+
isModerator: boolean;
|
|
50
|
+
}
|
|
51
|
+
export interface UseSessionRetrun {
|
|
52
|
+
session: Session | null;
|
|
53
|
+
isValid: boolean;
|
|
54
|
+
expiresAt: Date | null;
|
|
55
|
+
refresh: () => Promise<void>;
|
|
56
|
+
}
|
|
57
|
+
export {};
|