/** * ============================================================================ * @amaster.ai/auth-client - Type Definitions * ============================================================================ * * 🤖 AI NAVIGATION - Read these files based on your task: * * 1. Need LOGIN/REGISTER/LOGOUT? → Read: ./auth.d.ts * 2. Need PERMISSION checks? → Read: ./permissions.d.ts * 3. Need USER profile management? → Read: ./user.d.ts * 4. Need OAUTH binding? → Read: ./oauth.d.ts * 5. Need SESSION management? → Read: ./sessions.d.ts * * ============================================================================ */ import { HttpClient } from '@amaster.ai/http-client'; import { w as User } from './types-DqwQ2EzH.js'; /** * Permissions Module * * @module permissions * @category Permissions * * Handles permission and role checks: * - Role-based access control (RBAC) * - Permission checks (fast, local) * - Data scope queries (async, server-side) */ interface PermissionsModuleDeps { http: HttpClient; getCurrentUser: () => User | null; storage: { getItem: (key: string) => string | null; }; } declare function createPermissionsModule(deps: PermissionsModuleDeps): { /** * Check if user has a specific role (fast, local check) * * @category Permissions * @performance O(1) - Fast * @example * ```typescript * if (permissions.hasRole("admin")) { * showAdminPanel(); * } * ``` */ hasRole(roleCode: string): boolean; /** * Check if user has a specific permission (fast, local check) * * @category Permissions * @performance O(1) - Fast * @example * ```typescript * if (permissions.hasPermission("user", "delete")) { * showDeleteButton(); * } * ``` */ hasPermission(resource: string, action: string): boolean; /** * Check if user has ANY of the specified permissions * * @category Permissions * @performance O(n) - Fast * @example * ```typescript * if (permissions.hasAnyPermission([{ resource: "user", action: "read" }, { resource: "user", action: "write" }])) { * showUserSection(); * } * ``` */ hasAnyPermission(permissions: Array<{ resource: string; action: string; }>): boolean; /** * Check if user has ALL of the specified permissions * * @category Permissions * @performance O(n) - Fast * @example * ```typescript * if (permissions.hasAllPermissions([{ resource: "user", action: "read" }, { resource: "user", action: "write" }])) { * showFullEditor(); * } * ``` */ hasAllPermissions(permissions: Array<{ resource: string; action: string; }>): boolean; }; type PermissionsModule = ReturnType; export { type PermissionsModule, type PermissionsModuleDeps, createPermissionsModule };