export type TinyPushNotification = import('../../utils.mjs').TinyPushNotification; export type TinyPushMessage = import('../../utils.mjs').TinyPushMessage; export type TinyPushNotificationDefaults = { /** * - Fallback icon. */ defaultIcon?: string; /** * - Fallback badge. */ defaultBadge?: string; /** * - Fallback click URL. */ defaultUrl?: string; }; /** * Normalizes, validates and converts Web Push payloads. * * Every method is static and side effect free, so the class is safe to import * from both the page and the Service Worker. * @beta */ declare class TinyPushPayload { #private; static get PUSH_TYPE(): Readonly<{ NOTIFICATION: "notification"; DATA: "data"; SYNC: "sync"; COMMAND: "command"; UNKNOWN: "unknown"; }>; /** @type {number} The current payload schema version. */ static VERSION: number; /** @type {number} The maximum allowed TTL, in seconds. */ static MAX_TTL: number; /** * Builds a normalized message from an untrusted value. * * @param {unknown} raw - The value received from the network. * @returns {TinyPushMessage} A frozen, normalized message. * @throws {TypeError} If `raw` is not a non-null object. */ static from(raw: unknown): TinyPushMessage; /** * Reads the payload of a `push` event exactly once. * * `PushMessageData` is a one-shot stream: calling `json()` and then `text()` * throws `TypeError`. This method reads the body once and parses it manually. * * @param {PushEvent} event - The native push event. * @returns {Promise} The normalized message, never `null`. */ static fromEvent(event: PushEvent): Promise; /** * Checks whether a message is past its expiration time. * * @param {TinyPushMessage} message - The message to inspect. * @param {number} [now=Date.now()] - Reference time in milliseconds. * @returns {boolean} `true` when the message must be discarded. * @throws {TypeError} If `message` is not a non-null object or `now` is not a finite number. */ static isExpired(message: TinyPushMessage, now?: number): boolean; /** * Converts a message into the `[title, options]` pair expected by `showNotification`. * * @param {TinyPushMessage} message - The normalized message. * @param {TinyPushNotificationDefaults} [defaults] - Fallback values. * @returns {{ title: string, options: NotificationOptions & { data: Record } }} The arguments. * @throws {TypeError} If `message` is not a non-null object. */ static toNotification(message: TinyPushMessage, defaults?: TinyPushNotificationDefaults): { title: string; options: NotificationOptions & { data: Record; }; }; } export default TinyPushPayload; //# sourceMappingURL=TinyPushPayload.d.mts.map