UNPKG

editia-core

Version:

Core services and utilities for Editia applications - Authentication, Monetization, Video Generation Types, and Database Management

94 lines 3.23 kB
/** * Compatibility Layer for Editia Core Types * * This file provides backward compatibility for existing code while * encouraging migration to the new strongly-typed system. */ /** * Brand utility type for creating distinct types from primitives * This prevents accidental mixing of similar primitive values */ export type Brand<T, K> = T & { __brand: K; }; import type { FeatureId, Action, UsageField } from './monetization'; import type { UserUsage as NewUserUsage } from './usage-tracking'; /** * @deprecated Use FeatureId instead */ export type FeatureIdLegacy = string; /** * @deprecated Use Action instead */ export type ActionLegacy = 'video_generation' | 'source_video_upload' | 'voice_clone' | 'account_analysis' | 'script_conversations'; /** * @deprecated Use UsageField instead */ export type UsageFieldLegacy = 'videos_generated' | 'source_videos_used' | 'voice_clones_used' | 'account_analysis_used' | 'script_conversations_used'; /** * @deprecated Use UserUsage from './usage-tracking' instead */ export interface UserUsageLegacy { user_id: string; current_plan_id: string; videos_generated: number; videos_generated_limit: number; source_videos_used: number; source_videos_limit: number; voice_clones_used: number; voice_clones_limit: number; account_analysis_used: number; account_analysis_limit: number; script_conversations_used: number; script_conversations_limit: number; next_reset_date: string; created_at?: string; updated_at?: string; } /** * Convert legacy string to FeatureId with validation * @deprecated Use FEATURES constants directly */ export declare function toFeatureId(legacyFeature: string): FeatureId; /** * Convert legacy string to Action with validation * @deprecated Use ACTIONS constants directly */ export declare function toAction(legacyAction: string): Action; /** * Convert legacy string to UsageField with validation * @deprecated Use USAGE_FIELDS constants directly */ export declare function toUsageField(legacyField: string): UsageField; /** * Convert new UserUsage to legacy format * @deprecated Use new UserUsage type directly */ export declare function toLegacyUserUsage(newUsage: NewUserUsage): UserUsageLegacy; /** * Show deprecation warning in development */ export declare function showDeprecationWarning(oldUsage: string, newUsage: string): void; /** * @deprecated Use FEATURES constants instead */ export declare const LEGACY_FEATURES: { readonly VIDEO_GENERATION: "video_generation"; readonly SOURCE_VIDEOS: "source_videos"; readonly VOICE_CLONE: "voice_clone"; readonly ACCOUNT_ANALYSIS: "account_analysis"; readonly SCRIPT_CONVERSATIONS: "script_conversations"; readonly SCRIPT_GENERATION: "script_generation"; readonly CHAT_AI: "chat_ai"; }; /** * @deprecated Use ACTIONS constants instead */ export declare const LEGACY_ACTIONS: { readonly VIDEO_GENERATION: "video_generation"; readonly SOURCE_VIDEO_UPLOAD: "source_video_upload"; readonly VOICE_CLONE: "voice_clone"; readonly ACCOUNT_ANALYSIS: "account_analysis"; readonly SCRIPT_CONVERSATIONS: "script_conversations"; }; //# sourceMappingURL=compatibility.d.ts.map