import type { OfficeAddress } from "../types.js"; export type EventPayload = EventFilePayload; export interface EventRecord { filename: string; payload: EventFilePayload; size: number; mtimeMs: number; } export interface EventStore { readonly address: OfficeAddress; create(filename: string, payload: EventFilePayload): Promise<{ path: string; size: number; }>; list(): Promise & { payload: EventFilePayload | null; }>>; read(filename: string): Promise; update(filename: string, payload: EventFilePayload): Promise<{ path: string; size: number; }>; delete(filename: string): Promise; } export interface EventScheduleSink { scheduleRecord(address: OfficeAddress, record: EventRecord): void; cancelRecord(address: OfficeAddress, filename: string): void; } type EventConversationKind = "direct" | "shared"; type EventType = "immediate" | "one-shot" | "periodic"; interface EventPayloadBase { platform?: string; conversationId: string; conversationKind?: EventConversationKind; userId?: string; text: string; } interface ImmediateEventPayload extends EventPayloadBase { type: "immediate"; } interface OneShotEventPayload extends EventPayloadBase { type: "one-shot"; at: string; } interface PeriodicEventPayload extends EventPayloadBase { type: "periodic"; schedule: string; timezone: string; } export type EventFilePayload = ImmediateEventPayload | OneShotEventPayload | PeriodicEventPayload; export interface EventPayloadInput { type: EventType; platform?: string; conversationId: string; conversationKind?: EventConversationKind; userId?: string; text: string; at?: string; schedule?: string; timezone?: string; } interface ResolvedEventFields { platform: string; conversationKind: EventConversationKind; } export type MikanEvent = (ImmediateEventPayload & ResolvedEventFields) | (OneShotEventPayload & ResolvedEventFields) | (PeriodicEventPayload & ResolvedEventFields); export interface PeriodicEventInfo { platform: string; conversationId: string; text: string; schedule: string; nextRun: string | null; } import { Type } from "typebox"; export declare const EventTypeSchema: Type.TUnion<[Type.TLiteral<"immediate">, Type.TLiteral<"one-shot">, Type.TLiteral<"periodic">]>; export declare function validateEventFilename(filename: string): string; export declare function parseEventPayload(content: string, filename: string): EventFilePayload; export declare function buildEventPayload(input: EventPayloadInput): EventFilePayload; export declare function upcomingRuns(schedule: string, timezone: string, count: number): Date[]; import type { Office } from "../office/types.js"; export declare function officeEventsDir(office: Office): string; export declare class OfficeEventStore implements EventStore { private readonly office; private readonly scheduler?; readonly address: OfficeAddress; private readonly eventsDir; constructor(office: Office, scheduler?: EventScheduleSink | undefined); create(filename: string, payload: EventPayload): Promise<{ path: string; size: number; }>; list(): Promise & { payload: EventPayload | null; }>>; read(filename: string): Promise; update(filename: string, payload: EventPayload): Promise<{ path: string; size: number; }>; delete(filename: string): Promise; private assertOwnPayload; private writeRecord; } export {}; //# sourceMappingURL=index.d.ts.map