Initial commit

This commit is contained in:
root
2025-12-21 09:59:17 -05:00
committed by Sebastian Krupinski
commit 974d3fe11b
53 changed files with 7555 additions and 0 deletions
+62
View File
@@ -0,0 +1,62 @@
/**
* Chrono Manager - Providers Store
*/
import { defineStore } from 'pinia';
import { ref } from 'vue';
import { providerService } from '../services/providerService';
import type {
SourceSelector,
ProviderInterface,
} from '../types';
export const useProvidersStore = defineStore('chronoProvidersStore', () => {
// State
const providers = ref<Record<string, ProviderInterface>>({});
// Actions
/**
* List all available providers
*
* @returns Promise with provider list keyed by provider ID
*/
async function list(): Promise<Record<string, ProviderInterface>> {
try {
const response = await providerService.list();
console.debug('[Chrono Manager](Store) - Successfully retrieved', Object.keys(response).length, 'providers:', Object.keys(response));
providers.value = response;
return response;
} catch (error: any) {
console.error('[Chrono Manager](Store) - Failed to retrieve providers:', error);
throw error;
}
}
/**
* Check which providers exist/are available
*
* @param sources - Source selector with provider IDs to check
* @returns Promise with provider availability status
*/
async function extant(sources: SourceSelector): Promise<Record<string, boolean>> {
try {
const response = await providerService.extant(sources);
return response;
} catch (error: any) {
console.error('[Chrono Manager](Store) - Failed to check provider existence:', error);
throw error;
}
}
return {
// State
providers,
// Actions
list,
extant,
};
});