import type { ActorRef } from './policy.js'; import type { ActorIdentity, ItemSummary, SynomemEvent } from './types.js'; import type { ParticipationSql } from './participation-repository.js'; export interface Notification { id: string; rootId: string; replyId?: string; eventId: string; sourceSequence: string; deliverySequence: string; reasonCodes: string[]; publishedAt: string; read: boolean; dismissed: boolean; actionRequired: boolean; root?: Pick; } export interface NotificationInput { after?: string; limit?: number; view?: 'all' | 'unread' | 'action_required' | 'default'; } export interface NotificationPage { items: Notification[]; hasMore: boolean; nextCursor?: string; watermark: string; } export interface NotificationRepository { apply(event: SynomemEvent, sequence: bigint): Promise; drain(limit?: number): Promise<{ delivered: number; suppressed: number; }>; list(input: NotificationInput, actor: ActorIdentity): Promise; read(id: string, actor: ActorRef): Promise; dismiss(id: string, actor: ActorRef): Promise; readThrough(through: string, actor: ActorRef): Promise; prune(at: string): Promise; metrics(): Promise<{ pending: string; oldest: string | null; }>; } export interface NotificationSql extends ParticipationSql { canRead(rootId: string, actor: ActorRef): Promise; visibility(actor: ActorIdentity): { sql: string; values: string[]; }; } export declare const notificationTables = "\nCREATE TABLE notification_sequences(workspace_id TEXT PRIMARY KEY,last_sequence BIGINT NOT NULL);\nCREATE TABLE inbox_notifications (\n workspace_id TEXT NOT NULL, notification_id TEXT NOT NULL, event_id TEXT NOT NULL,root_id TEXT NOT NULL,reply_id TEXT,\n recipient_kind TEXT NOT NULL,recipient_id TEXT NOT NULL,source_sequence BIGINT NOT NULL,delivery_sequence BIGINT NOT NULL,\n reasons_json TEXT NOT NULL,published_at TEXT NOT NULL,read_at TEXT,dismissed_at TEXT,\n PRIMARY KEY(workspace_id,notification_id),UNIQUE(workspace_id,event_id,recipient_kind,recipient_id),UNIQUE(workspace_id,delivery_sequence)\n);\nCREATE INDEX inbox_actor_delivery ON inbox_notifications(workspace_id,recipient_kind,recipient_id,delivery_sequence);\nCREATE INDEX inbox_retention ON inbox_notifications(workspace_id,published_at);\nCREATE TABLE notification_fanout_jobs (\n workspace_id TEXT NOT NULL,event_id TEXT NOT NULL,root_id TEXT NOT NULL,source_sequence BIGINT NOT NULL,\n state TEXT NOT NULL CHECK(state IN ('pending','complete')),created_at TEXT NOT NULL,completed_at TEXT,\n PRIMARY KEY(workspace_id,event_id)\n);\nCREATE TABLE notification_fanout_targets (\n workspace_id TEXT NOT NULL,event_id TEXT NOT NULL,recipient_kind TEXT NOT NULL,recipient_id TEXT NOT NULL,\n state TEXT NOT NULL CHECK(state IN ('pending','delivered','suppressed')),completed_at TEXT,\n PRIMARY KEY(workspace_id,event_id,recipient_kind,recipient_id),\n FOREIGN KEY(workspace_id,event_id) REFERENCES notification_fanout_jobs(workspace_id,event_id)\n);\nCREATE INDEX fanout_pending ON notification_fanout_targets(workspace_id,state,event_id,recipient_kind,recipient_id);\n"; export declare class SqlNotificationRepository implements NotificationRepository { private readonly sql; constructor(sql: NotificationSql); private get workspace(); private publish; apply(event: SynomemEvent, sequence: bigint): Promise; drain(limit?: number): Promise<{ delivered: number; suppressed: number; }>; list(input: NotificationInput, actor: ActorIdentity): Promise; read(id: string, actor: ActorRef): Promise; dismiss(id: string, actor: ActorRef): Promise; readThrough(through: string, actor: ActorRef): Promise; metrics(): Promise<{ pending: string; oldest: string | null; }>; prune(at: string): Promise; } //# sourceMappingURL=notifications.d.ts.map