refactor: docs and styling
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
@@ -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: ''},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
+11
-19
@@ -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<Record<string, EntityObject>> {
|
||||
|
||||
@@ -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
|
||||
|
||||
+4
-1
@@ -8,7 +8,10 @@ import type {
|
||||
ListRange,
|
||||
ListSort,
|
||||
} from './common';
|
||||
import type { MessageInterface, MessageModelInterface } from './message';
|
||||
import type {
|
||||
MessageInterface,
|
||||
MessageModelInterface
|
||||
} from './message';
|
||||
|
||||
/**
|
||||
* Entity definition
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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';
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user