Files
provider_jmapc/src/models/JmapServiceObject.ts
T
Sebastian acc42d09ee
Build Test / test (pull_request) Successful in 35s
JS Unit Tests / test (pull_request) Successful in 33s
PHP Unit Tests / test (pull_request) Successful in 1m5s
refactor: bunch of improvements
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
2026-04-23 22:04:36 -04:00

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
}
}