import type { JsonValue } from "../../core/types.js"; import { HsonData } from "../data/hson-data.js"; import type { LiveMapDocumentAttributeValue, LiveMapDocumentAttrs, LiveMapDocumentCommitTarget, LiveMapDocumentContent, LiveMapGraphOp, LiveMapLibraries, HostedLiveMapLibrariesSnapshot, LivePath } from "../../types/livemap.types.js"; import type { LocusActionOrigin, LocusClientActionMessage } from "../../types/locus.types.js"; import type { LiveMapAggregateCommit } from "../livemap/livemap.library.js"; import { type HostedAggregateCommit } from "../livemap/livemap.hosted.js"; import type { PreparedLiveMapAggregateTransition } from "../livemap/livemap.authority.js"; /** Internal routing marker. The enclosed commit is exact aggregate evidence. */ export declare const LOCUS_HOSTED_AGGREGATE_WIRE_FORMAT: "hson-locus-hosted-aggregate-commit"; /** Keep aggregate live traffic inside the existing Locus four-megabyte history budget. */ export declare const DEFAULT_LOCUS_HOSTED_AGGREGATE_MAX_WIRE_BYTES: number; export type LocusHostedAggregateWireEnvelope = Readonly<{ format: typeof LOCUS_HOSTED_AGGREGATE_WIRE_FORMAT; logicalMapId: string; incarnationId: string; registryDigest: string; commit: HostedAggregateCommit; }>; export type LocusHostedAggregateWireMessage = Readonly<{ type: "commit"; id: "hosted-aggregate"; commit: LocusHostedAggregateWireEnvelope; }>; export type LocusHostedAggregateDataDraft = Readonly<{ at: (path: LivePath) => Readonly<{ set: (value: JsonValue) => void; replace: (value: JsonValue) => void; delete: () => void; }>; }>; type LocusHostedAggregateDocumentGraphMutation = Exclude>; export type LocusHostedAggregateDocumentDraft = Readonly<{ /** The selected library is separate from the document-local graph target. */ graph: (operation: LocusHostedAggregateDocumentGraphMutation) => void; attrs: Readonly<{ set: (target: LiveMapDocumentCommitTarget, name: string, value: LiveMapDocumentAttributeValue) => void; drop: (target: LiveMapDocumentCommitTarget, name: string) => void; replace: (target: LiveMapDocumentCommitTarget, attrs: LiveMapDocumentAttrs) => void; }>; content: Readonly<{ replace: (target: LiveMapDocumentCommitTarget, index: number, replacement: LiveMapDocumentContent) => void; insert: (target: LiveMapDocumentCommitTarget, index: number, content: LiveMapDocumentContent) => void; remove: (target: LiveMapDocumentCommitTarget, index: number) => void; move: (target: LiveMapDocumentCommitTarget, from: number, to: number) => void; }>; }>; export type LocusHostedAggregateDraft = Readonly<{ lib: (name: string) => LocusHostedAggregateDataDraft | LocusHostedAggregateDocumentDraft; }>; export type LocusHostedAggregateActionContext = Readonly<{ map: LiveMapLibraries; origin: LocusActionOrigin; /** * Add work to this action's one aggregate candidate. Nothing becomes visible * until the action returns and the single prepared transition is accepted. */ mutate: (mutation: (draft: LocusHostedAggregateDraft) => void) => Promise; }>; export type LocusHostedAggregateAction = (context: LocusHostedAggregateActionContext, payload: HsonData | undefined, message?: LocusClientActionMessage) => unknown | void | Promise; export type LocusHostedAggregateGateInput = Readonly<{ transition: PreparedLiveMapAggregateTransition; commit: HostedAggregateCommit; baseRevision: number; nextRevision: number; }>; export type LocusHostedAggregateOptions = Readonly<{ map: LiveMapLibraries; actions?: Readonly>; /** The existing Locus pre-accept/durability boundary, at aggregate granularity. */ gate?: (input: LocusHostedAggregateGateInput) => void | Promise; /** Optional internal live transport sink. One accepted transition emits once. */ send?: (wire: string) => void; maxWireBytes?: number; }>; export type LocusHostedAggregate = Readonly<{ map: LiveMapLibraries; readonly logicalMapId: string; readonly incarnationId: string; readonly registryDigest: string; readonly rev: number; mutate: (mutation: (draft: LocusHostedAggregateDraft) => void | Promise) => Promise; dispatch_action: (name: string, payload?: HsonData | JsonValue, message?: LocusClientActionMessage, origin?: LocusActionOrigin) => Promise; on_wire: (listener: (wire: string) => void) => () => void; dispose: () => void; }>; export type LocusHostedAggregateClient = Readonly<{ map: LiveMapLibraries; readonly logicalMapId: string; readonly incarnationId: string; readonly registryDigest: string; readonly rev: number; apply_wire: (wire: string) => LiveMapAggregateCommit; }>; /** * Internal aggregate server authority. It owns one existing aggregate LiveMap * and lowers every action into exactly one exact aggregate transition. */ export declare function create_locus_hosted_aggregate_internal(options: LocusHostedAggregateOptions): LocusHostedAggregate; /** * Internal client bootstrap seam for a seeded mirror plus live aggregate * commit replay. */ export declare function create_locus_hosted_aggregate_client_internal(snapshot: HostedLiveMapLibrariesSnapshot, options?: Readonly<{ maxWireBytes?: number; }>): LocusHostedAggregateClient; /** Encode the normal Locus `commit` message with an exact aggregate payload. */ export declare function encode_locus_hosted_aggregate_wire(commit: HostedAggregateCommit, maxWireBytes?: number): string; /** Strict envelope decoder; the aggregate engine then validates the enclosed exact payload. */ export declare function decode_locus_hosted_aggregate_wire(wire: string, expected: Readonly<{ logicalMapId: string; incarnationId: string; registryDigest: string; maxWireBytes?: number; }>): HostedAggregateCommit; /** * Strictly decode the reusable aggregate routing envelope without fabricating a * legacy solo commit. Recovery carries this same object as its commit body. */ export declare function decode_locus_hosted_aggregate_envelope(input: unknown, expected: Readonly<{ logicalMapId: string; incarnationId: string; registryDigest: string; maxWireBytes?: number; }>): HostedAggregateCommit; export {}; //# sourceMappingURL=locus.hosted-multi-library.d.ts.map