64 lines
1.4 KiB
TypeScript
64 lines
1.4 KiB
TypeScript
/**
|
|
* JMAP-specific ServiceObject implementation
|
|
* Extends base ServiceObject with JMAP-specific functionality
|
|
*/
|
|
|
|
import { ServiceObject } from '@KTXM/MailManager/models/service'
|
|
import type { JmapAuxiliary } from '../types/auxiliary'
|
|
|
|
/**
|
|
* JMAP Service Object
|
|
* Provides typed access to JMAP-specific auxiliary data
|
|
*/
|
|
export class JmapServiceObject extends ServiceObject {
|
|
/**
|
|
* Type-safe access to JMAP-specific auxiliary data
|
|
*/
|
|
get jmapAuxiliary(): JmapAuxiliary {
|
|
return (this._data.auxiliary ?? {}) as JmapAuxiliary
|
|
}
|
|
|
|
get hasCore(): boolean {
|
|
return this.jmapAuxiliary.capable?.core === true;
|
|
}
|
|
|
|
get hasMail(): boolean {
|
|
return this.jmapAuxiliary.capable?.mail === true;
|
|
}
|
|
|
|
get hasCalendar(): boolean {
|
|
return this.jmapAuxiliary.capable?.calendar === true;
|
|
}
|
|
|
|
get hasContacts(): boolean {
|
|
return this.jmapAuxiliary.capable?.contacts === true;
|
|
}
|
|
|
|
get hasDocuments(): boolean {
|
|
return this.jmapAuxiliary.capable?.documents === true;
|
|
}
|
|
|
|
/**
|
|
* Get JMAP session URL
|
|
*/
|
|
get sessionUrl(): string | undefined {
|
|
return this.jmapAuxiliary.sessionUrl
|
|
}
|
|
|
|
/**
|
|
* Get JMAP account ID
|
|
*/
|
|
get accountId(): string | undefined {
|
|
return this.jmapAuxiliary.accountId
|
|
}
|
|
|
|
get deleteMode(): 'soft' | 'hard' {
|
|
return this.jmapAuxiliary.deleteMode === 'hard' ? 'hard' : 'soft'
|
|
}
|
|
|
|
get deleteDestination(): string | undefined {
|
|
return this.jmapAuxiliary.deleteDestination
|
|
}
|
|
|
|
}
|