diff --git a/src/models/collection.ts b/src/models/collection.ts index f5ac01b..a84857b 100644 --- a/src/models/collection.ts +++ b/src/models/collection.ts @@ -2,9 +2,17 @@ * Class model for Collection Interface */ -import type { CollectionInterface, CollectionModelInterface, CollectionPropertiesInterface, CollectionPropertiesModelInterface } from "@/types/collection"; +import type { + CollectionInterface, + CollectionModelInterface, + CollectionPropertiesInterface, + CollectionPropertiesModelInterface +} from "@/types/collection"; import { clonePlain } from './clone-plain'; -import type { CollectionIdentifier, ServiceIdentifier } from "@/services"; +import type { + CollectionIdentifier, + ServiceIdentifier +} from "@/services"; export class CollectionObject implements CollectionModelInterface { @@ -16,9 +24,9 @@ export class CollectionObject implements CollectionModelInterface { '@type': 'mail:collection', version: 1, provider: '', - service: '', - collection: null, - identifier: '', + service: '' as ServiceIdentifier, + collection: null as CollectionIdentifier | null, + identifier: '' as CollectionIdentifier, properties: {'@type': 'mail:folder', label: ''}, }; } diff --git a/src/models/entity.ts b/src/models/entity.ts index d569d0e..0ba4cf8 100644 --- a/src/models/entity.ts +++ b/src/models/entity.ts @@ -19,8 +19,8 @@ export class EntityObject implements EntityModelInterface { version: 1, provider: '', service: '', - collection: null, - identifier: null, + collection: '' as CollectionIdentifier, + identifier: '' as EntityIdentifier, signature: null, created: null, modified: null, diff --git a/src/stores/entitiesStore.ts b/src/stores/entitiesStore.ts index e78f9e2..3aa466e 100644 --- a/src/stores/entitiesStore.ts +++ b/src/stores/entitiesStore.ts @@ -44,13 +44,10 @@ export const useEntitiesStore = defineStore('mailEntitiesStore', () => { /** * Get a specific entity from store, with optional retrieval - * - * @param provider - provider identifier - * @param service - service identifier - * @param collection - collection identifier - * @param identifier - entity identifier + * + * @param target - entity identifier * @param retrieve - Retrieve behavior: true = fetch if missing or refresh, false = cache only - * + * * @returns Entity object or null */ function entity(target: EntityIdentifier, retrieve: boolean = false): EntityObject | null { @@ -64,12 +61,10 @@ export const useEntitiesStore = defineStore('mailEntitiesStore', () => { /** * Get all entities for a specific collection - * - * @param provider - provider identifier - * @param service - service identifier - * @param collection - collection identifier + * + * @param target - collection identifier * @param retrieve - Retrieve behavior: true = fetch if missing or refresh, false = cache only - * + * * @returns Array of entity objects */ function entitiesForCollection(target: CollectionIdentifier, retrieve: boolean = false): EntityObject[] { @@ -117,14 +112,11 @@ export const useEntitiesStore = defineStore('mailEntitiesStore', () => { } } - /** - * Retrieve specific entities by provider, service, collection, and identifiers - * - * @param provider - provider identifier - * @param service - service identifier - * @param collection - collection identifier - * @param identifiers - array of entity identifiers to fetch - * + /** + * Retrieve specific entities by their identifiers + * + * @param targets - array of entity identifiers to fetch + * * @returns Promise with entity objects keyed by identifier */ async function fetch(targets: EntityIdentifier[]): Promise> { diff --git a/src/types/collection.ts b/src/types/collection.ts index 5b84dbe..dc58834 100644 --- a/src/types/collection.ts +++ b/src/types/collection.ts @@ -1,7 +1,12 @@ /** * Collection type definitions */ -import type { CollectionIdentifier, ListFilter, ListSort, ServiceIdentifier } from './common'; +import type { + ServiceIdentifier, + CollectionIdentifier, + ListFilter, + ListSort +} from './common'; /** * Collection information diff --git a/src/types/entity.ts b/src/types/entity.ts index 3cdadd7..0a85f99 100644 --- a/src/types/entity.ts +++ b/src/types/entity.ts @@ -8,7 +8,10 @@ import type { ListRange, ListSort, } from './common'; -import type { MessageInterface, MessageModelInterface } from './message'; +import type { + MessageInterface, + MessageModelInterface +} from './message'; /** * Entity definition diff --git a/src/types/provider.ts b/src/types/provider.ts index 60e0b30..dbc0130 100644 --- a/src/types/provider.ts +++ b/src/types/provider.ts @@ -39,14 +39,14 @@ export interface ProviderListRequest { } export interface ProviderListResponse { - [identifier: string]: ProviderInterface; + [identifier: ProviderIdentifier]: ProviderInterface; } /** * Provider fetch */ export interface ProviderFetchRequest { - target: string; + target: ProviderIdentifier; } export interface ProviderFetchResponse extends ProviderInterface {} @@ -59,5 +59,5 @@ export interface ProviderExtantRequest { } export interface ProviderExtantResponse { - [identifier: string]: boolean; + [identifier: ProviderIdentifier]: boolean; } diff --git a/src/types/service.ts b/src/types/service.ts index f7f3148..22aa2c9 100644 --- a/src/types/service.ts +++ b/src/types/service.ts @@ -5,9 +5,9 @@ import type { ServiceAddressObject } from '@/models/address'; import type { Identity } from '@/models/identity'; import type { Location } from '@/models/location'; import type { + ServiceIdentifier, CollectionIdentifier, ListFilterComparisonOperator, - ServiceIdentifier, } from './common'; /**