/** * User Plan & Flag Data Integration * * Provides dynamic retrieval of user plan and flags from the database * via users_metas table. Replaces hardcoded values throughout the system. */ import type { PlanType, UserFlag } from './entities/types'; import type { SessionUser } from './auth'; /** * Interface for user plan and flag data * @property plan - User's subscription plan type (free, starter, premium) * @property flags - Array of feature flags assigned to the user * @property cached - Whether this data was retrieved from cache vs database */ export interface UserPlanData { plan: PlanType; flags: UserFlag[]; cached: boolean; } /** * Custom error class for user data operations */ export declare class UserDataError extends Error { readonly userId: string; readonly operation: string; readonly originalError?: unknown; constructor(message: string, userId: string, operation: string, originalError?: unknown); } /** * Get user plan and flags from database * Uses user_metas table to store plan and flags data * * @throws UserDataError in production when database operations fail */ export declare function getUserPlanAndFlags(userId: string): Promise; /** * Update user plan in database * * @throws UserDataError in production when database operations fail */ export declare function updateUserPlan(userId: string, plan: PlanType): Promise; /** * Update user flags in database * * @throws UserDataError in production when database operations fail */ export declare function updateUserFlags(userId: string, flags: UserFlag[]): Promise; /** * Add user plan and flags to user object (server-side helper) */ export declare function enrichUserWithPlanData(user: SessionUser): Promise; //# sourceMappingURL=user-data.d.ts.map