import * as plugins from '../plugins.js'; import { WebPushBindingDoc, WebPushSpoolDoc, type IWebPushStoredCredential, type TWebPushControllerIntent } from '../db/index.js'; import { type IWebPushTransport } from './classes.webpush-transport.js'; type IWebPushBinding = plugins.servezoneInterfaces.data.IWebPushBinding; type IWebPushCredentialOneTimeSecret = plugins.servezoneInterfaces.data.IWebPushCredentialOneTimeSecret; type IWebPushDeliveryStatus = plugins.servezoneInterfaces.data.IWebPushDeliveryStatus; type IWebPushNotificationPayload = plugins.servezoneInterfaces.data.IWebPushNotificationPayload; type IWebPushResourceOwner = plugins.servezoneInterfaces.data.IWebPushResourceOwner; type IWebPushServiceStatus = plugins.servezoneInterfaces.data.IWebPushServiceStatus; type IWebPushSubscription = plugins.servezoneInterfaces.data.IWebPushSubscription; type TWebPushBindingSync = plugins.servezoneInterfaces.requests.webpush.TWebPushBindingSync; type IWebPushAppCredentialAuth = plugins.servezoneInterfaces.requests.webpush.IWebPushAppCredentialAuth; type TWebPushCancellationTarget = plugins.servezoneInterfaces.data.TWebPushCancellationTarget; type TWebPushDeliveryState = plugins.servezoneInterfaces.data.TWebPushDeliveryState; type TWebPushUrgency = plugins.servezoneInterfaces.data.TWebPushUrgency; interface IWebPushQenv { getEnvVarOnDemand(nameArg: string): Promise; } export interface IWebPushManagerOptions { qenv?: IWebPushQenv; transport?: IWebPushTransport; startWorker?: boolean; now?: () => number; admissionPolicy?: Partial; } export interface IWebPushAdmissionPolicy { shortWindowMs: number; shortLimit: number; longWindowMs: number; longLimit: number; } export interface IWebPushAuthenticatedBinding { binding: WebPushBindingDoc; credential: IWebPushStoredCredential; } export interface IWebPushBindingSyncResult { binding: IWebPushBinding; credential?: IWebPushCredentialOneTimeSecret; } /** * Durable controller ordering token. The controller id and epoch remain stable * for an owner, while generation increases for every desired-state mutation. */ export interface IWebPushControllerMutation { id: string; epoch: string; generation: number; operationId: string; intent: TWebPushControllerIntent; } export interface IWebPushBindingDelete { id?: string; owner: IWebPushResourceOwner; controller: IWebPushControllerMutation; } export interface IWebPushEnqueueResult { accepted: boolean; spoolItemId: string; } export interface IWebPushCancelResult { cancelledCount: number; alreadyTerminalCount: number; } export declare function toPublicWebPushBinding(bindingArg: WebPushBindingDoc): IWebPushBinding; export declare function toPublicWebPushDelivery(spoolArg: WebPushSpoolDoc): IWebPushDeliveryStatus; export declare function buildWebPushTerminalUpdate(optionsArg: { state: Extract; now: number; pushServiceStatusCode?: number; errorCode?: string; }): Record; export declare class WebPushManager { private readonly qenv; private readonly transport; private readonly startWorker; private readonly now; private readonly admissionPolicy; private enabled; private started; private ready; private crypto?; private vapidSubject?; private workerTimer?; private activeWorkerCycle?; private expiredCredentialOverlapCursor?; private expiredCredentialRecoveryCursor?; private retiredVapidCursor?; private inactiveLifecycleCursor?; constructor(optionsArg?: IWebPushManagerOptions); get isEnabled(): boolean; get isReady(): boolean; start(): Promise; stop(): Promise; getUnavailableServiceStatus(): IWebPushServiceStatus; listBindings(ownerFilterArg?: Partial): Promise; getBindingById(idArg: string): Promise; getBindingByCredentialId(credentialIdArg: string): Promise; syncBinding(bindingArg: TWebPushBindingSync, controllerArg: IWebPushControllerMutation, createdByArg: string): Promise; private resumeControllerSyncReplay; deleteBinding(deleteArg: IWebPushBindingDelete, deletedByArg: string): Promise; private resumeControllerDeleteReplay; rotateCredential(credentialIdArg: string): Promise; rotateVapidKey(bindingIdArg: string): Promise; authenticateAppCredential(authArg: IWebPushAppCredentialAuth): Promise; getServiceStatus(authArg: IWebPushAppCredentialAuth): Promise; enqueue(authArg: IWebPushAppCredentialAuth, requestArg: { idempotencyKey: string; subscriptionId: string; subscription: IWebPushSubscription; vapidKeyId: string; payload: IWebPushNotificationPayload; ttlSeconds?: number; urgency?: TWebPushUrgency; collapseKey?: string; }): Promise; getDeliveryStatus(authArg: IWebPushAppCredentialAuth, spoolItemIdArg: string): Promise; cancel(authArg: IWebPushAppCredentialAuth, targetArg: TWebPushCancellationTarget): Promise; processDueDeliveriesOnce(limitArg?: number): Promise; private requirePersistenceReady; private requireReady; private bindingOwner; private assertBindingOwner; private credentialHmacValue; private createCredential; private credentialRotationRecoveryAad; private replayCredentialRotation; private createVapidKey; private spoolAadBase; private assertBindingLifecycleActive; private reserveAdmission; private cancelSpoolIfLifecycleChanged; private scrubDeletedBindingLifecycle; private cleanupExpiredCredentialOverlaps; private cleanupExpiredCredentialRotationRecoveries; private cleanupRetiredVapidKeys; private runMaintenanceOnce; private cleanupInactiveBindingLifecycles; private selectBindingMaintenanceBatch; private requestBindingLifecyclesBeforeCancellation; private drainBindingLifecyclesBefore; private waitForBindingLifecyclesBeforeDrain; private finishStaleCancelledSending; private finishStaleCancelledSendingBefore; private cancelWithinBinding; private expireDueItems; private claimNextItem; private processClaimedItem; private finishTerminal; private deferOrFinish; private retryDelayMs; private scheduleWorker; } export {};