import { CalendarError } from "../data/Error"; import { Logger } from "../utils/logger"; import { Channel } from "type-pubsub"; export declare const SHORT_CACHE_DURATION_MS = 60000; export declare const LONG_CACHE_DURATION_MS = 120000; export declare enum EMITTER_TYPE { DELETE = 0, UPDATE = 1, CREATE = 2 } export declare enum QUERY_TYPE { REMOTE_THEN_LOCAL = 0, LOCAL_THEN_REMOTE = 1, LOCAL_ONLY = 2, REMOTE_ONLY = 3 } export interface QUERY_RESULT { result: T | undefined; local: boolean; } export interface QUERY_RESULTS { results: T[]; nextSyncToken?: string; local: boolean; } export interface QUERY_PAGINATED_RESULT { items: T[]; nextPageToken?: string; nextSyncToken?: number; totalItems?: number; } export declare const SERVICE_CHANNEL: Channel; export declare const STAFF_CHANNEL: Channel; export declare const STAFF_GROUP_CHANNEL: Channel; export declare const COMPANY_CHANNEL: Channel; export declare const SCHEDULING_RIGHTS_CHANNEL: Channel; export declare const ACCOUNT_CHANNEL: Channel; export declare const CONTACT_CHANNEL: Channel; export declare const EVENT_CHANNEL: Channel; export declare const RIGHT_CHANNEL: Channel; export declare const SERVICE_RESOURCE_CHANNEL: Channel; export declare const USER_CHANNEL: Channel; export declare const CONFERENCE_CHANNEL: Channel; export declare const CONFERENCE_TAG_CHANNEL: Channel; export declare const CONFERENCE_SESSION_CHANNEL: Channel; export declare abstract class Repository { readonly repositoryName: string; readonly logger?: Logger; readonly cacheDuration?: number; protected static lastRemoteList: { [key: string]: number; }; constructor(repositoryName: string, logger?: Logger, cacheDuration?: number); protected abstract remoteGet(bearer: string, args: A): Promise; protected abstract remoteList(bearer: string, args: A): Promise; protected abstract remoteCreate(bearer: string, args: A, item: T): Promise; protected abstract remoteUpdate(bearer: string, args: A, item: T): Promise; protected abstract remoteDelete(bearer: string, args: A): Promise; protected abstract localList(args: A): Promise; protected abstract localGet(args: A): Promise; protected abstract localBulkSave(args: A, items: T[]): Promise; protected abstract localDelete(args: A): Promise; protected abstract localBulkDelete(items: T[]): Promise; static cleanLastRemoteList(): void; expireDb(): void; protected list(bearer: string, queryType: QUERY_TYPE, args: A): Promise>; protected update(bearer: string, queryType: QUERY_TYPE, args: A, item: T): Promise; protected create(bearer: string, queryType: QUERY_TYPE, args: A, item: T): Promise; protected getById(bearer: string, mode: QUERY_TYPE, args: A): Promise>; protected deleteById(bearer: string, args: A): Promise; protected cascadeDeleteList(args: A, predicate: (item: T) => boolean): Promise; protected cascadeDeleteItem(args: A): Promise; protected cascadeDelete(args: A, predicate?: (item: T) => boolean, list?: boolean): Promise; private _getLocalFirstThenRemote; private _getRemoteFirstThenLocal; private _listRemoteFirstThenLocal; private _listLocalFirstThenRemote; private _createRemoteFirstThenLocal; private _updateRemoteFirstThenLocal; private localSaveList; private localSave; protected _isExpired(lastRemote: number | undefined): boolean; getError(e: unknown): CalendarError; }