editia-core
Version:
Core services and utilities for Editia applications - Authentication, Monetization, Video Generation Types, and Database Management
144 lines • 5.55 kB
TypeScript
/**
* Type Mapping Configuration for Editia Core
*
* This file provides the connection between raw Supabase types and our abstractions.
* It should be updated when the Database type is imported from generated Supabase types.
*/
import type { Database } from './database';
/**
* Map raw Supabase table types to our abstractions
* This ensures type safety while providing better DX
*/
export type RawUser = Database['public']['Tables']['users']['Row'];
export type RawUserInsert = Database['public']['Tables']['users']['Insert'];
export type RawUserUpdate = Database['public']['Tables']['users']['Update'];
export type RawUserUsage = Database['public']['Tables']['user_usage']['Row'];
export type RawUserUsageInsert = Database['public']['Tables']['user_usage']['Insert'];
export type RawUserUsageUpdate = Database['public']['Tables']['user_usage']['Update'];
export type RawSubscriptionPlan = Database['public']['Tables']['subscription_plans']['Row'];
export type RawSubscriptionPlanInsert = Database['public']['Tables']['subscription_plans']['Insert'];
export type RawSubscriptionPlanUpdate = Database['public']['Tables']['subscription_plans']['Update'];
export type RawFeatureFlag = Database['public']['Tables']['feature_flags']['Row'];
export type RawFeatureFlagInsert = Database['public']['Tables']['feature_flags']['Insert'];
export type RawFeatureFlagUpdate = Database['public']['Tables']['feature_flags']['Update'];
export type RawEditorialProfile = Database['public']['Tables']['editorial_profiles']['Row'];
export type RawEditorialProfileInsert = Database['public']['Tables']['editorial_profiles']['Insert'];
export type RawEditorialProfileUpdate = Database['public']['Tables']['editorial_profiles']['Update'];
export type RawVoiceClone = Database['public']['Tables']['voice_clones']['Row'];
export type RawVoiceCloneInsert = Database['public']['Tables']['voice_clones']['Insert'];
export type RawVoiceCloneUpdate = Database['public']['Tables']['voice_clones']['Update'];
export type RawVideo = Database['public']['Tables']['videos']['Row'];
export type RawVideoInsert = Database['public']['Tables']['videos']['Insert'];
export type RawVideoUpdate = Database['public']['Tables']['videos']['Update'];
/**
* Transform raw user data to our abstraction
*/
export declare const transformUser: (raw: RawUser) => {
id: any;
email: any;
full_name: any;
avatar_url: any;
role: any;
clerk_user_id: any;
stripe_customer_id: any;
created_at: any;
updated_at: any;
};
/**
* Transform raw user usage data to our abstraction
*/
export declare const transformUserUsage: (raw: RawUserUsage) => {
user_id: any;
current_plan_id: any;
videos_generated: any;
videos_generated_limit: any;
source_videos_used: any;
source_videos_limit: any;
voice_clones_used: any;
voice_clones_limit: any;
account_analysis_used: any;
account_analysis_limit: any;
next_reset_date: any;
created_at: any;
updated_at: any;
};
/**
* Transform raw subscription plan data to our abstraction
*/
export declare const transformSubscriptionPlan: (raw: RawSubscriptionPlan) => {
id: any;
name: any;
description: any;
videos_generated_limit: any;
source_videos_limit: any;
voice_clones_limit: any;
account_analysis_limit: any;
is_unlimited: any;
is_active: any;
created_at: any;
};
/**
* Transform raw feature flag data to our abstraction
*/
export declare const transformFeatureFlag: (raw: RawFeatureFlag) => {
id: any;
name: any;
description: any;
required_plan: any;
is_active: any;
created_at: any;
};
/**
* Validate and transform raw data with type safety
*/
export declare const validateAndTransform: {
user: (raw: RawUser) => {
id: any;
email: any;
full_name: any;
avatar_url: any;
role: any;
clerk_user_id: any;
stripe_customer_id: any;
created_at: any;
updated_at: any;
};
userUsage: (raw: RawUserUsage) => {
user_id: any;
current_plan_id: any;
videos_generated: any;
videos_generated_limit: any;
source_videos_used: any;
source_videos_limit: any;
voice_clones_used: any;
voice_clones_limit: any;
account_analysis_used: any;
account_analysis_limit: any;
next_reset_date: any;
created_at: any;
updated_at: any;
};
subscriptionPlan: (raw: RawSubscriptionPlan) => {
id: any;
name: any;
description: any;
videos_generated_limit: any;
source_videos_limit: any;
voice_clones_limit: any;
account_analysis_limit: any;
is_unlimited: any;
is_active: any;
created_at: any;
};
featureFlag: (raw: RawFeatureFlag) => {
id: any;
name: any;
description: any;
required_plan: any;
is_active: any;
created_at: any;
};
};
export type { RawUser, RawUserInsert, RawUserUpdate, RawUserUsage, RawUserUsageInsert, RawUserUsageUpdate, RawSubscriptionPlan, RawSubscriptionPlanInsert, RawSubscriptionPlanUpdate, RawFeatureFlag, RawFeatureFlagInsert, RawFeatureFlagUpdate, RawEditorialProfile, RawEditorialProfileInsert, RawEditorialProfileUpdate, RawVoiceClone, RawVoiceCloneInsert, RawVoiceCloneUpdate, RawVideo, RawVideoInsert, RawVideoUpdate, };
export { transformUser, transformUserUsage, transformSubscriptionPlan, transformFeatureFlag, validateAndTransform, };
//# sourceMappingURL=mapping.d.ts.map