import { BaseConnector } from '../../base/base.connector'; import type { IPushOptions, IPushProvider, ISendMessageSuccessResponse, WithPassthrough, PushSendResult, IPushConnector } from '../../types'; import { ChannelTypeEnum } from '../../types'; import type { PusherBeamsConfig } from './pusher-beams.config'; import type { PusherBeamsPushSendInput } from './pusher-beams.types'; /** * Pusher Beams push connector. * * **Canonical outlier example.** Beams requires * the publisher to send BOTH an FCM-formatted payload AND an APNs-formatted * payload in the same request (plus optionally a Web push payload). Beams' * server fans those payloads out to subscribed devices based on each * device's registered token type. * * To preserve Thinwrap's uniform `PushSendInput` base shape, this * connector synthesizes the nested platform payloads inside its `.send()` * method via the private `synthesizeWirePayload()` helper. The synthesis * lives **here, in the connector file** — not in `src/utils/` or * `src/base/` — following the "outlier wire-translation locality" discipline. */ export declare class PusherBeamsPushConnector extends BaseConnector implements IPushProvider, IPushConnector { private config; readonly id: "pusher-beams"; readonly channelType: ChannelTypeEnum.PUSH; constructor(config: PusherBeamsConfig, fetchImpl?: typeof fetch); /** * Thinwrap-native send. Implements `IPushConnector`. * * Routing precedence: * 1. `input.interests` set → `/publishes/interests`, body has `interests`. * 2. `input.users` set → `/publishes/users`, body has the supplied users array. * 3. Default → `/publishes/users`, body has `users: [input.to]`. * * Auth: `Authorization: Bearer ` (long-lived static secret — * no token signing, no caching). * * Errors map to canonical `ConnectorError` via `mapVendorError`. Per * Retry is consumer policy (no retryAfterSeconds field), no * structured `retryAfterSeconds` field — parsed seconds embedded in * `providerMessage` text, raw header on `cause.retryAfter`. */ send(input: PusherBeamsPushSendInput): Promise; /** * ** outlier synthesis — canonical TS example.** * * Build the Beams wire body from the base `PushSendInput` fields. The * synthesis assembles three parallel platform payloads (`fcm`, `apns`, * `web`) and merges in any consumer-supplied augmentations via shallow * spread. Beams' server fans the request out to subscribed devices. * * Why connector-local: Beams is the only push provider in * v1.0 with this requirement. A shared "wire translator" middleware * would be a generic-abstraction trap. Maintainers reading this file * see the entire request construction in one place. */ private synthesizeWirePayload; /** * Map Pusher Beams HTTP error responses to canonical `ConnectorError` * . Beams' error body shape is `{ error: string, description?: string }`. * * Retry-After surfacing * Retry is consumer policy (no retryAfterSeconds field): parsed seconds appended to * `providerMessage` text; raw header on `cause.retryAfter`. No structured * `retryAfterSeconds` field on `ConnectorError`. */ private mapVendorError; sendMessage(options: IPushOptions, bridgeProviderData?: WithPassthrough>): Promise; }