mya-cli
Version:
MYA - AI-Powered Stock & Options Analysis CLI Tool
73 lines (72 loc) • 1.83 kB
TypeScript
/**
* Storage related interfaces
* These define contracts for data persistence across the application
*/
/**
* Token storage provider capabilities
*/
export interface TokenStorage {
/**
* Save authentication token data
* @param data Token data to save
*/
saveToken(data: TokenData): void;
/**
* Retrieve stored authentication token data
* @returns Token data if valid, null otherwise
*/
getToken(): TokenData | null;
/**
* Clear stored authentication token
*/
clearToken(): void;
}
/**
* Token data structure
*/
export interface TokenData {
token: string;
session_token?: string;
email: string;
userId: string;
expiresAt: number;
}
/**
* Configuration storage provider capabilities
*/
export interface ConfigStorage {
/**
* Get a configuration value
* @param key Configuration key
* @param defaultValue Optional default value if key not found
* @returns The configuration value or default
*/
get<T>(key: string, defaultValue?: T): T | undefined;
/**
* Set a configuration value
* @param key Configuration key
* @param value Configuration value
*/
set<T>(key: string, value: T): void;
/**
* Remove a configuration value
* @param key Configuration key
*/
remove(key: string): void;
}
/**
* Environment variable provider capabilities
*/
export interface EnvironmentProvider {
/**
* Load environment variables from source
*/
loadEnvironment(): void;
/**
* Get an environment variable
* @param name Environment variable name
* @param defaultValue Optional default value if not found
* @returns The environment variable value or default
*/
get(name: string, defaultValue?: string): string | undefined;
}