import * as plugins from '../plugins.js'; import type { IIdentity } from '../data/user.js'; import type { IWebPushBinding, IWebPushControllerMutation, IWebPushCredentialOneTimeSecret, IWebPushDeliveryStatus, IWebPushNotificationPayload, IWebPushResourceOwner, IWebPushServiceStatus, IWebPushSubscription, TWebPushCancellationTarget, TWebPushUrgency, } from '../data/webpush.js'; /** Control-plane authentication. Never accepted by application delivery RPCs. */ export interface IWebPushControlRequestAuth { identity?: IIdentity; apiToken?: string; } /** Required service credential. Owner scope is resolved exclusively from it. */ export interface IWebPushAppCredentialAuth { credentialId: string; credentialSecret: string; identity?: never; apiToken?: never; } export type TWebPushBindingSync = Omit< IWebPushBinding, 'id' | 'status' | 'credential' | 'vapidKeys' | 'createdAt' | 'updatedAt' | 'createdBy' > & { id?: string; }; export interface IReq_ListWebPushBindings extends plugins.typedrequestInterfaces.implementsTR< plugins.typedrequestInterfaces.ITypedRequest, IReq_ListWebPushBindings > { method: 'listWebPushBindings'; request: { auth: IWebPushControlRequestAuth; owner?: Partial; }; response: { bindings: IWebPushBinding[]; }; } export interface IReq_SyncWebPushBinding extends plugins.typedrequestInterfaces.implementsTR< plugins.typedrequestInterfaces.ITypedRequest, IReq_SyncWebPushBinding > { method: 'syncWebPushBinding'; request: { auth: IWebPushControlRequestAuth; controller: IWebPushControllerMutation; binding: TWebPushBindingSync; }; response: { success: boolean; binding?: IWebPushBinding; credential?: IWebPushCredentialOneTimeSecret; message?: string; }; } export interface IReq_DeleteWebPushBinding extends plugins.typedrequestInterfaces.implementsTR< plugins.typedrequestInterfaces.ITypedRequest, IReq_DeleteWebPushBinding > { method: 'deleteWebPushBinding'; request: { auth: IWebPushControlRequestAuth; owner: IWebPushResourceOwner; id?: string; controller: IWebPushControllerMutation; }; response: { success: boolean; message?: string; }; } export interface IReq_RotateWebPushCredential extends plugins.typedrequestInterfaces.implementsTR< plugins.typedrequestInterfaces.ITypedRequest, IReq_RotateWebPushCredential > { method: 'rotateWebPushCredential'; request: { auth: IWebPushControlRequestAuth; credentialId: string; }; response: { success: boolean; credential?: IWebPushCredentialOneTimeSecret; message?: string; }; } export interface IReq_RotateWebPushVapidKey extends plugins.typedrequestInterfaces.implementsTR< plugins.typedrequestInterfaces.ITypedRequest, IReq_RotateWebPushVapidKey > { method: 'rotateWebPushVapidKey'; request: { auth: IWebPushControlRequestAuth; bindingId: string; }; response: { success: boolean; binding?: IWebPushBinding; message?: string; }; } export interface IReq_GetWebPushServiceStatus extends plugins.typedrequestInterfaces.implementsTR< plugins.typedrequestInterfaces.ITypedRequest, IReq_GetWebPushServiceStatus > { method: 'getWebPushServiceStatus'; request: { auth: IWebPushAppCredentialAuth; owner?: never; }; response: IWebPushServiceStatus; } export interface IReq_EnqueueWebPush extends plugins.typedrequestInterfaces.implementsTR< plugins.typedrequestInterfaces.ITypedRequest, IReq_EnqueueWebPush > { method: 'enqueueWebPush'; request: { auth: IWebPushAppCredentialAuth; /** Required credential-scoped replay key. */ idempotencyKey: string; /** Opaque application identity; never a raw endpoint. */ subscriptionId: string; subscription: IWebPushSubscription; vapidKeyId: string; payload: IWebPushNotificationPayload; ttlSeconds?: number; urgency?: TWebPushUrgency; /** Provider derives an opaque RFC Topic HMAC; this value is never sent raw. */ collapseKey?: string; owner?: never; }; response: { accepted: boolean; spoolItemId?: string; message?: string; }; } export interface IReq_CancelWebPush extends plugins.typedrequestInterfaces.implementsTR< plugins.typedrequestInterfaces.ITypedRequest, IReq_CancelWebPush > { method: 'cancelWebPush'; request: { auth: IWebPushAppCredentialAuth; target: TWebPushCancellationTarget; owner?: never; }; response: { success: boolean; cancelledCount: number; alreadyTerminalCount: number; message?: string; }; } export interface IReq_GetWebPushDeliveryStatus extends plugins.typedrequestInterfaces.implementsTR< plugins.typedrequestInterfaces.ITypedRequest, IReq_GetWebPushDeliveryStatus > { method: 'getWebPushDeliveryStatus'; request: { auth: IWebPushAppCredentialAuth; spoolItemId: string; owner?: never; }; response: { delivery?: IWebPushDeliveryStatus; }; }