chore: bunch of improvements
JS Unit Tests / test (pull_request) Successful in 33s
Build Test / test (pull_request) Successful in 36s
PHP Unit Tests / test (pull_request) Successful in 1m12s

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-04-23 22:00:50 -04:00
parent b617234b40
commit 3362afb7ec
28 changed files with 1717 additions and 1297 deletions
+16 -4
View File
@@ -7,6 +7,7 @@ import { defineStore } from 'pinia'
import { serviceService } from '../services'
import { ServiceObject } from '../models/service'
import type {
ServiceIdentifier,
ServiceLocation,
SourceSelector,
ServiceIdentity,
@@ -59,13 +60,23 @@ export const useServicesStore = defineStore('mailServicesStore', () => {
* @returns Service object or null
*/
function service(provider: string, identifier: string | number, retrieve: boolean = false): ServiceObject | null {
const key = identifierKey(provider, identifier)
if (retrieve === true && !_services.value[key]) {
console.debug(`[Mail Manager][Store] - Force fetching service "${key}"`)
return serviceByIdentifier(identifierKey(provider, identifier), retrieve)
}
/**
* Get a service from store by its unique identifier, with optional retrieval
*
* @param identifier - unique service identifier
* @param retrieve - Retrieve behavior: true = fetch if missing or refresh, false = cache only
* @returns Service object or null
*/
function serviceByIdentifier(identifier: ServiceIdentifier, retrieve: boolean = false): ServiceObject | null {
if (retrieve === true && !_services.value[identifier]) {
console.debug(`[Mail Manager][Store] - Force fetching service "${identifier}"`)
fetch(provider, identifier)
}
return _services.value[key] || null
return _services.value[identifier] ?? null
}
/**
@@ -341,6 +352,7 @@ export const useServicesStore = defineStore('mailServicesStore', () => {
// Actions
service,
serviceByIdentifier,
serviceForAddress,
list,
fetch,