export type EventCodecOptions = { objectIdLength?: number; legacy?: boolean; }; type EventSource = string | NodeJS.ArrayBufferView | ArrayBuffer; type EventPayload = Record; type SignalEvent = { sequence: number; type: "ping" | "pong"; payload: EventPayload & { message: string; }; }; type FieldEvent = { sequence: number; type: "setAlias" | "setLanguage" | "submitIdeal" | "submitInner" | "submitOuter" | "acceptIdeal" | "acceptInner" | "acceptOuter" | "alias.updated" | "language.updated" | "ideal.approved" | "implementation.accepted" | "deployment.accepted"; payload: EventPayload; }; type StateEvent = { sequence: number; type: "abandon" | "resume" | "idea.abandoned" | "idea.resumed"; }; export type IdeaEvent = SignalEvent | FieldEvent | StateEvent; export type IdeaEventStatus = Record & { id: string; alias?: string; language?: string; abandoned?: true; approvedRevision?: string; implementationAcceptedRevision?: string; deploymentAcceptedRevision?: string; submittedIdealRevision?: string; submittedImplementationRevision?: string; submittedDeploymentRevision?: string; }; export type IdeaControlOwner = "upstream" | "downstream" | "none"; export interface IdeaControl { owner: IdeaControlOwner; lastTransfer: { sequence: number; type: "ping" | "pong" | "submitIdeal" | "submitInner" | "submitOuter" | "acceptIdeal" | "acceptInner" | "acceptOuter" | "abandon" | "resume"; } | null; } export type IdeaEventState = { status: IdeaEventStatus; sequence: number; interaction?: { messages: Array<{ sequence: number; type: "ping" | "pong"; message: string; }>; }; control?: IdeaControl; }; export type IdeaEventReduction = { ok: false; code: string; sequence: number; } | { ok: true; state: IdeaEventState; }; /** @pure */ export declare function eventLifecycleStatus(status: IdeaEventStatus): { version: 1; id: string; alias?: string; language?: string; abandoned?: true; approvedRevision?: string; implementationAcceptedRevision?: string; deploymentAcceptedRevision?: string; }; export declare const EVENT_RENAMES: Readonly>; export declare const LEGACY_EVENT_TYPES: readonly string[]; export declare const IDEA_EVENT_TYPES: readonly string[]; /** @pure */ export declare function renameLegacyEvents(events: unknown[]): ({ type: string; sequence: number; payload: EventPayload & { message: string; }; } | { type: string; sequence: number; payload: EventPayload; } | { type: string; sequence: number; })[]; export declare const EVENT_PERMISSIONS: Readonly<{ setAlias: "both"; setLanguage: "both"; submitIdeal: "downstream"; submitInner: "downstream"; submitOuter: "downstream"; acceptIdeal: "upstream"; acceptInner: "upstream"; acceptOuter: "upstream"; abandon: "upstream"; resume: "upstream"; ping: "upstream"; pong: "downstream"; }>; export declare class IdeaEventFormatError extends Error { constructor(message: string, options?: ErrorOptions); } /** @pure */ export declare function validateIdeaEvent(event: unknown, options?: EventCodecOptions): IdeaEvent; /** @pure */ export declare function serializeIdeaEvent(event: unknown, options?: EventCodecOptions): string; /** @pure */ export declare function serializeIdeaEvents(events: unknown, options?: EventCodecOptions): string; /** @pure */ export declare function parseIdeaEvents(source: EventSource | undefined, options?: EventCodecOptions): IdeaEvent[]; /** @pure */ export declare function initialEventState(ideaId: string | undefined, options?: EventCodecOptions): IdeaEventState; /** @pure */ export declare function reduceIdeaEvent(before: IdeaEventState, event: unknown, options?: EventCodecOptions): IdeaEventReduction; /** @pure */ export declare function replayIdeaEvents(ideaId: string, events: readonly unknown[], options?: EventCodecOptions): IdeaEventReduction; /** @pure */ export declare function eventsFromStatus(status: IdeaEventStatus & { version: 1; }, options?: EventCodecOptions): ({ sequence: number; type: string | undefined; payload: { [x: string]: string | true | undefined; }; } | { sequence: number; type: string; payload?: never; })[]; /** @pure */ export declare function checkEventChange(ideaId: string, baseSource: EventSource, candidateSource: EventSource, options?: EventCodecOptions): { ok: boolean; mode: string; base: IdeaEventReduction; candidate: { ok: false; code: string; sequence: number; }; code: string; } | { ok: boolean; mode: string; base: { ok: true; state: IdeaEventState; }; candidate: { ok: true; state: IdeaEventState; }; code: string; } | { ok: boolean; mode: string; base: IdeaEventReduction; candidate: { ok: true; state: IdeaEventState; }; code?: never; }; export {}; //# sourceMappingURL=grammar.d.ts.map