@checkfirst/nestjs-outlook
Version:
An opinionated NestJS module for Microsoft Outlook integration that provides easy access to Microsoft Graph API for emails, calendars, and more.
38 lines (37 loc) • 1.32 kB
TypeScript
import { Client } from '@microsoft/microsoft-graph-client';
import { OutlookDeltaLinkRepository } from '../../repositories/outlook-delta-link.repository';
import { Event, Message } from '../../types';
export interface DeltaItem {
lastModifiedDateTime?: string;
createdDateTime: string;
id?: string;
'@removed'?: {
reason: 'changed' | 'deleted';
};
}
export type DeltaEvent = Event & DeltaItem;
export type DeltaMessage = Message & DeltaItem;
export interface DeltaResponse<T> {
'@odata.nextLink'?: string;
'@odata.deltaLink'?: string;
value: T[];
}
export declare class DeltaSyncError extends Error {
readonly code: string;
readonly statusCode: number;
constructor(message: string, code: string, statusCode: number);
}
export declare class DeltaSyncService {
private readonly deltaLinkRepository;
private readonly logger;
private readonly MAX_RETRIES;
private readonly RETRY_DELAY_MS;
constructor(deltaLinkRepository: OutlookDeltaLinkRepository);
private delay;
private retryWithBackoff;
private handleDeltaResponse;
private calculateTokenExpiry;
private handleReplays;
fetchAndSortChanges<T extends DeltaItem>(client: Client, requestUrl: string): Promise<T[]>;
getDeltaLink<T>(response: DeltaResponse<T>): string | null;
}